| uartlite Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xuartlite_intr_example.c File Reference

## Overview

This file contains a design example using the UartLite driver (XUartLite) and hardware device using the interrupt mode.

Note

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.
    3.9   gm   07/08/23 Added SDT support

## Functions
int | UartLiteIntrExample (INTC *IntcInstancePtr, XUartLite *UartLiteInstPtr, u16 DeviceId, u16 UartLiteIntrId)
| This function does a minimal test on the UartLite device and driver as a design example. 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...

## Function Documentation

int main | ( | void |  | ) |

Main function to call the UartLite interrupt example.

Returns
  XST_SUCCESS if successful, XST_FAILURE if unsuccessful

Note
  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.

Parameters

  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.

Returns
  None.

Note
  None.

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.

Parameters

  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.

Returns
  None.

Note
  None.

Referenced by UartLiteIntrExample().

int UartLiteIntrExample | ( | INTC * | IntcInstancePtr,
|  | XUartLite * | UartLiteInstPtr,
|  | u16 | UartLiteDeviceId,
|  | u16 | UartLiteIntrId
| ) |  |

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.

Parameters

  DeviceId | is the Device ID of the UartLite Device and is the XPAR_<uartlite_instance>_DEVICE_ID 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.

The purpose of this function is to illustrate how to use the XUartLite component.

This function sends data through the UartLite.

This function uses the interrupt driver mode of the UartLite. The calls to the UartLite driver in the interrupt handlers, should only use the non-blocking calls.

Parameters

  IntcInstancePtr | is a pointer to the instance of INTC driver.
  UartLiteInstPtr | is a pointer to the instance of UartLite driver.
  UartLiteDeviceId | is the Device ID of the UartLite Device and is the XPAR_<UARTLITE_instance>_DEVICE_ID value from xparameters.h.
  UartLiteIntrId | is the Interrupt ID and is typically XPAR_<INTC_instance>_<UARTLITE_instance>_VEC_ID value from xparameters.h.

Returns
  XST_SUCCESS if successful, otherwise XST_FAILURE.

Note
  None.

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

References RecvHandler(), SendHandler(), XUartLite_EnableInterrupt(), XUartLite_Initialize(), XUartLite_InterruptHandler(), XUartLite_Recv(), XUartLite_SelfTest(), XUartLite_Send(), XUartLite_SetRecvHandler(), and XUartLite_SetSendHandler().

Referenced by main().