libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
uart.h File Reference
Include dependency graph for uart.h:

Go to the source code of this file.

Macros

#define UART0   USART0_BASE /* APB0 */
 
#define UART1   UART1_BASE /* APB0 */
 
#define UART2   USART2_BASE /* APB2 */
 
#define UART3   USART3_BASE /* APB2 */
 
#define UART_RBR(port)   MMIO32((port) + 0x000) /* 8bits */
 
#define UART_THR(port)   MMIO32((port) + 0x000) /* 8bits */
 
#define UART_DLL(port)   MMIO32((port) + 0x000) /* 8bits */
 
#define UART_DLM(port)   MMIO32((port) + 0x004) /* 8bits */
 
#define UART_IER(port)   MMIO32((port) + 0x004)
 
#define UART_IIR(port)   MMIO32((port) + 0x008)
 
#define UART_FCR(port)   MMIO32((port) + 0x008)
 
#define UART_LCR(port)   MMIO32((port) + 0x00C)
 
#define UART_LSR(port)   MMIO32((port) + 0x014)
 
#define UART_ACR(port)   MMIO32((port) + 0x020)
 
#define UART_ICR(port)   MMIO32((port) + 0x024)
 
#define UART_FDR(port)   MMIO32((port) + 0x028)
 
#define UART_OSR(port)   MMIO32((port) + 0x02C)
 
#define UART_HDEN(port)   MMIO32((port) + 0x040)
 
#define UART_SCICTRL(port)   MMIO32((port) + 0x048)
 
#define UART_RS485CTRL(port)   MMIO32((port) + 0x04C)
 
#define UART_RS485ADRMATCH(port)   MMIO32((port) + 0x050)
 
#define UART_RS485DLY(port)   MMIO32((port) + 0x054)
 
#define UART_SYNCCTRL(port)   MMIO32((port) + 0x058)
 
#define UART_TER(port)   MMIO32((port) + 0x05C)
 
#define UART_RBR_MASKBIT   ((uint8_t)0xFF)
 
#define UART_THR_MASKBIT   ((uint8_t)0xFF)
 
#define UART_LOAD_DLL(div)   ((div) & 0xFF)
 
#define UART_DLL_MASKBIT   ((uint8_t)0xFF)
 
#define UART_DLM_MASKBIT   ((uint8_t)0xFF)
 
#define UART_LOAD_DLM(div)   (((div) >> 8) & 0xFF)
 
#define UART_IER_RBRINT_EN   (1 << 0)
 
#define UART_IER_THREINT_EN   (1 << 1)
 
#define UART_IER_RLSINT_EN   (1 << 2)
 
#define UART1_IER_MSINT_EN   (1 << 3)
 
#define UART1_IER_CTSINT_EN   (1 << 7)
 
#define UART_IER_ABEOINT_EN   (1 << 8)
 
#define UART_IER_ABTOINT_EN   (1 << 9)
 
#define UART_IER_BITMASK   ((uint32_t)(0x307))
 
#define UART1_IER_BITMASK   ((uint32_t)(0x38F))
 
#define UART_IIR_INTSTAT_PEND   (1 << 0)
 
#define UART1_IIR_INTID_MODEM   (0 << 1)
 
#define UART_IIR_INTID_THRE   (1 << 1)
 
#define UART_IIR_INTID_RDA   (2 << 1)
 
#define UART_IIR_INTID_RLS   (3 << 1)
 
#define UART_IIR_INTID_CTI   (6 << 1)
 
#define UART_IIR_INTID_MASK   (7 << 1)
 
#define UART_IIR_FIFO_EN   (3 << 6)
 
#define UART_IIR_ABEO_INT   (1 << 8)
 
#define UART_IIR_ABTO_INT   (1 << 9)
 
#define UART_IIR_BITMASK   ((uint32_t)(0x3CF))
 
#define UART_FCR_FIFO_EN   (1 << 0)
 
#define UART_FCR_RX_RS   (1 << 1)
 
#define UART_FCR_TX_RS   (1 << 2)
 
#define UART_FCR_DMAMODE_SEL   (1 << 3)
 
#define UART_FCR_TRG_LEV0   (0 << 6)
 
#define UART_FCR_TRG_LEV1   (1 << 6)
 
#define UART_FCR_TRG_LEV2   (2 << 6)
 
