[NTOSKRNL_VISTA] Implement IoGetIrpExtraCreateParameter
[reactos.git] / sdk / lib / drivers / hidparser / hidparser.h
1 /*
2 * PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/drivers/hidparser/hidparser.c
5 * PURPOSE: HID Parser
6 * PROGRAMMERS:
7 * Michael Martin (michael.martin@reactos.org)
8 * Johannes Anderwald (johannes.anderwald@reactos.org)
9 */
10
11 #pragma once
12
13 //
14 // function prototypes
15 //
16 typedef PVOID (NTAPI *PHIDPARSER_ALLOC_FUNCTION)(ULONG Size);
17 typedef VOID (NTAPI *PHIDPARSER_FREE_FUNCTION)(PVOID Item);
18 typedef VOID (NTAPI *PHIDPARSER_ZERO_FUNCTION)(PVOID Item, ULONG Size);
19 typedef VOID (NTAPI *PHIDPARSER_COPY_FUNCTION)(PVOID Target, PVOID Source, ULONG Size);
20 typedef VOID (__cdecl *PHIDPARSER_DEBUG_FUNCTION)(LPCSTR Src, ...);
21
22 //
23 // status code
24 //
25 typedef long HIDPARSER_STATUS;
26
27 //
28 // result codes
29 //
30 typedef enum
31 {
32 HIDPARSER_STATUS_SUCCESS = 0,
33 HIDPARSER_STATUS_INSUFFICIENT_RESOURCES = -1,
34 HIDPARSER_STATUS_NOT_IMPLEMENTED = -2,
35 HIDPARSER_STATUS_REPORT_NOT_FOUND = -3,
36 HIDPARSER_STATUS_COLLECTION_NOT_FOUND = -4,
37 HIDPARSER_STATUS_INVALID_REPORT_LENGTH = -5,
38 HIDPARSER_STATUS_INVALID_REPORT_TYPE = -6,
39 HIDPARSER_STATUS_BUFFER_TOO_SMALL = -7,
40 HIDPARSER_STATUS_USAGE_NOT_FOUND = -8,
41 HIDPARSER_STATUS_I8042_TRANS_UNKNOWN = -9,
42 HIDPARSER_STATUS_BAD_LOG_PHY_VALUES = -10
43 }HIDPARSER_STATUS_CODES;
44
45 typedef struct
46 {
47 //
48 // size of struct
49 //
50 unsigned long Size;
51
52 //
53 // allocation function
54 //
55 PHIDPARSER_ALLOC_FUNCTION Alloc;
56
57 //
58 // free function
59 //
60 PFREE_FUNCTION Free;
61
62 //
63 // zero function
64 //
65 PHIDPARSER_ZERO_FUNCTION Zero;
66
67 //
68 // copy function
69 //
70 PHIDPARSER_COPY_FUNCTION Copy;
71
72 //
73 // debug function
74 //
75 PHIDPARSER_DEBUG_FUNCTION Debug;
76 }HID_PARSER, *PHID_PARSER;
77
78 VOID
79 HidParser_InitParser(
80 IN PHIDPARSER_ALLOC_FUNCTION AllocFunction,
81 IN PHIDPARSER_FREE_FUNCTION FreeFunction,
82 IN PHIDPARSER_ZERO_FUNCTION ZeroFunction,
83 IN PHIDPARSER_COPY_FUNCTION CopyFunction,
84 IN PHIDPARSER_DEBUG_FUNCTION DebugFunction,
85 OUT PHID_PARSER Parser);
86
87 NTSTATUS
88 NTAPI
89 HidParser_GetCollectionDescription(
90 IN PHID_PARSER Parser,
91 IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
92 IN ULONG DescLength,
93 IN POOL_TYPE PoolType,
94 OUT PHIDP_DEVICE_DESC DeviceDescription);
95
96 VOID
97 NTAPI
98 HidParser_FreeCollectionDescription(
99 IN PHID_PARSER Parser,
100 IN PHIDP_DEVICE_DESC DeviceDescription);
101
102 HIDAPI
103 NTSTATUS
104 NTAPI
105 HidParser_GetCaps(
106 IN PHID_PARSER Parser,
107 IN PVOID CollectionContext,
108 OUT PHIDP_CAPS Capabilities);
109
110 HIDAPI
111 NTSTATUS
112 NTAPI
113 HidParser_GetSpecificValueCaps(
114 IN PHID_PARSER Parser,
115 IN PVOID CollectionContext,
116 IN HIDP_REPORT_TYPE ReportType,
117 IN USAGE UsagePage,
118 IN USHORT LinkCollection,
119 IN USAGE Usage,
120 OUT PHIDP_VALUE_CAPS ValueCaps,
121 IN OUT PUSHORT ValueCapsLength);
122
123
124 HIDAPI
125 NTSTATUS
126 NTAPI
127 HidParser_GetButtonCaps(
128 IN PHID_PARSER Parser,
129 IN PVOID CollectionContext,
130 HIDP_REPORT_TYPE ReportType,
131 PHIDP_BUTTON_CAPS ButtonCaps,
132 PUSHORT ButtonCapsLength);
133
134 HIDAPI
135 NTSTATUS
136 NTAPI
137 HidParser_GetSpecificButtonCaps(
138 IN PHID_PARSER Parser,
139 IN PVOID CollectionContext,
140 IN HIDP_REPORT_TYPE ReportType,
141 IN USAGE UsagePage,
142 IN USHORT LinkCollection,
143 IN USAGE Usage,
144 OUT PHIDP_BUTTON_CAPS ButtonCaps,
145 IN OUT PULONG ButtonCapsLength);
146
147 HIDAPI
148 NTSTATUS
149 NTAPI
150 HidParser_GetScaledUsageValue(
151 IN PHID_PARSER Parser,
152 IN PVOID CollectionContext,
153 IN HIDP_REPORT_TYPE ReportType,
154 IN USAGE UsagePage,
155 IN USHORT LinkCollection OPTIONAL,
156 IN USAGE Usage,
157 OUT PLONG UsageValue,
158 IN PCHAR Report,
159 IN ULONG ReportLength);
160
161
162 HIDAPI
163 NTSTATUS
164 NTAPI
165 HidParser_GetData(
166 IN PHID_PARSER Parser,
167 IN PVOID CollectionContext,
168 IN HIDP_REPORT_TYPE ReportType,
169 OUT PHIDP_DATA DataList,
170 IN OUT PULONG DataLength,
171 IN PCHAR Report,
172 IN ULONG ReportLength);
173
174 HIDAPI
175 NTSTATUS
176 NTAPI
177 HidParser_GetExtendedAttributes(
178 IN PHID_PARSER Parser,
179 IN PVOID CollectionContext,
180 IN HIDP_REPORT_TYPE ReportType,
181 IN USHORT DataIndex,
182 OUT PHIDP_EXTENDED_ATTRIBUTES Attributes,
183 IN OUT PULONG LengthAttributes);
184
185 HIDAPI
186 NTSTATUS
187 NTAPI
188 HidParser_GetLinkCollectionNodes(
189 IN PHID_PARSER Parser,
190 IN PVOID CollectionContext,
191 OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
192 IN OUT PULONG LinkCollectionNodesLength);
193
194
195 HIDAPI
196 NTSTATUS
197 NTAPI
198 HidParser_GetUsageValue(
199 IN PHID_PARSER Parser,
200 IN PVOID CollectionContext,
201 IN HIDP_REPORT_TYPE ReportType,
202 IN USAGE UsagePage,
203 IN USHORT LinkCollection,
204 IN USAGE Usage,
205 OUT PULONG UsageValue,
206 IN PCHAR Report,
207 IN ULONG ReportLength);
208
209 HIDAPI
210 NTSTATUS
211 NTAPI
212 HidParser_UsageListDifference(
213 IN PUSAGE PreviousUsageList,
214 IN PUSAGE CurrentUsageList,
215 OUT PUSAGE BreakUsageList,
216 OUT PUSAGE MakeUsageList,
217 IN ULONG UsageListLength);
218
219
220 HIDAPI
221 ULONG
222 NTAPI
223 HidParser_MaxUsageListLength(
224 IN PHID_PARSER Parser,
225 IN PVOID CollectionContext,
226 IN HIDP_REPORT_TYPE ReportType,
227 IN USAGE UsagePage OPTIONAL);
228
229 HIDAPI
230 NTSTATUS
231 NTAPI
232 HidParser_GetUsages(
233 IN PHID_PARSER Parser,
234 IN PVOID CollectionContext,
235 IN HIDP_REPORT_TYPE ReportType,
236 IN USAGE UsagePage,
237 IN USHORT LinkCollection OPTIONAL,
238 OUT USAGE *UsageList,
239 IN OUT ULONG *UsageLength,
240 IN PCHAR Report,
241 IN ULONG ReportLength);
242
243 HIDAPI
244 NTSTATUS
245 NTAPI
246 HidParser_GetUsagesEx(
247 IN PHID_PARSER Parser,
248 IN PVOID CollectionContext,
249 IN HIDP_REPORT_TYPE ReportType,
250 IN USHORT LinkCollection,
251 OUT PUSAGE_AND_PAGE ButtonList,
252 IN OUT ULONG *UsageLength,
253 IN PCHAR Report,
254 IN ULONG ReportLength);
255
256
257 NTSTATUS
258 NTAPI
259 HidParser_SysPowerEvent (
260 IN PHID_PARSER Parser,
261 IN PVOID CollectionContext,
262 IN PCHAR HidPacket,
263 IN USHORT HidPacketLength,
264 OUT PULONG OutputBuffer);
265
266 NTSTATUS
267 NTAPI
268 HidParser_SysPowerCaps (
269 IN PHID_PARSER Parser,
270 IN PVOID CollectionContext,
271 OUT PULONG OutputBuffer);
272
273 HIDAPI
274 NTSTATUS
275 NTAPI
276 HidParser_GetUsageValueArray(
277 IN PHID_PARSER Parser,
278 IN PVOID CollectionContext,
279 IN HIDP_REPORT_TYPE ReportType,
280 IN USAGE UsagePage,
281 IN USHORT LinkCollection OPTIONAL,
282 IN USAGE Usage,
283 OUT PCHAR UsageValue,
284 IN USHORT UsageValueByteLength,
285 IN PCHAR Report,
286 IN ULONG ReportLength);
287
288
289 HIDAPI
290 NTSTATUS
291 NTAPI
292 HidParser_UsageAndPageListDifference(
293 IN PUSAGE_AND_PAGE PreviousUsageList,
294 IN PUSAGE_AND_PAGE CurrentUsageList,
295 OUT PUSAGE_AND_PAGE BreakUsageList,
296 OUT PUSAGE_AND_PAGE MakeUsageList,
297 IN ULONG UsageListLength);
298
299 HIDAPI
300 NTSTATUS
301 NTAPI
302 HidParser_UnsetUsages(
303 IN PHID_PARSER Parser,
304 IN PVOID CollectionContext,
305 IN HIDP_REPORT_TYPE ReportType,
306 IN USAGE UsagePage,
307 IN USHORT LinkCollection,
308 IN PUSAGE UsageList,
309 IN OUT PULONG UsageLength,
310 IN OUT PCHAR Report,
311 IN ULONG ReportLength);
312
313 HIDAPI
314 NTSTATUS
315 NTAPI
316 HidParser_TranslateUsagesToI8042ScanCodes(
317 IN PUSAGE ChangedUsageList,
318 IN ULONG UsageListLength,
319 IN HIDP_KEYBOARD_DIRECTION KeyAction,
320 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
321 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
322 IN PVOID InsertCodesContext);
323
324 HIDAPI
325 NTSTATUS
326 NTAPI
327 HidParser_TranslateUsageAndPagesToI8042ScanCodes(
328 IN PHID_PARSER Parser,
329 IN PUSAGE_AND_PAGE ChangedUsageList,
330 IN ULONG UsageListLength,
331 IN HIDP_KEYBOARD_DIRECTION KeyAction,
332 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
333 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
334 IN PVOID InsertCodesContext);
335
336 HIDAPI
337 NTSTATUS
338 NTAPI
339 HidParser_SetUsages(
340 IN PHID_PARSER Parser,
341 IN PVOID CollectionContext,
342 IN HIDP_REPORT_TYPE ReportType,
343 IN USAGE UsagePage,
344 IN USHORT LinkCollection,
345 IN PUSAGE UsageList,
346 IN OUT PULONG UsageLength,
347 IN OUT PCHAR Report,
348 IN ULONG ReportLength);
349
350 HIDAPI
351 NTSTATUS
352 NTAPI
353 HidParser_SetUsageValueArray(
354 IN PHID_PARSER Parser,
355 IN PVOID CollectionContext,
356 IN HIDP_REPORT_TYPE ReportType,
357 IN USAGE UsagePage,
358 IN USHORT LinkCollection OPTIONAL,
359 IN USAGE Usage,
360 IN PCHAR UsageValue,
361 IN USHORT UsageValueByteLength,
362 OUT PCHAR Report,
363 IN ULONG ReportLength);
364
365 HIDAPI
366 NTSTATUS
367 NTAPI
368 HidParser_SetUsageValue(
369 IN PHID_PARSER Parser,
370 IN PVOID CollectionContext,
371 IN HIDP_REPORT_TYPE ReportType,
372 IN USAGE UsagePage,
373 IN USHORT LinkCollection,
374 IN USAGE Usage,
375 IN ULONG UsageValue,
376 IN OUT PCHAR Report,
377 IN ULONG ReportLength);
378
379 HIDAPI
380 NTSTATUS
381 NTAPI
382 HidParser_SetScaledUsageValue(
383 IN PHID_PARSER Parser,
384 IN PVOID CollectionContext,
385 IN HIDP_REPORT_TYPE ReportType,
386 IN USAGE UsagePage,
387 IN USHORT LinkCollection OPTIONAL,
388 IN USAGE Usage,
389 IN LONG UsageValue,
390 IN OUT PCHAR Report,
391 IN ULONG ReportLength);
392
393 HIDAPI
394 NTSTATUS
395 NTAPI
396 HidParser_SetData(
397 IN PHID_PARSER Parser,
398 IN PVOID CollectionContext,
399 IN HIDP_REPORT_TYPE ReportType,
400 IN PHIDP_DATA DataList,
401 IN OUT PULONG DataLength,
402 IN OUT PCHAR Report,
403 IN ULONG ReportLength);
404
405 HIDAPI
406 ULONG
407 NTAPI
408 HidParser_MaxDataListLength(
409 IN PHID_PARSER Parser,
410 IN PVOID CollectionContext,
411 IN HIDP_REPORT_TYPE ReportType);
412
413 HIDAPI
414 NTSTATUS
415 NTAPI
416 HidParser_InitializeReportForID(
417 IN PHID_PARSER Parser,
418 IN PVOID CollectionContext,
419 IN HIDP_REPORT_TYPE ReportType,
420 IN UCHAR ReportID,
421 IN OUT PCHAR Report,
422 IN ULONG ReportLength);
423
424 HIDPARSER_STATUS
425 HidParser_TranslateKbdUsage(
426 IN PHID_PARSER Parser,
427 IN USAGE Usage,
428 IN HIDP_KEYBOARD_DIRECTION KeyAction,
429 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
430 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
431 IN PVOID InsertCodesContext);
432
433 HIDPARSER_STATUS
434 HidParser_TranslateCustUsage(
435 IN PHID_PARSER Parser,
436 IN USAGE Usage,
437 IN HIDP_KEYBOARD_DIRECTION KeyAction,
438 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
439 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
440 IN PVOID InsertCodesContext);
441
442 HIDAPI
443 NTSTATUS
444 NTAPI
445 HidParser_GetValueCaps(
446 PHID_PARSER Parser,
447 IN PVOID CollectionContext,
448 HIDP_REPORT_TYPE ReportType,
449 PHIDP_VALUE_CAPS ValueCaps,
450 PULONG ValueCapsLength);