When an AXI4-Lite slave interface is implemented, a set of C driver files are automatically created. These C driver files provide a set of APIs that can be integrated into any software running on a CPU and used to communicate with the device via the AXI4-Lite slave interface.
The C driver files are created when the design is packaged as IP in the IP catalog.
Driver files are created for standalone and Linux modes. In standalone mode the drivers are used in the same way as any other Xilinx standalone drivers. In Linux mode, copy all the C files (.c) and header files (.h) files into the software project.
The driver files and API functions derive their name from the top-level function
for synthesis. In the above example, the top-level function is called “example”. If
the top-level function was named “DUT” the name “example” would be replaced by “DUT”
in the following description. The driver files are created in the packaged IP
(located in the impl
directory inside the
solution).
File Path | Usage Mode | Description |
---|---|---|
data/example.mdd | Standalone | Driver definition file. |
data/example.tcl | Standalone | Used by SDK to integrate the software into an SDK project. |
src/xexample_hw.h | Both | Defines address offsets for all internal registers. |
src/xexample.h | Both | API definitions |
src/xexample.c | Both | Standard API implementations |
src/xexample_sinit.c | Standalone | Initialization API implementations |
src/xexample_linux.c | Linux | Initialization API implementations |
src/Makefile | Standalone | Makefile |
In file xexample.h, two structs are defined.
- XExample_Config
- This is used to hold the configuration information (base address of each AXI4-Lite slave interface) of the IP instance.
- XExample
- This is used to hold the IP instance pointer. Most APIs take this instance pointer as the first argument.
The standard API implementations are provided in files xexample.c, xexample_sinit.c, xexample_linux.c, and provide functions to perform the following operations.
- Initialize the device
- Control the device and query its status
- Read/write to the registers
- Set up, monitor, and control the interrupts
Refer to Vitis HLS C Driver Reference for a description of the API functions provided in the C driver files.