kbd.c revision 1.35.4.1 1 /* $NetBSD: kbd.c,v 1.35.4.1 2001/09/09 19:10:30 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * kbd.c
36 */
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/device.h>
40 #include <sys/ioctl.h>
41 #include <sys/tty.h>
42 #include <sys/proc.h>
43 #include <sys/file.h>
44 #include <sys/kernel.h>
45 #include <sys/syslog.h>
46 #include <sys/signalvar.h>
47 #include <dev/cons.h>
48 #include <machine/cpu.h>
49 #include <amiga/amiga/device.h>
50 #include <amiga/amiga/custom.h>
51 #ifdef DRACO
52 #include <m68k/asm_single.h>
53 #include <amiga/amiga/drcustom.h>
54 #endif
55 #include <amiga/amiga/cia.h>
56 #include <amiga/dev/itevar.h>
57 #include <amiga/dev/kbdreg.h>
58 #include <amiga/dev/kbdmap.h>
59 #include <amiga/dev/event_var.h>
60 #include <amiga/dev/vuid_event.h>
61
62 #include "kbd.h"
63 #include "ite.h"
64
65 /* WSKBD */
66
67 /*
68 * If NWSKBD>0 we try to attach an wskbd device to us. What follows
69 * is definitions of callback functions and structures that are passed
70 * to wscons when initializing.
71 */
72
73 #include "wskbd.h"
74
75 #if NWSKBD>0
76 #include <dev/wscons/wsconsio.h>
77 #include <dev/wscons/wskbdvar.h>
78 #include <dev/wscons/wsksymdef.h>
79 #include <dev/wscons/wsksymvar.h>
80 #include <amiga/dev/wskbdmap_amiga.h>
81
82 /* accessops */
83 int kbd_enable __P((void *, int));
84 void kbd_set_leds __P((void *, int));
85 int kbd_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
86
87 /* console ops */
88 void kbd_getc __P((void *, u_int *, int *));
89 void kbd_pollc __P((void *, int));
90 void kbd_bell __P((void *, u_int, u_int, u_int));
91
92 static struct wskbd_accessops kbd_accessops = {
93 kbd_enable,
94 kbd_set_leds,
95 kbd_ioctl
96 };
97
98 static struct wskbd_consops kbd_consops = {
99 kbd_getc,
100 kbd_pollc,
101 kbd_bell
102 };
103
104 /*
105 * Pointer to keymap. It is defined in wskbdmap_amiga.c.
106 */
107 static struct wskbd_mapdata kbd_mapdata = {
108 amigakbd_keydesctab,
109 KB_US
110 };
111
112 #endif /* WSKBD */
113
114
115 #include <sys/conf.h>
116 #include <machine/conf.h>
117
118 struct kbd_softc {
119 int k_event_mode; /* if true, collect events, else pass to ite */
120 struct evvar k_events; /* event queue state */
121 #ifdef DRACO
122 u_char k_rlprfx; /* MF-II rel. prefix has been seen */
123 u_char k_mf2;
124 #endif
125
126 #if NWSKBD>0
127 struct device *k_wskbddev; /* pointer to wskbd for sending strokes */
128 int k_pollingmode; /* polling mode on? whatever it isss... */
129 #endif
130 };
131 struct kbd_softc kbd_softc;
132
133 int kbdmatch __P((struct device *, struct cfdata *, void *));
134 void kbdattach __P((struct device *, struct device *, void *));
135 void kbdintr __P((int));
136 void kbdstuffchar __P((u_char));
137
138 int drkbdgetc __P((void));
139 int drkbdrputc __P((int));
140 int drkbdputc __P((int));
141 int drkbdputc2 __P((int, int));
142 int drkbdwaitfor __P((int));
143
144 struct cfattach kbd_ca = {
145 sizeof(struct device), kbdmatch, kbdattach
146 };
147
148 /*ARGSUSED*/
149 int
150 kbdmatch(pdp, cfp, auxp)
151 struct device *pdp;
152 struct cfdata *cfp;
153 void *auxp;
154 {
155
156 if (matchname((char *)auxp, "kbd"))
157 return(1);
158 return(0);
159 }
160
161 /*ARGSUSED*/
162 void
163 kbdattach(pdp, dp, auxp)
164 struct device *pdp, *dp;
165 void *auxp;
166 {
167 #ifdef DRACO
168 kbdenable();
169 if (kbd_softc.k_mf2)
170 printf(": QuickLogic type MF-II\n");
171 else
172 printf(": CIA A type Amiga\n");
173 #else
174 printf(": CIA A type Amiga\n");
175 #endif
176
177 #if NWSKBD>0
178 if (dp != NULL) {
179 /*
180 * Try to attach the wskbd.
181 */
182 struct wskbddev_attach_args waa;
183
184 /* Maybe should be done before this?... */
185 wskbd_cnattach(&kbd_consops, NULL, &kbd_mapdata);
186
187 waa.console = 1;
188 waa.keymap = &kbd_mapdata;
189 waa.accessops = &kbd_accessops;
190 waa.accesscookie = NULL;
191 kbd_softc.k_wskbddev = config_found(dp, &waa, wskbddevprint);
192
193 kbd_softc.k_pollingmode = 0;
194 }
195 kbdenable();
196 #endif /* WSKBD */
197 }
198
199 /* definitions for amiga keyboard encoding. */
200 #define KEY_CODE(c) ((c) & 0x7f)
201 #define KEY_UP(c) ((c) & 0x80)
202
203 #define DATLO single_inst_bclr_b(draco_ioct->io_control, DRCNTRL_KBDDATOUT)
204 #define DATHI single_inst_bset_b(draco_ioct->io_control, DRCNTRL_KBDDATOUT)
205
206 #define CLKLO single_inst_bclr_b(draco_ioct->io_control, DRCNTRL_KBDCLKOUT)
207 #define CLKHI single_inst_bset_b(draco_ioct->io_control, DRCNTRL_KBDCLKOUT)
208
209 void
210 kbdenable()
211 {
212 static int kbd_inited = 0;
213
214 int s;
215
216 #ifdef DRACO
217 int id;
218 #endif
219 /*
220 * collides with external ints from SCSI, watch out for this when
221 * enabling/disabling interrupts there !!
222 */
223 s = splhigh(); /* don't lower; might be called from early ddb */
224 if (kbd_inited) {
225 splx(s);
226 return;
227 }
228 kbd_inited = 1;
229 #ifdef DRACO
230 if (is_draco()) {
231
232 CLKLO;
233 delay(5000);
234 draco_ioct->io_kbdrst = 0;
235
236 if (drkbdputc(0xf2))
237 goto LnoMFII;
238
239 id = drkbdgetc() << 8;
240 id |= drkbdgetc();
241
242 if (id != 0xab83)
243 goto LnoMFII;
244
245 if (drkbdputc2(0xf0, 3)) /* mode 3 */
246 goto LnoMFII;
247
248 if (drkbdputc(0xf8)) /* make/break, no typematic */
249 goto LnoMFII;
250
251 if (drkbdputc(0xf4)) /* enable */
252 goto LnoMFII;
253 kbd_softc.k_mf2 = 1;
254 single_inst_bclr_b(draco_ioct->io_control, DRCNTRL_KBDINTENA);
255
256 ciaa.icr = CIA_ICR_SP; /* CIA SP interrupt disable */
257 ciaa.cra &= ~(1<<6); /* serial line == input */
258 splx(s);
259 return;
260
261 LnoMFII:
262 kbd_softc.k_mf2 = 0;
263 single_inst_bset_b(*draco_intena, DRIRQ_INT2);
264 ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_SP;
265 /* SP interrupt enable */
266 ciaa.cra &= ~(1<<6); /* serial line == input */
267 splx(s);
268 return;
269
270 } else {
271 #endif
272 custom.intena = INTF_SETCLR | INTF_PORTS;
273 ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_SP; /* SP interrupt enable */
274 ciaa.cra &= ~(1<<6); /* serial line == input */
275 #ifdef DRACO
276 }
277 #endif
278 kbd_softc.k_event_mode = 0;
279 kbd_softc.k_events.ev_io = 0;
280 splx(s);
281 }
282
283 #ifdef DRACO
284 /*
285 * call this with kbd interupt blocked
286 */
287
288 int
289 drkbdgetc()
290 {
291 u_int8_t in;
292
293 while ((draco_ioct->io_status & DRSTAT_KBDRECV) == 0);
294 in = draco_ioct->io_kbddata;
295 draco_ioct->io_kbdrst = 0;
296
297 return in;
298 }
299
300 #define WAIT0 if (drkbdwaitfor(0)) goto Ltimeout
301 #define WAIT1 if (drkbdwaitfor(DRSTAT_KBDCLKIN)) goto Ltimeout
302
303 int
304 drkbdwaitfor(bit)
305 int bit;
306 {
307 int i;
308
309
310
311 i = 60000; /* about 50 ms max */
312
313 do {
314 if ((draco_ioct->io_status & DRSTAT_KBDCLKIN) == bit)
315 return 0;
316
317 } while (--i >= 0);
318
319 return 1;
320 }
321
322 /*
323 * Output a raw byte to the keyboard (+ parity and stop bit).
324 * return 0 on success, 1 on timeout.
325 */
326 int
327 drkbdrputc(c)
328 u_int8_t c;
329 {
330 u_int8_t parity;
331 int bitcnt;
332
333 DATLO; CLKHI; WAIT1;
334 parity = 0;
335
336 for (bitcnt=7; bitcnt >= 0; bitcnt--) {
337 WAIT0;
338 if (c & 1) {
339 DATHI;
340 } else {
341 ++parity;
342 DATLO;
343 }
344 c >>= 1;
345 WAIT1;
346 }
347 WAIT0;
348 /* parity bit */
349 if (parity & 1) {
350 DATLO;
351 } else {
352 DATHI;
353 }
354 WAIT1;
355 /* stop bit */
356 WAIT0; DATHI; WAIT1;
357
358 WAIT0; /* XXX should check the ack bit here... */
359 WAIT1;
360 draco_ioct->io_kbdrst = 0;
361 return 0;
362
363 Ltimeout:
364 DATHI;
365 draco_ioct->io_kbdrst = 0;
366 return 1;
367 }
368
369 /*
370 * Output one cooked byte to the keyboard, with wait for ACK or RESEND,
371 * and retry if necessary. 0 == success, 1 == timeout
372 */
373 int
374 drkbdputc(c)
375 u_int8_t c;
376 {
377 int rc;
378
379 do {
380 if (drkbdrputc(c))
381 return(-1);
382
383 rc = drkbdgetc();
384 } while (rc == 0xfe);
385 return (!(rc == 0xfa));
386 }
387
388 /*
389 * same for twobyte sequence
390 */
391
392 int
393 drkbdputc2(c1, c2)
394 u_int8_t c1, c2;
395 {
396 int rc;
397
398 do {
399 do {
400 if (drkbdrputc(c1))
401 return(-1);
402
403 rc = drkbdgetc();
404 } while (rc == 0xfe);
405 if (rc != 0xfa)
406 return (-1);
407
408 if (drkbdrputc(c2))
409 return(-1);
410
411 rc = drkbdgetc();
412 } while (rc == 0xfe);
413 return (!(rc == 0xfa));
414 }
415 #endif
416
417 int
418 kbdopen(dev, flags, mode, p)
419 dev_t dev;
420 int flags, mode;
421 struct proc *p;
422 {
423
424 kbdenable();
425 if (kbd_softc.k_events.ev_io)
426 return EBUSY;
427
428 kbd_softc.k_events.ev_io = p;
429 ev_init(&kbd_softc.k_events);
430 return (0);
431 }
432
433 int
434 kbdclose(dev, flags, mode, p)
435 dev_t dev;
436 int flags, mode;
437 struct proc *p;
438 {
439
440 /* Turn off event mode, dump the queue */
441 kbd_softc.k_event_mode = 0;
442 ev_fini(&kbd_softc.k_events);
443 kbd_softc.k_events.ev_io = NULL;
444 return (0);
445 }
446
447 int
448 kbdread(dev, uio, flags)
449 dev_t dev;
450 struct uio *uio;
451 int flags;
452 {
453 return ev_read (&kbd_softc.k_events, uio, flags);
454 }
455
456 int
457 kbdioctl(dev, cmd, data, flag, p)
458 dev_t dev;
459 u_long cmd;
460 register caddr_t data;
461 int flag;
462 struct proc *p;
463 {
464 register struct kbd_softc *k = &kbd_softc;
465
466 switch (cmd) {
467 case KIOCTRANS:
468 if (*(int *)data == TR_UNTRANS_EVENT)
469 return 0;
470 break;
471
472 case KIOCGTRANS:
473 /* Get translation mode */
474 *(int *)data = TR_UNTRANS_EVENT;
475 return 0;
476
477 case KIOCSDIRECT:
478 k->k_event_mode = *(int *)data;
479 return 0;
480
481 case FIONBIO: /* we will remove this someday (soon???) */
482 return 0;
483
484 case FIOASYNC:
485 k->k_events.ev_async = *(int *)data != 0;
486 return 0;
487
488 case TIOCSPGRP:
489 if (*(int *)data != k->k_events.ev_io->p_pgid)
490 return EPERM;
491 return 0;
492
493 default:
494 return ENOTTY;
495 }
496
497 /* We identified the ioctl, but we do not handle it. */
498 return EOPNOTSUPP; /* misuse, but what the heck */
499 }
500
501 int
502 kbdpoll(dev, events, p)
503 dev_t dev;
504 int events;
505 struct proc *p;
506 {
507 return ev_poll (&kbd_softc.k_events, events, p);
508 }
509
510 int
511 kbdkqfilter(dev, kn)
512 dev_t dev;
513 struct knote *kn;
514 {
515
516 return (ev_kqfilter(&kbd_softc.k_events, kn));
517 }
518
519 void
520 kbdintr(mask)
521 int mask;
522 {
523 u_char c;
524 #ifdef KBDRESET
525 static int reset_warn;
526 #endif
527
528 /*
529 * now only invoked from generic CIA interrupt handler if there *is*
530 * a keyboard interrupt pending
531 */
532
533 c = ~ciaa.sdr; /* keyboard data is inverted */
534 /* ack */
535 ciaa.cra |= (1 << 6); /* serial line output */
536 #ifdef KBDRESET
537 if (reset_warn && c == 0xf0) {
538 #ifdef DEBUG
539 printf ("kbdintr: !!!! Reset Warning !!!!\n");
540 #endif
541 bootsync();
542 reset_warn = 0;
543 DELAY(30000000);
544 }
545 #endif
546 /* wait 200 microseconds (for bloody Cherry keyboards..) */
547 DELAY(2000); /* fudge delay a bit for some keyboards */
548 ciaa.cra &= ~(1 << 6);
549
550 /* process the character */
551 c = (c >> 1) | (c << 7); /* rotate right once */
552
553 #ifdef KBDRESET
554 if (c == 0x78) {
555 #ifdef DEBUG
556 printf ("kbdintr: Reset Warning started\n");
557 #endif
558 ++reset_warn;
559 return;
560 }
561 #endif
562 kbdstuffchar(c);
563 }
564
565 #ifdef DRACO
566 /* maps MF-II keycodes to Amiga keycodes */
567
568 const u_char drkbdtab[] = {
569 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50,
570 0x45, 0xff, 0xff, 0xff, 0xff, 0x42, 0x00, 0x51,
571
572 0xff, 0x64, 0x60, 0x30, 0x63, 0x10, 0x01, 0x52,
573 0xff, 0x66, 0x31, 0x21, 0x20, 0x11, 0x02, 0x53,
574
575 0xff, 0x33, 0x32, 0x22, 0x12, 0x04, 0x03, 0x54,
576 0xff, 0x40, 0x34, 0x23, 0x14, 0x13, 0x05, 0x55,
577
578 0xff, 0x36, 0x35, 0x25, 0x24, 0x15, 0x06, 0x56,
579 0xff, 0x67, 0x37, 0x26, 0x16, 0x07, 0x08, 0x57,
580 /* --- */
581 0xff, 0x38, 0x27, 0x17, 0x18, 0x0a, 0x09, 0x58,
582 0xff, 0x39, 0x3a, 0x28, 0x29, 0x19, 0x0b, 0x59,
583
584 0xff, 0xff, 0x2a, 0x2b, 0x1a, 0x0c, 0x4b, 0xff,
585 0x65, 0x61, 0x44, 0x1b, 0xff, 0xff, 0x6f, 0xff,
586
587 0x4d, 0x4f, 0xff, 0x4c, 0x0d, 0xff, 0x41, 0x46,
588 0xff, 0x1d, 0x4e, 0x2d, 0x3d, 0x4a, 0x5f, 0x62,
589
590 0x0f, 0x3c, 0x1e, 0x2e, 0x2f, 0x3e, 0x5a, 0x5b,
591 0xff, 0x43, 0x1f, 0xff, 0x5e, 0x3f, 0x5c, 0xff,
592 /* --- */
593 0xff, 0xff, 0xff, 0xff, 0x5d
594 };
595 #endif
596
597
598 int
599 kbdgetcn ()
600 {
601 int s;
602 u_char ints, mask, c, in;
603
604 #ifdef DRACO
605 if (is_draco() && kbd_softc.k_mf2) {
606 do {
607 c = 0;
608 s = spltty ();
609 while ((draco_ioct->io_status & DRSTAT_KBDRECV) == 0);
610 in = draco_ioct->io_kbddata;
611 draco_ioct->io_kbdrst = 0;
612 if (in == 0xF0) { /* release prefix */
613 c = 0x80;
614 while ((draco_ioct->io_status &
615 DRSTAT_KBDRECV) == 0);
616 in = draco_ioct->io_kbddata;
617 draco_ioct->io_kbdrst = 0;
618 }
619 splx(s);
620 #ifdef DRACORAWKEYDEBUG
621 printf("<%02x>", in);
622 #endif
623 c |= in>=sizeof(drkbdtab) ? 0xff : drkbdtab[in];
624 } while (c == 0xff);
625 return (c);
626 }
627 #endif
628 s = spltty();
629 for (ints = 0; ! ((mask = ciaa.icr) & CIA_ICR_SP);
630 ints |= mask) ;
631
632 in = ciaa.sdr;
633 c = ~in;
634
635 /* ack */
636 ciaa.cra |= (1 << 6); /* serial line output */
637 ciaa.sdr = 0xff; /* ack */
638 /* wait 200 microseconds */
639 DELAY(2000); /* XXXX only works as long as DELAY doesn't
640 * use a timer and waits.. */
641 ciaa.cra &= ~(1 << 6);
642 ciaa.sdr = in;
643
644 splx (s);
645 c = (c >> 1) | (c << 7);
646
647 /* take care that no CIA-interrupts are lost */
648 if (ints)
649 dispatch_cia_ints (0, ints);
650
651 return c;
652 }
653
654 void
655 kbdstuffchar(c)
656 u_char c;
657 {
658 struct firm_event *fe;
659 struct kbd_softc *k = &kbd_softc;
660 int put;
661
662 #if NWSKBD>0
663 /*
664 * If we have attached a wskbd and not in polling mode and
665 * nobody has opened us directly, then send the keystroke
666 * to the wskbd.
667 */
668
669 if (kbd_softc.k_pollingmode == 0
670 && kbd_softc.k_wskbddev != NULL
671 && k->k_event_mode == 0) {
672 wskbd_input(kbd_softc.k_wskbddev,
673 KEY_UP(c) ?
674 WSCONS_EVENT_KEY_UP :
675 WSCONS_EVENT_KEY_DOWN,
676 KEY_CODE(c));
677 return;
678 }
679
680 #endif /* NWSKBD */
681
682 /*
683 * If not in event mode, deliver straight to ite to process
684 * key stroke
685 */
686
687 if (! k->k_event_mode) {
688 #if NITE>0
689 ite_filter (c, ITEFILT_TTY);
690 #endif
691 return;
692 }
693
694 /*
695 * Keyboard is generating events. Turn this keystroke into an
696 * event and put it in the queue. If the queue is full, the
697 * keystroke is lost (sorry!).
698 */
699
700 put = k->k_events.ev_put;
701 fe = &k->k_events.ev_q[put];
702 put = (put + 1) % EV_QSIZE;
703 if (put == k->k_events.ev_get) {
704 log(LOG_WARNING, "keyboard event queue overflow\n");
705 /* ??? */
706 return;
707 }
708 fe->id = KEY_CODE(c);
709 fe->value = KEY_UP(c) ? VKEY_UP : VKEY_DOWN;
710 fe->time = time;
711 k->k_events.ev_put = put;
712 EV_WAKEUP(&k->k_events);
713 }
714
715
716 #ifdef DRACO
717 void
718 drkbdintr()
719 {
720 u_char in;
721 struct kbd_softc *k = &kbd_softc;
722
723 in = draco_ioct->io_kbddata;
724 draco_ioct->io_kbdrst = 0;
725
726 if (in == 0xF0)
727 k->k_rlprfx = 0x80;
728 else {
729 kbdstuffchar(in>=sizeof(drkbdtab) ? 0xff :
730 drkbdtab[in] | k->k_rlprfx);
731 k->k_rlprfx = 0;
732 }
733 }
734
735 #endif
736
737
738 #if NWSKBD>0
739 /*
740 * These are the callback functions that are passed to wscons.
741 * They really don't do anything worth noting, just call the
742 * other functions above.
743 */
744
745 int
746 kbd_enable(c, on)
747 void *c;
748 int on;
749 {
750 /* Wonder what this is supposed to do... */
751 return (0);
752 }
753
754 void
755 kbd_set_leds(c, leds)
756 void *c;
757 int leds;
758 {
759 }
760
761 int
762 kbd_ioctl(c, cmd, data, flag, p)
763 void *c;
764 u_long cmd;
765 caddr_t data;
766 int flag;
767 struct proc *p;
768 {
769 switch (cmd)
770 {
771 case WSKBDIO_COMPLEXBELL:
772 return 0;
773 case WSKBDIO_SETLEDS:
774 return 0;
775 case WSKBDIO_GETLEDS:
776 *(int*)data = 0;
777 return 0;
778 case WSKBDIO_GTYPE:
779 /* XXX well is it, dont think so */
780 *(u_int*)data = WSKBD_TYPE_PC_AT;
781 return 0;
782 }
783
784 /* We are supposed to return -1 to wscons if we didnt understand */
785 return (-1);
786 }
787
788 void
789 kbd_getc(c, type, data)
790 void *c;
791 u_int *type;
792 int *data;
793 {
794 int key;
795
796 key = kbdgetcn();
797
798 *data = KEY_CODE(key);
799 *type = KEY_UP(key) ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
800 }
801
802 void
803 kbd_pollc(c, on)
804 void *c;
805 int on;
806 {
807 kbd_softc.k_pollingmode = on;
808 }
809
810 void
811 kbd_bell(c, x, y, z)
812 void *c;
813 u_int x;
814 u_int y;
815 u_int z;
816 {
817 }
818 #endif /* WSKBD */
819