| mcdma Vitis Drivers API Documentation

- Overview
- APIs
- File List

Macros | Enumerations | Functions
Overview

## Macros
#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)
| This function checks whether DMA is Idle or not. More...
#define | XMcdma_IntrEnable(Chan, Mask)
| This function 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)
| This function 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)
| This functions gives the Buffer descriptor count processed by the h/w. More...
#define | XMcdma_ChanGetIrq(Chan)
| This function gets the interrupts that are asserted. More...
#define | XMcdma_ChanAckIrq(Chan, Mask)
| This function acknowledges the 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)
| This function sets the ARCACHE field with the user specified value. More...
#define | XMcdma_SetAWCache(InstancePtr, Value)
| This function 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 | 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...

## Enumerations
enum | XMcdma_Handler { XMCDMA_TX_HANDLER_DONE, XMCDMA_TX_HANDLER_ERROR, XMCDMA_HANDLER_DONE, XMCDMA_HANDLER_ERROR, XMCDMA_HANDLER_PKTDROP }
enum | XMcdma_ChanHandler { XMCDMA_CHAN_HANDLER_DONE, XMCDMA_CHAN_HANDLER_ERROR, XMCDMA_CHAN_HANDLER_PKTDROP }

## Functions
s32 | XMcDma_CfgInitialize (XMcdma *InstancePtr, XMcdma_Config *CfgPtr)
| This function initializes an MCDMA core. More...
s32 | XMcDma_Initialize (XMcdma *InstancePtr, XMcdma_Config *CfgPtr)
| This function initializes an MCDMA core. More...
void | XMcDma_Reset (XMcdma *InstancePtr)
| This function resets the MCDMA core. More...
void | XMcdma_SetSGAWCache (XMcdma *InstancePtr, u8 Value)
| This function sets the AWCACHE field of the SG interface With the user specified value. More...
void | XMcdma_SetSGARCache (XMcdma *InstancePtr, u8 Value)
| This function 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...
void | XMcdma_DumpChanRegs (XMcdma_ChanCtrl *Chan)
| Dump the registers for a 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, This function creates and setup the BD Chain for the MCDMA Channel. More...
u32 | XMcDma_ChanSubmit (XMcdma_ChanCtrl *Chan, UINTPTR BufAddr, u32 len)
| This function 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)
| This function populates the BD Chain with the required buffer address, length APP(user application), TUSER and TID fields. More...
u32 | XMcDma_ChanToHw (XMcdma_ChanCtrl *Chan)
| This function triggers/Starts the h/w 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...
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...
u32 | XMcdma_SetChanCoalesceDelay (XMcdma_ChanCtrl *Chan, u32 IrqCoalesce, u32 IrqDelay)
| Set interrupt coalescing parameters for a particular channel. More...
void | XMcDma_DumpBd (XMcdma_Bd *BdPtr)
| Dump the fields of a BD. More...
void | XMcdma_ChanIntrHandler (void *Instance)
| This function is the Per Channel interrupt handler 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...
void | XMcdma_IntrHandler (void *Instance)
| This function is the S2MM(RX) interrupt handler for the MCDMA core. More...
void | XMcdma_TxIntrHandler (void *Instance)
| This function is the MM2S interrupt handler 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...
s32 | XMcdma_SelfTest (XMcdma *InstancePtr)
| This file contains a diagnostic self-test function for the MCDMA driver. More...
XMcdma_Config * | XMcdma_LookupConfig (u16 DeviceId)
| XMcdma_LookupConfig returns a reference to an XMcdma_Config structure based on the unique device id, DeviceId. More...
XMcdma_Config * | XMcdma_LookupConfigBaseAddr (UINTPTR Baseaddr)
| XMcdma_LookupConfigBaseAddr returns a reference to an XMcdma_Config structure based on base address. More...

## Macro Definition Documentation

#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

  Chan | is the Channel BD Chain to operate on.
  BdPtr | is 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))

Return the previous BD in the Chain.

Parameters

  Chan | is the MCDMA channel to operate on.
  BdPtr | is 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, \
XMCDMA_BD_BYTES_TO_CLEAR)

