Changeset af75db9 in mainline for kernel/genarch/src/kbd/ns16550.c
- Timestamp:
- 2009-02-12T20:05:15Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 912ee7c
- Parents:
- 95b9963
- File:
-
- 1 edited
-
kernel/genarch/src/kbd/ns16550.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/kbd/ns16550.c
r95b9963 raf75db9 40 40 #include <genarch/kbd/scanc_sun.h> 41 41 #include <arch/drivers/kbd.h> 42 #ifndef ia6443 #include <arch/drivers/ns16550.h>44 #endif45 42 #include <ddi/irq.h> 46 43 #include <ipc/irq.h> … … 131 128 ns16550_irq.cir_arg = cir_arg; 132 129 irq_register(&ns16550_irq); 133 134 130 135 131 while ((ns16550_lsr_read(&ns16550) & LSR_DATA_READY)) 136 132 ns16550_rbr_read(&ns16550); 137 138 133 139 134 sysinfo_set_item_val("kbd", NULL, true); … … 143 138 sysinfo_set_item_val("kbd.address.virtual", NULL, port); 144 139 sysinfo_set_item_val("kbd.port", NULL, port); 145 140 146 141 #ifdef CONFIG_NS16550_INTERRUPT_DRIVEN 147 142 /* Enable interrupts */ 148 ns16550_ier_write(&ns16550, IER_ERBFI);143 ns16550_ier_write(&ns16550, IER_ERBFI); 149 144 ns16550_mcr_write(&ns16550, MCR_OUT2); 150 145 #endif 151 152 #ifdef ia64 153 uint8_t c; 154 // This switches rbr & ier to mode when accept baudrate constant 155 c = ns16550_lcr_read(&ns16550); 156 ns16550_lcr_write(&ns16550, 0x80 | c); 157 ns16550_rbr_write(&ns16550, 0x0c); 158 ns16550_ier_write(&ns16550, 0x00); 159 ns16550_lcr_write(&ns16550, c); 160 #endif 146 147 uint8_t c; 148 // This switches rbr & ier to mode when accept baudrate constant 149 c = ns16550_lcr_read(&ns16550); 150 ns16550_lcr_write(&ns16550, 0x80 | c); 151 ns16550_rbr_write(&ns16550, 0x0c); 152 ns16550_ier_write(&ns16550, 0x00); 153 ns16550_lcr_write(&ns16550, c); 161 154 162 155 ns16550_grab(); … … 186 179 while(!(ch = active_read_buff_read())) { 187 180 uint8_t x; 188 while (!(ns16550_lsr_read(&ns16550) & LSR_DATA_READY)) 189 ;181 while (!(ns16550_lsr_read(&ns16550) & LSR_DATA_READY)); 182 190 183 x = ns16550_rbr_read(&ns16550); 191 #ifndef ia64 184 192 185 if (x != IGNORE_CODE) { 193 186 if (x & KEY_RELEASE) … … 196 189 active_read_key_pressed(x); 197 190 } 198 #else199 extern chardev_t kbrd;200 if(x != 0x0d) {201 if(x == 0x7f)202 x = '\b';203 chardev_push_character(&kbrd, x);204 }205 #endif206 207 191 } 208 192 return ch; … … 215 199 void ns16550_poll(void) 216 200 { 217 #ifndef CONFIG_NS16550_INTERRUPT_DRIVEN 201 #ifndef CONFIG_NS16550_INTERRUPT_DRIVEN 218 202 ipl_t ipl; 219 203 … … 241 225 242 226 x = ns16550_rbr_read(&ns16550); 243 #ifndef ia64 227 244 228 if (x != IGNORE_CODE) { 245 229 if (x & KEY_RELEASE) … … 248 232 key_pressed(x); 249 233 } 250 #else251 extern chardev_t kbrd;252 if(x != 0x0d) {253 if (x == 0x7f)254 x = '\b';255 chardev_push_character(&kbrd, x);256 }257 #endif258 259 234 } 260 235 }
Note:
See TracChangeset
for help on using the changeset viewer.
