source: Daodan/MinGW/include/ddk/usbioctl.h@ 1047

Last change on this file since 1047 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 10.4 KB
Line 
1/*
2 * usbioctl.h
3 *
4 * USB IOCTL interface.
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23#ifndef __USBIOCTL_H
24#define __USBIOCTL_H
25
26#if __GNUC__ >=3
27#pragma GCC system_header
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include "ntddk.h"
35#include "usb100.h"
36#include "usbiodef.h"
37
38#define USBD_PORT_ENABLED 1
39#define USBD_PORT_CONNECTED 2
40
41#define IOCTL_INTERNAL_USB_CYCLE_PORT \
42 CTL_CODE(FILE_DEVICE_USB, USB_CYCLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
43
44#define IOCTL_INTERNAL_USB_ENABLE_PORT \
45 CTL_CODE(FILE_DEVICE_USB, USB_ENABLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
46
47#define IOCTL_INTERNAL_USB_GET_BUS_INFO \
48 CTL_CODE(FILE_DEVICE_USB, USB_GET_BUS_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
49
50#define IOCTL_INTERNAL_USB_GET_BUSGUID_INFO \
51 CTL_CODE(FILE_DEVICE_USB, USB_GET_BUSGUID_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
52
53#define IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME \
54 CTL_CODE(FILE_DEVICE_USB, USB_GET_CONTROLLER_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
55
56#define IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE \
57 CTL_CODE(FILE_DEVICE_USB, USB_GET_DEVICE_HANDLE, METHOD_NEITHER, FILE_ANY_ACCESS)
58
59#define IOCTL_INTERNAL_USB_GET_HUB_COUNT \
60 CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_COUNT, METHOD_NEITHER, FILE_ANY_ACCESS)
61
62#define IOCTL_INTERNAL_USB_GET_HUB_NAME \
63 CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
64
65#define IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO \
66 CTL_CODE(FILE_DEVICE_USB, USB_GET_PARENT_HUB_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
67
68#define IOCTL_INTERNAL_USB_GET_PORT_STATUS \
69 CTL_CODE(FILE_DEVICE_USB, USB_GET_PORT_STATUS, METHOD_NEITHER, FILE_ANY_ACCESS)
70
71#define IOCTL_INTERNAL_USB_RESET_PORT \
72 CTL_CODE(FILE_DEVICE_USB, USB_RESET_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
73
74#define IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO \
75 CTL_CODE(FILE_DEVICE_USB, USB_GET_ROOTHUB_PDO, METHOD_NEITHER, FILE_ANY_ACCESS)
76
77#define IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION \
78 CTL_CODE(FILE_DEVICE_USB, USB_IDLE_NOTIFICATION, METHOD_NEITHER, FILE_ANY_ACCESS)
79
80#define IOCTL_INTERNAL_USB_SUBMIT_URB \
81 CTL_CODE(FILE_DEVICE_USB, USB_SUBMIT_URB, METHOD_NEITHER, FILE_ANY_ACCESS)
82
83
84#define IOCTL_USB_DIAG_IGNORE_HUBS_ON \
85 CTL_CODE(FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_ON, METHOD_BUFFERED, FILE_ANY_ACCESS)
86
87#define IOCTL_USB_DIAG_IGNORE_HUBS_OFF \
88 CTL_CODE(FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS)
89
90#define IOCTL_USB_DIAGNOSTIC_MODE_OFF \
91 CTL_CODE(FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS)
92
93#define IOCTL_USB_DIAGNOSTIC_MODE_ON \
94 CTL_CODE(FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_ON, METHOD_BUFFERED, FILE_ANY_ACCESS)
95
96#define IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION \
97 CTL_CODE(FILE_DEVICE_USB, USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, METHOD_BUFFERED, FILE_ANY_ACCESS)
98
99#define IOCTL_USB_GET_HUB_CAPABILITIES \
100 CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES, METHOD_BUFFERED, FILE_ANY_ACCESS)
101
102#define IOCTL_USB_GET_ROOT_HUB_NAME \
103 CTL_CODE(FILE_DEVICE_USB, HCD_GET_ROOT_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
104
105#define IOCTL_GET_HCD_DRIVERKEY_NAME \
106 CTL_CODE(FILE_DEVICE_USB, HCD_GET_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
107
108#define IOCTL_USB_GET_NODE_INFORMATION \
109 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS)
110
111#define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION \
112 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS)
113
114#define IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES \
115 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_ATTRIBUTES, METHOD_BUFFERED, FILE_ANY_ACCESS)
116
117#define IOCTL_USB_GET_NODE_CONNECTION_NAME \
118 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
119
120#define IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME \
121 CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
122
123#define IOCTL_USB_HCD_DISABLE_PORT \
124 CTL_CODE(FILE_DEVICE_USB, HCD_DISABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
125
126#define IOCTL_USB_HCD_ENABLE_PORT \
127 CTL_CODE(FILE_DEVICE_USB, HCD_ENABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
128
129#define IOCTL_USB_HCD_GET_STATS_1 \
130 CTL_CODE(FILE_DEVICE_USB, HCD_GET_STATS_1, METHOD_BUFFERED, FILE_ANY_ACCESS)
131
132#define IOCTL_USB_HCD_GET_STATS_2 \
133 CTL_CODE(FILE_DEVICE_USB, HCD_GET_STATS_2, METHOD_BUFFERED, FILE_ANY_ACCESS)
134
135
136typedef struct _USB_HUB_CAPABILITIES {
137 ULONG HubIs2xCapable : 1;
138} USB_HUB_CAPABILITIES, *PUSB_HUB_CAPABILITIES;
139
140typedef enum _USB_CONNECTION_STATUS {
141 NoDeviceConnected,
142 DeviceConnected,
143 DeviceFailedEnumeration,
144 DeviceGeneralFailure,
145 DeviceCausedOvercurrent,
146 DeviceNotEnoughPower,
147 DeviceNotEnoughBandwidth,
148 DeviceHubNestedTooDeeply,
149 DeviceInLegacyHub
150} USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS;
151
152#include <pshpack1.h>
153
154typedef struct _USB_DESCRIPTOR_REQUEST {
155 ULONG ConnectionIndex;
156 struct {
157 UCHAR bmRequest;
158 UCHAR bRequest;
159 USHORT wValue;
160 USHORT wIndex;
161 USHORT wLength;
162 } SetupPacket;
163 UCHAR Data[0];
164} USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST;
165
166typedef struct _USB_HCD_DRIVERKEY_NAME {
167 ULONG ActualLength;
168 WCHAR DriverKeyName[1];
169} USB_HCD_DRIVERKEY_NAME, *PUSB_HCD_DRIVERKEY_NAME;
170
171typedef struct _HCD_ISO_STAT_COUNTERS {
172 USHORT LateUrbs;
173 USHORT DoubleBufferedPackets;
174 USHORT TransfersCF_5ms;
175 USHORT TransfersCF_2ms;
176 USHORT TransfersCF_1ms;
177 USHORT MaxInterruptLatency;
178 USHORT BadStartFrame;
179 USHORT StaleUrbs;
180 USHORT IsoPacketNotAccesed;
181 USHORT IsoPacketHWError;
182 USHORT SmallestUrbPacketCount;
183 USHORT LargestUrbPacketCount;
184 USHORT IsoCRC_Error;
185 USHORT IsoOVERRUN_Error;
186 USHORT IsoINTERNAL_Error;
187 USHORT IsoUNKNOWN_Error;
188 ULONG IsoBytesTransferred;
189 USHORT LateMissedCount;
190 USHORT HWIsoMissedCount;
191 ULONG Reserved7[8];
192} HCD_ISO_STAT_COUNTERS, *PHCD_ISO_STAT_COUNTERS;
193
194typedef struct _HCD_STAT_COUNTERS {
195 ULONG BytesTransferred;
196 USHORT IsoMissedCount;
197 USHORT DataOverrunErrorCount;
198 USHORT CrcErrorCount;
199 USHORT ScheduleOverrunCount;
200 USHORT TimeoutErrorCount;
201 USHORT InternalHcErrorCount;
202 USHORT BufferOverrunErrorCount;
203 USHORT SWErrorCount;
204 USHORT StallPidCount;
205 USHORT PortDisableCount;
206} HCD_STAT_COUNTERS, *PHCD_STAT_COUNTERS;
207
208typedef struct _HCD_STAT_INFORMATION_1 {
209 ULONG Reserved1;
210 ULONG Reserved2;
211 ULONG ResetCounters;
212 LARGE_INTEGER TimeRead;
213 HCD_STAT_COUNTERS Counters;
214} HCD_STAT_INFORMATION_1, *PHCD_STAT_INFORMATION_1;
215
216typedef struct _HCD_STAT_INFORMATION_2 {
217 ULONG Reserved1;
218 ULONG Reserved2;
219 ULONG ResetCounters;
220 LARGE_INTEGER TimeRead;
221 LONG LockedMemoryUsed;
222 HCD_STAT_COUNTERS Counters;
223 HCD_ISO_STAT_COUNTERS IsoCounters;
224} HCD_STAT_INFORMATION_2, *PHCD_STAT_INFORMATION_2;
225
226typedef struct _USB_HUB_INFORMATION {
227 USB_HUB_DESCRIPTOR HubDescriptor;
228 BOOLEAN HubIsBusPowered;
229} USB_HUB_INFORMATION, *PUSB_HUB_INFORMATION;
230
231typedef struct _USB_HUB_NAME {
232 ULONG ActualLength;
233 WCHAR HubName[1];
234} USB_HUB_NAME, *PUSB_HUB_NAME;
235
236typedef enum _USB_HUB_NODE {
237 UsbHub,
238 UsbMIParent
239} USB_HUB_NODE;
240
241typedef VOID STDCALL
242(*USB_IDLE_CALLBACK)(
243 PVOID Context);
244
245typedef struct _USB_IDLE_CALLBACK_INFO {
246 USB_IDLE_CALLBACK IdleCallback;
247 PVOID IdleContext;
248} USB_IDLE_CALLBACK_INFO, *PUSB_IDLE_CALLBACK_INFO;
249
250typedef struct _USB_NODE_CONNECTION_ATTRIBUTES {
251 ULONG ConnectionIndex;
252 USB_CONNECTION_STATUS ConnectionStatus;
253 ULONG PortAttributes;
254} USB_NODE_CONNECTION_ATTRIBUTES, *PUSB_NODE_CONNECTION_ATTRIBUTES;
255
256typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME {
257 ULONG ConnectionIndex;
258 ULONG ActualLength;
259 WCHAR DriverKeyName[1];
260} USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME;
261
262typedef struct _USB_PIPE_INFO {
263 USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
264 ULONG ScheduleOffset;
265} USB_PIPE_INFO, *PUSB_PIPE_INFO;
266
267typedef struct _USB_NODE_CONNECTION_INFORMATION {
268 ULONG ConnectionIndex;
269 USB_DEVICE_DESCRIPTOR DeviceDescriptor;
270 UCHAR CurrentConfigurationValue;
271 BOOLEAN LowSpeed;
272 BOOLEAN DeviceIsHub;
273 USHORT DeviceAddress;
274 ULONG NumberOfOpenPipes;
275 USB_CONNECTION_STATUS ConnectionStatus;
276 USB_PIPE_INFO PipeList[0];
277} USB_NODE_CONNECTION_INFORMATION, *PUSB_NODE_CONNECTION_INFORMATION;
278
279typedef struct _USB_NODE_CONNECTION_NAME {
280 ULONG ConnectionIndex;
281 ULONG ActualLength;
282 WCHAR NodeName[1];
283} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;
284
285typedef struct _USB_MI_PARENT_INFORMATION {
286 ULONG NumberOfInterfaces;
287} USB_MI_PARENT_INFORMATION, *PUSB_MI_PARENT_INFORMATION;
288
289typedef struct _USB_NODE_INFORMATION {
290 USB_HUB_NODE NodeType;
291 union {
292 USB_HUB_INFORMATION HubInformation;
293 USB_MI_PARENT_INFORMATION MiParentInformation;
294 } u;
295} USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION;
296
297#define WMI_USB_DRIVER_INFORMATION 0
298#define WMI_USB_DRIVER_NOTIFICATION 1
299#define WMI_USB_POWER_DEVICE_ENABLE 2
300
301typedef enum _USB_NOTIFICATION_TYPE {
302 EnumerationFailure = 0,
303 InsufficentBandwidth,
304 InsufficentPower,
305 OverCurrent,
306 ResetOvercurrent,
307 AcquireBusInfo,
308 AcquireHubName,
309 AcquireControllerName,
310 HubOvercurrent,
311 HubPowerChange,
312 HubNestedTooDeeply,
313 ModernDeviceInLegacyHub
314} USB_NOTIFICATION_TYPE;
315
316typedef struct _USB_ACQUIRE_INFO {
317 USB_NOTIFICATION_TYPE NotificationType;
318 ULONG TotalSize;
319 WCHAR Buffer[1];
320} USB_ACQUIRE_INFO, *PUSB_ACQUIRE_INFO;
321
322typedef struct _USB_NOTIFICATION {
323 USB_NOTIFICATION_TYPE NotificationType;
324} USB_NOTIFICATION, *PUSB_NOTIFICATION;
325
326typedef struct _USB_BUS_NOTIFICATION {
327 USB_NOTIFICATION_TYPE NotificationType;
328 ULONG TotalBandwidth;
329 ULONG ConsumedBandwidth;
330 ULONG ControllerNameLength;
331} USB_BUS_NOTIFICATION, *PUSB_BUS_NOTIFICATION;
332
333typedef struct _USB_CONNECTION_NOTIFICATION {
334 USB_NOTIFICATION_TYPE NotificationType;
335 ULONG ConnectionNumber;
336 ULONG RequestedBandwidth;
337 ULONG EnumerationFailReason;
338 ULONG PowerRequested;
339 ULONG HubNameLength;
340} USB_CONNECTION_NOTIFICATION, *PUSB_CONNECTION_NOTIFICATION;
341
342typedef struct _USB_ROOT_HUB_NAME {
343 ULONG ActualLength;
344 WCHAR RootHubName[1];
345} USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME;
346
347#include <poppack.h>
348
349#ifdef __cplusplus
350}
351#endif
352
353#endif /* __USBIOCTL_H */
Note: See TracBrowser for help on using the repository browser.