|
Public Types |
| typedef unsigned | TransferMode |
| | Type UART transfer mode (Bits, Stopbits etc.
|
| typedef unsigned | BaudRate |
| | Type for baud rate.
|
| enum | { Base_rate = 115200,
Base_ier_bits = 0
} |
| enum | {
PAR_NONE = 0x00,
PAR_EVEN = 0x18,
PAR_ODD = 0x08,
DAT_5 = 0x00,
DAT_6 = 0x01,
DAT_7 = 0x02,
DAT_8 = 0x03,
STOP_1 = 0x00,
STOP_2 = 0x04,
MODE_8N1 = PAR_NONE | DAT_8 | STOP_1,
MODE_7E1 = PAR_EVEN | DAT_7 | STOP_1,
MODE_NC = 0x1000000,
BAUD_NC = 0x1000000
} |
Public Member Functions |
| | Uart () |
| | ctor
|
| | ~Uart () |
| | dtor
|
| void | shutdown () |
| | (abstract) Shutdown the serial port.
|
| int const | irq () const |
| | (abstract) Get the IRQ assigned to the port.
|
| void | enable_rcv_irq () |
| | (abstract) Enable rcv IRQ in UART.
|
| void | disable_rcv_irq () |
| | (abstract) Disable rcv IRQ in UART.
|
| bool | change_mode (TransferMode m, BaudRate r) |
| | (abstract) Change transfer mode or speed.
|
| TransferMode | get_mode () |
| | (abstract) Get the current transfer mode.
|
| int | write (char const *str, size_t len) |
| | (abstract) Write str.
|
| int | getchar (bool blocking=true) |
| | (abstract) Read a character.
|
| int | char_avail () const |
| | (abstract) Is there anything to read?
|
| Mword | get_attributes () const |
| | Console attributes.
|
| bool | startup (Address port, int irq) |
| | Start this serial port for I/O.
|
Private Types |
| enum | Registers {
TRB = 0,
BRD_LOW = 0,
IER = 1,
BRD_HIGH = 1,
IIR = 2,
FCR = 2,
LCR = 3,
MCR = 4,
LSR = 5,
MSR = 6,
SPR = 7
} |
Private Member Functions |
| void | outb (Unsigned8 b, Registers reg) |
| Unsigned8 | inb (Registers reg) const |
| void | mcr (Unsigned8 b) |
| Unsigned8 | mcr () const |
| void | fcr (Unsigned8 b) |
| void | lcr (Unsigned8 b) |
| Unsigned8 | lcr () const |
| void | ier (Unsigned8 b) |
| Unsigned8 | ier () const |
| Unsigned8 | iir () const |
| Unsigned8 | msr () const |
| Unsigned8 | lsr () const |
| void | trb (Unsigned8 b) |
| Unsigned8 | trb () const |
| bool | valid () |
Private Attributes |
| Address | port |
| int | _irq |