Rev 544 | Rev 549 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
519 | mauro | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * Mauro Marinoni <mauro.marinoni@unipv.it> |
||
13 | * (see the web pages for full authors list) |
||
14 | * |
||
15 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
16 | * |
||
17 | * http://www.sssup.it |
||
18 | * http://retis.sssup.it |
||
19 | * http://shark.sssup.it |
||
20 | */ |
||
21 | |||
22 | //#define __KEYB_DEBUG__ |
||
523 | mauro | 23 | #define KEYB_TASK |
519 | mauro | 24 | |
25 | #include <kernel/kern.h> |
||
26 | #include <signal.h> |
||
27 | #include <modules/hartport.h> |
||
28 | |||
29 | #include "../include/drivers/shark_input26.h" |
||
30 | #include "../include/drivers/shark_keyb26.h" |
||
31 | |||
32 | /* Devices */ |
||
33 | extern int atkbd_init(void); |
||
34 | extern int atkbd_exit(void); |
||
35 | |||
36 | /* Handlers */ |
||
37 | extern int kbd_init(void); |
||
38 | extern int kbd_exit(void); |
||
39 | |||
523 | mauro | 40 | /* Functions */ |
519 | mauro | 41 | extern int kbd_enable(void); |
42 | extern int kbd_disable(void); |
||
43 | extern int kbd_get(unsigned int *data, BYTE access); |
||
44 | extern void kbd_setleds(unsigned int led); |
||
45 | extern int kbd_rate(unsigned int *delay, unsigned int *period); |
||
46 | extern void kbd_mksound(unsigned int hz, unsigned int ticks); |
||
47 | |||
48 | extern int input_installed; |
||
49 | |||
50 | /* |
||
51 | * The following tables contains the ascii code corresponding to the |
||
52 | * scan codes, with shift & no shift... |
||
53 | */ |
||
54 | char keyTable [TABLE_KEY_SIZE]; |
||
55 | char keyShiftTable[TABLE_KEY_SIZE]; |
||
56 | char keyAltGrTable[TABLE_KEY_SIZE]; |
||
57 | |||
58 | BYTE useAltGr = FALSE; |
||
59 | |||
60 | /* Status variables */ |
||
61 | static BYTE shift = FALSE; |
||
62 | static BYTE ctrl = FALSE; |
||
63 | static BYTE alt = FALSE; |
||
64 | static BYTE altgr = FALSE; |
||
65 | |||
66 | static BYTE capslock = FALSE; |
||
67 | static BYTE numlock = TRUE; |
||
68 | static BYTE scrolllock = FALSE; |
||
69 | |||
70 | /* Keyboard Flags (if shift, alt or control are pressed...); */ |
||
71 | static BYTE keyFlag = 0x00; |
||
72 | static BYTE status; |
||
73 | |||
74 | /* Keyboard driver currently installed */ |
||
75 | static int keyb_installed = FALSE; |
||
76 | |||
77 | |||
78 | #define MAX_KEY_EXC 50 |
||
79 | |||
80 | static struct keyexctable |
||
81 | { |
||
82 | KEY_EVT evt; |
||
83 | void (*func) (KEY_EVT * k); |
||
84 | unsigned char lock; |
||
85 | } keyExcTable[MAX_KEY_EXC]; |
||
86 | |||
87 | static int lastExc; |
||
88 | |||
89 | /* Communication port between the extern process & the user */ |
||
90 | static PORT pkeyPort, ukeyPort; |
||
91 | |||
522 | mauro | 92 | #ifdef KEYB_TASK |
519 | mauro | 93 | /* keyboard task PID */ |
94 | static PID keybpid; |
||
522 | mauro | 95 | #else |
523 | mauro | 96 | static void keyProc(void); |
522 | mauro | 97 | #endif |
519 | mauro | 98 | |
99 | /* |
||
522 | mauro | 100 | * Start keyProc Task or exec it as function |
519 | mauro | 101 | */ |
522 | mauro | 102 | void shark_kbd_exec(void) |
519 | mauro | 103 | { |
522 | mauro | 104 | #ifdef KEYB_TASK |
519 | mauro | 105 | task_activate(keybpid); |
522 | mauro | 106 | #else |
107 | keyProc(); |
||
108 | #endif |
||
519 | mauro | 109 | } |
110 | |||
111 | /* |
||
112 | * This function get a scan code, return an ascii code and set |
||
113 | * the status vars in order to handle the special keys of the AT keyboard |
||
114 | */ |
||
115 | WORD scanCode(unsigned int c, int d) |
||
116 | { |
||
117 | //printk("scanCode: c (%x) - d (%d)\n", c, d); |
||
118 | |||
119 | /* KEY_EVT status setting */ |
||
120 | status = d; |
||
121 | |||
122 | switch (c) { |
||
123 | /* CapsLock pressed*/ |
||
124 | case KEY_CPSLOCK: |
||
125 | if (d == KEY_PRESSED) { |
||
126 | capslock = capslock ? FALSE : TRUE; |
||
127 | /* light the caps lock led */ |
||
128 | kbd_setleds(scrolllock + (numlock << 1) + (capslock << 2)); |
||
129 | } |
||
130 | return 0; |
||
131 | /* NumLock pressed */ |
||
132 | case PAD_NUMLOCK: |
||
133 | if (d == KEY_PRESSED) { |
||
134 | numlock = numlock ? FALSE : TRUE; |
||
135 | /* light the num lock led */ |
||
136 | kbd_setleds(scrolllock + (numlock << 1) + (capslock << 2)); |
||
137 | } |
||
138 | return 0; |
||
139 | /* ScrollLock pressed*/ |
||
140 | case EXT_SCRLOCK: |
||
141 | if (d == KEY_PRESSED) { |
||
142 | scrolllock = scrolllock ? FALSE : TRUE; |
||
143 | /* light the scroll lock led */ |
||
144 | kbd_setleds(scrolllock + (numlock << 1) + (capslock << 2)); |
||
145 | } |
||
146 | return 0; |
||
147 | /* Shift pressed or released */ |
||
148 | case KEY_SHL: |
||
149 | if (d) { |
||
150 | shift = TRUE; |
||
151 | if (c == KEY_SHL) |
||
152 | keyFlag |= SHFL_BIT; |
||
153 | } else { |
||
154 | keyFlag &= (!SHFL_BIT); |
||
155 | if (!(keyFlag & SHFR_BIT)) |
||
156 | shift = FALSE; |
||
157 | } |
||
158 | return 0; |
||
159 | /* Shift pressed or released */ |
||
160 | case KEY_SHR: |
||
161 | if (d) { |
||
162 | shift = TRUE; |
||
163 | if (c == KEY_SHR) |
||
164 | keyFlag |= SHFR_BIT; |
||
165 | } else { |
||
166 | keyFlag &= (!SHFR_BIT); |
||
167 | if (!(keyFlag & SHFL_BIT)) |
||
168 | shift = FALSE; |
||
169 | } |
||
170 | return 0; |
||
171 | /* Control pressed or released */ |
||
172 | case KEY_CTRLL: |
||
173 | if (d) { |
||
174 | ctrl = TRUE; |
||
175 | keyFlag |= CNTL_BIT; |
||
176 | } else { |
||
177 | keyFlag &= (!CNTL_BIT); |
||
178 | if (!(keyFlag & CNTR_BIT)) |
||
179 | ctrl = FALSE; |
||
180 | } |
||
181 | return 0; |
||
182 | /* Control pressed or released */ |
||
183 | case KEY_CTRLR: |
||
184 | if (d) { |
||
185 | ctrl = TRUE; |
||
186 | keyFlag |= CNTR_BIT; |
||
187 | } else { |
||
188 | keyFlag &= (!CNTR_BIT); |
||
189 | if (!(keyFlag & CNTL_BIT)) |
||
190 | ctrl = FALSE; |
||
191 | } |
||
192 | return 0; |
||
193 | /* Alt Left pressed */ |
||
194 | case KEY_ALTL: |
||
195 | if (d) { |
||
196 | alt = TRUE; |
||
197 | keyFlag |= ALTL_BIT; |
||
198 | } else { |
||
199 | alt = FALSE; |
||
200 | keyFlag &= (!ALTL_BIT); |
||
201 | } |
||
202 | return 0; |
||
203 | /* Alt Right (AltGr) pressed */ |
||
204 | case KEY_ALTR: |
||
205 | if (d) { |
||
206 | altgr = TRUE; |
||
207 | keyFlag |= ALTR_BIT; |
||
208 | } else { |
||
209 | altgr = FALSE; |
||
210 | keyFlag &= (!ALTR_BIT); |
||
211 | if ((!useAltGr) && (!(keyFlag & ALTL_BIT))) |
||
212 | alt = FALSE; |
||
213 | } |
||
214 | return 0; |
||
215 | /* Delete */ |
||
216 | case EXT_DEL: |
||
217 | return DELETE; |
||
218 | case PAD_DEL: |
||
219 | if (numlock || shift) |
||
220 | return 0x18; |
||
221 | else |
||
222 | break; |
||
223 | /* Pad Enter */ |
||
224 | case PAD_ENT: |
||
225 | return 0x0d; |
||
226 | /* Pad Add */ |
||
227 | case PAD_PLUS: |
||
228 | return 0x2b; |
||
229 | /* Pad Sub */ |
||
230 | case PAD_SUB: |
||
231 | return 0x2d; |
||
232 | /* Pad Slash */ |
||
233 | case PAD_SLH: |
||
234 | return 0x2f; |
||
235 | /* Numbers & simbols */ |
||
236 | case KEY_1: case KEY_2: case KEY_3: case KEY_4: case KEY_5: |
||
237 | case KEY_6: case KEY_7: case KEY_8: case KEY_9: case KEY_0: |
||
238 | case KEY_SUB: case KEY_PLUS: case KEY_BRL: case KEY_BRR: |
||
239 | case KEY_COL: case KEY_API: case KEY_TIL: case KEY_BSL: |
||
240 | case KEY_LT: case KEY_GT: case KEY_SLH: |
||
241 | /* AlrGR enabled & pressed */ |
||
242 | if (altgr && useAltGr) { |
||
243 | return keyAltGrTable[c]; |
||
244 | } |
||
245 | /* Control Shift status */ |
||
246 | if (shift) |
||
247 | return keyShiftTable[c]; |
||
248 | else |
||
249 | return keyTable[c]; |
||
250 | } |
||
251 | |||
252 | /* Pad Keys */ |
||
253 | if (numlock || shift) |
||
254 | switch (c) { |
||
255 | case PAD_DEL: |
||
256 | return 0x18; |
||
257 | case PAD_INS: |
||
258 | return 0x30; |
||
259 | case PAD_END: |
||
260 | return 0x31; |
||
261 | case PAD_DOWN: |
||
262 | return 0x32; |
||
263 | case PAD_PGDW: |
||
264 | return 0x33; |
||
265 | case PAD_RIGHT: |
||
266 | return 0x34; |
||
267 | case PAD_5: |
||
268 | return 0x35; |
||
269 | case PAD_LEFT: |
||
270 | return 0x36; |
||
271 | case PAD_HOME: |
||
272 | return 0x37; |
||
273 | case PAD_UP: |
||
274 | return 0x38; |
||
275 | case PAD_PGUP: |
||
276 | return 0x39; |
||
277 | } |
||
278 | |||
279 | /* Characters keys */ |
||
280 | if (((c >= KEY_Q) && (c <= KEY_P)) || |
||
281 | ((c >= KEY_A) && (c <= KEY_L)) || |
||
282 | ((c >= KEY_Z) && (c <= KEY_M))) { |
||
283 | /* AlrGR enabled & pressed */ |
||
284 | if (altgr && useAltGr) { |
||
285 | return keyAltGrTable[c]; |
||
286 | } |
||
287 | /* Control CapsLock & Shift status */ |
||
288 | if (capslock) { |
||
289 | if (shift) |
||
290 | return keyTable[c]; |
||
291 | else |
||
292 | return keyShiftTable[c]; |
||
293 | } else { |
||
294 | if (shift) |
||
295 | return keyShiftTable[c]; |
||
296 | else |
||
297 | return keyTable[c]; |
||
298 | } |
||
299 | } |
||
300 | |||
301 | /* Remaining keys */ |
||
302 | if (c < TABLE_KEY_SIZE) |
||
303 | /* Left 'low' keys (Esc, BackSpace, Space, ...) */ |
||
304 | return keyTable[c]; |
||
305 | else |
||
306 | /* Default - Return as keycode */ |
||
307 | return (0xff00 | c); |
||
308 | } |
||
309 | |||
522 | mauro | 310 | #ifdef KEYB_TASK |
519 | mauro | 311 | TASK keyProc(void) |
522 | mauro | 312 | #else |
523 | mauro | 313 | static void keyProc(void) |
522 | mauro | 314 | #endif |
519 | mauro | 315 | { |
316 | WORD code; |
||
317 | BYTE found; |
||
318 | KEY_EVT dt; |
||
319 | int i, res; |
||
320 | unsigned int dato; |
||
321 | |||
522 | mauro | 322 | #ifdef KEYB_TASK |
519 | mauro | 323 | while (1) { |
522 | mauro | 324 | #endif |
519 | mauro | 325 | res = kbd_get(&dato, NON_BLOCK); |
326 | if (res >= 0) { |
||
327 | code = scanCode(dato, res); |
||
328 | if (code != 0) { |
||
329 | if (code & 0xff00) |
||
330 | /* It's a scan code, set the right bit */ |
||
331 | dt.flag = (keyFlag | SCAN_BIT); |
||
332 | else |
||
333 | /* Simply send the keyFlag status */ |
||
334 | dt.flag = keyFlag; |
||
335 | dt.status = status; |
||
336 | dt.ascii = (BYTE) (code & 0x00FF); |
||
337 | dt.scan = dato; |
||
338 | #ifdef __KEYB_DEBUG__ |
||
339 | printk("shark_keyb.c: KEY_EVT ( %2x - %c - %2x - %1d)\n", dt.scan, dt.ascii, dt.flag, dt.status); |
||
340 | #endif |
||
341 | found = FALSE; |
||
342 | for (i = 0; i < lastExc; i++) |
||
523 | mauro | 343 | if ((keyExcTable[i].evt.scan == dt.scan) && |
344 | (keyExcTable[i].evt.flag == dt.flag) && |
||
345 | (keyExcTable[i].evt.status == dt.status)) { |
||
519 | mauro | 346 | #ifdef __KEYB_DEBUG__ |
523 | mauro | 347 | printk("shark_keyb.c: Key_Hook ( %2x - %2x - %1d) -> ( %2x - %2x - %1d)\n", |
348 | dt.scan, dt.flag, dt.status, |
||
349 | keyExcTable[i].evt.scan, keyExcTable[i].evt.flag, keyExcTable[i].evt.status); |
||
519 | mauro | 350 | #endif |
351 | keyExcTable[i].func(&dt); |
||
352 | if (keyExcTable[i].lock == TRUE) |
||
353 | found = TRUE; |
||
523 | mauro | 354 | } |
519 | mauro | 355 | /* when the port is full, data is lost */ |
356 | if (!found) |
||
357 | port_send(pkeyPort, (BYTE *) (&dt), NON_BLOCK); |
||
358 | } |
||
359 | } |
||
522 | mauro | 360 | #ifdef KEYB_TASK |
519 | mauro | 361 | task_endcycle(); |
362 | } |
||
522 | mauro | 363 | #endif |
519 | mauro | 364 | } |
365 | |||
366 | /* default function called on ctrl-c */ |
||
367 | void default_ctrlChandler(KEY_EVT * k) { |
||
368 | set_active_page(0); |
||
369 | set_visual_page(0); |
||
523 | mauro | 370 | //cputs("Ctrl-C pressed!\n"); |
519 | mauro | 371 | sys_end(); |
372 | } |
||
373 | |||
374 | /**** Start User Functions ****/ |
||
375 | |||
376 | /* Function that returns the ascii code */ |
||
377 | BYTE keyb_getch(BYTE wait) |
||
378 | { |
||
523 | mauro | 379 | KEY_EVT ev; |
519 | mauro | 380 | BYTE fl; |
381 | |||
523 | mauro | 382 | fl = port_receive (ukeyPort, &ev, wait); |
383 | if (fl) { |
||
384 | #ifdef __KEYB_DEBUG__ |
||
385 | printk("shark_keyb.c: GetChar ( %2x - %c - %2x - %1d)\n", ev.scan, ev.ascii, ev.flag, ev.status); |
||
386 | #endif |
||
387 | if (!isScanCode(ev) && !isReleased(ev)) |
||
388 | return (ev.ascii); |
||
389 | else |
||
390 | return 0; |
||
391 | } else |
||
519 | mauro | 392 | return 0; |
393 | } |
||
394 | |||
395 | /* |
||
396 | * Function that returns a structure containing the flags status, the ascii |
||
397 | * code, and the scan code |
||
398 | */ |
||
399 | int keyb_getcode(KEY_EVT * k, BYTE wait) |
||
400 | { |
||
401 | return (port_receive (ukeyPort, (BYTE *) (k), wait)); |
||
402 | } |
||
403 | |||
404 | void keyb_hook(KEY_EVT k, void (*f) (KEY_EVT * k), unsigned char l) |
||
405 | { |
||
406 | if (lastExc >= MAX_KEY_EXC) |
||
407 | return; |
||
408 | keyExcTable[lastExc].evt = k; |
||
409 | keyExcTable[lastExc].func = f; |
||
410 | keyExcTable[lastExc++].lock = l; |
||
411 | |||
412 | return; |
||
413 | } |
||
414 | |||
523 | mauro | 415 | /* This function disable the keyboard */ |
519 | mauro | 416 | int keyb_disable(void) |
417 | { |
||
418 | kbd_disable(); |
||
419 | return 0; |
||
420 | } |
||
421 | |||
523 | mauro | 422 | /* This function enable the keyboard */ |
519 | mauro | 423 | int keyb_enable(void) |
424 | { |
||
425 | kbd_enable(); |
||
426 | return 0; |
||
427 | } |
||
428 | |||
523 | mauro | 429 | /**** End User Functions ****/ |
519 | mauro | 430 | |
431 | int KEYB26_init(KEYB_PARMS *s) |
||
432 | { |
||
433 | KEYB_PARMS kparms = BASE_KEYB; |
||
434 | WORD i; |
||
435 | int status = 0; |
||
436 | |||
522 | mauro | 437 | #ifdef KEYB_TASK |
519 | mauro | 438 | SOFT_TASK_MODEL base_m; |
439 | TASK_MODEL *m; |
||
522 | mauro | 440 | #endif |
519 | mauro | 441 | |
442 | if (keyb_installed == TRUE) return 0; |
||
443 | |||
444 | /* if a NULL is passed */ |
||
445 | if (s == NULL) |
||
446 | s = &kparms; |
||
447 | |||
448 | for (i = 0; i < TABLE_KEY_SIZE; i++) { |
||
449 | keyTable[i] = 0; |
||
450 | keyShiftTable[i] = 0; |
||
451 | keyAltGrTable[i] = 0; |
||
452 | } |
||
453 | |||
454 | /* keymap */ |
||
455 | if (s->keymap == (unsigned char)KEYB_DEFAULT) s->keymap = KEYMAP_US; |
||
456 | keyb_set_map(s->keymap); |
||
457 | |||
523 | mauro | 458 | pkeyPort = port_create ("KeybPort", sizeof(KEY_EVT), 20, STREAM, WRITE); |
519 | mauro | 459 | if (pkeyPort == -1) |
460 | return -2; |
||
523 | mauro | 461 | ukeyPort = port_connect ("KeybPort", sizeof(KEY_EVT), STREAM, READ); |
519 | mauro | 462 | if (ukeyPort == -1) { |
463 | port_delete (pkeyPort); |
||
464 | return -3; |
||
465 | } |
||
466 | |||
467 | /* remove all key pressed handlers */ |
||
468 | lastExc = 0; |
||
469 | |||
470 | /* and add a ctrl-c handler if requested */ |
||
471 | if (s->ctrlcfunc == (void *) KEYB_DEFAULT) |
||
472 | s->ctrlcfunc = (void *) default_ctrlChandler; |
||
473 | if (s->ctrlcfunc != NULL) { |
||
474 | KEY_EVT emerg; |
||
523 | mauro | 475 | emerg.ascii = 'c'; |
476 | emerg.scan = KEY_C; |
||
477 | emerg.status = KEY_PRESSED; |
||
478 | emerg.flag = CNTL_BIT; |
||
519 | mauro | 479 | keyb_hook (emerg, s->ctrlcfunc, TRUE); |
523 | mauro | 480 | emerg.flag = CNTR_BIT; |
519 | mauro | 481 | keyb_hook (emerg, s->ctrlcfunc, TRUE); |
482 | } |
||
483 | |||
522 | mauro | 484 | #ifdef KEYB_TASK |
519 | mauro | 485 | /* keyb task */ |
486 | if (s->tm == (TASK_MODEL *) KEYB_DEFAULT) { |
||
487 | soft_task_default_model (base_m); |
||
488 | soft_task_def_wcet (base_m, 2000); |
||
489 | soft_task_def_met (base_m, 800); |
||
490 | soft_task_def_period (base_m, 25000); |
||
491 | soft_task_def_system (base_m); |
||
492 | soft_task_def_nokill (base_m); |
||
493 | soft_task_def_aperiodic (base_m); |
||
494 | m = (TASK_MODEL *) & base_m; |
||
495 | } else |
||
496 | m = s->tm; |
||
497 | |||
498 | #ifdef __KEYB_DEBUG__ |
||
499 | //printk(KERN_DEBUG "keyb task: %li %li %li %li\n", (long)s->pclass, (long)APERIODIC, (long)s->dline, (long)s->wcet); |
||
500 | #endif |
||
501 | |||
502 | keybpid = task_create ("KeyTask", keyProc, m, NULL); |
||
503 | if (keybpid == -1) { |
||
504 | port_delete (pkeyPort); |
||
505 | port_delete (ukeyPort); |
||
506 | return -1; |
||
507 | } |
||
522 | mauro | 508 | #endif |
519 | mauro | 509 | |
510 | if (input_installed == FALSE) |
||
511 | if (INPUT26_init()) { |
||
512 | printk(KERN_ERR "shark_keyb.c: Unable to open Input SubSystem.\n"); |
||
513 | port_delete (pkeyPort); |
||
514 | port_delete (ukeyPort); |
||
544 | giacomo | 515 | #ifdef KEYB_TASK |
523 | mauro | 516 | task_kill (keybpid); |
544 | giacomo | 517 | #endif |
519 | mauro | 518 | return -1; |
519 | } |
||
520 | |||
521 | status = atkbd_init(); |
||
522 | if (status) { |
||
523 | printk(KERN_ERR "shark_keyb.c: AtKbd_Init return: %d\n", status); |
||
524 | port_delete (pkeyPort); |
||
525 | port_delete (ukeyPort); |
||
544 | giacomo | 526 | #ifdef KEYB_TASK |
523 | mauro | 527 | task_kill (keybpid); |
544 | giacomo | 528 | #endif |
519 | mauro | 529 | return -1; |
530 | } |
||
531 | |||
532 | status = kbd_init(); |
||
533 | if (status) { |
||
534 | printk(KERN_ERR "shark_keyb.c: Kbd_Init return: %d\n", status); |
||
535 | port_delete (pkeyPort); |
||
536 | port_delete (ukeyPort); |
||
544 | giacomo | 537 | #ifdef KEYB_TASK |
523 | mauro | 538 | task_kill (keybpid); |
544 | giacomo | 539 | #endif |
519 | mauro | 540 | return -1; |
541 | } |
||
542 | |||
543 | kbd_setleds(scrolllock + (numlock << 1) + (capslock << 2)); |
||
544 | kbd_enable(); |
||
545 | |||
546 | keyb_installed = TRUE; |
||
547 | return status; |
||
548 | } |
||
549 | |||
550 | /* |
||
551 | * KEYB module cleanup |
||
552 | * (must be called if it's needed to re-call keyb_init() with other parameters) |
||
553 | * -1 -> ERROR |
||
554 | */ |
||
555 | int KEYB26_close(void) |
||
556 | { |
||
522 | mauro | 557 | #ifdef KEYB_TASK |
519 | mauro | 558 | int free; |
559 | SYS_FLAGS f; |
||
522 | mauro | 560 | #endif |
519 | mauro | 561 | |
562 | if (!keyb_installed) |
||
563 | return -1; |
||
564 | kbd_disable(); |
||
565 | kbd_exit(); |
||
566 | atkbd_exit(); |
||
567 | |||
522 | mauro | 568 | #ifdef KEYB_TASK |
519 | mauro | 569 | f = kern_fsave(); |
570 | free = (proc_table[keybpid].status == FREE); |
||
571 | kern_frestore(f); |
||
572 | #ifdef __KEYB_DEBUG__ |
||
573 | printk(KERN_DEBUG "shark_keyb.c: KeyTask is %s.\n", free ? "killed" : "alive"); |
||
574 | #endif |
||
575 | if (free) |
||
576 | task_kill (keybpid); |
||
522 | mauro | 577 | #endif |
519 | mauro | 578 | |
579 | /*port_delete (pkeyPort); |
||
580 | port_delete (ukeyPort);*/ |
||
581 | |||
582 | keyb_installed = FALSE; |
||
583 | |||
584 | return 0; |
||
585 | } |