mcdma
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Overview

Data Structures

struct  XMcdma_ChanCtrl
 Per-channel control and BD ring state for MCDMA. More...
 
struct  XMcdma
 Driver instance data for an MCDMA device. More...
 

Macros

#define XMCDMA_LOOP_COUNT   1000000
 Default poll loop iteration limit. More...
 
#define XMCDMA_NUM_APP_WORDS   5
 Number of application words in a buffer descriptor. More...
 
#define XMCDMA_MAX_CHAN_PER_DEVICE   32
 Maximum number of channels per MCDMA device. More...
 
#define XMCDMA_CHAN_IDLE   0
 Channel idle state value. More...
 
#define XMCDMA_CHAN_PAUSE   1
 Channel paused state value. More...
 
#define XMCDMA_CHAN_BUSY   2
 Channel busy state value. More...
 
#define XMCDMA_BD_MINIMUM_ALIGNMENT   0x40
 Minimum buffer descriptor alignment in bytes. More...
 
#define XMCDMA_AXCACHE   0xB
 Default AXI cache attribute value. More...
 
#define XMCDMA_DEV_TO_MEM   0
 Transfer direction from device to memory. More...
 
#define XMCDMA_MEM_TO_DEV   1
 Transfer direction from memory to device. More...
 
#define XMcdma_DisableCh(Chan, ChanId)
 Disable Particular Channel in the MCDMA Core. More...
 
#define XMcdma_GetChan(Chan)   XMcdma_ReadReg(Chan->ChanBase, XMCDMA_CHSER_OFFSET)
 Get Channel number that last Serviced. More...
 
#define XMcdma_isidle(Chan)
 Checks whether the DMA channel is idle or not. More...
 
#define XMcdma_IntrEnable(Chan, Mask)
 Enables interrupts specified by the Mask in specified direction, Interrupts that are not in the mask are not affected. More...
 
#define XMcdma_IntrDisable(Chan, Mask)
 Disables interrupts specified by the Mask. More...
 
#define XMcdma_GetPktDrp_cnt(Chan)   XMcdma_ReadReg(Chan->ChanBase, XMCDMA_CPKTDROP_OFFSET)
 Gets global Packet drop Count. More...
 
#define XMcdma_GetMcdmaTxChan(InstancePtr, ChanId)   (&((InstancePtr)->Tx_Chan[ChanId]))
 Gets the TX Channel Pointer. More...
 
#define XMcdma_GetMcdmaRxChan(InstancePtr, ChanId)   (&((InstancePtr)->Rx_Chan[ChanId]))
 Gets the RX Channel Pointer. More...
 
#define XMcdma_GetChanCurBd(Chan)   ((Chan)->BdRestart)
 Gets the Channel BD Chain Current BD. More...
 
#define XMcdma_GetChanBdDoneCnt(Chan)   ((Chan)->BdDoneCnt)
 Returns the buffer descriptor count processed by the h/w. More...
 
#define XMcdma_ChanGetIrq(Chan)
 Returns asserted channel interrupts. More...
 
#define XMcdma_ChanAckIrq(Chan, Mask)
 Acknowledges the specified channel interrupts that are specified in Mask. More...
 
#define XMcdma_GetChanPktDrp_Cnt(Chan, ChanId)
 Get Packet drop Count for the particular Channel. More...
 
#define XMcdma_SetARCache(InstancePtr, Value)
 Sets the ARCACHE field with the user specified value. More...
 
#define XMcdma_SetAWCache(InstancePtr, Value)
 Sets the AWCACHE field with the user specified value. More...
 
#define XMcdma_GetEgressObserver(InstancePtr, ObsId)
 Get Egress Channel Observer contents. More...
 
#define XMcdma_GetIngressObserver(InstancePtr, ObsId)
 Get Ingress Channel Observer contents. More...
 
#define MAX_TRANSFER_LEN(h)   (((~0UL) << (0)) & (~0UL >> (32 - 1 - (h))))
 Computes a contiguous bit mask for the maximum transfer length field. More...
 
#define WRR_MASK(h, l)   (((~0UL) << (l)) & (~0UL >> (32 - 1 - (h))))
 Computes a contiguous bit mask between high and low bit indices. More...
 
#define XMCDMA_CHAN_SEEKAHEAD(Chan, BdPtr, NumBd)
 Advances a BD pointer by a number of descriptors with ring wrap. More...
 
#define XMCDMA_CACHE_FLUSH(BdPtr)   Xil_DCacheFlushRange((UINTPTR)(BdPtr), XMCDMA_BD_HW_NUM_BYTES)
 Declares cache flush and invalidate helpers for BDs in cached memory. More...
 
#define XMCDMA_CACHE_INVALIDATE(BdPtr)   Xil_DCacheInvalidateRange((UINTPTR)(BdPtr), XMCDMA_BD_HW_NUM_BYTES)
 Invalidates the data cache for a buffer descriptor. More...
 
#define XMcdma_BdRead(BaseAddress, Offset)   (*(u32 *)(((UINTPTR)(void *)(BaseAddress)) + (u32)(Offset)))
 Read the given Buffer Descriptor word. More...
 
#define XMcdma_BdRead64(BaseAddress, Offset)   (*(u64 *)(((UINTPTR)(void *)(BaseAddress)) + (u32)(Offset)))
 Read the given Buffer Descriptor word. More...
 
#define XMcdma_BdWrite(BaseAddress, Offset, Data)   (*(u32 *)((UINTPTR)(void *)(BaseAddress) + (u32)(Offset))) = (u32)(Data)
 Write the given Buffer Descriptor word. More...
 
#define XMcdma_BdWrite64(BaseAddress, Offset, Data)   (*(u64 *)((UINTPTR)(void *)(BaseAddress) + (u32)(Offset))) = (u64)(Data)
 Write the given Buffer Descriptor double word. More...
 
#define XMcDma_BdGetSts(BdPtr)   XMcdma_BdRead((BdPtr), XMCDMA_BD_STS_OFFSET)
 Retrieve the status of a Ingress(S2MM) BD. More...
 
#define XMcdma_BdHwCompleted(BdPtr)
 Check whether a Ingress(S2MM) BD has completed in hardware. More...
 
#define XMcDma_BdGetActualLength(BdPtr, LengthMask)
 Get the actual transfer length of a Ingress (S2MM)BD. More...
 
#define XMcDma_TxBdGetSts(BdPtr)   XMcdma_BdRead((BdPtr), XMCDMA_BD_SIDEBAND_STS_OFFSET)
 Retrieve the status of a Egress(MM2S) BD. More...
 
#define XMcdma_TxBdHwCompleted(BdPtr)
 Check whether a Egress(MM2S) BD has completed in hardware. More...
 
#define XMcDma_TxBdGetActualLength(BdPtr, LengthMask)
 Get the actual transfer length of a Egress(MM2S) BD. More...
 
#define XMcDma_BdGetCtrl(BdPtr)
 Gets the control bits of a BD. More...
 
#define XMcdma_BdChainNextBd(Chan, BdPtr)
 Return the next BD in the Chain. More...
 
#define XMcdma_BdChainPrevBd(Chan, BdPtr)
 Return the previous BD in the Chain. More...
 
#define XMcdma_HwIsStarted(Chan)
 Check whether a DMA is started, meaning the channel is not halted. More...
 
#define XMcdma_ChanHwIsStarted(Chan, Chan_id)
 Check whether a DMA channel is started, meaning the channel is not halted. More...
 
#define XMcDma_BdSetCtrlSideBand(BdPtr, Tid, Tuser)
 Set the Tid and Tuser fields of a BD with the user provided values. More...
 
#define XMcDma_GetBdSbandStats(BdPtr)   XMcdma_BdRead((BdPtr), XMCDMA_BD_SIDEBAND_STS_OFFSET)
 Retrieve the side band status of a BD. More...
 
#define XMcdma_BdClear(BdPtr)
 Clears the BD Contents. More...
 
#define XMcdma_BdSetSwId(BdPtr, Id)   (XMcdma_BdWrite((BdPtr), XMCDMA_BD_SW_ID_OFFSET, (UINTPTR)(Id)))
 Set the Sw ID field of the given BD. More...
 
#define XMcdma_BdGetSwId(BdPtr)   (XMcdma_BdRead((BdPtr), XMCDMA_BD_SW_ID_OFFSET))
 Retrieve the Sw ID field of the given BD previously set with XMcdma_BdSetSwId. More...
 
#define XMCDMA_BD_CTRL_SBAND_OFFSET   0x18
 Status. More...
 
#define XMCDMA_BD_CTRL_SOF_MASK   0x80000000
 Buffer descriptor start-of-frame control mask. More...
 
#define XMCDMA_BD_CTRL_EOF_MASK   0x40000000
 Buffer descriptor end-of-frame control mask. More...
 
#define XMCDMA_BD_CTRL_ALL_MASK   0xC0000000
 Buffer descriptor SOF and EOF control mask. More...
 
#define XMCDMA_BD_CTRL_SBAND_SHIFT   24
 Bit shift for BD sideband control fields. More...
 
#define XMCDMA_BD_STS_COMPLETE_MASK   0x80000000
 Completed. More...
 
#define XMCDMA_BD_STS_DEC_ERR_MASK   0x40000000
 Decode error. More...
 
#define XMCDMA_BD_STS_SLV_ERR_MASK   0x20000000
 Slave error. More...
 
#define XMCDMA_BD_STS_INT_ERR_MASK   0x10000000
 Internal err. More...
 
#define XMCDMA_BD_STS_ALL_ERR_MASK   0x70000000
 All errors. More...
 
#define XMCDMA_BD_STS_RXSOF_MASK   0x08000000
 First rx pkt. More...
 
#define XMCDMA_BD_STS_RXEOF_MASK   0x04000000
 Last rx pkt. More...
 
#define XMCDMA_BD_STS_ALL_MASK   0xFC000000
 All status bits. More...
 
#define XMCDMA_BD_SIDEBAND_STS_TID_MASK   0xFF000000
 BD sideband status TID field mask. More...
 
#define XMCDMA_BD_SIDEBAND_STS_TDEST_MASK   0x000F0000
 BD sideband status TDEST field mask. More...
 
#define XMCDMA_BD_SIDEBAND_STS_TUSER_MASK   0x0000FFFF
 BD sideband status TUSER field mask. More...
 
#define XMCDMA_MAX_TRANSFER_LEN   0x03FFFFFF
 Maximum buffer transfer length mask. More...
 
#define XMCDMA_BD_HW_NUM_BYTES   52
 Number of bytes hw used. More...
 
#define XMCDMA_BD_START_CLEAR   8
 Offset to start clear. More...
 
#define XMCDMA_BD_BYTES_TO_CLEAR   44
 BD-specific bytes to clear. More...
 
#define XMCDMA_BD_HAS_DRE_MASK   0xF00
 Whether has DRE mask. More...
 
#define XMCDMA_BD_WORDLEN_MASK   0xFF
 Whether has DRE mask. More...
 
#define XMCDMA_BD_HAS_DRE_SHIFT   8
 Whether has DRE shift. More...
 
#define XMCDMA_BD_WORDLEN_SHIFT   0
 Whether has DRE shift. More...
 
#define XMCDMA_LAST_APPWORD   4
 Last application word index in the BD. More...
 
#define XMcdma_In32   Xil_In32
 Input operation. More...
 
#define XMcdma_Out32   Xil_Out32
 Output operation. More...
 
#define XMcdma_ReadReg(BaseAddress, RegOffset)   XMcdma_In32((BaseAddress) + (u32)(RegOffset))
 Reads the given register. More...
 
#define XMcdma_WriteReg(BaseAddress, RegOffset, Data)   XMcdma_Out32(((BaseAddress) + (RegOffset)), (Data))
 Writes the given register. More...
 
#define MCDMA_BASE_ADDR   XPAR_XMCDMA_0_BASEADDR
 Base address of the MCDMA device. More...
 
#define NUMBER_OF_BDS_PER_PKT   10
 Number of buffer descriptors per packet. More...
 
#define NUMBER_OF_PKTS_TO_TRANSFER   100
 Number of packets to transfer in the test. More...
 
#define NUMBER_OF_BDS_TO_TRANSFER
 Total buffer descriptors to transfer. More...
 
#define PACKETS_PER_IRQ   50
 Number of packets processed per interrupt. More...
 
#define MAX_PKT_LEN   1024
 Maximum packet length in bytes. More...
 
#define BLOCK_SIZE_2MB   0x200000U
 Two-megabyte block size for TLB attributes. More...
 
#define TEST_START_VALUE   0xC
 Starting value used to fill and verify test data. More...
 
#define POLL_TIMEOUT_COUNTER   1000000U
 Maximum poll iterations before a transfer times out. More...
 
#define NUMBER_OF_EVENTS   1
 Number of interrupt events expected to complete the test. More...
 
#define MAX_CHANNELS   16
 Maximum number of MCDMA channels. More...
 
#define TX_BUFFER_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * MAX_PKT_LEN * MAX_CHANNELS )
 Transmit buffer size in bytes. More...
 
#define RX_BUFFER_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * MAX_PKT_LEN * MAX_CHANNELS )
 Receive buffer size in bytes. More...
 
#define TX_BD_SPACE_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * sizeof(XMcdma_Bd) * MAX_CHANNELS)
 Transmit BD space size in bytes. More...
 
#define RX_BD_SPACE_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * sizeof(XMcdma_Bd) * MAX_CHANNELS)
 Receive BD space size in bytes. More...
 
#define MCDMA_BASE_ADDR   XPAR_XMCDMA_0_BASEADDR
 Base address of the MCDMA device. More...
 
#define MEM_BASE_ADDR   0x01000000
 Base address for DMA buffers and BD space. More...
 
#define TX_BD_SPACE_BASE   (MEM_BASE_ADDR)
 Base address of the transmit BD space. More...
 
#define RX_BD_SPACE_BASE   (MEM_BASE_ADDR + 0x10000000)
 Base address of the receive BD space. More...
 
#define TX_BUFFER_BASE   (MEM_BASE_ADDR + 0x20000000)
 Base address of the transmit buffer. More...
 
#define RX_BUFFER_BASE   (MEM_BASE_ADDR + 0x50000000)
 Base address of the receive buffer. More...
 
#define NUMBER_OF_BDS_PER_PKT   10
 Number of buffer descriptors per packet. More...
 
#define NUMBER_OF_PKTS_TO_TRANSFER   100
 Number of packets to transfer in the test. More...
 
#define NUMBER_OF_BDS_TO_TRANSFER
 Total buffer descriptors to transfer. More...
 
