![]() |
uartps
Vitis Drivers API Documentation
|
This example runs on zynqmp evaluation board (zcu102), it sends data and expects to receive the same data through the device using the local loopback mode in interrupt mode by using XUartPs driver.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00a drg/jz 01/13/10 First Release 1.00a sdm 05/25/11 Modified the example for supporting Peripheral tests in SDK 1.03a sg 07/16/12 Updated the example for CR 666306. Modified the device ID to use the first Device Id and increased the receive timeout to 8 Removed the printf at the start of the main Put the device normal mode at the end of the example 3.1 kvn 04/10/15 Added code to support Zynq Ultrascale+ MP. 3.1 mus 01/14/16 Added support for intc interrupt controller 3.8 adk 10/05/19 Don't update the DeviceId variable in peripheral test app case. 3.12 gm 09/26/22 Corrected SetRecvTimeout description details.
Functions | |
int | UartPsIntrExample (INTC *IntcInstPtr, XUartPs *UartInstPtr, u16 DeviceId, u16 UartIntrId) |
This function does a minimal test on the UartPS 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... | |
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.
CallBackRef | contains a callback reference from the driver, in this case it is the instance pointer for the XUartPs driver. |
Event | contains the specific kind of event that has occurred. |
EventData | contains the number of bytes sent or received for sent and receive events. |
int main | ( | void | ) |
Main function to call the Uart interrupt example.
References UartPsIntrExample().
int UartPsIntrExample | ( | INTC * | IntcInstPtr, |
XUartPs * | UartInstPtr, | ||
u16 | DeviceId, | ||
u16 | UartIntrId | ||
) |
This function does a minimal test on the UartPS device and driver as a design example.
The purpose of this function is to illustrate how to use the XUartPs 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.
IntcInstPtr | is a pointer to the instance of the Scu Gic driver. |
UartInstPtr | is a pointer to the instance of the UART driver which is going to be connected to the interrupt controller. |
DeviceId | is the device Id of the UART device and is typically XPAR_<UARTPS_instance>_DEVICE_ID value from xparameters.h. |
UartIntrId | is the interrupt Id and is typically XPAR_<UARTPS_instance>_INTR value from xparameters.h. |
This function contains an infinite loop such that if interrupts are not working it may never return.
References XUartPs_Config::BaseAddress, XUartPs_CfgInitialize(), XUartPs_InterruptHandler(), XUARTPS_IXR_FRAMING, XUARTPS_IXR_OVER, XUARTPS_IXR_PARITY, XUARTPS_IXR_RBRK, XUARTPS_IXR_RXFULL, XUARTPS_IXR_RXOVR, XUARTPS_IXR_TOUT, XUARTPS_IXR_TXEMPTY, XUartPs_LookupConfig(), XUARTPS_OPER_MODE_LOCAL_LOOP, XUARTPS_OPER_MODE_NORMAL, XUartPs_Recv(), XUartPs_SelfTest(), XUartPs_Send(), XUartPs_SetHandler(), XUartPs_SetInterruptMask(), XUartPs_SetOperMode(), and XUartPs_SetRecvTimeout().
Referenced by main().