AM263x MCU+ SDK  09.01.00

Introduction

This module contains APIs to program and use the UART.

Files

file  uart_lld.h
 This file contains the prototype of UART driver APIs.
 

Data Structures

struct  UART_ExtendedParams
 
struct  UART_Transaction
 Data structure used with UART_read() and UART_write() More...
 
struct  UARTLLD_InitObject
 UART driver initialization object. More...
 
struct  UARTLLD_Object
 UART driver object. More...
 

Functions

uint32_t UART_operatingModeSelect (uint32_t baseAddr, uint32_t modeFlag)
 
uint32_t UART_spaceAvail (uint32_t baseAddr)
 
int32_t UART_writeCancelNoCB (UARTLLD_Handle hUart)
 
int32_t UART_readCancelNoCB (UARTLLD_Handle hUart)
 
uint32_t UART_getBaseAddr_lld (UARTLLD_Handle handle)
 Function to get base address of UART instance of a particular handle. More...
 
void UART_enableLoopbackMode (uint32_t baseAddr)
 Function to enable loopback mode. This function is for internal use. Not recommended for customers to use. More...
 
void UART_disableLoopbackMode (uint32_t baseAddr)
 Function to disable loopback mode. This function is for internal use. Not recommended for customers to use. More...
 
int32_t UART_lld_init (UARTLLD_Handle hUart)
 This API Initializes the UART instance. More...
 
int32_t UART_lld_initDma (UARTLLD_Handle hUart)
 This API Initializes the UART instance in DMA mode. More...
 
int32_t UART_lld_deInit (UARTLLD_Handle hUart)
 This API De-Initializes the UART instance. More...
 
int32_t UART_lld_deInitDma (UARTLLD_Handle hUart)
 This API De-Initializes the UART instance in DMA mode. More...
 
int32_t UART_lld_write (UARTLLD_Handle hUart, void *txBuf, uint32_t size, uint32_t timeout, const UART_ExtendedParams *extendedParams)
 This API writes data to the UART instance in Polling mode. More...
 
int32_t UART_lld_writeIntr (UARTLLD_Handle hUart, void *txBuf, uint32_t size, const UART_ExtendedParams *extendedParams)
 This API writes data to the UART instance in Interrupt mode. More...
 
int32_t UART_lld_writeDma (UARTLLD_Handle hUart, void *txBuf, uint32_t size, const UART_ExtendedParams *extendedParams)
 This API writes data to the UART instance in DMA mode. More...
 
int32_t UART_lld_read (UARTLLD_Handle hUart, void *rxBuf, uint32_t size, uint32_t timeout, const UART_ExtendedParams *extendedParams)
 This API writes data to the UART instance in Polling mode. More...
 
int32_t UART_lld_readIntr (UARTLLD_Handle hUart, void *rxBuf, uint32_t size, const UART_ExtendedParams *extendedParams)
 This API writes data to the UART instance in Interrupt mode. More...
 
int32_t UART_lld_readDma (UARTLLD_Handle hUart, void *rxBuf, uint32_t size, const UART_ExtendedParams *extendedParams)
 This API writes data to the UART instance in DMA mode. More...
 
int32_t UART_lld_writeCancel (UARTLLD_Handle hUart, UART_Transaction *trans)
 This API cancels current UART Write. More...
 
int32_t UART_lld_readCancel (UARTLLD_Handle hUart, UART_Transaction *trans)
 This API cancels current UART Read. More...
 
int32_t UART_lld_flushTxFifo (UARTLLD_Handle hUart)
 Function to flush a TX FIFO of peripheral specified by the UART handle. More...
 
int32_t UART_procLineStatusErr (UARTLLD_Handle hUart)
 Function to check various error conditions in uart. More...
 
int32_t UART_lld_setRxState (UARTLLD_Handle hUart, uint32_t state)
 Function to enable/disable UART RX. More...
 
void UART_lld_controllerIsr (void *args)
 This is the UART ISR and can be used as IRQ handler. More...
 
void UART_intrDisable (uint32_t baseAddr, uint32_t intrFlag)
 This API disables the specified interrupts in the UART mode of operation. More...
 
void UART_intr2Disable (uint32_t baseAddr, uint32_t intrFlag)
 This API disables the specified interrupts in the UART mode of operation for IER2. More...
 
uint32_t UART_checkCharsAvailInFifo (uint32_t baseAddr)
 This API checks if the RX FIFO (or RHR in non-FIFO mode) has atleast one byte of data to be read. More...
 
uint32_t UART_readLineStatus (uint32_t baseAddr)
 This API reads the line status register value. More...
 
uint8_t UART_getCharFifo (uint32_t baseAddr, uint8_t *readBuf)
 This API reads the data present at the top of the RX FIFO, that is, the data in the Receive Holding Register(RHR). However before reading the data from RHR, it checks for RX error. More...
 
void UART_putChar (uint32_t baseAddr, uint8_t byteTx)
 This API writes a byte to the Transmitter FIFO without checking for the emptiness of the Transmitter FIFO or the Transmitter Shift Register(TSR). More...
 
void UART_intrEnable (uint32_t baseAddr, uint32_t intrFlag)
 This API enables the specified interrupts in the UART mode of operation. More...
 
uint32_t UART_getChar (uint32_t baseAddr, uint8_t *pChar)
 This API reads a byte from the Receiver Buffer Register (RBR). It checks once if any character is ready to be read. More...
 
uint32_t UART_getIntr2Status (uint32_t baseAddr)
 This API determines the UART Interrupt Status 2. More...
 
uint32_t UART_getIntrIdentityStatus (uint32_t baseAddr)
 This API determines the UART Interrupt Status. More...
 
void UART_intr2Enable (uint32_t baseAddr, uint32_t intrFlag)
 This API enables the specified interrupts in the UART mode of operation for IER2. More...
 
void UART_lld_Transaction_init (UART_Transaction *trans)
 Function to initialize the UART_Transaction struct to its defaults. More...
 