#define MAX_PKT_LEN   1024
 Maximum packet length in bytes. More...
 
#define BLOCK_SIZE_2MB   0x200000U
 Two-megabyte block size for TLB attributes. More...
 
#define NUM_MAX_CHANNELS   16
 Maximum number of channels for pattern arrays. More...
 
#define TEST_START_VALUE   0xC
 Starting value used to fill and verify test data. More...
 
#define POLL_TIMEOUT_COUNTER   1000000U
 Maximum poll iterations before a transfer times out. More...
 
#define MAX_CHANNELS   16
 Maximum number of MCDMA channels. More...
 
#define TX_BUFFER_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * MAX_PKT_LEN * MAX_CHANNELS )
 Transmit buffer size in bytes. More...
 
#define RX_BUFFER_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * MAX_PKT_LEN * MAX_CHANNELS )
 Receive buffer size in bytes. More...
 
#define TX_BD_SPACE_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * sizeof(XMcdma_Bd) * MAX_CHANNELS )
 Transmit BD space size in bytes. More...
 
#define RX_BD_SPACE_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * sizeof(XMcdma_Bd) * MAX_CHANNELS )
 Receive BD space size in bytes. More...
 

Typedefs

typedef u32 XMcdma_Bd [16]
 Buffer descriptor storage as an array of 32-bit words. More...
 

Enumerations

enum  XMcdma_Handler {
  XMCDMA_TX_HANDLER_DONE, XMCDMA_TX_HANDLER_ERROR, XMCDMA_HANDLER_DONE, XMCDMA_HANDLER_ERROR,
  XMCDMA_HANDLER_PKTDROP
}
 MCDMA instance-level interrupt handler types. More...
 
enum  XMcdma_ChanHandler { XMCDMA_CHAN_HANDLER_DONE, XMCDMA_CHAN_HANDLER_ERROR, XMCDMA_CHAN_HANDLER_PKTDROP }
 MCDMA per-channel interrupt handler types. More...
 
enum  XMcdma_QScheduler { XMCDMA_FIXED_PRIORITY, XMCDMA_WRR, XMCDMA_WRR_PRIORITY }
 Queue scheduler types for MCDMA channels. More...
 

Functions

s32 XMcDma_CfgInitialize (XMcdma *InstancePtr, XMcdma_Config *CfgPtr)
 Initializes an MCDMA core before any other driver function is called. More...
 
s32 XMcDma_Initialize (XMcdma *InstancePtr, XMcdma_Config *CfgPtr)
 Initializes an MCDMA core before any other driver function is called. More...
 
void XMcDma_Reset (XMcdma *InstancePtr)
 Resets the MCDMA core. More...
 
void XMcdma_SetSGAWCache (XMcdma *InstancePtr, u8 Value)
 Sets the AWCACHE field of the SG interface With the user specified value. More...
 
void XMcdma_SetSGARCache (XMcdma *InstancePtr, u8 Value)
 Sets the ARCACHE field of the SG interface With the user specified value. More...
 
u32 XMcdma_ResetIsDone (XMcdma *InstancePtr)
 Check whether reset is done. More...
 
u32 XMcdma_Start (XMcdma_ChanCtrl *Chan)
 Start the DMA engine. More...
 
u32 XMcdma_ChanHwStop (XMcdma_ChanCtrl *Chan)
 Stops the DMA engine. More...
 
void XMcdma_EnableCh (XMcdma_ChanCtrl *Chan)
 Enables a particular channel. More...
 
u16 XMcdma_GetChanServiced (XMcdma *InstancePtr)
 Gets the last serviced s2mm channel number. More...
 
u16 XMcdma_GetTxChanServiced (XMcdma *InstancePtr)
 Gets the last serviced mm2s channel number. More...
 
u32 XMCdma_GetChan_Weight (XMcdma_ChanCtrl *Chan)
 Gets the weighted round-robin weight for a transmit channel. More...
 
u32 XMCdma_SetChan_Weight (XMcdma_ChanCtrl *Chan, u8 Weight)
 Sets the weighted round-robin weight for a transmit channel. More...
 
u32 XMCdma_GetChan_PktDoneCnt (XMcdma_ChanCtrl *Chan)
 Gets the packet-done count for an MCDMA channel. More...
 
void XMcdma_DumpChanRegs (XMcdma_ChanCtrl *Chan)
 Dump the registers for a channel. More...
 
XMcdma_Config * XMcdma_LookupConfig (UINTPTR BaseAddress)
 Looks up device configuration by base address. More...
 
s32 XMcdma_SelfTest (XMcdma *InstancePtr)
 This file contains a diagnostic self-test function for the MCDMA driver. More...
 
u32 XMcdma_SetChanCoalesceDelay (XMcdma_ChanCtrl *Chan, u32 IrqCoalesce, u32 IrqDelay)
 Set interrupt coalescing parameters for a particular channel. More...
 
int XMcdma_UpdateChanCDesc (XMcdma_ChanCtrl *Chan)
 Update Current Descriptor for the MCDMA Channel. More...
 
int XMcdma_UpdateChanTDesc (XMcdma_ChanCtrl *Chan)
 Update Tail Desc for the Channel. More...
 
u32 XMcDma_ChanBdCreate (XMcdma_ChanCtrl *Chan, UINTPTR Addr, u32 Count)
 Using a memory segment allocated by the caller, creates and setup the BD Chain for the MCDMA Channel. More...
 
u32 XMcDma_ChanSubmit (XMcdma_ChanCtrl *Chan, UINTPTR BufAddr, u32 len)
 Populates the BD chain with the required buffer address and length fields. More...
 
u32 XMcDma_Chan_Sideband_Submit (XMcdma_ChanCtrl *ChanPtr, UINTPTR BufAddr, u32 Len, u32 *AppPtr, u16 Tuser, u16 Tid)
 Populates the BD chain with the required buffer address, length APP(user application), TUSER and TID fields. More...
 
u32 XMcDma_ChanToHw (XMcdma_ChanCtrl *Chan)
 Starts hardware by programming current and tail descriptors by programming the Current and Tail Descriptors and enabling the particular channel. More...
 
int XMcdma_BdChainFromHW (XMcdma_ChanCtrl *Chan, u32 BdLimit, XMcdma_Bd **BdSetPtr)
 Returns a set of BD(s) that have been processed by hardware. More...
 
int XMcdma_BdChainFree (XMcdma_ChanCtrl *Chan, int BdCount, XMcdma_Bd *BdSetPtr)
 Frees a set of BDs that had been previously retrieved with XMcdma_BdChainFromHW(). More...
 
u32 XMcdma_BdSetBufAddr (XMcdma_Bd *BdPtr, UINTPTR Addr)
 Set the Buffer descriptor buffer address field. More...
 
void XMcDma_BdSetCtrl (XMcdma_Bd *BdPtr, u32 Data)
 Set the control bits for a BD. More...
 
void XMcDma_DumpBd (XMcdma_Bd *BdPtr)
 Dump the fields of a BD. More...
 
int XMcDma_BdSetAppWord (XMcdma_Bd *BdPtr, int Offset, u32 Word)
 Set the APP word at the specified APP word offset for a BD. More...
 
u32 XMcDma_BdGetAppWord (XMcdma_Bd *BdPtr, int Offset, int *Valid)
 Get the APP word at the specified APP word offset for a BD. More...
 
void XMcdma_IntrHandler (void *Instance)
 Handles S2MM (RX) MCDMA interrupts for the MCDMA core. More...
 
void XMcdma_TxIntrHandler (void *Instance)
 Handles MM2S MCDMA interrupts for the MCDMA core. More...
 
s32 XMcdma_SetCallBack (XMcdma *InstancePtr, XMcdma_Handler HandlerType, void *CallBackFunc, void *CallBackRef)
 This routine installs an asynchronous callback function for the given HandlerType. More...
 
void XMcdma_ChanIntrHandler (void *Instance)
 Handles per-channel MCDMA interrupts for the MCDMA core. More...
 
s32 XMcdma_ChanSetCallBack (XMcdma_ChanCtrl *Chan, XMcdma_ChanHandler HandlerType, void *CallBackFunc, void *CallBackRef)
 This routine installs an asynchronous callback function for the given HandlerType. More...
 
int main (void)
 Runs the MCDMA interrupt-mode example entry point. More...
 

Variables

XMcdma_Config XMcdma_ConfigTable []
 Configuration table for each MCDMA instance in the system. More...
 

Registers offsets

#define XMCDMA_CCR_OFFSET   0x00
 Common control register offset. More...
 
#define XMCDMA_CSR_OFFSET   0x04
 Common status register offset. More...
 
#define XMCDMA_CHEN_OFFSET   0x08
 Channel enable register offset. More...
 
#define XMCDMA_CHSER_OFFSET   0x0C
 Channel service register offset. More...
 
#define XMCDMA_ERR_OFFSET   0x10
 Error register offset. More...
 
#define XMCDMA_CHOBS1_OFFSET   0x440
 Channel observer 1 register offset. More...
 
#define XMCDMA_CHOBS2_OFFSET   0x444
 Channel observer 2 register offset. More...
 
#define XMCDMA_CHOBS3_OFFSET   0x448
 Channel observer 3 register offset. More...
 
#define XMCDMA_CHOBS4_OFFSET   0x44C
 Channel observer 4 register offset. More...
 
#define XMCDMA_CHOBS5_OFFSET   0x450
 Channel observer 5 register offset. More...
 
#define XMCDMA_CHOBS6_OFFSET   0x454
 Channel observer 6 register offset. More...
 
#define XMCDMA_SGCACHE_OFFSET   0x4B0
 Scatter-gather cache register offset. More...
 
#define XMCDMA_TXSCHD_TYPE_OFFSET   0x14
 Transmit scheduler type register offset. More...
 
#define XMCDMA_TX_WRR_REG_OFFSET   0x18
 Transmit weighted round-robin register 0 offset. More...
 
#define XMCDMA_TX_WRR_REG1_OFFSET   0x1C
 Transmit weighted round-robin register 1 offset. More...
 
#define XMCDMA_TXCH_SERV_OFFSET   0x20
 Transmit channel service register offset. More...
 
#define XMCDMA_TXAXCACHE_OFFSET   0x24
 Transmit AXI cache register offset. More...
 
#define XMCDMA_TXINT_SER_OFFSET   0x28
 Transmit interrupt service register offset. More...
 
#define XMCDMA_CPKTDROP_OFFSET   0x14
 Common packet drop register offset. More...
 
#define XMCDMA_RXCH_SER_OFFSET   0x18
 Receive channel service register offset. More...
 
#define XMCDMA_RXAXCACHE_OFFSET   0x1C
 Receive AXI cache register offset. More...
 
#define XMCDMA_RXINT_SER_OFFSET   0x20
 Receive interrupt service register offset. More...
 
#define XMCDMA_CR_OFFSET   0x40
 Per-channel control register offset. More...
 
#define XMCDMA_SR_OFFSET   0x44
 Per-channel status register offset. More...
 
#define XMCDMA_CDESC_OFFSET   0x48
 Current descriptor pointer register offset. More...
 
#define XMCDMA_CDESC_MSB_OFFSET   0x4C
 Current descriptor pointer MSB register offset. More...
 
#define XMCDMA_TDESC_OFFSET   0x50
 Tail descriptor pointer register offset. More...
 
#define XMCDMA_TDESC_MSB_OFFSET   0x54
 Tail descriptor pointer MSB register offset. More...
 
#define XMCDMA_PKTDROP_OFFSET   0x58
 Packet drop count register offset. More...
 
#define XMCDMA_TX_PKTCNT_STAT_OFFSET   0x58
 Transmit packet count status register offset. More...
 
#define XMCDMA_RX_PKTCNT_STAT_OFFSET   0x5C
 Receive packet count status register offset. More...
 
#define XMCDMA_NXTCHAN_OFFSET   0x40
 Next channel register block stride. More...
 
#define XMCDMA_NXTOBS_OFFSET   0x4
 Next observer register stride. More...
 
#define XMCDMA_RX_OFFSET   0x500
 Receive path register base offset. More...
 
#define XMCDMA_CCR_RUNSTOP_MASK   0x00000001
 Common control run/stop bit mask. More...
 
#define XMCDMA_CCR_RESET_MASK   0x00000004
 Common control reset bit mask. More...
 
#define XMCDMA_CSR_HALTED_MASK   0x00000001
 Common status halted bit mask. More...
 
#define XMCDMA_CSR_IDLE_MASK   0x00000002
 Common status idle bit mask. More...
 
#define XMCDMA_IRQ_PKTDROP_MASK   0x00000010
 Packet drop interrupt mask. More...
 
#define XMCDMA_IRQ_IOC_MASK   0x00000020
 Interrupt on complete mask. More...
 
#define XMCDMA_IRQ_DELAY_MASK   0x00000040
 Delay interrupt mask. More...
 
#define XMCDMA_IRQ_ERROR_MASK   0x00000080
 Error interrupt mask. More...
 
#define XMCDMA_IRQ_ALL_MASK   0x000000F0
 All interrupt sources mask. More...
 
#define XMCDMA_DELAY_MASK   0xFF000000
 Interrupt delay counter field mask. More...
 
#define XMCDMA_COALESCE_MASK   0x00FF0000
 Interrupt coalesce counter field mask. More...
 
#define XMCDMA_PKTDROP_COALESCE_MASK   0x0000FF00
 Packet drop coalesce field mask. More...
 
#define XMCDMA_COALESCE_SHIFT   16
 Bit shift for the coalesce counter field. More...
 
#define XMCDMA_DELAY_SHIFT   24
 Bit shift for the delay counter field. More...
 
#define XMCDMA_CHEN_MASK   0x000000FF
 Channel enable field mask. More...
 
#define XMCDMA_CHID_MASK   0x000000FF
 Channel identifier field mask. More...
 
#define XMCDMA_ERR_INTERNAL_MASK   0x00000001
 Internal error bit mask. More...
 
#define XMCDMA_ERR_SLAVE_MASK   0x00000002
 Slave error bit mask. More...
 
#define XMCDMA_ERR_DECODE_MASK   0x00000004
 Decode error bit mask. More...
 
#define XMCDMA_ERR_SG_INT_MASK   0x00000010
 Scatter-gather internal error bit mask. More...
 
#define XMCDMA_ERR_SG_SLV_MASK   0x00000020
 Scatter-gather slave error bit mask. More...
 
#define XMCDMA_ERR_SG_DEC_MASK   0x00000040
 Scatter-gather decode error bit mask. More...
 