Clears the BD Contents.

Parameters

  BdPtr | is 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:
(XMcdma_BdRead((BdPtr), XMCDMA_BD_STS_OFFSET) & \
LengthMask)
XMcdma_BdRead
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:66

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

The BD has completed in hw.

This function may not work if the BD is in cached memory.

Parameters

  BdPtr | is the BD to check on
  LengthMask | is the Maximum Transfer Length.

Returns
  None

Note
  C-style signature: int XMcDma_BdGetActualLength(XMcdma_Bd* BdPtr, u32 LengthMask)

#define XMcDma_BdGetCtrl | ( |  | BdPtr | ) |

Value:
(XMcdma_BdRead((BdPtr), XMCDMA_BD_CTRL_OFFSET) \
& XMCDMA_BD_CTRL_ALL_MASK)
XMcdma_BdRead
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:66

Gets the control bits of a BD.

Parameters

  BdPtr | is 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

  BdPtr | is 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

  BdPtr | is the BD to operate on

Returns
  BD Sw identifier

Note
  C-style signature: u32 XMcdma_BdGetSwId(XMcdma_Bd* BdPtr)

#define XMcdma_BdHwCompleted | ( |  | BdPtr | ) |

Value:
(XMcdma_BdRead((BdPtr), XMCDMA_BD_STS_OFFSET) & \
XMCDMA_BD_STS_COMPLETE_MASK)
XMcdma_BdRead
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:66

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.

This function may not work if the BD is in cached memory.

Parameters

  BdPtr | is 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

  BaseAddress | is the base address of the BD to read
  Offset | is 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

  BaseAddress | is the base address of the BD to read
  Offset | is 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:
XMcdma_BdWrite((BdPtr), XMCDMA_BD_CTRL_SBAND_OFFSET, \
Tid << XMCDMA_BD_CTRL_SBAND_SHIFT | Tuser)
XMcdma_BdWrite
#define XMcdma_BdWrite(BaseAddress, Offset, Data)
Write the given Buffer Descriptor word.
Definition: xmcdma_bd.h:103

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

Parameters

  BdPtr | is the BD to operate on.
  Tid | is Tid value to be written in the Bd field.
  Tuser | is 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

  BdPtr | is the BD to operate on
  Id | is a 32 bit quantity to set in the BD

Returns
  None

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

  BaseAddress | is the base address of the BD to write
  Offset | is the word offset to be written
  Data | is the 32-bit value to write to the field

Returns
  None.

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

  BaseAddress | is the base address of the BD to write
  Offset | is the word offset to be written
  Data | is the 64-bit value to write to the field

Returns
  None.

Note
  C-style signature: void XMcdma_BdWrite(u64 BaseAddress, u32 RegOffset, u64 Data)

Referenced by XMcdma_BdSetBufAddr().

#define XMcdma_ChanAckIrq | ( |  | Chan,
|  |  | Mask
| ) |  |

Value:
XMcdma_WriteReg((Chan)->ChanBase, \
((Chan->Chan_id - 1) * XMCDMA_NXTCHAN_OFFSET + XMCDMA_SR_OFFSET) ,\
(Mask) & XMCDMA_IRQ_ALL_MASK)

This function acknowledges the interrupts that are specified in Mask.

Parameters

  Chan | is the MCDMA Channel to Operate on.
  Mask | is the mask for the interrupts to be acknowledge

Returns
  None

Note
  None.

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 + \
XMCDMA_SR_OFFSET)) & XMCDMA_IRQ_ALL_MASK)

This function gets the interrupts that are asserted.

Parameters

  Chan | is the MCDMA Channel to Operate on.

Returns
  The bit mask for the interrupts asserted.

Note
  None

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)

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

Parameters

  Chan | is the channel instance to operate on.
  Chan_id | is 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_DisableCh | ( |  | Chan,
|  |  | ChanId
| ) |  |

Value:
(XMcdma_WriteReg(Chan->ChanBase,(XMCDMA_CHEN_OFFSET), \
XMcdma_ReadReg((Chan)->ChanBase, XMCDMA_CHEN_OFFSET) & \
~(ChanId & XMCDMA_CHEN_MASK)))

