Changeset af75db9 in mainline for kernel/genarch/src
- Timestamp:
- 2009-02-12T20:05:15Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 912ee7c
- Parents:
- 95b9963
- Location:
- kernel/genarch/src/kbd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/kbd/i8042.c
r95b9963 raf75db9 38 38 39 39 #include <genarch/kbd/i8042.h> 40 #ifdef ia6441 40 #include <arch/drivers/kbd.h> 42 #endif43 41 #include <genarch/kbd/key.h> 44 42 #include <genarch/kbd/scanc.h> … … 172 170 i8042_mouse_irq.handler = i8042_irq_handler; 173 171 irq_register(&i8042_mouse_irq); 174 #ifndef ia64172 175 173 trap_virtual_enable_irqs(1 << kbd_inr); 176 174 trap_virtual_enable_irqs(1 << mouse_inr); 177 #endif175 178 176 /* 179 177 * Clear input buffer. … … 190 188 #ifdef KBD_LEGACY 191 189 sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); 192 #endif 190 #endif 193 191 sysinfo_set_item_val("mouse", NULL, true); 194 192 sysinfo_set_item_val("mouse.devno", NULL, mouse_devno); … … 210 208 char i8042_key_read(chardev_t *d) 211 209 { 212 char ch; 213 214 while (!(ch = active_read_buff_read())) {210 char ch; 211 212 while (!(ch = active_read_buff_read())) { 215 213 uint8_t x; 216 while (!(i8042_status_read() & i8042_BUFFER_FULL_MASK)) 217 ; 214 215 while (!(i8042_status_read() & i8042_BUFFER_FULL_MASK)); 216 218 217 x = i8042_data_read(); 219 218 if (x & KEY_RELEASE) … … 232 231 { 233 232 uint8_t x; 234 233 235 234 while (((x = i8042_status_read() & i8042_BUFFER_FULL_MASK))) { 236 235 x = i8042_data_read(); -
kernel/genarch/src/kbd/key.c
r95b9963 raf75db9 41 41 #endif 42 42 43 #if (defined( sparc64))43 #if (defined(US)) || (defined(US3)) 44 44 #include <genarch/kbd/scanc_sun.h> 45 45 #endif -
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 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.