#define XMCDMA_PKTDROP_CNT_MASK   0xFFFFFFFF
 Packet drop count field mask. More...
 
#define XMCDMA_AXUSER_MASK   0x00000F00
 AXI user sideband field mask. More...
 
#define XMCDMA_AXCACHE_MASK   0x0000000F
 AXI cache attribute field mask. More...
 
#define XMCDMA_TX_WRRCH0_MASK   0x0000000F
 Transmit WRR weight mask for channel 0. More...
 
#define XMCDMA_TX_WRRCH1_MASK   0x000000F0
 Transmit WRR weight mask for channel 1. More...
 
#define XMCDMA_TX_WRRCH2_MASK   0x00000F00
 Transmit WRR weight mask for channel 2. More...
 
#define XMCDMA_TX_WRRCH3_MASK   0x0000F000
 Transmit WRR weight mask for channel 3. More...
 
#define XMCDMA_TX_WRRCH4_MASK   0x000F0000
 Transmit WRR weight mask for channel 4. More...
 
#define XMCDMA_TX_WRRCH5_MASK   0x00F00000
 Transmit WRR weight mask for channel 5. More...
 
#define XMCDMA_TX_WRRCH6_MASK   0x0F000000
 Transmit WRR weight mask for channel 6. More...
 
#define XMCDMA_TX_WRRCH7_MASK   0xF0000000
 Transmit WRR weight mask for channel 7. More...
 
#define XMCDMA_TX_WRRCH_MASK(Chan_id)   WRR_MASK((Chan_id * 4 + 3), Chan_id *4)
 Returns the WRR weight field mask for a transmit channel. More...
 
#define XMCDMA_TX_WRRCH_SHIFT(Chan_id)   Chan_id * 4
 Returns the bit shift for a transmit channel WRR weight field. More...
 
#define XMCDMA_SGAWCACHE_MASK   0x000F0000
 Scatter-gather AXI write cache field mask. More...
 
#define XMCDMA_SGARCACHE_MASK   0x0000000F
 Scatter-gather AXI read cache field mask. More...
 
#define XMCDMA_SGAWCACHE_SHIFT   16
 Bit shift for scatter-gather write cache field. More...
 

Buffer Descriptor offsets

The first 13 words are used by hardware.

All words after the 13rd word are for software use only.

#define XMCDMA_BD_NDESC_OFFSET   0x00
 Next descriptor pointer. More...
 
#define XMCDMA_BD_NDESC_MSB_OFFSET   0x04
 Next descriptor pointer. More...
 
#define XMCDMA_BD_BUFA_OFFSET   0x08
 Buffer address. More...
 
#define XMCDMA_BD_BUFA_MSB_OFFSET   0x0C
 Buffer address. More...
 
#define XMCDMA_BD_RESERVED_OFFSET   0x10
 Reserved field. More...
 
#define XMCDMA_BD_CTRL_OFFSET   0x14
 Control/buffer length. More...
 
#define XMCDMA_BD_STS_OFFSET   0x18
 Status. More...
 
#define XMCDMA_BD_SIDEBAND_STS_OFFSET   0x1C
 Side Band Status. More...
 
#define XMCDMA_BD_USR0_OFFSET   0x20
 User IP specific word0. More...
 
#define XMCDMA_BD_USR1_OFFSET   0x24
 User IP specific word1. More...
 
#define XMCDMA_BD_USR2_OFFSET   0x28
 User IP specific word2. More...
 
#define XMCDMA_BD_USR3_OFFSET   0x2C
 User IP specific word3. More...
 
#define XMCDMA_BD_USR4_OFFSET   0x30
 User IP specific word3. More...
 
#define XMCDMA_BD_HAS_DRE_OFFSET   0x34
 First unused field by h/w. More...
 
#define XMCDMA_BD_HAS_CTRLSTS_OFFSET   0x38
 BD offset for status/control stream flag. More...
 
#define XMCDMA_BD_SW_ID_OFFSET   0x3C
 Sw ID. More...
 

Macro Definition Documentation

#define BLOCK_SIZE_2MB   0x200000U

Two-megabyte block size for TLB attributes.

Referenced by main().

#define BLOCK_SIZE_2MB   0x200000U

Two-megabyte block size for TLB attributes.

#define MAX_CHANNELS   16

Maximum number of MCDMA channels.

#define MAX_CHANNELS   16

Maximum number of MCDMA channels.

#define MAX_PKT_LEN   1024

Maximum packet length in bytes.

#define MAX_PKT_LEN   1024

Maximum packet length in bytes.

#define MAX_TRANSFER_LEN (   h)    (((~0UL) << (0)) & (~0UL >> (32 - 1 - (h))))

Computes a contiguous bit mask for the maximum transfer length field.

Parameters
[in]his the high bit index of the field.

Referenced by XMcDma_Initialize().

#define MCDMA_BASE_ADDR   XPAR_XMCDMA_0_BASEADDR

Base address of the MCDMA device.

Referenced by main().

#define MCDMA_BASE_ADDR   XPAR_XMCDMA_0_BASEADDR

Base address of the MCDMA device.

#define MEM_BASE_ADDR   0x01000000

Base address for DMA buffers and BD space.

#define NUM_MAX_CHANNELS   16

Maximum number of channels for pattern arrays.

#define NUMBER_OF_BDS_PER_PKT   10

Number of buffer descriptors per packet.

#define NUMBER_OF_BDS_PER_PKT   10

Number of buffer descriptors per packet.

#define NUMBER_OF_BDS_TO_TRANSFER
Value:
#define NUMBER_OF_PKTS_TO_TRANSFER
Number of packets to transfer in the test.
Definition: xmcdma_interrupt_example.c:106
#define NUMBER_OF_BDS_PER_PKT
Number of buffer descriptors per packet.
Definition: xmcdma_interrupt_example.c:105

Total buffer descriptors to transfer.

Referenced by main().

#define NUMBER_OF_BDS_TO_TRANSFER
Value:
#define NUMBER_OF_PKTS_TO_TRANSFER
Number of packets to transfer in the test.
Definition: xmcdma_polled_example.c:131
#define NUMBER_OF_BDS_PER_PKT
Number of buffer descriptors per packet.
Definition: xmcdma_polled_example.c:130

Total buffer descriptors to transfer.

#define NUMBER_OF_EVENTS   1

Number of interrupt events expected to complete the test.

Referenced by main().

#define NUMBER_OF_PKTS_TO_TRANSFER   100

Number of packets to transfer in the test.

#define NUMBER_OF_PKTS_TO_TRANSFER   100

Number of packets to transfer in the test.

#define PACKETS_PER_IRQ   50

Number of packets processed per interrupt.

#define POLL_TIMEOUT_COUNTER   1000000U

Maximum poll iterations before a transfer times out.

Referenced by main().

#define POLL_TIMEOUT_COUNTER   1000000U

Maximum poll iterations before a transfer times out.

#define RX_BD_SPACE_BASE   (MEM_BASE_ADDR + 0x10000000)

Base address of the receive BD space.

#define RX_BD_SPACE_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * sizeof(XMcdma_Bd) * MAX_CHANNELS)

Receive BD space size in bytes.

#define RX_BD_SPACE_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * sizeof(XMcdma_Bd) * MAX_CHANNELS )

Receive BD space size in bytes.

#define RX_BUFFER_BASE   (MEM_BASE_ADDR + 0x50000000)

Base address of the receive buffer.

#define RX_BUFFER_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * MAX_PKT_LEN * MAX_CHANNELS )

Receive buffer size in bytes.

#define RX_BUFFER_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * MAX_PKT_LEN * MAX_CHANNELS )

Receive buffer size in bytes.

#define TEST_START_VALUE   0xC

Starting value used to fill and verify test data.

#define TEST_START_VALUE   0xC

Starting value used to fill and verify test data.

#define TX_BD_SPACE_BASE   (MEM_BASE_ADDR)

Base address of the transmit BD space.

#define TX_BD_SPACE_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * sizeof(XMcdma_Bd) * MAX_CHANNELS)

Transmit BD space size in bytes.

#define TX_BD_SPACE_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * sizeof(XMcdma_Bd) * MAX_CHANNELS )

Transmit BD space size in bytes.

#define TX_BUFFER_BASE   (MEM_BASE_ADDR + 0x20000000)

Base address of the transmit buffer.

#define TX_BUFFER_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * MAX_PKT_LEN * MAX_CHANNELS )

Transmit buffer size in bytes.

#define TX_BUFFER_SIZE   (NUMBER_OF_BDS_TO_TRANSFER * MAX_PKT_LEN * MAX_CHANNELS )

Transmit buffer size in bytes.

#define WRR_MASK (   h,
  l 
)    (((~0UL) << (l)) & (~0UL >> (32 - 1 - (h))))

Computes a contiguous bit mask between high and low bit indices.

Parameters
[in]his the high bit index of the field.
[in]lis the low bit index of the field.
#define XMCDMA_AXCACHE   0xB

Default AXI cache attribute value.

Referenced by XMcDma_CfgInitialize().

#define XMCDMA_AXCACHE_MASK   0x0000000F

AXI cache attribute field mask.

#define XMCDMA_AXUSER_MASK   0x00000F00

AXI user sideband field mask.

#define XMCDMA_BD_BUFA_MSB_OFFSET   0x0C

Buffer address.

#define XMCDMA_BD_BUFA_OFFSET   0x08

Buffer address.

Referenced by XMcdma_BdSetBufAddr(), and XMcDma_DumpBd().

#define XMCDMA_BD_BYTES_TO_CLEAR   44

BD-specific bytes to clear.

#define XMCDMA_BD_CTRL_ALL_MASK   0xC0000000

Buffer descriptor SOF and EOF control mask.

Referenced by XMcDma_BdSetCtrl().

#define XMCDMA_BD_CTRL_EOF_MASK   0x40000000

Buffer descriptor end-of-frame control mask.

Referenced by XMcdma_BdChainFromHW().

#define XMCDMA_BD_CTRL_OFFSET   0x14
#define XMCDMA_BD_CTRL_SBAND_OFFSET   0x18

Status.

#define XMCDMA_BD_CTRL_SBAND_SHIFT   24

Bit shift for BD sideband control fields.

#define XMCDMA_BD_CTRL_SOF_MASK   0x80000000

Buffer descriptor start-of-frame control mask.

#define XMCDMA_BD_HAS_CTRLSTS_OFFSET   0x38

BD offset for status/control stream flag.

Referenced by XMcDma_BdGetAppWord(), XMcDma_BdSetAppWord(), and XMcDma_ChanBdCreate().

#define XMCDMA_BD_HAS_DRE_MASK   0xF00

Whether has DRE mask.

Referenced by XMcdma_BdSetBufAddr().

#define XMCDMA_BD_HAS_DRE_OFFSET   0x34

First unused field by h/w.

Referenced by XMcdma_BdSetBufAddr(), and XMcDma_ChanBdCreate().

#define XMCDMA_BD_HAS_DRE_SHIFT   8

Whether has DRE shift.

Referenced by XMcDma_ChanBdCreate().

#define XMCDMA_BD_HW_NUM_BYTES   52

Number of bytes hw used.

#define XMCDMA_BD_MINIMUM_ALIGNMENT   0x40

Minimum buffer descriptor alignment in bytes.

#define XMCDMA_BD_NDESC_MSB_OFFSET   0x04

Next descriptor pointer.

Referenced by XMcDma_ChanBdCreate().

#define XMCDMA_BD_NDESC_OFFSET   0x00

Next descriptor pointer.

Referenced by XMcDma_ChanBdCreate(), and XMcDma_DumpBd().

#define XMCDMA_BD_RESERVED_OFFSET   0x10

Reserved field.

#define XMCDMA_BD_SIDEBAND_STS_OFFSET   0x1C

Side Band Status.

Referenced by XMcdma_BdChainFromHW(), and XMcDma_DumpBd().

#define XMCDMA_BD_SIDEBAND_STS_TDEST_MASK   0x000F0000

BD sideband status TDEST field mask.

#define XMCDMA_BD_SIDEBAND_STS_TID_MASK   0xFF000000

BD sideband status TID field mask.

#define XMCDMA_BD_SIDEBAND_STS_TUSER_MASK   0x0000FFFF

BD sideband status TUSER field mask.

#define XMCDMA_BD_START_CLEAR   8

Offset to start clear.

#define XMCDMA_BD_STS_ALL_ERR_MASK   0x70000000

All errors.

#define XMCDMA_BD_STS_ALL_MASK   0xFC000000

All status bits.

#define XMCDMA_BD_STS_COMPLETE_MASK   0x80000000

Completed.

Referenced by XMcdma_BdChainFromHW().

#define XMCDMA_BD_STS_DEC_ERR_MASK   0x40000000

Decode error.

#define XMCDMA_BD_STS_INT_ERR_MASK   0x10000000

Internal err.

#define XMCDMA_BD_STS_OFFSET   0x18

Status.

Referenced by XMcdma_BdChainFromHW(), and XMcDma_DumpBd().

#define XMCDMA_BD_STS_RXEOF_MASK   0x04000000

Last rx pkt.

Referenced by XMcdma_BdChainFromHW().

#define XMCDMA_BD_STS_RXSOF_MASK   0x08000000

First rx pkt.

#define XMCDMA_BD_STS_SLV_ERR_MASK   0x20000000

Slave error.

#define XMCDMA_BD_SW_ID_OFFSET   0x3C

Sw ID.

#define XMCDMA_BD_USR0_OFFSET   0x20
#define XMCDMA_BD_USR1_OFFSET   0x24

User IP specific word1.

Referenced by XMcDma_DumpBd().

#define XMCDMA_BD_USR2_OFFSET   0x28

User IP specific word2.

Referenced by XMcDma_DumpBd().

#define XMCDMA_BD_USR3_OFFSET   0x2C

User IP specific word3.

Referenced by XMcDma_DumpBd().

#define XMCDMA_BD_USR4_OFFSET   0x30

User IP specific word3.

Referenced by XMcDma_DumpBd().

#define XMCDMA_BD_WORDLEN_MASK   0xFF

Whether has DRE mask.

Referenced by XMcdma_BdSetBufAddr().

#define XMCDMA_BD_WORDLEN_SHIFT   0

Whether has DRE shift.

#define XMcdma_BdChainNextBd (   Chan,
  BdPtr 
)
Value:
(((UINTPTR)(BdPtr) >= (Chan)->LastBdAddr) ? \
(UINTPTR)(Chan)->FirstBdAddr : \
(UINTPTR)((UINTPTR)(BdPtr) + (Chan)->Separation))

