1 /*        $NetBSD: hilreg.h,v 1.1 2011/02/06 18:26:54 tsutsui Exp $   */
2 /*        $OpenBSD: hilreg.h,v 1.6 2006/08/10 23:43:45 miod Exp $     */
3 /*        NetBSD: hilreg.h,v 1.6 1997/02/02 09:39:21 thorpej Exp      */
4 
5 /*
6  * Copyright (c) 1988 University of Utah.
7  * Copyright (c) 1990, 1993
8  *        The Regents of the University of California.  All rights reserved.
9  *
10  * This code is derived from software contributed to Berkeley by
11  * the Systems Programming Group of the University of Utah Computer
12  * Science Department.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  * 3. Neither the name of the University nor the names of its contributors
23  *    may be used to endorse or promote products derived from this software
24  *    without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *
38  * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
39  *
40  *        @(#)hilreg.h        8.1 (Berkeley) 6/10/93
41  */
42 
43 #include <machine/hil_machdep.h>
44 
45 #define   HIL_BUSY            0x02
46 #define   HIL_DATA_RDY                  0x01
47 
48 /* HIL status bits */
49 #define   HIL_POLLDATA        0x10                /* HIL poll data follows */
50 #define   HIL_COMMAND         0x08                /* Start of original command */
51 #define   HIL_ERROR 0x80                /* HIL error */
52 
53 #define   HIL_RECONFIG        0x80                /* HIL has reconfigured */
54 #define   HIL_UNPLUGGED       0x84                /* HIL cable unplugged */
55 
56 #define   HIL_SSHIFT          4                   /* Bits to shift status over */
57 #define   HIL_SMASK 0x0f                /* Service request status mask */
58 #define   HIL_DEVMASK         0x07
59 
60 /* HIL status types */
61 #define   HIL_68K             0x04                /* Data from the 68k is ready */
62 #define   HIL_STATUS          0x05                /* HIL status in data register */
63 #define   HIL_DATA  0x06                /* HIL data in data register */
64 #define   HIL_CTRLSHIFT       0x08                /* key + CTRL + SHIFT */
65 #define   HIL_CTRL  0x09                /* key + CTRL */
66 #define   HIL_SHIFT 0x0a                /* key + SHIFT */
67 #define   HIL_KEY             0x0b                /* key only */
68 
69 /* HIL commands */
70 #define HIL_IDENTIFY          0x03                /* Get device information */
71 #define   HIL_READTIME        0x13                /* Read real time register */
72 #define   HIL_RNAME 0x30                /* Report name */
73 #define   HIL_RSTATUS         0x31                /* Report status */
74 #define   HIL_DESCRIBE        0x32                /* Extended describe */
75 #define HIL_SECURITY          0x33                /* Read security bits */
76 #define   HIL_DKR             0x3d                /* Disable auto repeat */
77 #define   HIL_ER1             0x3e                /* Enable auto repeat 1/30 */
78 #define   HIL_ER2             0x3f                /* Enable auto repeat 1/60 */
79 #define   HIL_PROMPT1         0x40                /* Prompt #1 */
80 #define   HIL_PROMPT2         0x41                /* Prompt #2 */
81 #define   HIL_PROMPT3         0x42                /* Prompt #3 */
82 #define   HIL_PROMPT4         0x43                /* Prompt #4 */
83 #define   HIL_PROMPT5         0x44                /* Prompt #5 */
84 #define   HIL_PROMPT6         0x45                /* Prompt #6 */
85 #define   HIL_PROMPT7         0x46                /* Prompt #7 */
86 #define   HIL_PROMPT          0x47                /* Prompt */
87 #define   HIL_ACK1  0x48                /* Acknowledge #1 */
88 #define   HIL_ACK2  0x49                /* Acknowledge #2 */
89 #define   HIL_ACK3  0x4a                /* Acknowledge #3 */
90 #define   HIL_ACK4  0x4b                /* Acknowledge #4 */
91 #define   HIL_ACK5  0x4c                /* Acknowledge #5 */
92 #define   HIL_ACK6  0x4d                /* Acknowledge #6 */
93 #define   HIL_ACK7  0x4e                /* Acknowledge #7 */
94 #define   HIL_ACK             0x4f                /* Acknowledge */
95 #define   HIL_INTON 0x5c                /* Turn on interrupts. */
96 #define   HIL_INTOFF          0x5d                /* Turn off interrupts. */
97 #define   HIL_SETARD          0xa0                /* Set auto-repeat delay */
98 #define   HIL_SETARR          0xa2                /* Set auto-repeat rate */
99 #define   HIL_SETTONE         0xa3                /* Set tone generator */
100 #define   HIL_CNMT  0xb2                /* Clear nmi */
101 #define   HIL_TRIGGER         0xc5                /* Trigger command */
102 #define   HIL_STARTCMD        0xe0                /* Start loop command */
103 #define   HIL_TIMEOUT         0xfe                /* Timeout */
104 
105 /* Read/write various registers on the 8042. */
106 #define   HIL_READBUSY                  0x02      /* internal "busy" register */
107 #define   HIL_READKBDLANG               0x12      /* read keyboard language code */
108 #define   HIL_WRITEKBDSADR    0xe9
109 #define   HIL_WRITELPSTAT     0xea
110 #define   HIL_WRITELPCTRL     0xeb
111 #define   HIL_READKBDSADR               0xf9
112 #define   HIL_READLPSTAT      0xfa
113 #define   HIL_READLPCTRL      0xfb
114 
115 /* BUSY bits */
116 #define   BSY_LOOPBUSY        0x04
117 
118 /* LPCTRL bits */
119 #define   LPC_AUTOPOLL        0x01      /* enable auto-polling */
120 #define   LPC_NOERROR         0x02      /* don't report errors */
121 #define   LPC_NORECONF        0x04      /* don't report reconfigure */
122 #define   LPC_KBDCOOK         0x10      /* cook all keyboards */
123 #define   LPC_RECONF          0x80      /* reconfigure the loop */
124 
125 /* LPSTAT bits */
126 #define   LPS_DEVMASK         0x07      /* number of loop devices */
127 #define   LPS_CONFGOOD        0x08      /* reconfiguration worked */
128 #define   LPS_CONFFAIL        0x80      /* reconfiguration failed */
129 
130 /* HIL packet headers */
131 #define   HIL_MOUSEDATA   0x02
132 #define   HIL_KBDDATA     0x70
133 
134 #define   HIL_MOUSEMOTION     0x02      /* mouse movement event */
135 #define   HIL_TABLET      0x02          /* tablet motion event */
136 #define   HIL_KNOBBOX     0x03          /* knob box motion data */
137 #define   HIL_KBDBUTTON       0x40      /* keyboard button event */
138 #define   HIL_MOUSEBUTTON 0x40          /* mouse button event */
139 #define   HIL_BUTTONBOX   0x60          /* button box event */
140 
141 /* ID module defines */
142 #define HILSCBIT    0x04
143 
144 /* For setting auto repeat on the keyboard */
145 #define   ar_format(x)        ~((x - 10) / 10)
146 #define   KBD_ARD             400       /* initial delay in msec (10 - 2560) */
147 #define   KBD_ARR             60        /* rate (10 - 2550 msec, 2551 == off) */
148 
149 /* Device information bits */
150 #define   HIL_ABSOLUTE        0x40      /* absolute positioning data */
151 #define   HIL_16_BITS         0x20      /* 16 bit position accuracy */
152 #define   HIL_IOB             0x10      /* I/O description byte follows */
153 #define   HIL_AXMASK          0x03      /* Number of axes supported */
154 
155 #define   HILIOB_PROMPT       0x80      /* prompt and acknowledge (leds) supported */
156 #define   HILIOB_PMASK        0x70      /* number of prompt & acknowledge supported */
157 #define   HILIOB_PIO          0x08      /* proximity in/out (pressure) supported */
158 #define   HILIOB_BMASK        0x07      /* number of buttons supported */
159