hilreg.h revision 1.1 1 1.1 tsutsui /* $NetBSD: hilreg.h,v 1.1 2011/02/07 13:11:41 tsutsui Exp $ */
2 1.1 tsutsui
3 1.1 tsutsui /*
4 1.1 tsutsui * Copyright (c) 1990, 1993
5 1.1 tsutsui * The Regents of the University of California. All rights reserved.
6 1.1 tsutsui *
7 1.1 tsutsui * This code is derived from software contributed to Berkeley by
8 1.1 tsutsui * the Systems Programming Group of the University of Utah Computer
9 1.1 tsutsui * Science Department.
10 1.1 tsutsui *
11 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
12 1.1 tsutsui * modification, are permitted provided that the following conditions
13 1.1 tsutsui * are met:
14 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
15 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
16 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
18 1.1 tsutsui * documentation and/or other materials provided with the distribution.
19 1.1 tsutsui * 3. Neither the name of the University nor the names of its contributors
20 1.1 tsutsui * may be used to endorse or promote products derived from this software
21 1.1 tsutsui * without specific prior written permission.
22 1.1 tsutsui *
23 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1 tsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1 tsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1 tsutsui * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1 tsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1 tsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1 tsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 tsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 tsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 tsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 tsutsui * SUCH DAMAGE.
34 1.1 tsutsui *
35 1.1 tsutsui * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
36 1.1 tsutsui *
37 1.1 tsutsui * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
38 1.1 tsutsui */
39 1.1 tsutsui /*
40 1.1 tsutsui * Copyright (c) 1988 University of Utah.
41 1.1 tsutsui *
42 1.1 tsutsui * This code is derived from software contributed to Berkeley by
43 1.1 tsutsui * the Systems Programming Group of the University of Utah Computer
44 1.1 tsutsui * Science Department.
45 1.1 tsutsui *
46 1.1 tsutsui * Redistribution and use in source and binary forms, with or without
47 1.1 tsutsui * modification, are permitted provided that the following conditions
48 1.1 tsutsui * are met:
49 1.1 tsutsui * 1. Redistributions of source code must retain the above copyright
50 1.1 tsutsui * notice, this list of conditions and the following disclaimer.
51 1.1 tsutsui * 2. Redistributions in binary form must reproduce the above copyright
52 1.1 tsutsui * notice, this list of conditions and the following disclaimer in the
53 1.1 tsutsui * documentation and/or other materials provided with the distribution.
54 1.1 tsutsui * 3. All advertising materials mentioning features or use of this software
55 1.1 tsutsui * must display the following acknowledgement:
56 1.1 tsutsui * This product includes software developed by the University of
57 1.1 tsutsui * California, Berkeley and its contributors.
58 1.1 tsutsui * 4. Neither the name of the University nor the names of its contributors
59 1.1 tsutsui * may be used to endorse or promote products derived from this software
60 1.1 tsutsui * without specific prior written permission.
61 1.1 tsutsui *
62 1.1 tsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63 1.1 tsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 1.1 tsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65 1.1 tsutsui * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66 1.1 tsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67 1.1 tsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 1.1 tsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 1.1 tsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 1.1 tsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 1.1 tsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 1.1 tsutsui * SUCH DAMAGE.
73 1.1 tsutsui *
74 1.1 tsutsui * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
75 1.1 tsutsui *
76 1.1 tsutsui * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
77 1.1 tsutsui */
78 1.1 tsutsui
79 1.1 tsutsui #include <hp300/dev/iotypes.h> /* XXX */
80 1.1 tsutsui
81 1.1 tsutsui #ifdef hp300
82 1.1 tsutsui struct hil_dev {
83 1.1 tsutsui char hil_pad0;
84 1.1 tsutsui vu_char hil_data;
85 1.1 tsutsui char hil_pad1;
86 1.1 tsutsui vu_char hil_cmd;
87 1.1 tsutsui };
88 1.1 tsutsui
89 1.1 tsutsui #define HILADDR ((struct hil_dev *)IIOV(0x428000))
90 1.1 tsutsui #define BBCADDR ((struct hil_dev *)IIOV(0x420000))
91 1.1 tsutsui #endif
92 1.1 tsutsui
93 1.1 tsutsui #ifdef hp800
94 1.1 tsutsui #ifdef hp700
95 1.1 tsutsui struct hil_dev {
96 1.1 tsutsui vu_char hil_rsthold; /* (WO) reset hold (and Serial #3) */
97 1.1 tsutsui vu_char hil_resv1[2047];
98 1.1 tsutsui vu_char hil_data; /* send/receive data to/from 8042 */
99 1.1 tsutsui vu_char hil_cmd; /* status/control to/from 8042 */
100 1.1 tsutsui vu_char hil_resv2[1022];
101 1.1 tsutsui vu_char hil_rstrel; /* (WO) reset release (and Serial #3) */
102 1.1 tsutsui
103 1.1 tsutsui };
104 1.1 tsutsui #else
105 1.1 tsutsui struct hil_dev {
106 1.1 tsutsui vu_int hil_data;
107 1.1 tsutsui vu_int hil_pad;
108 1.1 tsutsui vu_int hil_cmd;
109 1.1 tsutsui };
110 1.1 tsutsui #endif
111 1.1 tsutsui #endif
112 1.1 tsutsui #define hil_stat hil_cmd
113 1.1 tsutsui
114 1.1 tsutsui #if defined(hp300) || defined(hp700)
115 1.1 tsutsui #define READHILDATA(x) ((x)->hil_data)
116 1.1 tsutsui #define READHILSTAT(x) ((x)->hil_stat)
117 1.1 tsutsui #define READHILCMD(x) ((x)->hil_cmd)
118 1.1 tsutsui #define WRITEHILDATA(x, y) ((x)->hil_data = (y))
119 1.1 tsutsui #define WRITEHILSTAT(x, y) ((x)->hil_stat = (y))
120 1.1 tsutsui #define WRITEHILCMD(x, y) ((x)->hil_cmd = (y))
121 1.1 tsutsui #else
122 1.1 tsutsui #define READHILDATA(x) ((x)->hil_data >> 24)
123 1.1 tsutsui #define READHILSTAT(x) ((x)->hil_stat >> 24)
124 1.1 tsutsui #define READHILCMD(x) ((x)->hil_cmd >> 24)
125 1.1 tsutsui #define WRITEHILDATA(x, y) ((x)->hil_data = ((y) << 24))
126 1.1 tsutsui #define WRITEHILSTAT(x, y) ((x)->hil_stat = ((y) << 24))
127 1.1 tsutsui #define WRITEHILCMD(x, y) ((x)->hil_cmd = ((y) << 24))
128 1.1 tsutsui #endif
129 1.1 tsutsui
130 1.1 tsutsui #define HIL_BUSY 0x02
131 1.1 tsutsui #define HIL_DATA_RDY 0x01
132 1.1 tsutsui
133 1.1 tsutsui #define HILWAIT(hil_dev) while ((READHILSTAT(hil_dev) & HIL_BUSY))
134 1.1 tsutsui #define HILDATAWAIT(hil_dev) while (!(READHILSTAT(hil_dev) & HIL_DATA_RDY))
135 1.1 tsutsui
136 1.1 tsutsui /* HIL status bits */
137 1.1 tsutsui #define HIL_POLLDATA 0x10 /* HIL poll data follows */
138 1.1 tsutsui #define HIL_COMMAND 0x08 /* Start of original command */
139 1.1 tsutsui #define HIL_ERROR 0x080 /* HIL error */
140 1.1 tsutsui #define HIL_RECONFIG 0x080 /* HIL has reconfigured */
141 1.1 tsutsui #define HIL_STATMASK (HIL_DATA | HIL_COMMAND)
142 1.1 tsutsui
143 1.1 tsutsui #define HIL_SSHIFT 4 /* Bits to shift status over */
144 1.1 tsutsui #define HIL_SMASK 0xF /* Service request status mask */
145 1.1 tsutsui #define HIL_DEVMASK 0x07
146 1.1 tsutsui
147 1.1 tsutsui /* HIL status types */
148 1.1 tsutsui #define HIL_STATUS 0x5 /* HIL status in data register */
149 1.1 tsutsui #define HIL_DATA 0x6 /* HIL data in data register */
150 1.1 tsutsui #define HIL_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
151 1.1 tsutsui #define HIL_CTRL 0x9 /* key + CTRL */
152 1.1 tsutsui #define HIL_SHIFT 0xA /* key + SHIFT */
153 1.1 tsutsui #define HIL_KEY 0xB /* key only */
154 1.1 tsutsui #define HIL_68K 0x4 /* Data from the 68k is ready */
155 1.1 tsutsui
156 1.1 tsutsui /* HIL commands */
157 1.1 tsutsui #define HIL_SETARD 0xA0 /* set auto-repeat delay */
158 1.1 tsutsui #define HIL_SETARR 0xA2 /* set auto-repeat rate */
159 1.1 tsutsui #define HIL_SETTONE 0xA3 /* set tone generator */
160 1.1 tsutsui #define HIL_CNMT 0xB2 /* clear nmi */
161 1.1 tsutsui #define HIL_INTON 0x5C /* Turn on interrupts. */
162 1.1 tsutsui #define HIL_INTOFF 0x5D /* Turn off interrupts. */
163 1.1 tsutsui #define HIL_TRIGGER 0xC5 /* trigger command */
164 1.1 tsutsui #define HIL_STARTCMD 0xE0 /* start loop command */
165 1.1 tsutsui #define HIL_TIMEOUT 0xFE /* timeout */
166 1.1 tsutsui #define HIL_READTIME 0x13 /* Read real time register */
167 1.1 tsutsui
168 1.1 tsutsui /* Read/write various registers on the 8042. */
169 1.1 tsutsui #define HIL_READBUSY 0x02 /* internal "busy" register */
170 1.1 tsutsui #define HIL_READKBDLANG 0x12 /* read keyboard language code */
171 1.1 tsutsui #define HIL_READKBDSADR 0xF9
172 1.1 tsutsui #define HIL_WRITEKBDSADR 0xE9
173 1.1 tsutsui #define HIL_READLPSTAT 0xFA
174 1.1 tsutsui #define HIL_WRITELPSTAT 0xEA
175 1.1 tsutsui #define HIL_READLPCTRL 0xFB
176 1.1 tsutsui #define HIL_WRITELPCTRL 0xEB
177 1.1 tsutsui
178 1.1 tsutsui /* BUSY bits */
179 1.1 tsutsui #define BSY_LOOPBUSY 0x04
180 1.1 tsutsui
181 1.1 tsutsui /* LPCTRL bits */
182 1.1 tsutsui #define LPC_AUTOPOLL 0x01 /* enable auto-polling */
183 1.1 tsutsui #define LPC_NOERROR 0x02 /* don't report errors */
184 1.1 tsutsui #define LPC_NORECONF 0x04 /* don't report reconfigure */
185 1.1 tsutsui #define LPC_KBDCOOK 0x10 /* cook all keyboards */
186 1.1 tsutsui #define LPC_RECONF 0x80 /* reconfigure the loop */
187 1.1 tsutsui
188 1.1 tsutsui /* LPSTAT bits */
189 1.1 tsutsui #define LPS_DEVMASK 0x07 /* number of loop devices */
190 1.1 tsutsui #define LPS_CONFGOOD 0x08 /* reconfiguration worked */
191 1.1 tsutsui #define LPS_CONFFAIL 0x80 /* reconfiguration failed */
192 1.1 tsutsui
193 1.1 tsutsui /* HIL packet headers */
194 1.1 tsutsui #define HIL_MOUSEDATA 0x2
195 1.1 tsutsui #define HIL_KBDDATA 0x40
196 1.1 tsutsui
197 1.1 tsutsui #define HIL_MOUSEMOTION 0x02 /* mouse movement event */
198 1.1 tsutsui #define HIL_KBDBUTTON 0x40 /* keyboard button event */
199 1.1 tsutsui #define HIL_MOUSEBUTTON 0x40 /* mouse button event */
200 1.1 tsutsui #define HIL_BUTTONBOX 0x60 /* button box event */
201 1.1 tsutsui #define HIL_TABLET 0x02 /* tablet motion event */
202 1.1 tsutsui #define HIL_KNOBBOX 0x03 /* knob box motion data */
203 1.1 tsutsui
204 1.1 tsutsui /* For setting auto repeat on the keyboard */
205 1.1 tsutsui #define ar_format(x) ~((x - 10) / 10)
206 1.1 tsutsui #define KBD_ARD 400 /* initial delay in msec (10 - 2560) */
207 1.1 tsutsui #define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off) */
208 1.1 tsutsui
209 1.1 tsutsui #ifdef hp300
210 1.1 tsutsui /* Magic */
211 1.1 tsutsui #define KBDNMISTAT ((volatile char *)IIOV(0x478005))
212 1.1 tsutsui #define KBDNMI 0x04
213 1.1 tsutsui #endif
214