10#define __USCI_UART_H__
34#define UUART_WORD_LEN_6 (6ul << UUART_LINECTL_DWIDTH_Pos)
35#define UUART_WORD_LEN_7 (7ul << UUART_LINECTL_DWIDTH_Pos)
36#define UUART_WORD_LEN_8 (8ul << UUART_LINECTL_DWIDTH_Pos)
37#define UUART_WORD_LEN_9 (9ul << UUART_LINECTL_DWIDTH_Pos)
42#define UUART_PARITY_NONE (0x0ul << UUART_PROTCTL_PARITYEN_Pos)
43#define UUART_PARITY_ODD (0x1ul << UUART_PROTCTL_PARITYEN_Pos)
44#define UUART_PARITY_EVEN (0x3ul << UUART_PROTCTL_PARITYEN_Pos)
46#define UUART_STOP_BIT_1 (0x0ul)
47#define UUART_STOP_BIT_2 (0x1ul)
52#define UUART_ABR_INT_MASK (0x002ul)
53#define UUART_RLS_INT_MASK (0x004ul)
54#define UUART_BUF_RXOV_INT_MASK (0x008ul)
55#define UUART_TXST_INT_MASK (0x010ul)
56#define UUART_TXEND_INT_MASK (0x020ul)
57#define UUART_RXST_INT_MASK (0x040ul)
58#define UUART_RXEND_INT_MASK (0x080ul)
80#define UUART_WRITE(uuart, u8Data) ((uuart)->TXDAT = (u8Data))
93#define UUART_READ(uuart) ((uuart)->RXDAT)
107#define UUART_GET_TX_EMPTY(uuart) ((uuart)->BUFSTS & UUART_BUFSTS_TXEMPTY_Msk)
121#define UUART_GET_RX_EMPTY(uuart) ((uuart)->BUFSTS & UUART_BUFSTS_RXEMPTY_Msk)
136#define UUART_IS_TX_EMPTY(uuart) (((uuart)->BUFSTS & UUART_BUFSTS_TXEMPTY_Msk) >> UUART_BUFSTS_TXEMPTY_Pos)
151#define UUART_IS_RX_EMPTY(uuart) (((uuart)->BUFSTS & UUART_BUFSTS_RXEMPTY_Msk) >> UUART_BUFSTS_RXEMPTY_Pos)
164#define UUART_WAIT_TX_EMPTY(uuart) while(!((((uuart)->BUFSTS) & UUART_BUFSTS_TXEMPTY_Msk) >> UUART_BUFSTS_TXEMPTY_Pos))
178#define UUART_IS_TX_FULL(uuart) (((uuart)->BUFSTS & UUART_BUFSTS_TXFULL_Msk)>>UUART_BUFSTS_TXFULL_Pos)
192#define UUART_IS_RX_FULL(uuart) (((uuart)->BUFSTS & UUART_BUFSTS_RXFULL_Msk)>>UUART_BUFSTS_RXFULL_Pos)
206#define UUART_GET_TX_FULL(uuart) ((uuart)->BUFSTS & UUART_BUFSTS_TXFULL_Msk)
220#define UUART_GET_RX_FULL(uuart) ((uuart)->BUFSTS & UUART_BUFSTS_RXFULL_Msk)
236#define UUART_ENABLE_PROT_INT(uuart, u32IntSel) ((uuart)->PROTIEN |= (u32IntSel))
252#define UUART_DISABLE_PROT_INT(uuart, u32IntSel) ((uuart)->PROTIEN &= ~(u32IntSel))
267#define UUART_ENABLE_BUF_INT(uuart, u32IntSel) ((uuart)->BUFCTL |= (u32IntSel))
282#define UUART_DISABLE_BUF_INT(uuart, u32IntSel) ((uuart)->BUFCTL &= ~ (u32IntSel))
300#define UUART_ENABLE_TRANS_INT(uuart, u32IntSel) ((uuart)->INTEN |= (u32IntSel))
318#define UUART_DISABLE_TRANS_INT(uuart, u32IntSel) ((uuart)->INTEN &= ~(u32IntSel))
331#define UUART_GET_PROT_STATUS(uuart) ((uuart)->PROTSTS)
354#define UUART_CLR_PROT_INT_FLAG(uuart,u32IntTypeFlag) ((uuart)->PROTSTS = (u32IntTypeFlag))
367#define UUART_GET_BUF_STATUS(uuart) ((uuart)->BUFSTS)
382#define UUART_CLR_BUF_INT_FLAG(uuart,u32IntTypeFlag) ((uuart)->BUFSTS = (u32IntTypeFlag))
396#define UUART_GET_WAKEUP_FLAG(uuart) ((uuart)->WKSTS & UUART_WKSTS_WKF_Msk ? 1: 0 )
409#define UUART_CLR_WAKEUP_FLAG(uuart) ((uuart)->WKSTS = UUART_WKSTS_WKF_Msk)
421#define UUART_TRIGGER_RX_PDMA(uuart) ((uuart)->PDMACTL |= UUART_PDMACTL_RXPDMAEN_Msk|UUART_PDMACTL_PDMAEN_Msk)
433#define UUART_TRIGGER_TX_PDMA(uuart) ((uuart)->PDMACTL |= UUART_PDMACTL_TXPDMAEN_Msk|UUART_PDMACTL_PDMAEN_Msk)
445#define UUART_DISABLE_RX_PDMA(uuart) ( (uuart)->PDMACTL &= ~UUART_PDMACTL_RXPDMAEN_Msk )
457#define UUART_DISABLE_TX_PDMA(uuart) ( (uuart)->PDMACTL &= ~UUART_PDMACTL_TXPDMAEN_Msk )
473#define UUART_PDMA_ENABLE(uuart, u32FuncSel) ((uuart)->PDMACTL |= (u32FuncSel))
488#define UUART_PDMA_DISABLE(uuart, u32FuncSel) ((uuart)->PDMACTL &= ~(u32FuncSel))
500uint32_t
UUART_SetLine_Config(
UUART_T* uuart, uint32_t u32baudrate, uint32_t u32data_width, uint32_t u32parity, uint32_t u32stop_bits);
uint32_t UUART_GetIntFlag(UUART_T *uuart, uint32_t u32Mask)
Get USCI_UART specified interrupt flag.
uint32_t UUART_Read(UUART_T *uuart, uint8_t pu8RxBuf[], uint32_t u32ReadBytes)
Read USCI_UART data.
void UUART_DisableWakeup(UUART_T *uuart)
Disable USCI_UART Wake-up Function.
void UUART_Close(UUART_T *uuart)
Disable USCI_UART function mode.
void UUART_EnableWakeup(UUART_T *uuart, uint32_t u32WakeupMode)
Enable USCI_UART Wake-up Function.
uint32_t UUART_Write(UUART_T *uuart, uint8_t pu8TxBuf[], uint32_t u32WriteBytes)
Write USCI_UART data.
uint32_t UUART_Open(UUART_T *uuart, uint32_t u32baudrate)
Open and set USCI_UART function.
void UUART_DisableInt(UUART_T *uuart, uint32_t u32Mask)
Disable interrupt function.
void UUART_DisableFlowCtrl(UUART_T *uuart)
Disable USCI_UART auto flow control.
uint32_t UUART_SetLine_Config(UUART_T *uuart, uint32_t u32baudrate, uint32_t u32data_width, uint32_t u32parity, uint32_t u32stop_bits)
Set USCI_UART line configuration.
void UUART_EnableInt(UUART_T *uuart, uint32_t u32Mask)
Enable interrupt function.
void UUART_EnableFlowCtrl(UUART_T *uuart)
Enable USCI_UART auto flow control.
void UUART_ClearIntFlag(UUART_T *uuart, uint32_t u32Mask)
Clear USCI_UART specified interrupt flag.