uartlite
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
xuartlite_low_level_example.c File Reference

Overview

Demonstrates the low-level UartLite driver functions.

Note
A physical loopback must be provided such that data which is transmitted is received.

MODIFICATION HISTORY:

Ver   Who  Date  Changes


1.00b rpm 04/25/02 First release 1.00b sv 06/13/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 guidelines. 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 3.13 vlt 12/18/25 Update Doxygen comments to include SDT flow details. 3.13 vlt 03/15/26 Updated BaseAddress type from u32 to UINTPTR to support 64-bit addressing 3.14 vn 09/09/26 Align Doxygen comments with AMD standards

#include "xparameters.h"
#include "xstatus.h"
#include "xuartlite_l.h"
#include "xil_printf.h"

Macros

Device parameters

The following constants map to the XPAR parameters created in the xparameters.h file.

They are defined here such that a user can easily change all the needed parameters in one place.

#define UARTLITE_BASEADDR   XPAR_XUARTLITE_0_BASEADDR
 UartLite base address. More...
 
Buffer size

This constant must be 16 bytes or less so the entire buffer fits into the transmit and receive FIFOs of the UartLite.

#define TEST_BUFFER_SIZE   16
 Length of the send and receive buffers. More...
 

Functions

int UartLiteLowLevelExample (UINTPTR UartliteBaseAddress)
 Performs a minimal test on the UartLite device using the low-level driver macros and functions. More...
 
int main (void)
 Calls the UartLite low-level example. More...
 

Variables

u8 SendBuffer [TEST_BUFFER_SIZE]
 Buffer for transmitting data. More...
 
u8 RecvBuffer [TEST_BUFFER_SIZE]
 Buffer for receiving data. More...
 

Macro Definition Documentation

#define TEST_BUFFER_SIZE   16

Length of the send and receive buffers.

Referenced by UartLiteLowLevelExample().

#define UARTLITE_BASEADDR   XPAR_XUARTLITE_0_BASEADDR

UartLite base address.

Referenced by main().

Function Documentation

int main ( void  )

Calls the UartLite low-level example.

Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful.

References UARTLITE_BASEADDR, and UartLiteLowLevelExample().

int UartLiteLowLevelExample ( UINTPTR  UartliteBaseAddress)

Performs a minimal test on the UartLite device using the low-level driver macros and functions.

This function sends data and expects to receive the data through the UartLite. A physical loopback must be provided with the transmit and receive signals of the UartLite.

Parameters
[in]UartliteBaseAddressBase address of the device.
Returns
XST_SUCCESS if successful, XST_FAILURE if unsuccessful.
Note
In XSCT/classic flow, the base address is used directly.

References RecvBuffer, SendBuffer, TEST_BUFFER_SIZE, XUartLite_RecvByte(), and XUartLite_SendByte().

Referenced by main().

Variable Documentation

u8 RecvBuffer[TEST_BUFFER_SIZE]

Buffer for receiving data.

Referenced by UartLiteLowLevelExample(), and UartLitePolledExample().

u8 SendBuffer[TEST_BUFFER_SIZE]

Buffer for transmitting data.