axicdma
Vitis Drivers API Documentation
Overview

Macros

#define XAxiCdma_ReadReg(BaseAddress, RegOffset)   XAxiCdma_In32((BaseAddress) + (u32)(RegOffset))
 Read a given register. More...
 
#define XAxiCdma_WriteReg(BaseAddress, RegOffset, Data)   XAxiCdma_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data))
 Write to a given register. More...
 

Typedefs

typedef UINTPTR XAxiCdma_Bd [XAXICDMA_BD_NUM_WORDS]
 XAxiCdma_Bd. More...
 

Functions

u32 XAxiCdma_GetError (XAxiCdma *InstancePtr)
 This function gets the status on error bits. More...
 
void XAxiCdma_Reset (XAxiCdma *InstancePtr)
 This function conducts hardware reset. More...
 
int XAxiCdma_ResetIsDone (XAxiCdma *InstancePtr)
 This function checks whether the hardware reset is done. More...
 
u32 XAxiCdma_CfgInitialize (XAxiCdma *InstancePtr, XAxiCdma_Config *CfgPtr, UINTPTR EffectiveAddr)
 This function initializes the driver. More...
 
int XAxiCdma_IsBusy (XAxiCdma *InstancePtr)
 This function checks whether the hardware is doing transfer. More...
 
int XAxiCdma_SelectKeyHole (XAxiCdma *InstancePtr, u32 Direction, u32 Select)
 This function configures KeyHole Write/Read Feature. More...
 
u32 XAxiCdma_SimpleTransfer (XAxiCdma *InstancePtr, UINTPTR SrcAddr, UINTPTR DstAddr, int Length, XAxiCdma_CallBackFn SimpleCallBack, void *CallBackRef)
 This function does one simple transfer submission. More...
 
int XAxiCdma_SetCoalesce (XAxiCdma *InstancePtr, u32 Counter, u32 Delay)
 This function tries to set the interrupt coalescing threshold counter and the delay counter. More...
 
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. More...
 
void XAxiCdma_DumpRegisters (XAxiCdma *InstancePtr)
 This function dumps the registers of this DMA instance. More...
 
XAxiCdma_Config * XAxiCdma_LookupConfig (u32 DeviceId)
 Look up the hardware configuration for a device instance. More...
 
void XAxiCdma_IntrEnable (XAxiCdma *InstancePtr, u32 Mask)
 This function enables interrupts specified by the Mask. More...
 
u32 XAxiCdma_IntrGetEnabled (XAxiCdma *InstancePtr)
 This function gets the mask for the interrupts that are currently enabled. More...
 
void XAxiCdma_IntrDisable (XAxiCdma *InstancePtr, u32 Mask)
 This function disables interrupts specified by the Mask. More...
 
void XAxiCdma_IntrHandler (void *HandlerRef)
 This function is the interrupt handler for the driver, it handles all the interrupts. More...
 
u32 XAxiCdma_BdRingCntCalc (u32 Alignment, u32 Bytes, UINTPTR BdBuffAddr)
 This function calculates how many BDs can be built using given number of bytes of memory, according to alignment provided. More...
 
u32 XAxiCdma_BdRingMemCalc (u32 Alignment, int NumBd)
 This function calculates how much memory is needed to build requested number of BDs. More...
 
u32 XAxiCdma_BdRingGetCnt (XAxiCdma *InstancePtr)
 This function gets the total number of BDs in the BD ring. More...
 
u32 XAxiCdma_BdRingGetFreeCnt (XAxiCdma *InstancePtr)
 This function gets the number of free BDs. More...
 
void XAxiCdma_BdRingSnapShotCurrBd (XAxiCdma *InstancePtr)
 This function grabs a copy of the current BD pointer from the hardware. More...
 
XAxiCdma_BdXAxiCdma_BdRingGetCurrBd (XAxiCdma *InstancePtr)
 This function grabs a copy of the current BD pointer from the hardware. More...
 
XAxiCdma_BdXAxiCdma_BdRingNext (XAxiCdma *InstancePtr, XAxiCdma_Bd *BdPtr)
 This function gets the next BD of the current BD on the BD ring. More...
 
XAxiCdma_BdXAxiCdma_BdRingPrev (XAxiCdma *InstancePtr, XAxiCdma_Bd *BdPtr)
 This function gets the previous BD of the current BD on the BD ring. More...
 
LONG XAxiCdma_BdRingCreate (XAxiCdma *InstancePtr, UINTPTR PhysAddr, UINTPTR VirtAddr, u32 Alignment, int BdCount)
 This function creates the BD ring for the driver instance. More...
 
LONG XAxiCdma_BdRingClone (XAxiCdma *InstancePtr, XAxiCdma_Bd *TemplateBdPtr)
 This function clones all BDs in the BD ring to be the same as the given BD. More...
 
LONG XAxiCdma_BdRingAlloc (XAxiCdma *InstancePtr, int NumBd, XAxiCdma_Bd **BdSetPtr)
 This function requests number of BDs from the BD ring. More...
 
LONG XAxiCdma_BdRingUnAlloc (XAxiCdma *InstancePtr, int NumBd, XAxiCdma_Bd *BdSetPtr)
 This function tries to free the number of BDs back to the ring. More...
 
LONG XAxiCdma_BdRingToHw (XAxiCdma *InstancePtr, int NumBd, XAxiCdma_Bd *BdSetPtr, XAxiCdma_CallBackFn CallBackFn, void *CallBackRef)
 This function tries to enqueue the number of BDs to the hardware. More...
 
u32 XAxiCdma_BdRingFromHw (XAxiCdma *InstancePtr, int BdLimit, XAxiCdma_Bd **BdSetPtr)
 This function tries to retrieve completed BDs from the hardware. More...
 
u32 XAxiCdma_BdRingFree (XAxiCdma *InstancePtr, int NumBd, XAxiCdma_Bd *BdSetPtr)
 This function returns the BDs back to the free pool of the BD ring. More...
 
void XAxiCdma_BdSetCurBdPtr (XAxiCdma *InstancePtr, UINTPTR CurBdPtr)
 This function set the Current BD ptr of a BD. More...
 
void XAxiCdma_BdSetTailBdPtr (XAxiCdma *InstancePtr, UINTPTR TailBdPtr)
 This function set the Tail BD ptr of a BD. More...
 
void XAxiCdma_BdClear (XAxiCdma_Bd *BdPtr)
 This function clears the content of the BD. More...
 
void XAxiCdma_BdClone (XAxiCdma_Bd *BdPtr, XAxiCdma_Bd *TmpBd)
 This function clones the content from the template BD. More...
 
LONG XAxiCdma_BdGetNextPtr (XAxiCdma_Bd *BdPtr)
 This function gets the next BD pointer of the BD. More...
 
void XAxiCdma_BdSetNextPtr (XAxiCdma_Bd *BdPtr, UINTPTR NextBdPtr)
 This function set the Next BD ptr of a BD. More...
 
u32 XAxiCdma_BdGetSts (XAxiCdma_Bd *BdPtr)
 This function gets the completion status of the BD. More...
 
void XAxiCdma_BdClearSts (XAxiCdma_Bd *BdPtr)
 This function clears the status bits of the BD. More...
 
u32 XAxiCdma_BdSetSrcBufAddr (XAxiCdma_Bd *BdPtr, UINTPTR Addr)
 This function sets the source address of the BD. More...
 
LONG XAxiCdma_BdGetSrcBufAddr (XAxiCdma_Bd *BdPtr)
 This function gets the source address of the BD. More...
 
