32#define UART_LCR_DLAB 0x80
34#define UART_8250_MAX 4
44#define IO(u) (&((struct uart_8250 *) (u))->io)
105 for (
size_t i = 0; i < 100000 && !
serial_empty(io); ++i)
166 printk(
"8250: ttyS%d at %p (%s), irq %d\n",
id, (
void *) pd->
io.
addr,
static int uart_8250_init(void)
Attaches to the platform's 8250s that are there, as /dev/ttyS0 and up, in the platform's order.
static int uart_8250_present(struct ioaddr *io)
Returns whether a UART is really there: its scratch register keeps what is written to it,...
static int serial_empty(struct ioaddr *io)
Returns whether the transmitter can take a character.
static int serial_received(struct ioaddr *io)
Returns whether a received character is waiting.
static char uart_8250_receive(struct uart *u)
Takes one received character.
static ssize_t uart_8250_transmit(struct uart *u, char c)
Sends one character, once the transmitter can take it.
static void uart_8250_comm_init(struct uart *u)
Sets a UART up when it is first opened: 38400 baud, 8 bits, no parity, one stop bit,...
static int uart_8250_attach(const struct platform_device *pd, int id)
Attaches to one of the platform's 8250s, if it is there, as /dev/ttyS<id>.
static void uart_8250_irq(void *arg)
Handles a UART's interrupt: every received character goes to the terminal, or is dropped if no one ha...
static uint8_t io_in8(struct ioaddr *io, uintptr_t off)
Reads an 8-, 16- or 32-bit register.
static void io_out8(struct ioaddr *io, uintptr_t off, uint8_t val)
Writes an 8-, 16- or 32-bit register.
static char * ioaddr_type_str(struct ioaddr *io)
void uart_transmit_handler(struct uart *u, size_t size)
Sends characters that the terminal output to its UART.
int uart_register(int id, struct uart *u)
Registers a UART, as /dev/ttyS<id>.
void uart_receive_handler(struct uart *u, size_t size)
Takes characters a UART received, and gives them to its terminal.
#define MALLOC_DEFINE(type, _name, _desc)
void * kmalloc(size_t size, struct malloc_type *type, int flags)
Allocates memory for one of the kernel's structures.
void kfree(void *)
Frees an object that kmalloc() gave.
#define MODULE_INIT(name, i, f)
int printk(const char *fmt,...)
Writes a kernel message, to the message buffer and the consoles.
Where a device's registers are.
One UART: the terminal layer's struct uart (first, so that a pointer to one is a pointer to the other...
ssize_t(*) transmit(struct uart *u, char c)
void(*) init(struct uart *u)
char(*) receive(struct uart *u)