Rev 4153 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4153 | Rev 4327 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | /** @file |
33 | /** @file |
34 | * @brief NS16550 port driver. |
34 | * @brief NS16550 port driver. |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #include <ipc/ipc.h> |
37 | #include <ipc/ipc.h> |
- | 38 | #include <ipc/bus.h> |
|
38 | #include <async.h> |
39 | #include <async.h> |
39 | #include <sysinfo.h> |
40 | #include <sysinfo.h> |
40 | #include <kbd.h> |
41 | #include <kbd.h> |
41 | #include <kbd_port.h> |
42 | #include <kbd_port.h> |
- | 43 | #include <sun.h> |
|
42 | #include <ddi.h> |
44 | #include <ddi.h> |
43 | 45 | ||
44 | /* NS16550 registers */ |
46 | /* NS16550 registers */ |
45 | #define RBR_REG 0 /** Receiver Buffer Register. */ |
47 | #define RBR_REG 0 /** Receiver Buffer Register. */ |
46 | #define IER_REG 1 /** Interrupt Enable Register. */ |
48 | #define IER_REG 1 /** Interrupt Enable Register. */ |
Line 87... | Line 89... | ||
87 | static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call); |
89 | static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call); |
88 | 90 | ||
89 | static uintptr_t ns16550_physical; |
91 | static uintptr_t ns16550_physical; |
90 | static uintptr_t ns16550_kernel; |
92 | static uintptr_t ns16550_kernel; |
91 | 93 | ||
92 | int kbd_port_init(void) |
94 | int ns16550_port_init(void) |
93 | { |
95 | { |
94 | void *vaddr; |
96 | void *vaddr; |
95 | 97 | ||
96 | async_set_interrupt_received(ns16550_irq_handler); |
98 | async_set_interrupt_received(ns16550_irq_handler); |
97 | 99 | ||
98 | ns16550_physical = sysinfo_value("kbd.address.physical"); |
100 | ns16550_physical = sysinfo_value("kbd.address.physical"); |
99 | ns16550_kernel = sysinfo_value("kbd.address.kernel"); |
101 | ns16550_kernel = sysinfo_value("kbd.address.kernel"); |
100 | ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); |
102 | ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); |
101 | ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); |
103 | ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); |
102 | ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), |
104 | ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), |
103 | 0, &ns16550_kbd); |
105 | sysinfo_value("kbd.inr"), &ns16550_kbd); |
104 | return pio_enable((void *) ns16550_physical, 8, &vaddr); |
106 | return pio_enable((void *) ns16550_physical, 8, &vaddr); |
105 | } |
107 | } |
106 | 108 | ||
107 | static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
109 | static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
108 | { |
110 | { |
109 | int scan_code = IPC_GET_ARG2(*call); |
111 | int scan_code = IPC_GET_ARG2(*call); |
110 | kbd_push_scancode(scan_code); |
112 | kbd_push_scancode(scan_code); |
- | 113 | ||
- | 114 | if (cir_service) |
|
- | 115 | async_msg_1(cir_phone, BUS_CLEAR_INTERRUPT, |
|
- | 116 | IPC_GET_METHOD(*call)); |
|
111 | } |
117 | } |
112 | 118 | ||
113 | /** |
119 | /** |
114 | * @} |
120 | * @} |
115 | */ |
121 | */ |