Return the next BD in the Chain.

Parameters
[in]Chanis the Channel BD Chain to operate on.
[in]BdPtris the current BD.
Returns
The next BD in the Chain relative to the BdPtr parameter.
Note
C-style signature: XMcdma_Bd XMcdma_BdChainNextBd(XMcdma_ChanCtrl Chan, XMcdma_Bd *BdPtr)

Referenced by XMcdma_BdChainFree(), XMcdma_BdChainFromHW(), XMcDma_Chan_Sideband_Submit(), and XMcDma_ChanSubmit().

#define XMcdma_BdChainPrevBd (   Chan,
  BdPtr 
)
Value:
(((UINTPTR)(BdPtr) <= (Chan)->FirstBdAddr) ? \
(XMcdma_Bd *)(Chan)->LastBdAddr : \
(XMcdma_Bd *)((UINTPTR)(BdPtr) - (Chan)->Separation))
u32 XMcdma_Bd[16]
Buffer descriptor storage as an array of 32-bit words.
Definition: xmcdma_bd.h:36

Return the previous BD in the Chain.

Parameters
[in]Chanis the MCDMA channel to operate on.
[in]BdPtris the current BD.
Returns
The previous BD in the Chain relative to the BdPtr parameter.
Note
C-style signature: XMcdma_Bd XMcdma_BdChainPrevBd(XMcdma_ChanCtrl Chan, XMcdma_Bd *BdPtr)
#define XMcdma_BdClear (   BdPtr)
Value:
memset((void *)(((UINTPTR)(BdPtr)) + XMCDMA_BD_START_CLEAR), 0, \
#define XMCDMA_BD_BYTES_TO_CLEAR
BD-specific bytes to clear.
Definition: xmcdma_hw.h:201
#define XMCDMA_BD_START_CLEAR
Offset to start clear.
Definition: xmcdma_hw.h:200

Clears the BD Contents.

Parameters
[in]BdPtris the BD to operate on
Note
C-style signature: void XMcdma_BdClear(XMcdma_Bd* BdPtr)

Referenced by XMcdma_BdChainFree(), XMcDma_Chan_Sideband_Submit(), and XMcDma_ChanSubmit().

#define XMcDma_BdGetActualLength (   BdPtr,
  LengthMask 
)
Value:
LengthMask)
#define XMCDMA_BD_STS_OFFSET
Status.
Definition: xmcdma_hw.h:162
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:94

Get the actual transfer length of a Ingress (S2MM)BD.

The BD has completed in hw.

May not work if the BD is in cached memory.

Parameters
[in]BdPtris the BD to check on
[in]LengthMaskis the Maximum Transfer Length.
Note
C-style signature: int XMcDma_BdGetActualLength(XMcdma_Bd* BdPtr, u32 LengthMask)
#define XMcDma_BdGetCtrl (   BdPtr)
Value:
#define XMCDMA_BD_CTRL_ALL_MASK
Buffer descriptor SOF and EOF control mask.
Definition: xmcdma_hw.h:180
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:94
#define XMCDMA_BD_CTRL_OFFSET
Control/buffer length.
Definition: xmcdma_hw.h:161

Gets the control bits of a BD.

Parameters
[in]BdPtris the BD to operate on
Returns
control bits of a BD.
Note
C-style signature: u32 XMcDma_BdGetCtrl(XMCDMA_Bd* BdPtr)
#define XMcDma_BdGetSts (   BdPtr)    XMcdma_BdRead((BdPtr), XMCDMA_BD_STS_OFFSET)

Retrieve the status of a Ingress(S2MM) BD.

Parameters
[in]BdPtris the BD to operate on
Returns
Use XMDMA_BD_STS_*** values defined in xmdma_hw.h to interpret the returned value
Note
C-style signature: u32 XMcDma_BdGetSts(XMcdma_Bd* BdPtr)
#define XMcdma_BdGetSwId (   BdPtr)    (XMcdma_BdRead((BdPtr), XMCDMA_BD_SW_ID_OFFSET))

Retrieve the Sw ID field of the given BD previously set with XMcdma_BdSetSwId.

Parameters
[in]BdPtris the BD to operate on
Returns
BD Sw identifier
Note
C-style signature: u32 XMcdma_BdGetSwId(XMcdma_Bd* BdPtr)
#define XMcdma_BdHwCompleted (   BdPtr)
Value:
#define XMCDMA_BD_STS_OFFSET
Status.
Definition: xmcdma_hw.h:162
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:94
#define XMCDMA_BD_STS_COMPLETE_MASK
Completed.
Definition: xmcdma_hw.h:183

Check whether a Ingress(S2MM) BD has completed in hardware.

This BD has been submitted to hardware. The application can use this function To poll for the Completion of the BD.

May not work if the BD is in cached memory.

Parameters
[in]BdPtris the BD to check on
Returns
  • 0 if not complete
  • XMCDMA_BD_STS_COMPLETE_MASK if completed, may contain XMDMA_BD_STS_*_ERR_MASK bits.
Note
C-style signature: int XMcdma_BdHwCompleted(XMcdma_Bd* BdPtr)
#define XMcdma_BdRead (   BaseAddress,
  Offset 
)    (*(u32 *)(((UINTPTR)(void *)(BaseAddress)) + (u32)(Offset)))

Read the given Buffer Descriptor word.

Parameters
[in]BaseAddressis the base address of the BD to read
[in]Offsetis the word offset to be read
Returns
The 32-bit value of the field
Note
C-style signature: u32 XMcdma_BdRead(u32 BaseAddress, u32 Offset)

Referenced by XMcdma_BdChainFromHW(), XMcDma_BdGetAppWord(), XMcDma_BdSetAppWord(), XMcdma_BdSetBufAddr(), XMcDma_BdSetCtrl(), and XMcDma_DumpBd().

#define XMcdma_BdRead64 (   BaseAddress,
  Offset 
)    (*(u64 *)(((UINTPTR)(void *)(BaseAddress)) + (u32)(Offset)))

Read the given Buffer Descriptor word.

Parameters
[in]BaseAddressis the base address of the BD to read
[in]Offsetis the word offset to be read
Returns
The 64-bit value of the field
Note
C-style signature: u64 XMcdma_BdRead64(u64 BaseAddress, u32 Offset)
#define XMcDma_BdSetCtrlSideBand (   BdPtr,
  Tid,
  Tuser 
)
Value:
#define XMCDMA_BD_CTRL_SBAND_SHIFT
Bit shift for BD sideband control fields.
Definition: xmcdma_hw.h:182
#define XMcdma_BdWrite(BaseAddress, Offset, Data)
Write the given Buffer Descriptor word.
Definition: xmcdma_bd.h:129
#define XMCDMA_BD_CTRL_SBAND_OFFSET
Status.
Definition: xmcdma_hw.h:176

Set the Tid and Tuser fields of a BD with the user provided values.

Parameters
[in]BdPtris the BD to operate on.
[in]Tidis Tid value to be written in the Bd field.
[in]Tuseris Tuser value to be written in the Bd field.
Note
C-style signature: u32 XMcDma_BdSetCtrlSideBand(XMcdma_Bd* BdPtr, u8 Tid, u8 Tuser)

Referenced by XMcDma_Chan_Sideband_Submit().

#define XMcdma_BdSetSwId (   BdPtr,
  Id 
)    (XMcdma_BdWrite((BdPtr), XMCDMA_BD_SW_ID_OFFSET, (UINTPTR)(Id)))

Set the Sw ID field of the given BD.

The ID is an arbitrary piece of data the application can associate with a specific BD.

Parameters
[in]BdPtris the BD to operate on
[in]Idis a 32-bit quantity to set in the BD
Note
C-style signature: void XMcdma_BdSetSwId(XMcdma_Bd* BdPtr, void Id)
#define XMcdma_BdWrite (   BaseAddress,
  Offset,
  Data 
)    (*(u32 *)((UINTPTR)(void *)(BaseAddress) + (u32)(Offset))) = (u32)(Data)

Write the given Buffer Descriptor word.

Parameters
[in]BaseAddressis the base address of the BD to write
[in]Offsetis the word offset to be written
[in]Datais the 32-bit value to write to the field
Note
C-style signature: void XMcdma_BdWrite(u32 BaseAddress, u32 RegOffset, u32 Data)

Referenced by XMcDma_BdSetAppWord(), XMcdma_BdSetBufAddr(), XMcDma_BdSetCtrl(), XMcDma_Chan_Sideband_Submit(), XMcDma_ChanBdCreate(), and XMcDma_ChanSubmit().

#define XMcdma_BdWrite64 (   BaseAddress,
  Offset,
  Data 
)    (*(u64 *)((UINTPTR)(void *)(BaseAddress) + (u32)(Offset))) = (u64)(Data)

Write the given Buffer Descriptor double word.

Parameters
[in]BaseAddressis the base address of the BD to write
[in]Offsetis the word offset to be written
[in]Datais the 64-bit value to write to the field
Note
C-style signature: void XMcdma_BdWrite(u64 BaseAddress, u32 RegOffset, u64 Data)

Referenced by XMcdma_BdSetBufAddr().

#define XMCDMA_CACHE_FLUSH (   BdPtr)    Xil_DCacheFlushRange((UINTPTR)(BdPtr), XMCDMA_BD_HW_NUM_BYTES)

Declares cache flush and invalidate helpers for BDs in cached memory.

Flushes the data cache for a buffer descriptor.

Parameters
[in]BdPtris the buffer descriptor address.

Referenced by XMcDma_Chan_Sideband_Submit(), XMcDma_ChanBdCreate(), XMcDma_ChanSubmit(), and XMcdma_UpdateChanCDesc().

#define XMCDMA_CACHE_INVALIDATE (   BdPtr)    Xil_DCacheInvalidateRange((UINTPTR)(BdPtr), XMCDMA_BD_HW_NUM_BYTES)

Invalidates the data cache for a buffer descriptor.

Parameters
[in]BdPtris the buffer descriptor address.

Referenced by XMcdma_BdChainFromHW(), and XMcdma_UpdateChanTDesc().

#define XMCDMA_CCR_OFFSET   0x00

Common control register offset.

Referenced by XMcDma_Reset(), XMcdma_ResetIsDone(), and XMcdma_Start().

#define XMCDMA_CCR_RESET_MASK   0x00000004

Common control reset bit mask.

Referenced by XMcDma_Reset(), and XMcdma_ResetIsDone().

#define XMCDMA_CCR_RUNSTOP_MASK   0x00000001

Common control run/stop bit mask.

Referenced by XMcdma_ChanHwStop(), XMcdma_Start(), and XMcdma_UpdateChanTDesc().

#define XMCDMA_CDESC_MSB_OFFSET   0x4C

Current descriptor pointer MSB register offset.

Referenced by XMcdma_DumpChanRegs(), and XMcdma_UpdateChanCDesc().

#define XMCDMA_CDESC_OFFSET   0x48

Current descriptor pointer register offset.

Referenced by XMcdma_DumpChanRegs(), and XMcdma_UpdateChanCDesc().

#define XMCDMA_CHAN_BUSY   2

Channel busy state value.

Referenced by XMcdma_UpdateChanCDesc(), and XMcdma_UpdateChanTDesc().

#define XMCDMA_CHAN_IDLE   0
#define XMCDMA_CHAN_PAUSE   1

Channel paused state value.

Referenced by XMcdma_ChanIntrHandler(), XMcdma_IntrHandler(), and XMcdma_TxIntrHandler().

#define XMCDMA_CHAN_SEEKAHEAD (   Chan,
  BdPtr,
  NumBd 
)
Value:
{ \
UINTPTR Addr = (UINTPTR)(void *)(BdPtr); \
\
Addr += (Chan->Separation * (NumBd)); \
if ((Addr > (Chan)->LastBdAddr) || ((UINTPTR)(BdPtr) > Addr)) \
{ \
Addr -= (Chan)->Length; \
} \
\
(BdPtr) = (XMcdma_Bd *)(void *)Addr; \
}
u32 XMcdma_Bd[16]
Buffer descriptor storage as an array of 32-bit words.
Definition: xmcdma_bd.h:36

Advances a BD pointer by a number of descriptors with ring wrap.

Wraparound occurs when the new BD pointer is greater than the high address in the ring or when the pointer crosses the 0xFFFFFFFF to 0 boundary.

Parameters
[in]Chanis the MCDMA channel that contains BdPtr.
[in,out]BdPtris the starting BD position on entry and the updated BD position on return.
[in]NumBdis the number of BD spaces to advance.

Referenced by XMcdma_BdChainFromHW().

