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