PAN1080 Peripheral API
Modules | Data Structures | Functions
Uart Interface

Uart Interface. More...

Collaboration diagram for Uart Interface:

Modules

 Uart transmit fifo threshold
 Uart transmit fifo threshold definition.
 
 Uart receive fifo threshold
 Uart receive fifo threshold definition.
 
 Uart line control
 This is the data type used for manipulation of the UART line control settings.
 
 Uart interrupts status
 These are the bit definitions used for managing UART interrupts. The functionality of ETBEI and ERBFI alters when programmable THRE interrupt mode is active (dw_uart_enablePtime()). See the DW_apb_uart databook for a detailed description.
 
 Uart event mode
 This is the data type used for specifying UART events. An event is the occurrence of an interrupt which must be handled appropriately. One of these events is passed at a time to the user listener function to be processed. The exception to this are the UART_EVENT_THR_EMPTY and UART_EVENT_TIMEOUT interrupts which are handled internally by the interrupt handler.
 
 Uart line status
 These are the definitions used for reporting the line status including errors, if any. Note that they represent bits of an 8-bit register and more than one can be active at any time.
 
 Uart modem status
 Uart modem status definitions.
 

Data Structures

struct  UART_InitTypeDef
 Structure with uart init feature. More...
 

Functions

__STATIC_INLINE void UART_EnableStickParity (UART_T *UARTx)
 This function is used to enable stick parity. More...
 
__STATIC_INLINE void UART_DisableStickParity (UART_T *UARTx)
 This function is used to disable stick parity. More...
 
__STATIC_INLINE UART_LineStatusDef UART_GetLineStatus (UART_T *UARTx)
 This function is used to get line status. More...
 
__STATIC_INLINE UART_ModemStatusDef UART_GetModemStatus (UART_T *UARTx)
 
__STATIC_INLINE void UART_EnableFifo (UART_T *UARTx)
 This function enables receive and transmit FIFOs, if they are available. More...
 
__STATIC_INLINE void UART_DisableFifo (UART_T *UARTx)
 This function disables receive and transmit FIFOs. More...
 
__STATIC_INLINE bool UART_IsFifoEnabled (UART_T *UARTx)
 Adjust whether the FIFOs enabled or not. More...
 
__STATIC_INLINE void UART_ResetRxFifo (UART_T *UARTx)
 This function is used to reset rx fifo. More...
 
__STATIC_INLINE void UART_ResetTxFifo (UART_T *UARTx)
 This function is used to reset tx fifo. More...
 
__STATIC_INLINE void UART_SetTxTrigger (UART_T *UARTx, UART_TxTriggerDef level)
 Set the trigger level of the transmitter FIFO empty interrupt. More...
 
__STATIC_INLINE void UART_SetRxTrigger (UART_T *UARTx, UART_RxTriggerDef level)
 Sets the trigger level of the receiver FIFO full interrupt. More...
 
__STATIC_INLINE uint8_t UART_GetTxFifoLevel (UART_T *UARTx)
 Get the transmit fifo level. More...
 
__STATIC_INLINE uint8_t UART_GetRxFifoLevel (UART_T *UARTx)
 Get the receive fifo level. More...
 
__STATIC_INLINE void UART_EnableAfc (UART_T *UARTx)
 Enable auto flow control mode. More...
 
__STATIC_INLINE void UART_DisableAfc (UART_T *UARTx)
 Disable auto flow control mode. More...
 
__STATIC_INLINE bool UART_IsAfcEnabled (UART_T *UARTx)
 Check auto flow control mode enable or not. More...
 
__STATIC_INLINE void UART_SendData (UART_T *UARTx, uint8_t Data)
 Uart send data function. More...
 
__STATIC_INLINE uint8_t UART_ReceiveData (UART_T *UARTx)
 Uart receive data function. More...
 
__STATIC_INLINE void UART_EnablePtime (UART_T *UARTx)
 Programmable THRE interrupt mode enable. More...
 
__STATIC_INLINE void UART_DisablePtime (UART_T *UARTx)
 Programmable THRE interrupt mode disable. More...
 
__STATIC_INLINE bool UART_IsPtimeEnabled (UART_T *UARTx)
 Check programmable THRE interrupt mode enable or not. More...
 
__STATIC_INLINE void UART_EnableIrq (UART_T *UARTx, UART_IrqDef irq)
 Enable interrupt,include Modem status linestatus,THRE,receive data. More...
 
__STATIC_INLINE void UART_DisableIrq (UART_T *UARTx, UART_IrqDef irq)
 Disable interrupt. More...
 