#define XMcdma_ChanAckIrq (   Chan,
  Mask 
)
Value:
XMcdma_WriteReg((Chan)->ChanBase, \
((Chan->Chan_id - 1) * XMCDMA_NXTCHAN_OFFSET + XMCDMA_SR_OFFSET) ,\
#define XMCDMA_SR_OFFSET
Per-channel status register offset.
Definition: xmcdma_hw.h:75
#define XMCDMA_NXTCHAN_OFFSET
Next channel register block stride.
Definition: xmcdma_hw.h:84
#define XMcdma_WriteReg(BaseAddress, RegOffset, Data)
Writes the given register.
Definition: xmcdma_hw.h:246
#define XMCDMA_IRQ_ALL_MASK
All interrupt sources mask.
Definition: xmcdma_hw.h:98

Acknowledges the specified channel interrupts that are specified in Mask.

Parameters
[in]Chanis the MCDMA Channel to Operate on.
[in]Maskis the mask for the interrupts to be acknowledge

Referenced by XMcdma_ChanIntrHandler(), XMcdma_IntrHandler(), and XMcdma_TxIntrHandler().

#define XMcdma_ChanGetIrq (   Chan)
Value:
(XMcdma_ReadReg(Chan->ChanBase, ((Chan->Chan_id - 1) * XMCDMA_NXTCHAN_OFFSET + \
#define XMCDMA_SR_OFFSET
Per-channel status register offset.
Definition: xmcdma_hw.h:75
#define XMCDMA_NXTCHAN_OFFSET
Next channel register block stride.
Definition: xmcdma_hw.h:84
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMCDMA_IRQ_ALL_MASK
All interrupt sources mask.
Definition: xmcdma_hw.h:98

Returns asserted channel interrupts.

Parameters
[in]Chanis the MCDMA Channel to Operate on.
Returns
The bit mask for the interrupts asserted.

Referenced by XMcdma_ChanIntrHandler(), XMcdma_IntrHandler(), and XMcdma_TxIntrHandler().

#define XMcdma_ChanHwIsStarted (   Chan,
  Chan_id 
)
Value:
((XMcdma_ReadReg((Chan)->ChanBase, (XMCDMA_CR_OFFSET + \
(Chan_id - 1) * XMCDMA_NXTCHAN_OFFSET)) \
& XMCDMA_CCR_RUNSTOP_MASK) ? TRUE : FALSE)
#define XMCDMA_CCR_RUNSTOP_MASK
Common control run/stop bit mask.
Definition: xmcdma_hw.h:88
#define XMCDMA_NXTCHAN_OFFSET
Next channel register block stride.
Definition: xmcdma_hw.h:84
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMCDMA_CR_OFFSET
Per-channel control register offset.
Definition: xmcdma_hw.h:74

Check whether a DMA channel is started, meaning the channel is not halted.

Parameters
[in]Chanis the channel instance to operate on.
[in]Chan_idis the channel number to operate on.
Returns
  • 1 if channel is started
  • 0 otherwise
Note
C-style signature: int XMcdma_ChanHwIsStarted(XMcdma_ChanCtrl *Chan, u32 Chan_id)

Referenced by XMcdma_UpdateChanTDesc().

#define XMCDMA_CHEN_MASK   0x000000FF

Channel enable field mask.

#define XMCDMA_CHEN_OFFSET   0x08

Channel enable register offset.

Referenced by XMcdma_EnableCh().

#define XMCDMA_CHID_MASK   0x000000FF

Channel identifier field mask.

#define XMCDMA_CHOBS1_OFFSET   0x440

Channel observer 1 register offset.

#define XMCDMA_CHOBS2_OFFSET   0x444

Channel observer 2 register offset.

#define XMCDMA_CHOBS3_OFFSET   0x448

Channel observer 3 register offset.

#define XMCDMA_CHOBS4_OFFSET   0x44C

Channel observer 4 register offset.

#define XMCDMA_CHOBS5_OFFSET   0x450

Channel observer 5 register offset.

#define XMCDMA_CHOBS6_OFFSET   0x454

Channel observer 6 register offset.

#define XMCDMA_CHSER_OFFSET   0x0C

Channel service register offset.

Referenced by XMcdma_GetChanServiced(), and XMcdma_GetTxChanServiced().

#define XMCDMA_COALESCE_MASK   0x00FF0000

Interrupt coalesce counter field mask.

Referenced by XMcdma_SetChanCoalesceDelay().

#define XMCDMA_COALESCE_SHIFT   16

Bit shift for the coalesce counter field.

Referenced by XMcdma_SetChanCoalesceDelay().

#define XMCDMA_CPKTDROP_OFFSET   0x14

Common packet drop register offset.

#define XMCDMA_CR_OFFSET   0x40

Per-channel control register offset.

Referenced by XMcdma_ChanHwStop(), XMcdma_DumpChanRegs(), XMcdma_SetChanCoalesceDelay(), and XMcdma_UpdateChanTDesc().

#define XMCDMA_CSR_HALTED_MASK   0x00000001

Common status halted bit mask.

Referenced by XMcdma_Start().

#define XMCDMA_CSR_IDLE_MASK   0x00000002

Common status idle bit mask.

#define XMCDMA_CSR_OFFSET   0x04

Common status register offset.

Referenced by XMcdma_Start().

#define XMCDMA_DELAY_MASK   0xFF000000

Interrupt delay counter field mask.

Referenced by XMcdma_SetChanCoalesceDelay().

#define XMCDMA_DELAY_SHIFT   24

Bit shift for the delay counter field.

Referenced by XMcdma_SetChanCoalesceDelay().

#define XMCDMA_DEV_TO_MEM   0

Transfer direction from device to memory.

#define XMcdma_DisableCh (   Chan,
  ChanId 
)
Value:
(XMcdma_WriteReg(Chan->ChanBase,(XMCDMA_CHEN_OFFSET), \
XMcdma_ReadReg((Chan)->ChanBase, XMCDMA_CHEN_OFFSET) & \
~(ChanId & XMCDMA_CHEN_MASK)))
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMcdma_WriteReg(BaseAddress, RegOffset, Data)
Writes the given register.
Definition: xmcdma_hw.h:246
#define XMCDMA_CHEN_MASK
Channel enable field mask.
Definition: xmcdma_hw.h:107
#define XMCDMA_CHEN_OFFSET
Channel enable register offset.
Definition: xmcdma_hw.h:48

Disable Particular Channel in the MCDMA Core.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]ChanIdis the channel to disable.
Note
C-style signature: XMcdma_DisableCh(XMcdma_ChanCtrl *Chan, u32 ChanId)
#define XMCDMA_ERR_DECODE_MASK   0x00000004

Decode error bit mask.

#define XMCDMA_ERR_INTERNAL_MASK   0x00000001

Internal error bit mask.

#define XMCDMA_ERR_OFFSET   0x10

Error register offset.

#define XMCDMA_ERR_SG_DEC_MASK   0x00000040

Scatter-gather decode error bit mask.

#define XMCDMA_ERR_SG_INT_MASK   0x00000010

Scatter-gather internal error bit mask.

#define XMCDMA_ERR_SG_SLV_MASK   0x00000020

Scatter-gather slave error bit mask.

#define XMCDMA_ERR_SLAVE_MASK   0x00000002

Slave error bit mask.

#define XMcDma_GetBdSbandStats (   BdPtr)    XMcdma_BdRead((BdPtr), XMCDMA_BD_SIDEBAND_STS_OFFSET)

Retrieve the side band status of a BD.

Parameters
[in]BdPtris the BD to operate on
Returns
Use XMDMA_BD_STS_*** values defined in xmdma_hw.h to interpret the returned value
Note
C-style signature: u32 XMcDma_GetBdSbandStats(XMcdma_Bd* BdPtr)
#define XMcdma_GetChan (   Chan)    XMcdma_ReadReg(Chan->ChanBase, XMCDMA_CHSER_OFFSET)

Get Channel number that last Serviced.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
Returns
Channel Number that last serviced.
Note
C-style signature: XMcdma_GetChan(XMcdma_ChanCtrl *Chan)
#define XMcdma_GetChanBdDoneCnt (   Chan)    ((Chan)->BdDoneCnt)

Returns the buffer descriptor count processed by the h/w.

Parameters
[in]Chanis the MCDMA Channel to Operate on.
Returns
Buffer descriptor count processed by the h/w.
Note
C-style signature: XMdma_ChanCtrl *XMcdma_GetChanBdDoneCnt(XMcdma_ChanCtrl * Chan)
#define XMcdma_GetChanCurBd (   Chan)    ((Chan)->BdRestart)

Gets the Channel BD Chain Current BD.

Parameters
[in]Chanis the MCDMA Channel to Operate on.
Returns
Channel BD Chain current Buffer descriptor.
Note
C-style signature: XMdma_ChanCtrl *XMcdma_GetChanCurBd(XMcdma_ChanCtrl * Chan)
#define XMcdma_GetChanPktDrp_Cnt (   Chan,
  ChanId 
)
Value:
XMcdma_ReadReg(Chan->ChanBase, ((ChanId - 1) * XMCDMA_NXTCHAN_OFFSET + \
#define XMCDMA_NXTCHAN_OFFSET
Next channel register block stride.
Definition: xmcdma_hw.h:84
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMCDMA_PKTDROP_OFFSET
Packet drop count register offset.
Definition: xmcdma_hw.h:80

Get Packet drop Count for the particular Channel.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]ChanIdis the Channel number to be worked on.
Returns
Packet Drop Count.
Note
C-style signature: XMcdma *XMcdma_GetChanPktDrp_Cnt(XMcdma_ChanCtrl *Chan, u32 ChanId)
#define XMcdma_GetEgressObserver (   InstancePtr,
  ObsId 
)
Value:
XMcdma_ReadReg(InstancePtr->Config.BaseAddress, (((ObsId - 1) * XMCDMA_NXTOBS_OFFSET) + \
#define XMCDMA_CHOBS1_OFFSET
Channel observer 1 register offset.
Definition: xmcdma_hw.h:51
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMCDMA_NXTOBS_OFFSET
Next observer register stride.
Definition: xmcdma_hw.h:85

Get Egress Channel Observer contents.

Parameters
[in]InstancePtris the driver instance we are working on.
[in]ObsIdis the Egress Channel observer number to be worked on.
Returns
Channel Observer register contents.
Note
C-style signature: XMcdma *XMcdma_GetEgressObserver(XMcdma *InstancePtr, u32 ObsId)
#define XMcdma_GetIngressObserver (   InstancePtr,
  ObsId 
)
Value:
XMcdma_ReadReg(InstancePtr->Config.BaseAddress, (((ObsId - 1) * XMCDMA_NXTOBS_OFFSET) + \
#define XMCDMA_CHOBS1_OFFSET
Channel observer 1 register offset.
Definition: xmcdma_hw.h:51
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMCDMA_RX_OFFSET
Receive path register base offset.
Definition: xmcdma_hw.h:86
#define XMCDMA_NXTOBS_OFFSET
Next observer register stride.
Definition: xmcdma_hw.h:85

Get Ingress Channel Observer contents.

Parameters
[in]InstancePtris the driver instance we are working on.
[in]ObsIdis the Ingress Channel observer number to be worked on.
Returns
Channel Observer register contents.
Note
C-style signature: XMcdma *XMcdma_GetIngressObserver(XMcdma *InstancePtr, u32 ObsId)
#define XMcdma_GetMcdmaRxChan (   InstancePtr,
  ChanId 
)    (&((InstancePtr)->Rx_Chan[ChanId]))

Gets the RX Channel Pointer.

Parameters
[in]InstancePtris a pointer to the DMA engine instance to be worked on.
[in]ChanIdis the channel to operate on
Returns
Pointer to the Channel
Note
C-style signature: XMcdma_ChanCtrl *XMcdma_McdmaRxChan(XMcdma * InstancePtr, u32 ChanId)

Referenced by XMcdma_IntrHandler(), and XMcdma_ResetIsDone().

#define XMcdma_GetMcdmaTxChan (   InstancePtr,
  ChanId 
)    (&((InstancePtr)->Tx_Chan[ChanId]))

Gets the TX Channel Pointer.

Parameters
[in]InstancePtris a pointer to the DMA engine instance to be worked on.
[in]ChanIdis the channel to operate on
Returns
Pointer to the Channel
Note
C-style signature: XMcdma_ChanCtrl *XMcdma_McdmaTxChan(XMcdma * InstancePtr, u32 ChanId)

Referenced by XMcdma_ResetIsDone(), and XMcdma_TxIntrHandler().

#define XMcdma_GetPktDrp_cnt (   Chan)    XMcdma_ReadReg(Chan->ChanBase, XMCDMA_CPKTDROP_OFFSET)

Gets global Packet drop Count.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
Returns
Packet Drop Count.
Note
C-style signature: XMcdma *XMcdma_GetPktDrp_cnt(XMcdma_ChanCtrl *Chan)
#define XMcdma_HwIsStarted (   Chan)
Value:
((XMcdma_ReadReg((Chan)->ChanBase, XMCDMA_CSR_OFFSET) \
& XMCDMA_CSR_HALTED_MASK) ? FALSE : TRUE)
#define XMCDMA_CSR_HALTED_MASK
Common status halted bit mask.
Definition: xmcdma_hw.h:91
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMCDMA_CSR_OFFSET
Common status register offset.
Definition: xmcdma_hw.h:47

Check whether a DMA is started, meaning the channel is not halted.

Parameters
[in]Chanis the channel instance to operate on.
Returns
  • 1 if channel is started
  • 0 otherwise
Note
C-style signature: int XMcdma_ChanHwIsStarted(XMcdma_ChanCtrl *Chan)

Referenced by XMcdma_UpdateChanTDesc().

#define XMcdma_In32   Xil_In32

Input operation.

#define XMcdma_IntrDisable (   Chan,
  Mask 
)
Value:
(XMcdma_WriteReg((Chan)->ChanBase, \
(Chan->Chan_id - 1) * XMCDMA_NXTCHAN_OFFSET + XMCDMA_CR_OFFSET, \
XMcdma_ReadReg((Chan)->ChanBase, (Chan->Chan_id - 1) * \
~((Mask) & XMCDMA_IRQ_ALL_MASK)))
#define XMCDMA_NXTCHAN_OFFSET
Next channel register block stride.
Definition: xmcdma_hw.h:84
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMCDMA_CR_OFFSET
Per-channel control register offset.
Definition: xmcdma_hw.h:74
#define XMcdma_WriteReg(BaseAddress, RegOffset, Data)
Writes the given register.
Definition: xmcdma_hw.h:246
#define XMCDMA_IRQ_ALL_MASK
All interrupt sources mask.
Definition: xmcdma_hw.h:98

Disables interrupts specified by the Mask.

Interrupts that are not in the mask are not affected.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]Maskis the mask for the interrupts to be disabled
#define XMcdma_IntrEnable (   Chan,
  Mask 
)
Value:
(XMcdma_WriteReg((Chan)->ChanBase, \
(Chan->Chan_id - 1) * XMCDMA_NXTCHAN_OFFSET + XMCDMA_CR_OFFSET, \
XMcdma_ReadReg((Chan)->ChanBase, (Chan->Chan_id - 1) * \
((Mask) & XMCDMA_IRQ_ALL_MASK)))
#define XMCDMA_NXTCHAN_OFFSET
Next channel register block stride.
Definition: xmcdma_hw.h:84
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229
#define XMCDMA_CR_OFFSET
Per-channel control register offset.
Definition: xmcdma_hw.h:74
#define XMcdma_WriteReg(BaseAddress, RegOffset, Data)
Writes the given register.
Definition: xmcdma_hw.h:246
#define XMCDMA_IRQ_ALL_MASK
All interrupt sources mask.
Definition: xmcdma_hw.h:98

Enables interrupts specified by the Mask in specified direction, Interrupts that are not in the mask are not affected.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]Maskis the mask for the interrupts to be enabled
#define XMCDMA_IRQ_ALL_MASK   0x000000F0

All interrupt sources mask.

Referenced by XMcdma_ChanIntrHandler(), XMcdma_IntrHandler(), and XMcdma_TxIntrHandler().

#define XMCDMA_IRQ_DELAY_MASK   0x00000040

Delay interrupt mask.

Referenced by XMcdma_ChanIntrHandler(), XMcdma_IntrHandler(), and XMcdma_TxIntrHandler().