Disable Particular Channel in the MCDMA Core.

Parameters

  Chan | is the MCDMA Channel to be worked on.
  ChanId | is the channel to disable.

Note
  C-style signature: XMcdma_DisableCh(XMcdma_ChanCtrl *Chan, u32 ChanId)

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

Retrieve the side band status of a BD.

Parameters

  BdPtr | is 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

  Chan | is 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)

This functions gives the Buffer descriptor count processed by the h/w.

Parameters

  Chan | is 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

  Chan | is 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 + \
XMCDMA_PKTDROP_OFFSET))

Get Packet drop Count for the particular Channel.

Parameters

  Chan | is the MCDMA Channel to be worked on.
  ChanId | is 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) + \
XMCDMA_CHOBS1_OFFSET))

Get Egress Channel Observer contents.

Parameters

  InstancePtr | is the driver instance we are working on.
  ObsId | is 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) + \
XMCDMA_RX_OFFSET + XMCDMA_CHOBS1_OFFSET))

Get Ingress Channel Observer contents.

Parameters

  InstancePtr | is the driver instance we are working on.
  ObsId | is 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

  InstancePtr | is a pointer to the DMA engine instance to be worked on.
  ChanId | is 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

  InstancePtr | is a pointer to the DMA engine instance to be worked on.
  ChanId | is 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

  Chan | is 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)

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

Parameters

  Chan | is 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_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) * \
XMCDMA_NXTCHAN_OFFSET + XMCDMA_CR_OFFSET) & \
~((Mask) & XMCDMA_IRQ_ALL_MASK)))

This function disables interrupts specified by the Mask.

Interrupts that are not in the mask are not affected.

Parameters

  Chan | is the MCDMA Channel to be worked on.
  Mask | is the mask for the interrupts to be disabled

Returns
  None

Note
  None

#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) * \
XMCDMA_NXTCHAN_OFFSET + XMCDMA_CR_OFFSET) | \
((Mask) & XMCDMA_IRQ_ALL_MASK)))

This function enables interrupts specified by the Mask in specified direction, Interrupts that are not in the mask are not affected.

Parameters

  Chan | is the MCDMA Channel to be worked on.
  Mask | is the mask for the interrupts to be enabled

Returns
  None

Note
  None

#define XMcdma_isidle | ( |  | Chan | ) |

Value:
(XMcdma_ReadReg(Chan->ChanBase, XMCDMA_SR_OFFSET) & \
XMCDMA_SR_IDLE_MASK)

This function checks whether DMA is Idle or not.

Parameters

  Chan | is the MCDMA Channel to be worked on.

Returns
  - TRUE if MCDMA is idle
  - FALSE if MCDMA is not idle

Note
  None

#define XMcdma_SetARCache | ( |  | InstancePtr,
|  |  | Value
| ) |  |

Value:
XMcdma_WriteReg(InstancePtr->Config.BaseAddress, \
XMCDMA_TXAXCACHE_OFFSET, \
(Value) & XMCDMA_AXCACHE_MASK)

This function sets the ARCACHE field with the user specified value.

Parameters

  InstancePtr | is the driver instance we are working on
  Value | is the ARCACHE value to be written.

Returns
  None

Note
  None.

Referenced by XMcDma_CfgInitialize().

#define XMcdma_SetAWCache | ( |  | InstancePtr,
|  |  | Value
| ) |  |

Value:
XMcdma_WriteReg(InstancePtr->Config.BaseAddress, \
XMCDMA_RXAXCACHE_OFFSET + XMCDMA_RX_OFFSET, \
(Value) & XMCDMA_AXCACHE_MASK)

This function sets the AWCACHE field with the user specified value.

Parameters

  InstancePtr | is the driver instance we are working on
  Value | is the AWCACHE value to be written.

Returns
  None

Note
  None.

Referenced by XMcDma_CfgInitialize().

#define XMcDma_TxBdGetActualLength | ( |  | BdPtr,
|  |  | LengthMask
| ) |  |

Value:
(XMcdma_BdRead((BdPtr), XMCDMA_BD_SIDEBAND_STS_OFFSET) & \
LengthMask)
XMcdma_BdRead
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:66

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

