1*41480Smckusick /* 2*41480Smckusick * Copyright (c) 1988 University of Utah. 3*41480Smckusick * Copyright (c) 1990 The Regents of the University of California. 4*41480Smckusick * All rights reserved. 5*41480Smckusick * 6*41480Smckusick * This code is derived from software contributed to Berkeley by 7*41480Smckusick * the Systems Programming Group of the University of Utah Computer 8*41480Smckusick * Science Department. 9*41480Smckusick * 10*41480Smckusick * %sccs.include.redist.c% 11*41480Smckusick * 12*41480Smckusick * from: Utah $Hdr: hilreg.h 1.8 89/08/24$ 13*41480Smckusick * 14*41480Smckusick * @(#)hilreg.h 7.1 (Berkeley) 05/08/90 15*41480Smckusick */ 16*41480Smckusick 17*41480Smckusick struct hil_dev { 18*41480Smckusick char hil_pad0; 19*41480Smckusick volatile char hil_data; 20*41480Smckusick char hil_pad1; 21*41480Smckusick volatile char hil_cmd; 22*41480Smckusick #define hil_stat hil_cmd 23*41480Smckusick }; 24*41480Smckusick 25*41480Smckusick #define HILADDR ((struct hil_dev *)IOV(0x428000)) 26*41480Smckusick #define BBCADDR ((struct hil_dev *)IOV(0x420000)) 27*41480Smckusick 28*41480Smckusick #define splhil spl1 29*41480Smckusick 30*41480Smckusick #define HIL_BUSY 0x02 31*41480Smckusick #define HIL_DATA_RDY 0x01 32*41480Smckusick 33*41480Smckusick #define HILWAIT(hil_dev) while ((hil_dev->hil_stat & HIL_BUSY)) 34*41480Smckusick #define HILDATAWAIT(hil_dev) while ((hil_dev->hil_stat & HIL_DATA_RDY) == 0) 35*41480Smckusick 36*41480Smckusick /* HIL status bits */ 37*41480Smckusick #define HIL_POLLDATA 0x10 /* HIL poll data follows */ 38*41480Smckusick #define HIL_COMMAND 0x08 /* Start of original command */ 39*41480Smckusick #define HIL_ERROR 0x080 /* HIL error */ 40*41480Smckusick #define HIL_RECONFIG 0x080 /* HIL has reconfigured */ 41*41480Smckusick #define HIL_STATMASK (HIL_DATA | HIL_COMMAND) 42*41480Smckusick 43*41480Smckusick #define HIL_SSHIFT 4 /* Bits to shift status over */ 44*41480Smckusick #define HIL_SMASK 0xF /* Service request status mask */ 45*41480Smckusick #define HIL_DEVMASK 0x07 46*41480Smckusick 47*41480Smckusick /* HIL status types */ 48*41480Smckusick #define HIL_STATUS 0x5 /* HIL status in data register */ 49*41480Smckusick #define HIL_DATA 0x6 /* HIL data in data register */ 50*41480Smckusick #define HIL_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */ 51*41480Smckusick #define HIL_CTRL 0x9 /* key + CTRL */ 52*41480Smckusick #define HIL_SHIFT 0xA /* key + SHIFT */ 53*41480Smckusick #define HIL_KEY 0xB /* key only */ 54*41480Smckusick #define HIL_68K 0x4 /* Data from the 68k is ready */ 55*41480Smckusick 56*41480Smckusick /* HIL commands */ 57*41480Smckusick #define HIL_SETARD 0xA0 /* set auto-repeat delay */ 58*41480Smckusick #define HIL_SETARR 0xA2 /* set auto-repeat rate */ 59*41480Smckusick #define HIL_SETTONE 0xA3 /* set tone generator */ 60*41480Smckusick #define HIL_CNMT 0xB2 /* clear nmi */ 61*41480Smckusick #define HIL_INTON 0x5C /* Turn on interrupts. */ 62*41480Smckusick #define HIL_INTOFF 0x5D /* Turn off interrupts. */ 63*41480Smckusick #define HIL_TRIGGER 0xC5 /* trigger command */ 64*41480Smckusick #define HIL_STARTCMD 0xE0 /* start loop command */ 65*41480Smckusick #define HIL_TIMEOUT 0xFE /* timeout */ 66*41480Smckusick #define HIL_READTIME 0x13 /* Read real time register */ 67*41480Smckusick 68*41480Smckusick /* Read/write various registers on the 8042. */ 69*41480Smckusick #define HIL_READBUSY 0x02 /* internal "busy" register */ 70*41480Smckusick #define HIL_READKBDLANG 0x12 /* read keyboard language code */ 71*41480Smckusick #define HIL_READKBDSADR 0xF9 72*41480Smckusick #define HIL_WRITEKBDSADR 0xE9 73*41480Smckusick #define HIL_READLPSTAT 0xFA 74*41480Smckusick #define HIL_WRITELPSTAT 0xEA 75*41480Smckusick #define HIL_READLPCTRL 0xFB 76*41480Smckusick #define HIL_WRITELPCTRL 0xEB 77*41480Smckusick 78*41480Smckusick /* BUSY bits */ 79*41480Smckusick #define BSY_LOOPBUSY 0x04 80*41480Smckusick 81*41480Smckusick /* LPCTRL bits */ 82*41480Smckusick #define LPC_AUTOPOLL 0x01 /* enable auto-polling */ 83*41480Smckusick #define LPC_NOERROR 0x02 /* don't report errors */ 84*41480Smckusick #define LPC_NORECONF 0x04 /* don't report reconfigure */ 85*41480Smckusick #define LPC_KBDCOOK 0x10 /* cook all keyboards */ 86*41480Smckusick #define LPC_RECONF 0x80 /* reconfigure the loop */ 87*41480Smckusick 88*41480Smckusick /* LPSTAT bits */ 89*41480Smckusick #define LPS_DEVMASK 0x07 /* number of loop devices */ 90*41480Smckusick #define LPS_CONFGOOD 0x08 /* reconfiguration worked */ 91*41480Smckusick #define LPS_CONFFAIL 0x80 /* reconfiguration failed */ 92*41480Smckusick 93*41480Smckusick /* HIL packet headers */ 94*41480Smckusick #define HIL_MOUSEDATA 0x2 95*41480Smckusick #define HIL_KBDDATA 0x40 96*41480Smckusick 97*41480Smckusick #define HIL_MOUSEMOTION 0x02 /* mouse movement event */ 98*41480Smckusick #define HIL_KBDBUTTON 0x40 /* keyboard button event */ 99*41480Smckusick #define HIL_MOUSEBUTTON 0x40 /* mouse button event */ 100*41480Smckusick #define HIL_BUTTONBOX 0x60 /* button box event */ 101*41480Smckusick #define HIL_TABLET 0x02 /* tablet motion event */ 102*41480Smckusick #define HIL_KNOBBOX 0x03 /* knob box motion data */ 103*41480Smckusick 104*41480Smckusick /* Magic */ 105*41480Smckusick #define KBDNMISTAT ((volatile char *)IOV(0x478005)) 106*41480Smckusick #define KBDNMI 0x04 107*41480Smckusick 108*41480Smckusick /* For setting auto repeat on the keyboard */ 109*41480Smckusick #define ar_format(x) ~((x - 10) / 10) 110*41480Smckusick #define KBD_ARD 400 /* initial delay in msec (10 - 2560) */ 111*41480Smckusick #define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off)*/ 112