#define XMCDMA_IRQ_ERROR_MASK   0x00000080

Error interrupt mask.

Referenced by XMcdma_ChanIntrHandler(), XMcdma_IntrHandler(), and XMcdma_TxIntrHandler().

#define XMCDMA_IRQ_IOC_MASK   0x00000020

Interrupt on complete mask.

Referenced by XMcdma_ChanIntrHandler(), XMcdma_IntrHandler(), and XMcdma_TxIntrHandler().

#define XMCDMA_IRQ_PKTDROP_MASK   0x00000010

Packet drop interrupt mask.

Referenced by XMcdma_IntrHandler().

#define XMcdma_isidle (   Chan)
Value:
(XMcdma_ReadReg(Chan->ChanBase, XMCDMA_SR_OFFSET) & \
XMCDMA_SR_IDLE_MASK)
#define XMCDMA_SR_OFFSET
Per-channel status register offset.
Definition: xmcdma_hw.h:75
#define XMcdma_ReadReg(BaseAddress, RegOffset)
Reads the given register.
Definition: xmcdma_hw.h:229

Checks whether the DMA channel is idle or not.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
Returns
  • TRUE if MCDMA is idle
  • FALSE if MCDMA is not idle
#define XMCDMA_LAST_APPWORD   4

Last application word index in the BD.

Referenced by XMcDma_BdGetAppWord(), XMcDma_BdSetAppWord(), and XMcDma_Chan_Sideband_Submit().

#define XMCDMA_LOOP_COUNT   1000000

Default poll loop iteration limit.

Referenced by XMcDma_CfgInitialize(), XMcdma_ChanHwStop(), XMcdma_SelfTest(), and XMcdma_Start().

#define XMCDMA_MAX_CHAN_PER_DEVICE   32

Maximum number of channels per MCDMA device.

#define XMCDMA_MAX_TRANSFER_LEN   0x03FFFFFF

Maximum buffer transfer length mask.

#define XMCDMA_MEM_TO_DEV   1

Transfer direction from memory to device.

#define XMCDMA_NUM_APP_WORDS   5

Number of application words in a buffer descriptor.

#define XMCDMA_NXTCHAN_OFFSET   0x40
#define XMCDMA_NXTOBS_OFFSET   0x4

Next observer register stride.

#define XMcdma_Out32   Xil_Out32

Output operation.

#define XMCDMA_PKTDROP_CNT_MASK   0xFFFFFFFF

Packet drop count field mask.

#define XMCDMA_PKTDROP_COALESCE_MASK   0x0000FF00

Packet drop coalesce field mask.

#define XMCDMA_PKTDROP_OFFSET   0x58

Packet drop count register offset.

Referenced by XMcdma_DumpChanRegs().

#define XMcdma_ReadReg (   BaseAddress,
  RegOffset 
)    XMcdma_In32((BaseAddress) + (u32)(RegOffset))
#define XMCDMA_RX_OFFSET   0x500

Receive path register base offset.

Referenced by XMcdma_GetChanServiced(), XMcDma_Initialize(), XMcdma_IntrHandler(), and XMcDma_Reset().

#define XMCDMA_RX_PKTCNT_STAT_OFFSET   0x5C

Receive packet count status register offset.

Referenced by XMCdma_GetChan_PktDoneCnt().

#define XMCDMA_RXAXCACHE_OFFSET   0x1C

Receive AXI cache register offset.

#define XMCDMA_RXCH_SER_OFFSET   0x18

Receive channel service register offset.

#define XMCDMA_RXINT_SER_OFFSET   0x20

Receive interrupt service register offset.

Referenced by XMcdma_IntrHandler().

#define XMcdma_SetARCache (   InstancePtr,
  Value 
)
Value:
XMcdma_WriteReg(InstancePtr->Config.BaseAddress, \
#define XMCDMA_TXAXCACHE_OFFSET
Transmit AXI cache register offset.
Definition: xmcdma_hw.h:64
#define XMCDMA_AXCACHE_MASK
AXI cache attribute field mask.
Definition: xmcdma_hw.h:121
#define XMcdma_WriteReg(BaseAddress, RegOffset, Data)
Writes the given register.
Definition: xmcdma_hw.h:246

Sets the ARCACHE field with the user specified value.

Parameters
[in]InstancePtris the driver instance we are working on
[in]Valueis the ARCACHE value to be written.

Referenced by XMcDma_CfgInitialize().

#define XMcdma_SetAWCache (   InstancePtr,
  Value 
)
Value:
XMcdma_WriteReg(InstancePtr->Config.BaseAddress, \
#define XMCDMA_AXCACHE_MASK
AXI cache attribute field mask.
Definition: xmcdma_hw.h:121
#define XMcdma_WriteReg(BaseAddress, RegOffset, Data)
Writes the given register.
Definition: xmcdma_hw.h:246
#define XMCDMA_RXAXCACHE_OFFSET
Receive AXI cache register offset.
Definition: xmcdma_hw.h:70
#define XMCDMA_RX_OFFSET
Receive path register base offset.
Definition: xmcdma_hw.h:86

Sets the AWCACHE field with the user specified value.

Parameters
[in]InstancePtris the driver instance we are working on
[in]Valueis the AWCACHE value to be written.

Referenced by XMcDma_CfgInitialize().

#define XMCDMA_SGARCACHE_MASK   0x0000000F

Scatter-gather AXI read cache field mask.

Referenced by XMcdma_SetSGARCache().

#define XMCDMA_SGAWCACHE_MASK   0x000F0000

Scatter-gather AXI write cache field mask.

Referenced by XMcdma_SetSGAWCache().

#define XMCDMA_SGAWCACHE_SHIFT   16

Bit shift for scatter-gather write cache field.

Referenced by XMcdma_SetSGAWCache().

#define XMCDMA_SGCACHE_OFFSET   0x4B0

Scatter-gather cache register offset.

Referenced by XMcdma_SetSGARCache(), and XMcdma_SetSGAWCache().

#define XMCDMA_SR_OFFSET   0x44

Per-channel status register offset.

Referenced by XMcdma_DumpChanRegs().

#define XMCDMA_TDESC_MSB_OFFSET   0x54

Tail descriptor pointer MSB register offset.

Referenced by XMcdma_DumpChanRegs(), and XMcdma_UpdateChanTDesc().

#define XMCDMA_TDESC_OFFSET   0x50

Tail descriptor pointer register offset.

Referenced by XMcdma_DumpChanRegs(), and XMcdma_UpdateChanTDesc().

#define XMCDMA_TX_PKTCNT_STAT_OFFSET   0x58

Transmit packet count status register offset.

Referenced by XMCdma_GetChan_PktDoneCnt().

#define XMCDMA_TX_WRR_REG1_OFFSET   0x1C

Transmit weighted round-robin register 1 offset.

Referenced by XMCdma_GetChan_Weight(), and XMCdma_SetChan_Weight().

#define XMCDMA_TX_WRR_REG_OFFSET   0x18

Transmit weighted round-robin register 0 offset.

Referenced by XMCdma_GetChan_Weight(), and XMCdma_SetChan_Weight().

#define XMCDMA_TX_WRRCH0_MASK   0x0000000F

Transmit WRR weight mask for channel 0.

#define XMCDMA_TX_WRRCH1_MASK   0x000000F0

Transmit WRR weight mask for channel 1.

#define XMCDMA_TX_WRRCH2_MASK   0x00000F00

Transmit WRR weight mask for channel 2.

#define XMCDMA_TX_WRRCH3_MASK   0x0000F000

Transmit WRR weight mask for channel 3.

#define XMCDMA_TX_WRRCH4_MASK   0x000F0000

Transmit WRR weight mask for channel 4.

#define XMCDMA_TX_WRRCH5_MASK   0x00F00000

Transmit WRR weight mask for channel 5.

#define XMCDMA_TX_WRRCH6_MASK   0x0F000000

Transmit WRR weight mask for channel 6.

#define XMCDMA_TX_WRRCH7_MASK   0xF0000000

Transmit WRR weight mask for channel 7.

#define XMCDMA_TX_WRRCH_MASK (   Chan_id)    WRR_MASK((Chan_id * 4 + 3), Chan_id *4)

Returns the WRR weight field mask for a transmit channel.

Parameters
[in]Chan_idis the zero-based WRR channel index within the register.

Referenced by XMCdma_GetChan_Weight(), and XMCdma_SetChan_Weight().

#define XMCDMA_TX_WRRCH_SHIFT (   Chan_id)    Chan_id * 4

Returns the bit shift for a transmit channel WRR weight field.

Parameters
[in]Chan_idis the zero-based WRR channel index within the register.

Referenced by XMCdma_GetChan_Weight(), and XMCdma_SetChan_Weight().

#define XMCDMA_TXAXCACHE_OFFSET   0x24

Transmit AXI cache register offset.

#define XMcDma_TxBdGetActualLength (   BdPtr,
  LengthMask 
)
Value:
LengthMask)
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:94
#define XMCDMA_BD_SIDEBAND_STS_OFFSET
Side Band Status.
Definition: xmcdma_hw.h:163

Get the actual transfer length of a Egress(MM2S) BD.

The BD has completed in hw.

May not work if the BD is in cached memory.

Parameters
[in]BdPtris the BD to check on
[in]LengthMaskis the Maximum Transfer Length.
Note
C-style signature: int XMcDma_TxBdGetActualLength(XMcdma_Bd* BdPtr, u32 LengthMask)
#define XMcDma_TxBdGetSts (   BdPtr)    XMcdma_BdRead((BdPtr), XMCDMA_BD_SIDEBAND_STS_OFFSET)

Retrieve the status of a Egress(MM2S) BD.

Parameters
[in]BdPtris the BD to operate on
Returns
Use XMDMA_BD_STS_*** values defined in xmdma_hw.h to interpret the returned value
Note
C-style signature: u32 XMcDma_TxBdGetSts(XMcdma_Bd* BdPtr)
#define XMcdma_TxBdHwCompleted (   BdPtr)
Value:
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:94
#define XMCDMA_BD_STS_COMPLETE_MASK
Completed.
Definition: xmcdma_hw.h:183
#define XMCDMA_BD_SIDEBAND_STS_OFFSET
Side Band Status.
Definition: xmcdma_hw.h:163

Check whether a Egress(MM2S) BD has completed in hardware.

This BD has been submitted to hardware. The application can use this function To poll for the Completion of the BD.

May not work if the BD is in cached memory.

Parameters
[in]BdPtris the BD to check on
Returns
  • 0 if not complete
  • XMCDMA_BD_STS_COMPLETE_MASK if completed, may contain XMDMA_BD_STS_*_ERR_MASK bits.
Note
C-style signature: int XMcdma_TxBdHwCompleted(XMcdma_Bd* BdPtr)
#define XMCDMA_TXCH_SERV_OFFSET   0x20

Transmit channel service register offset.

#define XMCDMA_TXINT_SER_OFFSET   0x28

Transmit interrupt service register offset.

Referenced by XMcdma_TxIntrHandler().

#define XMCDMA_TXSCHD_TYPE_OFFSET   0x14

Transmit scheduler type register offset.

#define XMcdma_WriteReg (   BaseAddress,
  RegOffset,
  Data 
)    XMcdma_Out32(((BaseAddress) + (RegOffset)), (Data))

Writes the given register.

Parameters
[in]BaseAddressis the base address of the MCDMA core.
[in]RegOffsetis the register offset of the register.
[in]Datais the 32-bit value to write to the register.
Note
C-style signature: void XMcdma_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)

Referenced by XMcdma_ChanHwStop(), XMcdma_EnableCh(), XMcDma_Reset(), XMCdma_SetChan_Weight(), XMcdma_SetChanCoalesceDelay(), XMcdma_SetSGARCache(), XMcdma_SetSGAWCache(), XMcdma_Start(), XMcdma_UpdateChanCDesc(), and XMcdma_UpdateChanTDesc().

Typedef Documentation

typedef u32 XMcdma_Bd[16]

Buffer descriptor storage as an array of 32-bit words.

Enumeration Type Documentation

MCDMA per-channel interrupt handler types.

Enumerator
XMCDMA_CHAN_HANDLER_DONE 

For Done Handler.

XMCDMA_CHAN_HANDLER_ERROR 

For Error Handler.

XMCDMA_CHAN_HANDLER_PKTDROP 

For Error Handler.

MCDMA instance-level interrupt handler types.

Enumerator
XMCDMA_TX_HANDLER_DONE 

For Done Handler.

XMCDMA_TX_HANDLER_ERROR 

For Error Handler.

XMCDMA_HANDLER_DONE 

For Done Handler.

XMCDMA_HANDLER_ERROR 

For Error Handler.

XMCDMA_HANDLER_PKTDROP 

For Error Handler.

Queue scheduler types for MCDMA channels.

Enumerator
XMCDMA_FIXED_PRIORITY 

Fixed-priority channel scheduling.

XMCDMA_WRR 

Weighted round-robin channel scheduling.

XMCDMA_WRR_PRIORITY 

Weighted round-robin with priority scheduling.

Function Documentation

int main ( void  )

Runs the MCDMA interrupt-mode example entry point.

Runs the MCDMA polled-mode example entry point.

Sets up the DMA engine to send and receive packets, then verifies the data.

Returns
  • XST_SUCCESS if the test passes.
  • XST_FAILURE if the test fails.

References BLOCK_SIZE_2MB, MCDMA_BASE_ADDR, NUMBER_OF_BDS_TO_TRANSFER, NUMBER_OF_EVENTS, POLL_TIMEOUT_COUNTER, XMcDma_CfgInitialize(), and XMcdma_LookupConfig().

int XMcdma_BdChainFree ( XMcdma_ChanCtrl *  Chan,
int  BdCount,
XMcdma_Bd *  BdSetPtr 
)

Frees a set of BDs that had been previously retrieved with XMcdma_BdChainFromHW().

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]BdCountis the number of BDs to free.
[in]BdSetPtris the head of a list of BDs returned by XMcdma_BdChainFromHW().
Returns
  • XST_SUCCESS if the set of BDs was freed.
  • XST_INVALID_PARAM if NumBd is negative
Note
This function should not be preempted by another XAxiMcDma function call that modifies the BD space. It is the caller's responsibility to ensure mutual exclusion.

References XMcdma_ChanCtrl::BdDoneCnt, XMcdma_BdChainNextBd, and XMcdma_BdClear.

int XMcdma_BdChainFromHW ( XMcdma_ChanCtrl *  Chan,
u32  BdLimit,
XMcdma_Bd **  BdSetPtr 
)

