141480Smckusick /* 241480Smckusick * Copyright (c) 1988 University of Utah. 341480Smckusick * Copyright (c) 1990 The Regents of the University of California. 441480Smckusick * All rights reserved. 541480Smckusick * 641480Smckusick * This code is derived from software contributed to Berkeley by 741480Smckusick * the Systems Programming Group of the University of Utah Computer 841480Smckusick * Science Department. 941480Smckusick * 1041480Smckusick * %sccs.include.redist.c% 1141480Smckusick * 12*49311Shibler * from: Utah $Hdr: hilreg.h 1.9 91/01/21$ 1341480Smckusick * 14*49311Shibler * @(#)hilreg.h 7.3 (Berkeley) 05/07/91 1541480Smckusick */ 1641480Smckusick 1741480Smckusick struct hil_dev { 1841480Smckusick char hil_pad0; 1941480Smckusick volatile char hil_data; 2041480Smckusick char hil_pad1; 2141480Smckusick volatile char hil_cmd; 2241480Smckusick #define hil_stat hil_cmd 2341480Smckusick }; 2441480Smckusick 25*49311Shibler #define HILADDR ((struct hil_dev *)IIOV(0x428000)) 26*49311Shibler #define BBCADDR ((struct hil_dev *)IIOV(0x420000)) 2741480Smckusick 2841480Smckusick #define splhil spl1 2941480Smckusick 3041480Smckusick #define HIL_BUSY 0x02 3141480Smckusick #define HIL_DATA_RDY 0x01 3241480Smckusick 3341480Smckusick #define HILWAIT(hil_dev) while ((hil_dev->hil_stat & HIL_BUSY)) 3441480Smckusick #define HILDATAWAIT(hil_dev) while ((hil_dev->hil_stat & HIL_DATA_RDY) == 0) 3541480Smckusick 3641480Smckusick /* HIL status bits */ 3741480Smckusick #define HIL_POLLDATA 0x10 /* HIL poll data follows */ 3841480Smckusick #define HIL_COMMAND 0x08 /* Start of original command */ 3941480Smckusick #define HIL_ERROR 0x080 /* HIL error */ 4041480Smckusick #define HIL_RECONFIG 0x080 /* HIL has reconfigured */ 4141480Smckusick #define HIL_STATMASK (HIL_DATA | HIL_COMMAND) 4241480Smckusick 4341480Smckusick #define HIL_SSHIFT 4 /* Bits to shift status over */ 4441480Smckusick #define HIL_SMASK 0xF /* Service request status mask */ 4541480Smckusick #define HIL_DEVMASK 0x07 4641480Smckusick 4741480Smckusick /* HIL status types */ 4841480Smckusick #define HIL_STATUS 0x5 /* HIL status in data register */ 4941480Smckusick #define HIL_DATA 0x6 /* HIL data in data register */ 5041480Smckusick #define HIL_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */ 5141480Smckusick #define HIL_CTRL 0x9 /* key + CTRL */ 5241480Smckusick #define HIL_SHIFT 0xA /* key + SHIFT */ 5341480Smckusick #define HIL_KEY 0xB /* key only */ 5441480Smckusick #define HIL_68K 0x4 /* Data from the 68k is ready */ 5541480Smckusick 5641480Smckusick /* HIL commands */ 5741480Smckusick #define HIL_SETARD 0xA0 /* set auto-repeat delay */ 5841480Smckusick #define HIL_SETARR 0xA2 /* set auto-repeat rate */ 5941480Smckusick #define HIL_SETTONE 0xA3 /* set tone generator */ 6041480Smckusick #define HIL_CNMT 0xB2 /* clear nmi */ 6141480Smckusick #define HIL_INTON 0x5C /* Turn on interrupts. */ 6241480Smckusick #define HIL_INTOFF 0x5D /* Turn off interrupts. */ 6341480Smckusick #define HIL_TRIGGER 0xC5 /* trigger command */ 6441480Smckusick #define HIL_STARTCMD 0xE0 /* start loop command */ 6541480Smckusick #define HIL_TIMEOUT 0xFE /* timeout */ 6641480Smckusick #define HIL_READTIME 0x13 /* Read real time register */ 6741480Smckusick 6841480Smckusick /* Read/write various registers on the 8042. */ 6941480Smckusick #define HIL_READBUSY 0x02 /* internal "busy" register */ 7041480Smckusick #define HIL_READKBDLANG 0x12 /* read keyboard language code */ 7141480Smckusick #define HIL_READKBDSADR 0xF9 7241480Smckusick #define HIL_WRITEKBDSADR 0xE9 7341480Smckusick #define HIL_READLPSTAT 0xFA 7441480Smckusick #define HIL_WRITELPSTAT 0xEA 7541480Smckusick #define HIL_READLPCTRL 0xFB 7641480Smckusick #define HIL_WRITELPCTRL 0xEB 7741480Smckusick 7841480Smckusick /* BUSY bits */ 7941480Smckusick #define BSY_LOOPBUSY 0x04 8041480Smckusick 8141480Smckusick /* LPCTRL bits */ 8241480Smckusick #define LPC_AUTOPOLL 0x01 /* enable auto-polling */ 8341480Smckusick #define LPC_NOERROR 0x02 /* don't report errors */ 8441480Smckusick #define LPC_NORECONF 0x04 /* don't report reconfigure */ 8541480Smckusick #define LPC_KBDCOOK 0x10 /* cook all keyboards */ 8641480Smckusick #define LPC_RECONF 0x80 /* reconfigure the loop */ 8741480Smckusick 8841480Smckusick /* LPSTAT bits */ 8941480Smckusick #define LPS_DEVMASK 0x07 /* number of loop devices */ 9041480Smckusick #define LPS_CONFGOOD 0x08 /* reconfiguration worked */ 9141480Smckusick #define LPS_CONFFAIL 0x80 /* reconfiguration failed */ 9241480Smckusick 9341480Smckusick /* HIL packet headers */ 9441480Smckusick #define HIL_MOUSEDATA 0x2 9541480Smckusick #define HIL_KBDDATA 0x40 9641480Smckusick 9741480Smckusick #define HIL_MOUSEMOTION 0x02 /* mouse movement event */ 9841480Smckusick #define HIL_KBDBUTTON 0x40 /* keyboard button event */ 9941480Smckusick #define HIL_MOUSEBUTTON 0x40 /* mouse button event */ 10041480Smckusick #define HIL_BUTTONBOX 0x60 /* button box event */ 10141480Smckusick #define HIL_TABLET 0x02 /* tablet motion event */ 10241480Smckusick #define HIL_KNOBBOX 0x03 /* knob box motion data */ 10341480Smckusick 10441480Smckusick /* Magic */ 105*49311Shibler #define KBDNMISTAT ((volatile char *)IIOV(0x478005)) 10641480Smckusick #define KBDNMI 0x04 10741480Smckusick 10841480Smckusick /* For setting auto repeat on the keyboard */ 10941480Smckusick #define ar_format(x) ~((x - 10) / 10) 11041480Smckusick #define KBD_ARD 400 /* initial delay in msec (10 - 2560) */ 11141480Smckusick #define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off)*/ 112