#define UART_FCR_TRG_LEV3   (3 << 6)
 
#define UART_FCR_BITMASK   ((uint8_t)(0xCF))
 
#define UART_TX_FIFO_SIZE   (16)
 
#define UART_LCR_WLEN5   (0 << 0)
 
#define UART_LCR_WLEN6   (1 << 0)
 
#define UART_LCR_WLEN7   (2 << 0)
 
#define UART_LCR_WLEN8   (3 << 0)
 
#define UART_LCR_ONE_STOPBIT   (0 << 2)
 
#define UART_LCR_TWO_STOPBIT   (1 << 2)
 
#define UART_LCR_NO_PARITY   (0 << 3)
 
#define UART_LCR_PARITY_EN   (1 << 3)
 
#define UART_LCR_PARITY_ODD   (0 << 4)
 
#define UART_LCR_PARITY_EVEN   (1 << 4)
 
#define UART_LCR_PARITY_SP_1   (1 << 5)
 
#define UART_LCR_PARITY_SP_0   ((1 << 5) | (1 << 4))
 
#define UART_LCR_BREAK_EN   (1 << 6)
 
#define UART_LCR_DLAB_EN   (1 << 7)
 
#define UART_LCR_BITMASK   ((uint8_t)(0xFF))
 
#define UART_LSR_RDR   (1 << 0)
 
#define UART_LSR_OE   (1 << 1)
 
#define UART_LSR_PE   (1 << 2)
 
#define UART_LSR_FE   (1 << 3)
 
#define UART_LSR_BI   (1 << 4)
 
#define UART_LSR_THRE   (1 << 5)
 
#define UART_LSR_TEMT   (1 << 6)
 
#define UART_LSR_RXFE   (1 << 7)
 
#define UART_LSR_BITMASK   ((uint8_t)(0xFF))
 
#define UART_LSR_ERROR_MASK    (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE | UART_LSR_BI | UART_LSR_RXFE)
 
#define UART_SCR_BIMASK   ((uint8_t)(0xFF))
 
#define UART_ACR_START   (1 << 0)
 
#define UART_ACR_MODE   (1 << 1)
 
#define UART_ACR_AUTO_RESTART   (1 << 2)
 
#define UART_ACR_ABEOINT_CLR   (1 << 8)
 
#define UART_ACR_ABTOINT_CLR   (1 << 9)
 
#define UART_ACR_BITMASK   ((uint32_t)(0x307))
 
#define UART_ICR_IRDAEN   (1 << 0)
 
#define UART_ICR_IRDAINV   (1 << 1)
 
#define UART_ICR_FIXPULSE_EN   (1 << 2)
 
#define UART_ICR_PULSEDIV(n)   ((uint32_t)(((n)&0x07)<<3))
 
#define UART_ICR_BITMASK   ((uint32_t)(0x3F))
 
#define UART_HDEN_HDEN   (1 << 0)
 
#define UART_SCICTRL_SCIEN   (1 << 0)
 
#define UART_SCICTRL_NACKDIS   (1 << 1)
 
#define UART_SCICTRL_PROTSEL_T1   (1 << 2)
 
#define UART_SCICTRL_TXRETRY(n)   ((uint32_t)(((n)&0x07)<<5))
 
#define UART_SCICTRL_GUARDTIME(n)   ((uint32_t)(((n)&0xFF)<<8))
 
#define UART_SYNCCTRL_SYNC   (1 << 0)
 
#define UART_SYNCCTRL_CSRC_MASTER   (1 << 1)
 
#define UART_SYNCCTRL_FES   (1 << 2)
 
#define UART_SYNCCTRL_TSBYPASS   (1 << 3)
 
#define UART_SYNCCTRL_CSCEN   (1 << 4)
 
#define UART_SYNCCTRL_NOSTARTSTOP   (1 << 5)
 
#define UART_SYNCCTRL_CCCLR   (1 << 6)
 
#define UART_FDR_DIVADDVAL(n)   ((uint32_t)((n)&0x0F))
 
#define UART_FDR_MULVAL(n)   ((uint32_t)(((n)<<4)&0xF0))
 
#define UART_FDR_BITMASK   ((uint32_t)(0xFF))
 
#define UART_TER_TXEN   (1 << 0) /* Transmit enable bit */
 