Returns a set of BD(s) that have been processed by hardware.

The returned BDs may be examined by the application to determine the outcome of the DMA transactions. Once the BDs have been examined, the application must call XMcdma_BdChainFree() in the same order which they were retrieved here.

If hardware has partially completed a packet spanning multiple BDs, then none of the BDs for that packet will be included in the results.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]BdLimitis the maximum number of BDs to return in the set.
[in]BdSetPtris an output parameter, it points to the first BD available for examination.
Returns
The number of BDs processed by hardware. A value of 0 indicates that no data is available. No more than BdLimit BDs will be returned.
Note
Treat BDs returned by this function as read-only.

References XMcdma_ChanCtrl::BdCnt, XMcdma_ChanCtrl::BdDoneCnt, XMcdma_ChanCtrl::BdHead, XMcdma_ChanCtrl::BdSubmitCnt, XMcdma_ChanCtrl::BdTail, XMcdma_ChanCtrl::IsRxChan, XMCDMA_BD_CTRL_EOF_MASK, XMCDMA_BD_CTRL_OFFSET, XMCDMA_BD_SIDEBAND_STS_OFFSET, XMCDMA_BD_STS_COMPLETE_MASK, XMCDMA_BD_STS_OFFSET, XMCDMA_BD_STS_RXEOF_MASK, XMcdma_BdChainNextBd, XMcdma_BdRead, XMCDMA_CACHE_INVALIDATE, and XMCDMA_CHAN_SEEKAHEAD.

u32 XMcDma_BdGetAppWord ( XMcdma_Bd *  BdPtr,
int  Offset,
int *  Valid 
)

Get the APP word at the specified APP word offset for a BD.

Parameters
[in]BdPtris the BD to operate on.
[in]Offsetis the offset inside the APP word, it is valid from 0 to 4
[in]Validis to tell the caller whether parameters are valid
Returns
The APP word. Passed in parameter Valid holds 0 for failure, and 1 for success.

References XMCDMA_BD_HAS_CTRLSTS_OFFSET, XMCDMA_BD_USR0_OFFSET, XMcdma_BdRead, and XMCDMA_LAST_APPWORD.

int XMcDma_BdSetAppWord ( XMcdma_Bd *  BdPtr,
int  Offset,
u32  Word 
)

Set the APP word at the specified APP word offset for a BD.

Parameters
[in]BdPtris the BD to operate on
[in]Offsetis the offset inside the APP word, it is valid from 0 to 4
[in]Wordis the value to set
Returns
  • XST_SUCCESS for success
  • XST_INVALID_PARAM under following error conditions. 1) StsCntrlStrm is not built in hardware 2) Offset is not in valid range

References XMCDMA_BD_HAS_CTRLSTS_OFFSET, XMCDMA_BD_USR0_OFFSET, XMcdma_BdRead, XMcdma_BdWrite, and XMCDMA_LAST_APPWORD.

u32 XMcdma_BdSetBufAddr ( XMcdma_Bd *  BdPtr,
UINTPTR  Addr 
)

Set the Buffer descriptor buffer address field.

Parameters
[in]BdPtris the BD to operate on
[in]Addris the address to set
Returns
  • XST_SUCCESS if buffer address set successfully
  • XST_INVALID_PARAM if hardware has no DRE and address is not aligned

References XMCDMA_BD_BUFA_OFFSET, XMCDMA_BD_HAS_DRE_MASK, XMCDMA_BD_HAS_DRE_OFFSET, XMCDMA_BD_WORDLEN_MASK, XMcdma_BdRead, XMcdma_BdWrite, and XMcdma_BdWrite64.

Referenced by XMcDma_Chan_Sideband_Submit(), and XMcDma_ChanSubmit().

void XMcDma_BdSetCtrl ( XMcdma_Bd *  BdPtr,
u32  Data 
)

Set the control bits for a BD.

Parameters
[in]BdPtris the BD to operate on.
[in]Datais the bit value to set

References XMCDMA_BD_CTRL_ALL_MASK, XMCDMA_BD_CTRL_OFFSET, XMcdma_BdRead, and XMcdma_BdWrite.

s32 XMcDma_CfgInitialize ( XMcdma *  InstancePtr,
XMcdma_Config *  CfgPtr 
)

Initializes an MCDMA core before any other driver function is called.

Initialization includes setting up the instance data and ensuring the hardware is in a quiescent state and resets all the hardware configurations.

Parameters
[in]InstancePtris a pointer to the XMcdma instance.
[in]CfgPtris a reference to a structure containing information about a specific XMcdma instance.
Returns
  • XST_SUCCESS if initialization was successful.

References XMcdma::Config, XMcdma::IsReady, XMCDMA_AXCACHE, XMcDma_Initialize(), XMCDMA_LOOP_COUNT, XMcDma_Reset(), XMcdma_ResetIsDone(), XMcdma_SetARCache, and XMcdma_SetAWCache.

Referenced by main().

u32 XMcDma_Chan_Sideband_Submit ( XMcdma_ChanCtrl *  ChanPtr,
UINTPTR  BufAddr,
u32  Len,
u32 *  AppPtr,
u16  Tuser,
u16  Tid 
)

Populates the BD chain with the required buffer address, length APP(user application), TUSER and TID fields.

User can submit multiple buffers/buffer descriptors by calling this function multiple times

Parameters
[in]ChanPtris the MCDMA Channel to be worked on.
[in]BufAddris the buffer address to which data should send/recv.
[in]Lenis the Amount of data user requested to send/recv.
[in]AppPtris the point to APP fields.
[in]Tuseris the value presented on the beat that has TLAST.
[in]Tidis the value value presented on the beat that has TLAST.
Returns
  • XST_SUCCESS if initialization was successful
  • XST_FAILURE if the BdStartAddress or requested bdlen doesn't match for the driver requirements.

References XMcdma_ChanCtrl::BdCnt, XMcdma_ChanCtrl::BdPendingCnt, XMcdma_ChanCtrl::BdRestart, XMcdma_ChanCtrl::BdTail, XMcdma_ChanCtrl::HasRxLength, XMcdma_ChanCtrl::IsRxChan, XMcdma_ChanCtrl::MaxTransferLen, XMCDMA_BD_CTRL_OFFSET, XMCDMA_BD_USR0_OFFSET, XMcdma_BdChainNextBd, XMcdma_BdClear, XMcdma_BdSetBufAddr(), XMcDma_BdSetCtrlSideBand, XMcdma_BdWrite, XMCDMA_CACHE_FLUSH, and XMCDMA_LAST_APPWORD.

u32 XMcDma_ChanBdCreate ( XMcdma_ChanCtrl *  Chan,
UINTPTR  Addr,
u32  Count 
)

Using a memory segment allocated by the caller, creates and setup the BD Chain for the MCDMA Channel.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]Addris the address of the application memory region.
[in]Countis the number of BDs to setup in the application memory region.
Returns
  • XST_SUCCESS if initialization was successful
  • XST_INVALID_PARAM if Count is not positive.

References XMcdma_ChanCtrl::BdCnt, XMcdma_ChanCtrl::BdDoneCnt, XMcdma_ChanCtrl::BdHead, XMcdma_ChanCtrl::BdPendingCnt, XMcdma_ChanCtrl::BdRestart, XMcdma_ChanCtrl::BdSubmitCnt, XMcdma_ChanCtrl::BdTail, XMcdma_ChanCtrl::ChanState, XMcdma_ChanCtrl::FirstBdAddr, XMcdma_ChanCtrl::Has_Rxdre, XMcdma_ChanCtrl::Has_Txdre, XMcdma_ChanCtrl::HasStsCntrlStrm, XMcdma_ChanCtrl::IsRxChan, XMcdma_ChanCtrl::LastBdAddr, XMcdma_ChanCtrl::Length, XMcdma_ChanCtrl::RxDataWidth, XMcdma_ChanCtrl::Separation, XMcdma_ChanCtrl::TxDataWidth, XMCDMA_BD_HAS_CTRLSTS_OFFSET, XMCDMA_BD_HAS_DRE_OFFSET, XMCDMA_BD_HAS_DRE_SHIFT, XMCDMA_BD_NDESC_MSB_OFFSET, XMCDMA_BD_NDESC_OFFSET, XMcdma_BdWrite, XMCDMA_CACHE_FLUSH, and XMCDMA_CHAN_IDLE.

u32 XMcdma_ChanHwStop ( XMcdma_ChanCtrl *  Chan)

Stops the DMA engine.

Parameters
[in]Chanis the Channel instance to be worked on.
Returns
  • XST_SUCCESS for success.
  • XST_FAILURE if hardware fails stop.

References XMcdma_ChanCtrl::Chan_id, XMcdma_ChanCtrl::ChanBase, XMCDMA_CCR_RUNSTOP_MASK, XMCDMA_CR_OFFSET, XMCDMA_LOOP_COUNT, XMCDMA_NXTCHAN_OFFSET, XMcdma_ReadReg, and XMcdma_WriteReg.

void XMcdma_ChanIntrHandler ( void *  Instance)

Handles per-channel MCDMA interrupts for the MCDMA core.

This handler reads the pending interrupt from Status register, determines the source of the interrupts and calls the respective callbacks for the interrupts that are enabled in the per channel control register, and finally clears the interrupts.

The application is responsible for connecting this function to the interrupt system. Application beyond this driver is also responsible for providing callbacks to handle interrupts and installing the callbacks using XMcdma_ChanSetCallBack() during initialization phase.

Parameters
[in]Instanceis a pointer to the Channel instance to be worked on.
Note
To generate interrupt required interrupts should be enabled.

References XMcdma_ChanCtrl::ChanState, XMcdma_ChanCtrl::DoneHandler, XMcdma_ChanCtrl::DoneRef, XMcdma_ChanCtrl::ErrorHandler, XMcdma_ChanCtrl::ErrorRef, XMCDMA_CHAN_IDLE, XMCDMA_CHAN_PAUSE, XMcdma_ChanAckIrq, XMcdma_ChanGetIrq, XMCDMA_IRQ_ALL_MASK, XMCDMA_IRQ_DELAY_MASK, XMCDMA_IRQ_ERROR_MASK, and XMCDMA_IRQ_IOC_MASK.

s32 XMcdma_ChanSetCallBack ( XMcdma_ChanCtrl *  Chan,
XMcdma_ChanHandler  HandlerType,
void *  CallBackFunc,
void *  CallBackRef 
)

This routine installs an asynchronous callback function for the given HandlerType.

HandlerType              Callback Function Type
-----------------------  --------------------------------------------------
XMCDMA_HANDLER_DONE      Channel Done handler
XMCDMA_HANDLER_ERROR     Channel Error handler
Parameters
[in]Chanis the Channel instance to be worked on.
[in]HandlerTypespecifies which callback is to be attached.
[in]CallBackFuncis the address of the callback function.
[in]CallBackRefis a user data item that will be passed to the callback function when it is invoked.
Returns
  • XST_SUCCESS when handler is installed.
  • XST_INVALID_PARAM when HandlerType is invalid.
Note
Invoking this function for a handler that already has been installed replaces it with the new handler.

References XMcdma_ChanCtrl::DoneHandler, XMcdma_ChanCtrl::DoneRef, XMcdma_ChanCtrl::ErrorHandler, XMcdma_ChanCtrl::ErrorRef, XMCDMA_CHAN_HANDLER_DONE, and XMCDMA_CHAN_HANDLER_ERROR.

u32 XMcDma_ChanSubmit ( XMcdma_ChanCtrl *  Chan,
UINTPTR  BufAddr,
u32  len 
)

Populates the BD chain with the required buffer address and length fields.

User can submit multiple buffers/buffer descriptors by calling this function multiple times

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]BufAddris the buffer address to which data should send/recv.
[in]lenis the Amount of data user requested to send/recv.
Returns
  • XST_SUCCESS if initialization was successful
  • XST_FAILURE if the BdStartAddress or requested bdlen doesn't match for the driver requirements.

References XMcdma_ChanCtrl::BdCnt, XMcdma_ChanCtrl::BdPendingCnt, XMcdma_ChanCtrl::BdRestart, XMcdma_ChanCtrl::BdTail, XMcdma_ChanCtrl::MaxTransferLen, XMCDMA_BD_CTRL_OFFSET, XMcdma_BdChainNextBd, XMcdma_BdClear, XMcdma_BdSetBufAddr(), XMcdma_BdWrite, and XMCDMA_CACHE_FLUSH.

u32 XMcDma_ChanToHw ( XMcdma_ChanCtrl *  Chan)

Starts hardware by programming current and tail descriptors by programming the Current and Tail Descriptors and enabling the particular channel.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
Returns
  • XST_SUCCESS if initialization was successful
  • XST_FAILURE In case of failure

References XMcdma_EnableCh(), XMcdma_UpdateChanCDesc(), and XMcdma_UpdateChanTDesc().

void XMcdma_DumpChanRegs ( XMcdma_ChanCtrl *  Chan)
void XMcdma_EnableCh ( XMcdma_ChanCtrl *  Chan)

Enables a particular channel.

Parameters
[in]Chanis the Channel instance to be worked on.

References XMcdma_ChanCtrl::Chan_id, XMcdma_ChanCtrl::ChanBase, XMCDMA_CHEN_OFFSET, XMcdma_ReadReg, and XMcdma_WriteReg.

Referenced by XMcDma_ChanToHw().

u32 XMCdma_GetChan_PktDoneCnt ( XMcdma_ChanCtrl *  Chan)

Gets the packet-done count for an MCDMA channel.

Parameters
[in]Chanis a pointer to the MCDMA channel to query.
Returns
The packet-done count reported by the channel statistics register.

References XMcdma_ChanCtrl::Chan_id, XMcdma_ChanCtrl::ChanBase, XMcdma_ChanCtrl::IsRxChan, XMCDMA_NXTCHAN_OFFSET, XMcdma_ReadReg, XMCDMA_RX_PKTCNT_STAT_OFFSET, and XMCDMA_TX_PKTCNT_STAT_OFFSET.

u32 XMCdma_GetChan_Weight ( XMcdma_ChanCtrl *  Chan)

Gets the weighted round-robin weight for a transmit channel.

Parameters
[in]Chanis a pointer to the MCDMA channel to query.
Returns
The configured channel weight on success, or XST_FAILURE on error.

References XMcdma_ChanCtrl::Chan_id, XMcdma_ChanCtrl::ChanBase, XMcdma_ChanCtrl::IsRxChan, XMcdma_ReadReg, XMCDMA_TX_WRR_REG1_OFFSET, XMCDMA_TX_WRR_REG_OFFSET, XMCDMA_TX_WRRCH_MASK, and XMCDMA_TX_WRRCH_SHIFT.

