atkbd.c (42626) | atkbd.c (42831) |
---|---|
1/*- 2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $Id: atkbd.c,v 1.1 1999/01/09 02:44:49 yokota Exp $ | 26 * $Id: atkbd.c,v 1.2 1999/01/13 11:19:19 yokota Exp $ |
27 */ 28 29#include "atkbd.h" 30#include "opt_kbd.h" 31#include "opt_devfs.h" 32 33#if NATKBD > 0 34 --- 7 unchanged lines hidden (view full) --- 42#include <sys/malloc.h> 43 44#include <dev/kbd/kbdreg.h> 45#include <dev/kbd/atkbdreg.h> 46#include <dev/kbd/atkbdcreg.h> 47 48#ifndef __i386__ 49 | 27 */ 28 29#include "atkbd.h" 30#include "opt_kbd.h" 31#include "opt_devfs.h" 32 33#if NATKBD > 0 34 --- 7 unchanged lines hidden (view full) --- 42#include <sys/malloc.h> 43 44#include <dev/kbd/kbdreg.h> 45#include <dev/kbd/atkbdreg.h> 46#include <dev/kbd/atkbdcreg.h> 47 48#ifndef __i386__ 49 |
50#include <isa/isareg.h> 51 |
|
50#define ATKBD_SOFTC(unit) \ 51 ((atkbd_softc_t *)devclass_get_softc(atkbd_devclass, unit)) 52 53#else /* __i386__ */ 54 55#include <i386/isa/isa.h> 56#include <i386/isa/isa_device.h> 57 --- 129 unchanged lines hidden (view full) --- 187 if ((*kbdsw[kbd->kb_index]->lock)(kbd, TRUE)) { 188 /* 189 * We have seen the lock flag is not set. Let's reset 190 * the flag early, otherwise the LED update routine fails 191 * which may want the lock during the interrupt routine. 192 */ 193 (*kbdsw[kbd->kb_index]->lock)(kbd, FALSE); 194 if ((*kbdsw[kbd->kb_index]->check_char)(kbd)) | 52#define ATKBD_SOFTC(unit) \ 53 ((atkbd_softc_t *)devclass_get_softc(atkbd_devclass, unit)) 54 55#else /* __i386__ */ 56 57#include <i386/isa/isa.h> 58#include <i386/isa/isa_device.h> 59 --- 129 unchanged lines hidden (view full) --- 189 if ((*kbdsw[kbd->kb_index]->lock)(kbd, TRUE)) { 190 /* 191 * We have seen the lock flag is not set. Let's reset 192 * the flag early, otherwise the LED update routine fails 193 * which may want the lock during the interrupt routine. 194 */ 195 (*kbdsw[kbd->kb_index]->lock)(kbd, FALSE); 196 if ((*kbdsw[kbd->kb_index]->check_char)(kbd)) |
195 (*kbdsw[kbd->kb_index]->intr)(kbd, NULL); | 197 (*kbdsw[kbd->kb_index]->intr)(kbd); |
196 } 197 splx(s); 198 timeout(atkbd_timeout, arg, hz/10); 199} 200 201/* cdev driver functions */ 202 203#ifdef KBD_INSTALL_CDEV --- 122 unchanged lines hidden (view full) --- 326static int probe_keyboard(KBDC kbdc, int flags); 327static int init_keyboard(KBDC kbdc, int *type, int flags); 328static int write_kbd(KBDC kbdc, int command, int data); 329static int get_kbd_id(KBDC kbdc); 330 331/* local variables */ 332 333/* the initial key map, accent map and fkey strings */ | 198 } 199 splx(s); 200 timeout(atkbd_timeout, arg, hz/10); 201} 202 203/* cdev driver functions */ 204 205#ifdef KBD_INSTALL_CDEV --- 122 unchanged lines hidden (view full) --- 328static int probe_keyboard(KBDC kbdc, int flags); 329static int init_keyboard(KBDC kbdc, int *type, int flags); 330static int write_kbd(KBDC kbdc, int command, int data); 331static int get_kbd_id(KBDC kbdc); 332 333/* local variables */ 334 335/* the initial key map, accent map and fkey strings */ |
334#include <i386/isa/kbdtables.h> | 336#include <dev/kbd/kbdtables.h> |
335 336/* structures for the default keyboard */ 337static keyboard_t default_kbd; 338static atkbd_state_t default_kbd_state; 339static keymap_t default_keymap; 340static accentmap_t default_accentmap; 341static fkeytab_t default_fkeytab[NUM_FKEYS]; 342 --- 176 unchanged lines hidden (view full) --- 519atkbd_term(keyboard_t *kbd) 520{ 521 kbd_unregister(kbd); 522 return 0; 523} 524 525/* keyboard interrupt routine */ 526static int | 337 338/* structures for the default keyboard */ 339static keyboard_t default_kbd; 340static atkbd_state_t default_kbd_state; 341static keymap_t default_keymap; 342static accentmap_t default_accentmap; 343static fkeytab_t default_fkeytab[NUM_FKEYS]; 344 --- 176 unchanged lines hidden (view full) --- 521atkbd_term(keyboard_t *kbd) 522{ 523 kbd_unregister(kbd); 524 return 0; 525} 526 527/* keyboard interrupt routine */ 528static int |
527atkbd_intr(keyboard_t *kbd, void *arg) | 529atkbd_intr(keyboard_t *kbd) |
528{ 529 atkbd_state_t *state; 530 int c; 531 532 if (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) { 533 /* let the callback function to process the input */ 534 (*kbd->kb_callback.kc_func)(kbd, KBDIO_KEYINPUT, 535 kbd->kb_callback.kc_arg); --- 663 unchanged lines hidden (view full) --- 1199 */ 1200 set_controller_command_byte(kbdc, 0xff, c); 1201 kbdc_lock(kbdc, FALSE); 1202 printf("atkbd: unable to set the XT keyboard mode.\n"); 1203 return EIO; 1204 } 1205 } 1206 | 530{ 531 atkbd_state_t *state; 532 int c; 533 534 if (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) { 535 /* let the callback function to process the input */ 536 (*kbd->kb_callback.kc_func)(kbd, KBDIO_KEYINPUT, 537 kbd->kb_callback.kc_arg); --- 663 unchanged lines hidden (view full) --- 1201 */ 1202 set_controller_command_byte(kbdc, 0xff, c); 1203 kbdc_lock(kbdc, FALSE); 1204 printf("atkbd: unable to set the XT keyboard mode.\n"); 1205 return EIO; 1206 } 1207 } 1208 |
1209#ifdef __alpha__ 1210 if (send_kbd_command_and_data( 1211 kbdc, KBDC_SET_SCANCODE_SET, 2) != KBD_ACK) { 1212 printf("atkbd: can't set translation.\n"); 1213 1214 } 1215 c |= KBD_TRANSLATION; 1216#endif 1217 |
|
1207 /* enable the keyboard port and intr. */ 1208 if (!set_controller_command_byte(kbdc, 1209 KBD_KBD_CONTROL_BITS | KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK, 1210 (c & (KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK)) 1211 | KBD_ENABLE_KBD_PORT | KBD_ENABLE_KBD_INT)) { 1212 /* 1213 * CONTROLLER ERROR 1214 * This is serious; we are left with the disabled --- 88 unchanged lines hidden --- | 1218 /* enable the keyboard port and intr. */ 1219 if (!set_controller_command_byte(kbdc, 1220 KBD_KBD_CONTROL_BITS | KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK, 1221 (c & (KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK)) 1222 | KBD_ENABLE_KBD_PORT | KBD_ENABLE_KBD_INT)) { 1223 /* 1224 * CONTROLLER ERROR 1225 * This is serious; we are left with the disabled --- 88 unchanged lines hidden --- |