source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/usbuser.h@ 1167

Last change on this file since 1167 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 10.0 KB
Line 
1/**
2 * usbuser.h
3 *
4 * USB user mode IOCTL interface
5 *
6 * This file is part of the mingw-w64 runtime package.
7 * No warranty is given; refer to the file DISCLAIMER within this package.
8 *
9 * This file is based on the ReactOS PSDK file usbuser.h.
10 * Original contributed by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 */
12
13#ifndef __USBUSER_H__
14#define __USBUSER_H__
15
16#include <winapifamily.h>
17
18#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
19
20#include "usbiodef.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <pshpack1.h>
27
28#define USBUSER_VERSION 0x00000004
29
30#define IOCTL_USB_USER_REQUEST USB_CTL (HCD_USER_REQUEST)
31
32#ifndef IOCTL_USB_DIAGNOSTIC_MODE_ON
33#define IOCTL_USB_DIAGNOSTIC_MODE_ON USB_CTL (HCD_DIAGNOSTIC_MODE_ON)
34#endif
35#ifndef IOCTL_USB_DIAGNOSTIC_MODE_OFF
36#define IOCTL_USB_DIAGNOSTIC_MODE_OFF USB_CTL (HCD_DIAGNOSTIC_MODE_OFF)
37#endif
38
39#ifndef IOCTL_USB_GET_ROOT_HUB_NAME
40#define IOCTL_USB_GET_ROOT_HUB_NAME USB_CTL (HCD_GET_ROOT_HUB_NAME)
41#endif
42#ifndef IOCTL_GET_HCD_DRIVERKEY_NAME
43#define IOCTL_GET_HCD_DRIVERKEY_NAME USB_CTL (HCD_GET_DRIVERKEY_NAME)
44#endif
45
46typedef enum _USB_USER_ERROR_CODE {
47 UsbUserSuccess = 0,
48 UsbUserNotSupported,
49 UsbUserInvalidRequestCode,
50 UsbUserFeatureDisabled,
51 UsbUserInvalidHeaderParameter,
52 UsbUserInvalidParameter,
53 UsbUserMiniportError,
54 UsbUserBufferTooSmall,
55 UsbUserErrorNotMapped,
56 UsbUserDeviceNotStarted,
57 UsbUserNoDeviceConnected
58} USB_USER_ERROR_CODE;
59
60#define USBUSER_GET_CONTROLLER_INFO_0 0x00000001
61#define USBUSER_GET_CONTROLLER_DRIVER_KEY 0x00000002
62#define USBUSER_PASS_THRU 0x00000003
63#define USBUSER_GET_POWER_STATE_MAP 0x00000004
64#define USBUSER_GET_BANDWIDTH_INFORMATION 0x00000005
65#define USBUSER_GET_BUS_STATISTICS_0 0x00000006
66#define USBUSER_GET_ROOTHUB_SYMBOLIC_NAME 0x00000007
67#define USBUSER_GET_USB_DRIVER_VERSION 0x00000008
68#define USBUSER_GET_USB2_HW_VERSION 0x00000009
69#define USBUSER_USB_REFRESH_HCT_REG 0x0000000a
70
71#define USBUSER_OP_SEND_ONE_PACKET 0x10000001
72
73#define USBUSER_OP_RAW_RESET_PORT 0x20000001
74#define USBUSER_OP_OPEN_RAW_DEVICE 0x20000002
75#define USBUSER_OP_CLOSE_RAW_DEVICE 0x20000003
76#define USBUSER_OP_SEND_RAW_COMMAND 0x20000004
77#define USBUSER_SET_ROOTPORT_FEATURE 0x20000005
78#define USBUSER_CLEAR_ROOTPORT_FEATURE 0x20000006
79#define USBUSER_GET_ROOTPORT_STATUS 0x20000007
80
81#define USBUSER_INVALID_REQUEST 0xfffffff0
82
83#define USBUSER_OP_MASK_DEVONLY_API 0x10000000
84#define USBUSER_OP_MASK_HCTEST_API 0x20000000
85
86#define USB_PACKETFLAG_LOW_SPEED 0x00000001
87#define USB_PACKETFLAG_FULL_SPEED 0x00000002
88#define USB_PACKETFLAG_HIGH_SPEED 0x00000004
89#define USB_PACKETFLAG_ASYNC_IN 0x00000008
90#define USB_PACKETFLAG_ASYNC_OUT 0x00000010
91#define USB_PACKETFLAG_ISO_IN 0x00000020
92#define USB_PACKETFLAG_ISO_OUT 0x00000040
93#define USB_PACKETFLAG_SETUP 0x00000080
94#define USB_PACKETFLAG_TOGGLE0 0x00000100
95#define USB_PACKETFLAG_TOGGLE1 0x00000200
96
97typedef struct _USBUSER_REQUEST_HEADER {
98 ULONG UsbUserRequest;
99 USB_USER_ERROR_CODE UsbUserStatusCode;
100 ULONG RequestBufferLength;
101 ULONG ActualBufferLength;
102} USBUSER_REQUEST_HEADER, *PUSBUSER_REQUEST_HEADER;
103
104typedef struct _PACKET_PARAMETERS {
105 UCHAR DeviceAddress;
106 UCHAR EndpointAddress;
107 USHORT MaximumPacketSize;
108 ULONG Timeout;
109 ULONG Flags;
110 ULONG DataLength;
111 USHORT HubDeviceAddress;
112 USHORT PortTTNumber;
113 UCHAR ErrorCount;
114 UCHAR Pad[3];
115 USBD_STATUS UsbdStatusCode;
116 UCHAR Data[4];
117} PACKET_PARAMETERS, *PPACKET_PARAMETERS;
118
119typedef struct _USBUSER_SEND_ONE_PACKET {
120 USBUSER_REQUEST_HEADER Header;
121 PACKET_PARAMETERS PacketParameters;
122} USBUSER_SEND_ONE_PACKET, *PUSBUSER_SEND_ONE_PACKET;
123
124typedef struct _RAW_RESET_PORT_PARAMETERS {
125 USHORT PortNumber;
126 USHORT PortStatus;
127} RAW_RESET_PORT_PARAMETERS, *PRAW_RESET_PORT_PARAMETERS;
128
129typedef struct _USBUSER_RAW_RESET_ROOT_PORT {
130 USBUSER_REQUEST_HEADER Header;
131 RAW_RESET_PORT_PARAMETERS Parameters;
132} USBUSER_RAW_RESET_ROOT_PORT, *PUSBUSER_RAW_RESET_ROOT_PORT;
133
134typedef struct _RAW_ROOTPORT_FEATURE {
135 USHORT PortNumber;
136 USHORT PortFeature;
137 USHORT PortStatus;
138} RAW_ROOTPORT_FEATURE, *PRAW_ROOTPORT_FEATURE;
139
140typedef struct _USBUSER_ROOTPORT_FEATURE_REQUEST {
141 USBUSER_REQUEST_HEADER Header;
142 RAW_ROOTPORT_FEATURE Parameters;
143} USBUSER_ROOTPORT_FEATURE_REQUEST, *PUSBUSER_ROOTPORT_FEATURE_REQUEST;
144
145typedef struct _RAW_ROOTPORT_PARAMETERS {
146 USHORT PortNumber;
147 USHORT PortStatus;
148} RAW_ROOTPORT_PARAMETERS, *PRAW_ROOTPORT_PARAMETERS;
149
150typedef struct _USBUSER_ROOTPORT_PARAMETERS {
151 USBUSER_REQUEST_HEADER Header;
152 RAW_ROOTPORT_PARAMETERS Parameters;
153} USBUSER_ROOTPORT_PARAMETERS, *PUSBUSER_ROOTPORT_PARAMETERS;
154
155#define USB_HC_FEATURE_FLAG_PORT_POWER_SWITCHING 0x00000001
156#define USB_HC_FEATURE_FLAG_SEL_SUSPEND 0x00000002
157#define USB_HC_FEATURE_LEGACY_BIOS 0x00000004
158
159typedef struct _USB_CONTROLLER_INFO_0 {
160 ULONG PciVendorId;
161 ULONG PciDeviceId;
162 ULONG PciRevision;
163 ULONG NumberOfRootPorts;
164 USB_CONTROLLER_FLAVOR ControllerFlavor;
165 ULONG HcFeatureFlags;
166} USB_CONTROLLER_INFO_0, *PUSB_CONTROLLER_INFO_0;
167
168typedef struct _USBUSER_CONTROLLER_INFO_0 {
169 USBUSER_REQUEST_HEADER Header;
170 USB_CONTROLLER_INFO_0 Info0;
171} USBUSER_CONTROLLER_INFO_0, *PUSBUSER_CONTROLLER_INFO_0;
172
173typedef struct _USB_UNICODE_NAME {
174 ULONG Length;
175 WCHAR String[1];
176} USB_UNICODE_NAME, *PUSB_UNICODE_NAME;
177
178typedef struct _USBUSER_CONTROLLER_UNICODE_NAME {
179 USBUSER_REQUEST_HEADER Header;
180 USB_UNICODE_NAME UnicodeName;
181} USBUSER_CONTROLLER_UNICODE_NAME, *PUSBUSER_CONTROLLER_UNICODE_NAME;
182
183typedef struct _USB_PASS_THRU_PARAMETERS {
184 GUID FunctionGUID;
185 ULONG ParameterLength;
186 UCHAR Parameters[4];
187} USB_PASS_THRU_PARAMETERS, *PUSB_PASS_THRU_PARAMETERS;
188
189typedef struct _USBUSER_PASS_THRU_REQUEST {
190 USBUSER_REQUEST_HEADER Header;
191 USB_PASS_THRU_PARAMETERS PassThru;
192} USBUSER_PASS_THRU_REQUEST, *PUSBUSER_PASS_THRU_REQUEST;
193
194typedef enum _WDMUSB_POWER_STATE {
195 WdmUsbPowerNotMapped = 0,
196 WdmUsbPowerSystemUnspecified = 100,
197 WdmUsbPowerSystemWorking,
198 WdmUsbPowerSystemSleeping1,
199 WdmUsbPowerSystemSleeping2,
200 WdmUsbPowerSystemSleeping3,
201 WdmUsbPowerSystemHibernate,
202 WdmUsbPowerSystemShutdown,
203 WdmUsbPowerDeviceUnspecified = 200,
204 WdmUsbPowerDeviceD0,
205 WdmUsbPowerDeviceD1,
206 WdmUsbPowerDeviceD2,
207 WdmUsbPowerDeviceD3
208} WDMUSB_POWER_STATE;
209
210typedef struct _USB_POWER_INFO {
211 WDMUSB_POWER_STATE SystemState;
212 WDMUSB_POWER_STATE HcDevicePowerState;
213 WDMUSB_POWER_STATE HcDeviceWake;
214 WDMUSB_POWER_STATE HcSystemWake;
215 WDMUSB_POWER_STATE RhDevicePowerState;
216 WDMUSB_POWER_STATE RhDeviceWake;
217 WDMUSB_POWER_STATE RhSystemWake;
218 WDMUSB_POWER_STATE LastSystemSleepState;
219 BOOLEAN CanWakeup;
220 BOOLEAN IsPowered;
221} USB_POWER_INFO, *PUSB_POWER_INFO;
222
223typedef struct _USBUSER_POWER_INFO_REQUEST {
224 USBUSER_REQUEST_HEADER Header;
225 USB_POWER_INFO PowerInformation;
226} USBUSER_POWER_INFO_REQUEST, *PUSBUSER_POWER_INFO_REQUEST;
227
228typedef struct _USB_OPEN_RAW_DEVICE_PARAMETERS {
229 USHORT PortStatus;
230 USHORT MaxPacketEp0;
231} USB_OPEN_RAW_DEVICE_PARAMETERS, *PUSB_OPEN_RAW_DEVICE_PARAMETERS;
232
233typedef struct _USBUSER_OPEN_RAW_DEVICE {
234 USBUSER_REQUEST_HEADER Header;
235 USB_OPEN_RAW_DEVICE_PARAMETERS Parameters;
236} USBUSER_OPEN_RAW_DEVICE, *PUSBUSER_OPEN_RAW_DEVICE;
237
238typedef struct _USB_CLOSE_RAW_DEVICE_PARAMETERS {
239 ULONG xxx;
240} USB_CLOSE_RAW_DEVICE_PARAMETERS, *PUSB_CLOSE_RAW_DEVICE_PARAMETERS;
241
242typedef struct _USBUSER_CLOSE_RAW_DEVICE {
243 USBUSER_REQUEST_HEADER Header;
244 USB_CLOSE_RAW_DEVICE_PARAMETERS Parameters;
245} USBUSER_CLOSE_RAW_DEVICE, *PUSBUSER_CLOSE_RAW_DEVICE;
246
247typedef struct _USB_SEND_RAW_COMMAND_PARAMETERS {
248 UCHAR Usb_bmRequest;
249 UCHAR Usb_bRequest;
250 USHORT Usb_wVlaue;
251 USHORT Usb_wIndex;
252 USHORT Usb_wLength;
253 USHORT DeviceAddress;
254 USHORT MaximumPacketSize;
255 ULONG Timeout;
256 ULONG DataLength;
257 USBD_STATUS UsbdStatusCode;
258 UCHAR Data[4];
259} USB_SEND_RAW_COMMAND_PARAMETERS, *PUSB_SEND_RAW_COMMAND_PARAMETERS;
260
261typedef struct _USBUSER_SEND_RAW_COMMAND {
262 USBUSER_REQUEST_HEADER Header;
263 USB_SEND_RAW_COMMAND_PARAMETERS Parameters;
264} USBUSER_SEND_RAW_COMMAND, *PUSBUSER_SEND_RAW_COMMAND;
265
266typedef struct _USB_BANDWIDTH_INFO {
267 ULONG DeviceCount;
268 ULONG TotalBusBandwidth;
269 ULONG Total32secBandwidth;
270 ULONG AllocedBulkAndControl;
271 ULONG AllocedIso;
272 ULONG AllocedInterrupt_1ms;
273 ULONG AllocedInterrupt_2ms;
274 ULONG AllocedInterrupt_4ms;
275 ULONG AllocedInterrupt_8ms;
276 ULONG AllocedInterrupt_16ms;
277 ULONG AllocedInterrupt_32ms;
278} USB_BANDWIDTH_INFO, *PUSB_BANDWIDTH_INFO;
279
280typedef struct _USBUSER_BANDWIDTH_INFO_REQUEST {
281 USBUSER_REQUEST_HEADER Header;
282 USB_BANDWIDTH_INFO BandwidthInformation;
283} USBUSER_BANDWIDTH_INFO_REQUEST, *PUSBUSER_BANDWIDTH_INFO_REQUEST;
284
285typedef struct _USB_BUS_STATISTICS_0 {
286 ULONG DeviceCount;
287 LARGE_INTEGER CurrentSystemTime;
288 ULONG CurrentUsbFrame;
289 ULONG BulkBytes;
290 ULONG IsoBytes;
291 ULONG InterruptBytes;
292 ULONG ControlDataBytes;
293 ULONG PciInterruptCount;
294 ULONG HardResetCount;
295 ULONG WorkerSignalCount;
296 ULONG CommonBufferBytes;
297 ULONG WorkerIdleTimeMs;
298 BOOLEAN RootHubEnabled;
299 UCHAR RootHubDevicePowerState;
300 UCHAR Unused;
301 UCHAR NameIndex;
302} USB_BUS_STATISTICS_0, *PUSB_BUS_STATISTICS_0;
303
304typedef struct _USBUSER_BUS_STATISTICS_0_REQUEST {
305 USBUSER_REQUEST_HEADER Header;
306 USB_BUS_STATISTICS_0 BusStatistics0;
307} USBUSER_BUS_STATISTICS_0_REQUEST, *PUSBUSER_BUS_STATISTICS_0_REQUEST;
308
309typedef struct _USB_DRIVER_VERSION_PARAMETERS {
310 ULONG DriverTrackingCode;
311 ULONG USBDI_Version;
312 ULONG USBUSER_Version;
313 BOOLEAN CheckedPortDriver;
314 BOOLEAN CheckedMiniportDriver;
315 USHORT USB_Version;
316} USB_DRIVER_VERSION_PARAMETERS, *PUSB_DRIVER_VERSION_PARAMETERS;
317
318typedef struct _USBUSER_GET_DRIVER_VERSION {
319 USBUSER_REQUEST_HEADER Header;
320 USB_DRIVER_VERSION_PARAMETERS Parameters;
321} USBUSER_GET_DRIVER_VERSION, *PUSBUSER_GET_DRIVER_VERSION;
322
323typedef struct _USB_USB2HW_VERSION_PARAMETERS {
324 UCHAR Usb2HwRevision;
325} USB_USB2HW_VERSION_PARAMETERS, *PUSB_USB2HW_VERSION_PARAMETERS;
326
327typedef struct _USBUSER_GET_USB2HW_VERSION {
328 USBUSER_REQUEST_HEADER Header;
329 USB_USB2HW_VERSION_PARAMETERS Parameters;
330} USBUSER_GET_USB2HW_VERSION, *PUSBUSER_GET_USB2HW_VERSION;
331
332typedef struct _USBUSER_REFRESH_HCT_REG {
333 USBUSER_REQUEST_HEADER Header;
334 ULONG Flags;
335} USBUSER_REFRESH_HCT_REG, *PUSBUSER_REFRESH_HCT_REG;
336
337#include <poppack.h>
338
339#ifdef __cplusplus
340}
341#endif
342
343#endif
344
345#endif
Note: See TracBrowser for help on using the repository browser.