#define UART_FIFOLVL_RX(n)   ((uint32_t)((n)&0x0F))
 
#define UART_FIFOLVL_TX(n)   ((uint32_t)(((n)>>8)&0x0F))
 
#define UART_FIFOLVL_BITMASK   ((uint32_t)(0x0F0F))
 

Enumerations

enum  uart_databit_t { UART_DATABIT_5 = UART_LCR_WLEN5 , UART_DATABIT_6 = UART_LCR_WLEN6 , UART_DATABIT_7 = UART_LCR_WLEN7 , UART_DATABIT_8 = UART_LCR_WLEN8 }
 
enum  uart_stopbit_t { UART_STOPBIT_1 = UART_LCR_ONE_STOPBIT , UART_STOPBIT_2 = UART_LCR_TWO_STOPBIT }
 
enum  uart_parity_t {
  UART_PARITY_NONE = UART_LCR_NO_PARITY , UART_PARITY_ODD = (UART_LCR_PARITY_ODD | UART_LCR_PARITY_EN) , UART_PARITY_EVEN = (UART_LCR_PARITY_EVEN | UART_LCR_PARITY_EN) , UART_PARITY_SP_1 = (UART_LCR_PARITY_SP_1 | UART_LCR_PARITY_EN) ,
  UART_PARITY_SP_0 = (UART_LCR_PARITY_SP_0 | UART_LCR_PARITY_EN)
}
 
enum  uart_num_t { UART0_NUM = UART0 , UART1_NUM = UART1 , UART2_NUM = UART2 , UART3_NUM = UART3 }
 
enum  uart_error_t { UART_NO_ERROR = 0 , UART_TIMEOUT_ERROR = 1 }
 
enum  uart_rx_data_ready_t { UART_RX_NO_DATA = 0 , UART_RX_DATA_READY = 1 , UART_RX_DATA_ERROR = 2 }
 

Functions

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)
 
uart_rx_data_ready_t uart_rx_data_ready (uart_num_t uart_num)
 
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)
 
void uart_write (uart_num_t uart_num, uint8_t data)
 

Macro Definition Documentation

◆ UART0

#define UART0   USART0_BASE /* APB0 */

Definition at line 29 of file uart.h.

◆ UART1

#define UART1   UART1_BASE /* APB0 */

Definition at line 30 of file uart.h.

◆ UART1_IER_BITMASK

#define UART1_IER_BITMASK   ((uint32_t)(0x38F))

Definition at line 149 of file uart.h.

◆ UART1_IER_CTSINT_EN

#define UART1_IER_CTSINT_EN   (1 << 7)

Definition at line 141 of file uart.h.

◆ UART1_IER_MSINT_EN

#define UART1_IER_MSINT_EN   (1 << 3)

Definition at line 139 of file uart.h.

◆ UART1_IIR_INTID_MODEM

#define UART1_IIR_INTID_MODEM   (0 << 1)

Definition at line 158 of file uart.h.

◆ UART2

#define UART2   USART2_BASE /* APB2 */

Definition at line 31 of file uart.h.

◆ UART3

#define UART3   USART3_BASE /* APB2 */

Definition at line 32 of file uart.h.

◆ UART_ACR

#define UART_ACR (   port)    MMIO32((port) + 0x020)

Definition at line 66 of file uart.h.

◆ UART_ACR_ABEOINT_CLR

#define UART_ACR_ABEOINT_CLR   (1 << 8)

Definition at line 278 of file uart.h.

◆ UART_ACR_ABTOINT_CLR

#define UART_ACR_ABTOINT_CLR   (1 << 9)

Definition at line 280 of file uart.h.

◆ UART_ACR_AUTO_RESTART

#define UART_ACR_AUTO_RESTART   (1 << 2)

Definition at line 276 of file uart.h.

◆ UART_ACR_BITMASK

#define UART_ACR_BITMASK   ((uint32_t)(0x307))

Definition at line 282 of file uart.h.

◆ UART_ACR_MODE

#define UART_ACR_MODE   (1 << 1)

Definition at line 274 of file uart.h.

◆ UART_ACR_START

#define UART_ACR_START   (1 << 0)

Definition at line 272 of file uart.h.

◆ UART_DLL

#define UART_DLL (   port)    MMIO32((port) + 0x000) /* 8bits */

Definition at line 43 of file uart.h.

◆ UART_DLL_MASKBIT