void UART_lld_Transaction_deInit (UART_Transaction *trans)
 Function to de-initialize the UART_Transaction struct to its defaults. More...
 

Typedefs

typedef void * UART_DmaHandle
 A handle that is returned from a UART_open() call. More...
 
typedef void * UART_DmaChConfig
 
typedef uint32_t(* UART_clockGet) (void)
 
typedef uint32_t(* UART_clockUsecToTick) (uint64_t usecs)
 
typedef void(* UART_readCompCallbackFxn) (void *hUart)
 The definition of a read complete callback function used by the UART driver when used in UART_TRANSFER_MODE_CALLBACK. More...
 
typedef void(* UART_writeCompCallbackFxn) (void *hUart)
 The definition of a write complete callback function used by the UART driver when used in UART_TRANSFER_MODE_CALLBACK. More...
 
typedef void(* UART_errorCallbackFxn) (void *hUart)
 The definition of a error callback function used by the UART driver when used in UART_TRANSFER_MODE_CALLBACK. More...
 
typedef struct UARTLLD_InitObjectUARTLLD_InitHandle
 
typedef struct UARTLLD_ObjectUARTLLD_Handle
 

Macros

#define UART_FIFO_SIZE   (64U)
 Uart FIFO Size. More...
 
#define UART_TRANSMITEMPTY_TRIALCOUNT   (3000U)
 Timeout in ms used for TX FIFO empty at the time of delete. Three seconds is more than sufficient to transfer 64 bytes (FIFO size) at the lowest baud rate of 2400. More...
 
#define UART_ERROR_COUNT   (0x00FFFFFFU)
 Count Value to check error in the recieved byte
More...
 
#define UART_NOT_IN_USE(x)   (void) 0
 NOT_IN_USE macro to highlight unused parameters. More...
 
#define UART_STATE_RX_DISABLED   (0x0U)
 
#define UART_STATE_RX_ENABLED   (0x1U)
 

Transfer Status Code

Status

Status codes that are set by the UART driver

#define UART_STATUS_SUCCESS   ((int32_t)0)
 Transaction success. More...
 
#define UART_STATUS_FAILURE   ((int32_t)-1)
 Transaction failure. More...
 
#define UART_TRANSFER_STATUS_SUCCESS   ((int32_t)0)
 Transaction success. More...
 
#define UART_TRANSFER_STATUS_FAILURE   ((int32_t)-1)
 Transaction failure. More...
 
#define UART_WAIT_FOREVER   ((int32_t)-1)
 Value to use when needing a timeout of infinity or wait forver until resource is available. More...
 
#define UART_INVALID_PARAM   ((int32_t)-3)
 Return status when the API execution failed due invalid parameters. More...
 
#define UART_TRANSFER_BUSY   ((int32_t)-4)
 Return status when the API execution failed due to driver busy. More...
 
#define UART_TRANSFER_TIMEOUT   ((int32_t)-2)
 Return status when the API execution was not successful due to a time out. More...
 
#define UART_TRANSFER_INVALID_STATE   ((int32_t)-5)
 Return status when the API execution failed due to invalid LLD state. More...
 
#define UART_TRANSFER_STATUS_TIMEOUT   (1U)
 Time out error. More...
 
#define UART_TRANSFER_STATUS_ERROR_BI   (2U)
 Break condition error. More...
 
#define UART_TRANSFER_STATUS_ERROR_FE   (3U)
 Framing error. More...
 
#define UART_TRANSFER_STATUS_ERROR_PE   (4U)
 Parity error. More...
 
#define UART_TRANSFER_STATUS_ERROR_OE   (5U)
 Overrun error. More...
 
#define UART_TRANSFER_STATUS_CANCELLED   (6U)
 Cancelled. More...
 
#define UART_TRANSFER_STATUS_STARTED   (7U)
 Transaction started. More...
 
#define UART_TRANSFER_STATUS_READ_TIMEOUT   (8U)
 Read timeout error. More...
 
#define UART_TRANSFER_STATUS_ERROR_INUSE   (9U)
 UART is currently in use. More...
 
#define UART_TRANSFER_STATUS_ERROR_OTH   (10U)
 Other errors. More...
 
#define UART_STATE_RESET   (0U)
 
#define UART_STATE_READY   (1U)
 
#define UART_STATE_BUSY   (2U)
 
#define UART_STATE_ERROR   (3U)
 

UART Read length

This enumeration defines the return modes for UART_read().

UART_READ_RETURN_MODE_FULL unblocks or performs a callback when the read buffer has been filled with the number of bytes passed to UART_read(). UART_READ_RETURN_MODE_PARTIAL unblocks or performs a callback whenever a read timeout error occurs on the UART peripheral. The read timeout occurs if the read FIFO is non-empty and no new data has been received for a specific device/baudrate dependent number of clock cycles. This mode can be used when the exact number of bytes to be read is not known.

#define UART_READ_RETURN_MODE_FULL   (0U)
 Unblock/callback when buffer is full. More...
 
#define UART_READ_RETURN_MODE_PARTIAL   (1U)
 Unblock/callback when no new data comes in. More...
 

UART data length

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_LEN_5   (0U)
 
#define UART_LEN_6   (1U)
 
#define UART_LEN_7   (2U)
 
#define UART_LEN_8   (3U)
 

UART stop bits

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_STOPBITS_1   (0U)
 
#define UART_STOPBITS_2   (1U)
 
#define UART_STOPBITS_1P5   (UART_STOPBITS_1)
 

UART Parity

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_PARITY_NONE   (0x00U)
 
#define UART_PARITY_ODD   (0x01U)
 
#define UART_PARITY_EVEN   (0x03U)
 
#define UART_PARITY_FORCED0   (0x07U)
 
#define UART_PARITY_FORCED1   (0x05U)
 

UART Flow Control Type

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_FCTYPE_NONE   (0x00U)
 
#define UART_FCTYPE_HW   (0x02U)
 

UART Flow Control Params for RX

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_FCPARAM_RXNONE   (0x00U)
 