The BD has completed in hw.

This function may not work if the BD is in cached memory.

Parameters

  BdPtr | is the BD to check on
  LengthMask | is the Maximum Transfer Length.

Returns
  None

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

  BdPtr | is 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:
(XMcdma_BdRead((BdPtr), XMCDMA_BD_SIDEBAND_STS_OFFSET) & \
XMCDMA_BD_STS_COMPLETE_MASK)
XMcdma_BdRead
#define XMcdma_BdRead(BaseAddress, Offset)
Read the given Buffer Descriptor word.
Definition: xmcdma_bd.h:66

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.

This function may not work if the BD is in cached memory.

Parameters

  BdPtr | is 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)

## Enumeration Type Documentation

enum XMcdma_ChanHandler

Enumerator
XMCDMA_CHAN_HANDLER_DONE | For Done Handler.
XMCDMA_CHAN_HANDLER_ERROR | For Error Handler.
XMCDMA_CHAN_HANDLER_PKTDROP | For Error Handler.

enum XMcdma_Handler

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.

## Function Documentation

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

  Chan | is the MCDMA Channel to be worked on..
  BdCount | is the number of BDs to free.
  BdSetPtr | is 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_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

  Chan | is the MCDMA Channel to be worked on..
  BdLimit | is the maximum number of BDs to return in the set.
  BdSetPtr | is 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_BdChainNextBd, and XMcdma_BdRead.

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

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

Parameters

  BdPtr | is the BD to operate on.
  Offset | is the offset inside the APP word, it is valid from 0 to 4
  Valid | is 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_BdRead.

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

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

Parameters

  BdPtr | is the BD to operate on
  Offset | is the offset inside the APP word, it is valid from 0 to 4
  Word | is 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_BdRead, and XMcdma_BdWrite.

u32 XMcdma_BdSetBufAddr | ( | XMcdma_Bd * | BdPtr,
|  | UINTPTR | Addr
| ) |  |

Set the Buffer descriptor buffer address field.

Parameters

  BdPtr | is the BD to operate on
  Addr | is 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_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

  BdPtr | is the BD to operate on.
  Data | is the bit value to set

Returns
  None

Note
  None

References XMcdma_BdRead, and XMcdma_BdWrite.

s32 XMcDma_CfgInitialize | ( | XMcdma * | InstancePtr,
|  | XMcdma_Config * | CfgPtr
| ) |  |

This function initializes an MCDMA core.

This function must be called prior to using an MCDMA core. Initialization of an MCDMA includes setting up the instance data and ensuring the hardware is in a quiescent state and resets all the hardware configurations.

Parameters

  InstancePtr | is a pointer to the XMcdma instance.
  CfgPtr | is a reference to a structure containing information about a specific XMcdma instance.

Returns
  - XST_SUCCESS if initialization was successful.

Note
  None.

References XMcDma_Initialize(), 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
| ) |  |

This function 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

  ChanPtr | is the MCDMA Channel to be worked on..
  BufAddr | is the buffer address to which data should send/recv.
  Len | is the Amount of data user requested to send/recv.
  AppPtr | is the point to APP fields.
  Tuser | is the value presented on the beat that has TLAST.
  Tid | is 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_BdChainNextBd, XMcdma_BdClear, XMcdma_BdSetBufAddr(), XMcDma_BdSetCtrlSideBand, and XMcdma_BdWrite.

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

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

Parameters

  Chan | is the MCDMA Channel to be worked on..
  Addr | is the address of the application memory region.
  Count | is 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_BdWrite.

u32 XMcdma_ChanHwStop | ( | XMcdma_ChanCtrl * | Chan | ) |

Stops the DMA engine.

Parameters

  Chan | is the Channel instance to be worked on

Returns
  - XST_SUCCESS for success.
  - XST_FAILURE if hardware fails stop.

Note
  None

void XMcdma_ChanIntrHandler | ( | void * | Instance | ) |

This function is the Per Channel interrupt handler 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

  Instance | is a pointer to the Channel instance to be worked on.

Returns
  None.

