mcdma
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
xmcdma.h File Reference
#include "xmcdma_hw.h"
#include "xmcdma_bd.h"
#include "xil_assert.h"
#include "xstatus.h"
#include "xil_cache.h"

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_H_
 Include guard for the MCDMA driver header. More...
 
#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...
 

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

XMcdma_Config * XMcdma_LookupConfig (UINTPTR BaseAddress)
 Looks up device configuration by base address. More...
 
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...
 
s32 XMcdma_SelfTest (XMcdma *InstancePtr)
 This file contains a diagnostic self-test function for the MCDMA driver. More...
 
u32 XMcdma_ResetIsDone (XMcdma *InstancePtr)
 Check whether reset is done. More...
 
void XMcdma_DumpChanRegs (XMcdma_ChanCtrl *Chan)
 Dump the registers for a channel. 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_SetChanCoalesceDelay (XMcdma_ChanCtrl *Chan, u32 IrqCoalesce, u32 IrqDelay)
 Set interrupt coalescing parameters for a particular 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_Weight (XMcdma_ChanCtrl *Chan)
 Gets 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_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...
 
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...
 

Macro Definition Documentation

#define XMCDMA_H_

Include guard for the MCDMA driver header.