#define UART_FCPARAM_RXXONXOFF_2   (0x01U)
 
#define UART_FCPARAM_RXXONXOFF_1   (0x02U)
 
#define UART_FCPARAM_RXXONXOFF_12   (0x03U)
 
#define UART_FCPARAM_AUTO_RTS   (0x40U)
 

UART Flow Control Params for TX

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_FCPARAM_TXNONE   (0x00U)
 
#define UART_FCPARAM_TXXONXOFF_2   (0x04U)
 
#define UART_FCPARAM_TXXONXOFF_1   (0x08U)
 
#define UART_FCPARAM_TXXONXOFF_12   (0x0CU)
 
#define UART_FCPARAM_AUTO_CTS   (0x80U)
 

UART RX trigger level

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_RXTRIGLVL_1   (1U)
 
#define UART_RXTRIGLVL_8   (8U)
 
#define UART_RXTRIGLVL_16   (16U)
 
#define UART_RXTRIGLVL_56   (56U)
 
#define UART_RXTRIGLVL_60   (60U)
 

UART TX trigger level

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_TXTRIGLVL_1   (1U)
 
#define UART_TXTRIGLVL_8   (8U)
 
#define UART_TXTRIGLVL_16   (16U)
 
#define UART_TXTRIGLVL_32   (32U)
 
#define UART_TXTRIGLVL_56   (56U)
 

UART Operational Mode

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_OPER_MODE_16X   (0U)
 
#define UART_OPER_MODE_SIR   (1U)
 
#define UART_OPER_MODE_16X_AUTO_BAUD   (2U)
 
#define UART_OPER_MODE_13X   (3U)
 
#define UART_OPER_MODE_MIR   (4U)
 
#define UART_OPER_MODE_FIR   (5U)
 
#define UART_OPER_MODE_CIR   (6U)
 
#define UART_OPER_MODE_DISABLED   (7U)
 

Values indicating the filled status of TX FIFO

Note: The values should not be changed since it represents the actual register configuration values used to configure the UART

#define UART_TX_FIFO_NOT_FULL
 
#define UART_TX_FIFO_FULL
 

Values related to status of Interrupt souces.

#define UART_INTID_MODEM_STAT
 Values pertaining to status of UART Interrupt sources. More...
 
#define UART_INTID_TX_THRES_REACH
 
#define UART_INTID_RX_THRES_REACH
 
#define UART_INTID_RX_LINE_STAT_ERROR
 
#define UART_INTID_CHAR_TIMEOUT
 
#define UART_INTID_XOFF_SPEC_CHAR_DETECT
 
#define UART_INTID_MODEM_SIG_STATE_CHANGE
 
#define UART_INTR_PENDING   (0U)
 Values indicating the UART Interrupt pending status. More...
 
#define UART_N0_INTR_PENDING   (1U)
 

Values related to enabling/disabling of Interrupts.

#define UART_INTR_CTS   (UART_IER_CTS_IT_MASK)
 Values for enabling/disabling the interrupts of UART. More...
 
#define UART_INTR_RTS   (UART_IER_RTS_IT_MASK)
 
#define UART_INTR_XOFF   (UART_IER_XOFF_IT_MASK)
 
#define UART_INTR_SLEEPMODE   (UART_IER_SLEEP_MODE_MASK)
 
#define UART_INTR_MODEM_STAT   (UART_IER_MODEM_STS_IT_MASK)
 
#define UART_INTR_LINE_STAT   (UART_IER_LINE_STS_IT_MASK)
 
#define UART_INTR_THR   (UART_IER_THR_IT_MASK)
 
#define UART_INTR_RHR_CTI   (UART_IER_RHR_IT_MASK)
 
#define UART_INTR2_RX_EMPTY   (UART_IER2_EN_RXFIFO_EMPTY_MASK)
 
#define UART_INTR2_TX_EMPTY   (UART_IER2_EN_TXFIFO_EMPTY_MASK)
 

Values related to Line Status information.

#define UART_FIFO_PE_FE_BI_DETECTED   (UART_LSR_RX_FIFO_STS_MASK)
 Values pertaining to UART Line Status information. More...
 
#define UART_BREAK_DETECTED_ERROR   (UART_LSR_RX_BI_MASK)
 
#define UART_FRAMING_ERROR   (UART_LSR_RX_FE_MASK)
 
#define UART_PARITY_ERROR   (UART_LSR_RX_PE_MASK)
 
#define UART_OVERRUN_ERROR   (UART_LSR_RX_OE_MASK)
 

Values related to Register Mode Configuration.

#define UART_REG_CONFIG_MODE_A   ((uint32_t) 0x0080)
 Values to be used while switching between register configuration modes. More...
 
#define UART_REG_CONFIG_MODE_B   ((uint32_t) 0x00BF)
 
#define UART_REG_OPERATIONAL_MODE   ((uint32_t) 0x007F)
 

UART Configration Mode

This determines whether the driver configuration mode like Polled, Interrupt, Dma used for the transfer function

#define UART_CONFIG_MODE_POLLED   (0x00U)
 
#define UART_CONFIG_MODE_INTERRUPT   (0x01U)
 
#define UART_CONFIG_MODE_USER_INTR   (0x02U)
 
#define UART_CONFIG_MODE_DMA   (0x03U)
 

Macro Definition Documentation

◆ UART_FIFO_SIZE

#define UART_FIFO_SIZE   (64U)

Uart FIFO Size.

◆ UART_TRANSMITEMPTY_TRIALCOUNT

#define UART_TRANSMITEMPTY_TRIALCOUNT   (3000U)

Timeout in ms used for TX FIFO empty at the time of delete. Three seconds is more than sufficient to transfer 64 bytes (FIFO size) at the lowest baud rate of 2400.

◆ UART_ERROR_COUNT

#define UART_ERROR_COUNT   (0x00FFFFFFU)

Count Value to check error in the recieved byte

◆ UART_STATUS_SUCCESS

#define UART_STATUS_SUCCESS   ((int32_t)0)

