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