Changes in uspace/srv/hid/kbd/port/ns16550.c [d9fae235:36e9cd1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/kbd/port/ns16550.c
rd9fae235 r36e9cd1 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>46 45 47 46 /* NS16550 registers */ 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. */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. */ 55 54 56 #define LSR_DATA_READY 55 #define LSR_DATA_READY 0x01 57 56 58 57 static irq_cmd_t ns16550_cmds[] = { 59 58 { 60 59 .cmd = CMD_PIO_READ_8, 61 .addr = (void *) 0, /* Will be patched in run-time */60 .addr = (void *) 0, /* will be patched in run-time */ 62 61 .dstarg = 1 63 62 }, … … 75 74 { 76 75 .cmd = CMD_PIO_READ_8, 77 .addr = (void *) 0, /* Will be patched in run-time */76 .addr = (void *) 0, /* will be patched in run-time */ 78 77 .dstarg = 2 79 78 }, … … 97 96 void *vaddr; 98 97 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 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"); 109 102 ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); 110 103 ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); 111 112 async_set_interrupt_received(ns16550_irq_handler); 113 ipc_register_irq(inr, device_assign_devno(), inr, &ns16550_kbd); 114 104 ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), 105 sysinfo_value("kbd.inr"), &ns16550_kbd); 115 106 return pio_enable((void *) ns16550_physical, 8, &vaddr); 116 107 }
Note:
See TracChangeset
for help on using the changeset viewer.