kernel32: Use the Mach host_info(HOST_BASIC_INFO) API to obtain total RAM after tryin...
[wine/multimedia.git] / include / ddk / usb.h
blob0cda6a4e43f7b1b4cee51a95493dc5bf26e6dac3
1 /*
2 * Copyright (C) the Wine project
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __DDK_USB_H__
20 #define __DDK_USB_H__
22 #include <ddk/usb200.h>
24 #define URB_FUNCTION_SELECT_CONFIGURATION 0x0000
25 #define URB_FUNCTION_SELECT_INTERFACE 0x0001
26 #define URB_FUNCTION_ABORT_PIPE 0x0002
27 #define URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL 0x0003
28 #define URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL 0x0004
29 #define URB_FUNCTION_GET_FRAME_LENGTH 0x0005
30 #define URB_FUNCTION_SET_FRAME_LENGTH 0x0006
31 #define URB_FUNCTION_GET_CURRENT_FRAME_NUMBER 0x0007
32 #define URB_FUNCTION_CONTROL_TRANSFER 0x0008
33 #define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER 0x0009
34 #define URB_FUNCTION_ISOCH_TRANSFER 0x000A
35 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE 0x000B
36 #define URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE 0x000C
37 #define URB_FUNCTION_SET_FEATURE_TO_DEVICE 0x000D
38 #define URB_FUNCTION_SET_FEATURE_TO_INTERFACE 0x000E
39 #define URB_FUNCTION_SET_FEATURE_TO_ENDPOINT 0x000F
40 #define URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE 0x0010
41 #define URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE 0x0011
42 #define URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT 0x0012
43 #define URB_FUNCTION_GET_STATUS_FROM_DEVICE 0x0013
44 #define URB_FUNCTION_GET_STATUS_FROM_INTERFACE 0x0014
45 #define URB_FUNCTION_GET_STATUS_FROM_ENDPOINT 0x0015
46 #define URB_FUNCTION_RESERVED_0X0016 0x0016
47 #define URB_FUNCTION_VENDOR_DEVICE 0x0017
48 #define URB_FUNCTION_VENDOR_INTERFACE 0x0018
49 #define URB_FUNCTION_VENDOR_ENDPOINT 0x0019
50 #define URB_FUNCTION_CLASS_DEVICE 0x001A
51 #define URB_FUNCTION_CLASS_INTERFACE 0x001B
52 #define URB_FUNCTION_CLASS_ENDPOINT 0x001C
53 #define URB_FUNCTION_RESERVE_0X001D 0x001D
54 #define URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL 0x001E
55 #define URB_FUNCTION_CLASS_OTHER 0x001F
56 #define URB_FUNCTION_VENDOR_OTHER 0x0020
57 #define URB_FUNCTION_GET_STATUS_FROM_OTHER 0x0021
58 #define URB_FUNCTION_CLEAR_FEATURE_TO_OTHER 0x0022
59 #define URB_FUNCTION_SET_FEATURE_TO_OTHER 0x0023
60 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT 0x0024
61 #define URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT 0x0025
62 #define URB_FUNCTION_GET_CONFIGURATION 0x0026
63 #define URB_FUNCTION_GET_INTERFACE 0x0027
64 #define URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE 0x0028
65 #define URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE 0x0029
66 #define URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR 0x002A
67 #define URB_FUNCTION_RESERVE_0X002B 0x002B
68 #define URB_FUNCTION_RESERVE_0X002C 0x002C
69 #define URB_FUNCTION_RESERVE_0X002D 0x002D
70 #define URB_FUNCTION_RESERVE_0X002E 0x002E
71 #define URB_FUNCTION_RESERVE_0X002F 0x002F
72 #define URB_FUNCTION_SYNC_RESET_PIPE 0x0030
73 #define URB_FUNCTION_SYNC_CLEAR_STALL 0x0031
75 #define USBD_SHORT_TRANSFER_OK 0x00000002
76 #define USBD_TRANSFER_DIRECTION_OUT 0
77 #define USBD_TRANSFER_DIRECTION_IN 1
79 typedef LONG USBD_STATUS;
81 typedef PVOID USBD_PIPE_HANDLE;
82 typedef PVOID USBD_CONFIGURATION_HANDLE;
83 typedef PVOID USBD_INTERFACE_HANDLE;
85 #define USBD_STATUS_SUCCESS ((USBD_STATUS)0x00000000)
86 #define USBD_STATUS_PENDING ((USBD_STATUS)0x40000000)
87 #define USBD_STATUS_ERROR ((USBD_STATUS)0x80000000)
88 #define USBD_STATUS_HALTED ((USBD_STATUS)0xC0000000)
90 #define USBD_STATUS_CANCELED ((USBD_STATUS)0x00010000)
91 #define USBD_STATUS_CANCELING ((USBD_STATUS)0x00020000)
92 #define USBD_STATUS_CRC ((USBD_STATUS)0xC0000001)
93 #define USBD_STATUS_BTSTUFF ((USBD_STATUS)0xC0000002)
94 #define USBD_STATUS_DATA_TOGGLE_MISMATCH ((USBD_STATUS)0xC0000003)
95 #define USBD_STATUS_STALL_PID ((USBD_STATUS)0xC0000004)
96 #define USBD_STATUS_DEV_NOT_RESPONDING ((USBD_STATUS)0xC0000005)
97 #define USBD_STATUS_PID_CHECK_FAILURE ((USBD_STATUS)0xC0000006)
98 #define USBD_STATUS_UNEXPECTED_PID ((USBD_STATUS)0xC0000007)
99 #define USBD_STATUS_DATA_OVERRUN ((USBD_STATUS)0xC0000008)
100 #define USBD_STATUS_DATA_UNDERRUN ((USBD_STATUS)0xC0000009)
101 #define USBD_STATUS_RESERVED1 ((USBD_STATUS)0xC000000A)
102 #define USBD_STATUS_RESERVED2 ((USBD_STATUS)0xC000000B)
103 #define USBD_STATUS_BUFFER_OVERRUN ((USBD_STATUS)0xC000000C)
104 #define USBD_STATUS_BUFFER_UNDERRUN ((USBD_STATUS)0xC000000D)
105 #define USBD_STATUS_NOT_ACCESSED ((USBD_STATUS)0xC000000F)
106 #define USBD_STATUS_FIFO ((USBD_STATUS)0xC0000010)
107 #define USBD_STATUS_XACT_ERROR ((USBD_STATUS)0xC0000011)
108 #define USBD_STATUS_BABBLE_DETECTED ((USBD_STATUS)0xC0000012)
109 #define USBD_STATUS_DATA_BUFFER_ERROR ((USBD_STATUS)0xC0000013)
110 #define USBD_STATUS_ENDPOINT_HALTED ((USBD_STATUS)0xC0000030)
111 #define USBD_STATUS_NO_MEMORY ((USBD_STATUS)0x80000100)
112 #define USBD_STATUS_INVALID_URB_FUNCTION ((USBD_STATUS)0x80000200)
113 #define USBD_STATUS_INVALID_PARAMETER ((USBD_STATUS)0x80000300)
114 #define USBD_STATUS_ERROR_BUSY ((USBD_STATUS)0x80000400)
115 #define USBD_STATUS_REQUEST_FAILED ((USBD_STATUS)0x80000500)
116 #define USBD_STATUS_INVALID_PIPE_HANDLE ((USBD_STATUS)0x80000600)
117 #define USBD_STATUS_NO_BANDWIDTH ((USBD_STATUS)0x80000700)
118 #define USBD_STATUS_INTERNAL_HC_ERROR ((USBD_STATUS)0x80000800)
119 #define USBD_STATUS_ERROR_SHORT_TRANSFER ((USBD_STATUS)0x80000900)
120 #define USBD_STATUS_BAD_START_FRAME ((USBD_STATUS)0xC0000A00)
121 #define USBD_STATUS_ISOCH_REQUEST_FAILED ((USBD_STATUS)0xC0000B00)
122 #define USBD_STATUS_FRAME_CONTROL_OWNED ((USBD_STATUS)0xC0000C00)
123 #define USBD_STATUS_FRAME_CONTROL_NOT_OWNED ((USBD_STATUS)0xC0000D00)
124 #define USBD_STATUS_NOT_SUPPORTED ((USBD_STATUS)0xC0000E00)
125 #define USBD_STATUS_INVALID_CONFIGURATION_DESCRIPTOR ((USBD_STATUS)0xC0000F00)
126 #define USBD_STATUS_INSUFFICIENT_RESOURCES ((USBD_STATUS)0xC0001000)
127 #define USBD_STATUS_SET_CONFIG_FAILED ((USBD_STATUS)0xC0002000)
128 #define USBD_STATUS_BUFFER_TOO_SMALL ((USBD_STATUS)0xC0003000)
129 #define USBD_STATUS_INTERFACE_NOT_FOUND ((USBD_STATUS)0xC0004000)
130 #define USBD_STATUS_INVALID_PIPE_FLAGS ((USBD_STATUS)0xC0005000)
131 #define USBD_STATUS_TIMEOUT ((USBD_STATUS)0xC0006000)
132 #define USBD_STATUS_DEVICE_GONE ((USBD_STATUS)0xC0007000)
133 #define USBD_STATUS_STATUS_NOT_MAPPED ((USBD_STATUS)0xC0008000)
134 #define USBD_STATUS_ISO_NOT_ACCESSED_BY_HW ((USBD_STATUS)0xC0020000)
135 #define USBD_STATUS_ISO_TD_ERROR ((USBD_STATUS)0xC0030000)
136 #define USBD_STATUS_ISO_NA_LATE_USBPORT ((USBD_STATUS)0xC0040000)
137 #define USBD_STATUS_ISO_NOT_ACCESSED_LATE ((USBD_STATUS)0xC0050000)
139 #define USBD_SUCCESS(Status) ((USBD_STATUS)(Status) >= 0)
140 #define USBD_PENDING(Status) ((ULONG)(Status) >> 30 == 1)
141 #define USBD_ERROR(Status) ((USBD_STATUS)(Status) < 0)
143 typedef struct _USBD_VERSION_INFORMATION {
144 ULONG USBDI_Version;
145 ULONG Supported_USB_Version;
146 } USBD_VERSION_INFORMATION;
147 typedef struct _USBD_VERSION_INFORMATION *PUSBD_VERSION_INFORMATION;
149 typedef enum _USBD_PIPE_TYPE {
150 UsbdPipeTypeControl,
151 UsbdPipeTypeIsochronous,
152 UsbdPipeTypeBulk,
153 UsbdPipeTypeInterrupt
154 } USBD_PIPE_TYPE;
156 typedef struct _USBD_PIPE_INFORMATION {
157 USHORT MaximumPacketSize;
158 UCHAR EndpointAddress;
159 UCHAR Interval;
160 USBD_PIPE_TYPE PipeType;
161 USBD_PIPE_HANDLE PipeHandle;
162 ULONG MaximumTransferSize;
163 ULONG PipeFlags;
164 } USBD_PIPE_INFORMATION;
165 typedef struct _USBD_PIPE_INFORMATION *PUSBD_PIPE_INFORMATION;
167 typedef struct _USBD_INTERFACE_INFORMATION {
168 USHORT Length;
169 UCHAR InterfaceNumber;
170 UCHAR AlternateSetting;
171 UCHAR Class;
172 UCHAR SubClass;
173 UCHAR Protocol;
174 UCHAR Reserved;
175 USBD_INTERFACE_HANDLE InterfaceHandle;
176 ULONG NumberOfPipes;
177 USBD_PIPE_INFORMATION Pipes[1];
178 } USBD_INTERFACE_INFORMATION;
179 typedef struct _USBD_INTERFACE_INFORMATION *PUSBD_INTERFACE_INFORMATION;
181 typedef struct _USBD_ISO_PACKET_DESCRIPTOR {
182 ULONG Offset;
183 ULONG Length;
184 USBD_STATUS Status;
185 } USBD_ISO_PACKET_DESCRIPTOR;
186 typedef struct _USBD_ISO_PACKET_DESCRIPTOR *PUSBD_ISO_PACKET_DESCRIPTOR;
188 struct _URB_HCD_AREA {
189 PVOID Reserved8[8];
192 struct _URB_HEADER {
193 USHORT Length;
194 USHORT Function;
195 USBD_STATUS Status;
196 PVOID UsbdDeviceHandle;
197 ULONG UsbdFlags;
200 struct _URB_SELECT_INTERFACE {
201 struct _URB_HEADER Hdr;
202 USBD_CONFIGURATION_HANDLE ConfigurationHandle;
203 USBD_INTERFACE_INFORMATION Interface;
206 struct _URB_SELECT_CONFIGURATION {
207 struct _URB_HEADER Hdr;
208 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
209 USBD_CONFIGURATION_HANDLE ConfigurationHandle;
210 USBD_INTERFACE_INFORMATION Interface;
213 struct _URB_PIPE_REQUEST {
214 struct _URB_HEADER Hdr;
215 USBD_PIPE_HANDLE PipeHandle;
216 ULONG Reserved;
219 struct _URB_FRAME_LENGTH_CONTROL {
220 struct _URB_HEADER Hdr;
223 struct _URB_GET_FRAME_LENGTH {
224 struct _URB_HEADER Hdr;
225 ULONG FrameLength;
226 ULONG FrameNumber;
229 struct _URB_SET_FRAME_LENGTH {
230 struct _URB_HEADER Hdr;
231 LONG FrameLengthDelta;
234 struct _URB_GET_CURRENT_FRAME_NUMBER {
235 struct _URB_HEADER Hdr;
236 ULONG FrameNumber;
239 struct _URB_CONTROL_TRANSFER {
240 struct _URB_HEADER Hdr;
241 USBD_PIPE_HANDLE PipeHandle;
242 ULONG TransferFlags;
243 ULONG TransferBufferLength;
244 PVOID TransferBuffer;
245 PMDL TransferBufferMDL;
246 struct _URB *UrbLink;
247 struct _URB_HCD_AREA hca;
248 UCHAR SetupPacket[8];
251 struct _URB_BULK_OR_INTERRUPT_TRANSFER {
252 struct _URB_HEADER Hdr;
253 USBD_PIPE_HANDLE PipeHandle;
254 ULONG TransferFlags;
255 ULONG TransferBufferLength;
256 PVOID TransferBuffer;
257 PMDL TransferBufferMDL;
258 struct _URB *UrbLink;
259 struct _URB_HCD_AREA hca;
262 struct _URB_ISOCH_TRANSFER {
263 struct _URB_HEADER Hdr;
264 USBD_PIPE_HANDLE PipeHandle;
265 ULONG TransferFlags;
266 ULONG TransferBufferLength;
267 PVOID TransferBuffer;
268 PMDL TransferBufferMDL;
269 struct _URB *UrbLink;
270 struct _URB_HCD_AREA hca;
271 ULONG StartFrame;
272 ULONG NumberOfPackets;
273 ULONG ErrorCount;
274 USBD_ISO_PACKET_DESCRIPTOR IsoPacket[1];
277 struct _URB_CONTROL_DESCRIPTOR_REQUEST {
278 struct _URB_HEADER Hdr;
279 PVOID Reserved;
280 ULONG Reserved0;
281 ULONG TransferBufferLength;
282 PVOID TransferBuffer;
283 PMDL TransferBufferMDL;
284 struct _URB *UrbLink;
285 struct _URB_HCD_AREA hca;
286 USHORT Reserved1;
287 UCHAR Index;
288 UCHAR DescriptorType;
289 USHORT LanguageId;
290 USHORT Reserved2;
293 struct _URB_CONTROL_GET_STATUS_REQUEST {
294 struct _URB_HEADER Hdr;
295 PVOID Reserved;
296 ULONG Reserved0;
297 ULONG TransferBufferLength;
298 PVOID TransferBuffer;
299 PMDL TransferBufferMDL;
300 struct _URB *UrbLink;
301 struct _URB_HCD_AREA hca;
302 UCHAR Reserved1[4];
303 USHORT Index;
304 USHORT Reserved2;
307 struct _URB_CONTROL_FEATURE_REQUEST {
308 struct _URB_HEADER Hdr;
309 PVOID Reserved;
310 ULONG Reserved2;
311 ULONG Reserved3;
312 PVOID Reserved4;
313 PMDL Reserved5;
314 struct _URB *UrbLink;
315 struct _URB_HCD_AREA hca;
316 USHORT Reserved0;
317 USHORT FeatureSelector;
318 USHORT Index;
319 USHORT Reserved1;
322 struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST {
323 struct _URB_HEADER Hdr;
324 PVOID Reserved;
325 ULONG TransferFlags;
326 ULONG TransferBufferLength;
327 PVOID TransferBuffer;
328 PMDL TransferBufferMDL;
329 struct _URB *UrbLink;
330 struct _URB_HCD_AREA hca;
331 UCHAR RequestTypeReservedBits;
332 UCHAR Request;
333 USHORT Value;
334 USHORT Index;
335 USHORT Reserved1;
338 struct _URB_CONTROL_GET_INTERFACE_REQUEST {
339 struct _URB_HEADER Hdr;
340 PVOID Reserved;
341 ULONG Reserved0;
342 ULONG TransferBufferLength;
343 PVOID TransferBuffer;
344 PMDL TransferBufferMDL;
345 struct _URB *UrbLink;
346 struct _URB_HCD_AREA hca;
347 UCHAR Reserved1[4];
348 USHORT Interface;
349 USHORT Reserved2;
352 struct _URB_CONTROL_GET_CONFIGURATION_REQUEST {
353 struct _URB_HEADER Hdr;
354 PVOID Reserved;
355 ULONG Reserved0;
356 ULONG TransferBufferLength;
357 PVOID TransferBuffer;
358 PMDL TransferBufferMDL;
359 struct _URB *UrbLink;
360 struct _URB_HCD_AREA hca;
361 UCHAR Reserved1[8];
364 struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST {
365 struct _URB_HEADER Hdr;
366 PVOID Reserved;
367 ULONG Reserved0;
368 ULONG TransferBufferLength;
369 PVOID TransferBuffer;
370 PMDL TransferBufferMDL;
371 struct _URB *UrbLink;
372 struct _URB_HCD_AREA hca;
373 UCHAR Recipient:5;
374 UCHAR Reserved1:3;
375 UCHAR Reserved2;
376 UCHAR InterfaceNumber;
377 UCHAR MS_PageIndex;
378 USHORT MS_FeatureDescriptorIndex;
379 USHORT Reserved3;
382 typedef struct _URB {
383 union {
384 struct _URB_HEADER UrbHeader;
385 struct _URB_SELECT_INTERFACE UrbSelectInterface;
386 struct _URB_SELECT_CONFIGURATION UrbSelectConfiguration;
387 struct _URB_PIPE_REQUEST UrbPipeRequest;
388 struct _URB_FRAME_LENGTH_CONTROL UrbFrameLengthControl;
389 struct _URB_GET_FRAME_LENGTH UrbGetFrameLength;
390 struct _URB_SET_FRAME_LENGTH UrbSetFrameLength;
391 struct _URB_GET_CURRENT_FRAME_NUMBER UrbGetCurrentFrameNumber;
392 struct _URB_CONTROL_TRANSFER UrbControlTransfer;
393 struct _URB_BULK_OR_INTERRUPT_TRANSFER UrbBulkOrInterruptTransfer;
394 struct _URB_ISOCH_TRANSFER UrbIsochronousTransfer;
395 struct _URB_CONTROL_DESCRIPTOR_REQUEST UrbControlDescriptorRequest;
396 struct _URB_CONTROL_GET_STATUS_REQUEST UrbControlGetStatusRequest;
397 struct _URB_CONTROL_FEATURE_REQUEST UrbControlFeatureRequest;
398 struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST UrbControlVendorClassRequest;
399 struct _URB_CONTROL_GET_INTERFACE_REQUEST UrbControlGetInterfaceRequest;
400 struct _URB_CONTROL_GET_CONFIGURATION_REQUEST UrbControlGetConfigurationRequest;
401 struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST UrbOSFeatureDescriptorRequest;
402 } DUMMYUNIONNAME;
403 } URB;
404 typedef struct _URB *PURB;
406 #endif