u32 XAxiCdma_BdSetDstBufAddr (XAxiCdma_Bd *BdPtr, UINTPTR Addr)
 This function sets the destination address of the BD. More...
 
LONG XAxiCdma_BdGetDstBufAddr (XAxiCdma_Bd *BdPtr)
 This function gets the destination address of the BD. More...
 
u32 XAxiCdma_BdSetLength (XAxiCdma_Bd *BdPtr, int LenBytes)
 This function sets the length of the BD. More...
 
u32 XAxiCdma_BdGetLength (XAxiCdma_Bd *BdPtr)
 This function gets the length of the BD. More...
 
void XAxiCdma_BdSetPhysAddr (XAxiCdma_Bd *BdPtr, UINTPTR PhysAddr)
 This function sets the Physical address of the BD. More...
 
void XAxiCdma_BdSetIsLite (XAxiCdma_Bd *BdPtr, int IsLite)
 This function sets the is lite mode field of the BD. More...
 
void XAxiCdma_BdSetHasDRE (XAxiCdma_Bd *BdPtr, int HasDRE)
 This function sets the has DRE field of the BD. More...
 
void XAxiCdma_BdSetWordLen (XAxiCdma_Bd *BdPtr, int WordLen)
 This function sets the word length field of the BD. More...
 
void XAxiCdma_BdSetMaxLen (XAxiCdma_Bd *BdPtr, int MaxLen)
 This function sets the maximum transfer length field of the BD. More...
 
LONG XAxiCdma_BdGetPhysAddr (XAxiCdma_Bd *BdPtr)
 This function gets the Physical address of the BD. More...
 
void XAxiCdma_DumpBd (XAxiCdma_Bd *BdPtr)
 This function dumps the BD, it is a debug utility. More...
 

Call Back function

If interrupt is enabled, and the application wants to be notified about the completion of a transfer, the application should register its call back function to the driver.

The call back function is registered through the transfer submission.

Parameters
CallBackRefis the call back reference passed in by application. A NULL pointer is acceptable.
IrqMaskis the interrupt mask regarding this completion
NumBdPtris the pointer to number of BDs this handler should handle, for simple transfer, it is ignored.
typedef void(* XAxiCdma_CallBackFn )(void *CallBackRef, u32 IrqMask, int *NumBdPtr)
 

Buffer Descriptor Alignment

#define XAXICDMA_BD_MINIMUM_ALIGNMENT   0x40
 Minimum byte alignment requirement for descriptors to satisfy both hardware/software needs. More...
 

Register offset definitions

Register accesses are 32-bit.

#define XAXICDMA_CR_OFFSET   0x00000000
 Control register. More...
 
#define XAXICDMA_SR_OFFSET   0x00000004
 Status register. More...
 
#define XAXICDMA_CDESC_OFFSET   0x00000008
 Current descriptor pointer. More...
 
#define XAXICDMA_CDESC_MSB_OFFSET   0x0000000C
 Current descriptor pointer. More...
 
#define XAXICDMA_TDESC_OFFSET   0x00000010
 Tail descriptor pointer. More...
 
#define XAXICDMA_TDESC_MSB_OFFSET   0x00000014
 Tail descriptor pointer. More...
 
#define XAXICDMA_SRCADDR_OFFSET   0x00000018
 Source address register. More...
 
#define XAXICDMA_SRCADDR_MSB_OFFSET   0x0000001C
 Source address register. More...
 
#define XAXICDMA_DSTADDR_OFFSET   0x00000020
 Destination address register. More...
 
#define XAXICDMA_DSTADDR_MSB_OFFSET   0x00000024
 Destination address register. More...
 

Bitmasks of XAXICDMA_CR_OFFSET register

#define XAXICDMA_CR_RESET_MASK   0x00000004
 Reset DMA engine. More...
 
#define XAXICDMA_CR_RESET_MASK   0x00000004
 Reset DMA engine. More...
 
#define XAXICDMA_CR_SGMODE_MASK   0x00000008
 Scatter gather mode. More...
 
#define XAXICDMA_CR_SGMODE_MASK   0x00000008
 Scatter gather mode. More...
 
#define XAXICDMA_CR_KHOLE_RD_MASK   0x00000010
 Keyhole Read. More...
 
#define XAXICDMA_CR_KHOLE_RD_MASK   0x00000010
 Keyhole Read. More...
 
#define XAXICDMA_CR_KHOLE_WR_MASK   0x00000020
 Keyhole Write. More...
 
#define XAXICDMA_CR_KHOLE_WR_MASK   0x00000020
 Keyhole Write. More...
 

Bitmasks of XAXICDMA_SR_OFFSET register

This register reports status of a DMA channel, including idle state, errors, and interrupts

#define XAXICDMA_BTT_OFFSET   0x00000028
 Bytes to transfer. More...
 
#define XAXICDMA_BTT_OFFSET   0x00000028
 Bytes to transfer. More...
 
#define XAXICDMA_SR_IDLE_MASK   0x00000002
 DMA channel idle. More...
 
#define XAXICDMA_SR_IDLE_MASK   0x00000002
 DMA channel idle. More...
 
#define XAXICDMA_SR_SGINCLD_MASK   0x00000008
 Hybrid build. More...
 
#define XAXICDMA_SR_SGINCLD_MASK   0x00000008
 Hybrid build. More...
 
#define XAXICDMA_SR_ERR_INTERNAL_MASK   0x00000010
 Datamover internal err. More...
 
#define XAXICDMA_SR_ERR_INTERNAL_MASK   0x00000010
 Datamover internal err. More...
 
#define XAXICDMA_SR_ERR_SLAVE_MASK   0x00000020
 Datamover slave err. More...
 
#define XAXICDMA_SR_ERR_DECODE_MASK   0x00000040
 Datamover decode err. More...
 
#define XAXICDMA_SR_ERR_SG_INT_MASK   0x00000100
 SG internal err. More...
 
#define XAXICDMA_SR_ERR_SG_SLV_MASK   0x00000200
 SG slave err. More...
 
#define XAXICDMA_SR_ERR_SG_DEC_MASK   0x00000400
 SG decode err. More...
 
#define XAXICDMA_SR_ERR_ALL_MASK   0x00000770
 All errors. More...
 

Bitmask for descriptor

#define XAXICDMA_DESC_LSB_MASK   (0xFFFFFFC0U)
 LSB Address mask. More...
 

Bitmask for interrupts

These masks are shared by XAXICDMA_CR_OFFSET register and XAXICDMA_SR_OFFSET register

#define XAXICDMA_XR_IRQ_IOC_MASK   0x00001000
 Completion interrupt. More...
 
#define XAXICDMA_XR_IRQ_DELAY_MASK   0x00002000
 Delay interrupt. More...
 
#define XAXICDMA_XR_IRQ_ERROR_MASK   0x00004000
 Error interrupt. More...
 
#define XAXICDMA_XR_IRQ_ALL_MASK   0x00007000
 All interrupts. More...
 
#define XAXICDMA_XR_IRQ_SIMPLE_ALL_MASK   0x00005000
 All interrupts for simple only mode. More...
 

Bitmask and shift for delay counter and coalescing counter

These masks are shared by XAXICDMA_CR_OFFSET register and XAXICDMA_SR_OFFSET register

#define XAXICDMA_XR_DELAY_MASK   0xFF000000
 Delay timeout counter. More...
 
#define XAXICDMA_XR_COALESCE_MASK   0x00FF0000
 Coalesce counter. More...
 
#define XAXICDMA_DELAY_SHIFT   24
 