Transaction success.

◆ UART_STATUS_FAILURE

#define UART_STATUS_FAILURE   ((int32_t)-1)

Transaction failure.

◆ UART_TRANSFER_STATUS_SUCCESS

#define UART_TRANSFER_STATUS_SUCCESS   ((int32_t)0)

Transaction success.

◆ UART_TRANSFER_STATUS_FAILURE

#define UART_TRANSFER_STATUS_FAILURE   ((int32_t)-1)

Transaction failure.

◆ UART_WAIT_FOREVER

#define UART_WAIT_FOREVER   ((int32_t)-1)

Value to use when needing a timeout of infinity or wait forver until resource is available.

◆ UART_INVALID_PARAM

#define UART_INVALID_PARAM   ((int32_t)-3)

Return status when the API execution failed due invalid parameters.

◆ UART_TRANSFER_BUSY

#define UART_TRANSFER_BUSY   ((int32_t)-4)

Return status when the API execution failed due to driver busy.

◆ UART_TRANSFER_TIMEOUT

#define UART_TRANSFER_TIMEOUT   ((int32_t)-2)

Return status when the API execution was not successful due to a time out.

◆ UART_TRANSFER_INVALID_STATE

#define UART_TRANSFER_INVALID_STATE   ((int32_t)-5)

Return status when the API execution failed due to invalid LLD state.

◆ UART_TRANSFER_STATUS_TIMEOUT

#define UART_TRANSFER_STATUS_TIMEOUT   (1U)

Time out error.

◆ UART_TRANSFER_STATUS_ERROR_BI

#define UART_TRANSFER_STATUS_ERROR_BI   (2U)

Break condition error.

◆ UART_TRANSFER_STATUS_ERROR_FE

#define UART_TRANSFER_STATUS_ERROR_FE   (3U)

Framing error.

◆ UART_TRANSFER_STATUS_ERROR_PE

#define UART_TRANSFER_STATUS_ERROR_PE   (4U)

Parity error.

◆ UART_TRANSFER_STATUS_ERROR_OE

#define UART_TRANSFER_STATUS_ERROR_OE   (5U)

Overrun error.

◆ UART_TRANSFER_STATUS_CANCELLED

#define UART_TRANSFER_STATUS_CANCELLED   (6U)

Cancelled.

◆ UART_TRANSFER_STATUS_STARTED

#define UART_TRANSFER_STATUS_STARTED   (7U)

Transaction started.

◆ UART_TRANSFER_STATUS_READ_TIMEOUT

#define UART_TRANSFER_STATUS_READ_TIMEOUT   (8U)

Read timeout error.

◆ UART_TRANSFER_STATUS_ERROR_INUSE

#define UART_TRANSFER_STATUS_ERROR_INUSE   (9U)

UART is currently in use.

◆ UART_TRANSFER_STATUS_ERROR_OTH

#define UART_TRANSFER_STATUS_ERROR_OTH   (10U)

Other errors.

◆ UART_READ_RETURN_MODE_FULL

#define UART_READ_RETURN_MODE_FULL   (0U)

Unblock/callback when buffer is full.

◆ UART_READ_RETURN_MODE_PARTIAL

#define UART_READ_RETURN_MODE_PARTIAL   (1U)

Unblock/callback when no new data comes in.

◆ UART_LEN_5

#define UART_LEN_5   (0U)

◆ UART_LEN_6

#define UART_LEN_6   (1U)

◆ UART_LEN_7

#define UART_LEN_7   (2U)

◆ UART_LEN_8

#define UART_LEN_8   (3U)

◆ UART_STATE_RESET

#define UART_STATE_RESET   (0U)

◆ UART_STATE_READY

#define UART_STATE_READY   (1U)

◆ UART_STATE_BUSY

#define UART_STATE_BUSY   (2U)

◆ UART_STATE_ERROR

#define UART_STATE_ERROR   (3U)

◆ UART_NOT_IN_USE

#define UART_NOT_IN_USE (   x)    (void) 0

NOT_IN_USE macro to highlight unused parameters.

◆ UART_STOPBITS_1

#define UART_STOPBITS_1   (0U)

◆ UART_STOPBITS_2

#define UART_STOPBITS_2   (1U)

◆ UART_STOPBITS_1P5

#define UART_STOPBITS_1P5   (UART_STOPBITS_1)

◆ UART_PARITY_NONE

#define UART_PARITY_NONE   (0x00U)

◆ UART_PARITY_ODD

#define UART_PARITY_ODD   (0x01U)

◆ UART_PARITY_EVEN

#define UART_PARITY_EVEN   (0x03U)

◆ UART_PARITY_FORCED0

#define UART_PARITY_FORCED0   (0x07U)

◆ UART_PARITY_FORCED1

#define UART_PARITY_FORCED1   (0x05U)

◆ UART_FCTYPE_NONE

#define UART_FCTYPE_NONE   (0x00U)

◆ UART_FCTYPE_HW

#define UART_FCTYPE_HW   (0x02U)

◆ UART_FCPARAM_RXNONE

#define UART_FCPARAM_RXNONE   (0x00U)

◆ UART_FCPARAM_RXXONXOFF_2

#define UART_FCPARAM_RXXONXOFF_2   (0x01U)

◆ UART_FCPARAM_RXXONXOFF_1

#define UART_FCPARAM_RXXONXOFF_1   (0x02U)

◆ UART_FCPARAM_RXXONXOFF_12

#define UART_FCPARAM_RXXONXOFF_12   (0x03U)

◆ UART_FCPARAM_AUTO_RTS

#define UART_FCPARAM_AUTO_RTS   (0x40U)

◆ UART_FCPARAM_TXNONE

#define UART_FCPARAM_TXNONE   (0x00U)

◆ UART_FCPARAM_TXXONXOFF_2

#define UART_FCPARAM_TXXONXOFF_2   (0x04U)

◆ UART_FCPARAM_TXXONXOFF_1

#define UART_FCPARAM_TXXONXOFF_1   (0x08U)

