25 #define UART_FCR_FE 0x01 29 #define UART_LCR_WLS0 0x01 30 #define UART_LCR_WLS1 0x02 31 #define UART_LCR_STB 0x04 32 #define UART_LCR_PEN 0x08 33 #define UART_LCR_EPS 0x10 34 #define UART_LCR_DLAB 0x80 36 #define UART_LCR_WORD_LEN(x) ( ( (x) - 5 ) << 0 ) 37 #define UART_LCR_STOP_BITS(x) ( ( (x) - 1 ) << 2 ) 38 #define UART_LCR_PARITY(x) ( ( (x) - 0 ) << 3 ) 48 #define UART_LCR_WPS( word_len, parity, stop_bits ) \ 49 ( UART_LCR_WORD_LEN ( (word_len) ) | \ 50 UART_LCR_PARITY ( (parity) ) | \ 51 UART_LCR_STOP_BITS ( (stop_bits) ) ) 54 #define UART_LCR_8N1 UART_LCR_WPS ( 8, 0, 1 ) 58 #define UART_MCR_DTR 0x01 59 #define UART_MCR_RTS 0x02 63 #define UART_LSR_DR 0x01 64 #define UART_LSR_THRE 0x20 65 #define UART_LSR_TEMT 0x40 77 #define UART_MAX_BAUD 115200 97 #include <bits/uart.h>
uint16_t divisor
Baud rate divisor.
static int uart_data_ready(struct uart *uart)
Check if received data is ready.
#define UART_LSR
Line status register.
uart_port
Symbolic names for port indexes.
uint8_t lcr
Line control register.
void * base
I/O port base address.
void uart_flush(struct uart *uart)
Flush data.
static uint8_t uart_receive(struct uart *uart)
Receive data.
int uart_select(struct uart *uart, unsigned int port)
Select UART port.
int uart_init(struct uart *uart, unsigned int baud, uint8_t lcr)
Initialise UART.
static unsigned int uint8_t data
#define UART_RBR
Receiver buffer register.
void uart_write(struct uart *uart, unsigned int addr, uint8_t data)
uint8_t uart_read(struct uart *uart, unsigned int addr)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void uart_transmit(struct uart *uart, uint8_t data)
Transmit data.
int uart_exists(struct uart *uart)
Check for existence of UART.
#define UART_LSR_DR
Data ready.