#define XAXICDMA_COALESCE_SHIFT   16
 
#define XAXICDMA_DELAY_MAX   0xFF
 Maximum delay counter value. More...
 
#define XAXICDMA_COALESCE_MAX   0xFF
 Maximum coalescing counter value. More...
 

Buffer Descriptor offsets

The first 8 words are used by hardware.

Cache operations are required for words used by hardware to enforce data consistency. All words after the 8th word are for software use only.

#define XAXICDMA_BD_NDESC_OFFSET   0x00
 Next descriptor pointer. More...
 
#define XAXICDMA_BD_NDESC_MSB_OFFSET   0x04
 Next descriptor pointer. More...
 
#define XAXICDMA_BD_BUFSRC_OFFSET   0x08
 Buffer source address. More...
 
#define XAXICDMA_BD_BUFSRC_MSB_OFFSET   0x0C
 Buffer source address. More...
 
#define XAXICDMA_BD_BUFDST_OFFSET   0x10
 Buffer destination address. More...
 
#define XAXICDMA_BD_BUFDST_MSB_OFFSET   0x14
 Buffer destination address. More...
 
#define XAXICDMA_BD_CTRL_LEN_OFFSET   0x18
 Control/buffer length. More...
 
#define XAXICDMA_BD_STS_OFFSET   0x1C
 Status. More...
 
#define XAXICDMA_BD_PHYS_ADDR_OFFSET   0x20
 Physical address of the BD. More...
 
#define XAXICDMA_BD_PHYS_ADDR_MSB_OFFSET   0x24
 Physical address of the BD. More...
 
#define XAXICDMA_BD_ISLITE_OFFSET   0x28
 Lite mode hardware build? More...
 
#define XAXICDMA_BD_HASDRE_OFFSET   0x2C
 Support unaligned transfers? More...
 
#define XAXICDMA_BD_WORDLEN_OFFSET   0x30
 Word length in bytes. More...
 
#define XAXICDMA_BD_MAX_LEN_OFFSET   0x34
 Word length in bytes. More...
 
#define XAXICDMA_BD_ADDRLEN_OFFSET   0x38
 Word length in bytes. More...
 
#define XAXICDMA_BD_START_CLEAR   8
 Offset to start clear. More...
 
#define XAXICDMA_BD_TO_CLEAR   24
 BD specific bytes to be cleared. More...
 
#define XAXICDMA_BD_NUM_WORDS   16U
 Total number of words for one BD. More...
 
#define XAXICDMA_BD_HW_NUM_BYTES   32
 Number of bytes hw used. More...
 

Bitmasks of XAXICDMA_BD_CTRL_OFFSET register

#define XAXICDMA_BD_CTRL_LENGTH_MASK   0x007FFFFF
 Requested len. More...
 

Bitmasks of XAXICDMA_BD_STS_OFFSET register

#define XAXICDMA_BD_STS_COMPLETE_MASK   0x80000000
 Completed. More...
 
#define XAXICDMA_BD_STS_DEC_ERR_MASK   0x40000000
 Decode error. More...
 
#define XAXICDMA_BD_STS_SLV_ERR_MASK   0x20000000
 Slave error. More...
 
#define XAXICDMA_BD_STS_INT_ERR_MASK   0x10000000
 Internal err. More...
 
#define XAXICDMA_BD_STS_ALL_ERR_MASK   0x70000000
 All errors. More...
 
#define XAXICDMA_BD_STS_ALL_MASK   0xF0000000
 All status bits. More...
 

Macro Definition Documentation

#define XAXICDMA_BD_ADDRLEN_OFFSET   0x38

Word length in bytes.

#define XAXICDMA_BD_BUFDST_MSB_OFFSET   0x14

Buffer destination address.

Referenced by XAxiCdma_BdGetDstBufAddr(), and XAxiCdma_BdSetDstBufAddr().

#define XAXICDMA_BD_BUFDST_OFFSET   0x10

Buffer destination address.

Referenced by XAxiCdma_BdGetDstBufAddr(), and XAxiCdma_BdSetDstBufAddr().

#define XAXICDMA_BD_BUFSRC_MSB_OFFSET   0x0C

Buffer source address.

Referenced by XAxiCdma_BdGetSrcBufAddr(), and XAxiCdma_BdSetSrcBufAddr().

#define XAXICDMA_BD_BUFSRC_OFFSET   0x08

Buffer source address.

Referenced by XAxiCdma_BdGetSrcBufAddr(), and XAxiCdma_BdSetSrcBufAddr().

#define XAXICDMA_BD_CTRL_LEN_OFFSET   0x18

Control/buffer length.

Referenced by XAxiCdma_BdGetLength(), and XAxiCdma_BdSetLength().

#define XAXICDMA_BD_CTRL_LENGTH_MASK   0x007FFFFF

Requested len.

#define XAXICDMA_BD_HASDRE_OFFSET   0x2C
#define XAXICDMA_BD_HW_NUM_BYTES   32

Number of bytes hw used.

#define XAXICDMA_BD_ISLITE_OFFSET   0x28

Lite mode hardware build?

Referenced by XAxiCdma_BdSetIsLite(), and XAxiCdma_DumpBd().

#define XAXICDMA_BD_MAX_LEN_OFFSET   0x34

Word length in bytes.

Referenced by XAxiCdma_BdSetLength(), XAxiCdma_BdSetMaxLen(), and XAxiCdma_DumpBd().

#define XAXICDMA_BD_MINIMUM_ALIGNMENT   0x40

Minimum byte alignment requirement for descriptors to satisfy both hardware/software needs.

Referenced by XAxiCdma_BdRingCreate(), XAxiCdma_BdRingNext(), and XAxiCdma_BdRingPrev().

#define XAXICDMA_BD_NDESC_MSB_OFFSET   0x04

Next descriptor pointer.

Referenced by XAxiCdma_BdGetNextPtr(), and XAxiCdma_BdSetNextPtr().

#define XAXICDMA_BD_NDESC_OFFSET   0x00

Next descriptor pointer.

Referenced by XAxiCdma_BdGetNextPtr(), and XAxiCdma_BdSetNextPtr().

#define XAXICDMA_BD_NUM_WORDS   16U

Total number of words for one BD.

#define XAXICDMA_BD_PHYS_ADDR_MSB_OFFSET   0x24

Physical address of the BD.

Referenced by XAxiCdma_BdGetPhysAddr(), and XAxiCdma_BdSetPhysAddr().

#define XAXICDMA_BD_PHYS_ADDR_OFFSET   0x20

Physical address of the BD.

Referenced by XAxiCdma_BdGetPhysAddr(), and XAxiCdma_BdSetPhysAddr().

#define XAXICDMA_BD_START_CLEAR   8

Offset to start clear.

Referenced by XAxiCdma_BdClear(), and XAxiCdma_BdClone().

#define XAXICDMA_BD_STS_ALL_ERR_MASK   0x70000000

All errors.

#define XAXICDMA_BD_STS_ALL_MASK   0xF0000000

All status bits.

Referenced by XAxiCdma_BdGetSts().

#define XAXICDMA_BD_STS_COMPLETE_MASK   0x80000000

Completed.

Referenced by XAxiCdma_BdRingFromHw().

#define XAXICDMA_BD_STS_DEC_ERR_MASK   0x40000000

Decode error.

#define XAXICDMA_BD_STS_INT_ERR_MASK   0x10000000

Internal err.

#define XAXICDMA_BD_STS_OFFSET   0x1C

Status.