◆ UART_FCPARAM_TXXONXOFF_12

#define UART_FCPARAM_TXXONXOFF_12   (0x0CU)

◆ UART_FCPARAM_AUTO_CTS

#define UART_FCPARAM_AUTO_CTS   (0x80U)

◆ UART_RXTRIGLVL_1

#define UART_RXTRIGLVL_1   (1U)

◆ UART_RXTRIGLVL_8

#define UART_RXTRIGLVL_8   (8U)

◆ UART_RXTRIGLVL_16

#define UART_RXTRIGLVL_16   (16U)

◆ UART_RXTRIGLVL_56

#define UART_RXTRIGLVL_56   (56U)

◆ UART_RXTRIGLVL_60

#define UART_RXTRIGLVL_60   (60U)

◆ UART_TXTRIGLVL_1

#define UART_TXTRIGLVL_1   (1U)

◆ UART_TXTRIGLVL_8

#define UART_TXTRIGLVL_8   (8U)

◆ UART_TXTRIGLVL_16

#define UART_TXTRIGLVL_16   (16U)

◆ UART_TXTRIGLVL_32

#define UART_TXTRIGLVL_32   (32U)

◆ UART_TXTRIGLVL_56

#define UART_TXTRIGLVL_56   (56U)

◆ UART_OPER_MODE_16X

#define UART_OPER_MODE_16X   (0U)

◆ UART_OPER_MODE_SIR

#define UART_OPER_MODE_SIR   (1U)

◆ UART_OPER_MODE_16X_AUTO_BAUD

#define UART_OPER_MODE_16X_AUTO_BAUD   (2U)

◆ UART_OPER_MODE_13X

#define UART_OPER_MODE_13X   (3U)

◆ UART_OPER_MODE_MIR

#define UART_OPER_MODE_MIR   (4U)

◆ UART_OPER_MODE_FIR

#define UART_OPER_MODE_FIR   (5U)

◆ UART_OPER_MODE_CIR

#define UART_OPER_MODE_CIR   (6U)

◆ UART_OPER_MODE_DISABLED

#define UART_OPER_MODE_DISABLED   (7U)

◆ UART_TX_FIFO_NOT_FULL

#define UART_TX_FIFO_NOT_FULL
Value:
( \
UART_SSR_TX_FIFO_FULL_TX_FIFO_FULL_VALUE_0)

◆ UART_TX_FIFO_FULL

#define UART_TX_FIFO_FULL
Value:
( \
UART_SSR_TX_FIFO_FULL_TX_FIFO_FULL_VALUE_1)

◆ UART_INTID_MODEM_STAT

#define UART_INTID_MODEM_STAT
Value:
(UART_IIR_IT_TYPE_IT_TYPE_VALUE_0 \
<< \
UART_IIR_IT_TYPE_SHIFT)

Values pertaining to status of UART Interrupt sources.

◆ UART_INTID_TX_THRES_REACH

#define UART_INTID_TX_THRES_REACH
Value:
(UART_IIR_IT_TYPE_IT_TYPE_VALUE_1 \
<< \
UART_IIR_IT_TYPE_SHIFT)

◆ UART_INTID_RX_THRES_REACH

#define UART_INTID_RX_THRES_REACH
Value:
(UART_IIR_IT_TYPE_IT_TYPE_VALUE_2 \
<< \
UART_IIR_IT_TYPE_SHIFT)

◆ UART_INTID_RX_LINE_STAT_ERROR

#define UART_INTID_RX_LINE_STAT_ERROR
Value:
(UART_IIR_IT_TYPE_IT_TYPE_VALUE_3 \
<< \
UART_IIR_IT_TYPE_SHIFT)

◆ UART_INTID_CHAR_TIMEOUT

#define UART_INTID_CHAR_TIMEOUT
Value:
(UART_IIR_IT_TYPE_IT_TYPE_VALUE_6 \
<< \
UART_IIR_IT_TYPE_SHIFT)

◆ UART_INTID_XOFF_SPEC_CHAR_DETECT

#define UART_INTID_XOFF_SPEC_CHAR_DETECT
Value:
(UART_IIR_IT_TYPE_IT_TYPE_VALUE_8 \
<< \
UART_IIR_IT_TYPE_SHIFT)

◆ UART_INTID_MODEM_SIG_STATE_CHANGE

#define UART_INTID_MODEM_SIG_STATE_CHANGE
Value:
(UART_IIR_IT_TYPE_IT_TYPE_VALUE_10 \
<< \
UART_IIR_IT_TYPE_SHIFT)

◆ UART_INTR_PENDING

#define UART_INTR_PENDING   (0U)

Values indicating the UART Interrupt pending status.

◆ UART_N0_INTR_PENDING

#define UART_N0_INTR_PENDING   (1U)

◆ UART_INTR_CTS

#define UART_INTR_CTS   (UART_IER_CTS_IT_MASK)

Values for enabling/disabling the interrupts of UART.

◆ UART_INTR_RTS

#define UART_INTR_RTS   (UART_IER_RTS_IT_MASK)

◆ UART_INTR_XOFF

#define UART_INTR_XOFF   (UART_IER_XOFF_IT_MASK)

◆ UART_INTR_SLEEPMODE

#define UART_INTR_SLEEPMODE   (UART_IER_SLEEP_MODE_MASK)

◆ UART_INTR_MODEM_STAT

#define UART_INTR_MODEM_STAT   (UART_IER_MODEM_STS_IT_MASK)

◆ UART_INTR_LINE_STAT

#define UART_INTR_LINE_STAT   (UART_IER_LINE_STS_IT_MASK)

◆ UART_INTR_THR

#define UART_INTR_THR   (UART_IER_THR_IT_MASK)

◆ UART_INTR_RHR_CTI

#define UART_INTR_RHR_CTI   (UART_IER_RHR_IT_MASK)

◆ UART_INTR2_RX_EMPTY

#define UART_INTR2_RX_EMPTY   (UART_IER2_EN_RXFIFO_EMPTY_MASK)

