csudma
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
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.

#include "xcsudma.h"
#include "xparameters.h"
#include "xil_exception.h"
#include "xinterrupt_wrap.h"

Macros

#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 transferred. More...
 

Functions

int XCsuDma_IntrExample (XCsuDma *CsuDmaInstance, UINTPTR BaseAddress)
 This function performs data transfer in loop back mode in interrupt mode and verify the data. More...
 
void IntrHandler (void *CallBackRef)
 This function sets up the interrupt system so interrupts can occur for the CSU DMA. More...
 
int main (void)
 Main function to call the example. More...
 

Variables

u32 DstBuf [SIZE]
 Destination buffer. More...
 
u32 SrcBuf [SIZE]
 Source buffer. More...
 
XCsuDma CsuDma
 Instance of the Csu_Dma Device. More...
 

Macro Definition Documentation

#define CSU_SSS_CONFIG_OFFSET   0x008

CSU SSS_CFG Offset.

#define CSUDMA_LOOPBACK_CFG   0x00000050

LOOP BACK configuration macro.

#define PMC_SSS_CONFIG_OFFSET   0x500

CSU SSS_CFG Offset.

#define PMCDMA0_LOOPBACK_CFG   0x0000000D

LOOP BACK configuration macro for PMCDMA0.

#define PMCDMA1_LOOPBACK_CFG   0x00000090

LOOP BACK configuration macro for PMCDMA1.

#define SIZE   0x100

Size of the data to be transferred.

Function Documentation

void IntrHandler ( void *  CallBackRef)

This function sets up the interrupt system so interrupts can occur for the CSU DMA.

This function is application-specific. The user should modify this function to fit the application.

Parameters
IntcInstancePtris a pointer to the instance of the INTC.
InstancePtrcontains a pointer to the instance of the CSU DMA driver which is going to be connected to the interrupt controller.
IntrIdis the interrupt Id and is typically XPAR_<CSUDMA_instance>_INTR value from xparameters.h.
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if failed
Note
None.

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.
int main ( void  )

Main function to call the example.

Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.
int XCsuDma_IntrExample ( XCsuDma CsuDmaInstance,
UINTPTR  BaseAddress 
)

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

Parameters
CsuDmaInstancecontains a pointer to the CSU DMA instance which is going to be connected to the interrupt controller.
BaseAddresscontains the base address of the CsuDma device
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if failed.
Note
None.

Variable Documentation

XCsuDma CsuDma

Instance of the Csu_Dma Device.

u32 DstBuf[SIZE]

Destination buffer.

u32 SrcBuf[SIZE]

Source buffer.