Referenced by XAxiCdma_BdClearSts(), and XAxiCdma_BdGetSts().

#define XAXICDMA_BD_STS_SLV_ERR_MASK   0x20000000

Slave error.

#define XAXICDMA_BD_TO_CLEAR   24

BD specific bytes to be cleared.

Referenced by XAxiCdma_BdClear(), and XAxiCdma_BdClone().

#define XAXICDMA_BD_WORDLEN_OFFSET   0x30
#define XAXICDMA_BTT_OFFSET   0x00000028

Bytes to transfer.

Referenced by XAxiCdma_DumpRegisters(), and XAxiCdma_SimpleTransfer().

#define XAXICDMA_BTT_OFFSET   0x00000028

Bytes to transfer.

#define XAXICDMA_CDESC_MSB_OFFSET   0x0000000C

Current descriptor pointer.

Referenced by XAxiCdma_BdRingGetCurrBd(), XAxiCdma_BdSetCurBdPtr(), and XAxiCdma_DumpRegisters().

#define XAXICDMA_CDESC_OFFSET   0x00000008

Current descriptor pointer.

Referenced by XAxiCdma_BdRingGetCurrBd(), XAxiCdma_BdSetCurBdPtr(), and XAxiCdma_DumpRegisters().

#define XAXICDMA_COALESCE_MAX   0xFF

Maximum coalescing counter value.

Referenced by XAxiCdma_SetCoalesce().

#define XAXICDMA_CR_KHOLE_RD_MASK   0x00000010

Keyhole Read.

Referenced by XAxiCdma_SelectKeyHole().

#define XAXICDMA_CR_KHOLE_RD_MASK   0x00000010

Keyhole Read.

#define XAXICDMA_CR_KHOLE_WR_MASK   0x00000020

Keyhole Write.

Referenced by XAxiCdma_SelectKeyHole().

#define XAXICDMA_CR_KHOLE_WR_MASK   0x00000020

Keyhole Write.

#define XAXICDMA_CR_RESET_MASK   0x00000004

Reset DMA engine.

Referenced by XAxiCdma_Reset(), and XAxiCdma_ResetIsDone().

#define XAXICDMA_CR_RESET_MASK   0x00000004

Reset DMA engine.

#define XAXICDMA_CR_SGMODE_MASK   0x00000008

Scatter gather mode.

Referenced by XAxiCdma_SelectKeyHole().

#define XAXICDMA_CR_SGMODE_MASK   0x00000008

Scatter gather mode.

#define XAXICDMA_DELAY_MAX   0xFF

Maximum delay counter value.

Referenced by XAxiCdma_SetCoalesce().

#define XAXICDMA_DESC_LSB_MASK   (0xFFFFFFC0U)
#define XAXICDMA_DSTADDR_MSB_OFFSET   0x00000024

Destination address register.

Referenced by XAxiCdma_DumpRegisters(), and XAxiCdma_SimpleTransfer().

#define XAXICDMA_DSTADDR_OFFSET   0x00000020

Destination address register.

Referenced by XAxiCdma_DumpRegisters(), and XAxiCdma_SimpleTransfer().

#define XAxiCdma_ReadReg (   BaseAddress,
  RegOffset 
)    XAxiCdma_In32((BaseAddress) + (u32)(RegOffset))

Read a given register.

Parameters
BaseAddressis the base virtual address of the device
RegOffsetis the register offset to be read
Returns
The 32-bit value of the register
Note
C-style signature: u32 XAxiCdma_ReadReg(u32 BaseAddress, u32 RegOffset)

Referenced by XAxiCdma_CfgInitialize(), XAxiCdma_DumpRegisters(), XAxiCdma_GetCoalesce(), XAxiCdma_GetError(), XAxiCdma_IntrDisable(), XAxiCdma_IntrEnable(), XAxiCdma_IntrGetEnabled(), XAxiCdma_IntrHandler(), XAxiCdma_IsBusy(), XAxiCdma_ResetIsDone(), XAxiCdma_SelectKeyHole(), and XAxiCdma_SetCoalesce().

#define XAXICDMA_SR_ERR_ALL_MASK   0x00000770

All errors.

Referenced by XAxiCdma_GetError(), and XAxiCdma_IntrHandler().

#define XAXICDMA_SR_ERR_DECODE_MASK   0x00000040

Datamover decode err.

#define XAXICDMA_SR_ERR_INTERNAL_MASK   0x00000010

Datamover internal err.

#define XAXICDMA_SR_ERR_INTERNAL_MASK   0x00000010

Datamover internal err.

#define XAXICDMA_SR_ERR_SG_DEC_MASK   0x00000400

SG decode err.

#define XAXICDMA_SR_ERR_SG_INT_MASK   0x00000100

SG internal err.

#define XAXICDMA_SR_ERR_SG_SLV_MASK   0x00000200

SG slave err.

#define XAXICDMA_SR_ERR_SLAVE_MASK   0x00000020

Datamover slave err.

#define XAXICDMA_SR_IDLE_MASK   0x00000002

DMA channel idle.

Referenced by XAxiCdma_IsBusy().

#define XAXICDMA_SR_IDLE_MASK   0x00000002

DMA channel idle.

#define XAXICDMA_SR_OFFSET   0x00000004
#define XAXICDMA_SR_SGINCLD_MASK   0x00000008

Hybrid build.

Referenced by XAxiCdma_CfgInitialize().

#define XAXICDMA_SR_SGINCLD_MASK   0x00000008

Hybrid build.

#define XAXICDMA_SRCADDR_MSB_OFFSET   0x0000001C

Source address register.

Referenced by XAxiCdma_DumpRegisters(), and XAxiCdma_SimpleTransfer().

#define XAXICDMA_SRCADDR_OFFSET   0x00000018

Source address register.

Referenced by XAxiCdma_DumpRegisters(), and XAxiCdma_SimpleTransfer().

#define XAXICDMA_TDESC_MSB_OFFSET   0x00000014

Tail descriptor pointer.

Referenced by XAxiCdma_BdSetTailBdPtr(), and XAxiCdma_DumpRegisters().

#define XAXICDMA_TDESC_OFFSET   0x00000010

Tail descriptor pointer.

Referenced by XAxiCdma_BdSetTailBdPtr(), and XAxiCdma_DumpRegisters().

#define XAxiCdma_WriteReg (   BaseAddress,
  RegOffset,
  Data 
)    XAxiCdma_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data))

Write to a given register.

Parameters
BaseAddressis the base virtual address of the device
RegOffsetis the register offset to be written
Datais the 32-bit value to write to the register
Returns
None.
Note
C-style signature: void XAxiCdma_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)

Referenced by XAxiCdma_BdSetCurBdPtr(), XAxiCdma_BdSetTailBdPtr(), XAxiCdma_IntrDisable(), XAxiCdma_IntrEnable(), XAxiCdma_IntrHandler(), XAxiCdma_Reset(), XAxiCdma_SelectKeyHole(), XAxiCdma_SetCoalesce(), and XAxiCdma_SimpleTransfer().

#define XAXICDMA_XR_COALESCE_MASK   0x00FF0000

Coalesce counter.

Referenced by XAxiCdma_GetCoalesce(), and XAxiCdma_SetCoalesce().

#define XAXICDMA_XR_DELAY_MASK   0xFF000000

Delay timeout counter.

Referenced by XAxiCdma_GetCoalesce(), and XAxiCdma_SetCoalesce().

#define XAXICDMA_XR_IRQ_DELAY_MASK   0x00002000

Delay interrupt.

