uartps
Vitis Drivers API Documentation
xuartps.h File Reference

Data Structures

struct  XUartPs_Config
 This typedef contains configuration information for the device. More...
 
struct  XUartPsFormat
 Keep track of data format setting of a device. More...
 
struct  XUartPs
 The XUartPs driver instance data structure. More...
 

Macros

#define TIMEOUT_VAL   1000000U
 Wait for 1 sec in worst case. More...
 
#define XUartPs_GetChannelStatus(InstancePtr)   Xil_In32(((InstancePtr)->Config.BaseAddress) + (u32)XUARTPS_SR_OFFSET)
 Get the UART Channel Status Register. More...
 
#define XUartPs_GetModeControl(InstancePtr)   Xil_In32(((InstancePtr)->Config.BaseAddress) + (u32)XUARTPS_CR_OFFSET)
 Get the UART Mode Control Register. More...
 
#define XUartPs_SetModeControl(InstancePtr, RegisterValue)
 Set the UART Mode Control Register. More...
 
#define XUartPs_EnableUart(InstancePtr)
 Enable the transmitter and receiver of the UART. More...
 
#define XUartPs_DisableUart(InstancePtr)
 Disable the transmitter and receiver of the UART. More...
 
#define XUartPs_IsTransmitEmpty(InstancePtr)
 Determine if the transmitter FIFO is empty. More...
 
Configuration options
#define XUARTPS_OPTION_SET_BREAK   0x0080U
 These constants specify the options that may be set or retrieved with the driver, each is a unique bit mask such that multiple options may be specified. More...
 
#define XUARTPS_OPTION_STOP_BREAK   0x0040U
 Stops break transmission. More...
 
#define XUARTPS_OPTION_RESET_TMOUT   0x0020U
 Reset the receive timeout. More...
 
#define XUARTPS_OPTION_RESET_TX   0x0010U
 Reset the transmitter. More...
 
#define XUARTPS_OPTION_RESET_RX   0x0008U
 Reset the receiver. More...
 
#define XUARTPS_OPTION_ASSERT_RTS   0x0004U
 Assert the RTS bit. More...
 
#define XUARTPS_OPTION_ASSERT_DTR   0x0002U
 Assert the DTR bit. More...
 
#define XUARTPS_OPTION_SET_FCM   0x0001U
 Turn on flow control mode. More...
 
Channel Operational Mode

The UART can operate in one of four modes: Normal, Local Loopback, Remote Loopback, or automatic echo.

#define XUARTPS_OPER_MODE_NORMAL   (u8)0x00U
 Normal Mode. More...
 
#define XUARTPS_OPER_MODE_AUTO_ECHO   (u8)0x01U
 Auto Echo Mode. More...
 
#define XUARTPS_OPER_MODE_LOCAL_LOOP   (u8)0x02U
 Local Loopback Mode. More...
 
#define XUARTPS_OPER_MODE_REMOTE_LOOP   (u8)0x03U
 Remote Loopback Mode. More...
 
Data format values

These constants specify the data format that the driver supports.

The data format includes the number of data bits, the number of stop bits and parity.

#define XUARTPS_FORMAT_8_BITS   0U
 8 data bits More...
 
#define XUARTPS_FORMAT_7_BITS   2U
 7 data bits More...
 
#define XUARTPS_FORMAT_6_BITS   3U
 6 data bits More...
 
#define XUARTPS_FORMAT_NO_PARITY   4U
 No parity. More...
 
#define XUARTPS_FORMAT_MARK_PARITY   3U
 Mark parity. More...
 
#define XUARTPS_FORMAT_SPACE_PARITY   2U
 parity More...
 
#define XUARTPS_FORMAT_ODD_PARITY   1U
 Odd parity. More...
 
#define XUARTPS_FORMAT_EVEN_PARITY   0U
 Even parity. More...
 
#define XUARTPS_FORMAT_2_STOP_BIT   2U
 2 stop bits More...
 
#define XUARTPS_FORMAT_1_5_STOP_BIT   1U
 1.5 stop bits More...
 
#define XUARTPS_FORMAT_1_STOP_BIT   0U
 1 stop bit More...
 
Callback events

These constants specify the handler events that an application can handle using its specific handler function.

Note that these constants are not bit mask, so only one event can be passed to an application at a time.

#define XUARTPS_EVENT_RECV_DATA   1U
 Data receiving done. More...
 