◆ UART_INTR2_TX_EMPTY

#define UART_INTR2_TX_EMPTY   (UART_IER2_EN_TXFIFO_EMPTY_MASK)

◆ UART_FIFO_PE_FE_BI_DETECTED

#define UART_FIFO_PE_FE_BI_DETECTED   (UART_LSR_RX_FIFO_STS_MASK)

Values pertaining to UART Line Status information.

◆ UART_BREAK_DETECTED_ERROR

#define UART_BREAK_DETECTED_ERROR   (UART_LSR_RX_BI_MASK)

◆ UART_FRAMING_ERROR

#define UART_FRAMING_ERROR   (UART_LSR_RX_FE_MASK)

◆ UART_PARITY_ERROR

#define UART_PARITY_ERROR   (UART_LSR_RX_PE_MASK)

◆ UART_OVERRUN_ERROR

#define UART_OVERRUN_ERROR   (UART_LSR_RX_OE_MASK)

◆ UART_REG_CONFIG_MODE_A

#define UART_REG_CONFIG_MODE_A   ((uint32_t) 0x0080)

Values to be used while switching between register configuration modes.

◆ UART_REG_CONFIG_MODE_B

#define UART_REG_CONFIG_MODE_B   ((uint32_t) 0x00BF)

◆ UART_REG_OPERATIONAL_MODE

#define UART_REG_OPERATIONAL_MODE   ((uint32_t) 0x007F)

◆ UART_CONFIG_MODE_POLLED

#define UART_CONFIG_MODE_POLLED   (0x00U)

◆ UART_CONFIG_MODE_INTERRUPT

#define UART_CONFIG_MODE_INTERRUPT   (0x01U)

◆ UART_CONFIG_MODE_USER_INTR

#define UART_CONFIG_MODE_USER_INTR   (0x02U)

◆ UART_CONFIG_MODE_DMA

#define UART_CONFIG_MODE_DMA   (0x03U)

◆ UART_STATE_RX_DISABLED

#define UART_STATE_RX_DISABLED   (0x0U)

◆ UART_STATE_RX_ENABLED

#define UART_STATE_RX_ENABLED   (0x1U)

Typedef Documentation

◆ UART_DmaHandle

typedef void* UART_DmaHandle

A handle that is returned from a UART_open() call.

◆ UART_DmaChConfig

typedef void* UART_DmaChConfig

◆ UART_clockGet

typedef uint32_t(* UART_clockGet) (void)

◆ UART_clockUsecToTick

typedef uint32_t(* UART_clockUsecToTick) (uint64_t usecs)

◆ UART_readCompCallbackFxn

typedef void(* UART_readCompCallbackFxn) (void *hUart)

The definition of a read complete callback function used by the UART driver when used in UART_TRANSFER_MODE_CALLBACK.

Parameters
void*void pointer

◆ UART_writeCompCallbackFxn

typedef void(* UART_writeCompCallbackFxn) (void *hUart)

The definition of a write complete callback function used by the UART driver when used in UART_TRANSFER_MODE_CALLBACK.

Parameters
void*void pointer

◆ UART_errorCallbackFxn

typedef void(* UART_errorCallbackFxn) (void *hUart)

The definition of a error callback function used by the UART driver when used in UART_TRANSFER_MODE_CALLBACK.

Parameters
void*void pointer

◆ UARTLLD_InitHandle

◆ UARTLLD_Handle

typedef struct UARTLLD_Object * UARTLLD_Handle

Function Documentation

◆ UART_operatingModeSelect()

uint32_t UART_operatingModeSelect ( uint32_t  baseAddr,
uint32_t  modeFlag 
)

◆ UART_spaceAvail()

uint32_t UART_spaceAvail ( uint32_t  baseAddr)

◆ UART_writeCancelNoCB()

int32_t UART_writeCancelNoCB ( UARTLLD_Handle  hUart)

◆ UART_readCancelNoCB()

int32_t UART_readCancelNoCB ( UARTLLD_Handle  hUart)

◆ UART_getBaseAddr_lld()

uint32_t UART_getBaseAddr_lld ( UARTLLD_Handle  handle)

Function to get base address of UART instance of a particular handle.

Parameters
handleUARTLLD_Handle returned from UART_open()
See also
UART_open

◆ UART_enableLoopbackMode()

void UART_enableLoopbackMode ( uint32_t  baseAddr)

Function to enable loopback mode. This function is for internal use. Not recommended for customers to use.

Parameters
baseAddrMemory address of the UART instance being used.
See also
UART_open

◆ UART_disableLoopbackMode()

void UART_disableLoopbackMode ( uint32_t  baseAddr)

Function to disable loopback mode. This function is for internal use. Not recommended for customers to use.

Parameters
baseAddrMemory address of the UART instance being used.
See also
UART_open

◆ UART_lld_init()

int32_t UART_lld_init ( UARTLLD_Handle  hUart)

This API Initializes the UART instance.

Parameters
hUartHandle to the UART instance used
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_initDma()

int32_t UART_lld_initDma ( UARTLLD_Handle  hUart)

This API Initializes the UART instance in DMA mode.

Parameters
hUartHandle to the UART instance used
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_deInit()

int32_t UART_lld_deInit ( UARTLLD_Handle  hUart)

This API De-Initializes the UART instance.

Parameters
hUartHandle to the UART instance used
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_deInitDma()

int32_t UART_lld_deInitDma ( UARTLLD_Handle  hUart)

This API De-Initializes the UART instance in DMA mode.

Parameters
hUartHandle to the UART instance used
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_write()

int32_t UART_lld_write ( UARTLLD_Handle  hUart,
void *  txBuf,
uint32_t  size,
uint32_t  timeout,
const UART_ExtendedParams extendedParams 
)

This API writes data to the UART instance in Polling mode.

Parameters
hUartHandle to the UART instance used
txBufPointer to write data buffer
sizeData size to be transferred
timeoutWrite timeout value
extendedParamsStructure to hold the extended parameters
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_writeIntr()