#define UART_DLL_MASKBIT   ((uint8_t)0xFF)

Definition at line 118 of file uart.h.

◆ UART_DLM

#define UART_DLM (   port)    MMIO32((port) + 0x004) /* 8bits */

Definition at line 46 of file uart.h.

◆ UART_DLM_MASKBIT

#define UART_DLM_MASKBIT   ((uint8_t)0xFF)

Definition at line 124 of file uart.h.

◆ UART_FCR

#define UART_FCR (   port)    MMIO32((port) + 0x008)

Definition at line 55 of file uart.h.

◆ UART_FCR_BITMASK

#define UART_FCR_BITMASK   ((uint8_t)(0xCF))

Definition at line 198 of file uart.h.

◆ UART_FCR_DMAMODE_SEL

#define UART_FCR_DMAMODE_SEL   (1 << 3)

Definition at line 188 of file uart.h.

◆ UART_FCR_FIFO_EN

#define UART_FCR_FIFO_EN   (1 << 0)

Definition at line 182 of file uart.h.

◆ UART_FCR_RX_RS

#define UART_FCR_RX_RS   (1 << 1)

Definition at line 184 of file uart.h.

◆ UART_FCR_TRG_LEV0

#define UART_FCR_TRG_LEV0   (0 << 6)

Definition at line 190 of file uart.h.

◆ UART_FCR_TRG_LEV1

#define UART_FCR_TRG_LEV1   (1 << 6)

Definition at line 192 of file uart.h.

◆ UART_FCR_TRG_LEV2

#define UART_FCR_TRG_LEV2   (2 << 6)

Definition at line 194 of file uart.h.

◆ UART_FCR_TRG_LEV3

#define UART_FCR_TRG_LEV3   (3 << 6)

Definition at line 196 of file uart.h.

◆ UART_FCR_TX_RS

#define UART_FCR_TX_RS   (1 << 2)

Definition at line 186 of file uart.h.

◆ UART_FDR

#define UART_FDR (   port)    MMIO32((port) + 0x028)

Definition at line 72 of file uart.h.

◆ UART_FDR_BITMASK

#define UART_FDR_BITMASK   ((uint32_t)(0xFF))

Definition at line 345 of file uart.h.

◆ UART_FDR_DIVADDVAL

#define UART_FDR_DIVADDVAL (   n)    ((uint32_t)((n)&0x0F))

Definition at line 341 of file uart.h.

◆ UART_FDR_MULVAL

#define UART_FDR_MULVAL (   n)    ((uint32_t)(((n)<<4)&0xF0))

Definition at line 343 of file uart.h.

◆ UART_FIFOLVL_BITMASK

#define UART_FIFOLVL_BITMASK   ((uint32_t)(0x0F0F))

Definition at line 361 of file uart.h.

◆ UART_FIFOLVL_RX

#define UART_FIFOLVL_RX (   n)    ((uint32_t)((n)&0x0F))

Definition at line 357 of file uart.h.

◆ UART_FIFOLVL_TX

#define UART_FIFOLVL_TX (   n)    ((uint32_t)(((n)>>8)&0x0F))

Definition at line 359 of file uart.h.

◆ UART_HDEN

#define UART_HDEN (   port)    MMIO32((port) + 0x040)

Definition at line 78 of file uart.h.

◆ UART_HDEN_HDEN

#define UART_HDEN_HDEN   (1 << 0)

Definition at line 302 of file uart.h.

◆ UART_ICR

#define UART_ICR (   port)    MMIO32((port) + 0x024)

Definition at line 69 of file uart.h.

◆ UART_ICR_BITMASK

#define UART_ICR_BITMASK   ((uint32_t)(0x3F))

Definition at line 296 of file uart.h.

◆ UART_ICR_FIXPULSE_EN

#define UART_ICR_FIXPULSE_EN   (1 << 2)

Definition at line 292 of file uart.h.

◆ UART_ICR_IRDAEN

#define UART_ICR_IRDAEN   (1 << 0)

Definition at line 288 of file uart.h.

◆ UART_ICR_IRDAINV

#define UART_ICR_IRDAINV   (1 << 1)

Definition at line 290 of file uart.h.

◆ UART_ICR_PULSEDIV

#define UART_ICR_PULSEDIV (   n)    ((uint32_t)(((n)&0x07)<<3))

