Home | History | Annotate | Line # | Download | only in hil
      1  1.1  tsutsui /*	$NetBSD: hilreg.h,v 1.1 2011/02/06 18:26:54 tsutsui Exp $	*/
      2  1.1  tsutsui /*	$OpenBSD: hilreg.h,v 1.6 2006/08/10 23:43:45 miod Exp $	*/
      3  1.1  tsutsui /*	NetBSD: hilreg.h,v 1.6 1997/02/02 09:39:21 thorpej Exp 	*/
      4  1.1  tsutsui 
      5  1.1  tsutsui /*
      6  1.1  tsutsui  * Copyright (c) 1988 University of Utah.
      7  1.1  tsutsui  * Copyright (c) 1990, 1993
      8  1.1  tsutsui  *	The Regents of the University of California.  All rights reserved.
      9  1.1  tsutsui  *
     10  1.1  tsutsui  * This code is derived from software contributed to Berkeley by
     11  1.1  tsutsui  * the Systems Programming Group of the University of Utah Computer
     12  1.1  tsutsui  * Science Department.
     13  1.1  tsutsui  *
     14  1.1  tsutsui  * Redistribution and use in source and binary forms, with or without
     15  1.1  tsutsui  * modification, are permitted provided that the following conditions
     16  1.1  tsutsui  * are met:
     17  1.1  tsutsui  * 1. Redistributions of source code must retain the above copyright
     18  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer.
     19  1.1  tsutsui  * 2. Redistributions in binary form must reproduce the above copyright
     20  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer in the
     21  1.1  tsutsui  *    documentation and/or other materials provided with the distribution.
     22  1.1  tsutsui  * 3. Neither the name of the University nor the names of its contributors
     23  1.1  tsutsui  *    may be used to endorse or promote products derived from this software
     24  1.1  tsutsui  *    without specific prior written permission.
     25  1.1  tsutsui  *
     26  1.1  tsutsui  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27  1.1  tsutsui  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28  1.1  tsutsui  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29  1.1  tsutsui  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30  1.1  tsutsui  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31  1.1  tsutsui  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32  1.1  tsutsui  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33  1.1  tsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34  1.1  tsutsui  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35  1.1  tsutsui  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36  1.1  tsutsui  * SUCH DAMAGE.
     37  1.1  tsutsui  *
     38  1.1  tsutsui  * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
     39  1.1  tsutsui  *
     40  1.1  tsutsui  *	@(#)hilreg.h	8.1 (Berkeley) 6/10/93
     41  1.1  tsutsui  */
     42  1.1  tsutsui 
     43  1.1  tsutsui #include <machine/hil_machdep.h>
     44  1.1  tsutsui 
     45  1.1  tsutsui #define	HIL_BUSY		0x02
     46  1.1  tsutsui #define	HIL_DATA_RDY		0x01
     47  1.1  tsutsui 
     48  1.1  tsutsui /* HIL status bits */
     49  1.1  tsutsui #define	HIL_POLLDATA	0x10		/* HIL poll data follows */
     50  1.1  tsutsui #define	HIL_COMMAND	0x08		/* Start of original command */
     51  1.1  tsutsui #define	HIL_ERROR	0x80		/* HIL error */
     52  1.1  tsutsui 
     53  1.1  tsutsui #define	HIL_RECONFIG	0x80		/* HIL has reconfigured */
     54  1.1  tsutsui #define	HIL_UNPLUGGED	0x84		/* HIL cable unplugged */
     55  1.1  tsutsui 
     56  1.1  tsutsui #define	HIL_SSHIFT	4		/* Bits to shift status over */
     57  1.1  tsutsui #define	HIL_SMASK	0x0f		/* Service request status mask */
     58  1.1  tsutsui #define	HIL_DEVMASK	0x07
     59  1.1  tsutsui 
     60  1.1  tsutsui /* HIL status types */
     61  1.1  tsutsui #define	HIL_68K		0x04		/* Data from the 68k is ready */
     62  1.1  tsutsui #define	HIL_STATUS	0x05		/* HIL status in data register */
     63  1.1  tsutsui #define	HIL_DATA	0x06		/* HIL data in data register */
     64  1.1  tsutsui #define	HIL_CTRLSHIFT	0x08		/* key + CTRL + SHIFT */
     65  1.1  tsutsui #define	HIL_CTRL	0x09		/* key + CTRL */
     66  1.1  tsutsui #define	HIL_SHIFT	0x0a		/* key + SHIFT */
     67  1.1  tsutsui #define	HIL_KEY		0x0b		/* key only */
     68  1.1  tsutsui 
     69  1.1  tsutsui /* HIL commands */
     70  1.1  tsutsui #define HIL_IDENTIFY	0x03		/* Get device information */
     71  1.1  tsutsui #define	HIL_READTIME	0x13		/* Read real time register */
     72  1.1  tsutsui #define	HIL_RNAME	0x30		/* Report name */
     73  1.1  tsutsui #define	HIL_RSTATUS	0x31		/* Report status */
     74  1.1  tsutsui #define	HIL_DESCRIBE	0x32		/* Extended describe */
     75  1.1  tsutsui #define HIL_SECURITY	0x33		/* Read security bits */
     76  1.1  tsutsui #define	HIL_DKR		0x3d		/* Disable auto repeat */
     77  1.1  tsutsui #define	HIL_ER1		0x3e		/* Enable auto repeat 1/30 */
     78  1.1  tsutsui #define	HIL_ER2		0x3f		/* Enable auto repeat 1/60 */
     79  1.1  tsutsui #define	HIL_PROMPT1	0x40		/* Prompt #1 */
     80  1.1  tsutsui #define	HIL_PROMPT2	0x41		/* Prompt #2 */
     81  1.1  tsutsui #define	HIL_PROMPT3	0x42		/* Prompt #3 */
     82  1.1  tsutsui #define	HIL_PROMPT4	0x43		/* Prompt #4 */
     83  1.1  tsutsui #define	HIL_PROMPT5	0x44		/* Prompt #5 */
     84  1.1  tsutsui #define	HIL_PROMPT6	0x45		/* Prompt #6 */
     85  1.1  tsutsui #define	HIL_PROMPT7	0x46		/* Prompt #7 */
     86  1.1  tsutsui #define	HIL_PROMPT	0x47		/* Prompt */
     87  1.1  tsutsui #define	HIL_ACK1	0x48		/* Acknowledge #1 */
     88  1.1  tsutsui #define	HIL_ACK2	0x49		/* Acknowledge #2 */
     89  1.1  tsutsui #define	HIL_ACK3	0x4a		/* Acknowledge #3 */
     90  1.1  tsutsui #define	HIL_ACK4	0x4b		/* Acknowledge #4 */
     91  1.1  tsutsui #define	HIL_ACK5	0x4c		/* Acknowledge #5 */
     92  1.1  tsutsui #define	HIL_ACK6	0x4d		/* Acknowledge #6 */
     93  1.1  tsutsui #define	HIL_ACK7	0x4e		/* Acknowledge #7 */
     94  1.1  tsutsui #define	HIL_ACK		0x4f		/* Acknowledge */
     95  1.1  tsutsui #define	HIL_INTON	0x5c		/* Turn on interrupts. */
     96  1.1  tsutsui #define	HIL_INTOFF	0x5d		/* Turn off interrupts. */
     97  1.1  tsutsui #define	HIL_SETARD	0xa0		/* Set auto-repeat delay */
     98  1.1  tsutsui #define	HIL_SETARR	0xa2		/* Set auto-repeat rate */
     99  1.1  tsutsui #define	HIL_SETTONE	0xa3		/* Set tone generator */
    100  1.1  tsutsui #define	HIL_CNMT	0xb2		/* Clear nmi */
    101  1.1  tsutsui #define	HIL_TRIGGER	0xc5		/* Trigger command */
    102  1.1  tsutsui #define	HIL_STARTCMD	0xe0		/* Start loop command */
    103  1.1  tsutsui #define	HIL_TIMEOUT	0xfe		/* Timeout */
    104  1.1  tsutsui 
    105  1.1  tsutsui /* Read/write various registers on the 8042. */
    106  1.1  tsutsui #define	HIL_READBUSY		0x02	/* internal "busy" register */
    107  1.1  tsutsui #define	HIL_READKBDLANG		0x12	/* read keyboard language code */
    108  1.1  tsutsui #define	HIL_WRITEKBDSADR 	0xe9
    109  1.1  tsutsui #define	HIL_WRITELPSTAT 	0xea
    110  1.1  tsutsui #define	HIL_WRITELPCTRL 	0xeb
    111  1.1  tsutsui #define	HIL_READKBDSADR	 	0xf9
    112  1.1  tsutsui #define	HIL_READLPSTAT  	0xfa
    113  1.1  tsutsui #define	HIL_READLPCTRL  	0xfb
    114  1.1  tsutsui 
    115  1.1  tsutsui /* BUSY bits */
    116  1.1  tsutsui #define	BSY_LOOPBUSY	0x04
    117  1.1  tsutsui 
    118  1.1  tsutsui /* LPCTRL bits */
    119  1.1  tsutsui #define	LPC_AUTOPOLL	0x01	/* enable auto-polling */
    120  1.1  tsutsui #define	LPC_NOERROR	0x02	/* don't report errors */
    121  1.1  tsutsui #define	LPC_NORECONF	0x04	/* don't report reconfigure */
    122  1.1  tsutsui #define	LPC_KBDCOOK	0x10	/* cook all keyboards */
    123  1.1  tsutsui #define	LPC_RECONF	0x80	/* reconfigure the loop */
    124  1.1  tsutsui 
    125  1.1  tsutsui /* LPSTAT bits */
    126  1.1  tsutsui #define	LPS_DEVMASK	0x07	/* number of loop devices */
    127  1.1  tsutsui #define	LPS_CONFGOOD	0x08	/* reconfiguration worked */
    128  1.1  tsutsui #define	LPS_CONFFAIL	0x80	/* reconfiguration failed */
    129  1.1  tsutsui 
    130  1.1  tsutsui /* HIL packet headers */
    131  1.1  tsutsui #define	HIL_MOUSEDATA   0x02
    132  1.1  tsutsui #define	HIL_KBDDATA     0x70
    133  1.1  tsutsui 
    134  1.1  tsutsui #define	HIL_MOUSEMOTION	0x02	/* mouse movement event */
    135  1.1  tsutsui #define	HIL_TABLET      0x02	/* tablet motion event */
    136  1.1  tsutsui #define	HIL_KNOBBOX     0x03	/* knob box motion data */
    137  1.1  tsutsui #define	HIL_KBDBUTTON	0x40	/* keyboard button event */
    138  1.1  tsutsui #define	HIL_MOUSEBUTTON 0x40	/* mouse button event */
    139  1.1  tsutsui #define	HIL_BUTTONBOX   0x60	/* button box event */
    140  1.1  tsutsui 
    141  1.1  tsutsui /* ID module defines */
    142  1.1  tsutsui #define HILSCBIT	0x04
    143  1.1  tsutsui 
    144  1.1  tsutsui /* For setting auto repeat on the keyboard */
    145  1.1  tsutsui #define	ar_format(x)	~((x - 10) / 10)
    146  1.1  tsutsui #define	KBD_ARD		400	/* initial delay in msec (10 - 2560) */
    147  1.1  tsutsui #define	KBD_ARR		60	/* rate (10 - 2550 msec, 2551 == off) */
    148  1.1  tsutsui 
    149  1.1  tsutsui /* Device information bits */
    150  1.1  tsutsui #define	HIL_ABSOLUTE	0x40	/* absolute positioning data */
    151  1.1  tsutsui #define	HIL_16_BITS	0x20	/* 16 bit position accuracy */
    152  1.1  tsutsui #define	HIL_IOB		0x10	/* I/O description byte follows */
    153  1.1  tsutsui #define	HIL_AXMASK	0x03	/* Number of axes supported */
    154  1.1  tsutsui 
    155  1.1  tsutsui #define	HILIOB_PROMPT	0x80	/* prompt and acknowledge (leds) supported */
    156  1.1  tsutsui #define	HILIOB_PMASK	0x70	/* number of prompt & acknowledge supported */
    157  1.1  tsutsui #define	HILIOB_PIO	0x08	/* proximity in/out (pressure) supported */
    158  1.1  tsutsui #define	HILIOB_BMASK	0x07	/* number of buttons supported */
    159