xref: /csrg-svn/sys/pmax/include/pmioctl.h (revision 52131)
1*52131Smckusick /*
2*52131Smckusick  * Copyright (c) 1992 Regents of the University of California.
3*52131Smckusick  * All rights reserved.
4*52131Smckusick  *
5*52131Smckusick  * This code is derived from software contributed to Berkeley by
6*52131Smckusick  * Ralph Campbell.
7*52131Smckusick  *
8*52131Smckusick  * %sccs.include.redist.c%
9*52131Smckusick  *
10*52131Smckusick  *	@(#)pmioctl.h	7.1 (Berkeley) 01/07/92
11*52131Smckusick  *
12*52131Smckusick  * graphics.h --
13*52131Smckusick  *
14*52131Smckusick  *     	Defines for the graphics device.
15*52131Smckusick  *
16*52131Smckusick  * Copyright (C) 1989 by Digital Equipment Corporation, Maynard MA
17*52131Smckusick  *
18*52131Smckusick  *			All Rights Reserved
19*52131Smckusick  *
20*52131Smckusick  * Permission to use, copy, modify, and distribute this software and its
21*52131Smckusick  * documentation for any purpose and without fee is hereby granted,
22*52131Smckusick  * provided that the above copyright notice appear in all copies and that
23*52131Smckusick  * both that copyright notice and this permission notice appear in
24*52131Smckusick  * supporting documentation, and that the name of Digital not be
25*52131Smckusick  * used in advertising or publicity pertaining to distribution of the
26*52131Smckusick  * software without specific, written prior permission.
27*52131Smckusick  *
28*52131Smckusick  * Digitial disclaims all warranties with regard to this software, including
29*52131Smckusick  * all implied warranties of merchantability and fitness.  In no event shall
30*52131Smckusick  * Digital be liable for any special, indirect or consequential damages or
31*52131Smckusick  * any damages whatsoever resulting from loss of use, data or profits,
32*52131Smckusick  * whether in an action of contract, negligence or other tortious action,
33*52131Smckusick  * arising out of or in connection with the use or performance of this
34*52131Smckusick  * software.
35*52131Smckusick  *
36*52131Smckusick  * from: $Header: devSerialPmax.c,
37*52131Smckusick  *	v 1.4 89/05/22 13:31:07 mnelson Exp $ SPRITE (DECWRL)
38*52131Smckusick  */
39*52131Smckusick 
40*52131Smckusick #include <sys/ioctl.h>
41*52131Smckusick 
42*52131Smckusick /*
43*52131Smckusick  * Events.
44*52131Smckusick  */
45*52131Smckusick typedef struct {
46*52131Smckusick         short	        x;		/* x position */
47*52131Smckusick         short 	        y;		/* y position */
48*52131Smckusick         unsigned int    time;		/* 1 millisecond units */
49*52131Smckusick         unsigned char   type;		/* button up/down/raw or motion */
50*52131Smckusick         unsigned char   key;		/* the key (button only) */
51*52131Smckusick         unsigned char   index;		/* which instance of device */
52*52131Smckusick         unsigned char   device;		/* which device */
53*52131Smckusick } pmEvent;
54*52131Smckusick 
55*52131Smckusick /*
56*52131Smckusick  * type field
57*52131Smckusick  */
58*52131Smckusick #define BUTTON_UP_TYPE          0
59*52131Smckusick #define BUTTON_DOWN_TYPE        1
60*52131Smckusick #define BUTTON_RAW_TYPE         2
61*52131Smckusick #define MOTION_TYPE             3
62*52131Smckusick 
63*52131Smckusick /*
64*52131Smckusick  * device field
65*52131Smckusick  */
66*52131Smckusick #define NULL_DEVICE		0	/* NULL event (for QD_GETEVENT ret) */
67*52131Smckusick #define MOUSE_DEVICE		1	/* mouse */
68*52131Smckusick #define KEYBOARD_DEVICE		2	/* main keyboard */
69*52131Smckusick #define TABLET_DEVICE		3	/* graphics tablet */
70*52131Smckusick #define AUX_DEVICE		4	/* auxiliary */
71*52131Smckusick #define CONSOLE_DEVICE		5	/* console */
72*52131Smckusick #define KNOB_DEVICE		8
73*52131Smckusick #define JOYSTICK_DEVICE		9
74*52131Smckusick 
75*52131Smckusick #define PM_MAXEVQ		64	/* must be power of 2 */
76*52131Smckusick #define PM_EVROUND(x)		((x) & (PM_MAXEVQ - 1))
77*52131Smckusick #define MOTION_BUFFER_SIZE	100
78*52131Smckusick 
79*52131Smckusick typedef struct {
80*52131Smckusick 	unsigned int	time;
81*52131Smckusick 	short		x, y;
82*52131Smckusick } pmTimeCoord;
83*52131Smckusick 
84*52131Smckusick /*
85*52131Smckusick  * The event queue. This structure is normally included in the info
86*52131Smckusick  * returned by the device driver.
87*52131Smckusick  */
88*52131Smckusick typedef struct {
89*52131Smckusick 	pmEvent 	*events;
90*52131Smckusick 	unsigned int 	eSize;
91*52131Smckusick         unsigned int    eHead;
92*52131Smckusick         unsigned int    eTail;
93*52131Smckusick 	unsigned	long	timestamp_ms;
94*52131Smckusick 	pmTimeCoord	*tcs;	/* history of pointer motions */
95*52131Smckusick 	unsigned int	tcSize;
96*52131Smckusick 	unsigned int	tcNext;	/* simple ring buffer, old events are tossed */
97*52131Smckusick } pmEventQueue;
98*52131Smckusick 
99*52131Smckusick /*
100*52131Smckusick  * mouse cursor position
101*52131Smckusick  */
102*52131Smckusick typedef struct {
103*52131Smckusick         short	x;
104*52131Smckusick         short	y;
105*52131Smckusick } pmCursor;
106*52131Smckusick 
107*52131Smckusick /*
108*52131Smckusick  * mouse motion rectangle
109*52131Smckusick  */
110*52131Smckusick typedef struct {
111*52131Smckusick         short	bottom;
112*52131Smckusick         short	right;
113*52131Smckusick         short	left;
114*52131Smckusick         short	top;
115*52131Smckusick } pmBox;
116*52131Smckusick 
117*52131Smckusick /*
118*52131Smckusick  * Structures used by ioctl's.
119*52131Smckusick  */
120*52131Smckusick typedef struct pm_kpcmd {
121*52131Smckusick 	char nbytes;		/* number of bytes in parameter */
122*52131Smckusick 	unsigned char cmd;	/* command to be sent, peripheral bit will */
123*52131Smckusick 				/* be forced by driver */
124*52131Smckusick 	unsigned char par[2];	/* bytes of parameters to be sent */
125*52131Smckusick } pmKpCmd;
126*52131Smckusick 
127*52131Smckusick typedef struct pm_info {
128*52131Smckusick 	pmEventQueue qe;		/* event & motion queues	*/
129*52131Smckusick 	short	mswitches;		/* current value of mouse buttons */
130*52131Smckusick 	pmCursor tablet;		/* current tablet position	*/
131*52131Smckusick 	short	tswitches;		/* current tablet buttons NI!	*/
132*52131Smckusick 	pmCursor cursor;		/* current cursor position	*/
133*52131Smckusick 	short	row;			/* screen row			*/
134*52131Smckusick 	short	col;			/* screen col			*/
135*52131Smckusick 	short	max_row;		/* max character row		*/
136*52131Smckusick 	short	max_col;		/* max character col		*/
137*52131Smckusick 	short	max_x;			/* max x position		*/
138*52131Smckusick 	short	max_y;			/* max y position		*/
139*52131Smckusick 	short	max_cur_x;		/* max cursor x position 	*/
140*52131Smckusick 	short	max_cur_y;		/* max cursor y position	*/
141*52131Smckusick 	int	version;		/* version of driver		*/
142*52131Smckusick 	char	*bitmap;		/* bit map position		*/
143*52131Smckusick         short   *scanmap;               /* scanline map position        */
144*52131Smckusick 	short	*cursorbits;		/* cursor bit position		*/
145*52131Smckusick 	short	*pmaddr;		/* virtual address           	*/
146*52131Smckusick 	char    *planemask;		/* plane mask virtual location  */
147*52131Smckusick 	pmCursor mouse;			/* atomic read/write		*/
148*52131Smckusick 	pmBox	mbox;			/* atomic read/write		*/
149*52131Smckusick 	short	mthreshold;		/* mouse motion parameter	*/
150*52131Smckusick 	short	mscale;			/* mouse scale factor (if
151*52131Smckusick 					   negative, then do square).	*/
152*52131Smckusick 	short	min_cur_x;		/* min cursor x position	*/
153*52131Smckusick 	short	min_cur_y;		/* min cursor y position	*/
154*52131Smckusick } PM_Info;
155*52131Smckusick 
156*52131Smckusick typedef struct {
157*52131Smckusick 	short		Map;
158*52131Smckusick 	unsigned short	index;
159*52131Smckusick 	struct {
160*52131Smckusick 		unsigned short red;
161*52131Smckusick 		unsigned short green;
162*52131Smckusick 		unsigned short blue;
163*52131Smckusick 	} Entry;
164*52131Smckusick } ColorMap;
165*52131Smckusick 
166*52131Smckusick /*
167*52131Smckusick  * CAUTION:
168*52131Smckusick  *	The numbers of these ioctls must match
169*52131Smckusick  *	the ioctls in qvioctl.h
170*52131Smckusick  */
171*52131Smckusick #define QIOCGINFO 	_IOR('q', 1, struct pm_info *)	/* get the info	 */
172*52131Smckusick #define QIOCPMSTATE	_IOW('q', 2, pmCursor)		/* set mouse pos */
173*52131Smckusick #define	QIOWCURSORCOLOR	_IOW('q', 3, unsigned int [6])	/* bg/fg r/g/b */
174*52131Smckusick #define QIOCINIT	_IO('q', 4)			/* init screen   */
175*52131Smckusick #define QIOCKPCMD	_IOW('q', 5, struct pm_kpcmd)	/* keybd. per. cmd */
176*52131Smckusick #define QIOCADDR	_IOR('q', 6, struct pm_info *)	/* get address */
177*52131Smckusick #define	QIOWCURSOR	_IOW('q', 7, short [32])	/* write cursor bit map */
178*52131Smckusick #define QIOKERNLOOP	_IO('q', 8)   /* re-route kernel console output */
179*52131Smckusick #define QIOKERNUNLOOP	_IO('q', 9)   /* don't re-route kernel console output */
180*52131Smckusick #define QIOVIDEOON	_IO('q', 10)			/* turn on the video */
181*52131Smckusick #define	QIOVIDEOOFF	_IO('q', 11)			/* turn off the video */
182*52131Smckusick #define QIOSETCMAP      _IOW('q', 12, ColorMap)
183