38,10 → 38,18 |
#include <arch/types.h> |
#include <arch/drivers/kbd.h> |
|
/* NS16550 registers */ |
#define RBR_REG 0 /** Receiver Buffer Register. */ |
#define IER_REG 1 /** Interrupt Enable Register. */ |
#define IIR_REG 2 /** Interrupt Ident Register (read). */ |
#define FCR_REG 2 /** FIFO control register (write). */ |
#define LCR_REG 3 /** Line Control register. */ |
#define LSR_REG 5 /** Line Status Register. */ |
|
#define IER_ERBFI 0x01 /** Enable Receive Buffer Full Interrupt. */ |
|
#define LCR_DLAB 0x80 /** Divisor Latch Access bit. */ |
|
static inline uint8_t ns16550_rbr_read(void) |
{ |
return kbd_virt_address[RBR_REG]; |
57,6 → 65,26 |
kbd_virt_address[IER_REG] = v; |
} |
|
static inline uint8_t ns16550_iir_read(void) |
{ |
return kbd_virt_address[IIR_REG]; |
} |
|
static inline void ns16550_fcr_write(uint8_t v) |
{ |
kbd_virt_address[FCR_REG] = v; |
} |
|
static inline uint8_t ns16550_lcr_read(void) |
{ |
return kbd_virt_address[LCR_REG]; |
} |
|
static inline void ns16550_lcr_write(uint8_t v) |
{ |
kbd_virt_address[LCR_REG] = v; |
} |
|
static inline uint8_t ns16550_lsr_read(void) |
{ |
return kbd_virt_address[LSR_REG]; |