1 | /*
|
---|
2 | * Copyright (C) the Wine project
|
---|
3 | *
|
---|
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.
|
---|
8 | *
|
---|
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.
|
---|
13 | *
|
---|
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
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef __DDK_USB_H__
|
---|
29 | #define __DDK_USB_H__
|
---|
30 |
|
---|
31 | #include <ddk/usb200.h>
|
---|
32 |
|
---|
33 | #define URB_FUNCTION_SELECT_CONFIGURATION 0x0000
|
---|
34 | #define URB_FUNCTION_SELECT_INTERFACE 0x0001
|
---|
35 | #define URB_FUNCTION_ABORT_PIPE 0x0002
|
---|
36 | #define URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL 0x0003
|
---|
37 | #define URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL 0x0004
|
---|
38 | #define URB_FUNCTION_GET_FRAME_LENGTH 0x0005
|
---|
39 | #define URB_FUNCTION_SET_FRAME_LENGTH 0x0006
|
---|
40 | #define URB_FUNCTION_GET_CURRENT_FRAME_NUMBER 0x0007
|
---|
41 | #define URB_FUNCTION_CONTROL_TRANSFER 0x0008
|
---|
42 | #define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER 0x0009
|
---|
43 | #define URB_FUNCTION_ISOCH_TRANSFER 0x000A
|
---|
44 | #define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE 0x000B
|
---|
45 | #define URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE 0x000C
|
---|
46 | #define URB_FUNCTION_SET_FEATURE_TO_DEVICE 0x000D
|
---|
47 | #define URB_FUNCTION_SET_FEATURE_TO_INTERFACE 0x000E
|
---|
48 | #define URB_FUNCTION_SET_FEATURE_TO_ENDPOINT 0x000F
|
---|
49 | #define URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE 0x0010
|
---|
50 | #define URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE 0x0011
|
---|
51 | #define URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT 0x0012
|
---|
52 | #define URB_FUNCTION_GET_STATUS_FROM_DEVICE 0x0013
|
---|
53 | #define URB_FUNCTION_GET_STATUS_FROM_INTERFACE 0x0014
|
---|
54 | #define URB_FUNCTION_GET_STATUS_FROM_ENDPOINT 0x0015
|
---|
55 | #define URB_FUNCTION_RESERVED_0X0016 0x0016
|
---|
56 | #define URB_FUNCTION_VENDOR_DEVICE 0x0017
|
---|
57 | #define URB_FUNCTION_VENDOR_INTERFACE 0x0018
|
---|
58 | #define URB_FUNCTION_VENDOR_ENDPOINT 0x0019
|
---|
59 | #define URB_FUNCTION_CLASS_DEVICE 0x001A
|
---|
60 | #define URB_FUNCTION_CLASS_INTERFACE 0x001B
|
---|
61 | #define URB_FUNCTION_CLASS_ENDPOINT 0x001C
|
---|
62 | #define URB_FUNCTION_RESERVE_0X001D 0x001D
|
---|
63 | #define URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL 0x001E
|
---|
64 | #define URB_FUNCTION_CLASS_OTHER 0x001F
|
---|
65 | #define URB_FUNCTION_VENDOR_OTHER 0x0020
|
---|
66 | #define URB_FUNCTION_GET_STATUS_FROM_OTHER 0x0021
|
---|
67 | #define URB_FUNCTION_CLEAR_FEATURE_TO_OTHER 0x0022
|
---|
68 | #define URB_FUNCTION_SET_FEATURE_TO_OTHER 0x0023
|
---|
69 | #define URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT 0x0024
|
---|
70 | #define URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT 0x0025
|
---|
71 | #define URB_FUNCTION_GET_CONFIGURATION 0x0026
|
---|
72 | #define URB_FUNCTION_GET_INTERFACE 0x0027
|
---|
73 | #define URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE 0x0028
|
---|
74 | #define URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE 0x0029
|
---|
75 | #define URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR 0x002A
|
---|
76 | #define URB_FUNCTION_RESERVE_0X002B 0x002B
|
---|
77 | #define URB_FUNCTION_RESERVE_0X002C 0x002C
|
---|
78 | #define URB_FUNCTION_RESERVE_0X002D 0x002D
|
---|
79 | #define URB_FUNCTION_RESERVE_0X002E 0x002E
|
---|
80 | #define URB_FUNCTION_RESERVE_0X002F 0x002F
|
---|
81 | #define URB_FUNCTION_SYNC_RESET_PIPE 0x0030
|
---|
82 | #define URB_FUNCTION_SYNC_CLEAR_STALL 0x0031
|
---|
83 |
|
---|
84 | #define USBD_SHORT_TRANSFER_OK 0x00000002
|
---|
85 | #define USBD_TRANSFER_DIRECTION_OUT 0
|
---|
86 | #define USBD_TRANSFER_DIRECTION_IN 1
|
---|
87 |
|
---|
88 | typedef LONG USBD_STATUS;
|
---|
89 |
|
---|
90 | typedef PVOID USBD_PIPE_HANDLE;
|
---|
91 | typedef PVOID USBD_CONFIGURATION_HANDLE;
|
---|
92 | typedef PVOID USBD_INTERFACE_HANDLE;
|
---|
93 |
|
---|
94 | typedef enum _USBD_PIPE_TYPE {
|
---|
95 | UsbdPipeTypeControl,
|
---|
96 | UsbdPipeTypeIsochronous,
|
---|
97 | UsbdPipeTypeBulk,
|
---|
98 | UsbdPipeTypeInterrupt
|
---|
99 | } USBD_PIPE_TYPE;
|
---|
100 |
|
---|
101 | typedef struct _USBD_PIPE_INFORMATION {
|
---|
102 | USHORT MaximumPacketSize;
|
---|
103 | UCHAR EndpointAddress;
|
---|
104 | UCHAR Interval;
|
---|
105 | USBD_PIPE_TYPE PipeType;
|
---|
106 | USBD_PIPE_HANDLE PipeHandle;
|
---|
107 | ULONG MaximumTransferSize;
|
---|
108 | ULONG PipeFlags;
|
---|
109 | } USBD_PIPE_INFORMATION;
|
---|
110 | typedef struct _USBD_PIPE_INFORMATION *PUSBD_PIPE_INFORMATION;
|
---|
111 |
|
---|
112 | typedef struct _USBD_INTERFACE_INFORMATION {
|
---|
113 | USHORT Length;
|
---|
114 | UCHAR InterfaceNumber;
|
---|
115 | UCHAR AlternateSetting;
|
---|
116 | UCHAR Class;
|
---|
117 | UCHAR SubClass;
|
---|
118 | UCHAR Protocol;
|
---|
119 | UCHAR Reserved;
|
---|
120 | USBD_INTERFACE_HANDLE InterfaceHandle;
|
---|
121 | ULONG NumberOfPipes;
|
---|
122 | USBD_PIPE_INFORMATION Pipes[1];
|
---|
123 | } USBD_INTERFACE_INFORMATION;
|
---|
124 | typedef struct _USBD_INTERFACE_INFORMATION *PUSBD_INTERFACE_INFORMATION;
|
---|
125 |
|
---|
126 | typedef struct _USBD_ISO_PACKET_DESCRIPTOR {
|
---|
127 | ULONG Offset;
|
---|
128 | ULONG Length;
|
---|
129 | USBD_STATUS Status;
|
---|
130 | } USBD_ISO_PACKET_DESCRIPTOR;
|
---|
131 | typedef struct _USBD_ISO_PACKET_DESCRIPTOR *PUSBD_ISO_PACKET_DESCRIPTOR;
|
---|
132 |
|
---|
133 | struct _URB_HCD_AREA {
|
---|
134 | PVOID Reserved8[8];
|
---|
135 | };
|
---|
136 |
|
---|
137 | struct _URB_HEADER {
|
---|
138 | USHORT Length;
|
---|
139 | USHORT Function;
|
---|
140 | USBD_STATUS Status;
|
---|
141 | PVOID UsbdDeviceHandle;
|
---|
142 | ULONG UsbdFlags;
|
---|
143 | };
|
---|
144 |
|
---|
145 | struct _URB_SELECT_INTERFACE {
|
---|
146 | struct _URB_HEADER Hdr;
|
---|
147 | USBD_CONFIGURATION_HANDLE ConfigurationHandle;
|
---|
148 | USBD_INTERFACE_INFORMATION Interface;
|
---|
149 | };
|
---|
150 |
|
---|
151 | struct _URB_SELECT_CONFIGURATION {
|
---|
152 | struct _URB_HEADER Hdr;
|
---|
153 | PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
|
---|
154 | USBD_CONFIGURATION_HANDLE ConfigurationHandle;
|
---|
155 | USBD_INTERFACE_INFORMATION Interface;
|
---|
156 | };
|
---|
157 |
|
---|
158 | struct _URB_PIPE_REQUEST {
|
---|
159 | struct _URB_HEADER Hdr;
|
---|
160 | USBD_PIPE_HANDLE PipeHandle;
|
---|
161 | ULONG Reserved;
|
---|
162 | };
|
---|
163 |
|
---|
164 | struct _URB_FRAME_LENGTH_CONTROL {
|
---|
165 | struct _URB_HEADER Hdr;
|
---|
166 | };
|
---|
167 |
|
---|
168 | struct _URB_GET_FRAME_LENGTH {
|
---|
169 | struct _URB_HEADER Hdr;
|
---|
170 | ULONG FrameLength;
|
---|
171 | ULONG FrameNumber;
|
---|
172 | };
|
---|
173 |
|
---|
174 | struct _URB_SET_FRAME_LENGTH {
|
---|
175 | struct _URB_HEADER Hdr;
|
---|
176 | LONG FrameLengthDelta;
|
---|
177 | };
|
---|
178 |
|
---|
179 | struct _URB_GET_CURRENT_FRAME_NUMBER {
|
---|
180 | struct _URB_HEADER Hdr;
|
---|
181 | ULONG FrameNumber;
|
---|
182 | };
|
---|
183 |
|
---|
184 | struct _URB_CONTROL_TRANSFER {
|
---|
185 | struct _URB_HEADER Hdr;
|
---|
186 | USBD_PIPE_HANDLE PipeHandle;
|
---|
187 | ULONG TransferFlags;
|
---|
188 | ULONG TransferBufferLength;
|
---|
189 | PVOID TransferBuffer;
|
---|
190 | PMDL TransferBufferMDL;
|
---|
191 | struct _URB *UrbLink;
|
---|
192 | struct _URB_HCD_AREA hca;
|
---|
193 | UCHAR SetupPacket[8];
|
---|
194 | };
|
---|
195 |
|
---|
196 | struct _URB_BULK_OR_INTERRUPT_TRANSFER {
|
---|
197 | struct _URB_HEADER Hdr;
|
---|
198 | USBD_PIPE_HANDLE PipeHandle;
|
---|
199 | ULONG TransferFlags;
|
---|
200 | ULONG TransferBufferLength;
|
---|
201 | PVOID TransferBuffer;
|
---|
202 | PMDL TransferBufferMDL;
|
---|
203 | struct _URB *UrbLink;
|
---|
204 | struct _URB_HCD_AREA hca;
|
---|
205 | };
|
---|
206 |
|
---|
207 | struct _URB_ISOCH_TRANSFER {
|
---|
208 | struct _URB_HEADER Hdr;
|
---|
209 | USBD_PIPE_HANDLE PipeHandle;
|
---|
210 | ULONG TransferFlags;
|
---|
211 | ULONG TransferBufferLength;
|
---|
212 | PVOID TransferBuffer;
|
---|
213 | PMDL TransferBufferMDL;
|
---|
214 | struct _URB *UrbLink;
|
---|
215 | struct _URB_HCD_AREA hca;
|
---|
216 | ULONG StartFrame;
|
---|
217 | ULONG NumberOfPackets;
|
---|
218 | ULONG ErrorCount;
|
---|
219 | USBD_ISO_PACKET_DESCRIPTOR IsoPacket[1];
|
---|
220 | };
|
---|
221 |
|
---|
222 | struct _URB_CONTROL_DESCRIPTOR_REQUEST {
|
---|
223 | struct _URB_HEADER Hdr;
|
---|
224 | PVOID Reserved;
|
---|
225 | ULONG Reserved0;
|
---|
226 | ULONG TransferBufferLength;
|
---|
227 | PVOID TransferBuffer;
|
---|
228 | PMDL TransferBufferMDL;
|
---|
229 | struct _URB *UrbLink;
|
---|
230 | struct _URB_HCD_AREA hca;
|
---|
231 | USHORT Reserved1;
|
---|
232 | UCHAR Index;
|
---|
233 | UCHAR DescriptorType;
|
---|
234 | USHORT LanguageId;
|
---|
235 | USHORT Reserved2;
|
---|
236 | };
|
---|
237 |
|
---|
238 | struct _URB_CONTROL_GET_STATUS_REQUEST {
|
---|
239 | struct _URB_HEADER Hdr;
|
---|
240 | PVOID Reserved;
|
---|
241 | ULONG Reserved0;
|
---|
242 | ULONG TransferBufferLength;
|
---|
243 | PVOID TransferBuffer;
|
---|
244 | PMDL TransferBufferMDL;
|
---|
245 | struct _URB *UrbLink;
|
---|
246 | struct _URB_HCD_AREA hca;
|
---|
247 | UCHAR Reserved1[4];
|
---|
248 | USHORT Index;
|
---|
249 | USHORT Reserved2;
|
---|
250 | };
|
---|
251 |
|
---|
252 | struct _URB_CONTROL_FEATURE_REQUEST {
|
---|
253 | struct _URB_HEADER Hdr;
|
---|
254 | PVOID Reserved;
|
---|
255 | ULONG Reserved2;
|
---|
256 | ULONG Reserved3;
|
---|
257 | PVOID Reserved4;
|
---|
258 | PMDL Reserved5;
|
---|
259 | struct _URB *UrbLink;
|
---|
260 | struct _URB_HCD_AREA hca;
|
---|
261 | USHORT Reserved0;
|
---|
262 | USHORT FeatureSelector;
|
---|
263 | USHORT Index;
|
---|
264 | USHORT Reserved1;
|
---|
265 | };
|
---|
266 |
|
---|
267 | struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST {
|
---|
268 | struct _URB_HEADER Hdr;
|
---|
269 | PVOID Reserved;
|
---|
270 | ULONG TransferFlags;
|
---|
271 | ULONG TransferBufferLength;
|
---|
272 | PVOID TransferBuffer;
|
---|
273 | PMDL TransferBufferMDL;
|
---|
274 | struct _URB *UrbLink;
|
---|
275 | struct _URB_HCD_AREA hca;
|
---|
276 | UCHAR RequestTypeReservedBits;
|
---|
277 | UCHAR Request;
|
---|
278 | USHORT Value;
|
---|
279 | USHORT Index;
|
---|
280 | USHORT Reserved1;
|
---|
281 | };
|
---|
282 |
|
---|
283 | struct _URB_CONTROL_GET_INTERFACE_REQUEST {
|
---|
284 | struct _URB_HEADER Hdr;
|
---|
285 | PVOID Reserved;
|
---|
286 | ULONG Reserved0;
|
---|
287 | ULONG TransferBufferLength;
|
---|
288 | PVOID TransferBuffer;
|
---|
289 | PMDL TransferBufferMDL;
|
---|
290 | struct _URB *UrbLink;
|
---|
291 | struct _URB_HCD_AREA hca;
|
---|
292 | UCHAR Reserved1[4];
|
---|
293 | USHORT Interface;
|
---|
294 | USHORT Reserved2;
|
---|
295 | };
|
---|
296 |
|
---|
297 | struct _URB_CONTROL_GET_CONFIGURATION_REQUEST {
|
---|
298 | struct _URB_HEADER Hdr;
|
---|
299 | PVOID Reserved;
|
---|
300 | ULONG Reserved0;
|
---|
301 | ULONG TransferBufferLength;
|
---|
302 | PVOID TransferBuffer;
|
---|
303 | PMDL TransferBufferMDL;
|
---|
304 | struct _URB *UrbLink;
|
---|
305 | struct _URB_HCD_AREA hca;
|
---|
306 | UCHAR Reserved1[8];
|
---|
307 | };
|
---|
308 |
|
---|
309 | struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST {
|
---|
310 | struct _URB_HEADER Hdr;
|
---|
311 | PVOID Reserved;
|
---|
312 | ULONG Reserved0;
|
---|
313 | ULONG TransferBufferLength;
|
---|
314 | PVOID TransferBuffer;
|
---|
315 | PMDL TransferBufferMDL;
|
---|
316 | struct _URB *UrbLink;
|
---|
317 | struct _URB_HCD_AREA hca;
|
---|
318 | UCHAR Recipient:5;
|
---|
319 | UCHAR Reserved1:3;
|
---|
320 | UCHAR Reserved2;
|
---|
321 | UCHAR InterfaceNumber;
|
---|
322 | UCHAR MS_PageIndex;
|
---|
323 | USHORT MS_FeatureDescriptorIndex;
|
---|
324 | USHORT Reserved3;
|
---|
325 | };
|
---|
326 |
|
---|
327 | typedef struct _URB {
|
---|
328 | union {
|
---|
329 | struct _URB_HEADER UrbHeader;
|
---|
330 | struct _URB_SELECT_INTERFACE UrbSelectInterface;
|
---|
331 | struct _URB_SELECT_CONFIGURATION UrbSelectConfiguration;
|
---|
332 | struct _URB_PIPE_REQUEST UrbPipeRequest;
|
---|
333 | struct _URB_FRAME_LENGTH_CONTROL UrbFrameLengthControl;
|
---|
334 | struct _URB_GET_FRAME_LENGTH UrbGetFrameLength;
|
---|
335 | struct _URB_SET_FRAME_LENGTH UrbSetFrameLength;
|
---|
336 | struct _URB_GET_CURRENT_FRAME_NUMBER UrbGetCurrentFrameNumber;
|
---|
337 | struct _URB_CONTROL_TRANSFER UrbControlTransfer;
|
---|
338 | struct _URB_BULK_OR_INTERRUPT_TRANSFER UrbBulkOrInterruptTransfer;
|
---|
339 | struct _URB_ISOCH_TRANSFER UrbIsochronousTransfer;
|
---|
340 | struct _URB_CONTROL_DESCRIPTOR_REQUEST UrbControlDescriptorRequest;
|
---|
341 | struct _URB_CONTROL_GET_STATUS_REQUEST UrbControlGetStatusRequest;
|
---|
342 | struct _URB_CONTROL_FEATURE_REQUEST UrbControlFeatureRequest;
|
---|
343 | struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST UrbControlVendorClassRequest;
|
---|
344 | struct _URB_CONTROL_GET_INTERFACE_REQUEST UrbControlGetInterfaceRequest;
|
---|
345 | struct _URB_CONTROL_GET_CONFIGURATION_REQUEST UrbControlGetConfigurationRequest;
|
---|
346 | struct _URB_OS_FEATURE_DESCRIPTOR_REQUEST UrbOSFeatureDescriptorRequest;
|
---|
347 | } DUMMYUNIONNAME;
|
---|
348 | } URB;
|
---|
349 | typedef struct _URB *PURB;
|
---|
350 |
|
---|
351 | #endif
|
---|