u16 XMcdma_GetChanServiced ( XMcdma *  InstancePtr)

Gets the last serviced s2mm channel number.

Parameters
[in]InstancePtris a pointer to the DMA engine instance to be worked on.
Returns
  • Channel id that last serviced.

References XMcdma::Config, XMCDMA_CHSER_OFFSET, XMcdma_ReadReg, and XMCDMA_RX_OFFSET.

u16 XMcdma_GetTxChanServiced ( XMcdma *  InstancePtr)

Gets the last serviced mm2s channel number.

Parameters
[in]InstancePtris a pointer to the DMA engine instance to be worked on.
Returns
  • Channel id that last serviced.

References XMcdma::Config, XMCDMA_CHSER_OFFSET, and XMcdma_ReadReg.

s32 XMcDma_Initialize ( XMcdma *  InstancePtr,
XMcdma_Config *  CfgPtr 
)

Initializes an MCDMA core before any other driver function is called.

Initialization includes setting up the instance data and updating driver fields with proper values.

Parameters
[in]InstancePtris a pointer to the XMcdma instance.
[in]CfgPtris a reference to a structure containing information about a specific XMcdma instance.
Returns
  • XST_SUCCESS if initialization was successful.
Note
When user calls this function he should ensure the hardware is in a quiescent state by resetting all the hardware Configurations.

References XMcdma_ChanCtrl::Chan_id, XMcdma_ChanCtrl::ChanBase, XMcdma::Config, XMcdma_ChanCtrl::ext_addr, XMcdma_ChanCtrl::Has_Rxdre, XMcdma_ChanCtrl::Has_Txdre, XMcdma_ChanCtrl::HasRxLength, XMcdma_ChanCtrl::HasStsCntrlStrm, XMcdma::IsReady, XMcdma_ChanCtrl::IsRxChan, MAX_TRANSFER_LEN, XMcdma_ChanCtrl::MaxTransferLen, XMcdma::Rx_Chan, XMcdma_ChanCtrl::RxDataWidth, XMcdma::Tx_Chan, XMcdma_ChanCtrl::TxDataWidth, and XMCDMA_RX_OFFSET.

Referenced by XMcDma_CfgInitialize().

void XMcdma_IntrHandler ( void *  Instance)

Handles S2MM (RX) MCDMA interrupts for the MCDMA core.

This handler reads the pending interrupt from Status register, determines the source of the interrupts and calls the respective callbacks for the interrupts that are enabled in global control register, and finally clears the interrupts.

The application is responsible for connecting this function to the interrupt system. Application beyond this driver is also responsible for providing callbacks to handle interrupts and installing the callbacks using XMcdma_SetCallBack() during initialization phase.

Parameters
[in]Instanceis a pointer to the XMcdma instance to be worked on.
Note
To generate interrupt required interrupts should be enabled.

References XMcdma_ChanCtrl::ChanState, XMcdma::Config, XMcdma::DoneHandler, XMcdma::DoneRef, XMcdma::ErrorHandler, XMcdma::ErrorRef, XMcdma::PktDropHandler, XMcdma::PktDropRef, XMCDMA_CHAN_IDLE, XMCDMA_CHAN_PAUSE, XMcdma_ChanAckIrq, XMcdma_ChanGetIrq, XMcdma_GetMcdmaRxChan, XMCDMA_IRQ_ALL_MASK, XMCDMA_IRQ_DELAY_MASK, XMCDMA_IRQ_ERROR_MASK, XMCDMA_IRQ_IOC_MASK, XMCDMA_IRQ_PKTDROP_MASK, XMcdma_ReadReg, XMCDMA_RX_OFFSET, and XMCDMA_RXINT_SER_OFFSET.

XMcdma_Config * XMcdma_LookupConfig ( UINTPTR  BaseAddress)

Looks up device configuration by base address.

Parameters
[in]BaseAddresscontains the base address of the device.
Returns
A pointer to the configuration table entry corresponding to the given base address, or NULL if no match is found.

Referenced by main().

void XMcDma_Reset ( XMcdma *  InstancePtr)

Resets the MCDMA core.

Parameters
[in]InstancePtris a pointer to the XMcdma instance.
Note
Resets all configurations made previously.

References XMcdma_ChanCtrl::ChanState, XMcdma::Config, XMcdma::Rx_Chan, XMcdma::Tx_Chan, XMCDMA_CCR_OFFSET, XMCDMA_CCR_RESET_MASK, XMCDMA_CHAN_IDLE, XMCDMA_RX_OFFSET, and XMcdma_WriteReg.

Referenced by XMcDma_CfgInitialize(), and XMcdma_SelfTest().

u32 XMcdma_ResetIsDone ( XMcdma *  InstancePtr)

Check whether reset is done.

Parameters
[in]InstancePtris a pointer to the DMA engine instance to be worked on.
Returns
  • 1 if reset is done.
  • 0 if reset is not done

References XMcdma_ChanCtrl::ChanBase, XMcdma::Config, XMCDMA_CCR_OFFSET, XMCDMA_CCR_RESET_MASK, XMcdma_GetMcdmaRxChan, XMcdma_GetMcdmaTxChan, and XMcdma_ReadReg.

Referenced by XMcDma_CfgInitialize(), and XMcdma_SelfTest().

s32 XMcdma_SelfTest ( XMcdma *  InstancePtr)

This file contains a diagnostic self-test function for the MCDMA driver.

Parameters
[in]InstancePtris a pointer to XMcDma instance.
Returns
  • XST_SUCCESS if the test is successful.
  • XST_FAILURE if the test is failed.

References XMCDMA_LOOP_COUNT, XMcDma_Reset(), and XMcdma_ResetIsDone().

s32 XMcdma_SetCallBack ( XMcdma *  InstancePtr,
XMcdma_Handler  HandlerType,
void *  CallBackFunc,
void *  CallBackRef 
)

This routine installs an asynchronous callback function for the given HandlerType.

HandlerType              Callback Function Type
-----------------------  --------------------------------------------------
XMCDMA_TX_HANDLER_DONE   MM2S(TX) Done handler
XMCDMA_TX_HANDLER_ERROR  MM2S(TX) Error handler
XMCDMA_HANDLER_DONE      S2MM(RX) Done handler
XMCDMA_HANDLER_ERROR     S2MM(RX) Error handler
XMCDMA_HANDLER_PKTDROP   S2MM(RX) Packet drop handler
Parameters
[in]InstancePtris a pointer to the XMcdma instance to be worked on.
[in]HandlerTypespecifies which callback is to be attached.
[in]CallBackFuncis the address of the callback function.
[in]CallBackRefis a user data item that will be passed to the callback function when it is invoked.
Returns
  • XST_SUCCESS when handler is installed.
  • XST_INVALID_PARAM when HandlerType is invalid.
Note
Invoking this function for a handler that already has been installed replaces it with the new handler.

References XMcdma::DoneHandler, XMcdma::DoneRef, XMcdma::ErrorHandler, XMcdma::ErrorRef, XMcdma::PktDropHandler, XMcdma::PktDropRef, XMcdma::TxDoneHandler, XMcdma::TxDoneRef, XMcdma::TxErrorHandler, XMcdma::TxErrorRef, XMCDMA_HANDLER_DONE, XMCDMA_HANDLER_ERROR, XMCDMA_HANDLER_PKTDROP, XMCDMA_TX_HANDLER_DONE, and XMCDMA_TX_HANDLER_ERROR.

u32 XMCdma_SetChan_Weight ( XMcdma_ChanCtrl *  Chan,
u8  Weight 
)

Sets the weighted round-robin weight for a transmit channel.

Parameters
[in]Chanis a pointer to the MCDMA channel to configure.
[in]Weightis the WRR weight value in the range 1 to 15.
Returns
XST_SUCCESS on success, or XST_FAILURE on error.

References XMcdma_ChanCtrl::Chan_id, XMcdma_ChanCtrl::ChanBase, XMcdma_ChanCtrl::IsRxChan, XMcdma_ReadReg, XMCDMA_TX_WRR_REG1_OFFSET, XMCDMA_TX_WRR_REG_OFFSET, XMCDMA_TX_WRRCH_MASK, XMCDMA_TX_WRRCH_SHIFT, and XMcdma_WriteReg.

u32 XMcdma_SetChanCoalesceDelay ( XMcdma_ChanCtrl *  Chan,
u32  IrqCoalesce,
u32  IrqDelay 
)

Set interrupt coalescing parameters for a particular channel.

Parameters
[in]Chanis the MCDMA Channel to be worked on.
[in]IrqCoalesceis the Irq Threshold value valid ranges are 1 to 255
[in]IrqDelayis the Irq Delay value valid ranges are 1 to 255
Returns
  • XST_SUCCESS if Interrupt Coalescing settings updated
  • XST_FAILURE if IrqCoalesce and IrqDelay parameters are out of range

References XMcdma_ChanCtrl::Chan_id, XMcdma_ChanCtrl::ChanBase, XMCDMA_COALESCE_MASK, XMCDMA_COALESCE_SHIFT, XMCDMA_CR_OFFSET, XMCDMA_DELAY_MASK, XMCDMA_DELAY_SHIFT, XMCDMA_NXTCHAN_OFFSET, XMcdma_ReadReg, and XMcdma_WriteReg.

void XMcdma_SetSGARCache ( XMcdma *  InstancePtr,
u8  Value 
)

Sets the ARCACHE field of the SG interface With the user specified value.

Parameters
[in]InstancePtris the driver instance we are working on
[in]Valueis the ARCACHE value to be written.

References XMcdma::Config, XMcdma_ReadReg, XMCDMA_SGARCACHE_MASK, XMCDMA_SGCACHE_OFFSET, and XMcdma_WriteReg.

void XMcdma_SetSGAWCache ( XMcdma *  InstancePtr,
u8  Value 
)

Sets the AWCACHE field of the SG interface With the user specified value.

Parameters
[in]InstancePtris the driver instance we are working on
[in]Valueis the AWCACHE value to be written.

References XMcdma::Config, XMcdma_ReadReg, XMCDMA_SGAWCACHE_MASK, XMCDMA_SGAWCACHE_SHIFT, XMCDMA_SGCACHE_OFFSET, and XMcdma_WriteReg.

u32 XMcdma_Start ( XMcdma_ChanCtrl *  Chan)

Start the DMA engine.

Parameters
[in]Chanis the Channel instance to be worked on.
Returns
  • XST_SUCCESS for success.
  • XST_FAILURE if starting the hardware fails.

References XMcdma_ChanCtrl::ChanBase, XMCDMA_CCR_OFFSET, XMCDMA_CCR_RUNSTOP_MASK, XMCDMA_CSR_HALTED_MASK, XMCDMA_CSR_OFFSET, XMCDMA_LOOP_COUNT, XMcdma_ReadReg, and XMcdma_WriteReg.

Referenced by XMcdma_UpdateChanTDesc().

void XMcdma_TxIntrHandler ( void *  Instance)

Handles MM2S MCDMA interrupts for the MCDMA core.

This handler reads the pending interrupt from Status register, determines the source of the interrupts and calls the respective callbacks for the interrupts that are enabled in global control register, and finally clears the interrupts.

The application is responsible for connecting this function to the interrupt system. Application beyond this driver is also responsible for providing callbacks to handle interrupts and installing the callbacks using XMcdma_SetCallBack() during initialization phase.

Parameters
[in]Instanceis a pointer to the XMcdma instance to be worked on.
Note
To generate interrupt required interrupts should be enabled.

References XMcdma_ChanCtrl::ChanState, XMcdma::Config, XMcdma::TxDoneHandler, XMcdma::TxDoneRef, XMcdma::TxErrorHandler, XMcdma::TxErrorRef, XMCDMA_CHAN_IDLE, XMCDMA_CHAN_PAUSE, XMcdma_ChanAckIrq, XMcdma_ChanGetIrq, XMcdma_GetMcdmaTxChan, XMCDMA_IRQ_ALL_MASK, XMCDMA_IRQ_DELAY_MASK, XMCDMA_IRQ_ERROR_MASK, XMCDMA_IRQ_IOC_MASK, XMcdma_ReadReg, and XMCDMA_TXINT_SER_OFFSET.

int XMcdma_UpdateChanCDesc ( XMcdma_ChanCtrl *  Chan)

Update Current Descriptor for the MCDMA Channel.

Parameters
[in]Chanis the Channel instance to be worked on.
Returns
  • XST_SUCCESS upon success

References XMcdma_ChanCtrl::BdHead, XMcdma_ChanCtrl::Chan_id, XMcdma_ChanCtrl::ChanBase, XMcdma_ChanCtrl::ChanState, XMcdma_ChanCtrl::ext_addr, XMCDMA_CACHE_FLUSH, XMCDMA_CDESC_MSB_OFFSET, XMCDMA_CDESC_OFFSET, XMCDMA_CHAN_BUSY, XMCDMA_NXTCHAN_OFFSET, and XMcdma_WriteReg.

Referenced by XMcDma_ChanToHw().

int XMcdma_UpdateChanTDesc ( XMcdma_ChanCtrl *  Chan)

Variable Documentation

XMcdma_Config XMcdma_ConfigTable[]
Initial value:
= {
{
XPAR_AXI_MCDMA_0_DEVICE_ID,
XPAR_AXI_MCDMA_0_BASEADDR,
XPAR_AXI_MCDMA_0_ADDR_WIDTH,
XPAR_AXI_MCDMA_0_ENABLE_SINGLE_INTR,
XPAR_AXI_MCDMA_0_INCLUDE_MM2S,
XPAR_AXI_MCDMA_0_INCLUDE_MM2S_DRE,
XPAR_AXI_MCDMA_0_NUM_MM2S_CHANNELS,
XPAR_AXI_MCDMA_0_INCLUDE_S2MM,
XPAR_AXI_MCDMA_0_INCLUDE_S2MM_DRE,
XPAR_AXI_MCDMA_0_NUM_S2MM_CHANNELS,
XPAR_AXI_MCDMA_0_M_AXI_MM2S_DATA_WIDTH,
XPAR_AXI_MCDMA_0_M_AXI_S2MM_DATA_WIDTH,
XPAR_AXI_MCDMA_0_SG_LENGTH_WIDTH,
XPAR_AXI_MCDMA_0_SG_INCLUDE_STSCNTRL_STRM
}
}

Configuration table for each MCDMA instance in the system.