No empty .Rs/.Re
[netbsd-mini2440.git] / sys / compat / darwin / darwin_iohidsystem.h
blobe8b0b3c6ec615ca90adf6f9d548ceed637304380
1 /* $NetBSD: darwin_iohidsystem.h,v 1.15 2005/12/11 12:19:56 christos Exp $ */
3 /*-
4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Emmanuel Dreyfus
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
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)
68 typedef struct {
69 uint16_t tabletid;
70 uint16_t pointerid;
71 uint16_t deviceid;
72 uint16_t system_tabletid;
73 uint16_t vendor_pointertype;
74 uint32_t pointer_serialnum;
75 uint64_t uniqueid;
76 uint32_t cap_mask;
77 uint8_t ptrtype;
78 uint8_t enter_proximity;
79 int16_t reserved1;
80 } darwin_iohidsystem_tabletproxymity;
82 typedef struct {
83 int32_t x;
84 int32_t y;
85 int32_t z;
86 uint16_t buttons;
87 uint16_t pressure;
88 struct {
89 int16_t x;
90 int16_t y;
91 } tilt;
92 uint16_t rotation;
93 uint16_t tanpressure;
94 uint16_t devid;
95 uint16_t vendor1;
96 uint16_t vendor2;
97 uint16_t vendor3;
98 } darwin_iohidsystem_tabletpoint;
100 typedef union {
101 struct {
102 uint8_t subx;
103 uint8_t suby;
104 int16_t buttonid;
105 int32_t click;
106 uint8_t pressure;
107 uint8_t reserved1;
108 uint8_t subtype;
109 uint8_t reserved2;
110 uint32_t reserved3;
111 union {
112 darwin_iohidsystem_tabletpoint point;
113 darwin_iohidsystem_tabletproxymity proximity;
114 } tablet;
115 } mouse;
116 struct {
117 int32_t dx;
118 int32_t dy;
119 uint8_t subx;
120 uint8_t suby;
121 uint8_t subtype;
122 uint8_t reserved1;
123 int32_t reserved2;
124 union {
125 darwin_iohidsystem_tabletpoint point;
126 darwin_iohidsystem_tabletproxymity proximity;
127 } tablet;
128 } mouse_move;
129 struct {
130 uint16_t orig_charset;
131 int16_t repeat;
132 uint16_t charset;
133 uint16_t charcode;
134 uint16_t keycode;
135 uint16_t orig_charcode;
136 int32_t reserved1;
137 int32_t keyboardtype;
138 int32_t reserved2[7];
139 } key;
140 struct {
141 int16_t reserved;
142 int16_t eventnum;
143 int32_t trackingnum;
144 int32_t userdata;
145 int32_t reserved5[9];
146 } tracking;
147 struct {
148 int16_t da1;
149 int16_t da2;
150 int16_t da3;
151 int16_t reserved1;
152 int32_t reserved2[10];
153 } scrollwheel;
154 struct {
155 int16_t reserved;
156 int16_t subtype;
157 union {
158 float F[11];
159 long L[11];
160 short S[22];
161 char C[44];
162 } misc;
163 } compound;
164 struct {
165 int32_t x;
166 int32_t y;
167 int32_t z;
168 uint16_t buttons;
169 uint16_t pressure;
170 struct {
171 int16_t x;
172 int16_t y;
173 } tilt;
174 uint16_t rotation;
175 int16_t tanpressure;
176 uint16_t devid;
177 int16_t vendor1;
178 int16_t vendor2;
179 int16_t vendor3;
180 int32_t reserved[4];
181 } tablet;
182 struct {
183 uint16_t vendorid;
184 uint16_t tabletid;
185 uint16_t pointerid;
186 uint16_t deviceid;
187 uint16_t systemtabletid;
188 uint16_t vendor_pointertype;
189 uint32_t pointer_serialnum;
190 uint64_t uniqueid;
191 uint32_t cap_mask;
192 uint8_t ptr_type;
193 uint8_t enter_proximity;
194 int16_t reserved[9];
195 } proximity;
196 } darwin_iohidsystem_event_data;
198 typedef struct {
199 int dne_setcursor;
200 int dne_type;
201 darwin_iogpoint dne_location;
202 darwin_iohidsystem_event_data dne_data;
203 int dne_setflags;
204 int dne_flags;
205 } darwin_nxll_event;
207 typedef struct {
208 int die_type;
209 int die_location_x;
210 int die_location_y;
211 unsigned long die_time_hi;
212 unsigned long die_time_lo;
213 int die_flags;
214 unsigned int die_window;
215 darwin_iohidsystem_event_data die_data;
216 } darwin_iohidsystem_event;
218 typedef struct {
219 int diei_next;
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;
232 int evg_event_head;
233 int evg_event_tail;
234 int evg_event_last;
235 int evg_uniq_mouseid;
236 int evg_buttons;
237 int evg_event_flags;
238 int evg_event_time;
239 darwin_iogpoint evg_cursor_loc;
240 int evg_cursor_frame;
241 darwin_iogbounds evg_all_screen;
242 darwin_iogbounds evg_mouse_rect;
243 int evg_version;
244 int evg_struct_size;
245 int evg_last_frame;
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;
253 int evg_moved_mask;
254 int evg_lastevent_sent;
255 int evg_lastevent_consumed;
256 darwin_ev_lock_data_t evg_waitcursor_sem;
257 int evg_waitcursor;
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 */
289 typedef struct {
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_ */