Software Drivers

xaxicdma.c File Reference

#include "xaxicdma.h"
#include "xaxicdma_i.h"

Functions

u32 XAxiCdma_GetError (XAxiCdma *InstancePtr)
void XAxiCdma_Reset (XAxiCdma *InstancePtr)
int XAxiCdma_ResetIsDone (XAxiCdma *InstancePtr)
int XAxiCdma_CfgInitialize (XAxiCdma *InstancePtr, XAxiCdma_Config *CfgPtr, u32 EffectiveAddr)
int XAxiCdma_IsBusy (XAxiCdma *InstancePtr)
int XAxiCdma_IsSimpleMode (XAxiCdma *InstancePtr)
int XAxiCdma_SelectKeyHole (XAxiCdma *InstancePtr, u32 Direction, u32 Select)
int XAxiCdma_SwitchMode (XAxiCdma *InstancePtr, int Mode)
int XAxiCdma_SimpleTransfer (XAxiCdma *InstancePtr, u32 SrcAddr, u32 DstAddr, int Length, XAxiCdma_CallBackFn SimpleCallBack, void *CallBackRef)
int XAxiCdma_SetCoalesce (XAxiCdma *InstancePtr, u32 Counter, u32 Delay)
void XAxiCdma_GetCoalesce (XAxiCdma *InstancePtr, u32 *CounterPtr, u32 *DelayPtr)
void XAxiCdma_DumpRegisters (XAxiCdma *InstancePtr)

Detailed Description

The implementation of the API of Xilinx CDMA engine.

 MODIFICATION HISTORY:
 Ver   Who  Date     Changes
 ----- ---- -------- -------------------------------------------------------
 1.00a jz   04/18/10 First release
 2.01a rkv  01/25/11 Replaced with "\r\n" in place on "\n\r" in printf
			statements Changed XAxiCdma_CfgInitialize to use
			EffectiveAddress.
 2.02a srt  01/18/13 Added support for Key Hole feature (CR: 687217).
 

Function Documentation

int XAxiCdma_CfgInitialize ( XAxiCdma InstancePtr,
XAxiCdma_Config CfgPtr,
u32  EffectiveAddr 
)

This function initializes the driver. It should be called before any other function calls to the driver.

It sets up the driver according to the hardware build. It resets the hardware at the end.

Parameters:
InstancePtr is the driver instance that is working on
CfgPtr is the pointer to the hardware configuration structure
EffectiveAddr is the virtual address of the hardware instance. If address translation is not in use, please use the physical address
Returns:
  • XST_SUCCESS for success
  • XST_INVALID_PARAM if word length is less than 4
  • XST_FAILURE for reset failure
Note:
None.
void XAxiCdma_DumpRegisters ( XAxiCdma InstancePtr  ) 

This function dumps the registers of this DMA instance

Parameters:
InstancePtr is the driver instance we are working on
Returns:
None
Note:
None.
void XAxiCdma_GetCoalesce ( XAxiCdma InstancePtr,
u32 *  CounterPtr,
u32 *  DelayPtr 
)

This function gets the current setting of the interrupt coalescing threshold counter and the delay counter.

Parameters:
InstancePtr is the driver instance we are working on
CounterPtr is the return value for the coalescing counter setting
DelayPtr is the return value for the delay counter setting
Returns:
A zero coalescing threshold indicates invalid results
Note:
None.
u32 XAxiCdma_GetError ( XAxiCdma InstancePtr  ) 

This function gets the status on error bits.

Parameters:
InstancePtr is the driver instance we are working on
Returns:
The error bits in the status register. Zero indicates no errors.
Note:
None.
int XAxiCdma_IsBusy ( XAxiCdma InstancePtr  ) 

This function checks whether the hardware is doing transfer

Parameters:
InstancePtr is the driver instance we are working on
Returns:
  • 1 if the hardware is doing a transfer
  • 0 if the hardware is idle
Note:
None.
int XAxiCdma_IsSimpleMode ( XAxiCdma InstancePtr  ) 
void XAxiCdma_Reset ( XAxiCdma InstancePtr  ) 

This function conducts hardware reset

Current transfer will finish gracefully. However, all queued SG transfers that have not started will be flushed from the hardware.

Parameters:
InstancePtr is the driver instance we are working on
Returns:
None
Note:
None.
int XAxiCdma_ResetIsDone ( XAxiCdma InstancePtr  ) 

This function checks whether the hardware reset is done

Parameters:
InstancePtr is the driver instance we are working on
Returns:
  • 1 if the reset has finished successfully
  • 0 if the reset is not done
Note:
None.
int XAxiCdma_SelectKeyHole ( XAxiCdma InstancePtr,
u32  Direction,
u32  Select 
)

This function configures KeyHole Write/Read Feature

Parameters:
InstancePtr is the driver instance we are working on
Direction is WRITE/READ Select is the option to enable (TRUE) or disable (FALSE).
Returns:
- XST_SUCCESS for success
  • XST_DEVICE_BUSY when transfer is in progress
  • XST_NO_FEATURE when not configured with feature
Note:
None.
int XAxiCdma_SetCoalesce ( XAxiCdma InstancePtr,
u32  Counter,
u32  Delay 
)

This function tries to set the interrupt coalescing threshold counter and the delay counter. If to set only one of the counters, set the value of the other counter to be XAXICDMA_COALESCE_NO_CHANGE.

Parameters:
InstancePtr is the driver instance we are working on
Counter is the coalescing threshold to set to, the valid range is 1 to XAXICDMA_COALESCE_MAX.
Delay is the delay timeout counter to set to, the valid range is 0 to XAXICDMA_DELAY_MAX. Setting a value of 0 disables the delay interrupt.
Returns:
  • XST_SUCCESS for success
  • XST_FAILURE if hardware is in invalid state, for example, reset failed
  • XST_INVALID_PARAM if one of the counters is not in the valid range
Note:
None.
int XAxiCdma_SimpleTransfer ( XAxiCdma InstancePtr,
u32  SrcAddr,
u32  DstAddr,
int  Length,
XAxiCdma_CallBackFn  SimpleCallBack,
void *  CallBackRef 
)

This function does one simple transfer submission

It checks in the following sequence:

  • if engine is busy, cannot submit
  • if software is still handling the completion of the previous simple transfer, cannot submit
  • if engine is in SG mode and cannot switch to simple mode, cannot submit
Parameters:
InstancePtr is the pointer to the driver instance
SrcAddr is the address of the source buffer
DstAddr is the address of the destination buffer
Length is the length of the transfer
SimpleCallBack is the callback function for the simple transfer
CallBackRef is the callback reference pointer
Returns:
  • XST_SUCCESS for success of submission
  • XST_FAILURE for submission failure, maybe caused by: Another simple transfer is still going . Another SG transfer is still going
  • XST_INVALID_PARAM if: Length out of valid range [1:8M] Or, address not aligned when DRE is not built in
Note:
Only set the callback function if using interrupt to signal the completion.If used in polling mode, please set the callback function to be NULL.
int XAxiCdma_SwitchMode ( XAxiCdma InstancePtr,
int  Mode 
)