|
AM64x MCU+ SDK
10.00.00
|
|
Go to the documentation of this file.
56 #include <drivers/hw_include/cslr.h>
57 #include <drivers/hw_include/cslr_uart.h>
58 #include <drivers/hw_include/hw_types.h>
74 #define UART_FIFO_SIZE (64U)
81 #define UART_TRANSMITEMPTY_TRIALCOUNT (3000U)
84 #define UART_ERROR_COUNT (0x00FFFFFFU)
95 #define UART_STATUS_SUCCESS ((int32_t)0)
97 #define UART_STATUS_FAILURE ((int32_t)-1)
99 #define UART_TRANSFER_STATUS_SUCCESS ((int32_t)0)
101 #define UART_TRANSFER_STATUS_FAILURE ((int32_t)-1)
107 #define UART_WAIT_FOREVER ((int32_t)-1)
111 #define UART_INVALID_PARAM ((int32_t)-3)
116 #define UART_TRANSFER_BUSY ((int32_t)-4)
122 #define UART_TRANSFER_TIMEOUT ((int32_t)-2)
128 #define UART_TRANSFER_INVALID_STATE ((int32_t)-5)
130 #define UART_TRANSFER_STATUS_TIMEOUT (1U)
132 #define UART_TRANSFER_STATUS_ERROR_BI (2U)
134 #define UART_TRANSFER_STATUS_ERROR_FE (3U)
136 #define UART_TRANSFER_STATUS_ERROR_PE (4U)
138 #define UART_TRANSFER_STATUS_ERROR_OE (5U)
140 #define UART_TRANSFER_STATUS_CANCELLED (6U)
142 #define UART_TRANSFER_STATUS_STARTED (7U)
144 #define UART_TRANSFER_STATUS_READ_TIMEOUT (8U)
146 #define UART_TRANSFER_STATUS_ERROR_INUSE (9U)
148 #define UART_TRANSFER_STATUS_ERROR_OTH (10U)
171 #define UART_READ_RETURN_MODE_FULL (0U)
175 #define UART_READ_RETURN_MODE_PARTIAL (1U)
186 #define UART_LEN_5 (0U)
187 #define UART_LEN_6 (1U)
188 #define UART_LEN_7 (2U)
189 #define UART_LEN_8 (3U)
200 #define UART_STATE_RESET (0U)
201 #define UART_STATE_READY (1U)
202 #define UART_STATE_BUSY (2U)
203 #define UART_STATE_ERROR (3U)
209 #define UART_NOT_IN_USE(x) (void) 0
218 #define UART_STOPBITS_1 (0U)
219 #define UART_STOPBITS_2 (1U)
220 #define UART_STOPBITS_1P5 (UART_STOPBITS_1)
231 #define UART_PARITY_NONE (0x00U)
232 #define UART_PARITY_ODD (0x01U)
233 #define UART_PARITY_EVEN (0x03U)
234 #define UART_PARITY_FORCED0 (0x07U)
235 #define UART_PARITY_FORCED1 (0x05U)
246 #define UART_FCTYPE_NONE (0x00U)
247 #define UART_FCTYPE_HW (0x02U)
258 #define UART_FCPARAM_RXNONE (0x00U)
259 #define UART_FCPARAM_RXXONXOFF_2 (0x01U)
260 #define UART_FCPARAM_RXXONXOFF_1 (0x02U)
261 #define UART_FCPARAM_RXXONXOFF_12 (0x03U)
262 #define UART_FCPARAM_AUTO_RTS (0x40U)
273 #define UART_FCPARAM_TXNONE (0x00U)
274 #define UART_FCPARAM_TXXONXOFF_2 (0x04U)
275 #define UART_FCPARAM_TXXONXOFF_1 (0x08U)
276 #define UART_FCPARAM_TXXONXOFF_12 (0x0CU)
277 #define UART_FCPARAM_AUTO_CTS (0x80U)
288 #define UART_RXTRIGLVL_1 (1U)
289 #define UART_RXTRIGLVL_8 (8U)
290 #define UART_RXTRIGLVL_16 (16U)
291 #define UART_RXTRIGLVL_56 (56U)
292 #define UART_RXTRIGLVL_60 (60U)
303 #define UART_TXTRIGLVL_1 (1U)
304 #define UART_TXTRIGLVL_8 (8U)
305 #define UART_TXTRIGLVL_16 (16U)
306 #define UART_TXTRIGLVL_32 (32U)
307 #define UART_TXTRIGLVL_56 (56U)
318 #define UART_OPER_MODE_16X (0U)
319 #define UART_OPER_MODE_SIR (1U)
320 #define UART_OPER_MODE_16X_AUTO_BAUD (2U)
321 #define UART_OPER_MODE_13X (3U)
322 #define UART_OPER_MODE_MIR (4U)
323 #define UART_OPER_MODE_FIR (5U)
324 #define UART_OPER_MODE_CIR (6U)
325 #define UART_OPER_MODE_DISABLED (7U)
337 #define UART_TX_FIFO_NOT_FULL ( \
338 UART_SSR_TX_FIFO_FULL_TX_FIFO_FULL_VALUE_0)
339 #define UART_TX_FIFO_FULL ( \
340 UART_SSR_TX_FIFO_FULL_TX_FIFO_FULL_VALUE_1)
351 #define UART_INTID_MODEM_STAT (UART_IIR_IT_TYPE_IT_TYPE_VALUE_0 \
353 UART_IIR_IT_TYPE_SHIFT)
354 #define UART_INTID_TX_THRES_REACH (UART_IIR_IT_TYPE_IT_TYPE_VALUE_1 \
356 UART_IIR_IT_TYPE_SHIFT)
357 #define UART_INTID_RX_THRES_REACH (UART_IIR_IT_TYPE_IT_TYPE_VALUE_2 \
359 UART_IIR_IT_TYPE_SHIFT)
360 #define UART_INTID_RX_LINE_STAT_ERROR (UART_IIR_IT_TYPE_IT_TYPE_VALUE_3 \
362 UART_IIR_IT_TYPE_SHIFT)
363 #define UART_INTID_CHAR_TIMEOUT (UART_IIR_IT_TYPE_IT_TYPE_VALUE_6 \
365 UART_IIR_IT_TYPE_SHIFT)
366 #define UART_INTID_XOFF_SPEC_CHAR_DETECT (UART_IIR_IT_TYPE_IT_TYPE_VALUE_8 \
368 UART_IIR_IT_TYPE_SHIFT)
369 #define UART_INTID_MODEM_SIG_STATE_CHANGE (UART_IIR_IT_TYPE_IT_TYPE_VALUE_10 \
371 UART_IIR_IT_TYPE_SHIFT)
374 #define UART_INTR_PENDING (0U)
375 #define UART_N0_INTR_PENDING (1U)
385 #define UART_INTR_CTS (UART_IER_CTS_IT_MASK)
386 #define UART_INTR_RTS (UART_IER_RTS_IT_MASK)
387 #define UART_INTR_XOFF (UART_IER_XOFF_IT_MASK)
388 #define UART_INTR_SLEEPMODE (UART_IER_SLEEP_MODE_MASK)
389 #define UART_INTR_MODEM_STAT (UART_IER_MODEM_STS_IT_MASK)
390 #define UART_INTR_LINE_STAT (UART_IER_LINE_STS_IT_MASK)
391 #define UART_INTR_THR (UART_IER_THR_IT_MASK)
392 #define UART_INTR_RHR_CTI (UART_IER_RHR_IT_MASK)
394 #define UART_INTR2_RX_EMPTY (UART_IER2_EN_RXFIFO_EMPTY_MASK)
395 #define UART_INTR2_TX_EMPTY (UART_IER2_EN_TXFIFO_EMPTY_MASK)
405 #define UART_FIFO_PE_FE_BI_DETECTED (UART_LSR_RX_FIFO_STS_MASK)
406 #define UART_BREAK_DETECTED_ERROR (UART_LSR_RX_BI_MASK)
407 #define UART_FRAMING_ERROR (UART_LSR_RX_FE_MASK)
408 #define UART_PARITY_ERROR (UART_LSR_RX_PE_MASK)
409 #define UART_OVERRUN_ERROR (UART_LSR_RX_OE_MASK)
419 #define UART_REG_CONFIG_MODE_A ((uint32_t) 0x0080)
420 #define UART_REG_CONFIG_MODE_B ((uint32_t) 0x00BF)
421 #define UART_REG_OPERATIONAL_MODE ((uint32_t) 0x007F)
433 #define UART_CONFIG_MODE_POLLED (0x00U)
434 #define UART_CONFIG_MODE_INTERRUPT (0x01U)
435 #define UART_CONFIG_MODE_USER_INTR (0x02U)
436 #define UART_CONFIG_MODE_DMA (0x03U)
437 #define UART_CONFIG_MODE_POLLED_WITH_COUNTER (0x04U)
440 #define UART_STATE_RX_DISABLED (0x0U)
441 #define UART_STATE_RX_ENABLED (0x1U)
446 typedef struct UART_ExtendedParams_s
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.
int32_t UART_writeCancelNoCB(UARTLLD_Handle hUart)
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.
uint32_t operMode
Definition: uart_lld.h:541
Definition: uart_lld.h:447
void(* UART_readCompCallbackFxn)(void *hUart)
The definition of a read complete callback function used by the UART driver when used in UART_TRANSFE...
Definition: uart_lld.h:482
uint32_t rxTimeoutCnt
Definition: uart_lld.h:602
int32_t UART_lld_deInit(UARTLLD_Handle hUart)
This API De-Initializes the UART instance.
uint16_t size
Definition: tisci_boardcfg.h:1
void UART_lld_Transaction_init(UART_Transaction *trans)
Function to initialize the UART_Transaction struct to its defaults.
uint32_t readErrorCnt
Definition: uart_lld.h:604
int32_t UART_readCancelNoCB(UARTLLD_Handle hUart)
uint32_t readSizeRemaining
Definition: uart_lld.h:600
int32_t UART_lld_readCancel(UARTLLD_Handle hUart, UART_Transaction *trans)
This API cancels current UART Read.
uint32_t txEvtNum
Definition: uart_lld.h:553
uint32_t transferMode
Definition: uart_lld.h:531
uint32_t UART_readLineStatus(uint32_t baseAddr)
This API reads the line status register value.
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.
UART_writeCompCallbackFxn writeCompleteCallbackFxn
Definition: uart_lld.h:567
uint32_t timeout
Definition: uart_lld.h:465
void * UART_DmaChConfig
Definition: uart_lld.h:71
uint32_t readCount
Definition: uart_lld.h:598
int32_t UART_lld_flushTxFifo(UARTLLD_Handle hUart)
Function to flush a TX FIFO of peripheral specified by the UART handle.
uint32_t dataLength
Definition: uart_lld.h:515
uint32_t rxEvtNum
Definition: uart_lld.h:551
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.
uint32_t baudRate
Definition: uart_lld.h:513
struct UARTLLD_Object * UARTLLD_Handle
UART_DmaHandle uartDmaHandle
Definition: uart_lld.h:555
UART_readCompCallbackFxn readCompleteCallbackFxn
Definition: uart_lld.h:565
uint32_t hwFlowControl
Definition: uart_lld.h:523
void * args
Definition: uart_lld.h:626
uint8_t state
Definition: tisci_pm_clock.h:3
int32_t UART_lld_deInitDma(UARTLLD_Handle hUart)
This API De-Initializes the UART instance in DMA mode.
uint32_t UART_operatingModeSelect(uint32_t baseAddr, uint32_t modeFlag)
int32_t UART_lld_initDma(UARTLLD_Handle hUart)
This API Initializes the UART instance in DMA mode.
UART_clockGet clockP_get
Definition: uart_lld.h:561
UART_clockUsecToTick clockP_usecToTick
Definition: uart_lld.h:563
UART driver initialization object.
Definition: uart_lld.h:507
void * args
Definition: uart_lld.h:469
void UART_intrEnable(uint32_t baseAddr, uint32_t intrFlag)
This API enables the specified interrupts in the UART mode of operation.
uint32_t UART_getIntrIdentityStatus(uint32_t baseAddr)
This API determines the UART Interrupt Status.
void UART_lld_Transaction_deInit(UART_Transaction *trans)
Function to de-initialize the UART_Transaction struct to its defaults.
void * readTransferMutex
Definition: uart_lld.h:621
uint32_t parityType
Definition: uart_lld.h:519
void UART_lld_controllerIsr(void *args)
This is the UART ISR and can be used as IRQ handler.
UART driver object.
Definition: uart_lld.h:577
uint32_t readMode
Definition: uart_lld.h:543
void UART_enableLoopbackMode(uint32_t baseAddr)
Function to enable loopback mode. This function is for internal use. Not recommended for customers to...
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 ...
uint32_t hwFlowControlThr
Definition: uart_lld.h:525
uint32_t stopBits
Definition: uart_lld.h:517
void UART_disableLoopbackMode(uint32_t baseAddr)
Function to disable loopback mode. This function is for internal use. Not recommended for customers t...
UART_errorCallbackFxn errorCallbackFxn
Definition: uart_lld.h:569
uint32_t timeGuardVal
Definition: uart_lld.h:559
uint8_t intrPriority
Definition: uart_lld.h:535
void * readBuf
Definition: uart_lld.h:596
uint32_t UART_getBaseAddr_lld(UARTLLD_Handle handle)
Function to get base address of UART instance of a particular handle.
void(* UART_errorCallbackFxn)(void *hUart)
The definition of a error callback function used by the UART driver when used in UART_TRANSFER_MODE_C...
Definition: uart_lld.h:498
int32_t UART_lld_setRxState(UARTLLD_Handle hUart, uint32_t state)
Function to enable/disable UART RX.
int32_t UART_lld_init(UARTLLD_Handle hUart)
This API Initializes the UART instance.
uint32_t writeMode
Definition: uart_lld.h:545
UART_DmaChConfig dmaChCfg
Definition: uart_lld.h:557
uint32_t status
Definition: uart_lld.h:467
Data structure used with UART_read() and UART_write()
Definition: uart_lld.h:457
uint32_t currIntMask
Definition: uart_lld.h:614
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.
uint32_t UART_getIntr2Status(uint32_t baseAddr)
This API determines the UART Interrupt Status 2.
void UART_intr2Disable(uint32_t baseAddr, uint32_t intrFlag)
This API disables the specified interrupts in the UART mode of operation for IER2.
uint32_t writeSizeRemaining
Definition: uart_lld.h:590
uint32_t UART_IsTxRxFifoEmpty(uint32_t baseAddr)
UARTLLD_InitHandle hUartInit
Definition: uart_lld.h:580
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 rea...
void * writeTransferMutex
Definition: uart_lld.h:623
void(* UART_writeCompCallbackFxn)(void *hUart)
The definition of a write complete callback function used by the UART driver when used in UART_TRANSF...
Definition: uart_lld.h:490
uint32_t state
Definition: uart_lld.h:619
void * UART_DmaHandle
A handle that is returned from a UART_open() call.
Definition: uart_lld.h:69
uint32_t inputClkFreq
Definition: uart_lld.h:511
void UART_intr2Enable(uint32_t baseAddr, uint32_t intrFlag)
This API enables the specified interrupts in the UART mode of operation for IER2.
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.
uint32_t intrNum
Definition: uart_lld.h:533
const void * writeBuf
Definition: uart_lld.h:586
UART_Transaction readTrans
Definition: uart_lld.h:610
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.
uint32_t UART_spaceAvail(uint32_t baseAddr)
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 R...
uint32_t txTrigLvl
Definition: uart_lld.h:549
struct UARTLLD_InitObject * UARTLLD_InitHandle
int32_t UART_lld_writeCancel(UARTLLD_Handle hUart, UART_Transaction *trans)
This API cancels current UART Write.
int32_t UART_lld_readWithCounter(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.
void UART_intrDisable(uint32_t baseAddr, uint32_t intrFlag)
This API disables the specified interrupts in the UART mode of operation.
uint32_t readReturnMode
Definition: uart_lld.h:521
void * buf
Definition: uart_lld.h:458
uint32_t writeCount
Definition: uart_lld.h:588
UART_Transaction writeTrans
Definition: uart_lld.h:612
uint32_t(* UART_clockGet)(void)
Definition: uart_lld.h:473
uint32_t(* UART_clockUsecToTick)(uint64_t usecs)
Definition: uart_lld.h:474
uint32_t rxTrigLvl
Definition: uart_lld.h:547
uint64_t lineStatusTimeout
Definition: uart_lld.h:628
uint32_t count
Definition: uart_lld.h:461
uint32_t baseAddr
Definition: uart_lld.h:578
void * args
Definition: uart_lld.h:448
int32_t UART_procLineStatusErr(UARTLLD_Handle hUart)
Function to check various error conditions in uart.