1 /* $NetBSD: darwin_iohidsystem.h,v 1.15 2005/12/11 12:19:56 christos Exp $ */
4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _DARWIN_IOHIDSYSTEM_H_
33 #define _DARWIN_IOHIDSYSTEM_H_
35 extern struct mach_iokit_devclass darwin_iohidsystem_devclass
;
36 extern struct mach_iokit_devclass darwin_iokbd_devclass
;
37 extern struct mach_iokit_devclass darwin_iomouse_devclass
;
38 extern struct mach_iokit_devclass darwin_ioresources_devclass
;
40 /* Events and event queue */
41 #define DARWIN_NX_NULLEVENT 0
42 #define DARWIN_NX_LMOUSEDOWN 1
43 #define DARWIN_NX_LMOUSEUP 2
44 #define DARWIN_NX_RMOUSEDOWN 3
45 #define DARWIN_NX_RMOUSEUP 4
46 #define DARWIN_NX_MOUSEMOVED 5
47 #define DARWIN_NX_LMOUSEDRAGGED 6
48 #define DARWIN_NX_RMOUSEDRAGGED 7
49 #define DARWIN_NX_MOUSEENTERED 8
50 #define DARWIN_NX_MOUSEEXITED 9
51 #define DARWIN_NX_KEYDOWN 10
52 #define DARWIN_NX_KEYUP 11
53 #define DARWIN_NX_FLAGSCHANGED 12
55 #define DARWIN_NX_LMOUSEDOWN_MASK (1 << DARWIN_NX_LMOUSEDOWN)
56 #define DARWIN_NX_LMOUSEUP_MASK (1 << DARWIN_NX_LMOUSEUP)
57 #define DARWIN_NX_RMOUSEDOWN_MASK (1 << DARWIN_NX_RMOUSEDOWN)
58 #define DARWIN_NX_RMOUSEUP_MASK (1 << DARWIN_NX_RMOUSEUP)
59 #define DARWIN_NX_MOUSEMOVED_MASK (1 << DARWIN_NX_MOUSEMOVED)
60 #define DARWIN_NX_LMOUSEDRAGGED_MASK (1 << DARWIN_NX_LMOUSEDRAGGED)
61 #define DARWIN_NX_RMOUSEDRAGGED_MASK (1 << DARWIN_NX_RMOUSEDRAGGED)
62 #define DARWIN_NX_MOUSEENTERED_MASK (1 << DARWIN_NX_MOUSEENTERED)
63 #define DARWIN_NX_MOUSEEXITED_MASK (1 << DARWIN_NX_MOUSEEXITED)
64 #define DARWIN_NX_KEYDOWN_MASK (1 << DARWIN_NX_KEYDOWN)
65 #define DARWIN_NX_KEYUP_MASK (1 << DARWIN_NX_KEYUP)
66 #define DARWIN_NX_FLAGSCHANGED_MASK (1 << DARWIN_NX_FLAGSCHANGED)
72 uint16_t system_tabletid
;
73 uint16_t vendor_pointertype
;
74 uint32_t pointer_serialnum
;
78 uint8_t enter_proximity
;
80 } darwin_iohidsystem_tabletproxymity
;
98 } darwin_iohidsystem_tabletpoint
;
112 darwin_iohidsystem_tabletpoint point
;
113 darwin_iohidsystem_tabletproxymity proximity
;
125 darwin_iohidsystem_tabletpoint point
;
126 darwin_iohidsystem_tabletproxymity proximity
;
130 uint16_t orig_charset
;
135 uint16_t orig_charcode
;
137 int32_t keyboardtype
;
138 int32_t reserved2
[7];
145 int32_t reserved5
[9];
152 int32_t reserved2
[10];
187 uint16_t systemtabletid
;
188 uint16_t vendor_pointertype
;
189 uint32_t pointer_serialnum
;
193 uint8_t enter_proximity
;
196 } darwin_iohidsystem_event_data
;
201 darwin_iogpoint dne_location
;
202 darwin_iohidsystem_event_data dne_data
;
211 unsigned long die_time_hi
;
212 unsigned long die_time_lo
;
214 unsigned int die_window
;
215 darwin_iohidsystem_event_data die_data
;
216 } darwin_iohidsystem_event
;
220 darwin_ev_lock_data_t diei_sem
;
222 * Avoid automatic alignement, this should be
223 * darwin_iohidsystem_event, we declare it as a char array.
225 unsigned char diei_event
[76];
226 } darwin_iohidsystem_event_item
;
228 #define DARWIN_IOHIDSYSTEM_EVENTQUEUE_LEN 240
230 struct darwin_iohidsystem_evglobals
{
231 darwin_ev_lock_data_t evg_cursor_sem
;
235 int evg_uniq_mouseid
;
239 darwin_iogpoint evg_cursor_loc
;
240 int evg_cursor_frame
;
241 darwin_iogbounds evg_all_screen
;
242 darwin_iogbounds evg_mouse_rect
;
246 unsigned int evg_reserved1
[31];
247 unsigned evg_reserved2
:27;
248 unsigned evg_want_pressure
:1;
249 unsigned evg_want_precision
:1;
250 unsigned evg_dontwant_coalesce
:1;
251 unsigned evg_dont_coalesce
:1;
252 unsigned evg_mouserect_valid
:1;
254 int evg_lastevent_sent
;
255 int evg_lastevent_consumed
;
256 darwin_ev_lock_data_t evg_waitcursor_sem
;
258 char evg_waitcursor_timeout
;
259 char evg_waitcursor_enabled
;
260 char evg_globalwaitcursor_enabled
;
261 int evg_waitcursor_threshold
;
262 darwin_iohidsystem_event_item
263 evg_evqueue
[DARWIN_IOHIDSYSTEM_EVENTQUEUE_LEN
];
266 /* Shared memory between the IOHIDSystem driver and userland */
267 struct darwin_iohidsystem_shmem
{
268 int dis_global_offset
; /* Offset to global zone, usually 8 */
269 int dis_private_offset
; /* Offset to private memory. Don't care. */
270 struct darwin_iohidsystem_evglobals dis_evglobals
;
273 /* I/O selectors for io_connect_method_{scalar|struct}i_{scalar|struct}o */
274 #define DARWIN_IOHIDCREATESHMEM 0
275 #define DARWIN_IOHIDSETEVENTSENABLE 1
276 #define DARWIN_IOHIDSETCURSORENABLE 2
277 #define DARWIN_IOHIDPOSTEVENT 3
278 #define DARWIN_IOHIDSETMOUSELOCATION 4
279 #define DARWIN_IOHIDGETBUTTONEVENTNUM 5
282 int darwin_iohidsystem_connect_method_scalari_scalaro(struct mach_trap_args
*);
283 int darwin_iohidsystem_connect_method_structi_structo(struct mach_trap_args
*);
284 int darwin_iohidsystem_connect_map_memory(struct mach_trap_args
*);
285 void darwin_iohidsystem_postfake(struct lwp
*);
287 /* I/O notifications: XXX not checked on Darwin */
290 mach_msg_header_t req_msgh
;
291 mach_msg_trailer_t req_trailer
;
292 } mach_notify_iohidsystem_request_t
;
294 #endif /* _DARWIN_IOHIDSYSTEM_H_ */