int32_t UART_lld_writeIntr ( UARTLLD_Handle  hUart,
void *  txBuf,
uint32_t  size,
const UART_ExtendedParams extendedParams 
)

This API writes data to the UART instance in Interrupt mode.

Parameters
hUartHandle to the UART instance used
txBufPointer to write data buffer
sizeData size to be transferred
extendedParamsStructure to hold the extended parameters
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_writeDma()

int32_t UART_lld_writeDma ( UARTLLD_Handle  hUart,
void *  txBuf,
uint32_t  size,
const UART_ExtendedParams extendedParams 
)

This API writes data to the UART instance in DMA mode.

Parameters
hUartHandle to the UART instance used
txBufPointer to write data buffer
sizeData size to be transferred
extendedParamsStructure to hold the extended parameters
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_read()

int32_t UART_lld_read ( UARTLLD_Handle  hUart,
void *  rxBuf,
uint32_t  size,
uint32_t  timeout,
const UART_ExtendedParams extendedParams 
)

This API writes data to the UART instance in Polling mode.

Parameters
hUartHandle to the UART instance used
rxBufPointer to read data buffer
sizeData size to be transferred
timeoutWrite timeout value
extendedParamsStructure to hold the extended parameters
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_readIntr()

int32_t UART_lld_readIntr ( UARTLLD_Handle  hUart,
void *  rxBuf,
uint32_t  size,
const UART_ExtendedParams extendedParams 
)

This API writes data to the UART instance in Interrupt mode.

Parameters
hUartHandle to the UART instance used
rxBufPointer to read data buffer
sizeData size to be transferred
extendedParamsStructure to hold the extended parameters
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_readDma()

int32_t UART_lld_readDma ( UARTLLD_Handle  hUart,
void *  rxBuf,
uint32_t  size,
const UART_ExtendedParams extendedParams 
)

This API writes data to the UART instance in DMA mode.

Parameters
hUartHandle to the UART instance used
rxBufPointer to read data buffer
sizeData size to be transferred
extendedParamsStructure to hold the extended parameters
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_writeCancel()

int32_t UART_lld_writeCancel ( UARTLLD_Handle  hUart,
UART_Transaction trans 
)

This API cancels current UART Write.

Parameters
hUartHandle to the UART instance used
transPointer to UART_Transaction structure
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_readCancel()

int32_t UART_lld_readCancel ( UARTLLD_Handle  hUart,
UART_Transaction trans 
)

This API cancels current UART Read.

Parameters
hUartHandle to the UART instance used
transPointer to UART_Transaction structure
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_flushTxFifo()

int32_t UART_lld_flushTxFifo ( UARTLLD_Handle  hUart)

Function to flush a TX FIFO of peripheral specified by the UART handle.

Parameters
hUartHandle to the UART instance used
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_procLineStatusErr()

int32_t UART_procLineStatusErr ( UARTLLD_Handle  hUart)

Function to check various error conditions in uart.

Parameters
hUartHandle to the UART instance used
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_setRxState()

int32_t UART_lld_setRxState ( UARTLLD_Handle  hUart,
uint32_t  state 
)

Function to enable/disable UART RX.

Parameters
hUartHandle to the UART instance used
stateEnable/Disable UART interrupt
Returns
SystemP_SUCCESS if successful; else error on failure

◆ UART_lld_controllerIsr()

void UART_lld_controllerIsr ( void *  args)

This is the UART ISR and can be used as IRQ handler.

Parameters
argsArgument to the ISR.

◆ UART_intrDisable()

void UART_intrDisable ( uint32_t  baseAddr,
uint32_t  intrFlag 
)

This API disables the specified interrupts in the UART mode of operation.

Parameters
baseAddrMemory address of the UART instance being used.
intrFlagBit mask value of the bits corresponding to Interrupt Enable Register(IER). This specifies the UART interrupts to be disabled.

'intrFlag' can take one or a combination of the following macros:

  • UART_INTR_CTS - to disable Clear-To-Send interrupt,
  • UART_INTR_RTS - to disable Request-To-Send interrupt,
  • UART_INTR_XOFF - to disable XOFF interrupt,
  • UART_INTR_SLEEPMODE - to disable Sleep Mode,
  • UART_INTR_MODEM_STAT - to disable Modem Status interrupt,
  • UART_INTR_LINE_STAT - to disable Line Status interrupt,
  • UART_INTR_THR - to disable Transmitter Holding Register Empty interrupt,
  • UART_INTR_RHR_CTI - to disable Receiver Data available interrupt and Character timeout indication interrupt.
Note
The note section of UART_intrEnable() also applies to this API.
See also
UART_open

◆ UART_intr2Disable()

void UART_intr2Disable ( uint32_t  baseAddr,
uint32_t  intrFlag 
)

This API disables the specified interrupts in the UART mode of operation for IER2.

Parameters
baseAddrMemory address of the UART instance being used.
intrFlagBit mask value of the bits corresponding to Interrupt Enable Register(IER2). This specifies the UART interrupts to be disabled.

'intrFlag' can take one or a combination of the following macros:

  • UART_INTR2_RX_EMPTY - to enable receive FIFO empty interrupt
  • UART_INTR2_TX_EMPTY - to enable TX FIFO empty interrupt
Note
The note section of UART_intr2Enable() also applies to this API.
See also
UART_open

◆ UART_checkCharsAvailInFifo()

uint32_t UART_checkCharsAvailInFifo ( uint32_t  baseAddr)

This API checks if the RX FIFO (or RHR in non-FIFO mode) has atleast one byte of data to be read.

Parameters
baseAddrMemory address of the UART instance being used.
Returns
TRUE - if there is atleast one data byte present in the RX FIFO (or RHR in non-FIFO mode)
FALSE - if there are no data bytes present in the RX FIFO(or RHR in non-FIFO mode)
See also
UART_open

◆ UART_readLineStatus()

uint32_t UART_readLineStatus ( uint32_t  baseAddr)

This API reads the line status register value.