#define XAXICDMA_XR_IRQ_ERROR_MASK   0x00004000

Error interrupt.

Referenced by XAxiCdma_IntrHandler().

#define XAXICDMA_XR_IRQ_IOC_MASK   0x00001000

Completion interrupt.

#define XAXICDMA_XR_IRQ_SIMPLE_ALL_MASK   0x00005000

All interrupts for simple only mode.

Referenced by XAxiCdma_SimpleTransfer().

Typedef Documentation

typedef UINTPTR XAxiCdma_Bd[XAXICDMA_BD_NUM_WORDS]

XAxiCdma_Bd.

Buffer descriptor, shared by hardware and software The structure of the BD is as the following, however, the user never directly accesses the fields in the BD. The following shows the fields inside a BD:

u32 NextBdPtr; u32 NextBdPtrMsb; u32 SrcAddr; u32 SrcAddrMsb; u32 DstAddr; u32 DstAddrMsb; int Length; u32 Status; u32 PhysAddr; u32 IsLite; u32 HasDRE; u32 WordLen; u32 Addrlen;

Function Documentation

void XAxiCdma_BdClear ( XAxiCdma_Bd BdPtr)

This function clears the content of the BD.

Parameters
BdPtris the pointer to the BD to be cleared
Returns
None.
Note
None.

References XAXICDMA_BD_START_CLEAR, and XAXICDMA_BD_TO_CLEAR.

void XAxiCdma_BdClearSts ( XAxiCdma_Bd BdPtr)

This function clears the status bits of the BD.

The status bits include the completion bit as well as the error bits.

This is the only function that needs to be called to clear a completed BD. All other fields (except reserved words) need to be re-assigned before re-submission.

Parameters
BdPtris the pointer to the BD to clear the status
Returns
None
Note
None.

References XAXICDMA_BD_STS_OFFSET.

Referenced by XAxiCdma_BdRingClone(), and XAxiCdma_BdRingToHw().

void XAxiCdma_BdClone ( XAxiCdma_Bd BdPtr,
XAxiCdma_Bd TmpBd 
)

This function clones the content from the template BD.

Parameters
BdPtris the pointer to the BD to be cloned to
TmpBdis the pointer to the BD to be cloned from
Returns
None.
Note
None.

References XAXICDMA_BD_START_CLEAR, and XAXICDMA_BD_TO_CLEAR.

Referenced by XAxiCdma_BdRingClone().

LONG XAxiCdma_BdGetDstBufAddr ( XAxiCdma_Bd BdPtr)

This function gets the destination address of the BD.

Parameters
BdPtris the pointer to the BD to get the destination address
Returns
The destination address of the buffer that this BD describes
Note
None

References XAXICDMA_BD_BUFDST_MSB_OFFSET, and XAXICDMA_BD_BUFDST_OFFSET.

Referenced by XAxiCdma_DumpBd().

u32 XAxiCdma_BdGetLength ( XAxiCdma_Bd BdPtr)

This function gets the length of the BD.

Parameters
BdPtris the pointer to the BD to get the length
Returns
The length of the buffer that this BD describes
Note
None

References XAXICDMA_BD_CTRL_LEN_OFFSET.

Referenced by XAxiCdma_BdRingToHw(), and XAxiCdma_DumpBd().

LONG XAxiCdma_BdGetNextPtr ( XAxiCdma_Bd BdPtr)

This function gets the next BD pointer of the BD.

Parameters
BdPtris the pointer to the BD to get the next BD ptr
Returns
The next BD ptr of the BD.
Note
None.

References XAXICDMA_BD_NDESC_MSB_OFFSET, and XAXICDMA_BD_NDESC_OFFSET.

Referenced by XAxiCdma_DumpBd().

LONG XAxiCdma_BdGetPhysAddr ( XAxiCdma_Bd BdPtr)

This function gets the Physical address of the BD.

Parameters
BdPtris the pointer to the BD to get the physical address
Returns
The physical address of the BD
Note
None

References XAXICDMA_BD_PHYS_ADDR_MSB_OFFSET, and XAXICDMA_BD_PHYS_ADDR_OFFSET.

Referenced by XAxiCdma_BdRingToHw(), and XAxiCdma_DumpBd().

LONG XAxiCdma_BdGetSrcBufAddr ( XAxiCdma_Bd BdPtr)

This function gets the source address of the BD.

Parameters
BdPtris the pointer to the BD to get the source address
Returns
The source address of the buffer that this BD describes
Note
None.

References XAXICDMA_BD_BUFSRC_MSB_OFFSET, and XAXICDMA_BD_BUFSRC_OFFSET.

Referenced by XAxiCdma_DumpBd().

u32 XAxiCdma_BdGetSts ( XAxiCdma_Bd BdPtr)

This function gets the completion status of the BD.

Parameters
BdPtris the pointer to the BD to get the status
Returns
The status bits of the BD.
Note
None.

References XAXICDMA_BD_STS_ALL_MASK, and XAXICDMA_BD_STS_OFFSET.

Referenced by XAxiCdma_BdRingFromHw(), and XAxiCdma_DumpBd().

LONG XAxiCdma_BdRingAlloc ( XAxiCdma *  InstancePtr,
int  NumBd,
XAxiCdma_Bd **  BdSetPtr 
)

This function requests number of BDs from the BD ring.

Parameters
InstancePtris the driver instance we are working on
NumBdis the number of BDs to request
BdSetPtris the pointer to the set of BDs returned
Returns
  • XST_SUCCESS for success
  • XST_INVALID_PARAM if requests non-positive number of BDs
  • XST_FAILURE if not enough free BDs available
Note
None.
LONG XAxiCdma_BdRingClone ( XAxiCdma *  InstancePtr,
XAxiCdma_Bd TemplateBdPtr 
)

This function clones all BDs in the BD ring to be the same as the given BD.

Parameters
InstancePtris the driver instance we are working on
TemplateBdPtris the BD to be copied from
Returns
  • XST_SUCCESS for success
  • XST_DMA_SG_NO_LIST if there is no BD ring
  • XST_DEVICE_IS_STARTED if the hardware is running
  • XST_DMA_SG_LIST_ERROR is the BD ring is still in use
Note
None.

References XAxiCdma_BdClearSts(), XAxiCdma_BdClone(), and XAxiCdma_IsBusy().

u32 XAxiCdma_BdRingCntCalc ( u32  Alignment,
u32  Bytes,
UINTPTR  BdBuffAddr 
)

This function calculates how many BDs can be built using given number of bytes of memory, according to alignment provided.

Parameters
Alignmentis the preferred alignment for the BDs
Bytesis the number of bytes of memory to build BDs with
BdBuffAddris the buffer address allocated for the BDs. This is to check the alignment of the buffer to make sure the the buffer is aligned to the BD alignment. An invalid buffer address results in 0.
Returns
The number of BDs can be built. 0 means buffer address is not valid.
Note
The application is responsible to align the buffer before pass it to this function.
LONG XAxiCdma_BdRingCreate ( XAxiCdma *  InstancePtr,
UINTPTR  PhysAddr,
UINTPTR  VirtAddr,
u32  Alignment,
int  BdCount 
)

This function creates the BD ring for the driver instance.

If a BD ring pre-exist of this ring, the previous ring is lost.

Parameters
InstancePtris the driver instance we are working on
PhysAddris the physical address of the memory for the BD ring
VirtAddris the virtual address of the memory for the BD ring
Alignmentis the alignment for the BDs
BdCountis the number of BDs to create in the ring
Returns
  • XST_SUCCESS for success
  • XST_INVALID_PARAM for invalid parameter
  • XST_DMA_SG_LIST_ERROR for invalid memory region
  • XST_FAILURE if the hardware build is simple mode only
