![]() |
uartns550
Vitis Drivers API Documentation
|
Declares low-level identifiers and access macros for the device.
This header file contains identifiers and low-level driver functions (or macros) that can be used to access the device. Refer to the hardware device specification for more details of the device operation. High-level driver functions are defined in xuartns550.h.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00b jhl 04/24/02 First release 1.11a sv 03/20/07 Updated to use the new coding guidelines. 1.11a rpm 11/13/07 Fixed bug in _EnableIntr 2.00a ktn 10/20/09 Converted all register accesses to 32 bit access. Updated to use HAL Processor APIs. _m is removed from the name of all the macro definitions. 3.4 sk 11/10/15 Used UINTPTR instead of u32 for Baseaddress CR# 867425. Changed the prototypes of XUartNs550_SendByte, XUartNs550_RecvByte, XUartNs550_SetBaud APIs. 3.6 sd 02/03/20 Updated the register macros for DRL and DRM registers. 3.15 vn 07/30/26 Fix Doxygen warnings 3.15 vn 09/09/26 Align Doxygen comments with AMD standards
#include "xil_types.h"#include "xil_assert.h"#include "xil_io.h"Macros | |
| #define | XUN_REG_OFFSET 0x1000 |
| Offset from the device base address to the IP registers. More... | |
| #define | XUN_FIFO_SIZE 16 |
| Size of the transmit and receive FIFOs combined. More... | |
| #define | XUN_DIVISOR_BYTE_MASK 0x000000FF |
| Mask for divisor byte. More... | |
| #define | XUartNs550_ReadReg(BaseAddress, RegOffset) Xil_In32((BaseAddress) + (RegOffset)) |
| Reads a UART register. More... | |
| #define | XUartNs550_WriteReg(BaseAddress, RegOffset, RegisterValue) Xil_Out32((BaseAddress) + (RegOffset), (RegisterValue)) |
| Writes to a UART register. More... | |
| #define | XUartNs550_GetLineStatusReg(BaseAddress) XUartNs550_ReadReg((BaseAddress), XUN_LSR_OFFSET) |
| Gets the UART Line Status Register. More... | |
| #define | XUartNs550_GetLineControlReg(BaseAddress) XUartNs550_ReadReg((BaseAddress), XUN_LCR_OFFSET) |
| Gets the UART Line Control Register. More... | |
| #define | XUartNs550_SetLineControlReg(BaseAddress, RegisterValue) XUartNs550_WriteReg((BaseAddress), XUN_LCR_OFFSET, (RegisterValue)) |
| Sets the UART Line Control Register. More... | |
| #define | XUartNs550_EnableIntr(BaseAddress) |
| Enables the transmit and receive interrupts of the UART. More... | |
| #define | XUartNs550_DisableIntr(BaseAddress) |
| Disables the transmit and receive interrupts of the UART. More... | |
| #define | XUartNs550_IsReceiveData(BaseAddress) (XUartNs550_GetLineStatusReg(BaseAddress) & XUN_LSR_DATA_READY) |
| Determines if there is receive data in the receiver and/or FIFO. More... | |
| #define | XUartNs550_IsTransmitEmpty(BaseAddress) (XUartNs550_GetLineStatusReg(BaseAddress) & XUN_LSR_TX_BUFFER_EMPTY) |
| Determines if a byte of data can be sent with the transmitter. More... | |
Register Map | |
Register offsets for the 16450/16550 compatible UART device. | |
| #define | XUN_RBR_OFFSET (XUN_REG_OFFSET) |
| Receive buffer, read only. More... | |
| #define | XUN_THR_OFFSET (XUN_REG_OFFSET) |
| Transmit holding register. More... | |
| #define | XUN_IER_OFFSET (XUN_REG_OFFSET + 0x04) |
| Interrupt enable. More... | |
| #define | XUN_IIR_OFFSET (XUN_REG_OFFSET + 0x08) |
| Interrupt id, read only. More... | |
| #define | XUN_FCR_OFFSET (XUN_REG_OFFSET + 0x08) |
| Fifo control, write only. More... | |
| #define | XUN_LCR_OFFSET (XUN_REG_OFFSET + 0x0C) |
| Line Control Register. More... | |
| #define | XUN_MCR_OFFSET (XUN_REG_OFFSET + 0x10) |
| Modem Control Register. More... | |
| #define | XUN_LSR_OFFSET (XUN_REG_OFFSET + 0x14) |
| Line Status Register. More... | |
| #define | XUN_MSR_OFFSET (XUN_REG_OFFSET + 0x18) |
| Modem Status Register. More... | |
| #define | XUN_DLL_OFFSET (XUN_REG_OFFSET + 0x00) |
| Divisor Register LSB. More... | |
| #define | XUN_DLM_OFFSET (XUN_REG_OFFSET + 0x04) |
| Divisor Register MSB. More... | |
| #define | XUN_DRLS_OFFSET (XUN_REG_OFFSET + 0x00) |
| Divisor Register LSB. More... | |
| #define | XUN_DRLM_OFFSET (XUN_REG_OFFSET + 0x04) |
| Divisor Register MSB. More... | |
Interrupt Enable Register (IER) masks | |
| #define | XUN_IER_MODEM_STATUS 0x00000008 |
| Modem status interrupt. More... | |
| #define | XUN_IER_RX_LINE 0x00000004 |
| Receive status interrupt. More... | |
| #define | XUN_IER_TX_EMPTY 0x00000002 |
| Transmitter empty interrupt. More... | |
| #define | XUN_IER_RX_DATA 0x00000001 |
| Receiver data available. More... | |
Interrupt ID Register (INT_ID) masks | |
| #define | XUN_INT_ID_MASK 0x0000000F |
| Only the interrupt ID. More... | |
| #define | XUN_INT_ID_FIFOS_ENABLED 0x000000C0 |
| Only the FIFOs enable. More... | |
FIFO Control Register masks | |
| #define | XUN_FIFO_RX_TRIG_MSB 0x00000080 |
| Trigger level MSB. More... | |
| #define | XUN_FIFO_RX_TRIG_LSB 0x00000040 |
| Trigger level LSB. More... | |
| #define | XUN_FIFO_TX_RESET 0x00000004 |
| Reset the transmit FIFO. More... | |
| #define | XUN_FIFO_RX_RESET 0x00000002 |
| Reset the receive FIFO. More... | |
| #define | XUN_FIFO_ENABLE 0x00000001 |
| Enable the FIFOs. More... | |
| #define | XUN_FIFO_RX_TRIGGER 0x000000C0 |
| Both trigger level bits. More... | |
Line Control Register(LCR) masks | |
| #define | XUN_LCR_DLAB 0x00000080 |
| Divisor latch access. More... | |
| #define | XUN_LCR_SET_BREAK 0x00000040 |
| Cause a break condition. More... | |
| #define | XUN_LCR_STICK_PARITY 0x00000020 |
| Stick Parity. More... | |
| #define | XUN_LCR_EVEN_PARITY 0x00000010 |
| 1 = even, 0 = odd parity More... | |
| #define | XUN_LCR_ENABLE_PARITY 0x00000008 |
| 1 = Enable, 0 = Disable parity More... | |
| #define | XUN_LCR_2_STOP_BITS 0x00000004 |
| 1= 2 stop bits,0 = 1 stop bit More... | |
| #define | XUN_LCR_8_DATA_BITS 0x00000003 |
| 8 Data bits selection More... | |
| #define | XUN_LCR_7_DATA_BITS 0x00000002 |
| 7 Data bits selection More... | |
| #define | XUN_LCR_6_DATA_BITS 0x00000001 |
| 6 Data bits selection More... | |
| #define | XUN_LCR_LENGTH_MASK 0x00000003 |
| Both length bits mask. More... | |
| #define | XUN_LCR_PARITY_MASK 0x00000018 |
| Both parity bits mask. More... | |
Mode Control Register(MCR) masks | |
| #define | XUN_MCR_LOOP 0x00000010 |
| Local loopback. More... | |
| #define | XUN_MCR_OUT_2 0x00000008 |
| General output 2 signal. More... | |
| #define | XUN_MCR_OUT_1 0x00000004 |
| General output 1 signal. More... | |
| #define | XUN_MCR_RTS 0x00000002 |
| RTS signal. More... | |
| #define | XUN_MCR_DTR 0x00000001 |
| DTR signal. More... | |
Line Status Register(LSR) masks | |
| #define | XUN_LSR_RX_FIFO_ERROR 0x00000080 |
| An errored byte is in FIFO. More... | |
| #define | XUN_LSR_TX_EMPTY 0x00000040 |
| Transmitter is empty. More... | |
| #define | XUN_LSR_TX_BUFFER_EMPTY 0x00000020 |
| Transmit holding reg empty. More... | |
| #define | XUN_LSR_BREAK_INT 0x00000010 |
| Break detected interrupt. More... | |
| #define | XUN_LSR_FRAMING_ERROR 0x00000008 |
| Framing error on current byte. More... | |
| #define | XUN_LSR_PARITY_ERROR 0x00000004 |
| Parity error on current byte. More... | |
| #define | XUN_LSR_OVERRUN_ERROR 0x00000002 |
| Overrun error on receive FIFO. More... | |
| #define | XUN_LSR_DATA_READY 0x00000001 |
| Receive data ready. More... | |
| #define | XUN_LSR_ERROR_BREAK 0x0000001E |
| Errors except FIFO error and break detected. More... | |
Functions | |
| void | XUartNs550_SendByte (UINTPTR BaseAddress, u8 Data) |
| Sends a data byte with the UART. More... | |
| u8 | XUartNs550_RecvByte (UINTPTR BaseAddress) |
| Receives a byte from the UART. More... | |
| void | XUartNs550_SetBaud (UINTPTR BaseAddress, u32 InputClockHz, u32 BaudRate) |
| Sets the baud rate for the UART. More... | |