xref: /openbsd/sys/dev/hil/hilreg.h (revision a9e13e96)
1*a9e13e96Smiod /*	$OpenBSD: hilreg.h,v 1.2 2003/02/12 01:42:31 miod Exp $	*/
21d96aa5bSmiod /*	$NetBSD: hilreg.h,v 1.6 1997/02/02 09:39:21 thorpej Exp $	*/
31d96aa5bSmiod 
41d96aa5bSmiod /*
51d96aa5bSmiod  * Copyright (c) 1988 University of Utah.
61d96aa5bSmiod  * Copyright (c) 1990, 1993
71d96aa5bSmiod  *	The Regents of the University of California.  All rights reserved.
81d96aa5bSmiod  *
91d96aa5bSmiod  * This code is derived from software contributed to Berkeley by
101d96aa5bSmiod  * the Systems Programming Group of the University of Utah Computer
111d96aa5bSmiod  * Science Department.
121d96aa5bSmiod  *
131d96aa5bSmiod  * Redistribution and use in source and binary forms, with or without
141d96aa5bSmiod  * modification, are permitted provided that the following conditions
151d96aa5bSmiod  * are met:
161d96aa5bSmiod  * 1. Redistributions of source code must retain the above copyright
171d96aa5bSmiod  *    notice, this list of conditions and the following disclaimer.
181d96aa5bSmiod  * 2. Redistributions in binary form must reproduce the above copyright
191d96aa5bSmiod  *    notice, this list of conditions and the following disclaimer in the
201d96aa5bSmiod  *    documentation and/or other materials provided with the distribution.
211d96aa5bSmiod  * 3. All advertising materials mentioning features or use of this software
221d96aa5bSmiod  *    must display the following acknowledgement:
231d96aa5bSmiod  *	This product includes software developed by the University of
241d96aa5bSmiod  *	California, Berkeley and its contributors.
251d96aa5bSmiod  * 4. Neither the name of the University nor the names of its contributors
261d96aa5bSmiod  *    may be used to endorse or promote products derived from this software
271d96aa5bSmiod  *    without specific prior written permission.
281d96aa5bSmiod  *
291d96aa5bSmiod  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
301d96aa5bSmiod  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
311d96aa5bSmiod  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
321d96aa5bSmiod  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
331d96aa5bSmiod  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
341d96aa5bSmiod  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
351d96aa5bSmiod  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
361d96aa5bSmiod  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
371d96aa5bSmiod  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
381d96aa5bSmiod  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
391d96aa5bSmiod  * SUCH DAMAGE.
401d96aa5bSmiod  *
411d96aa5bSmiod  * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
421d96aa5bSmiod  *
431d96aa5bSmiod  *	@(#)hilreg.h	8.1 (Berkeley) 6/10/93
441d96aa5bSmiod  */
451d96aa5bSmiod 
461d96aa5bSmiod #include <machine/hil_machdep.h>
471d96aa5bSmiod 
481d96aa5bSmiod #define	HIL_BUSY		0x02
491d96aa5bSmiod #define	HIL_DATA_RDY		0x01
501d96aa5bSmiod 
511d96aa5bSmiod /* HIL status bits */
521d96aa5bSmiod #define	HIL_POLLDATA	0x10		/* HIL poll data follows */
531d96aa5bSmiod #define	HIL_COMMAND	0x08		/* Start of original command */
541d96aa5bSmiod #define	HIL_ERROR	0x80		/* HIL error */
551d96aa5bSmiod #define	HIL_RECONFIG	0x80		/* HIL has reconfigured */
561d96aa5bSmiod #define	HIL_STATMASK	(HIL_DATA | HIL_COMMAND)
571d96aa5bSmiod 
581d96aa5bSmiod #define	HIL_SSHIFT	4		/* Bits to shift status over */
591d96aa5bSmiod #define	HIL_SMASK	0x0f		/* Service request status mask */
601d96aa5bSmiod #define	HIL_DEVMASK	0x07
611d96aa5bSmiod 
621d96aa5bSmiod /* HIL status types */
631d96aa5bSmiod #define	HIL_68K		0x04		/* Data from the 68k is ready */
641d96aa5bSmiod #define	HIL_STATUS	0x05		/* HIL status in data register */
651d96aa5bSmiod #define	HIL_DATA	0x06		/* HIL data in data register */
661d96aa5bSmiod #define	HIL_CTRLSHIFT	0x08		/* key + CTRL + SHIFT */
671d96aa5bSmiod #define	HIL_CTRL	0x09		/* key + CTRL */
681d96aa5bSmiod #define	HIL_SHIFT	0x0a		/* key + SHIFT */
691d96aa5bSmiod #define	HIL_KEY		0x0b		/* key only */
701d96aa5bSmiod 
711d96aa5bSmiod /* HIL commands */
721d96aa5bSmiod #define HIL_IDENTIFY	0x03		/* Get device information */
731d96aa5bSmiod #define	HIL_READTIME	0x13		/* Read real time register */
741d96aa5bSmiod #define	HIL_RNAME	0x30		/* Report name */
751d96aa5bSmiod #define	HIL_RSTATUS	0x31		/* Report status */
761d96aa5bSmiod #define	HIL_DESCRIBE	0x32		/* Extended describe */
771d96aa5bSmiod #define HIL_SECURITY	0x33		/* Read security bits */
781d96aa5bSmiod #define	HIL_DKR		0x3d		/* Disable auto repeat */
791d96aa5bSmiod #define	HIL_ER1		0x3e		/* Enable auto repeat 1/30 */
801d96aa5bSmiod #define	HIL_ER2		0x3f		/* Enable auto repeat 1/60 */
811d96aa5bSmiod #define	HIL_PROMPT1	0x40		/* Prompt #1 */
821d96aa5bSmiod #define	HIL_PROMPT2	0x41		/* Prompt #2 */
831d96aa5bSmiod #define	HIL_PROMPT3	0x42		/* Prompt #3 */
841d96aa5bSmiod #define	HIL_PROMPT4	0x43		/* Prompt #4 */
851d96aa5bSmiod #define	HIL_PROMPT5	0x44		/* Prompt #5 */
861d96aa5bSmiod #define	HIL_PROMPT6	0x45		/* Prompt #6 */
871d96aa5bSmiod #define	HIL_PROMPT7	0x46		/* Prompt #7 */
881d96aa5bSmiod #define	HIL_PROMPT	0x47		/* Prompt */
891d96aa5bSmiod #define	HIL_ACK1	0x48		/* Acknowledge #1 */
901d96aa5bSmiod #define	HIL_ACK2	0x49		/* Acknowledge #2 */
911d96aa5bSmiod #define	HIL_ACK3	0x4a		/* Acknowledge #3 */
921d96aa5bSmiod #define	HIL_ACK4	0x4b		/* Acknowledge #4 */
931d96aa5bSmiod #define	HIL_ACK5	0x4c		/* Acknowledge #5 */
941d96aa5bSmiod #define	HIL_ACK6	0x4d		/* Acknowledge #6 */
951d96aa5bSmiod #define	HIL_ACK7	0x4e		/* Acknowledge #7 */
961d96aa5bSmiod #define	HIL_ACK		0x4f		/* Acknowledge */
971d96aa5bSmiod #define	HIL_INTON	0x5c		/* Turn on interrupts. */
981d96aa5bSmiod #define	HIL_INTOFF	0x5d		/* Turn off interrupts. */
991d96aa5bSmiod #define	HIL_SETARD	0xa0		/* Set auto-repeat delay */
1001d96aa5bSmiod #define	HIL_SETARR	0xa2		/* Set auto-repeat rate */
1011d96aa5bSmiod #define	HIL_SETTONE	0xa3		/* Set tone generator */
1021d96aa5bSmiod #define	HIL_CNMT	0xb2		/* Clear nmi */
1031d96aa5bSmiod #define	HIL_TRIGGER	0xc5		/* Trigger command */
1041d96aa5bSmiod #define	HIL_STARTCMD	0xe0		/* Start loop command */
1051d96aa5bSmiod #define	HIL_TIMEOUT	0xfe		/* Timeout */
1061d96aa5bSmiod 
1071d96aa5bSmiod /* Read/write various registers on the 8042. */
1081d96aa5bSmiod #define	HIL_READBUSY		0x02	/* internal "busy" register */
1091d96aa5bSmiod #define	HIL_READKBDLANG		0x12	/* read keyboard language code */
1101d96aa5bSmiod #define	HIL_WRITEKBDSADR 	0xe9
1111d96aa5bSmiod #define	HIL_WRITELPSTAT 	0xea
1121d96aa5bSmiod #define	HIL_WRITELPCTRL 	0xeb
1131d96aa5bSmiod #define	HIL_READKBDSADR	 	0xf9
1141d96aa5bSmiod #define	HIL_READLPSTAT  	0xfa
1151d96aa5bSmiod #define	HIL_READLPCTRL  	0xfb
1161d96aa5bSmiod 
1171d96aa5bSmiod /* BUSY bits */
1181d96aa5bSmiod #define	BSY_LOOPBUSY	0x04
1191d96aa5bSmiod 
1201d96aa5bSmiod /* LPCTRL bits */
1211d96aa5bSmiod #define	LPC_AUTOPOLL	0x01	/* enable auto-polling */
1221d96aa5bSmiod #define	LPC_NOERROR	0x02	/* don't report errors */
1231d96aa5bSmiod #define	LPC_NORECONF	0x04	/* don't report reconfigure */
1241d96aa5bSmiod #define	LPC_KBDCOOK	0x10	/* cook all keyboards */
1251d96aa5bSmiod #define	LPC_RECONF	0x80	/* reconfigure the loop */
1261d96aa5bSmiod 
1271d96aa5bSmiod /* LPSTAT bits */
1281d96aa5bSmiod #define	LPS_DEVMASK	0x07	/* number of loop devices */
1291d96aa5bSmiod #define	LPS_CONFGOOD	0x08	/* reconfiguration worked */
1301d96aa5bSmiod #define	LPS_CONFFAIL	0x80	/* reconfiguration failed */
1311d96aa5bSmiod 
1321d96aa5bSmiod /* HIL packet headers */
1331d96aa5bSmiod #define	HIL_MOUSEDATA   0x02
1341d96aa5bSmiod #define	HIL_KBDDATA     0x40
1351d96aa5bSmiod 
1361d96aa5bSmiod #define	HIL_MOUSEMOTION	0x02	/* mouse movement event */
1371d96aa5bSmiod #define	HIL_TABLET      0x02	/* tablet motion event */
1381d96aa5bSmiod #define	HIL_KNOBBOX     0x03	/* knob box motion data */
1391d96aa5bSmiod #define	HIL_KBDBUTTON	0x40	/* keyboard button event */
1401d96aa5bSmiod #define	HIL_MOUSEBUTTON 0x40	/* mouse button event */
1411d96aa5bSmiod #define	HIL_BUTTONBOX   0x60	/* button box event */
1421d96aa5bSmiod 
1431d96aa5bSmiod /* ID module defines */
1441d96aa5bSmiod #define HILSCBIT	0x04
1451d96aa5bSmiod 
1461d96aa5bSmiod /* For setting auto repeat on the keyboard */
1471d96aa5bSmiod #define	ar_format(x)	~((x - 10) / 10)
1481d96aa5bSmiod #define	KBD_ARD		400	/* initial delay in msec (10 - 2560) */
1491d96aa5bSmiod #define	KBD_ARR		60	/* rate (10 - 2550 msec, 2551 == off) */
150*a9e13e96Smiod 
151*a9e13e96Smiod /* Device information bits */
152*a9e13e96Smiod #define	HIL_ABSOLUTE	0x40	/* absolute positioning data */
153*a9e13e96Smiod #define	HIL_16_BITS	0x20	/* 16 bit position accuracy */
154*a9e13e96Smiod #define	HIL_IOB		0x10	/* I/O description byte follows */
155*a9e13e96Smiod #define	HIL_AXMASK	0x03	/* Number of axes supported */
156*a9e13e96Smiod 
157*a9e13e96Smiod #define	HILIOB_PROMPT	0x80	/* prompt and acknowledge (leds) supported */
158*a9e13e96Smiod #define	HILIOB_PMASK	0x70	/* number of prompt & acknowledge supported */
159*a9e13e96Smiod #define	HILIOB_PIO	0x08	/* proximity in/out (pressure) supported */
160*a9e13e96Smiod #define	HILIOB_BMASK	0x07	/* number of buttons supported */
161