29#define UART0 USART0_BASE
30#define UART1 UART1_BASE
31#define UART2 USART2_BASE
32#define UART3 USART3_BASE
37#define UART_RBR(port) MMIO32((port) + 0x000)
40#define UART_THR(port) MMIO32((port) + 0x000)
43#define UART_DLL(port) MMIO32((port) + 0x000)
46#define UART_DLM(port) MMIO32((port) + 0x004)
49#define UART_IER(port) MMIO32((port) + 0x004)
52#define UART_IIR(port) MMIO32((port) + 0x008)
55#define UART_FCR(port) MMIO32((port) + 0x008)
58#define UART_LCR(port) MMIO32((port) + 0x00C)
63#define UART_LSR(port) MMIO32((port) + 0x014)
66#define UART_ACR(port) MMIO32((port) + 0x020)
69#define UART_ICR(port) MMIO32((port) + 0x024)
72#define UART_FDR(port) MMIO32((port) + 0x028)
75#define UART_OSR(port) MMIO32((port) + 0x02C)
78#define UART_HDEN(port) MMIO32((port) + 0x040)
81#define UART_SCICTRL(port) MMIO32((port) + 0x048)
84#define UART_RS485CTRL(port) MMIO32((port) + 0x04C)
87#define UART_RS485ADRMATCH(port) MMIO32((port) + 0x050)
90#define UART_RS485DLY(port) MMIO32((port) + 0x054)
93#define UART_SYNCCTRL(port) MMIO32((port) + 0x058)
96#define UART_TER(port) MMIO32((port) + 0x05C)
103#define UART_RBR_MASKBIT ((uint8_t)0xFF)
109#define UART_THR_MASKBIT ((uint8_t)0xFF)
115#define UART_LOAD_DLL(div) ((div) & 0xFF)
118#define UART_DLL_MASKBIT ((uint8_t)0xFF)
124#define UART_DLM_MASKBIT ((uint8_t)0xFF)
127#define UART_LOAD_DLM(div) (((div) >> 8) & 0xFF)
133#define UART_IER_RBRINT_EN (1 << 0)
135#define UART_IER_THREINT_EN (1 << 1)
137#define UART_IER_RLSINT_EN (1 << 2)
139#define UART1_IER_MSINT_EN (1 << 3)
141#define UART1_IER_CTSINT_EN (1 << 7)
143#define UART_IER_ABEOINT_EN (1 << 8)
145#define UART_IER_ABTOINT_EN (1 << 9)
147#define UART_IER_BITMASK ((uint32_t)(0x307))
149#define UART1_IER_BITMASK ((uint32_t)(0x38F))
156#define UART_IIR_INTSTAT_PEND (1 << 0)
158#define UART1_IIR_INTID_MODEM (0 << 1)
160#define UART_IIR_INTID_THRE (1 << 1)
162#define UART_IIR_INTID_RDA (2 << 1)
164#define UART_IIR_INTID_RLS (3 << 1)
166#define UART_IIR_INTID_CTI (6 << 1)
168#define UART_IIR_INTID_MASK (7 << 1)
170#define UART_IIR_FIFO_EN (3 << 6)
172#define UART_IIR_ABEO_INT (1 << 8)
174#define UART_IIR_ABTO_INT (1 << 9)
176#define UART_IIR_BITMASK ((uint32_t)(0x3CF))
182#define UART_FCR_FIFO_EN (1 << 0)
184#define UART_FCR_RX_RS (1 << 1)
186#define UART_FCR_TX_RS (1 << 2)
188#define UART_FCR_DMAMODE_SEL (1 << 3)
190#define UART_FCR_TRG_LEV0 (0 << 6)
192#define UART_FCR_TRG_LEV1 (1 << 6)
194#define UART_FCR_TRG_LEV2 (2 << 6)
196#define UART_FCR_TRG_LEV3 (3 << 6)
198#define UART_FCR_BITMASK ((uint8_t)(0xCF))
199#define UART_TX_FIFO_SIZE (16)
205#define UART_LCR_WLEN5 (0 << 0)
207#define UART_LCR_WLEN6 (1 << 0)
209#define UART_LCR_WLEN7 (2 << 0)
211#define UART_LCR_WLEN8 (3 << 0)
213#define UART_LCR_ONE_STOPBIT (0 << 2)
215#define UART_LCR_TWO_STOPBIT (1 << 2)
218#define UART_LCR_NO_PARITY (0 << 3)
220#define UART_LCR_PARITY_EN (1 << 3)
222#define UART_LCR_PARITY_ODD (0 << 4)
224#define UART_LCR_PARITY_EVEN (1 << 4)
226#define UART_LCR_PARITY_SP_1 (1 << 5)
228#define UART_LCR_PARITY_SP_0 ((1 << 5) | (1 << 4))
230#define UART_LCR_BREAK_EN (1 << 6)
232#define UART_LCR_DLAB_EN (1 << 7)
234#define UART_LCR_BITMASK ((uint8_t)(0xFF))
240#define UART_LSR_RDR (1 << 0)
242#define UART_LSR_OE (1 << 1)
244#define UART_LSR_PE (1 << 2)
246#define UART_LSR_FE (1 << 3)
248#define UART_LSR_BI (1 << 4)
250#define UART_LSR_THRE (1 << 5)
252#define UART_LSR_TEMT (1 << 6)
254#define UART_LSR_RXFE (1 << 7)
256#define UART_LSR_BITMASK ((uint8_t)(0xFF))
257#define UART_LSR_ERROR_MASK \
258 (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE | UART_LSR_BI | UART_LSR_RXFE)
265#define UART_SCR_BIMASK ((uint8_t)(0xFF))
272#define UART_ACR_START (1 << 0)
274#define UART_ACR_MODE (1 << 1)
276#define UART_ACR_AUTO_RESTART (1 << 2)
278#define UART_ACR_ABEOINT_CLR (1 << 8)
280#define UART_ACR_ABTOINT_CLR (1 << 9)
282#define UART_ACR_BITMASK ((uint32_t)(0x307))
288#define UART_ICR_IRDAEN (1 << 0)
290#define UART_ICR_IRDAINV (1 << 1)
292#define UART_ICR_FIXPULSE_EN (1 << 2)
294#define UART_ICR_PULSEDIV(n) ((uint32_t)(((n)&0x07)<<3))
296#define UART_ICR_BITMASK ((uint32_t)(0x3F))
302#define UART_HDEN_HDEN (1 << 0)
308#define UART_SCICTRL_SCIEN (1 << 0)
310#define UART_SCICTRL_NACKDIS (1 << 1)
312#define UART_SCICTRL_PROTSEL_T1 (1 << 2)
314#define UART_SCICTRL_TXRETRY(n) ((uint32_t)(((n)&0x07)<<5))
316#define UART_SCICTRL_GUARDTIME(n) ((uint32_t)(((n)&0xFF)<<8))
322#define UART_SYNCCTRL_SYNC (1 << 0)
324#define UART_SYNCCTRL_CSRC_MASTER (1 << 1)
326#define UART_SYNCCTRL_FES (1 << 2)
328#define UART_SYNCCTRL_TSBYPASS (1 << 3)
330#define UART_SYNCCTRL_CSCEN (1 << 4)
332#define UART_SYNCCTRL_NOSTARTSTOP (1 << 5)
334#define UART_SYNCCTRL_CCCLR (1 << 6)
341#define UART_FDR_DIVADDVAL(n) ((uint32_t)((n)&0x0F))
343#define UART_FDR_MULVAL(n) ((uint32_t)(((n)<<4)&0xF0))
345#define UART_FDR_BITMASK ((uint32_t)(0xFF))
351#define UART_TER_TXEN (1 << 0)
357#define UART_FIFOLVL_RX(n) ((uint32_t)((n)&0x0F))
359#define UART_FIFOLVL_TX(n) ((uint32_t)(((n)>>8)&0x0F))
361#define UART_FIFOLVL_BITMASK ((uint32_t)(0x0F0F))
428 uint16_t uart_divisor, uint8_t uart_divaddval, uint8_t uart_mulval);
uart_rx_data_ready_t uart_rx_data_ready(uart_num_t uart_num)
#define UART_LCR_TWO_STOPBIT
#define UART_LCR_PARITY_EVEN
#define UART_LCR_PARITY_EN
#define UART_LCR_PARITY_ODD
#define UART_LCR_NO_PARITY
uint8_t uart_read(uart_num_t uart_num)
uint8_t uart_read_timeout(uart_num_t uart_num, uint32_t rx_timeout_nb_cycles, uart_error_t *error)
#define UART_LCR_PARITY_SP_0
void uart_write(uart_num_t uart_num, uint8_t data)
#define UART_LCR_ONE_STOPBIT
#define UART_LCR_PARITY_SP_1
void uart_init(uart_num_t uart_num, uart_databit_t data_nb_bits, uart_stopbit_t data_nb_stop, uart_parity_t data_parity, uint16_t uart_divisor, uint8_t uart_divaddval, uint8_t uart_mulval)