__STATIC_INLINE bool UART_IsIrqEnabled (UART_T *UARTx, UART_IrqDef irq)
 Check interrupt enable or not. More...
 
__STATIC_INLINE uint8_t UART_GetIrqMasked (UART_T *UARTx)
 Get which interrupt is actived. More...
 
__STATIC_INLINE UART_EventDef UART_GetActiveEvent (UART_T *UARTx)
 Get active interrupt ID. More...
 
__STATIC_INLINE bool UART_IsTxFifoEmpty (UART_T *UARTx)
 Check tx fifo empty or not. More...
 
__STATIC_INLINE bool UART_IsTxFifoFull (UART_T *UARTx)
 Check tx fifo full or not. More...
 
__STATIC_INLINE bool UART_IsRxFifoEmpty (UART_T *UARTx)
 Check rx fifo empty or not. More...
 
__STATIC_INLINE bool UART_IsRxFifoFull (UART_T *UARTx)
 Check rx fifo full or not. More...
 
__STATIC_INLINE void UART_EnableHaltTX (UART_T *UARTx)
 Enable halt transmit,this function is used to halt transmit for test. More...
 
__STATIC_INLINE void UART_DisableHaltTX (UART_T *UARTx)
 Disable halt transmit. More...
 
__STATIC_INLINE void UART_EnableRts (UART_T *UARTx)
 Enable request to send in flow control mode. More...
 
__STATIC_INLINE void UART_DisableRts (UART_T *UARTx)
 Disable request to send in flow control mode. More...
 
__STATIC_INLINE void UART_Enable9BitData (UART_T *UARTx)
 Enable 9-bit data transmit and receive transfer. More...
 
__STATIC_INLINE void UART_Disable9BitData (UART_T *UARTx)
 Disable 9-bit data transmit and receive transfer. More...
 
__STATIC_INLINE void UART_EnableAddrMatchMode (UART_T *UARTx)
 Enable address match feature during receive. More...
 
__STATIC_INLINE void UART_DisableAddrMatchMode (UART_T *UARTx)
 Disable address match feature during receive. More...
 
__STATIC_INLINE void UART_SendAddr (UART_T *UARTx)
 UART Send Address,9-bit character will be transmitted with 9-th bit set to 1 and the remaining 8-bits will match to what is being programmed in "Transmit Address Register". More...
 
__STATIC_INLINE void UART_SetReceiveAddress (UART_T *UARTx, uint32_t addr)
 This is an address matching register during receive mode,Set Receive Address. More...
 
__STATIC_INLINE void UART_SetTransmitAddress (UART_T *UARTx, uint32_t addr)
 This is an address matching register during transmit mode,Set transmit address. More...
 
bool UART_Init (UART_T *UARTx, UART_InitTypeDef *UART_InitStruct)
 Initializes the UARTx peripheral according to the specified parameters in the UART_InitStruct . More...
 
void UART_DeInit (UART_T *UARTx)
 Deinit the UARTx peripheral. More...
 
bool UART_SendMultipleData (UART_T *UARTx, uint8_t *Buf, size_t BufSize, size_t SendSize)
 This function is used to send multiple data. More...
 
bool UART_ReceiveMultipleData (UART_T *UARTx, uint8_t *Buf, size_t BufSize, size_t ExpectSize)
 This function is used to receive multiple data. More...
 

Detailed Description

Uart Interface.

Function Documentation

◆ UART_DeInit()

void UART_DeInit ( UART_T *  UARTx)

Deinit the UARTx peripheral.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_Disable9BitData()

__STATIC_INLINE void UART_Disable9BitData ( UART_T *  UARTx)

Disable 9-bit data transmit and receive transfer.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_DisableAddrMatchMode()

__STATIC_INLINE void UART_DisableAddrMatchMode ( UART_T *  UARTx)

Disable address match feature during receive.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_DisableAfc()

__STATIC_INLINE void UART_DisableAfc ( UART_T *  UARTx)

Disable auto flow control mode.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_DisableFifo()

__STATIC_INLINE void UART_DisableFifo ( UART_T *  UARTx)

This function disables receive and transmit FIFOs.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_DisableHaltTX()

__STATIC_INLINE void UART_DisableHaltTX ( UART_T *  UARTx)

Disable halt transmit.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
true or false

◆ UART_DisableIrq()

__STATIC_INLINE void UART_DisableIrq ( UART_T *  UARTx,
UART_IrqDef  irq 
)

