1 /* $NetBSD: dnkbd.c,v 1.11 2007/03/04 05:59:50 christos Exp $ */
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Michael Smith and Jason R. Thorpe.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Apollo Domain keyboard routines for the standalone ITE.
36 #if defined(ITECONSOLE) && defined(DOMAIN_KEYBOARD)
38 #include <sys/param.h>
40 #include <hp300/dev/frodoreg.h> /* for apci offsets */
41 #include <hp300/dev/intioreg.h> /* for frodo offsets */
43 #include <hp300/stand/common/dcareg.h> /* for the register bit definitions */
44 #include <hp300/stand/common/apcireg.h> /* for the apci registers */
45 #include <hp300/stand/common/samachdep.h>
46 #include <hp300/stand/common/kbdvar.h>
51 * The Apollo keyboard is used in `cooked' mode as configured by the
52 * firmware; only one table is required.
54 * Note that if an entry in this table is set to 0, the key is passed
55 * through untranslated. If the entry is 0xff, the key is ignored.
57 u_char dnkbd_keymap
[] = {
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 07 */
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0f */
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 17 */
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1f */
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 27 */
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 2f */
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 37 */
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 3f */
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 47 */
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 4f */
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 57 */
69 0x00, 0x00, 0x00, '{', 0x00, '}', 0x00, 0x00, /* 5f */
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 67 */
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6f */
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 77 */
73 0x00, 0x00, 0x00, '[', 0x00, ']', 0x00, 0x00, /* 7f */
74 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 87 */
75 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 8f */
76 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 97 */
77 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 9f */
78 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* a7 */
79 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* af */
80 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* b7 */
81 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bf */
82 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* c7 */
83 '\\', '|', 0x09, 0x0a, '/', 0xff, 0xff, 0xff, /* cf */
84 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* d7 */
85 0xff, 0xff, 0xff, 0xff, '?', 0xff, 0x08, 0xff, /* df */
86 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* e7 */
87 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* ef */
88 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* f7 */
89 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* ff */
92 int dnkbd_ignore
; /* for ignoring mouse packets */
97 struct apciregs
*apci
=
98 (struct apciregs
*)IIOV(FRODO_BASE
+ FRODO_APCI_OFFSET(0));
101 /* default to `no key' */
104 /* Is data in the UART? */
105 if (apci
->ap_lsr
& LSR_RXRDY
) {
106 /* Get the character. */
109 /* Ignoring mouse? */
115 /* Is this the start of a mouse packet? */
117 dnkbd_ignore
= 3; /* 3 bytes of junk */
121 /* It's a keyboard event. */
122 switch (dnkbd_keymap
[c
]) {
147 * XXX Should we do anything? Can we even generate one?
156 * 400, 425, and 433 models can have a Domain keyboard.
168 * Look for a Frodo utility chip. If we find one, assume there
169 * is a Domain keyboard attached.
171 if (badaddr((void *)IIOV(FRODO_BASE
+ FRODO_APCI_OFFSET(0))))
175 * XXX Any other initialization? This appears to work ok.
179 #endif /* ITECONSOLE && DOMAIN_KEYBOARD */