csudma
Vitis Drivers API Documentation
xcsudma_intr_example.c File Reference

Overview

This file contains a design example using the XCsuDma driver in interrupt mode.

It sends data and expects to receive the same data through the device using the local loop back mode.

Note
The example contains an infinite loop such that if interrupts are not working it may hang.
MODIFICATION HISTORY:
Ver   Who     Date     Changes


1.0 vnsld 22/10/14 First release 1.2 adk 11/22/17 Added peripheral test app support. 1.4 adk 04/12/17 Added support for PMC DMA. adk 11/01/18 Declared static array rather than hard code memory for buffers. adk 18/01/18 Remove unnecessary column in XIntc_Connect() API. 1.5 adk 09/05/19 Added volatile keyword for DstDone variable to disable optimizations. 1.6 hk 11/18/19 Correct Versal INTR definition. 1.9 sk 12/23/20 Add the documentation for XCsuDma_IntrExample() function parameters to fix the doxygen warning. 1.11 sk 12/20/21 Add interrupt device id support for A78 and R52 processors. 1.14 adk 05/04/23 Added support for system device-tree flow.

Macros

#define INTG_CSUDMA_INTR_DEVICE_ID   XPAR_XCSUDMA_INTR
 Interrupt device ID of CSU DMA device ID. More...
 
#define CSU_SSS_CONFIG_OFFSET   0x008
 CSU SSS_CFG Offset. More...
 
#define CSUDMA_LOOPBACK_CFG   0x00000050
 LOOP BACK configuration macro. More...
 
#define PMC_SSS_CONFIG_OFFSET   0x500
 CSU SSS_CFG Offset. More...
 
#define PMCDMA0_LOOPBACK_CFG   0x0000000D
 LOOP BACK configuration macro for PMCDMA0. More...
 
#define PMCDMA1_LOOPBACK_CFG   0x00000090
 LOOP BACK configuration macro for PMCDMA1. More...
 
#define SIZE   0x100
 Size of the data to be transfered. More...
 

Functions

u32 DstBuf[SIZE__attribute__ ((aligned(64)))
 Destination buffer. More...
 
int XCsuDma_IntrExample (INTC *IntcInstancePtr, XCsuDma *CsuDmaInstance, u16 DeviceId, u16 IntrId)
 This function performs data transfer in loop back mode in interrupt mode and verify the data. More...
 
void IntrHandler (void *CallBackRef)
 This function is the interrupt handler for the CSU_DMA driver. More...
 
int main (void)
 Main function to call the example. More...
 

Variables

XCsuDma CsuDma
 Instance of the Csu_Dma Device. More...
 

Macro Definition Documentation

#define CSU_SSS_CONFIG_OFFSET   0x008

CSU SSS_CFG Offset.

Referenced by XCsuDma_IntrExample().

#define CSUDMA_LOOPBACK_CFG   0x00000050

LOOP BACK configuration macro.

Referenced by XCsuDma_IntrExample().

#define INTG_CSUDMA_INTR_DEVICE_ID   XPAR_XCSUDMA_INTR

Interrupt device ID of CSU DMA device ID.

#define PMC_SSS_CONFIG_OFFSET   0x500

CSU SSS_CFG Offset.

Referenced by XCsuDma_IntrExample().

#define PMCDMA0_LOOPBACK_CFG   0x0000000D

LOOP BACK configuration macro for PMCDMA0.

Referenced by XCsuDma_IntrExample().

#define PMCDMA1_LOOPBACK_CFG   0x00000090

LOOP BACK configuration macro for PMCDMA1.

Referenced by XCsuDma_IntrExample().

#define SIZE   0x100

Size of the data to be transfered.

Referenced by XCsuDma_IntrExample().

Function Documentation

u32 DstBuf [SIZE] __attribute__ ( (aligned(64))  )

Destination buffer.

Source buffer.

void IntrHandler ( void *  CallBackRef)

This function is the interrupt handler for the CSU_DMA driver.

This handler reads the interrupt status from the Status register, determines the source of the interrupts, calls according callbacks, and finally clears the interrupts.

Parameters
CallBackRefis the callback reference passed from the interrupt handler, which in our case is a pointer to the driver instance.
Returns
None.
Note
None.

Referenced by XCsuDma_IntrExample().

int main ( void  )

Main function to call the example.

Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.
int XCsuDma_IntrExample ( INTC *  IntcInstancePtr,
XCsuDma CsuDmaInstance,
u16  DeviceId,
u16  IntrId 
)

This function performs data transfer in loop back mode in interrupt mode and verify the data.

Parameters
IntcInstancePtris a pointer to the instance of the INTC.
CsuDmaInstancecontains a pointer to the CSU DMA instance which is going to be connected to the interrupt controller.
DeviceIdis the XPAR_<CSUDMA Instance>_DEVICE_ID macro value.
IntrIdis the interrupt Id and is typically XPAR_<CSUDMA_instance>_INTR macro value.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.

References XCsuDma_Config::BaseAddress, XCsuDma::Config, CSU_SSS_CONFIG_OFFSET, CSUDMA_LOOPBACK_CFG, XCsuDma_Config::DmaType, IntrHandler(), PMC_SSS_CONFIG_OFFSET, PMCDMA0_LOOPBACK_CFG, PMCDMA1_LOOPBACK_CFG, SIZE, XCsuDma_CfgInitialize(), XCsuDma_DisableIntr(), XCSUDMA_DMATYPEIS_CSUDMA, XCSUDMA_DMATYPEIS_PMCDMA0, XCSUDMA_DST_CHANNEL, XCsuDma_EnableIntr(), XCsuDma_IntrClear(), XCSUDMA_IXR_DONE_MASK, XCsuDma_LookupConfig(), XCsuDma_SelfTest(), XCSUDMA_SRC_CHANNEL, and XCsuDma_Transfer().

Variable Documentation

XCsuDma CsuDma

Instance of the Csu_Dma Device.