Changeset ddf1255 in mainline
- Timestamp:
- 2007-05-10T15:05:37Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 51ec40f
- Parents:
- b8f11baa
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/kbd/i8042.c
rb8f11baa rddf1255 75 75 76 76 #define i8042_BUFFER_FULL_MASK 0x01 77 #define i8042_WAIT_MASK 78 #define i8042_MOUSE_DATA 77 #define i8042_WAIT_MASK 0x02 78 #define i8042_MOUSE_DATA 0x20 79 79 80 80 static void i8042_suspend(chardev_t *); … … 91 91 static irq_t i8042_mouse_irq; 92 92 93 /** Wait until the controller reads its data. */94 static void i8042_wait(void) {95 while (i8042_status_read() & i8042_WAIT_MASK) {96 /* wait */97 }98 }99 100 93 void i8042_grab(void) 101 94 { 102 95 ipl_t ipl = interrupts_disable(); 103 96 104 i8042_wait();105 i8042_command_write(i8042_SET_COMMAND);106 i8042_wait();107 i8042_data_write(i8042_COMMAND);108 i8042_wait();109 110 97 spinlock_lock(&i8042_kbd_irq.lock); 111 98 i8042_kbd_irq.notif_cfg.notify = false; … … 141 128 } 142 129 143 static void i8042_ kbd_irq_handler(irq_t *irq, void *arg, ...)130 static void i8042_irq_handler(irq_t *irq, void *arg, ...) 144 131 { 145 132 if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) 146 133 ipc_irq_send_notif(irq); 147 134 else { 148 uint8_t x;135 uint8_t data; 149 136 uint8_t status; 150 137 151 138 while (((status = i8042_status_read()) & i8042_BUFFER_FULL_MASK)) { 152 x= i8042_data_read();139 data = i8042_data_read(); 153 140 154 141 if ((status & i8042_MOUSE_DATA)) 155 142 continue; 156 157 if ( x& KEY_RELEASE)158 key_released( x^ KEY_RELEASE);143 144 if (data & KEY_RELEASE) 145 key_released(data ^ KEY_RELEASE); 159 146 else 160 key_pressed( x);147 key_pressed(data); 161 148 } 162 149 } 163 }164 165 static void i8042_mouse_irq_handler(irq_t *irq, void *arg, ...)166 {167 if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)168 ipc_irq_send_notif(irq);169 150 } 170 151 … … 179 160 i8042_kbd_irq.inr = kbd_inr; 180 161 i8042_kbd_irq.claim = i8042_claim; 181 i8042_kbd_irq.handler = i8042_ kbd_irq_handler;162 i8042_kbd_irq.handler = i8042_irq_handler; 182 163 irq_register(&i8042_kbd_irq); 183 164 … … 186 167 i8042_mouse_irq.inr = mouse_inr; 187 168 i8042_mouse_irq.claim = i8042_claim; 188 i8042_mouse_irq.handler = i8042_ mouse_irq_handler;169 i8042_mouse_irq.handler = i8042_irq_handler; 189 170 irq_register(&i8042_mouse_irq); 190 171 -
uspace/kbd/arch/ia32/src/kbd.c
rb8f11baa rddf1255 105 105 while (i8042_status_read() & i8042_OUTPUT_FULL) 106 106 i8042_data_read(); 107 107 108 /* Initialize mouse */ 108 109 i8042_command_write(i8042_CMD_MOUSE);
Note:
See TracChangeset
for help on using the changeset viewer.