![]() |
uartns550
Vitis Drivers API Documentation
|
Demonstrates XUartNs550 driver usage in interrupt mode.
This file contains a design example using the UART 16450/16550 driver (XUartNs550) and hardware device using interrupt mode.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00b jhl 02/13/02 First release 1.00b sv 06/08/05 Minor changes to comply to Doxygen and coding guidelines 1.01a sv 05/08/06 Minor changes for supporting Test App Interrupt examples 2.00a ktn 10/20/09 Updated to use HAL processor APIs and minor modifications as per coding guidelines. 2.01a ssb 01/11/01 Updated the example to be used with the SCUGIC in Zynq. 3.2 adk 15/10/14 Clear the global counters.If multiple instance of ip is present in the h/w design without clearing these counters will result undefined behaviour for the second ip instance while running the peripheral tests. 3.4 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.6 rna 01/06/20 Clean up options at end to get Success/Failure strings 3.9 gm 07/09/23 Added SDT support. 3.14 vlt 12/18/25 Update Doxygen comments to include SDT flow details. 3.15 vn 07/30/26 Fix Doxygen warnings 3.15 vn 09/09/26 Align Doxygen comments with AMD standards
#include "xparameters.h"#include "xuartns550.h"#include "xil_exception.h"#include "xinterrupt_wrap.h"Macros | |
| #define | TEST_BUFFER_SIZE 100 |
| Length of the send and receive buffers. More... | |
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 | XUARTNS550_BASEADDRESS XPAR_XUARTNS550_0_BASEADDR |
| UART base address. More... | |
Functions | |
| int | UartNs550IntrExample (XUartNs550 *UartInstancePtr, UINTPTR BaseAddress) |
| Performs a minimal interrupt-mode test on the UartNs550 device. More... | |
| void | UartNs550IntrHandler (void *CallBackRef, u32 Event, unsigned int EventData) |
| Handles data events from the UartNs550. More... | |
| int | main (void) |
| Calls the UartNs550 interrupt example. More... | |
Variables | |
| XUartNs550 | UartNs550Instance |
| Instance of the UART Device. More... | |
Data buffers | |
The following buffers are used in this example to send and receive data with the UART. | |
| u8 | SendBuffer [TEST_BUFFER_SIZE] |
| Buffer for Transmitting Data. More... | |
| u8 | RecvBuffer [TEST_BUFFER_SIZE] |
| Buffer for Receiving Data. More... | |
Transfer counters | |
The following counters are used to determine when the entire buffer has been sent and received. | |
| #define TEST_BUFFER_SIZE 100 |
Length of the send and receive buffers.
The following constant controls the length of the buffers to be sent and received with the UART.
Referenced by UartNs550IntrExample().
| #define XUARTNS550_BASEADDRESS XPAR_XUARTNS550_0_BASEADDR |
UART base address.
Referenced by main().
| int main | ( | void | ) |
Calls the UartNs550 interrupt example.
References UartNs550IntrExample(), and XUARTNS550_BASEADDRESS.
| int UartNs550IntrExample | ( | XUartNs550 * | UartInstancePtr, |
| UINTPTR | BaseAddress | ||
| ) |
Performs a minimal interrupt-mode test on the UartNs550 device.
This is a design example that tests the device and driver.
This function illustrates how to use the XUartNs550 component.
This function transmits data and expects to receive the same data through the UART using the local loopback of the hardware.
This function uses interrupt driver mode of the UART.
| [in] | UartInstancePtr | Pointer to the instance of the UART . |
| [in] | BaseAddress | Base address of the device. |
References XUartNs550_Config::IntrId, XUartNs550_Config::IntrParent, RecvBuffer, SendBuffer, TEST_BUFFER_SIZE, UartNs550IntrHandler(), XUartNs550_GetOptions(), XUartNs550_Initialize(), XUartNs550_InterruptHandler(), XUartNs550_LookupConfig(), XUartNs550_Recv(), XUartNs550_SelfTest(), XUartNs550_Send(), XUartNs550_SetHandler(), XUartNs550_SetOptions(), XUN_OPTION_DATA_INTR, XUN_OPTION_FIFOS_ENABLE, and XUN_OPTION_LOOPBACK.
Referenced by main().
| void UartNs550IntrHandler | ( | void * | CallBackRef, |
| u32 | Event, | ||
| unsigned int | EventData | ||
| ) |
Handles data events from the UartNs550.
It is called from an interrupt context such that the amount of processing performed should be minimized.
This handler provides an example of how to handle data for the UART and is application specific.
| [in] | CallBackRef | Callback reference from the driver, in this case it is the instance pointer for the UART driver. |
| [in] | Event | Specific kind of event that has occurred. |
| [in] | EventData | Number of bytes sent or received for sent and receive events. |
References XUartNs550_GetLastErrors(), XUN_EVENT_RECV_DATA, XUN_EVENT_RECV_ERROR, XUN_EVENT_RECV_TIMEOUT, and XUN_EVENT_SENT_DATA.
Referenced by UartNs550IntrExample().
| u8 RecvBuffer[TEST_BUFFER_SIZE] |
Buffer for Receiving Data.
Referenced by UartNs550IntrExample(), UartNs550PolledExample(), and XUartNs550_LowLevelExample().
| u8 SendBuffer[TEST_BUFFER_SIZE] |
Buffer for Transmitting Data.
Referenced by UartNs550IntrExample(), UartNs550PolledExample(), and XUartNs550_LowLevelExample().
| XUartNs550 UartNs550Instance |
Instance of the UART Device.