Annotation of sys/arch/hp300/stand/include/hilreg.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: hilreg.h,v 1.2 2006/08/17 06:31:10 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 <hp300/dev/iotypes.h> /* XXX */
! 43:
! 44: struct hil_dev {
! 45: char hil_pad0;
! 46: vu_char hil_data;
! 47: char hil_pad1;
! 48: vu_char hil_cmd;
! 49: #define hil_stat hil_cmd
! 50: };
! 51:
! 52: #define HILADDR ((struct hil_dev *)IIOV(0x428000))
! 53:
! 54: #define READHILDATA(x) ((x)->hil_data)
! 55: #define READHILSTAT(x) ((x)->hil_stat)
! 56: #define READHILCMD(x) ((x)->hil_cmd)
! 57: #define WRITEHILDATA(x, y) ((x)->hil_data = (y))
! 58: #define WRITEHILSTAT(x, y) ((x)->hil_stat = (y))
! 59: #define WRITEHILCMD(x, y) ((x)->hil_cmd = (y))
! 60:
! 61: #define HIL_BUSY 0x02
! 62: #define HIL_DATA_RDY 0x01
! 63:
! 64: #define HILWAIT(hil_dev) while ((READHILSTAT(hil_dev) & HIL_BUSY))
! 65: #define HILDATAWAIT(hil_dev) while (!(READHILSTAT(hil_dev) & HIL_DATA_RDY))
! 66:
! 67: /* HIL status bits */
! 68: #define HIL_POLLDATA 0x10 /* HIL poll data follows */
! 69: #define HIL_COMMAND 0x08 /* Start of original command */
! 70: #define HIL_ERROR 0x080 /* HIL error */
! 71: #define HIL_RECONFIG 0x080 /* HIL has reconfigured */
! 72: #define HIL_STATMASK (HIL_DATA | HIL_COMMAND)
! 73:
! 74: #define HIL_SSHIFT 4 /* Bits to shift status over */
! 75: #define HIL_SMASK 0xF /* Service request status mask */
! 76: #define HIL_DEVMASK 0x07
! 77:
! 78: /* HIL status types */
! 79: #define HIL_STATUS 0x5 /* HIL status in data register */
! 80: #define HIL_DATA 0x6 /* HIL data in data register */
! 81: #define HIL_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
! 82: #define HIL_CTRL 0x9 /* key + CTRL */
! 83: #define HIL_SHIFT 0xA /* key + SHIFT */
! 84: #define HIL_KEY 0xB /* key only */
! 85: #define HIL_68K 0x4 /* Data from the 68k is ready */
! 86:
! 87: /* HIL commands */
! 88: #define HIL_SETARD 0xA0 /* set auto-repeat delay */
! 89: #define HIL_SETARR 0xA2 /* set auto-repeat rate */
! 90: #define HIL_SETTONE 0xA3 /* set tone generator */
! 91: #define HIL_CNMT 0xB2 /* clear nmi */
! 92: #define HIL_INTON 0x5C /* Turn on interrupts. */
! 93: #define HIL_INTOFF 0x5D /* Turn off interrupts. */
! 94: #define HIL_TRIGGER 0xC5 /* trigger command */
! 95: #define HIL_STARTCMD 0xE0 /* start loop command */
! 96: #define HIL_TIMEOUT 0xFE /* timeout */
! 97: #define HIL_READTIME 0x13 /* Read real time register */
! 98:
! 99: /* Read/write various registers on the 8042. */
! 100: #define HIL_READBUSY 0x02 /* internal "busy" register */
! 101: #define HIL_READKBDLANG 0x12 /* read keyboard language code */
! 102: #define HIL_READKBDSADR 0xF9
! 103: #define HIL_WRITEKBDSADR 0xE9
! 104: #define HIL_READLPSTAT 0xFA
! 105: #define HIL_WRITELPSTAT 0xEA
! 106: #define HIL_READLPCTRL 0xFB
! 107: #define HIL_WRITELPCTRL 0xEB
! 108:
! 109: /* BUSY bits */
! 110: #define BSY_LOOPBUSY 0x04
! 111:
! 112: /* LPCTRL bits */
! 113: #define LPC_AUTOPOLL 0x01 /* enable auto-polling */
! 114: #define LPC_NOERROR 0x02 /* don't report errors */
! 115: #define LPC_NORECONF 0x04 /* don't report reconfigure */
! 116: #define LPC_KBDCOOK 0x10 /* cook all keyboards */
! 117: #define LPC_RECONF 0x80 /* reconfigure the loop */
! 118:
! 119: /* LPSTAT bits */
! 120: #define LPS_DEVMASK 0x07 /* number of loop devices */
! 121: #define LPS_CONFGOOD 0x08 /* reconfiguration worked */
! 122: #define LPS_CONFFAIL 0x80 /* reconfiguration failed */
! 123:
! 124: /* HIL packet headers */
! 125: #define HIL_MOUSEDATA 0x2
! 126: #define HIL_KBDDATA 0x40
! 127:
! 128: #define HIL_MOUSEMOTION 0x02 /* mouse movement event */
! 129: #define HIL_KBDBUTTON 0x40 /* keyboard button event */
! 130: #define HIL_MOUSEBUTTON 0x40 /* mouse button event */
! 131: #define HIL_BUTTONBOX 0x60 /* button box event */
! 132: #define HIL_TABLET 0x02 /* tablet motion event */
! 133: #define HIL_KNOBBOX 0x03 /* knob box motion data */
! 134:
! 135: /* For setting auto repeat on the keyboard */
! 136: #define ar_format(x) ~((x - 10) / 10)
! 137: #define KBD_ARD 400 /* initial delay in msec (10 - 2560) */
! 138: #define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off) */
! 139:
! 140: /* Magic */
! 141: #define KBDNMISTAT ((volatile char *)IIOV(0x478005))
! 142: #define KBDNMI 0x04
! 143:
! 144: /* keyboard status */
! 145: #define KBD_CHARMASK 0x7F
! 146: #define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
! 147: #define KBD_CTRL 0x9 /* key + CTRL */
! 148: #define KBD_SHIFT 0xA /* key + SHIFT */
! 149: #define KBD_KEY 0xB /* key only */
! 150:
CVSweb