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