#define XUARTPS_EVENT_RECV_TOUT   2U
 A receive timeout occurred. More...
 
#define XUARTPS_EVENT_SENT_DATA   3U
 Data transmission done. More...
 
#define XUARTPS_EVENT_RECV_ERROR   4U
 A receive error detected. More...
 
#define XUARTPS_EVENT_MODEM   5U
 Modem status changed. More...
 
#define XUARTPS_EVENT_PARE_FRAME_BRKE   6U
 A receive parity, frame, break error detected. More...
 
#define XUARTPS_EVENT_RECV_ORERR   7U
 A receive overrun error detected. More...
 

Typedefs

typedef void(* XUartPs_Handler )(void *CallBackRef, u32 Event, u32 EventData)
 This data type defines a handler that an application defines to communicate with interrupt system to retrieve state information about an application. More...
 

Functions

XUartPs_ConfigXUartPs_LookupConfig (u16 DeviceId)
 Looks up the device configuration based on the unique device ID. More...
 
s32 XUartPs_CfgInitialize (XUartPs *InstancePtr, XUartPs_Config *Config, u32 EffectiveAddr)
 Initializes a specific XUartPs instance such that it is ready to be used. More...
 
u32 XUartPs_Send (XUartPs *InstancePtr, u8 *BufferPtr, u32 NumBytes)
 This functions sends the specified buffer using the device in either polled or interrupt driven mode. More...
 
u32 XUartPs_Recv (XUartPs *InstancePtr, u8 *BufferPtr, u32 NumBytes)
 This function attempts to receive a specified number of bytes of data from the device and store it into the specified buffer. More...
 
s32 XUartPs_SetBaudRate (XUartPs *InstancePtr, u32 BaudRate)
 Sets the baud rate for the device. More...
 
void XUartPs_SetOptions (XUartPs *InstancePtr, u16 Options)
 Sets the options for the specified driver instance. More...
 
u16 XUartPs_GetOptions (XUartPs *InstancePtr)
 Gets the options for the specified driver instance. More...
 
void XUartPs_SetFifoThreshold (XUartPs *InstancePtr, u8 TriggerLevel)
 This functions sets the receive FIFO trigger level. More...
 
u8 XUartPs_GetFifoThreshold (XUartPs *InstancePtr)
 This function gets the receive FIFO trigger level. More...
 
u16 XUartPs_GetModemStatus (XUartPs *InstancePtr)
 This function gets the modem status from the specified UART. More...
 
u32 XUartPs_IsSending (XUartPs *InstancePtr)
 This function determines if the specified UART is sending data. More...
 
u8 XUartPs_GetOperMode (XUartPs *InstancePtr)
 This function gets the operational mode of the UART. More...
 
void XUartPs_SetOperMode (XUartPs *InstancePtr, u8 OperationMode)
 This function sets the operational mode of the UART. More...
 
u8 XUartPs_GetFlowDelay (XUartPs *InstancePtr)
 This function sets the Flow Delay. More...
 
void XUartPs_SetFlowDelay (XUartPs *InstancePtr, u8 FlowDelayValue)
 This function sets the Flow Delay. More...
 
u8 XUartPs_GetRecvTimeout (XUartPs *InstancePtr)
 This function gets the Receive Timeout of the UART. More...
 
void XUartPs_SetRecvTimeout (XUartPs *InstancePtr, u8 RecvTimeout)
 This function sets the Receive Timeout of the UART. More...
 
s32 XUartPs_SetDataFormat (XUartPs *InstancePtr, XUartPsFormat *FormatPtr)
 Sets the data format for the device. More...
 
void XUartPs_GetDataFormat (XUartPs *InstancePtr, XUartPsFormat *FormatPtr)
 Gets the data format for the specified UART. More...
 
u32 XUartPs_GetInterruptMask (XUartPs *InstancePtr)
 This function gets the interrupt mask. More...
 
void XUartPs_SetInterruptMask (XUartPs *InstancePtr, u32 Mask)
 This function sets the interrupt mask. More...
 
void XUartPs_InterruptHandler (XUartPs *InstancePtr)
 This function is the interrupt handler for the driver. More...
 
void XUartPs_SetHandler (XUartPs *InstancePtr, XUartPs_Handler FuncPtr, void *CallBackRef)
 This function sets the handler that will be called when an event (interrupt) occurs that needs application's attention. More...
 
s32 XUartPs_SelfTest (XUartPs *InstancePtr)
 This function runs a self-test on the driver and hardware device. More...