Note
  To generate interrupt required interrupts should be enabled.

References XMcdma_ChanAckIrq, and XMcdma_ChanGetIrq.

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

  Chan | is the Channel instance to be worked on
  HandlerType | specifies which callback is to be attached.
  CallBackFunc | is the address of the callback function.
  CallBackRef | is 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_CHAN_HANDLER_DONE, and XMCDMA_CHAN_HANDLER_ERROR.

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

This function 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

  Chan | is the MCDMA Channel to be worked on..
  BufAddr | is the buffer address to which data should send/recv.
  len | is 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_BdChainNextBd, XMcdma_BdClear, XMcdma_BdSetBufAddr(), and XMcdma_BdWrite.

u32 XMcDma_ChanToHw | ( | XMcdma_ChanCtrl * | Chan | ) |

This function triggers/Starts the h/w by programming the Current and Tail Descriptors and enabling the particular channel.

Parameters

  Chan | is 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_DumpBd | ( | XMcdma_Bd * | BdPtr | ) |

Dump the fields of a BD.

Parameters

  BdPtr | is the BD to operate on.

Returns
  None

References XMcdma_BdRead.

void XMcdma_DumpChanRegs | ( | XMcdma_ChanCtrl * | Chan | ) |

Dump the registers for a channel.

Parameters

  Chan | is the MCDMA Channel to be worked on.

Returns
  None

void XMcdma_EnableCh | ( | XMcdma_ChanCtrl * | Chan | ) |

Enables a particular channel.

Parameters

  Chan | is the Channel instance to be worked on

Returns
  none

Note
  None

Referenced by XMcDma_ChanToHw().

u16 XMcdma_GetChanServiced | ( | XMcdma * | InstancePtr | ) |

Gets the last serviced s2mm channel number.

Parameters

  InstancePtr | is a pointer to the DMA engine instance to be worked on.

Returns
  - Channel id that last serviced.

Note
  None

u16 XMcdma_GetTxChanServiced | ( | XMcdma * | InstancePtr | ) |

Gets the last serviced mm2s channel number.

Parameters

  InstancePtr | is a pointer to the DMA engine instance to be worked on.

Returns
  - Channel id that last serviced.

Note
  None

s32 XMcDma_Initialize | ( | XMcdma * | InstancePtr,
|  | XMcdma_Config * | CfgPtr
| ) |  |

This function initializes an MCDMA core.

This function must be called prior to using an MCDMA core. Initialization of an MCDMA includes setting up the instance data and updating the driver filed with a proper values.

Parameters

  InstancePtr | is a pointer to the XMcdma instance.
  CfgPtr | is 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.

Referenced by XMcDma_CfgInitialize().

void XMcdma_IntrHandler | ( | void * | Instance | ) |

This function is the S2MM(RX) interrupt handler 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

  Instance | is a pointer to the XMcdma instance to be worked on.

Returns
  None.

Note
  To generate interrupt required interrupts should be enabled.

References XMcdma_ChanAckIrq, XMcdma_ChanGetIrq, and XMcdma_GetMcdmaRxChan.

XMcdma_Config* XMcdma_LookupConfig | ( | u16 | DeviceId | ) |

XMcdma_LookupConfig returns a reference to an XMcdma_Config structure based on the unique device id, DeviceId.

The return value will refer to an entry in the device configuration table defined in the xmcdma_g.c file.

Parameters

  DeviceId | is the unique device ID of the device for the lookup operation.

Returns
  CfgPtr is a reference to a config record in the configuration table (in xmcdma_g.c) corresponding to DeviceId, or NULL if no match is found.

Note
  None.

Referenced by main().

XMcdma_Config* XMcdma_LookupConfigBaseAddr | ( | UINTPTR | Baseaddr | ) |

XMcdma_LookupConfigBaseAddr returns a reference to an XMcdma_Config structure based on base address.

The return value will refer to an entry in the device configuration table defined in the xmcdma_g.c file.

Parameters

  Baseaddr | is the base address of the device to lookup for

Returns
  CfgPtr is a reference to a config record in the configuration table (in xmcdma_g.c) corresponding to Baseaddr, or NULL if no match is found.