Note
For a system that has flat memory layout, then the PhysAddr and the VirtAddr are the same.

References XAXICDMA_BD_MINIMUM_ALIGNMENT, XAxiCdma_BdSetHasDRE(), XAxiCdma_BdSetIsLite(), XAxiCdma_BdSetMaxLen(), XAxiCdma_BdSetNextPtr(), XAxiCdma_BdSetPhysAddr(), and XAxiCdma_BdSetWordLen().

u32 XAxiCdma_BdRingFree ( XAxiCdma *  InstancePtr,
int  NumBd,
XAxiCdma_Bd BdSetPtr 
)

This function returns the BDs back to the free pool of the BD ring.

Parameters
InstancePtris the driver instance we are working on
NumBdis the number of BDs to free
BdSetPtris the set of BDs to be freed
Returns
  • XST_SUCCESS for success
  • XST_INVALID_PARAM if number of BDs is negative
  • XST_DMA_SG_LIST_ERROR if the BD ring management has a problem
Note
None.
u32 XAxiCdma_BdRingFromHw ( XAxiCdma *  InstancePtr,
int  BdLimit,
XAxiCdma_Bd **  BdSetPtr 
)

This function tries to retrieve completed BDs from the hardware.

Parameters
InstancePtris the driver instance we are working on
BdLimitis the maximum number of completed BDs to retrieve
BdSetPtris the set of completed BDs
Returns
The number of completed BDs.
Note
None.

References XAXICDMA_BD_STS_COMPLETE_MASK, XAxiCdma_BdGetSts(), and XAxiCdma_BdRingNext().

u32 XAxiCdma_BdRingGetCnt ( XAxiCdma *  InstancePtr)

This function gets the total number of BDs in the BD ring.

Parameters
InstancePtris the driver instance we are working on
Returns
The total number of BDs for this instance
Note
None.
XAxiCdma_Bd * XAxiCdma_BdRingGetCurrBd ( XAxiCdma *  InstancePtr)

This function grabs a copy of the current BD pointer from the hardware.

Parameters
InstancePtris the driver instance we are working on
Returns
The BD pointer in CDESC register
Note
None.

References XAXICDMA_CDESC_MSB_OFFSET, and XAXICDMA_CDESC_OFFSET.

Referenced by XAxiCdma_BdRingSnapShotCurrBd(), and XAxiCdma_SelectKeyHole().

u32 XAxiCdma_BdRingGetFreeCnt ( XAxiCdma *  InstancePtr)

This function gets the number of free BDs.

Parameters
InstancePtris the driver instance we are working on
Returns
The total number of free BDs for this instance
Note
None.
u32 XAxiCdma_BdRingMemCalc ( u32  Alignment,
int  NumBd 
)

This function calculates how much memory is needed to build requested number of BDs.

Parameters
Alignmentis the preferred alignment for the BDs
NumBdis the number of BDs to be built
Returns
The number of bytes of memory needed to build the BDs
Note
None.
XAxiCdma_Bd * XAxiCdma_BdRingNext ( XAxiCdma *  InstancePtr,
XAxiCdma_Bd BdPtr 
)

This function gets the next BD of the current BD on the BD ring.

Parameters
InstancePtris the driver instance we are working on
BdPtris the current BD
Returns
The next BD on the ring from the current BD, NULL if passed in BdPtr not valid.
Note
None.

References XAXICDMA_BD_MINIMUM_ALIGNMENT.

Referenced by XAxiCdma_BdRingFromHw(), XAxiCdma_BdRingSnapShotCurrBd(), XAxiCdma_BdRingToHw(), and XAxiCdma_SelectKeyHole().

XAxiCdma_Bd * XAxiCdma_BdRingPrev ( XAxiCdma *  InstancePtr,
XAxiCdma_Bd BdPtr 
)

This function gets the previous BD of the current BD on the BD ring.

Parameters
InstancePtris the driver instance we are working on
BdPtris the current BD
Returns
The previous BD on the ring from the current BD
Note
None.

References XAXICDMA_BD_MINIMUM_ALIGNMENT.

Referenced by XAxiCdma_BdRingToHw().

void XAxiCdma_BdRingSnapShotCurrBd ( XAxiCdma *  InstancePtr)

This function grabs a copy of the current BD pointer from the hardware.

It is normally used to prepare for the hardware reset. The snapshot of the current BD pointer should be reloaded once the reset is done.

Parameters
InstancePtris the driver instance we are working on
Returns
None
Note
None.

References XAxiCdma_BdRingGetCurrBd(), and XAxiCdma_BdRingNext().

LONG XAxiCdma_BdRingToHw ( XAxiCdma *  InstancePtr,
int  NumBd,
XAxiCdma_Bd BdSetPtr,
XAxiCdma_CallBackFn  CallBackFn,
void *  CallBackRef 
)

This function tries to enqueue the number of BDs to the hardware.

Parameters
InstancePtris the driver instance we are working on
NumBdis the number of BDs to enqueue
BdSetPtris the set of BDs to be enqueued
CallBackFnis the callback function for this transfer, NULL is fine
CallBackRefis the callback reference pointer
Returns
  • XST_SUCCESS for success
  • XST_INVALID_PARAM if enqueues negative number of BDs or zero transfer len
  • XST_DMA_SG_LIST_ERROR if BD ring management has a problem
  • XST_FIFO_NO_ROOM if the interrupt handler array is full
  • XST_FAILURE for: Hardware is in invalid state, for example, reset failed Or, the hardware build is simple mode only
Note
None.

References XAxiCdma_BdClearSts(), XAxiCdma_BdGetLength(), XAxiCdma_BdGetPhysAddr(), XAxiCdma_BdRingNext(), XAxiCdma_BdRingPrev(), and XAxiCdma_BdSetTailBdPtr().

LONG XAxiCdma_BdRingUnAlloc ( XAxiCdma *  InstancePtr,
int  NumBd,
XAxiCdma_Bd BdSetPtr 
)

This function tries to free the number of BDs back to the ring.

Parameters
InstancePtris the driver instance we are working on
NumBdis the number of BDs to return
BdSetPtris the set of BDs to be returned
Returns
  • XST_SUCCESS for success
  • XST_INVALID_PARAM if to free non-positive number of BDs
  • XST_FAILURE if BD ring management shows an error
Note
None.
void XAxiCdma_BdSetCurBdPtr ( XAxiCdma *  InstancePtr,
UINTPTR  CurBdPtr 
)

This function set the Current BD ptr of a BD.

Parameters
BdPtris the pointer to the BD to set the Next BD ptr
CurBdPtris the valud of Current BD ptr
Returns
None
Note
None.

References XAXICDMA_CDESC_MSB_OFFSET, XAXICDMA_CDESC_OFFSET, XAXICDMA_DESC_LSB_MASK, and XAxiCdma_WriteReg.

Referenced by XAxiCdma_SelectKeyHole().

u32 XAxiCdma_BdSetDstBufAddr ( XAxiCdma_Bd BdPtr,
UINTPTR  Addr 
)

This function sets the destination address of the BD.

Parameters
BdPtris the pointer to the BD to set the destination address
Addris the destination address of the buffer
Returns
  • XST_SUCCESS if buffer address set successfully
  • XST_INVALID_PARAM if buffer address is not aligned and hardware build has no DRE or in lite mode
Note
None.