Definition at line 294 of file uart.h.

◆ UART_IER

#define UART_IER (   port)    MMIO32((port) + 0x004)

Definition at line 49 of file uart.h.

◆ UART_IER_ABEOINT_EN

#define UART_IER_ABEOINT_EN   (1 << 8)

Definition at line 143 of file uart.h.

◆ UART_IER_ABTOINT_EN

#define UART_IER_ABTOINT_EN   (1 << 9)

Definition at line 145 of file uart.h.

◆ UART_IER_BITMASK

#define UART_IER_BITMASK   ((uint32_t)(0x307))

Definition at line 147 of file uart.h.

◆ UART_IER_RBRINT_EN

#define UART_IER_RBRINT_EN   (1 << 0)

Definition at line 133 of file uart.h.

◆ UART_IER_RLSINT_EN

#define UART_IER_RLSINT_EN   (1 << 2)

Definition at line 137 of file uart.h.

◆ UART_IER_THREINT_EN

#define UART_IER_THREINT_EN   (1 << 1)

Definition at line 135 of file uart.h.

◆ UART_IIR

#define UART_IIR (   port)    MMIO32((port) + 0x008)

Definition at line 52 of file uart.h.

◆ UART_IIR_ABEO_INT

#define UART_IIR_ABEO_INT   (1 << 8)

Definition at line 172 of file uart.h.

◆ UART_IIR_ABTO_INT

#define UART_IIR_ABTO_INT   (1 << 9)

Definition at line 174 of file uart.h.

◆ UART_IIR_BITMASK

#define UART_IIR_BITMASK   ((uint32_t)(0x3CF))

Definition at line 176 of file uart.h.

◆ UART_IIR_FIFO_EN

#define UART_IIR_FIFO_EN   (3 << 6)

Definition at line 170 of file uart.h.

◆ UART_IIR_INTID_CTI

#define UART_IIR_INTID_CTI   (6 << 1)

Definition at line 166 of file uart.h.

◆ UART_IIR_INTID_MASK

#define UART_IIR_INTID_MASK   (7 << 1)

Definition at line 168 of file uart.h.

◆ UART_IIR_INTID_RDA

#define UART_IIR_INTID_RDA   (2 << 1)

Definition at line 162 of file uart.h.

◆ UART_IIR_INTID_RLS

#define UART_IIR_INTID_RLS   (3 << 1)

Definition at line 164 of file uart.h.

◆ UART_IIR_INTID_THRE

#define UART_IIR_INTID_THRE   (1 << 1)

Definition at line 160 of file uart.h.

◆ UART_IIR_INTSTAT_PEND

#define UART_IIR_INTSTAT_PEND   (1 << 0)

Definition at line 156 of file uart.h.

◆ UART_LCR

#define UART_LCR (   port)    MMIO32((port) + 0x00C)

Definition at line 58 of file uart.h.

◆ UART_LCR_BITMASK

#define UART_LCR_BITMASK   ((uint8_t)(0xFF))

Definition at line 234 of file uart.h.

◆ UART_LCR_BREAK_EN

#define UART_LCR_BREAK_EN   (1 << 6)

Definition at line 230 of file uart.h.

◆ UART_LCR_DLAB_EN

#define UART_LCR_DLAB_EN   (1 << 7)

Definition at line 232 of file uart.h.

◆ UART_LCR_NO_PARITY

#define UART_LCR_NO_PARITY   (0 << 3)

Definition at line 218 of file uart.h.

◆ UART_LCR_ONE_STOPBIT

#define UART_LCR_ONE_STOPBIT   (0 << 2)

Definition at line 213 of file uart.h.

◆ UART_LCR_PARITY_EN

#define UART_LCR_PARITY_EN   (1 << 3)

Definition at line 220 of file uart.h.

◆ UART_LCR_PARITY_EVEN

#define UART_LCR_PARITY_EVEN   (1 << 4)

Definition at line 224 of file uart.h.

◆ UART_LCR_PARITY_ODD

#define UART_LCR_PARITY_ODD   (0 << 4)

Definition at line 222 of file uart.h.

◆ UART_LCR_PARITY_SP_0

#define UART_LCR_PARITY_SP_0   ((1 << 5) | (1 << 4))

Definition at line 228 of file uart.h.

◆ UART_LCR_PARITY_SP_1