Parameters
baseAddrMemory address of the UART instance being used.
Returns
This returns the line status register value.
See also
UART_open

◆ UART_getCharFifo()

uint8_t UART_getCharFifo ( uint32_t  baseAddr,
uint8_t *  readBuf 
)

This API reads the data present at the top of the RX FIFO, that is, the data in the Receive Holding Register(RHR). However before reading the data from RHR, it checks for RX error.

Parameters
baseAddrMemory address of the UART instance being used.
readBufPointer to the byte buffer to be read from RHR register.
Returns
The data read from the RHR.
See also
UART_open

◆ UART_putChar()

void UART_putChar ( uint32_t  baseAddr,
uint8_t  byteTx 
)

This API writes a byte to the Transmitter FIFO without checking for the emptiness of the Transmitter FIFO or the Transmitter Shift Register(TSR).

Parameters
baseAddrMemory address of the UART instance being used.
byteTxThe byte to be transmitted by the UART.
Note
Unlike the APIs UARTCharPut() or UARTCharPutNonBlocking(), this API does not check for the emptiness of the TX FIFO or TSR. This API is ideal for use in FIFO mode of operation where the 64-byte TX FIFO has to be written with successive bytes. If transmit interrupt is enabled, it provides a mechanism to control the writes to the TX FIFO.
See also
UART_open

◆ UART_intrEnable()

void UART_intrEnable ( uint32_t  baseAddr,
uint32_t  intrFlag 
)

This API enables the specified interrupts in the UART mode of operation.

Parameters
baseAddrMemory address of the UART instance being used.
intrFlagBit mask value of the bits corresponding to Interrupt Enable Register(IER). This specifies the UART interrupts to be enabled.

'intrFlag' can take one or a combination of the following macros:

  • UART_INTR_CTS - to enable Clear-To-Send interrupt,
  • UART_INTR_RTS - to enable Request-To-Send interrupt,
  • UART_INTR_XOFF - to enable XOFF interrupt,
  • UART_INTR_SLEEPMODE - to enable Sleep Mode,
  • UART_INTR_MODEM_STAT - to enable Modem Status interrupt,
  • UART_INTR_LINE_STAT - to enable Line Status interrupt,
  • UART_INTR_THR - to enable Transmitter Holding Register Empty interrupt,
  • UART_INTR_RHR_CTI - to enable Receiver Data available interrupt and Character timeout indication interrupt.
Note
This API modifies the contents of UART Interrupt Enable Register (IER). Modifying the bits IER[7:4] requires that EFR[4] be set. This API does the needful before it accesses IER. Moreover, this API should be called when UART is operating in UART 16x Mode, UART 13x Mode or UART 16x Auto-baud mode.
See also
UART_open

◆ UART_getChar()

uint32_t UART_getChar ( uint32_t  baseAddr,
uint8_t *  pChar 
)

This API reads a byte from the Receiver Buffer Register (RBR). It checks once if any character is ready to be read.

Parameters
baseAddrMemory address of the UART instance being used.
pCharPointer to the byte variable which saves the byte read from RBR if there is any char ready to be read
Returns
If the RX FIFO(or RHR) was found to have atleast one byte of data, then this API returns TRUE. Else it returns FALSE.
See also
UART_open

◆ UART_getIntr2Status()

uint32_t UART_getIntr2Status ( uint32_t  baseAddr)

This API determines the UART Interrupt Status 2.

Parameters
baseAddrMemory address of the UART instance being used.
Returns
This returns one or a combination of the following macros:
  • UART_INTR2_RX_EMPTY - to enable receive FIFO empty interrupt
  • UART_INTR2_TX_EMPTY - to enable TX FIFO empty interrupt
See also
UART_open

◆ UART_getIntrIdentityStatus()

uint32_t UART_getIntrIdentityStatus ( uint32_t  baseAddr)

This API determines the UART Interrupt Status.

Parameters
baseAddrMemory address of the UART instance being used.
Returns
This returns one or a combination of the following macros:
  • UART_INTID_MODEM_STAT - indicating the occurence of a Modem Status interrupt
  • UART_INTID_TX_THRES_REACH - indicating that the TX FIFO Threshold number of bytes can be written to the TX FIFO.
  • UART_INTID_RX_THRES_REACH - indicating that the RX FIFO has reached its programmed Trigger Level
  • UART_INTID_RX_LINE_STAT_ERROR - indicating the occurence of a receiver Line Status error
  • UART_INTID_CHAR_TIMEOUT - indicating the occurence of a Receiver Timeout
  • UART_INTID_XOFF_SPEC_CHAR_DETECT - indicating the detection of XOFF or a Special character
  • UART_INTID_MODEM_SIG_STATE_CHANGE - indicating that atleast one of the Modem signals among CTSn, RTSn and DSRn have changed states from active(low) to inactive(high)
See also
UART_open

◆ UART_intr2Enable()

void UART_intr2Enable ( uint32_t  baseAddr,
uint32_t  intrFlag 
)

This API enables the specified interrupts in the UART mode of operation for IER2.

Parameters
baseAddrMemory address of the UART instance being used.
intrFlagBit mask value of the bits corresponding to Interrupt Enable Register(IER2). This specifies the UART interrupts to be enabled.

'intrFlag' can take one or a combination of the following macros:

  • UART_INTR2_RX_EMPTY - to enable receive FIFO empty interrupt
  • UART_INTR2_TX_EMPTY - to enable TX FIFO empty interrupt
Note
This API modifies the contents of UART Interrupt Enable Register 2 (IER2).
See also
UART_open

◆ UART_lld_Transaction_init()

void UART_lld_Transaction_init ( UART_Transaction trans)

Function to initialize the UART_Transaction struct to its defaults.

Parameters
transPointer to UART_Transaction structure for initialization

◆ UART_lld_Transaction_deInit()

void UART_lld_Transaction_deInit ( UART_Transaction trans)

Function to de-initialize the UART_Transaction struct to its defaults.

Parameters
transPointer to UART_Transaction structure for initialization