References XAXICDMA_BD_BUFDST_MSB_OFFSET, XAXICDMA_BD_BUFDST_OFFSET, XAXICDMA_BD_HASDRE_OFFSET, and XAXICDMA_BD_WORDLEN_OFFSET.

void XAxiCdma_BdSetHasDRE ( XAxiCdma_Bd BdPtr,
int  HasDRE 
)

This function sets the has DRE field of the BD.

Parameters
BdPtris the pointer to the BD to work on
HasDREis the value for whether hardware has DRE built in
Returns
None
Note
None

References XAXICDMA_BD_HASDRE_OFFSET.

Referenced by XAxiCdma_BdRingCreate().

void XAxiCdma_BdSetIsLite ( XAxiCdma_Bd BdPtr,
int  IsLite 
)

This function sets the is lite mode field of the BD.

Parameters
BdPtris the pointer to the BD to work on
IsLiteis the value for whether hardware is in lite mode
Returns
None
Note
None

References XAXICDMA_BD_ISLITE_OFFSET.

Referenced by XAxiCdma_BdRingCreate().

u32 XAxiCdma_BdSetLength ( XAxiCdma_Bd BdPtr,
int  LenBytes 
)

This function sets the length of the BD.

Parameters
BdPtris the pointer to the BD to set the length
LenBytesis the length of the buffer
Returns
  • XST_SUCCESS for success
  • XST_INVALID_PARAM if invalid length: Length value out of valid range
Note
One case that will cause hardware failure is not covered here: If the start address is not at page offset 0, and the length plus the offset crosses the page boundary, this will cause slave error if the hardware is built in lite mode.

References XAXICDMA_BD_CTRL_LEN_OFFSET, and XAXICDMA_BD_MAX_LEN_OFFSET.

void XAxiCdma_BdSetMaxLen ( XAxiCdma_Bd BdPtr,
int  MaxLen 
)

This function sets the maximum transfer length field of the BD.

Parameters
BdPtris the pointer to the BD to work on
MaxLenis the maximum transfer length in bytes
Returns
None
Note
None

References XAXICDMA_BD_MAX_LEN_OFFSET.

Referenced by XAxiCdma_BdRingCreate().

void XAxiCdma_BdSetNextPtr ( XAxiCdma_Bd BdPtr,
UINTPTR  NextBdPtr 
)

This function set the Next BD ptr of a BD.

Parameters
BdPtris the pointer to the BD to set the Next BD ptr
NextBdPtris the valud of Next BD ptr
Returns
None
Note
None.

References XAXICDMA_BD_NDESC_MSB_OFFSET, XAXICDMA_BD_NDESC_OFFSET, and XAXICDMA_DESC_LSB_MASK.

Referenced by XAxiCdma_BdRingCreate().

void XAxiCdma_BdSetPhysAddr ( XAxiCdma_Bd BdPtr,
UINTPTR  PhysAddr 
)

This function sets the Physical address of the BD.

Parameters
BdPtris the pointer to the BD to set the physical address
PhysAddris the physical address of the BD
Returns
None
Note
None

References XAXICDMA_BD_PHYS_ADDR_MSB_OFFSET, and XAXICDMA_BD_PHYS_ADDR_OFFSET.

Referenced by XAxiCdma_BdRingCreate().

u32 XAxiCdma_BdSetSrcBufAddr ( XAxiCdma_Bd BdPtr,
UINTPTR  Addr 
)

This function sets the source address of the BD.

Parameters
BdPtris the pointer to the BD to set the source address
Addris the source address of the buffer
Returns
  • XST_SUCCESS if buffer address set successfully
  • XST_INVALID_PARAM if buffer address is not aligned and hardware build has no DRE or in lite mode
Note
None.

References XAXICDMA_BD_BUFSRC_MSB_OFFSET, XAXICDMA_BD_BUFSRC_OFFSET, XAXICDMA_BD_HASDRE_OFFSET, and XAXICDMA_BD_WORDLEN_OFFSET.

void XAxiCdma_BdSetTailBdPtr ( XAxiCdma *  InstancePtr,
UINTPTR  TailBdPtr 
)

This function set the Tail BD ptr of a BD.

Parameters
BdPtris the pointer to the BD to set the Next BD ptr
TailBd is the value of Tail BD ptr
Returns
None
Note
None.

References XAXICDMA_DESC_LSB_MASK, XAXICDMA_TDESC_MSB_OFFSET, XAXICDMA_TDESC_OFFSET, and XAxiCdma_WriteReg.

Referenced by XAxiCdma_BdRingToHw().

void XAxiCdma_BdSetWordLen ( XAxiCdma_Bd BdPtr,
int  WordLen 
)

This function sets the word length field of the BD.

Parameters
BdPtris the pointer to the BD to work on
WordLenis the length of word in bytes
Returns
None
Note
None

References XAXICDMA_BD_WORDLEN_OFFSET.

Referenced by XAxiCdma_BdRingCreate().

