Software Drivers

axivdma v5_0

This is the Xilinx MVI AXI Video DMA device driver. The DMA engine transfers frames from the AXI Bus or to the AXI Bus. It is in the chain of video IPs, which process video frames.

It supports the following features:

An AXI Video DMA engine can have one or two channels. If configured as two channels, then one of the channels reads data from memory, and the other channel writes to the memory.

For a full description of AXI Video DMA features, please see the hardware spec.

The driver composes of three parts: initialization, start a DMA transfer, and interrupt handling.

Driver Initialization

To initialize the driver, the caller needs to pass a configuration structure to the driver. This configuration structure contains information about the hardware build.

A caller can manually setup the configuration structure, or call XAxiVdma_LoopkupConfig().

The sequence of initialization of the driver is: 1. XAxiVdma_LookupConfig() to get the configuration structure, or manually setup the structure. 2. XAxiVdma_CfgInitialize() to initialize the driver & device. 3. XAxiVdma_SetFrmStore() to set the desired frame store number which is optional. 4. If interrupt is desired:

Start a DMA Transaction

If you are using the driver API to start the transfer, then there are two ways to start a DMA transaction:

1. Invoke XAxiVdma_StartWriteFrame() or XAxiVdma_StartReadFrame() to start a DMA operation, depending on the purpose of the transfer (Read or Write).

2. Or, call the phased functions as the following:

If you are writing your own functions to start the transfer, the order of setting up the hardware must be the following:

You can refer to XAxiVdma_ChannelStartTransfer() to see how this order is preserved there. The function is in xaxivdma_channel.c.

Note a Read VDMA could work with one out of multiple write VDMA instances and vice versa. The PointNum in structure XAxiVdma_DmaSetup decides which VDMA instance this VDMA is working with.

Interrupt Handling

Each VDMA channel supports 2 kinds of interrupts:

The driver does the interrupt handling, and dispatch to the user application through callback functions that user has registered. If there are no registered callback functions, then a stub callback function is called.

Each channel has two interrupt callback functions. One for IOC and delay interrupt, or general interrupt; one for error interrupt.

Reset

Reset a DMA channel causes the channel enter the following state:

If there is an active transfer going on when reset (or stop) is issued to the hardware, the current transfer will gracefully finish. For a maximum transfer length of (0x1FFF * 0xFFFF) bytes, on a 100 MHz system, it can take as long as 1.34 seconds, assuming that the system responds to DMA engine's requests quickly.

To ensure that the hardware finishes the reset, please use XAxiVdma_ResetNotDone() to check for completion of the reset.

To start a transfer after a reset, the following actions are the minimal requirement before setting RUN/STOP bit high to avoid crashing the system:

If you are using the driver API to start a transfer after a reset, then it should be fine.

Stop

Stop a channel using XAxiVDma_DmaStop() is similar to a reset, except the registers are kept intact.

To start a transfer after a stop:

Examples

We provide one example on how to use the AXI VDMA with AXI Video IPs. This example does not work by itself. To make it work, you must have two other Video IPs to connect to the VDMA. One of the Video IP does the write and the other does the read.

Cache Coherency

This driver does not handle any cache coherency for the data buffers. The application is responsible for handling cache coherency, if the cache is enabled.

Alignment

The VDMA supports any buffer alignment when DRE is enabled in the hardware configuration. It only supports word-aligned buffers otherwise. Note that "word" is defined by C_M_AXIS_MM2S_TDATA_WIDTH and C_S_AXIS_S2MM_TDATA_WIDTH for the read and write channel specifically.

If the horizonal frame size is not word-aligned, then DRE must be enabled in the hardware. Otherwise, undefined results happen.

Address Translation

Buffer addresses for transfers are physical addresses. If the system does not use MMU, then physical and virtual addresses are the same.

API Change from PLB Video DMA

We try to keep the API as consistent with the PLB Video DMA driver as possible. However, due to hardware differences, some of the PLB video DMA driver APIs are changed or removed. Two API functions are added to the AXI DMA driver.

For details on the API changes, please refer to xaxivdma_porting_guide.h.

 MODIFICATION HISTORY:
 Ver   Who  Date     Changes
 ----- ---- -------- -------------------------------------------------------
 1.00a jz   08/16/10 First release
 2.00a jz   12/10/10 Added support for direct register access mode, v3 core
 2.01a jz   01/19/11 Added ability to re-assign BD addresses
		      Replaced include xenv.h with string.h in xaxivdma_i.h
 		      file.
 2.01a	rkv  03/28/11 Added support for frame store register and 
                     XAxiVdma_ChannelInit API is changed.
 3.00a srt  08/26/11 - Added support for Flush on Frame Sync and dynamic 
			programming of Line Buffer Thresholds.


Added unalignment checks for Hsize and Stride
			(CR 710279)
 4.06a srt  04/09/13 - Added support for the newly added S2MM_DMA_IRQ_MASK
                       register (CR 734741)
 5.0   adk  19/12/13 - Updated as per the New Tcl API's