Changeset d9fae235 in mainline for uspace/srv/hid/kbd/port/ns16550.c
- Timestamp:
- 2010-04-17T01:28:38Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9d6bfa5
- Parents:
- 9256ad29
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/kbd/port/ns16550.c
r9256ad29 rd9fae235 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 * @brief 34 * @brief NS16550 port driver. 35 35 */ 36 36 … … 43 43 #include <sun.h> 44 44 #include <ddi.h> 45 #include <errno.h> 45 46 46 47 /* NS16550 registers */ 47 #define RBR_REG 0/** Receiver Buffer Register. */48 #define IER_REG 1/** Interrupt Enable Register. */49 #define IIR_REG 2/** Interrupt Ident Register (read). */50 #define FCR_REG 2/** FIFO control register (write). */51 #define LCR_REG 3/** Line Control register. */52 #define MCR_REG 4/** Modem Control Register. */53 #define LSR_REG 5/** Line Status Register. */48 #define RBR_REG 0 /** Receiver Buffer Register. */ 49 #define IER_REG 1 /** Interrupt Enable Register. */ 50 #define IIR_REG 2 /** Interrupt Ident Register (read). */ 51 #define FCR_REG 2 /** FIFO control register (write). */ 52 #define LCR_REG 3 /** Line Control register. */ 53 #define MCR_REG 4 /** Modem Control Register. */ 54 #define LSR_REG 5 /** Line Status Register. */ 54 55 55 #define LSR_DATA_READY 56 #define LSR_DATA_READY 0x01 56 57 57 58 static irq_cmd_t ns16550_cmds[] = { 58 59 { 59 60 .cmd = CMD_PIO_READ_8, 60 .addr = (void *) 0, /* will be patched in run-time */61 .addr = (void *) 0, /* Will be patched in run-time */ 61 62 .dstarg = 1 62 63 }, … … 74 75 { 75 76 .cmd = CMD_PIO_READ_8, 76 .addr = (void *) 0, /* will be patched in run-time */77 .addr = (void *) 0, /* Will be patched in run-time */ 77 78 .dstarg = 2 78 79 }, … … 96 97 void *vaddr; 97 98 98 async_set_interrupt_received(ns16550_irq_handler); 99 100 ns16550_physical = sysinfo_value("kbd.address.physical"); 101 ns16550_kernel = sysinfo_value("kbd.address.kernel"); 99 if (sysinfo_get_value("kbd.address.physical", &ns16550_physical) != EOK) 100 return -1; 101 102 if (sysinfo_get_value("kbd.address.kernel", &ns16550_kernel) != EOK) 103 return -1; 104 105 sysarg_t inr; 106 if (sysinfo_get_value("kbd.inr", &inr) != EOK) 107 return -1; 108 102 109 ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); 103 110 ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); 104 ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), 105 sysinfo_value("kbd.inr"), &ns16550_kbd); 111 112 async_set_interrupt_received(ns16550_irq_handler); 113 ipc_register_irq(inr, device_assign_devno(), inr, &ns16550_kbd); 114 106 115 return pio_enable((void *) ns16550_physical, 8, &vaddr); 107 116 }
Note:
See TracChangeset
for help on using the changeset viewer.