xref: /titanic_52/usr/src/uts/common/sys/mouse.h (revision ae115bc77f6fcde83175c75b4206dc2e50747966)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
28 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
29 /*	  All Rights Reserved  	*/
30 
31 #ifndef	_SYS_MOUSE_H
32 #define	_SYS_MOUSE_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #define	BUTCHNGMASK	0x38
41 #define	MOVEMENT	0x40
42 
43 #define	BUTSTATMASK	7
44 #define	BUT3STAT	1
45 #define	BUT2STAT	2
46 #define	BUT1STAT	4
47 #define	BUT3CHNG	8
48 #define	BUT2CHNG	0x10
49 #define	BUT1CHNG	0x20
50 
51 struct mse_event {
52 	uchar_t	type;		/* event type (see below) */
53 	uchar_t	code;		/* when type is XQ_MOTION or XQ_BUTTON, => */
54 				/*	bit 0 clear if right button pushed; */
55 				/*	bit 1 clear if middle button pushed; */
56 				/*	bit 2 clear if left button pushed; */
57 	char	x;		/* delta x movement (mouse motion only) */
58 	char	y;		/* delta y movement (mouse motion only) */
59 };
60 
61 #define	MSE_BUTTON	0
62 #define	MSE_MOTION	1
63 
64 struct mouseinfo {
65 	unsigned char	status;
66 	char	xmotion, ymotion;
67 };
68 
69 /* Ioctl Command definitions */
70 
71 #define	MOUSEIOC	('M'<<8)
72 #define	MOUSEIOCREAD    (MOUSEIOC|60)
73 #define	MOUSEISOPEN	(MOUSEIOC|66)
74 #define	MOUSE320    	(MOUSEIOC|67)
75 #define	MSEBUTTONS	(MOUSEIOC|68)
76 #define	TS_CALIB	(MOUSEIOC|70)	/* Touch screen: set the calibration */
77 #define	TS_RECALIB	(MOUSEIOC|71)	/* Touch screen: disable calibration */
78 #define	TS_CURPOS	(MOUSEIOC|72)	/* Touch screen: set cursor position */
79 #define	MOUSEIOCDELAY	(MOUSEIOC|80)
80 #define	MOUSEIOCNDELAY	(MOUSEIOC|81)
81 #define	MOUSEIOCCONFIG	(MOUSEIOC|100)
82 #define	MOUSEIOCMON	(MOUSEIOC|101)
83 
84 #define	VPC_MOUSE_READ  MOUSEIOCREAD
85 
86 #define	UPPERLIM	127
87 #define	LOWERLIM	-128
88 #define	ONEBYTE(x)	((x) > UPPERLIM ? UPPERLIM : \
89 				(x) < LOWERLIM ? LOWERLIM : (x))
90 
91 /* 320 mouse command/query structure */
92 
93 struct cmd_320 {
94 	int	cmd;
95 	int	arg1;
96 	int	arg2;
97 	int	arg3;
98 };
99 
100 /*
101  * AT&T 320 (PS/2 style) Mouse Commands
102  */
103 #define	MSERESET	0xff	/* reset mouse */
104 #define	MSERESEND	0xfe	/* resend last data stream */
105 #define	MSESETDEF	0xf6	/* set default status */
106 #define	MSEOFF		0xf5	/* disable mouse */
107 #define	MSEON		0xf4	/* enable mouse */
108 #define	MSECHGMOD	0xf3	/* set sampling rate and/or button mode */
109 #define	MSEGETDEV	0xf2	/* read device type */
110 #define	MSESPROMPT	0xf0	/* set prompt mode (resets stream mode) */
111 #define	MSEECHON	0xee	/* set echo mode */
112 #define	MSEECHOFF	0xec	/* reset echo mode */
113 #define	MSEREPORT	0xeb	/* read mouse report */
114 #define	MSESTREAM	0xea	/* set Incremental Stream Mode */
115 #define	MSESTATREQ	0xe9	/* status request */
116 #define	MSESETRES	0xe8	/* set counts per mm. resolution */
117 #define	MSESCALE2	0xe7	/* set 2:1 scaling */
118 #define	MSESCALE1	0xe6	/* set 1:1 scaling */
119 
120 /*
121  * 320 mouse 8042 controller commands and flags
122  */
123 #define	MSE_ROP		0xD0	/* read output port command */
124 #define	MSE_RIP		0xC0	/* read input port command */
125 #define	MSE_WOP		0xD3	/* write to loopback command */
126 #define	MSE_WAD		0xD4	/* write to device command */
127 #define	MSE_RCB		0x20	/* read command byte command */
128 #define	MSE_WCB		0x60	/* write command byte command */
129 #define	MSE_INBF	0x03	/* input/output buffer full flag */
130 #define	MSE_OUTBF	0x21	/* output buffer full flag */
131 #define	MSE_ENAB	0xA8	/* enable 8042 interface */
132 #define	MSE_DISAB	0xA7	/* disable 8042 interface */
133 #define	MSE_ACK		0xFA	/* Acknowledgement byte from 8042 */
134 
135 typedef struct mouseinfo MOUSEINFO;
136 
137 /*
138  * Begin Carrol touch screen-specific definitions.
139  */
140 
141 /*
142  * Calibration data structure.	Used with TS_CALIB ioctl to register the upper
143  * left opto-coordinate that corresponds to the upper left corner of the active
144  * video area, and the lower right opto-coordinate that corresponds to the
145  * lower right corner of the active video area.
146  */
147 
148 struct ts_calib {
149 	int	c_ulx,	/* upper left X opto-coordinate of active video area */
150 		c_uly,	/* upper left Y opto-coordinate of active video area */
151 		c_lrx,	/* lower right X opto-coordinate of active video area */
152 		c_lry;	/* lower right Y opto-coordinate of active video area */
153 };
154 
155 /*
156  * Position cursor at the given "pixel" coordinate.
157  */
158 
159 struct ts_curpos {
160 	int	p_xpos, /* X cursor coordinate */
161 		p_ypos;	/* Y cursor coordinate */
162 };
163 
164 /*
165  * End Carrol touch screen-specific definitions.
166  */
167 
168 #ifdef	__cplusplus
169 }
170 #endif
171 
172 #endif	/* _SYS_MOUSE_H */
173