![]() |
uartlite
Xilinx SDK Drivers API Documentation
|
This file contains a design example using the UartLite driver (XUartLite) and hardware device using the interrupt mode.
The user must provide a physical loopback such that data which is transmitted will be received.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00a jhl 02/13/02 First release 1.00b rpm 10/01/03 Made XIntc declaration global 1.00b sv 06/09/05 Minor changes to comply to Doxygen and coding guidelines 2.00a ktn 10/20/09 Updated to use HAL Processor APIs and minor changes for coding guidelnes. 3.2 ms 01/23/17 Added xil_printf statement in main function to ensure that "Successfully ran" and "Failed" strings are available in all examples. This is a fix for CR-965028.
Functions | |
int | UartLiteIntrExample (u16 DeviceId) |
This function does a minimal test on the UartLite device and driver as a design example. More... | |
int | SetupInterruptSystem (XUartLite *UartLitePtr) |
This function setups the interrupt system such that interrupts can occur for the UartLite device. More... | |
void | SendHandler (void *CallBackRef, unsigned int EventData) |
This function is the handler which performs processing to send data to the UartLite. More... | |
void | RecvHandler (void *CallBackRef, unsigned int EventData) |
This function is the handler which performs processing to receive data from the UartLite. More... | |
int | main (void) |
Main function to call the UartLite interrupt example. More... | |
int main | ( | void | ) |
Main function to call the UartLite interrupt example.
None |
References UartLiteIntrExample().
void RecvHandler | ( | void * | CallBackRef, |
unsigned int | EventData | ||
) |
This function is the handler which performs processing to receive data from the UartLite.
It is called from an interrupt context such that the amount of processing performed should be minimized. It is called data is present in the receive FIFO of the UartLite such that the data can be retrieved from the UartLite. The size of the data present in the FIFO is not known when this function is called.
This handler provides an example of how to handle data for the UartLite, but is application specific.
CallBackRef | contains a callback reference from the driver, in this case it is the instance pointer for the UartLite driver. |
EventData | contains the number of bytes sent or received for sent and receive events. |
Referenced by UartLiteIntrExample().
void SendHandler | ( | void * | CallBackRef, |
unsigned int | EventData | ||
) |
This function is the handler which performs processing to send data to the UartLite.
It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when the transmit FIFO of the UartLite is empty and more data can be sent through the UartLite.
This handler provides an example of how to handle data for the UartLite, but is application specific.
CallBackRef | contains a callback reference from the driver. In this case it is the instance pointer for the UartLite driver. |
EventData | contains the number of bytes sent or received for sent and receive events. |
Referenced by UartLiteIntrExample().
int SetupInterruptSystem | ( | XUartLite * | UartLitePtr | ) |
This function setups the interrupt system such that interrupts can occur for the UartLite device.
This function is application specific since the actual system may or may not have an interrupt controller. The UartLite could be directly connected to a processor without an interrupt controller. The user should modify this function to fit the application.
UartLitePtr | contains a pointer to the instance of the UartLite component which is going to be connected to the interrupt controller. |
References XUartLite_InterruptHandler().
Referenced by UartLiteIntrExample().
int UartLiteIntrExample | ( | u16 | DeviceId | ) |
This function does a minimal test on the UartLite device and driver as a design example.
The purpose of this function is to illustrate how to use the XUartLite component.
This function sends data and expects to receive the same data through the UartLite. The user must provide a physical loopback such that data which is transmitted will be received.
This function uses interrupt driver mode of the UartLite device. The calls to the UartLite driver in the handlers should only use the non-blocking calls.
DeviceId | is the Device ID of the UartLite Device and is the XPAR_<uartlite_instance>_DEVICE_ID value from xparameters.h. |
This function contains an infinite loop such that if interrupts are not working it may never return.
References RecvHandler(), SendHandler(), SetupInterruptSystem(), XUartLite_EnableInterrupt(), XUartLite_Initialize(), XUartLite_Recv(), XUartLite_SelfTest(), XUartLite_Send(), XUartLite_SetRecvHandler(), and XUartLite_SetSendHandler().
Referenced by main().