1 /* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department. 9 * 10 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: hilreg.h 1.10 92/01/21$ 13 * 14 * @(#)hilreg.h 7.5 (Berkeley) 10/11/92 15 */ 16 17 #include <hp/dev/iotypes.h> /* XXX */ 18 19 #ifdef hp300 20 struct hil_dev { 21 char hil_pad0; 22 vu_char hil_data; 23 char hil_pad1; 24 vu_char hil_cmd; 25 }; 26 27 #define HILADDR ((struct hil_dev *)IIOV(0x428000)) 28 #define BBCADDR ((struct hil_dev *)IIOV(0x420000)) 29 #endif 30 31 #ifdef hp800 32 #ifdef hp700 33 struct hil_dev { 34 vu_char hil_rsthold; /* (WO) reset hold (and Serial #3) */ 35 vu_char hil_resv1[2047]; 36 vu_char hil_data; /* send/receive data to/from 8042 */ 37 vu_char hil_cmd; /* status/control to/from 8042 */ 38 vu_char hil_resv2[1022]; 39 vu_char hil_rstrel; /* (WO) reset release (and Serial #3) */ 40 41 }; 42 #else 43 struct hil_dev { 44 vu_int hil_data; 45 vu_int hil_pad; 46 vu_int hil_cmd; 47 }; 48 #endif 49 #endif 50 #define hil_stat hil_cmd 51 52 #if defined(hp300) || defined(hp700) 53 #define READHILDATA(x) ((x)->hil_data) 54 #define READHILSTAT(x) ((x)->hil_stat) 55 #define READHILCMD(x) ((x)->hil_cmd) 56 #define WRITEHILDATA(x, y) ((x)->hil_data = (y)) 57 #define WRITEHILSTAT(x, y) ((x)->hil_stat = (y)) 58 #define WRITEHILCMD(x, y) ((x)->hil_cmd = (y)) 59 #else 60 #define READHILDATA(x) ((x)->hil_data >> 24) 61 #define READHILSTAT(x) ((x)->hil_stat >> 24) 62 #define READHILCMD(x) ((x)->hil_cmd >> 24) 63 #define WRITEHILDATA(x, y) ((x)->hil_data = ((y) << 24)) 64 #define WRITEHILSTAT(x, y) ((x)->hil_stat = ((y) << 24)) 65 #define WRITEHILCMD(x, y) ((x)->hil_cmd = ((y) << 24)) 66 #endif 67 68 #ifdef hp300 69 #define splhil() spl1() 70 #else 71 extern int hilspl; 72 #define splhil() splx(hilspl) 73 #endif 74 75 #define HIL_BUSY 0x02 76 #define HIL_DATA_RDY 0x01 77 78 #define HILWAIT(hil_dev) while ((READHILSTAT(hil_dev) & HIL_BUSY)) 79 #define HILDATAWAIT(hil_dev) while (!(READHILSTAT(hil_dev) & HIL_DATA_RDY)) 80 81 /* HIL status bits */ 82 #define HIL_POLLDATA 0x10 /* HIL poll data follows */ 83 #define HIL_COMMAND 0x08 /* Start of original command */ 84 #define HIL_ERROR 0x080 /* HIL error */ 85 #define HIL_RECONFIG 0x080 /* HIL has reconfigured */ 86 #define HIL_STATMASK (HIL_DATA | HIL_COMMAND) 87 88 #define HIL_SSHIFT 4 /* Bits to shift status over */ 89 #define HIL_SMASK 0xF /* Service request status mask */ 90 #define HIL_DEVMASK 0x07 91 92 /* HIL status types */ 93 #define HIL_STATUS 0x5 /* HIL status in data register */ 94 #define HIL_DATA 0x6 /* HIL data in data register */ 95 #define HIL_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */ 96 #define HIL_CTRL 0x9 /* key + CTRL */ 97 #define HIL_SHIFT 0xA /* key + SHIFT */ 98 #define HIL_KEY 0xB /* key only */ 99 #define HIL_68K 0x4 /* Data from the 68k is ready */ 100 101 /* HIL commands */ 102 #define HIL_SETARD 0xA0 /* set auto-repeat delay */ 103 #define HIL_SETARR 0xA2 /* set auto-repeat rate */ 104 #define HIL_SETTONE 0xA3 /* set tone generator */ 105 #define HIL_CNMT 0xB2 /* clear nmi */ 106 #define HIL_INTON 0x5C /* Turn on interrupts. */ 107 #define HIL_INTOFF 0x5D /* Turn off interrupts. */ 108 #define HIL_TRIGGER 0xC5 /* trigger command */ 109 #define HIL_STARTCMD 0xE0 /* start loop command */ 110 #define HIL_TIMEOUT 0xFE /* timeout */ 111 #define HIL_READTIME 0x13 /* Read real time register */ 112 113 /* Read/write various registers on the 8042. */ 114 #define HIL_READBUSY 0x02 /* internal "busy" register */ 115 #define HIL_READKBDLANG 0x12 /* read keyboard language code */ 116 #define HIL_READKBDSADR 0xF9 117 #define HIL_WRITEKBDSADR 0xE9 118 #define HIL_READLPSTAT 0xFA 119 #define HIL_WRITELPSTAT 0xEA 120 #define HIL_READLPCTRL 0xFB 121 #define HIL_WRITELPCTRL 0xEB 122 123 /* BUSY bits */ 124 #define BSY_LOOPBUSY 0x04 125 126 /* LPCTRL bits */ 127 #define LPC_AUTOPOLL 0x01 /* enable auto-polling */ 128 #define LPC_NOERROR 0x02 /* don't report errors */ 129 #define LPC_NORECONF 0x04 /* don't report reconfigure */ 130 #define LPC_KBDCOOK 0x10 /* cook all keyboards */ 131 #define LPC_RECONF 0x80 /* reconfigure the loop */ 132 133 /* LPSTAT bits */ 134 #define LPS_DEVMASK 0x07 /* number of loop devices */ 135 #define LPS_CONFGOOD 0x08 /* reconfiguration worked */ 136 #define LPS_CONFFAIL 0x80 /* reconfiguration failed */ 137 138 /* HIL packet headers */ 139 #define HIL_MOUSEDATA 0x2 140 #define HIL_KBDDATA 0x40 141 142 #define HIL_MOUSEMOTION 0x02 /* mouse movement event */ 143 #define HIL_KBDBUTTON 0x40 /* keyboard button event */ 144 #define HIL_MOUSEBUTTON 0x40 /* mouse button event */ 145 #define HIL_BUTTONBOX 0x60 /* button box event */ 146 #define HIL_TABLET 0x02 /* tablet motion event */ 147 #define HIL_KNOBBOX 0x03 /* knob box motion data */ 148 149 /* For setting auto repeat on the keyboard */ 150 #define ar_format(x) ~((x - 10) / 10) 151 #define KBD_ARD 400 /* initial delay in msec (10 - 2560) */ 152 #define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off) */ 153 154 #ifdef hp300 155 /* Magic */ 156 #define KBDNMISTAT ((volatile char *)IIOV(0x478005)) 157 #define KBDNMI 0x04 158 #endif 159