Note
  None.

void XMcDma_Reset | ( | XMcdma * | InstancePtr | ) |

This function resets the MCDMA core.

Parameters

  InstancePtr | is a pointer to the XMcdma instance.

Returns
  None.

Note
  This function resets all the configurations made previously.

Referenced by XMcDma_CfgInitialize(), and XMcdma_SelfTest().

u32 XMcdma_ResetIsDone | ( | XMcdma * | InstancePtr | ) |

Check whether reset is done.

Parameters

  InstancePtr | is a pointer to the DMA engine instance to be worked on.

Returns
  - 1 if reset is done.

- 0 if reset is not done

Note
  None

References XMcdma_GetMcdmaRxChan, and XMcdma_GetMcdmaTxChan.

Referenced by XMcDma_CfgInitialize(), and XMcdma_SelfTest().

s32 XMcdma_SelfTest | ( | XMcdma * | InstancePtr | ) |

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

Refer to the header file xmcdma.h for more detailed information.

Parameters

  InstancePtr | is a pointer to XMcDma instance.

Returns
  - XST_SUCCESS if the test is successful.
  - XST_FAILURE if the test is failed.

Note
  None.

References 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

  InstancePtr | is a pointer to the XMcdma instance to be worked on.
  HandlerType | specifies which callback is to be attached.
  CallBackFunc | is the address of the callback function.
  CallBackRef | is 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_HANDLER_DONE, XMCDMA_HANDLER_ERROR, XMCDMA_HANDLER_PKTDROP, XMCDMA_TX_HANDLER_DONE, and XMCDMA_TX_HANDLER_ERROR.

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

Set interrupt coalescing parameters for a particular channel.

Parameters

  Chan | is the MCDMA Channel to be worked on..
  IrqCoalesce | is the Irq Threshold value valid ranges are 1 to 255
  IrqDelay | is 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

void XMcdma_SetSGARCache | ( | XMcdma * | InstancePtr,
|  | u8 | Value
| ) |  |

This function sets the ARCACHE field of the SG interface With the user specified value.

Parameters

  InstancePtr | is the driver instance we are working on
  Value | is the ARCACHE value to be written.

Returns
  None

Note
  None.

void XMcdma_SetSGAWCache | ( | XMcdma * | InstancePtr,
|  | u8 | Value
| ) |  |

This function sets the AWCACHE field of the SG interface With the user specified value.

Parameters

  InstancePtr | is the driver instance we are working on
  Value | is the AWCACHE value to be written.

Returns
  None

Note
  None.

u32 XMcdma_Start | ( | XMcdma_ChanCtrl * | Chan | ) |

Start the DMA engine.

Parameters

  Chan | is the Channel instance to be worked on

Returns
  - XST_SUCCESS for success.
  - XST_FAILURE if starting the hardware fails.

Note
  None

Referenced by XMcdma_UpdateChanTDesc().

void XMcdma_TxIntrHandler | ( | void * | Instance | ) |

This function is the MM2S interrupt handler 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

  Instance | is a pointer to the XMcdma instance to be worked on.

Returns
  None.

Note
  To generate interrupt required interrupts should be enabled.

References XMcdma_ChanAckIrq, XMcdma_ChanGetIrq, and XMcdma_GetMcdmaTxChan.

int XMcdma_UpdateChanCDesc | ( | XMcdma_ChanCtrl * | Chan | ) |

Update Current Descriptor for the MCDMA Channel.

Parameters

  Chan | is the Channel instance to be worked on

Returns
  - XST_SUCCESS upon success

Note
  None.

Referenced by XMcDma_ChanToHw().

int XMcdma_UpdateChanTDesc | ( | XMcdma_ChanCtrl * | Chan | ) |

Update Tail Desc for the Channel.

Parameters

  Chan | is the MCDMA Channel to be worked on.

Returns
  - XST_SUCCESS upon success
  - XST_DMA_ERROR if no valid BD available to put into current BD register

References XMcdma_ChanHwIsStarted, XMcdma_HwIsStarted, and XMcdma_Start().

Referenced by XMcDma_ChanToHw().