Rev 3581 | Rev 3655 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3581 | Rev 3646 | ||
---|---|---|---|
Line 132... | Line 132... | ||
132 | #endif |
132 | #endif |
133 | sysinfo_set_item_val("kbd.devno", NULL, devno); |
133 | sysinfo_set_item_val("kbd.devno", NULL, devno); |
134 | sysinfo_set_item_val("kbd.inr", NULL, inr); |
134 | sysinfo_set_item_val("kbd.inr", NULL, inr); |
135 | sysinfo_set_item_val("kbd.address.virtual", NULL, port); |
135 | sysinfo_set_item_val("kbd.address.virtual", NULL, port); |
136 | 136 | ||
- | 137 | #ifdef CONFIG_NS16550_INTERRUPT_DRIVEN |
|
- | 138 | /* Enable interrupts */ |
|
- | 139 | ns16550_ier_write(&ns16550, IER_ERBFI); |
|
- | 140 | ns16550_mcr_write(&ns16550, MCR_OUT2); |
|
- | 141 | #endif |
|
- | 142 | ||
137 | #ifdef ia64 |
143 | #ifdef ia64 |
138 | uint8_t c; |
144 | uint8_t c; |
139 | c = ns16550_lcr_read(&ns16550); |
145 | c = ns16550_lcr_read(&ns16550); |
140 | ns16550_lcr_write(&ns16550, 0x80 | c); |
146 | ns16550_lcr_write(&ns16550, 0x80 | c); |
141 | ns16550_rbr_write(&ns16550, 0x0c); |
147 | ns16550_rbr_write(&ns16550, 0x0c); |
Line 147... | Line 153... | ||
147 | } |
153 | } |
148 | 154 | ||
149 | /** Process ns16550 interrupt. */ |
155 | /** Process ns16550 interrupt. */ |
150 | void ns16550_interrupt(void) |
156 | void ns16550_interrupt(void) |
151 | { |
157 | { |
152 | /* TODO |
- | |
153 | * |
- | |
154 | * ns16550 works in the polled mode so far. |
158 | ns16550_poll(); |
155 | */ |
- | |
156 | } |
159 | } |
157 | 160 | ||
158 | /* Called from getc(). */ |
161 | /* Called from getc(). */ |
159 | void ns16550_resume(chardev_t *d) |
162 | void ns16550_resume(chardev_t *d) |
160 | { |
163 | { |
Line 199... | Line 202... | ||
199 | * |
202 | * |
200 | * This function can be used to implement keyboard polling. |
203 | * This function can be used to implement keyboard polling. |
201 | */ |
204 | */ |
202 | void ns16550_poll(void) |
205 | void ns16550_poll(void) |
203 | { |
206 | { |
- | 207 | #ifndef CONFIG_NS16550_INTERRUPT_DRIVEN |
|
204 | ipl_t ipl; |
208 | ipl_t ipl; |
205 | 209 | ||
206 | ipl = interrupts_disable(); |
210 | ipl = interrupts_disable(); |
207 | spinlock_lock(&ns16550_irq.lock); |
211 | spinlock_lock(&ns16550_irq.lock); |
208 | 212 | ||
Line 218... | Line 222... | ||
218 | } |
222 | } |
219 | } |
223 | } |
220 | 224 | ||
221 | spinlock_unlock(&ns16550_irq.lock); |
225 | spinlock_unlock(&ns16550_irq.lock); |
222 | interrupts_restore(ipl); |
226 | interrupts_restore(ipl); |
- | 227 | #endif |
|
223 | 228 | ||
224 | while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY) { |
229 | while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY) { |
225 | uint8_t x; |
230 | uint8_t x; |
226 | 231 | ||
227 | x = ns16550_rbr_read(&ns16550); |
232 | x = ns16550_rbr_read(&ns16550); |
Line 249... | Line 254... | ||
249 | return (ns16550_lsr_read(&ns16550) & LSR_DATA_READY); |
254 | return (ns16550_lsr_read(&ns16550) & LSR_DATA_READY); |
250 | } |
255 | } |
251 | 256 | ||
252 | void ns16550_irq_handler(irq_t *irq, void *arg, ...) |
257 | void ns16550_irq_handler(irq_t *irq, void *arg, ...) |
253 | { |
258 | { |
254 | panic("Not yet implemented, ns16550 works in polled mode.\n"); |
259 | if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) |
- | 260 | ipc_irq_send_notif(irq); |
|
- | 261 | else |
|
- | 262 | ns16550_interrupt(); |
|
255 | } |
263 | } |
256 | 264 | ||
257 | /** @} |
265 | /** @} |
258 | */ |
266 | */ |