#define UART_LCR_PARITY_SP_1   (1 << 5)

Definition at line 226 of file uart.h.

◆ UART_LCR_TWO_STOPBIT

#define UART_LCR_TWO_STOPBIT   (1 << 2)

Definition at line 215 of file uart.h.

◆ UART_LCR_WLEN5

#define UART_LCR_WLEN5   (0 << 0)

Definition at line 205 of file uart.h.

◆ UART_LCR_WLEN6

#define UART_LCR_WLEN6   (1 << 0)

Definition at line 207 of file uart.h.

◆ UART_LCR_WLEN7

#define UART_LCR_WLEN7   (2 << 0)

Definition at line 209 of file uart.h.

◆ UART_LCR_WLEN8

#define UART_LCR_WLEN8   (3 << 0)

Definition at line 211 of file uart.h.

◆ UART_LOAD_DLL

#define UART_LOAD_DLL (   div)    ((div) & 0xFF)

Definition at line 115 of file uart.h.

◆ UART_LOAD_DLM

#define UART_LOAD_DLM (   div)    (((div) >> 8) & 0xFF)

Definition at line 127 of file uart.h.

◆ UART_LSR

#define UART_LSR (   port)    MMIO32((port) + 0x014)

Definition at line 63 of file uart.h.

◆ UART_LSR_BI

#define UART_LSR_BI   (1 << 4)

Definition at line 248 of file uart.h.

◆ UART_LSR_BITMASK

#define UART_LSR_BITMASK   ((uint8_t)(0xFF))

Definition at line 256 of file uart.h.

◆ UART_LSR_ERROR_MASK

#define UART_LSR_ERROR_MASK    (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE | UART_LSR_BI | UART_LSR_RXFE)

Definition at line 257 of file uart.h.

◆ UART_LSR_FE

#define UART_LSR_FE   (1 << 3)

Definition at line 246 of file uart.h.

◆ UART_LSR_OE

#define UART_LSR_OE   (1 << 1)

Definition at line 242 of file uart.h.

◆ UART_LSR_PE

#define UART_LSR_PE   (1 << 2)

Definition at line 244 of file uart.h.

◆ UART_LSR_RDR

#define UART_LSR_RDR   (1 << 0)

Definition at line 240 of file uart.h.

◆ UART_LSR_RXFE

#define UART_LSR_RXFE   (1 << 7)

Definition at line 254 of file uart.h.

◆ UART_LSR_TEMT

#define UART_LSR_TEMT   (1 << 6)

Definition at line 252 of file uart.h.

◆ UART_LSR_THRE

#define UART_LSR_THRE   (1 << 5)

Definition at line 250 of file uart.h.

◆ UART_OSR

#define UART_OSR (   port)    MMIO32((port) + 0x02C)

Definition at line 75 of file uart.h.

◆ UART_RBR

#define UART_RBR (   port)    MMIO32((port) + 0x000) /* 8bits */

Definition at line 37 of file uart.h.

◆ UART_RBR_MASKBIT

#define UART_RBR_MASKBIT   ((uint8_t)0xFF)

Definition at line 103 of file uart.h.

◆ UART_RS485ADRMATCH

#define UART_RS485ADRMATCH (   port)    MMIO32((port) + 0x050)

Definition at line 87 of file uart.h.

◆ UART_RS485CTRL

#define UART_RS485CTRL (   port)    MMIO32((port) + 0x04C)

Definition at line 84 of file uart.h.

◆ UART_RS485DLY

#define UART_RS485DLY (   port)    MMIO32((port) + 0x054)

Definition at line 90 of file uart.h.

◆ UART_SCICTRL

#define UART_SCICTRL (   port)    MMIO32((port) + 0x048)

Definition at line 81 of file uart.h.

◆ UART_SCICTRL_GUARDTIME

#define UART_SCICTRL_GUARDTIME (   n)    ((uint32_t)(((n)&0xFF)<<8))

Definition at line 316 of file uart.h.

◆ UART_SCICTRL_NACKDIS

#define UART_SCICTRL_NACKDIS   (1 << 1)

Definition at line 310 of file uart.h.

◆ UART_SCICTRL_PROTSEL_T1

#define UART_SCICTRL_PROTSEL_T1   (1 << 2)

Definition at line 312 of file uart.h.