Disable interrupt.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
irqinterrupt type,see UART_IrqDef
Returns
none

◆ UART_DisablePtime()

__STATIC_INLINE void UART_DisablePtime ( UART_T *  UARTx)

Programmable THRE interrupt mode disable.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
none

◆ UART_DisableRts()

__STATIC_INLINE void UART_DisableRts ( UART_T *  UARTx)

Disable request to send in flow control mode.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_DisableStickParity()

__STATIC_INLINE void UART_DisableStickParity ( UART_T *  UARTx)

This function is used to disable stick parity.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_Enable9BitData()

__STATIC_INLINE void UART_Enable9BitData ( UART_T *  UARTx)

Enable 9-bit data transmit and receive transfer.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_EnableAddrMatchMode()

__STATIC_INLINE void UART_EnableAddrMatchMode ( UART_T *  UARTx)

Enable address match feature during receive.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_EnableAfc()

__STATIC_INLINE void UART_EnableAfc ( UART_T *  UARTx)

Enable auto flow control mode.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_EnableFifo()

__STATIC_INLINE void UART_EnableFifo ( UART_T *  UARTx)

This function enables receive and transmit FIFOs, if they are available.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_EnableHaltTX()

__STATIC_INLINE void UART_EnableHaltTX ( UART_T *  UARTx)

Enable halt transmit,this function is used to halt transmit for test.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
true or false

◆ UART_EnableIrq()

__STATIC_INLINE void UART_EnableIrq ( UART_T *  UARTx,
UART_IrqDef  irq 
)

Enable interrupt,include Modem status linestatus,THRE,receive data.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
irqinterrupt type,see UART_IrqDef
Returns
none

◆ UART_EnablePtime()

__STATIC_INLINE void UART_EnablePtime ( UART_T *  UARTx)

Programmable THRE interrupt mode enable.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
none

◆ UART_EnableRts()

__STATIC_INLINE void UART_EnableRts ( UART_T *  UARTx)

Enable request to send in flow control mode.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_EnableStickParity()

__STATIC_INLINE void UART_EnableStickParity ( UART_T *  UARTx)

This function is used to enable stick parity.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_GetActiveEvent()

__STATIC_INLINE UART_EventDef UART_GetActiveEvent ( UART_T *  UARTx)

Get active interrupt ID.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
interrupt ID

◆ UART_GetIrqMasked()

__STATIC_INLINE uint8_t UART_GetIrqMasked ( UART_T *  UARTx)

Get which interrupt is actived.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
interrupt type

◆ UART_GetLineStatus()

__STATIC_INLINE UART_LineStatusDef UART_GetLineStatus ( UART_T *  UARTx)

This function is used to get line status.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_GetModemStatus()

__STATIC_INLINE UART_ModemStatusDef UART_GetModemStatus ( UART_T *  UARTx)

◆ UART_GetRxFifoLevel()

__STATIC_INLINE uint8_t UART_GetRxFifoLevel ( UART_T *  UARTx)

Get the receive fifo level.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
the number of characters currently present in the Rx fifo.

◆ UART_GetTxFifoLevel()

__STATIC_INLINE uint8_t UART_GetTxFifoLevel ( UART_T *  UARTx)

Get the transmit fifo level.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
how many bytes deep the transmitter and receiver FIFOs are

◆ UART_Init()

bool UART_Init ( UART_T *  UARTx,
UART_InitTypeDef UART_InitStruct 
)

Initializes the UARTx peripheral according to the specified parameters in the UART_InitStruct .

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
UART_InitStructpointer to a UART_InitTypeDef structure that contains the configuration information for the specified UART peripheral.
Returns
UART init success (true) or fail (false)
UART_InitTypeDef Init_Struct;
Init_Struct.UART_BaudRate = 115200;
UART_Init(UART1, &Init_Struct);
@ Uart_Line_8n1
Definition: pan_uart.h:90
bool UART_Init(UART_T *UARTx, UART_InitTypeDef *UART_InitStruct)
Initializes the UARTx peripheral according to the specified parameters in the UART_InitStruct .
__STATIC_INLINE void UART_EnableFifo(UART_T *UARTx)
This function enables receive and transmit FIFOs, if they are available.
Definition: pan_uart.h:242
Structure with uart init feature.
Definition: pan_uart.h:189
UART_LineCtrlDef UART_LineCtrl
Definition: pan_uart.h:191
uint32_t UART_BaudRate
Definition: pan_uart.h:190

◆ UART_IsAfcEnabled()

