Root/
Source at commit 1275 created 12 years 11 months ago. By meklort, Remove unused file. Fixup makefiles some more - boot2 compiles again. | |
---|---|
1 | /*␊ |
2 | * @APPLE_LICENSE_HEADER_START@␊ |
3 | * ␊ |
4 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.␊ |
5 | * ␊ |
6 | * This file contains Original Code and/or Modifications of Original Code␊ |
7 | * as defined in and that are subject to the Apple Public Source License␊ |
8 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
9 | * compliance with the License. Please obtain a copy of the License at␊ |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
11 | * file.␊ |
12 | * ␊ |
13 | * The Original Code and all software distributed under the License are␊ |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
18 | * Please see the License for the specific language governing rights and␊ |
19 | * limitations under the License.␊ |
20 | * ␊ |
21 | * @APPLE_LICENSE_HEADER_END@␊ |
22 | */␊ |
23 | /******************************************************************************␊ |
24 | ␊ |
25 | evio.h␊ |
26 | Ioctl calls for the events driver␊ |
27 | Leovitch 02Jan88␊ |
28 | ␊ |
29 | Copyright 1988 NeXT, Inc.␊ |
30 | ␊ |
31 | ␉CAUTION: Developers should stick to the API exported in␊ |
32 | ␉␉<drivers/event_status_driver.h> to guarantee␊ |
33 | ␉␉binary compatability of their applications in future␊ |
34 | ␉␉releases.␊ |
35 | ␊ |
36 | Modified:␊ |
37 | ␊ |
38 | 09Dec88 Leo Broken out from evsio.h␊ |
39 | 24Aug89 Ted ANSI function prototyping.␊ |
40 | 19Feb90 Ted Major revision for multiple driver support.␊ |
41 | 26Feb90 Ted New evioScreen structure and EVIOST ioctl.␊ |
42 | 12Mar90 Ted New ev_unregister_screen function, SCREENTOKEN constant.␊ |
43 | 06May90 Ted Added AALastEventSent and AALastEventConsumed to EvVars.␊ |
44 | 22May90 Trey More wait cursor vars in EvVars.␊ |
45 | 13Jun90 Ted NXCursorData structure.␊ |
46 | 18Jun90 Ted Default wait cursor constants.␊ |
47 | 26Sep90 Ted Enhanced cursor system to support intelligent drivers.␊ |
48 | 26Nov90 Ted Removed NXSaveCursor and NXCursorData structures␊ |
49 | 28Nov90 Ted Remove EvVars, rolled into EventGlobals␊ |
50 | 28Nov90 Ted Renamed EventGlobals -> EvGlobals, eventGlobals -> evg␊ |
51 | 05May92 Mike Reworked for NRW driver architecture.␊ |
52 | ␊ |
53 | ******************************************************************************/␊ |
54 | ␊ |
55 | #ifndef _DEV_EVIO_H␊ |
56 | #define _DEV_EVIO_H␊ |
57 | ␊ |
58 | #include <sys/cdefs.h>␊ |
59 | ␊ |
60 | __BEGIN_DECLS␊ |
61 | ␊ |
62 | #if KERNEL␊ |
63 | #include <IOKit/system.h>␊ |
64 | #else /* !KERNEL */␊ |
65 | #include <mach/message.h>␊ |
66 | #include <IOKit/IOKitLib.h>␊ |
67 | #endif /* KERNEL */␊ |
68 | ␊ |
69 | #include <IOKit/IOReturn.h>␊ |
70 | #include <IOKit/graphics/IOGraphicsTypes.h>␊ |
71 | #include <IOKit/hidsystem/IOHIDTypes.h>␊ |
72 | #include <IOKit/hidsystem/IOLLEvent.h>␊ |
73 | ␊ |
74 | /*␊ |
75 | * Identify this driver as one that uses the new driverkit and messaging API␊ |
76 | */␊ |
77 | #ifndef _NeXT_MACH_EVENT_DRIVER_␊ |
78 | #define _NeXT_MACH_EVENT_DRIVER_␉(1)␊ |
79 | #endif /* _NeXT_MACH_EVENT_DRIVER_ */␊ |
80 | ␊ |
81 | ␊ |
82 | /* Pressure Constants */␊ |
83 | #define MINPRESSURE EV_MINPRESSURE␊ |
84 | #define MAXPRESSURE EV_MAXPRESSURE␊ |
85 | ␊ |
86 | #define␉LLEQSIZE 240␉/* Entries in low-level event queue */␊ |
87 | ␊ |
88 | typedef struct _NXEQElStruct {␊ |
89 | int␉next;␉␉/* Slot of lleq for next event */␊ |
90 | ev_lock_data_t sema; /* Is high-level code reading this event now? */␊ |
91 | NXEvent event;␉/* The event itself */␊ |
92 | } NXEQElement;␊ |
93 | ␊ |
94 | ␊ |
95 | /******************************************************************************␊ |
96 | SHARED MEMORY OVERVIEW␊ |
97 | ␊ |
98 | PERSPECTIVE␊ |
99 | The ev driver and PostScript share at least one page of wired memory.␊ |
100 | This memory contains the low-level event queue which ev deposits events␊ |
101 | into and PostScript reads events from. Also, this memory contains other␊ |
102 | important data such as wait cursor state and some general cursor state.␊ |
103 | This memory is critical for speed. That is, we avoid having to make␊ |
104 | system calls for common operations.␊ |
105 | ␊ |
106 | SHARED MEMORY REGIONS␊ |
107 | There are currently three "regions" or "zones" delineated within this␊ |
108 | shared memory. The first zone is the EvOffsets structure. This structure␊ |
109 | contains two offsets from the beginning of shared memory. The first offset␊ |
110 | is to the second zone, EvGlobals. The second offset is to the third␊ |
111 | zone, private shmem for drivers.␊ |
112 | ␊ |
113 | INITIALIZATION OF SHARED MEMORY␊ |
114 | When the WindowServer starts up, it finds all screens that will be active.␊ |
115 | It then opens the ev driver and calls the EVIOSSCR ioctl repeatedly for␊ |
116 | each screen in use. This lets the ev driver set up the evScreen array␊ |
117 | and fill in each element. This ioctl also returns to PostScript a running␊ |
118 | total shared memory size with which to allocate. PostScript then allocates␊ |
119 | a region of memory this size and calls evmmap to "map in" this shared␊ |
120 | region. Evmmap initializes and fills in the EvOffsets and EvGlobals.␊ |
121 | Next the WindowServer calls each screen in turn to register itself with␊ |
122 | the ev driver in the same sequence as presented to EVIOSSCR. Each screen␊ |
123 | driver calls ev_register_screen() which among other things allocates a␊ |
124 | part of the private shmem (of the third shared memory zone) for the driver.␊ |
125 | ␊ |
126 | DEBUGGING NOTES␊ |
127 | You can easily display and set this shared memory from kgdb, but usually␊ |
128 | cannot do so from within PostScript. Gdb (or some weird interaction␊ |
129 | between gdb and the os) chokes on this shmem. So if you read or write␊ |
130 | this area of memory, copy-on-write will occur and you'll get a completely␊ |
131 | new page for PostScript. This will render the shared memory scheme␊ |
132 | useless and you will have to restart PostScript. It was my understanding␊ |
133 | that before, we were able to "read" this area from PS, but not write to␊ |
134 | it (the idea behind copy-on-WRITE). However, this seems to be broken␊ |
135 | in 2.0. We think this is a kernel bug.␊ |
136 | ******************************************************************************/␊ |
137 | ␊ |
138 | typedef volatile struct _evOffsets {␊ |
139 | int␉evGlobalsOffset;␉/* Offset to EvGlobals structure */␊ |
140 | int evShmemOffset;␉␉/* Offset to private shmem regions */␊ |
141 | } EvOffsets;␊ |
142 | ␊ |
143 | /******************************************************************************␊ |
144 | EvGlobals␊ |
145 | This structures defines the portion of the events driver data structure␊ |
146 | that is exported to the PostScript server. It contains the event queue␊ |
147 | which is in memory shared between the driver and the PostScript server.␊ |
148 | All the variables necessary to read and process events from the queue are␊ |
149 | contained here.␊ |
150 | ******************************************************************************/␊ |
151 | ␊ |
152 | #ifndef __ppc__␊ |
153 | typedef volatile struct _evGlobals {␊ |
154 | ev_lock_data_t cursorSema; ␉/* set to disable periodic code */␊ |
155 | int eNum;␉␉␉/* Unique id for mouse events */␊ |
156 | int buttons;␉␉/* State of the mouse buttons 1==down, 0==up */␊ |
157 | int eventFlags;␉␉/* The current value of event.flags */␊ |
158 | int VertRetraceClock;␉/* The current value of event.time */␊ |
159 | IOGPoint cursorLoc;␉␉/* The current location of the cursor */␊ |
160 | int frame;␉␉␉/* current cursor frame */␊ |
161 | IOGBounds workBounds;␉/* bounding box of all screens */␊ |
162 | IOGBounds mouseRect;␉/* Rect for mouse-exited events */␊ |
163 | int version;␉␉/* for run time checks */␊ |
164 | int␉structSize;␉␉/* for run time checks */␊ |
165 | int lastFrame;␊ |
166 | unsigned int reservedA[31];␊ |
167 | ␊ |
168 | unsigned reserved:27;␊ |
169 | unsigned wantPressure:1;␉/* pressure in current mouseRect? */␊ |
170 | unsigned wantPrecision:1;␉/* precise coordinates in current mouseRect? */␊ |
171 | unsigned dontWantCoalesce:1;/* coalesce within the current mouseRect? */␊ |
172 | unsigned dontCoalesce:1;␉/* actual flag which determines coalescing */␊ |
173 | unsigned mouseRectValid:1;␉/* If nonzero, post a mouse-exited␊ |
174 | ␉␉␉␉ whenever mouse outside mouseRect. */␊ |
175 | int movedMask;␉␉/* This contains an event mask for the␊ |
176 | ␉␉␉␉ three events MOUSEMOVED,␊ |
177 | ␉␉␉␉ LMOUSEDRAGGED, and RMOUSEDRAGGED.␊ |
178 | ␉␉␉␉ It says whether driver should␊ |
179 | ␉␉␉␉ generate those events. */␊ |
180 | ev_lock_data_t waitCursorSema; /* protects wait cursor fields */␊ |
181 | int AALastEventSent;␉/* timestamp for wait cursor */␊ |
182 | int AALastEventConsumed;␉/* timestamp for wait cursor */␉␊ |
183 | int waitCursorUp;␉␉/* Is wait cursor up? */␊ |
184 | char ctxtTimedOut;␉␉/* Has wait cursor timer expired? */␊ |
185 | char waitCursorEnabled;␉/* Play wait cursor game (per ctxt)? */␊ |
186 | char globalWaitCursorEnabled; /* Play wait cursor game (global)? */␊ |
187 | int waitThreshold;␉␉/* time before wait cursor appears */␊ |
188 | ␊ |
189 | int LLEHead;␉␉/* The next event to be read */␊ |
190 | int LLETail;␉␉/* Where the next event will go */␊ |
191 | int LLELast;␉␉/* The last event entered */␊ |
192 | NXEQElement lleq[LLEQSIZE];␉/* The event queue itself */␊ |
193 | } EvGlobals;␊ |
194 | ␊ |
195 | #else␊ |
196 | ␊ |
197 | typedef volatile struct _evGlobals {␊ |
198 | ev_lock_data_t cursorSema; ␉/* set to disable periodic code */␊ |
199 | int LLEHead;␉␉/* The next event to be read */␊ |
200 | int LLETail;␉␉/* Where the next event will go */␊ |
201 | int LLELast;␉␉/* The last event entered */␊ |
202 | int eNum;␉␉␉/* Unique id for mouse events */␊ |
203 | int buttons;␉␉/* State of the mouse buttons 1==down, 0==up */␊ |
204 | int eventFlags;␉␉/* The current value of event.flags */␊ |
205 | int VertRetraceClock;␉/* The current value of event.time */␊ |
206 | IOGPoint cursorLoc;␉␉/* The current location of the cursor */␊ |
207 | int frame;␉␉␉/* current cursor frame */␊ |
208 | IOGBounds workBounds;␉/* bounding box of all screens */␊ |
209 | IOGBounds mouseRect;␉/* Rect for mouse-exited events */␊ |
210 | int version;␉␉/* for run time checks */␊ |
211 | int␉structSize;␉␉/* for run time checks */␊ |
212 | int lastFrame;␊ |
213 | unsigned int reservedA[31];␊ |
214 | ␊ |
215 | unsigned reserved:27;␊ |
216 | unsigned wantPressure:1;␉/* pressure in current mouseRect? */␊ |
217 | unsigned wantPrecision:1;␉/* precise coordinates in current mouseRect? */␊ |
218 | unsigned dontWantCoalesce:1;/* coalesce within the current mouseRect? */␊ |
219 | unsigned dontCoalesce:1;␉/* actual flag which determines coalescing */␊ |
220 | unsigned mouseRectValid:1;␉/* If nonzero, post a mouse-exited␊ |
221 | ␉␉␉␉ whenever mouse outside mouseRect. */␊ |
222 | int movedMask;␉␉/* This contains an event mask for the␊ |
223 | ␉␉␉␉ three events MOUSEMOVED,␊ |
224 | ␉␉␉␉ LMOUSEDRAGGED, and RMOUSEDRAGGED.␊ |
225 | ␉␉␉␉ It says whether driver should␊ |
226 | ␉␉␉␉ generate those events. */␊ |
227 | int AALastEventSent;␉/* timestamp for wait cursor */␊ |
228 | int AALastEventConsumed;␉/* timestamp for wait cursor */␉␊ |
229 | ev_lock_data_t waitCursorSema; /* protects wait cursor fields */␊ |
230 | int waitCursorUp;␉␉/* Is wait cursor up? */␊ |
231 | char ctxtTimedOut;␉␉/* Has wait cursor timer expired? */␊ |
232 | char waitCursorEnabled;␉/* Play wait cursor game (per ctxt)? */␊ |
233 | char globalWaitCursorEnabled; /* Play wait cursor game (global)? */␊ |
234 | int waitThreshold;␉␉/* time before wait cursor appears */␊ |
235 | NXEQElement lleq[LLEQSIZE];␉/* The event queue itself */␊ |
236 | } EvGlobals;␊ |
237 | #endif␊ |
238 | ␊ |
239 | /* These evio structs are used in various calls supported by the ev driver. */␊ |
240 | ␊ |
241 | struct evioLLEvent {␊ |
242 | int setCursor;␊ |
243 | int type;␊ |
244 | IOGPoint location;␊ |
245 | NXEventData data;␊ |
246 | int setFlags;␊ |
247 | int flags;␊ |
248 | };␊ |
249 | ␊ |
250 | typedef struct evioLLEvent _NXLLEvent;␊ |
251 | ␊ |
252 | #ifdef mach3xxx␊ |
253 | ␊ |
254 | /*␊ |
255 | * On a keypress of a VOL UP or VOL DOWN key, we send a message to the ␊ |
256 | * sound server to notify it of the volume change. The message includes␊ |
257 | * a flag to indicate which key was pressed, and the machine independant␊ |
258 | * flag bits to indicate which modifier keys were pressed.␊ |
259 | */␊ |
260 | ␊ |
261 | struct evioSpecialKeyMsg␊ |
262 | {␊ |
263 | ␉msg_header_t Head;␊ |
264 | ␉msg_type_t keyType;␊ |
265 | ␉int key;␉␉// special key number, from bsd/dev/ev_keymap.h␊ |
266 | ␉msg_type_t directionType;␊ |
267 | ␉int direction;␉␉// NX_KEYDOWN, NX_KEYUP from event.h␊ |
268 | ␉msg_type_t flagsType;␊ |
269 | ␉int flags;␉␉// device independant flags from event.h␊ |
270 | ␉msg_type_t levelType;␊ |
271 | ␉int level;␉␉// EV_AUDIO_MIN_VOLUME to EV_AUDIO_MAX_VOLUME␊ |
272 | };␊ |
273 | #else␊ |
274 | struct evioSpecialKeyMsg␊ |
275 | {␊ |
276 | ␉mach_msg_header_t Head;␊ |
277 | ␉int key;␉␉// special key number, from bsd/dev/ev_keymap.h␊ |
278 | ␉int direction;␉␉// NX_KEYDOWN, NX_KEYUP from event.h␊ |
279 | ␉int flags;␉␉// device independant flags from event.h␊ |
280 | ␉int level;␉␉// EV_AUDIO_MIN_VOLUME to EV_AUDIO_MAX_VOLUME␊ |
281 | };␊ |
282 | #endif␊ |
283 | ␊ |
284 | #define EV_SPECIAL_KEY_MSG_ID␉(('S'<<24) | ('k'<<16) | ('e'<<8) | ('y'))␊ |
285 | typedef struct evioSpecialKeyMsg *evioSpecialKeyMsg_t;␊ |
286 | ␊ |
287 | /*␊ |
288 | * Volume ranges␊ |
289 | */␊ |
290 | #define EV_AUDIO_MIN_VOLUME␉0␊ |
291 | #define EV_AUDIO_MAX_VOLUME␉64␊ |
292 | ␊ |
293 | #define kIOHIDSystemClass␉"IOHIDSystem"␊ |
294 | #define kIOHIKeyboardClass␉"IOHIKeyboard"␊ |
295 | #define kIOHIPointingClass␉"IOHIPointing"␊ |
296 | ␊ |
297 | #define IOHIDSYSTEM_CONFORMSTO␉kIOHIDSystemClass␊ |
298 | ␊ |
299 | enum {␊ |
300 | kIOHIDCurrentShmemVersion␉= 3,␊ |
301 | kIOHIDEventNotification␉= 0,␊ |
302 | };␊ |
303 | ␊ |
304 | enum {␊ |
305 | kIOHIDServerConnectType␉= 0,␊ |
306 | kIOHIDParamConnectType␉= 1,␊ |
307 | kIOHIDEventSystemConnectType = 3,␊ |
308 | };␊ |
309 | ␊ |
310 | enum {␊ |
311 | kIOHIDGlobalMemory = 0␊ |
312 | };␊ |
313 | ␊ |
314 | enum {␊ |
315 | kIOHIDEventQueueTypeKernel = 0,␊ |
316 | kIOHIDEventQueueTypeUser = 1␊ |
317 | };␊ |
318 | ␊ |
319 | #ifdef KERNEL␊ |
320 | typedef UInt16 (*MasterVolumeUpdate)(void);␊ |
321 | typedef bool (*MasterMuteUpdate)(void);␊ |
322 | ␊ |
323 | typedef struct {␊ |
324 | MasterVolumeUpdate incrementMasterVolume;␊ |
325 | MasterVolumeUpdate decrementMasterVolume;␊ |
326 | MasterMuteUpdate toggleMasterMute;␊ |
327 | } MasterAudioFunctions;␊ |
328 | ␊ |
329 | extern MasterAudioFunctions *masterAudioFunctions;␊ |
330 | #endif␊ |
331 | ␊ |
332 | #ifndef KERNEL␊ |
333 | #ifndef _IOKIT_IOHIDLIB_H␊ |
334 | #include <IOKit/hidsystem/IOHIDLib.h>␊ |
335 | #endif␊ |
336 | #endif /* !KERNEL */␊ |
337 | ␊ |
338 | __END_DECLS␊ |
339 | ␊ |
340 | ␊ |
341 | #endif /* !_DEV_EVIO_H */␊ |
342 |