◆ UART_SCICTRL_SCIEN

#define UART_SCICTRL_SCIEN   (1 << 0)

Definition at line 308 of file uart.h.

◆ UART_SCICTRL_TXRETRY

#define UART_SCICTRL_TXRETRY (   n)    ((uint32_t)(((n)&0x07)<<5))

Definition at line 314 of file uart.h.

◆ UART_SCR_BIMASK

#define UART_SCR_BIMASK   ((uint8_t)(0xFF))

Definition at line 265 of file uart.h.

◆ UART_SYNCCTRL

#define UART_SYNCCTRL (   port)    MMIO32((port) + 0x058)

Definition at line 93 of file uart.h.

◆ UART_SYNCCTRL_CCCLR

#define UART_SYNCCTRL_CCCLR   (1 << 6)

Definition at line 334 of file uart.h.

◆ UART_SYNCCTRL_CSCEN

#define UART_SYNCCTRL_CSCEN   (1 << 4)

Definition at line 330 of file uart.h.

◆ UART_SYNCCTRL_CSRC_MASTER

#define UART_SYNCCTRL_CSRC_MASTER   (1 << 1)

Definition at line 324 of file uart.h.

◆ UART_SYNCCTRL_FES

#define UART_SYNCCTRL_FES   (1 << 2)

Definition at line 326 of file uart.h.

◆ UART_SYNCCTRL_NOSTARTSTOP

#define UART_SYNCCTRL_NOSTARTSTOP   (1 << 5)

Definition at line 332 of file uart.h.

◆ UART_SYNCCTRL_SYNC

#define UART_SYNCCTRL_SYNC   (1 << 0)

Definition at line 322 of file uart.h.

◆ UART_SYNCCTRL_TSBYPASS

#define UART_SYNCCTRL_TSBYPASS   (1 << 3)

Definition at line 328 of file uart.h.

◆ UART_TER

#define UART_TER (   port)    MMIO32((port) + 0x05C)

Definition at line 96 of file uart.h.

◆ UART_TER_TXEN

#define UART_TER_TXEN   (1 << 0) /* Transmit enable bit */

Definition at line 351 of file uart.h.

◆ UART_THR

#define UART_THR (   port)    MMIO32((port) + 0x000) /* 8bits */

Definition at line 40 of file uart.h.

◆ UART_THR_MASKBIT

#define UART_THR_MASKBIT   ((uint8_t)0xFF)

Definition at line 109 of file uart.h.

◆ UART_TX_FIFO_SIZE

#define UART_TX_FIFO_SIZE   (16)

Definition at line 199 of file uart.h.

Enumeration Type Documentation

◆ uart_databit_t

Enumerator
UART_DATABIT_5 
UART_DATABIT_6 
UART_DATABIT_7 
UART_DATABIT_8 

Definition at line 370 of file uart.h.

◆ uart_error_t

Enumerator
UART_NO_ERROR 
UART_TIMEOUT_ERROR 

Definition at line 410 of file uart.h.

◆ uart_num_t

enum uart_num_t
Enumerator
UART0_NUM 
UART1_NUM 
UART2_NUM 
UART3_NUM 

Definition at line 403 of file uart.h.

◆ uart_parity_t

Enumerator
UART_PARITY_NONE 
UART_PARITY_ODD 
UART_PARITY_EVEN 
UART_PARITY_SP_1 
UART_PARITY_SP_0 

Definition at line 390 of file uart.h.

◆ uart_rx_data_ready_t

Enumerator
UART_RX_NO_DATA 
UART_RX_DATA_READY 
UART_RX_DATA_ERROR 

Definition at line 415 of file uart.h.

◆ uart_stopbit_t

Enumerator
UART_STOPBIT_1 
UART_STOPBIT_2 

Definition at line 380 of file uart.h.

Function Documentation

◆ uart_init()

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 
)

◆ uart_read()

uint8_t uart_read ( uart_num_t  uart_num)

◆ uart_read_timeout()

uint8_t uart_read_timeout ( uart_num_t  uart_num,
uint32_t  rx_timeout_nb_cycles,
uart_error_t error 
)

◆ uart_rx_data_ready()

uart_rx_data_ready_t uart_rx_data_ready ( uart_num_t  uart_num)

◆ uart_write()

void uart_write ( uart_num_t  uart_num,
uint8_t  data 
)