uartpsv
Vitis Drivers API Documentation
xuartpsv_intr_example.c File Reference

Overview

This example runs on versal evaluation board (vck190), it sends data and expects to receive the same data through the device using the local loopback mode in interrupt mode by using XUartPsv driver.

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 ms 11/30/17 First Release 1.1 sd 07/11/19 Remove the hardcoded interrupt id. 1.2 rna 01/20/20 Add selftest, while loop for waiting

Functions

int UartPsvIntrExample (INTC *IntcInstPtr, XUartPsv *UartInstPtr, u16 DeviceId, u16 UartIntrId)
 This function does a minimal test on the UartPsv device and driver as a design example. More...
 
void Handler (void *CallBackRef, u32 Event, unsigned int EventData)
 This function is the handler which performs processing to handle data events from the device. More...
 
int main (void)
 Main function to call the Uart interrupt example. More...
 

Function Documentation

void Handler ( void *  CallBackRef,
u32  Event,
unsigned int  EventData 
)

This function is the handler which performs processing to handle data events from the device.

It is called from an interrupt context. so the amount of processing should be minimal.

This handler provides an example of how to handle data for the device and is application specific.

Parameters
CallBackRefcontains a callback reference from the driver, in this case it is the instance pointer for the XUARTPSV driver.
Eventcontains the specific kind of event that has occurred.
EventDatacontains the number of bytes sent or received for sent and receive events.
Returns
None.
Note
None.

References XUARTPSV_EVENT_PARE_FRAME_BRKE, XUARTPSV_EVENT_RECV_DATA, XUARTPSV_EVENT_RECV_ERROR, XUARTPSV_EVENT_RECV_ORERR, XUARTPSV_EVENT_RECV_TOUT, and XUARTPSV_EVENT_SENT_DATA.

Referenced by UartPsvIntrExample().

int main ( void  )

Main function to call the Uart interrupt example.

Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful
Note
None

References UartPsvIntrExample().

int UartPsvIntrExample ( INTC *  IntcInstPtr,
XUartPsv UartInstPtr,
u16  DeviceId,
u16  UartIntrId 
)

This function does a minimal test on the UartPsv device and driver as a design example.

The purpose of this function is to illustrate how to use the XUartPsv driver.

This function sends data and expects to receive the same data through the device using the local loopback mode.

This function uses interrupt mode of the device.

Parameters
IntcInstPtris a pointer to the instance of the Scu Gic driver.
UartInstPtris a pointer to the instance of the UART driver which is going to be connected to the interrupt controller.
DeviceIdis the device Id of the UART device and is typically XPAR_<UartPsv_instance>_DEVICE_ID value from xparameters.h.
UartIntrIdis the interrupt Id and is typically XPAR_<UartPsv_instance>_INTR value from xparameters.h.
Returns
XST_SUCCESS if successful, otherwise XST_FAILURE.
Note

This function contains an infinite loop such that if interrupts are not working it may never return.

References XUartPsv_Config::BaseAddress, Handler(), XUartPsv_CfgInitialize(), XUartPsv_InterruptHandler(), XUartPsv_LookupConfig(), XUARTPSV_OPER_MODE_LOCAL_LOOP, XUARTPSV_OPER_MODE_NORMAL, XUartPsv_Recv(), XUartPsv_SelfTest(), XUartPsv_Send(), XUartPsv_SetHandler(), XUartPsv_SetInterruptMask(), XUartPsv_SetOperMode(), XUartPsv_SetRxFifoThreshold(), XUartPsv_SetTxFifoThreshold(), XUARTPSV_UARTIFLS_RXIFLSEL_1_4, XUARTPSV_UARTIFLS_TXIFLSEL_1_2, XUARTPSV_UARTIMSC_BEIM, XUARTPSV_UARTIMSC_FEIM, XUARTPSV_UARTIMSC_OEIM, XUARTPSV_UARTIMSC_PEIM, XUARTPSV_UARTIMSC_RTIM, XUARTPSV_UARTIMSC_RXIM, and XUARTPSV_UARTIMSC_TXIM.

Referenced by main().