u32 XAxiCdma_CfgInitialize ( XAxiCdma *  InstancePtr,
XAxiCdma_Config *  CfgPtr,
UINTPTR  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
InstancePtris the driver instance that is working on
CfgPtris the pointer to the hardware configuration structure
EffectiveAddris 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.

References XAxiCdma_ReadReg, XAxiCdma_Reset(), XAxiCdma_ResetIsDone(), XAXICDMA_SR_OFFSET, and XAXICDMA_SR_SGINCLD_MASK.

Referenced by XAxiCdma_HybridIntrExample(), XAxiCdma_HybridPollExample(), XAxiCdma_SgIntrExample(), XAxiCdma_SgPollExample(), XAxiCdma_SimpleIntrExample(), and XAxiCdma_SimplePollExample().

void XAxiCdma_DumpBd ( XAxiCdma_Bd BdPtr)

This function dumps the BD, it is a debug utility.

Parameters
BdPtris the pointer to the BD to get the physical address
Returns
None
Note
None

References XAXICDMA_BD_HASDRE_OFFSET, XAXICDMA_BD_ISLITE_OFFSET, XAXICDMA_BD_MAX_LEN_OFFSET, XAXICDMA_BD_WORDLEN_OFFSET, XAxiCdma_BdGetDstBufAddr(), XAxiCdma_BdGetLength(), XAxiCdma_BdGetNextPtr(), XAxiCdma_BdGetPhysAddr(), XAxiCdma_BdGetSrcBufAddr(), and XAxiCdma_BdGetSts().

void XAxiCdma_DumpRegisters ( XAxiCdma *  InstancePtr)

This function dumps the registers of this DMA instance.

Parameters
InstancePtris the driver instance we are working on
Returns
None
Note
None.

References XAXICDMA_BTT_OFFSET, XAXICDMA_CDESC_MSB_OFFSET, XAXICDMA_CDESC_OFFSET, XAXICDMA_CR_OFFSET, XAXICDMA_DSTADDR_MSB_OFFSET, XAXICDMA_DSTADDR_OFFSET, XAxiCdma_ReadReg, XAXICDMA_SR_OFFSET, XAXICDMA_SRCADDR_MSB_OFFSET, XAXICDMA_SRCADDR_OFFSET, XAXICDMA_TDESC_MSB_OFFSET, and XAXICDMA_TDESC_OFFSET.

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
InstancePtris the driver instance we are working on
CounterPtris the return value for the coalescing counter setting
DelayPtris the return value for the delay counter setting
Returns
A zero coalescing threshold indicates invalid results
Note
None.

References XAXICDMA_CR_OFFSET, XAxiCdma_ReadReg, XAXICDMA_XR_COALESCE_MASK, and XAXICDMA_XR_DELAY_MASK.

u32 XAxiCdma_GetError ( XAxiCdma *  InstancePtr)

This function gets the status on error bits.

Parameters
InstancePtris the driver instance we are working on
Returns
The error bits in the status register. Zero indicates no errors.
Note
None.

References XAxiCdma_ReadReg, XAXICDMA_SR_ERR_ALL_MASK, and XAXICDMA_SR_OFFSET.

Referenced by XAxiCdma_SgIntrExample().

void XAxiCdma_IntrDisable ( XAxiCdma *  InstancePtr,
u32  Mask 
)

This function disables interrupts specified by the Mask.

Interrupts that are not in the mask are not affected.

Parameters
InstancePtris the driver instance we are working on
Maskis the mask for the interrupts to be disabled
Returns
None
Note
None.

References XAXICDMA_CR_OFFSET, XAxiCdma_ReadReg, XAxiCdma_WriteReg, and XAXICDMA_XR_IRQ_ALL_MASK.

Referenced by XAxiCdma_HybridPollExample(), and XAxiCdma_SimplePollExample().

void XAxiCdma_IntrEnable ( XAxiCdma *  InstancePtr,
u32  Mask 
)

This function enables interrupts specified by the Mask.

Interrupts that are not in the mask are not affected.

Parameters
InstancePtris the driver instance we are working on
Maskis the mask for the interrupts to be enabled
Returns
None
Note
None.

References XAXICDMA_CR_OFFSET, XAxiCdma_ReadReg, XAxiCdma_WriteReg, and XAXICDMA_XR_IRQ_ALL_MASK.

Referenced by XAxiCdma_HybridIntrExample(), XAxiCdma_SgIntrExample(), and XAxiCdma_SimpleIntrExample().

u32 XAxiCdma_IntrGetEnabled ( XAxiCdma *  InstancePtr)

This function gets the mask for the interrupts that are currently enabled.

Parameters
InstancePtris the driver instance we are working on
Returns
The bit mask for the interrupts that are currently enabled
Note
None.

References XAXICDMA_CR_OFFSET, XAxiCdma_ReadReg, and XAXICDMA_XR_IRQ_ALL_MASK.

Referenced by XAxiCdma_SimpleTransfer().

void XAxiCdma_IntrHandler ( void *  HandlerRef)

This function is the interrupt handler for the driver, it handles all the interrupts.

For the completion of a transfer that has a callback function, the callback function is called.

Parameters
HandlerRefis a reference pointer passed to the interrupt registration function. It will be a pointer to the driver instance we are working on
Returns
None
Note
If one transfer does not have all its submitted BDs completed successfully,then a reset is needed to clean up the mess left by that transfer.Otherwise, the wrong interrupt callback maybe called for the following transfers. However, if you always use the same interrupt callback for all the transfers, and you are the only user of the DMA engine, then you do not have to worry about this.

References XAxiCdma_ReadReg, XAxiCdma_Reset(), XAxiCdma_ResetIsDone(), XAXICDMA_SR_ERR_ALL_MASK, XAXICDMA_SR_OFFSET, XAxiCdma_WriteReg, XAXICDMA_XR_IRQ_ALL_MASK, and XAXICDMA_XR_IRQ_ERROR_MASK.

Referenced by XAxiCdma_SimpleIntrExample().

int XAxiCdma_IsBusy ( XAxiCdma *  InstancePtr)

This function checks whether the hardware is doing transfer.

Parameters
InstancePtris the driver instance we are working on
Returns
  • 1 if the hardware is doing a transfer
  • 0 if the hardware is idle
Note
None.

References XAxiCdma_ReadReg, XAXICDMA_SR_IDLE_MASK, and XAXICDMA_SR_OFFSET.

Referenced by XAxiCdma_BdRingClone(), XAxiCdma_SelectKeyHole(), and XAxiCdma_SimpleTransfer().

XAxiCdma_Config * XAxiCdma_LookupConfig ( u32  DeviceId)

Look up the hardware configuration for a device instance.

Parameters
DeviceIdis the unique device ID of the device to lookup for
Returns
The configuration structure for the device. If the device ID is not found,a NULL pointer is returned.
Note
None.

Referenced by XAxiCdma_HybridIntrExample(), XAxiCdma_HybridPollExample(), XAxiCdma_SgIntrExample(), XAxiCdma_SgPollExample(), XAxiCdma_SimpleIntrExample(), and XAxiCdma_SimplePollExample().

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
InstancePtris the driver instance we are working on
Returns
None
Note
None.

References XAXICDMA_CR_OFFSET, XAXICDMA_CR_RESET_MASK, and XAxiCdma_WriteReg.

Referenced by XAxiCdma_CfgInitialize(), XAxiCdma_IntrHandler(), and XAxiCdma_SgPollExample().

int XAxiCdma_ResetIsDone ( XAxiCdma *  InstancePtr)

This function checks whether the hardware reset is done.

Parameters
InstancePtris the driver instance we are working on
Returns
  • 1 if the reset has finished successfully
  • 0 if the reset is not done
Note
None.

References XAXICDMA_CR_OFFSET, XAXICDMA_CR_RESET_MASK, and XAxiCdma_ReadReg.

Referenced by XAxiCdma_CfgInitialize(), XAxiCdma_IntrHandler(), and XAxiCdma_SgPollExample().

int XAxiCdma_SelectKeyHole ( XAxiCdma *  InstancePtr,
u32  Direction,
u32  Select 
)

This function configures KeyHole Write/Read Feature.

Parameters
InstancePtris the driver instance we are working on
Directionis 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.

References XAxiCdma_BdRingGetCurrBd(), XAxiCdma_BdRingNext(), XAxiCdma_BdSetCurBdPtr(), XAXICDMA_CR_KHOLE_RD_MASK, XAXICDMA_CR_KHOLE_WR_MASK, XAXICDMA_CR_OFFSET, XAXICDMA_CR_SGMODE_MASK, XAxiCdma_IsBusy(), XAxiCdma_ReadReg, and XAxiCdma_WriteReg.

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
InstancePtris the driver instance we are working on
Counteris the coalescing threshold to set to, the valid range is 1 to XAXICDMA_COALESCE_MAX.
Delayis 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.

References XAXICDMA_COALESCE_MAX, XAXICDMA_CR_OFFSET, XAXICDMA_DELAY_MAX, XAxiCdma_ReadReg, XAxiCdma_WriteReg, XAXICDMA_XR_COALESCE_MASK, and XAXICDMA_XR_DELAY_MASK.

u32 XAxiCdma_SimpleTransfer ( XAxiCdma *  InstancePtr,
UINTPTR  SrcAddr,
UINTPTR  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
InstancePtris the pointer to the driver instance
SrcAddris the address of the source buffer
DstAddris the address of the destination buffer
Lengthis the length of the transfer
SimpleCallBackis the callback function for the simple transfer
CallBackRefis 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: XAXICDMA_MAX_TRANSFER_LEN] 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.

References XAXICDMA_BTT_OFFSET, XAXICDMA_DSTADDR_MSB_OFFSET, XAXICDMA_DSTADDR_OFFSET, XAxiCdma_IntrGetEnabled(), XAxiCdma_IsBusy(), XAXICDMA_SRCADDR_MSB_OFFSET, XAXICDMA_SRCADDR_OFFSET, XAxiCdma_WriteReg, and XAXICDMA_XR_IRQ_SIMPLE_ALL_MASK.