__STATIC_INLINE bool UART_IsAfcEnabled ( UART_T *  UARTx)

Check auto flow control mode enable or not.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_IsFifoEnabled()

__STATIC_INLINE bool UART_IsFifoEnabled ( UART_T *  UARTx)

Adjust whether the FIFOs enabled or not.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_IsIrqEnabled()

__STATIC_INLINE bool UART_IsIrqEnabled ( UART_T *  UARTx,
UART_IrqDef  irq 
)

Check interrupt enable or not.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
irqinterrupt type,see UART_IrqDef
Returns
none

◆ UART_IsPtimeEnabled()

__STATIC_INLINE bool UART_IsPtimeEnabled ( UART_T *  UARTx)

Check programmable THRE interrupt mode enable or not.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
none

◆ UART_IsRxFifoEmpty()

__STATIC_INLINE bool UART_IsRxFifoEmpty ( UART_T *  UARTx)

Check rx fifo empty or not.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
true or false

◆ UART_IsRxFifoFull()

__STATIC_INLINE bool UART_IsRxFifoFull ( UART_T *  UARTx)

Check rx fifo full or not.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
true or false

◆ UART_IsTxFifoEmpty()

__STATIC_INLINE bool UART_IsTxFifoEmpty ( UART_T *  UARTx)

Check tx fifo empty or not.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
true or false

◆ UART_IsTxFifoFull()

__STATIC_INLINE bool UART_IsTxFifoFull ( UART_T *  UARTx)

Check tx fifo full or not.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
true or false

◆ UART_ReceiveData()

__STATIC_INLINE uint8_t UART_ReceiveData ( UART_T *  UARTx)

Uart receive data function.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
received data

◆ UART_ReceiveMultipleData()

bool UART_ReceiveMultipleData ( UART_T *  UARTx,
uint8_t *  Buf,
size_t  BufSize,
size_t  ExpectSize 
)

This function is used to receive multiple data.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Bufpointer to receive data storage location
BufSizeused to indicate the offset of buf
ExpectSizeused to indicate the size expect to receive
Returns
Receive success (true) or fail (false)

◆ UART_ResetRxFifo()

__STATIC_INLINE void UART_ResetRxFifo ( UART_T *  UARTx)

This function is used to reset rx fifo.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_ResetTxFifo()

__STATIC_INLINE void UART_ResetTxFifo ( UART_T *  UARTx)

This function is used to reset tx fifo.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_SendAddr()

__STATIC_INLINE void UART_SendAddr ( UART_T *  UARTx)

UART Send Address,9-bit character will be transmitted with 9-th bit set to 1 and the remaining 8-bits will match to what is being programmed in "Transmit Address Register".

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Returns
None

◆ UART_SendData()

__STATIC_INLINE void UART_SendData ( UART_T *  UARTx,
uint8_t  Data 
)

Uart send data function.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Datadata need to seed
Returns
None

◆ UART_SendMultipleData()

bool UART_SendMultipleData ( UART_T *  UARTx,
uint8_t *  Buf,
size_t  BufSize,
size_t  SendSize 
)

This function is used to send multiple data.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
Bufpointer to send data storage location.
BufSizeused to indicate the offset of buf.
SendSizeused to indicate the size need to send.
Returns
Send success (true) or fail (false)

◆ UART_SetReceiveAddress()

__STATIC_INLINE void UART_SetReceiveAddress ( UART_T *  UARTx,
uint32_t  addr 
)

This is an address matching register during receive mode,Set Receive Address.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
addrReceive Address
Returns
None

◆ UART_SetRxTrigger()

__STATIC_INLINE void UART_SetRxTrigger ( UART_T *  UARTx,
UART_RxTriggerDef  level 
)

Sets the trigger level of the receiver FIFO full interrupt.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
levelUart receive fifo threshold UART_RxTriggerDef
Returns
None

◆ UART_SetTransmitAddress()

__STATIC_INLINE void UART_SetTransmitAddress ( UART_T *  UARTx,
uint32_t  addr 
)

This is an address matching register during transmit mode,Set transmit address.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
addrTransmit address
Returns
None

◆ UART_SetTxTrigger()

__STATIC_INLINE void UART_SetTxTrigger ( UART_T *  UARTx,
UART_TxTriggerDef  level 
)

Set the trigger level of the transmitter FIFO empty interrupt.

Parameters
UARTxwhere x can be 1, 2 to select the UART peripheral.
levelUart transmit fifo threshold UART_TxTriggerDef
Returns
None