138 UART_EVENT_BUSY = 0x7,
205 UARTx->LCR |= UART_LCR_SP_Msk;
216 UARTx->LCR &= ~UART_LCR_SP_Msk;
245 UARTx->SCR |= UART_FCR_FIFOE_Msk;
247 UARTx->IIR_FCR = UARTx->SCR;
260 UARTx->SCR &= ~UART_FCR_FIFOE_Msk;
262 UARTx->IIR_FCR = UARTx->SCR;
273 return (UARTx->IIR_FCR & UART_IIR_FIFOSE_Msk) ? true :
false;
285 UARTx->SCR |= UART_FCR_RFIFOR_Msk;
287 UARTx->IIR_FCR = UARTx->SCR;
288 UARTx->SCR &= ~UART_FCR_RFIFOR_Msk;
291 volatile uint32_t val = UARTx->RBR_THR_DLL;
304 UARTx->SCR |= UART_FCR_XFIFOR_Msk;
306 UARTx->IIR_FCR = UARTx->SCR;
307 UARTx->SCR &= ~UART_FCR_XFIFOR_Msk;
320 UARTx->SCR &= ~UART_FCR_TET_Msk;
321 UARTx->SCR |= (level << UART_FCR_TET_Pos);
323 UARTx->IIR_FCR = UARTx->SCR;
337 UARTx->SCR &= ~UART_FCR_RT_Msk;
338 UARTx->SCR |= (level << UART_FCR_RT_Pos);
340 UARTx->IIR_FCR = UARTx->SCR;
351 return (uint8_t)((UARTx->TFL & UART_TFL_Msk) >> UART_TFL_Pos);
362 return (uint8_t)((UARTx->RFL & UART_RFL_Msk) >> UART_RFL_Pos);
373 UARTx->MCR |= UART_MCR_AFCE_Msk;
384 UARTx->MCR &= ~UART_MCR_AFCE_Msk;
395 return (UARTx->MCR & UART_MCR_AFCE_Msk) ? true :
false;
407 UARTx->RBR_THR_DLL = Data;
418 return (uint8_t)UARTx->RBR_THR_DLL;
429 UARTx->IER_DLH |= UART_IER_EPTI_Msk;
440 UARTx->IER_DLH &= ~UART_IER_EPTI_Msk;
451 return (UARTx->IER_DLH & UART_IER_EPTI_Msk) ? true :
false;
463 UARTx->IER_DLH |= ((irq << UART_IER_ALL_IRQ_Pos) & UART_IER_ALL_IRQ_Msk);
475 UARTx->IER_DLH &= ~((irq << UART_IER_ALL_IRQ_Pos) & UART_IER_ALL_IRQ_Msk);
487 return (UARTx->IER_DLH & ((irq << UART_IER_ALL_IRQ_Pos) & UART_IER_ALL_IRQ_Msk)) ? true :
false;
498 return (uint8_t)((UARTx->IER_DLH & UART_IER_ALL_IRQ_Msk) >> UART_IER_ALL_IRQ_Pos);
509 return (
UART_EventDef)((UARTx->IIR_FCR & UART_IIR_IID_Msk) >> UART_IIR_IID_Pos);
520 return (UARTx->USR & UART_USR_TFE_Msk) ? true :
false;
531 return (UARTx->USR & UART_USR_TFNF_Msk) ? false :
true;
542 return (UARTx->USR & UART_USR_RFNE_Msk) ? false :
true;
553 return (UARTx->USR & UART_USR_RFF_Msk) ? true :
false;
586 UARTx->MCR |= UART_MCR_RTS_Msk;
597 UARTx->MCR &= ~UART_MCR_RTS_Msk;
608 UARTx->LCR_EXT |= UART_LCR_EXT_DLS_E_Msk;
619 UARTx->LCR_EXT &= ~UART_LCR_EXT_DLS_E_Msk;
630 UARTx->LCR_EXT |= UART_LCR_EXT_ADDR_MATCH_Msk;
641 UARTx->LCR_EXT &= ~UART_LCR_EXT_ADDR_MATCH_Msk;
653 UARTx->LCR_EXT |= UART_LCR_EXT_SEND_ADDR_Msk;
enum UART_LineStatus UART_LineStatusDef
UART_LineStatus
Definition: pan_uart.h:152
@ UART_LINE_PARITY_ERR
Definition: pan_uart.h:155
@ UART_LINE_BREAK_INT
Definition: pan_uart.h:157
@ UART_LINE_THRE
Definition: pan_uart.h:158
@ UART_LINE_ADDR_RCVD
Definition: pan_uart.h:161
@ UART_LINE_DATA_RDY
Definition: pan_uart.h:153
@ UART_LINE_FRAME_ERR
Definition: pan_uart.h:156
@ UART_LINE_RECV_FIFO_EMPTY
Definition: pan_uart.h:160
@ UART_LINE_OVERRUN_ERR
Definition: pan_uart.h:154
@ UART_LINE_TXSR_EMPTY
Definition: pan_uart.h:159
UART_ModemStatus
Definition: pan_uart.h:169
enum UART_ModemStatus UART_ModemStatusDef
@ UART_MODEM_DDSR
Definition: pan_uart.h:171
@ UART_MODEM_DCTS
Definition: pan_uart.h:170
@ UART_MODEM_DSR
Definition: pan_uart.h:175
@ UART_MODEM_CTS
Definition: pan_uart.h:174
@ UART_MODEM_DCD
Definition: pan_uart.h:177
@ UART_MODEM_DDCD
Definition: pan_uart.h:173
@ UART_MODEM_TERI
Definition: pan_uart.h:172
@ UART_MODEM_RI
Definition: pan_uart.h:176
UART_Event
Definition: pan_uart.h:131
enum UART_Event UART_EventDef
@ UART_EVENT_MODEM
Definition: pan_uart.h:132
@ UART_EVENT_TIMEOUT
Definition: pan_uart.h:140
@ UART_EVENT_THR_EMPTY
Definition: pan_uart.h:134
@ UART_EVENT_NONE
Definition: pan_uart.h:133
@ UART_EVENT_LINE
Definition: pan_uart.h:136
@ UART_EVENT_DATA
Definition: pan_uart.h:135
UART_Irq
Definition: pan_uart.h:111
enum UART_Irq UART_IrqDef
@ UART_IRQ_ALL
Definition: pan_uart.h:116
@ UART_IRQ_MODEM_STATUS
Definition: pan_uart.h:115
@ UART_IRQ_LINE_STATUS
Definition: pan_uart.h:114
@ UART_IRQ_RECV_DATA_AVL
Definition: pan_uart.h:112
@ UART_IRQ_THR_EMPTY
Definition: pan_uart.h:113
UART_LineCtrl
Definition: pan_uart.h:59
enum UART_LineCtrl UART_LineCtrlDef
@ Uart_Line_5e1_5
Definition: pan_uart.h:63
@ Uart_Line_6e1
Definition: pan_uart.h:72
@ Uart_Line_8e1
Definition: pan_uart.h:92
@ Uart_Line_7o2
Definition: pan_uart.h:85
@ Uart_Line_8m2
Definition: pan_uart.h:99
@ Uart_Line_5m1
Definition: pan_uart.h:68
@ Uart_Line_8n1
Definition: pan_uart.h:90
@ Uart_Line_7m2
Definition: pan_uart.h:89
@ Uart_Line_6m1
Definition: pan_uart.h:78
@ Uart_Line_7n1
Definition: pan_uart.h:80
@ Uart_Line_8m1
Definition: pan_uart.h:98
@ Uart_Line_5o1_5
Definition: pan_uart.h:65
@ Uart_Line_5e1
Definition: pan_uart.h:62
@ Uart_Line_5n1
Definition: pan_uart.h:60
@ Uart_Line_6e2
Definition: pan_uart.h:73
@ Uart_Line_6n2
Definition: pan_uart.h:71
@ Uart_Line_5s1
Definition: pan_uart.h:66
@ Uart_Line_8s2
Definition: pan_uart.h:97
@ Uart_Line_8o1
Definition: pan_uart.h:94
@ Uart_Line_5m1_5
Definition: pan_uart.h:69
@ Uart_Line_7e2
Definition: pan_uart.h:83
@ Uart_Line_6n1
Definition: pan_uart.h:70
@ Uart_Line_6s1
Definition: pan_uart.h:76
@ Uart_Line_5s1_5
Definition: pan_uart.h:67
@ Uart_Line_8e2
Definition: pan_uart.h:93
@ Uart_Line_8s1
Definition: pan_uart.h:96
@ Uart_Line_5n1_5
Definition: pan_uart.h:61
@ Uart_Line_6m2
Definition: pan_uart.h:79
@ Uart_Line_6o2
Definition: pan_uart.h:75
@ Uart_Line_8n2
Definition: pan_uart.h:91
@ Uart_Line_7e1
Definition: pan_uart.h:82
@ Uart_Line_7o1
Definition: pan_uart.h:84
@ Uart_Line_7s1
Definition: pan_uart.h:86
@ Uart_Line_7m1
Definition: pan_uart.h:88
@ Uart_Line_6o1
Definition: pan_uart.h:74
@ Uart_Line_8o2
Definition: pan_uart.h:95
@ Uart_Line_7n2
Definition: pan_uart.h:81
@ Uart_Line_7s2
Definition: pan_uart.h:87
@ Uart_Line_6s2
Definition: pan_uart.h:77
@ Uart_Line_5o1
Definition: pan_uart.h:64
enum UART_RxTrigger UART_RxTriggerDef
UART_RxTrigger
Definition: pan_uart.h:45
@ UART_RX_FIFO_TWO_LESS_THAN_FULL
Definition: pan_uart.h:49
@ UART_RX_FIFO_HALF_FULL
Definition: pan_uart.h:48
@ UART_RX_FIFO_ONE_CHAR
Definition: pan_uart.h:46
@ UART_RX_FIFO_QUARTER_FULL
Definition: pan_uart.h:47
enum UART_TxTrigger UART_TxTriggerDef
UART_TxTrigger
Definition: pan_uart.h:33
@ UART_TX_FIFO_QUARTER_FULL
Definition: pan_uart.h:36
@ UART_TX_FIFO_EMPTY
Definition: pan_uart.h:34
@ UART_TX_FIFO_HALF_FULL
Definition: pan_uart.h:37
@ UART_TX_FIFO_TWO_CHARS
Definition: pan_uart.h:35
__STATIC_INLINE void UART_DisableIrq(UART_T *UARTx, UART_IrqDef irq)
Disable interrupt.
Definition: pan_uart.h:473
__STATIC_INLINE uint8_t UART_GetTxFifoLevel(UART_T *UARTx)
Get the transmit fifo level.
Definition: pan_uart.h:349
__STATIC_INLINE bool UART_IsRxFifoEmpty(UART_T *UARTx)
Check rx fifo empty or not.
Definition: pan_uart.h:540
__STATIC_INLINE UART_LineStatusDef UART_GetLineStatus(UART_T *UARTx)
This function is used to get line status.
Definition: pan_uart.h:225
__STATIC_INLINE void UART_EnableStickParity(UART_T *UARTx)
This function is used to enable stick parity.
Definition: pan_uart.h:203
bool UART_SendMultipleData(UART_T *UARTx, uint8_t *Buf, size_t BufSize, size_t SendSize)
This function is used to send multiple data.
__STATIC_INLINE void UART_SetReceiveAddress(UART_T *UARTx, uint32_t addr)
This is an address matching register during receive mode,Set Receive Address.
Definition: pan_uart.h:663
__STATIC_INLINE bool UART_IsTxFifoEmpty(UART_T *UARTx)
Check tx fifo empty or not.
Definition: pan_uart.h:518
__STATIC_INLINE void UART_Enable9BitData(UART_T *UARTx)
Enable 9-bit data transmit and receive transfer.
Definition: pan_uart.h:606
void UART_DeInit(UART_T *UARTx)
Deinit the UARTx peripheral.
__STATIC_INLINE void UART_Disable9BitData(UART_T *UARTx)
Disable 9-bit data transmit and receive transfer.
Definition: pan_uart.h:617
__STATIC_INLINE void UART_ResetRxFifo(UART_T *UARTx)
This function is used to reset rx fifo.
Definition: pan_uart.h:282
__STATIC_INLINE void UART_SetTransmitAddress(UART_T *UARTx, uint32_t addr)
This is an address matching register during transmit mode,Set transmit address.
Definition: pan_uart.h:674
__STATIC_INLINE void UART_EnableRts(UART_T *UARTx)
Enable request to send in flow control mode.
Definition: pan_uart.h:584
__STATIC_INLINE void UART_ResetTxFifo(UART_T *UARTx)
This function is used to reset tx fifo.
Definition: pan_uart.h:301
__STATIC_INLINE void UART_DisableAfc(UART_T *UARTx)
Disable auto flow control mode.
Definition: pan_uart.h:382
__STATIC_INLINE bool UART_IsPtimeEnabled(UART_T *UARTx)
Check programmable THRE interrupt mode enable or not.
Definition: pan_uart.h:449
__STATIC_INLINE UART_ModemStatusDef UART_GetModemStatus(UART_T *UARTx)
Definition: pan_uart.h:230
__STATIC_INLINE uint8_t UART_GetRxFifoLevel(UART_T *UARTx)
Get the receive fifo level.
Definition: pan_uart.h:360
__STATIC_INLINE UART_EventDef UART_GetActiveEvent(UART_T *UARTx)
Get active interrupt ID.
Definition: pan_uart.h:507
__STATIC_INLINE bool UART_IsIrqEnabled(UART_T *UARTx, UART_IrqDef irq)
Check interrupt enable or not.
Definition: pan_uart.h:485
__STATIC_INLINE bool UART_IsRxFifoFull(UART_T *UARTx)
Check rx fifo full or not.
Definition: pan_uart.h:551
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_DisablePtime(UART_T *UARTx)
Programmable THRE interrupt mode disable.
Definition: pan_uart.h:438
__STATIC_INLINE void UART_EnableIrq(UART_T *UARTx, UART_IrqDef irq)
Enable interrupt,include Modem status linestatus,THRE,receive data.
Definition: pan_uart.h:461
__STATIC_INLINE bool UART_IsFifoEnabled(UART_T *UARTx)
Adjust whether the FIFOs enabled or not.
Definition: pan_uart.h:271
__STATIC_INLINE void UART_SetTxTrigger(UART_T *UARTx, UART_TxTriggerDef level)
Set the trigger level of the transmitter FIFO empty interrupt.
Definition: pan_uart.h:317
__STATIC_INLINE void UART_EnableAddrMatchMode(UART_T *UARTx)
Enable address match feature during receive.
Definition: pan_uart.h:628
__STATIC_INLINE void UART_EnableHaltTX(UART_T *UARTx)
Enable halt transmit,this function is used to halt transmit for test.
Definition: pan_uart.h:562
__STATIC_INLINE void UART_DisableRts(UART_T *UARTx)
Disable request to send in flow control mode.
Definition: pan_uart.h:595
__STATIC_INLINE bool UART_IsTxFifoFull(UART_T *UARTx)
Check tx fifo full or not.
Definition: pan_uart.h:529
__STATIC_INLINE uint8_t UART_GetIrqMasked(UART_T *UARTx)
Get which interrupt is actived.
Definition: pan_uart.h:496
__STATIC_INLINE void UART_DisableAddrMatchMode(UART_T *UARTx)
Disable address match feature during receive.
Definition: pan_uart.h:639
bool UART_ReceiveMultipleData(UART_T *UARTx, uint8_t *Buf, size_t BufSize, size_t ExpectSize)
This function is used to receive multiple data.
__STATIC_INLINE void UART_DisableFifo(UART_T *UARTx)
This function disables receive and transmit FIFOs.
Definition: pan_uart.h:257
__STATIC_INLINE uint8_t UART_ReceiveData(UART_T *UARTx)
Uart receive data function.
Definition: pan_uart.h:416
__STATIC_INLINE bool UART_IsAfcEnabled(UART_T *UARTx)
Check auto flow control mode enable or not.
Definition: pan_uart.h:393
__STATIC_INLINE void UART_DisableStickParity(UART_T *UARTx)
This function is used to disable stick parity.
Definition: pan_uart.h:214
__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...
Definition: pan_uart.h:651
__STATIC_INLINE void UART_DisableHaltTX(UART_T *UARTx)
Disable halt transmit.
Definition: pan_uart.h:573
__STATIC_INLINE void UART_SendData(UART_T *UARTx, uint8_t Data)
Uart send data function.
Definition: pan_uart.h:405
__STATIC_INLINE void UART_EnablePtime(UART_T *UARTx)
Programmable THRE interrupt mode enable.
Definition: pan_uart.h:427
__STATIC_INLINE void UART_EnableAfc(UART_T *UARTx)
Enable auto flow control mode.
Definition: pan_uart.h:371
__STATIC_INLINE void UART_EnableFifo(UART_T *UARTx)
This function enables receive and transmit FIFOs, if they are available.
Definition: pan_uart.h:242
__STATIC_INLINE void UART_SetRxTrigger(UART_T *UARTx, UART_RxTriggerDef level)
Sets the trigger level of the receiver FIFO full interrupt.
Definition: pan_uart.h:334
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