Performing Transfers using the XDMA Driver with Linux
Use these steps to prepare the application driver to use the XDMA driver to transfer data
between the host and EP in a Linux environment. Passing of an OUT direction parameter
indicates to the XDMA driver that the SGL is a source-side SGL; passing of an IN parameter
indicates to the XDMA driver that the SGL is a destination-side SGL.
S2C I/O
In these steps channel 0 is used and data from the host I/O buffer resident at a virtual
address of 0x12340000 has to be transferred to a fixed AXI address of 0x12340000) in the
EP.
1. Create a source SGL software descriptor using XDMA API xlnx_get_dma_channel ().
Specify the direction as OUT. Call this descriptor s2c_chann0_out_desc. This is the
descriptor for source SGL.
2. Allocate queues for the SGL using XDMA API xlnx_alloc_queues ().
3. Activate the DMA channel using XDMA API xlnx_activate_dma_channel ().
4. Invoke XDMA API xlnx_data_frag_io () passing parameters s2c_chann0_out_desc,
0x12340000, and address type as VIRT_ADDR. A pointer to a callback function also can
be passed (optional).
This causes the data to be drained from the host I/O buffer pointed to by 0x12340000
to the EP memory pointed to by a BD element populated by hardware logic. The host
side software stays agnostic of this location. Optional callbacks are invoked for SGL
descriptors so that application drivers can do necessary post-data transfer clean up.
C2S I/O
In these steps channel 1 is used and data from the EP has to be transferred to a host I/O
buffer at a physical address of 0x880000.
1. Create a destination SGL software descriptor using XDMA API xlnx_get_dma_channel ().
Specify the direction as IN. For this example, the descriptor is called
c2s_chann1_in_desc. This is the descriptor for destination SGL.
2. Allocate Qs for the SGL using XDMA API xlnx_alloc_queues ().
3. Activate the DMA channel using XDMA API xlnx_activate_dma_channel ().
4. Invoke XDMA API xlnx_data_frag_io () passing parameters c2s_chann1_in_desc,
0x880000, and address type as PHYS_ADDR. A pointer to a callback function also can
be optionally passed.
This causes the data to be drained from the EP I/O buffer to the host I/O buffer physical
address location 0x880000. The host software is agnostic of the EP memory location
PCIe Streaming Data Plane TRD
UG920 (v2017.1) June 01, 2017
Chapter 5: Targeted Reference Design Details and Modifications
www.xilinx.com
61
Send Feedback