of 347 /347
Xilinx Standalone Library Documentation OS and Libraries Document Collection UG643 (2017.4) December 20, 2017

Xilinx Standalone Library Documentation · Xilinx Standalone Library Documentation OS and Libraries Document ... MicroBlaze Processor ... Macro Definition Documentation

Embed Size (px)

Text of Xilinx Standalone Library Documentation · Xilinx Standalone Library Documentation OS and Libraries...

  • Xilinx Standalone LibraryDocumentation

    OS and Libraries DocumentCollection

    UG643 (2017.4) December 20, 2017

  • Table of Contents

    Chapter 1: Xilinx OS and Libraries OverviewAbout the Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    Library Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    Xilinx Standard C Libraries

    Chapter 2: Xilinx Standard C LibrariesOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    Standard C Library (libc.a) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    Xilinx C Library (libxil.a) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    Memory Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    Arithmetic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23MicroBlaze Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    Thread Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    Input/Output Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    Standalone (v6.5 )

    Chapter 3: Xilinx Hardware Abstraction Layer APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    Assert APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    Variable Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    IO interfacing APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 2Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=2

  • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    Definitions for available xilinx platforms . . . . . . . . . . . . . . . . . . . . . . . . 39Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

    Data types for Xilinx Software IP Cores . . . . . . . . . . . . . . . . . . . . . . . . . 40Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    Customized APIs for memory operations . . . . . . . . . . . . . . . . . . . . . . . . 43Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    Xilinx software status codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Test utilities for memory and caches . . . . . . . . . . . . . . . . . . . . . . . . . . 44Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

    Chapter 4: Microblaze Processor APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    Microblaze Pseudo-asm Macros and Interrupt handling APIs . . . . . . . . . . . . 50Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Microblaze exception APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    Data Structure Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    Microblaze Processor Cache APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    MicroBlaze Processor FSL Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . 62Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Microblaze PVR access routines and macros . . . . . . . . . . . . . . . . . . . . . 64

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 3Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=3

  • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

    Sleep Routines for Microblaze . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    Chapter 5: Cortex R5 Processor APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Cortex R5 Processor Boot Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Cortex R5 Processor MPU specific APIs . . . . . . . . . . . . . . . . . . . . . . . . 78Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

    Cortex R5 Processor Cache Functions . . . . . . . . . . . . . . . . . . . . . . . . . 80Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

    Cortex R5 Time Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    Cortex R5 Event Counters Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 87Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    Cortex R5 Processor Specific Include Files . . . . . . . . . . . . . . . . . . . . . . 88Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    Chapter 6: ARM Processor Common APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    ARM Processor Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

    Chapter 7: Cortex A9 Processor APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    Cortex A9 Processor Boot Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    Cortex A9 Processor Cache Functions . . . . . . . . . . . . . . . . . . . . . . . . . 97

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 4Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=4

  • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    Cortex A9 Processor MMU Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 112Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

    Cortex A9 Time Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

    Cortex A9 Event Counter Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 115Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

    PL310 L2 Event Counters Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 116Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

    Cortex A9 Processor and pl310 Errata Support . . . . . . . . . . . . . . . . . . . . 118Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

    Cortex A9 Processor Specific Include Files . . . . . . . . . . . . . . . . . . . . . . 119

    Chapter 8: Cortex A53 32-bit Processor APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

    Cortex A53 32-bit Processor Boot Code . . . . . . . . . . . . . . . . . . . . . . . . 120Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

    Cortex A53 32-bit Processor Cache Functions . . . . . . . . . . . . . . . . . . . . . 122Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

    Cortex A53 32-bit Processor MMU Handling . . . . . . . . . . . . . . . . . . . . . . 127Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

    Cortex A53 32-bit Mode Time Functions . . . . . . . . . . . . . . . . . . . . . . . . 128Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

    Cortex A53 32-bit Processor Specific Include Files . . . . . . . . . . . . . . . . . . 129

    Chapter 9: Cortex A53 64-bit Processor APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

    Cortex A53 64-bit Processor Boot Code . . . . . . . . . . . . . . . . . . . . . . . . 130Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 5Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=5

  • Cortex A53 64-bit Processor Cache Functions . . . . . . . . . . . . . . . . . . . . . 131Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

    Cortex A53 64-bit Processor MMU Handling . . . . . . . . . . . . . . . . . . . . . . 136Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    Cortex A53 64-bit Mode Time Functions . . . . . . . . . . . . . . . . . . . . . . . . 137Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

    Cortex A53 64-bit Processor Specific Include Files . . . . . . . . . . . . . . . . . . 138

    XilMFS Library (v2.3 )

    Chapter 10: Overview

    Chapter 11: XilMFS Library APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142mfs_init_fs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

    mfs_init_genimage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

    mfs_change_dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

    mfs_delete_file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

    mfs_create_dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

    mfs_delete_dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

    mfs_rename_file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

    mfs_exists_file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

    mfs_get_current_dir_name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

    mfs_get_usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

    mfs_dir_open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

    mfs_dir_close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

    mfs_dir_read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

    mfs_file_open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

    mfs_file_read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

    mfs_file_write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

    mfs_file_close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

    mfs_file_lseek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    mfs_ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 6Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=6

  • mfs_ls_r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    mfs_cat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    mfs_copy_stdin_to_file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

    mfs_file_copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

    Chapter 12: Utility Functions

    Chapter 13: Library Parameters in MSS File

    LwIP 1.4.1 Library (v2_0 )

    Chapter 14: IntroductionFeatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

    Chapter 15: Using lwIPOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

    Setting up the Hardware System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

    Setting up the Software System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157Configuring lwIP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

    Customizing lwIP API Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

    Configuring Xilinx Adapter Options . . . . . . . . . . . . . . . . . . . . . . . . . . 160

    Configuring Memory Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

    Configuring Packet Buffer (Pbuf) Memory Options . . . . . . . . . . . . . . . . . . 164

    Configuring ARP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

    Configuring IP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

    Configuring ICMP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

    Configuring IGMP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

    Configuring UDP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

    Configuring TCP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

    Configuring DHCP Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

    Configuring the Stats Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

    Configuring the Debug Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

    Chapter 16: LwIP Library APIsOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

    Raw API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170Xilinx Adapter Requirements when using the RAW API . . . . . . . . . . . . . . . 170

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 7Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=7

  • LwIP Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

    RAW API Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

    Socket API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171Xilinx Adapter Requirements when using the Socket API . . . . . . . . . . . . . . 172

    Xilkernel/FreeRTOS scheduling policy when using the Socket API . . . . . . . . . 172

    Socket API Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

    Using the Xilinx Adapter Helper Functions . . . . . . . . . . . . . . . . . . . . . . . 173lwip_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    xemac_add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    xemacif_input_thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    xemacif_input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    xemacpsif_resetrx_on_no_rxdata . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

    XilFlash Library (v4.4 )

    Chapter 17: OverviewLibrary Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    Device Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177Intel Flash Device Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    AMD Flash Device Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    Write Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    Read Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    Erase Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    Sector Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    Device Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    Chapter 18: XilFlash Library APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180XFlash_Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

    XFlash_Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

    XFlash_DeviceControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

    XFlash_Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

    XFlash_Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

    XFlash_Erase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

    XFlash_Lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

    XFlash_Unlock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 8Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=8

  • XFlash_IsReady . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

    Chapter 19: Library Parameters in MSS File

    XilIsf Library (v5.9 )

    Chapter 20: OverviewSupported Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

    Chapter 21: XilIsf Library APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191XIsf_Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

    XIsf_GetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

    XIsf_GetStatusReg2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

    XIsf_GetDeviceInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

    XIsf_Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

    XIsf_Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

    XIsf_Erase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

    XIsf_MicronFlashEnter4BAddMode . . . . . . . . . . . . . . . . . . . . . . . . . . 199

    XIsf_MicronFlashExit4BAddMode . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

    XIsf_SectorProtect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

    XIsf_Ioctl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

    XIsf_WriteEnable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

    XIsf_RegisterInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

    XIsf_SetSpiConfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

    XIsf_SetStatusHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

    XIsf_IfaceHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

    Chapter 22: Library Parameters in MSS File

    XilFFS Library (v3.7 )

    Chapter 23: OverviewLibrary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 9Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=9

  • Choosing a File System with an SD Interface . . . . . . . . . . . . . . . . . . . . . 209

    Chapter 24: Library Parameters in MSS File

    XilSecure Library (v2.2 )

    Chapter 25: Overview

    Chapter 26: AES-GCMOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216XSecure_AesInitialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

    XSecure_AesDecryptInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

    XSecure_AesDecryptUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

    XSecure_AesDecryptData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

    XSecure_AesDecrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

    XSecure_AesEncryptInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

    XSecure_AesEncryptUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

    XSecure_AesEncryptData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

    XSecure_AesReset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

    XSecure_AesWaitForDone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

    AES-GCM API Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

    Chapter 27: RSAOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226XSecure_RsaInitialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

    XSecure_RsaDecrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

    XSecure_RsaSignVerification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

    XSecure_RsaPublicEncrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

    XSecure_RsaPrivateDecrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228

    RSA API Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

    Chapter 28: SHA-3Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234XSecure_Sha3Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 10Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=10

  • XSecure_Sha3Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

    XSecure_Sha3Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

    XSecure_Sha3Finish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

    XSecure_Sha3Digest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

    XSecure_Sha3_ReadHash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236

    SHA-3 API Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236

    Chapter 29: SHA-2Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239sha_256 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

    sha2_starts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

    sha2_update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

    sha2_finish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

    sha2_hash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

    SHA-2 Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

    XilRSA Library (v1.4 )

    Chapter 30: OverviewSource Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

    Usage of SHA-256 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243SHA2 API Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

    Chapter 31: XilRSA APIsOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244rsa2048_exp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

    rsa2048_pubexp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

    sha_256 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

    sha2_starts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

    sha2_update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

    sha2_finish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

    XilSKey Library (v6.3 )

    Chapter 32: Overview

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 11Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=11

  • Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248Hardware setup for Zynq PL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

    Hardware setup for UltraScale or UltraScale+ . . . . . . . . . . . . . . . . . . . . 250

    Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

    Chapter 33: BBRAM PL APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

    Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253XilSKey_Bbram_Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

    Chapter 34: Zynq UltraScale+ MPSoC BBRAM PS APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

    Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254XilSKey_ZynqMp_Bbram_Program . . . . . . . . . . . . . . . . . . . . . . . . . . 254

    XilSKey_ZynqMp_Bbram_Zeroise . . . . . . . . . . . . . . . . . . . . . . . . . . . 255

    Chapter 35: Zynq eFUSE PS APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256

    Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256XilSKey_EfusePs_Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256

    XilSKey_EfusePs_Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

    XilSKey_EfusePs_ReadStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

    Chapter 36: Zynq UltraScale+ MPSoC eFUSE PS APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

    Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260XilSKey_ZynqMp_EfusePs_CheckAesKeyCrc . . . . . . . . . . . . . . . . . . . . 260

    XilSKey_ZynqMp_EfusePs_ReadUserFuse . . . . . . . . . . . . . . . . . . . . . 260

    XilSKey_ZynqMp_EfusePs_ReadPpk0Hash . . . . . . . . . . . . . . . . . . . . . 261

    XilSKey_ZynqMp_EfusePs_ReadPpk1Hash . . . . . . . . . . . . . . . . . . . . . 261

    XilSKey_ZynqMp_EfusePs_ReadSpkId . . . . . . . . . . . . . . . . . . . . . . . . 262

    XilSKey_ZynqMp_EfusePs_ReadDna . . . . . . . . . . . . . . . . . . . . . . . . . 262

    XilSKey_ZynqMp_EfusePs_ReadSecCtrlBits . . . . . . . . . . . . . . . . . . . . . 262

    XilSKey_ZynqMp_EfusePs_Write . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

    XilSKey_ZynqMp_EfusePs_WritePufHelprData . . . . . . . . . . . . . . . . . . . 263

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 12Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=12

  • XilSKey_ZynqMp_EfusePs_ReadPufHelprData . . . . . . . . . . . . . . . . . . . 264

    XilSKey_ZynqMp_EfusePs_WritePufChash . . . . . . . . . . . . . . . . . . . . . 264

    XilSKey_ZynqMp_EfusePs_ReadPufChash . . . . . . . . . . . . . . . . . . . . . 265

    XilSKey_ZynqMp_EfusePs_WritePufAux . . . . . . . . . . . . . . . . . . . . . . . 265

    XilSKey_ZynqMp_EfusePs_ReadPufAux . . . . . . . . . . . . . . . . . . . . . . . 266

    XilSKey_Write_Puf_EfusePs_SecureBits . . . . . . . . . . . . . . . . . . . . . . . 266

    XilSKey_Read_Puf_EfusePs_SecureBits . . . . . . . . . . . . . . . . . . . . . . . 266

    XilSKey_Puf_Debug2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

    XilSKey_Puf_Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

    Chapter 37: eFUSE PL APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

    Example Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269XilSKey_EfusePl_Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

    XilSKey_EfusePl_ReadStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

    XilSKey_EfusePl_ReadKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271

    XilSKey_CrcCalculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271

    Chapter 38: CRC Calculation APIOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272XilSKey_CrcCalculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

    XilSkey_CrcCalculation_AesKey . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

    Chapter 39: User-Configurable ParametersOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274

    Zynq User-Configurable PS eFUSE Parameters . . . . . . . . . . . . . . . . . . . . 274

    Zynq User-Configurable PL eFUSE Parameters . . . . . . . . . . . . . . . . . . . . 276Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

    MIO Pins for Zynq PL eFUSE JTAG Operations . . . . . . . . . . . . . . . . . . . 277

    MUX Selection Pin for Zynq PL eFUSE JTAG Operations . . . . . . . . . . . . . . 278

    MUX Parameter for Zynq PL eFUSE JTAG Operations . . . . . . . . . . . . . . . . 278

    AES and User Key Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

    Zynq User-Configurable PL BBRAM Parameters . . . . . . . . . . . . . . . . . . . . 280Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

    MUX Parameter for Zynq BBRAM PL JTAG Operations . . . . . . . . . . . . . . . 281

    AES and User Key Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

    UltraScale or UltraScale+ User-Configurable BBRAM PL Parameters . . . . . . . . 281

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 13Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=13

  • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

    AES Keys and Related Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 281

    DPA Protection for BBRAM key . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

    GPIO Pins Used for PL Master JTAG and HWM Signals . . . . . . . . . . . . . . . 283

    GPIO Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

    UltraScale or UltraScale+ User-Configurable PL eFUSE Parameters . . . . . . . . 284Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

    GPIO Pins Used for PL Master JTAG Signal . . . . . . . . . . . . . . . . . . . . . 286

    GPIO Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287

    AES, User Keys and RSA Hash Related Parameters . . . . . . . . . . . . . . . . . 287

    Zynq UltraScale+ MPSoC User-Configurable PS eFUSE Parameters . . . . . . . . 290Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290

    AES Keys and Related Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 292

    User Keys and Related Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . 293

    PPK0 Keys and Related Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 297

    PPK1 Keys and Related Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 298

    SPK ID and Related Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

    Zynq UltraScale+ MPSoC User-Configurable PS BBRAM Parameters . . . . . . . . 301

    Zynq UltraScale+ MPSoC User-Configurable PS PUF Parameters . . . . . . . . . . 301

    Chapter 40: Error CodesOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304

    PL eFUSE Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304

    PS eFUSE Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

    Zynq UltraScale+ MPSoC BBRAM PS Error Codes . . . . . . . . . . . . . . . . . . 312

    Chapter 41: Status Codes

    Chapter 42: ProceduresZynq eFUSE Writing Procedure Running from DDR as an Application . . . . . . . 314

    Zynq eFUSE Driver Compilation Procedure for OCM . . . . . . . . . . . . . . . . . 314

    UltraScale eFUSE Access Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 315

    UltraScale BBRAM Access Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 315

    XilPM Library (v2.2 )

    Chapter 43: XilPM APIs

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 14Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=14

  • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

    Data Structure Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318struct XPm_Notifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318

    struct XPm_NodeStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319

    Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320XPmBootStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

    XPmResetAction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

    XPmReset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

    XPmNotifyEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320XPm_InitXilpm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

    XPm_SuspendFinalize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

    XPm_GetBootStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

    XPm_RequestSuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

    XPm_SelfSuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322

    XPm_ForcePowerDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322

    XPm_AbortSuspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

    XPm_RequestWakeUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

    XPm_SetWakeUpSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

    XPm_SystemShutdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

    XPm_SetConfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

    XPm_InitFinalize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

    XPm_InitSuspendCb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

    XPm_AcknowledgeCb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

    XPm_NotifyCb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

    XPm_RequestNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

    XPm_ReleaseNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

    XPm_SetRequirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

    XPm_SetMaxLatency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

    XPm_GetApiVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

    XPm_GetNodeStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

    XPm_RegisterNotifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

    XPm_UnregisterNotifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332

    XPm_GetOpCharacteristic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332

    XPm_ResetAssert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

    XPm_ResetGetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

    XPm_MmioWrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334

    XPm_MmioRead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334

    Error Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 15Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=15

  • Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334

    Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

    XilFPGA Library (v3.0 )

    Chapter 44: OverviewXilfpga library Interface modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

    Processor Configuration Access Port (PCAP) . . . . . . . . . . . . . . . . . . . . 338

    CSU DMA driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

    Xilsecure_library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

    Design Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

    Flow Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340

    Setting up the Software System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341

    Enabling Secure Mode in PMUFirmware . . . . . . . . . . . . . . . . . . . . . . . . 341

    Chapter 45: XilFPGA APIsOverview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

    Xilfpga_PL library Interface modules . . . . . . . . . . . . . . . . . . . . . . . . . . 343Initialization & Writing Bit-Stream . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

    Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344Xfpga_GetConfigReg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

    XFpga_PL_BitSream_Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

    XFpga_PcapStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

    Appendix A: Additional Resources and Legal Notices

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 16Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=16

  • Chapter 1

    Xilinx OS and Libraries OverviewThe Software Development Kit (SDK) provides a variety of Xilinx software packages, including drivers,libraries, board support packages, and complete operating systems to help you develop a software platform.This document collection provides information on these.Complete documentation for other operating systems can be found in the their respective reference guides.Device drivers are documented along with the corresponding peripheral documentation. The documentation islisted in the following table; click the name to open the document.

    Document ID Document Name Summary

    UG645 Xilinx Standard C Libraries Describes the software librariesavailable for the embeddedprocessors.

    UG647 Standalone Library Referencev6.5

    Describes the Standaloneplatform, a single-threaded,simple operating system (OS)platform that provides the lowestlayer of software modules used toaccess processor-specificfunctions. Some typical functionsoffered by the Standaloneplatform include setting up theinterrupts and exceptionssystems, configuring caches, andother hardware specific functions.The Hardware Abstraction Layer(HAL) is described in thisdocument.

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 17Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=17

  • Document ID Document Name Summary

    UG649 LibXil Memory File System (MFS)Library v2.3

    Describes a simple,memory-based file system thatcan reside in RAM, ROM, orFlash memory.

    UG650 LwIP 1.4.1 Library v2_0 Describes the SDK port of thethird party networking library,Light Weight IP (lwIP) forembedded processors.

    UG651 XilFlash Library v4.4 Describes the functionalityprovided in the flashprogramming library. This libraryprovides access to flash memorydevices that conform to theCommon Flash Interface (CFI)standard. Intel and AMD CFIdevices for some specific partlayouts are currently supported.

    UG652 XilIsf Library v5.9 Describes the In System Flashhardware library, which enableshigher-layer software (such as anapplication) to communicate withthe Isf. XilIsf supports the XilinxIn-System Flash and externalSerial Flash memories fromAtmel (AT45XXXD),Spansion(S25FLXX), WinbondW25QXX, and Micron N25QXX.

    UG1032 XilFFS Library v3.7 Xilffs is a generic FAT file systemthat is primarily added for usewith SD/eMMC driver. The filesystem is open source and a gluelayer is implemented to link it tothe SD/eMMC driver. A link to thesource of file system is providedin the PDF where the file systemdescription can be found.

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 18Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=18

  • Document ID Document Name Summary

    UG1125 XilPM Library v2.2 The Zynq UltraScale+ MPSoCpower management framework isa set of power managementoptions, based upon animplementation of the extensibleenergy management interface(EEMI). The power managementframework allows softwarecomponents running acrossdifferent processing units (PUs)on a chip or device to issue orrespond to requests for powermanagement.

    UG1189 XilSecure Library v2.2 The XilSecure library providesAPIs to access secure hardwareon the Zynq UltraScale+ MPSoCdevices.

    UG1190 XilRSA Library v1.4 The XilRSA library provides APIsto use RSA encryption anddecryption algorithms and SHAalgorithms.

    UG1191 XilSKey Library v6.3 The XilSKey library provides aprogramming mechanism foruser-defined eFUSE bits and forprogramming the KEY intobattery-backed RAM (BBRAM) ofZynq SoC, providesprogramming mechanisms foreFUSE bits of UltraScaledevices. The library also providesprogramming mechanisms foreFUSE bits and BBRAM key ofthe Zynq UltraScale+ MPSoCdevices.

    UG1229 XilFPGA Library v3.0 The XilFPGA library provides aninterface to the Linux orbare-metal users for configuringthe programmable logic (PL) overPCAP from PS. The library isdesigned for Zynq UltraScale+MPSoC devices to run on top ofXilinx standalone BSPs.

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 19Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=19

  • About the LibrariesThe Standard C support library consists of the newlib, libc, which contains the standard C functions suchas stdio, stdlib, and string routines. The math library is an enhancement over the newlib math library,libm, and provides the standard math routines.The LibXil libraries consist of the following:

    LibXil Driver (Xilinx device drivers)

    XilMFS (Xilinx memory file system)

    XilFlash (a parallel flash programming library)

    XilIsf (a serial flash programming library)

    The Hardware Abstraction Layer (HAL) provides common functions related to register IO, exception, and cache.These common functions are uniform across MicroBlaze and Cortex A9 processors. The Standaloneplatform document provides some processor specific functions and macros for accessing the processor-specificfeatures.Most routines in the library are written in C and can be ported to any platform. User applications mustinclude appropriate headers and link with required libraries for proper compilation and inclusion of requiredfunctionality. These libraries and their corresponding include files are created in the processor \lib and\include directories, under the current project, respectively. The -I and -L options of the compiler beingused should be leveraged to add these directories to the search paths.

    Library OrganizationThe organization of the libraries is illustrated in the figure below. As shown, your application can interface withthe components in a variety of ways. The libraries are independent of each other, with the exception of someinteractions. The LibXil drivers and the Standalone form the lowermost hardware abstraction layer. The libraryand OS components rely on standard C library components. The math library, libm.a is also available forlinking with the user applications.

    Note

    LibXil Drivers are the device drivers included in the software platform to provide an interface to theperipherals in the system. These drivers are provided along with Xilinx SDK and are configured by Libgen.This document collection contains a chapter that briefly discusses the concept of device drivers and theway they integrate with the board support package in Xilinx SDK.

    Taking into account some restrictions and implications, which are described in the reference guides for eachcomponent, you can mix and match the component libraries.

    OS and Libraries Document CollectionUG643 (2017.4) December 20, 2017

    www.xilinx.com 20Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=20

  • Xilinx Standard CLibraries

    Xilinx Standard C LibrariesUG645 (2017.3) October 9, 2017

    www.xilinx.com 21Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=21

  • Chapter 2

    Xilinx Standard C LibrariesOverviewThe Xilinx Software Development Kit (SDK) libraries and device drivers provide standard C library functions,as well as functions to access peripherals. The SDK libraries are automatically configured based on theMicroprocessor Software Specification (MSS) file. These libraries and include files are saved in the currentproject lib and include directories, respectively. The -I and -L options of mb-gcc are used to add thesedirectories to its library search paths.

    Standard C Library (libc.a)The standard C library, libc.a, contains the standard C functions compiled for the MicroBlaze processoror the Cortex A9 processor. You can find the header files corresponding to these C standard functions in the/gnu////include folder, where:

    is the Xilinx SDK installation path

    is ARM or MicroBlaze

    is Solaris (sol), Windows (nt), or Linux (lin)

    is arm-xilinx-eabi or microblaze-xilinx-elfThe lib.c directories and functions are:_ansi.h fastmath.h machine/ reent.h stdlib.h utime.h _syslist.h fcntl.h malloc.hregdef.h string.h utmp.h ar.h float.h math.h setjmp.h sys/ assert.hgrp.h paths.h signal.h termios.h ctype.h ieeefp.h process.h stdarg.h time.hdirent.h imits.h pthread.h stddef.h nctrl.h errno.h locale.h pwd.h stdio.hunistd.h

    Programs accessing standard C library functions must be compiled as follows:

    For MicroBlaze processors:

    mb-gcc

    For Cortex A9 processors:

    arm-xilinx-eabi-gcc

    The libc library is included automatically. For programs that access libm math functions, specify the lmoption. For more information on the C runtime library, see MicroBlaze Processor Reference Guide (UG081).

    Xilinx Standard C LibrariesUG645 (2017.3) October 9, 2017

    www.xilinx.com 22Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=22

  • Xilinx C Library (libxil.a)The Xilinx C library, libxil.a, contains the following object files for the MicroBlaze processor embeddedprocessor:

    _exception_handler.o

    _interrupt_handler.o

    _program_clean.o

    _program_init.o

    Default exception and interrupt handlers are provided. The libxil.a library is included automatically. Programsaccessing Xilinx C library functions must be compiled as follows:

    mb-gcc

    Memory Management FunctionsThe MicroBlaze processor and Cortex A9 processor C libraries support the standard memory managementfunctions such as malloc(), calloc(), and free(). Dynamic memory allocation provides memory from theprogram heap. The heap pointer starts at low memory and grows toward high memory. The size of the heapcannot be increased at runtime. Therefore an appropriate value must be provided for the heap size at compiletime. The malloc() function requires the heap to be at least 128 bytes in size to be able to allocate memorydynamically (even if the dynamic requirement is less than 128 bytes).

    Note

    The return value of malloc must always be checked to ensure that it could actually allocate the memoryrequested.

    Arithmetic OperationsSoftware implementations of integer and floating point arithmetic is available as library routines in libgcc.afor both processors. The compiler for both the processors inserts calls to these routines in the code produced,in case the hardware does not support the arithmetic primitive with an instruction.

    MicroBlaze ProcessorDetails of the software implementations of integer and floating point arithmetic for MicroBlaze processors arelisted below:

    Xilinx Standard C LibrariesUG645 (2017.3) October 9, 2017

    www.xilinx.com 23Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=23

  • Integer ArithmeticBy default, integer multiplication is done in software using the library function __mulsi3. Integer multiplicationis done in hardware if the -mno-xl-soft-mul mb-gcc option is specified.Integer divide and mod operations are done in software using the library functions __divsi3 and __modsi3.The MicroBlaze processor can also be customized to use a hard divider, in which case the div instruction isused in place of the __divsi3 library routine.Double precision multiplication, division and mod functions are carried out by the library functions __muldi3,__divdi3, and __moddi3 respectively.The unsigned version of these operations correspond to the signed versions described above, but are prefixedwith an __u instead of __.

    Floating Point ArithmeticAll floating point addition, subtraction, multiplication, division, and conversions are implemented using softwarefunctions in the C library.

    Thread SafetyThe standard C library provided with SDK is not built for a multi-threaded environment. STDIO functions likeprintf(), scanf() and memory management functions like malloc() and free() are common examplesof functions that are not thread-safe. When using the C library in a multi-threaded environment, proper mutualexclusion techniques must be used to protect thread unsafe functions.

    Modules Input/Output Functions

    Input/Output Functions

    OverviewThe SDK libraries contains standard C functions for I/O, such as printf and scanf. These functions are largeand might not be suitable for embedded processors. The prototypes for these functions are available in thestdio.h file.

    Note

    The C standard I/O routines such as printf, scanf, vfprintf are, by default, line buffered. To change thebuffering scheme to no buffering, you must call setvbuf appropriately. For example:

    setvbuf (stdout, NULL, _IONBF, 0);

    These Input/Output routines require that a newline is terminated with both a CR and LF. Ensure that yourterminal CR/LF behavior corresponds to this requirement.For more information on setting the standard input and standard output devices for a system, see EmbeddedSystem Tools Reference Manual (UG1043). In addition to the standard C functions, the SDK processors libraryprovides the following smaller I/O functions:

    Xilinx Standard C LibrariesUG645 (2017.3) October 9, 2017

    www.xilinx.com 24Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=24

  • Functions void print (char ) void putnum (int) void xil_printf (const char ctrl1,...)

    Function Documentation

    void print ( char )This function prints a string to the peripheral designated as standard output in the Microprocessor SoftwareSpecification (MSS) file. This function outputs the passed string as is and there is no interpretation of the stringpassed. For example, a \n passed is interpreted as a new line character and not as a carriage return and anew line as is the case with ANSI C printf function.

    void putnum ( int )This function converts an integer to a hexadecimal string and prints it to the peripheral designated as standardoutput in the MSS file.

    void xil_printf ( const char ctrl1, ... )xil_printf() is a light-weight implementation of printf. It is much smaller in size (only 1 Kb). It does not havesupport for floating point numbers. xil_printf() also does not support printing of long (such as 64-bit)numbers.About format string support:The format string is composed of zero or more directives: ordinary characters (not %), which are copiedunchanged to the output stream; and conversion specifications, each of which results in fetching zero or moresubsequent arguments. Each conversion specification is introduced by the character %, and ends with aconversion specifier.In between there can be (in order) zero or more flags, an optional minimum field width and an optional precision.Supported flag characters are:The character % is followed by zero or more of the following flags:

    0 The value should be zero padded. For d, x conversions, the converted value is padded on the left withzeros rather than blanks. If the 0 and - flags both appear, the 0 flag is ignored.

    - The converted value is to be left adjusted on the field boundary. (The default is right justification.)Except for n conversions, the converted value is padded on the right with blanks, rather than on the leftwith blanks or zeros. A - overrides a 0 if both are given.

    About supported field widthsField widths are represented with an optional decimal digit string (with a nonzero in the first digit) specifying aminimum field width. If the converted value has fewer characters than the field width, it is padded with spaceson the left (or right, if the left-adjustment flag has been given). The supported conversion specifiers are:

    d The int argument is converted to signed decimal notation.

    Xilinx Standard C LibrariesUG645 (2017.3) October 9, 2017

    www.xilinx.com 25Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=25

  • l The int argument is converted to a signed long notation.

    x The unsigned int argument is converted to unsigned hexadecimal notation. The letters abcdef are usedfor x conversions.

    c The int argument is converted to an unsigned char, and the resulting character is written.

    s The const char argument is expected to be a pointer to an array of character type (pointer to a string).

    Characters from the array are written up to (but not including) a terminating NULL character; if a precisionis specified, no more than the number specified are written. If a precision s given, no null character needbe present; if the precision is not specified, or is greater than the size of the array, the array must contain aterminating NULL character.

    Xilinx Standard C LibrariesUG645 (2017.3) October 9, 2017

    www.xilinx.com 26Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=26

  • Standalone (v6.5 )

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 27Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=27

  • Chapter 3

    Xilinx Hardware Abstraction Layer APIOverviewThis section describes the Xilinx Hardware Abstraction Layer API, These APIs are applicable for all processorssupported by Xilinx.

    Modules Assert APIs IO interfacing APIs Definitions for available xilinx platforms Data types for Xilinx Software IP Cores Customized APIs for memory operations Xilinx software status codes Test utilities for memory and caches

    Assert APIs

    OverviewThe xil_assert.h file contains the assert related functions.

    Macros #define Xil_AssertVoid(Expression) #define Xil_AssertNonvoid(Expression) #define Xil_AssertVoidAlways() #define Xil_AssertNonvoidAlways()

    Typedefs typedef void( Xil_AssertCallback) (const char8 File, s32 Line)

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 28Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=28

  • Functions void Xil_Assert (const char8 File, s32 Line) void XNullHandler (void NullParameter) void Xil_AssertSetCallback (Xil_AssertCallback Routine)

    Variables u32 Xil_AssertStatus s32 Xil_AssertWait

    Macro Definition Documentation

    #define Xil_AssertVoid( Expression )This assert macro is to be used for void functions. This in conjunction with the Xil_AssertWait boolean can beused to accomodate tests so that asserts which fail allow execution to continue.

    Parameters

    Expression expression to be evaluated. If it evaluates to false, the assert occurs.

    Returns

    Returns void unless the Xil_AssertWait variable is true, in which case no return is made and an infiniteloop is entered.

    #define Xil_AssertNonvoid( Expression )This assert macro is to be used for functions that do return a value. This in conjunction with the Xil_AssertWaitboolean can be used to accomodate tests so that asserts which fail allow execution to continue.

    Parameters

    Expression expression to be evaluated. If it evaluates to false, the assert occurs.

    Returns

    Returns 0 unless the Xil_AssertWait variable is true, in which case no return is made and an infinite loopis entered.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 29Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=29

  • #define Xil_AssertVoidAlways( )Always assert. This assert macro is to be used for void functions. Use for instances where an assert shouldalways occur.

    Returns

    Returns void unless the Xil_AssertWait variable is true, in which case no return is made and an infiniteloop is entered.

    #define Xil_AssertNonvoidAlways( )Always assert. This assert macro is to be used for functions that do return a value. Use for instances where anassert should always occur.

    Returns

    Returns void unless the Xil_AssertWait variable is true, in which case no return is made and an infiniteloop is entered.

    Typedef Documentation

    typedef void( Xil_AssertCallback) (const char8 File, s32 Line)This data type defines a callback to be invoked when an assert occurs. The callback is invoked only whenasserts are enabled

    Function Documentation

    void Xil_Assert ( const char8 File, s32 Line )Implement assert. Currently, it calls a user-defined callback function if one has been set. Then, it potentiallyenters an infinite loop depending on the value of the Xil_AssertWait variable.

    Parameters

    file filename of the source

    line linenumber within File

    Returns

    None.

    Note

    None.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 30Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=30

  • void XNullHandler ( void NullParameter )Null handler function. This follows the XInterruptHandler signature for interrupt handlers. It can be used toassign a null handler (a stub) to an interrupt controller vector table.

    Parameters

    NullParameter arbitrary void pointer and not used.

    Returns

    None.

    Note

    None.

    void Xil_AssertSetCallback ( Xil_AssertCallback Routine )Set up a callback function to be invoked when an assert occurs. If a callback is already installed, then it will bereplaced.

    Parameters

    routine callback to be invoked when an assert is taken

    Returns

    None.

    Note

    This function has no effect if NDEBUG is set

    Variable Documentation

    u32 Xil_AssertStatusThis variable allows testing to be done easier with asserts. An assert sets this variable such that a driver canevaluate this variable to determine if an assert occurred.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 31Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=31

  • s32 Xil_AssertWaitThis variable allows the assert functionality to be changed for testing such that it does not wait infinitely. Usethe debugger to disable the waiting during testing of asserts.

    IO interfacing APIs

    OverviewThe xil_io.h file contains the interface for the general IO component, which encapsulates the Input/Outputfunctions for processors that do not require any special I/O handling.

    Functions u16 Xil_EndianSwap16 (u16 Data) u32 Xil_EndianSwap32 (u32 Data) static INLINE u8 Xil_In8 (UINTPTR Addr) static INLINE u16 Xil_In16 (UINTPTR Addr) static INLINE u32 Xil_In32 (UINTPTR Addr) static INLINE u64 Xil_In64 (UINTPTR Addr) static INLINE void Xil_Out8 (UINTPTR Addr, u8 Value) static INLINE void Xil_Out16 (UINTPTR Addr, u16 Value) static INLINE void Xil_Out32 (UINTPTR Addr, u32 Value) static INLINE void Xil_Out64 (UINTPTR Addr, u64 Value) static INLINE u16 Xil_In16LE (UINTPTR Addr) static INLINE u32 Xil_In32LE (UINTPTR Addr) static INLINE void Xil_Out16LE (UINTPTR Addr, u16 Value) static INLINE void Xil_Out32LE (UINTPTR Addr, u32 Value) static INLINE u16 Xil_In16BE (UINTPTR Addr) static INLINE u32 Xil_In32BE (UINTPTR Addr) static INLINE void Xil_Out16BE (UINTPTR Addr, u16 Value) static INLINE void Xil_Out32BE (UINTPTR Addr, u32 Value)

    Function Documentation

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 32Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=32

  • u16 Xil_EndianSwap16 ( u16 Data )Perform a 16-bit endian converion.

    Parameters

    Data 16 bit value to be converted

    Returns

    converted value.

    u32 Xil_EndianSwap32 ( u32 Data )Perform a 32-bit endian converion.

    Parameters

    Data 32 bit value to be converted

    Returns

    converted value.

    static INLINE u8 Xil_In8 ( UINTPTR Addr ) [static]Performs an input operation for an 8-bit memory location by reading from the specified address and returningthe Value read from that address.

    Parameters

    Addr contains the address to perform the input operation at.

    Returns

    The Value read from the specified input address.

    Note

    None.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 33Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=33

  • static INLINE u16 Xil_In16 ( UINTPTR Addr ) [static]Performs an input operation for a 16-bit memory location by reading from the specified address and returningthe Value read from that address.

    Parameters

    Addr contains the address to perform the input operation at.

    Returns

    The Value read from the specified input address.

    Note

    None.

    static INLINE u32 Xil_In32 ( UINTPTR Addr ) [static]Performs an input operation for a 32-bit memory location by reading from the specified address and returningthe Value read from that address.

    Parameters

    Addr contains the address to perform the input operation at.

    Returns

    The Value read from the specified input address.

    Note

    None.

    static INLINE u64 Xil_In64 ( UINTPTR Addr ) [static]Performs an input operation for a 64-bit memory location by reading the specified Value to the the specifiedaddress.

    Parameters

    Addr contains the address to perform the output operation at.

    Value contains the Value to be output at the specified address.

    Returns

    None.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 34Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=34

  • Note

    None.

    static INLINE void Xil_Out8 ( UINTPTR Addr, u8 Value ) [static]Performs an output operation for an 8-bit memory location by writing the specified Value to the the specifiedaddress.

    Parameters

    Addr contains the address to perform the output operation at.

    Value contains the Value to be output at the specified address.

    Returns

    None.

    Note

    None.

    static INLINE void Xil_Out16 ( UINTPTR Addr, u16 Value ) [static]Performs an output operation for a 16-bit memory location by writing the specified Value to the the specifiedaddress.

    Parameters

    Addr contains the address to perform the output operation at.

    Value contains the Value to be output at the specified address.

    Returns

    None.

    Note

    None.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 35Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=35

  • static INLINE void Xil_Out32 ( UINTPTR Addr, u32 Value ) [static]Performs an output operation for a 32-bit memory location by writing the specified Value to the the specifiedaddress.

    Parameters

    Addr contains the address to perform the output operation at.

    Value contains the Value to be output at the specified address.

    Returns

    None.

    Note

    None.

    static INLINE void Xil_Out64 ( UINTPTR Addr, u64 Value ) [static]Performs an output operation for a 64-bit memory location by writing the specified Value to the the specifiedaddress.

    Parameters

    Addr contains the address to perform the output operation at.

    Value contains the Value to be output at the specified address.

    Returns

    None.

    Note

    None.

    static INLINE u16 Xil_In16LE ( UINTPTR Addr ) [static]Perform a little-endian input operation for a 16-bit memory location by reading from the specified address andreturning the value read from that address.

    Parameters

    Addr contains the address at which to perform the input operation.

    Returns

    The value read from the specified input address with the proper endianness. The return value has thesame endianness as that of the processor. For example, if the processor is big-endian, the return value isthe byte-swapped value read from the address.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 36Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=36

  • static INLINE u32 Xil_In32LE ( UINTPTR Addr ) [static]Perform a little-endian input operation for a 32-bit memory location by reading from the specified address andreturning the value read from that address.

    Parameters

    Addr contains the address at which to perform the input operation.

    Returns

    The value read from the specified input address with the proper endianness. The return value has thesame endianness as that of the processor. For example, if the processor is big-endian, the return value isthe byte-swapped value read from the address.

    static INLINE void Xil_Out16LE ( UINTPTR Addr, u16 Value ) [static]Perform a little-endian output operation for a 16-bit memory location by writing the specified value to thespecified address.

    Parameters

    Addr contains the address at which to perform the output operation.

    Value contains the value to be output at the specified address. The value has thesame endianness as that of the processor. For example, if the processor isbig-endian, the byteswapped value is written to the address.

    static INLINE void Xil_Out32LE ( UINTPTR Addr, u32 Value ) [static]Perform a little-endian output operation for a 32-bit memory location by writing the specified value to thespecified address.

    Parameters

    Addr contains the address at which to perform the output operation.

    Value contains the value to be output at the specified address. The value has thesame endianness as that of the processor. For example, if the processor isbig-endian, the byteswapped value is written to the address.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 37Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=37

  • static INLINE u16 Xil_In16BE ( UINTPTR Addr ) [static]Perform an big-endian input operation for a 16-bit memory location by reading from the specified address andreturning the value read from that address.

    Parameters

    Addr contains the address at which to perform the input operation.

    Returns

    The value read from the specified input address with the proper endianness. The return value has thesame endianness as that of the processor. For example, if the processor is little-endian, the return valueis the byte-swapped value read from the address.

    static INLINE u32 Xil_In32BE ( UINTPTR Addr ) [static]Perform a big-endian input operation for a 32-bit memory location by reading from the specified address andreturning the value read from that address.

    Parameters

    Addr contains the address at which to perform the input operation.

    Returns

    The value read from the specified input address with the proper endianness. The return value has thesame endianness as that of the processor. For example, if the processor is little-endian, the return valueis the byte-swapped value read from the address.

    static INLINE void Xil_Out16BE ( UINTPTR Addr, u16 Value ) [static]Perform a big-endian output operation for a 16-bit memory location by writing the specified value to the specifiedaddress.

    Parameters

    Addr contains the address at which to perform the output operation.

    Value contains the value to be output at the specified address. The value has thesame endianness as that of the processor. For example, if the processor islittle-endian, the byteswapped value is written to the address.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 38Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=38

  • static INLINE void Xil_Out32BE ( UINTPTR Addr, u32 Value ) [static]Perform a big-endian output operation for a 32-bit memory location by writing the specified value to the specifiedaddress.

    Parameters

    Addr contains the address at which to perform the output operation.

    Value contains the value to be output at the specified address. The value has thesame endianness as that of the processor. For example, if the processor islittle-endian, the byteswapped value is written to the address.

    Definitions for available xilinx platforms

    OverviewThe xplatform_info.h file contains definitions for various available Xilinx platforms.

    Functions u32 XGetPlatform_Info () u32 XGetPSVersion_Info () u32 XGet_Zynq_UltraMp_Platform_info ()

    Function Documentation

    u32 XGetPlatform_Info ( )This API is used to provide information about platform.

    Parameters

    None.

    Returns

    The information about platform defined in xplatform_info.h

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 39Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=39

  • u32 XGetPSVersion_Info ( )This API is used to provide information about PS Silicon version.

    Parameters

    None.

    Returns

    The information about PS Silicon version.

    u32 XGet_Zynq_UltraMp_Platform_info ( )This API is used to provide information about zynq ultrascale MP platform.

    Parameters

    None.

    Returns

    The information about zynq ultrascale MP platform defined in xplatform_info.h

    Data types for Xilinx Software IP Cores

    OverviewThe xil_types.h file contains basic types for Xilinx software IP cores. These data types are applicable forall processors supported by Xilinx.

    Macros #define XIL_COMPONENT_IS_READY #define XIL_COMPONENT_IS_STARTED

    New typesNew simple types.

    typedef uint8_t u8 typedef uint16_t u16 typedef uint32_t u32 typedef char char8 typedef int8_t s8

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 40Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=40

  • typedef int16_t s16 typedef int32_t s32 typedef int64_t s64 typedef uint64_t u64 typedef int sint32 typedef intptr_t INTPTR typedef uintptr_t UINTPTR typedef ptrdiff_t PTRDIFF typedef long LONG typedef unsigned long ULONG typedef void( XInterruptHandler) (void InstancePtr) typedef void( XExceptionHandler) (void InstancePtr) #define __XUINT64__ #define XUINT64_MSW(x) #define XUINT64_LSW(x) #define ULONG64_HI_MASK #define ULONG64_LO_MASK #define UPPER_32_BITS(n) #define LOWER_32_BITS(n)

    Macro Definition Documentation

    #define XIL_COMPONENT_IS_READYcomponent has been initialized

    #define XIL_COMPONENT_IS_STARTEDcomponent has been started

    #define XUINT64_MSW( x )Return the most significant half of the 64 bit data type.

    Parameters

    x is the 64 bit word.

    Returns

    The upper 32 bits of the 64 bit word.

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 41Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=41

  • #define XUINT64_LSW( x )Return the least significant half of the 64 bit data type.

    Parameters

    x is the 64 bit word.

    Returns

    The lower 32 bits of the 64 bit word.

    #define UPPER_32_BITS( n )return bits 32-63 of a number

    Parameters

    n : the number we're accessing

    Returns

    bits 32-63 of number

    Note

    A basic shift-right of a 64- or 32-bit quantity. Use this to suppress the "right shift count >= width of type"warning when that quantity is 32-bits.

    #define LOWER_32_BITS( n )return bits 0-31 of a number

    Parameters

    n : the number we're accessing

    Returns

    bits 0-31 of number

    Typedef Documentation

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 42Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=42

  • typedef uint8_t u8guarded against xbasic_types.h.

    typedef char char8xbasic_types.h does not typedef s or u64

    typedef void( XInterruptHandler) (void InstancePtr)This data type defines an interrupt handler for a device. The argument points to the instance of the component

    typedef void( XExceptionHandler) (void InstancePtr)This data type defines an exception handler for a processor. The argument points to the instance of thecomponent

    Customized APIs for memory operations

    OverviewThe xil_mem.h file contains prototypes for function related to memory operations. These APIs are applicablefor all processors supported by Xilinx.

    Functions void Xil_MemCpy (void dst, const void src, u32 cnt)

    Function Documentation

    void Xil_MemCpy ( void dst, const void src, u32 cnt )This function copies memory from once location to other.

    Parameters

    dst pointer pointing to destination memory

    src pointer pointing to source memory

    cnt 32 bit length of bytes to be copied

    Standalone (v6.5 )UG647 (2017.4) December 20, 2017

    www.xilinx.com 43Send Feedback

    http://www.xilinx.comhttps://www.xilinx.com/about/feedback.html?docType=User_Guides&docId=UG643&Title=OS%20and%20Libraries%20Document%20Collection&releaseVersion=2017.4&docPage=43

  • Xilinx software status codes

    OverviewThe xstatus.h file contains Xilinx software status codes. Status codes have their own data type called int.These codes are used throughout the Xilinx device drivers.

    Test utilities for memory and caches

    OverviewThe xil_testcache.h, xil_testio.h and the xil_testmem.h files contain utility functions to test cacheand memory. Details of supported tests and subtests are listed below.

    Cache test : xil_testcache.h contains utility functions to test cache.

    I/O test : The Xil_testio.h file contains endian related memory IO functions. A subset of the memorytests can be selected or all of the tests can be run in order. If there is an error detected by a subtest, thetest stops and the failure code is returned. Further tests are not run even if all of the tests are selected.

    Memory test : The xil_testmem.h file contains utility functions to test memory. A subset of the memorytests can be selected or all of the tests can be run in order. If there is an error detected by a subtest, thetest stops and the failure code is returned. Further tests are not run even if all of the tests are selected.Following are des