|
AquilaOS documentation
How it works, and its code
|
The driver for the 8250 UART and its successors, such as the 16550 with its FIFOs: the PC's serial ports, /dev/ttyS0 and up. More...
#include <core/system.h>#include <core/module.h>#include <dev/tty.h>#include <dev/uart.h>#include <dev/irq.h>#include <dev/platform.h>#include <cpu/io.h>#include <mm/mm.h>Go to the source code of this file.
Data Structures | |
| struct | uart_8250 |
| One UART: the terminal layer's struct uart (first, so that a pointer to one is a pointer to the other), and its registers. More... | |
Macros | |
| #define | UART_IER 1 |
| #define | UART_FCR 2 |
| #define | UART_LCR 3 |
| #define | UART_MCR 4 |
| #define | UART_LSR 5 |
| #define | UART_SCR 7 |
| #define | UART_DLL 0 |
| #define | UART_DLH 1 |
| #define | UART_LCR_DLAB 0x80 |
| #define | UART_8250_MAX 4 |
| #define | IO(u) |
Functions | |
| 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_irq (void *arg) |
| Handles a UART's interrupt: every received character goes to the terminal, or is dropped if no one has opened 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, the FIFOs, and the receive interrupt. | |
| static int | uart_8250_present (struct ioaddr *io) |
| Returns whether a UART is really there: its scratch register keeps what is written to it, where no device would read back all ones. | |
| 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 int | uart_8250_init (void) |
| Attaches to the platform's 8250s that are there, as /dev/ttyS0 and up, in the platform's order. | |
The driver for the 8250 UART and its successors, such as the 16550 with its FIFOs: the PC's serial ports, /dev/ttyS0 and up.
The driver attaches to each 8250 the platform lists (dev/platform.h) that is really there, in the platform's order. Output is written one character at a time, waiting until the transmitter is empty. Input comes with the UART's interrupt, which drains the receive FIFO into the terminal. The registers may be ports or memory (struct ioaddr).
Definition in file 8250.c.
| #define IO | ( | u | ) |
Definition at line 44 of file 8250.c.
Referenced by uart_8250_comm_init(), uart_8250_irq(), uart_8250_receive(), and uart_8250_transmit().
| #define UART_8250_MAX 4 |
Definition at line 34 of file 8250.c.
Referenced by uart_8250_init().
| #define UART_LSR 5 |
Definition at line 28 of file 8250.c.
Referenced by serial_empty(), and serial_received().
| #define UART_SCR 7 |
Definition at line 29 of file 8250.c.
Referenced by uart_8250_present().
|
static |
Returns whether the transmitter can take a character.
Definition at line 47 of file 8250.c.
References io_in8(), serial_empty(), and UART_LSR.
Referenced by serial_empty(), uart_8250_comm_init(), uart_8250_irq(), and uart_8250_transmit().
|
static |
Returns whether a received character is waiting.
Definition at line 53 of file 8250.c.
References io_in8(), serial_received(), and UART_LSR.
Referenced by serial_received(), and uart_8250_irq().
|
static |
Attaches to one of the platform's 8250s, if it is there, as /dev/ttyS<id>.
Returns 0, or a negative errno.
Definition at line 139 of file 8250.c.
References ioaddr::addr, uart::init, platform_device::io, uart_8250::io, ioaddr_type_str(), platform_device::irq, irq_install(), kfree(), kmalloc(), M_ZERO, uart::name, platform_device::nirq, platform_device_io(), printk(), uart::receive, uart::transmit, uart_8250::uart, uart_8250_attach(), uart_8250_comm_init(), uart_8250_irq(), uart_8250_present(), uart_8250_receive(), uart_8250_transmit(), and uart_register().
Referenced by uart_8250_attach(), and uart_8250_init().
|
static |
Sets a UART up when it is first opened: 38400 baud, 8 bits, no parity, one stop bit, the FIFOs, and the receive interrupt.
Definition at line 99 of file 8250.c.
References IO, io_in8(), io_out8(), serial_empty(), uart_8250_comm_init(), UART_DLH, UART_DLL, UART_FCR, UART_IER, UART_LCR, UART_LCR_DLAB, and UART_MCR.
Referenced by uart_8250_attach(), and uart_8250_comm_init().
|
static |
Attaches to the platform's 8250s that are there, as /dev/ttyS0 and up, in the platform's order.
Definition at line 175 of file 8250.c.
References platform_device_get(), uart_8250_attach(), uart_8250_init(), and UART_8250_MAX.
Referenced by uart_8250_init().
|
static |
Handles a UART's interrupt: every received character goes to the terminal, or is dropped if no one has opened it.
Definition at line 77 of file 8250.c.
References IO, serial_empty(), serial_received(), uart::tty, uart_8250_irq(), uart_8250_receive(), uart_receive_handler(), and uart_transmit_handler().
Referenced by uart_8250_attach(), and uart_8250_irq().
|
static |
Returns whether a UART is really there: its scratch register keeps what is written to it, where no device would read back all ones.
Definition at line 126 of file 8250.c.
References io_in8(), io_out8(), uart_8250_present(), and UART_SCR.
Referenced by uart_8250_attach(), and uart_8250_present().
|
static |
Takes one received character.
Definition at line 59 of file 8250.c.
References IO, io_in8(), and uart_8250_receive().
Referenced by uart_8250_attach(), uart_8250_irq(), and uart_8250_receive().
Sends one character, once the transmitter can take it.
Definition at line 65 of file 8250.c.
References IO, io_out8(), serial_empty(), and uart_8250_transmit().
Referenced by uart_8250_attach(), and uart_8250_transmit().