Merge trunk HEAD (46152)
[reactos.git] / include / ddk / usbbusif.h
1 #pragma once
2
3 #ifndef USB_BUSIFFN
4 #define USB_BUSIFFN __stdcall
5 #endif
6
7 #if (NTDDI_VERSION >= NTDDI_WINXP)
8
9 typedef PVOID PUSB_DEVICE_HANDLE;
10
11 typedef NTSTATUS
12 (USB_BUSIFFN *PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB) (
13 IN PVOID,
14 IN PURB);
15
16 #define USB_HCD_CAPS_SUPPORTS_RT_THREADS 0x00000001
17
18 typedef VOID
19 (USB_BUSIFFN *PUSB_BUSIFFN_GETUSBDI_VERSION) (
20 IN PVOID,
21 OUT PUSBD_VERSION_INFORMATION OPTIONAL,
22 OUT PULONG OPTIONAL);
23
24 typedef NTSTATUS
25 (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME) (
26 IN PVOID,
27 OUT PULONG OPTIONAL);
28
29 typedef NTSTATUS
30 (USB_BUSIFFN *PUSB_BUSIFFN_ENUM_LOG_ENTRY) (
31 IN PVOID,
32 IN ULONG,
33 IN ULONG,
34 IN ULONG,
35 IN ULONG);
36
37 typedef struct _USB_BUS_INFORMATION_LEVEL_0 {
38 ULONG TotalBandwidth;
39 ULONG ConsumedBandwidth;
40 } USB_BUS_INFORMATION_LEVEL_0, *PUSB_BUS_INFORMATION_LEVEL_0;
41
42 typedef struct _USB_BUS_INFORMATION_LEVEL_1 {
43 ULONG TotalBandwidth;
44 ULONG ConsumedBandwidth;
45 ULONG ControllerNameLength;
46 WCHAR ControllerNameUnicodeString[1];
47 } USB_BUS_INFORMATION_LEVEL_1, *PUSB_BUS_INFORMATION_LEVEL_1;
48
49 typedef NTSTATUS
50 (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_INFORMATION) (
51 IN PVOID,
52 IN ULONG,
53 IN OUT PVOID,
54 OUT PULONG,
55 OUT PULONG OPTIONAL);
56
57 typedef BOOLEAN
58 (USB_BUSIFFN *PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED) (
59 IN PVOID OPTIONAL);
60
61 #define USB_BUSIF_USBDI_VERSION_0 0x0000
62 #define USB_BUSIF_USBDI_VERSION_1 0x0001
63 #define USB_BUSIF_USBDI_VERSION_2 0x0002
64 #define USB_BUSIF_USBDI_VERSION_3 0x0003
65
66 DEFINE_GUID(USB_BUS_INTERFACE_USBDI_GUID,
67 0xb1a96a13, 0x3de0, 0x4574, 0x9b, 0x1, 0xc0, 0x8f, 0xea, 0xb3, 0x18, 0xd6);
68
69 typedef struct _USB_BUS_INTERFACE_USBDI_V0 {
70 USHORT Size;
71 USHORT Version;
72 PVOID BusContext;
73 PINTERFACE_REFERENCE InterfaceReference;
74 PINTERFACE_DEREFERENCE InterfaceDereference;
75 PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion;
76 PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime;
77 PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb;
78 PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation;
79 } USB_BUS_INTERFACE_USBDI_V0, *PUSB_BUS_INTERFACE_USBDI_V0;
80
81 typedef struct _USB_BUS_INTERFACE_USBDI_V1 {
82 USHORT Size;
83 USHORT Version;
84 PVOID BusContext;
85 PINTERFACE_REFERENCE InterfaceReference;
86 PINTERFACE_DEREFERENCE InterfaceDereference;
87 PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion;
88 PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime;
89 PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb;
90 PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation;
91 PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed;
92 } USB_BUS_INTERFACE_USBDI_V1, *PUSB_BUS_INTERFACE_USBDI_V1;
93
94 typedef struct _USB_BUS_INTERFACE_USBDI_V2 {
95 USHORT Size;
96 USHORT Version;
97 PVOID BusContext;
98 PINTERFACE_REFERENCE InterfaceReference;
99 PINTERFACE_DEREFERENCE InterfaceDereference;
100 PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion;
101 PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime;
102 PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb;
103 PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation;
104 PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed;
105 PUSB_BUSIFFN_ENUM_LOG_ENTRY EnumLogEntry;
106 } USB_BUS_INTERFACE_USBDI_V2, *PUSB_BUS_INTERFACE_USBDI_V2;
107
108 #endif
109
110 #if (NTDDI_VERSION >= NTDDI_VISTA)
111
112 typedef NTSTATUS
113 (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_BUS_TIME_EX) (
114 IN PVOID OPTIONAL,
115 OUT PULONG OPTIONAL);
116
117 typedef NTSTATUS
118 (USB_BUSIFFN *PUSB_BUSIFFN_QUERY_CONTROLLER_TYPE) (
119 IN PVOID OPTIONAL,
120 OUT PULONG OPTIONAL,
121 OUT PUSHORT OPTIONAL,
122 OUT PUSHORT OPTIONAL,
123 OUT PUCHAR OPTIONAL,
124 OUT PUCHAR OPTIONAL,
125 OUT PUCHAR OPTIONAL,
126 OUT PUCHAR OPTIONAL);
127
128 typedef struct _USB_BUS_INTERFACE_USBDI_V3 {
129 USHORT Size;
130 USHORT Version;
131 PVOID BusContext;
132 PINTERFACE_REFERENCE InterfaceReference;
133 PINTERFACE_DEREFERENCE InterfaceDereference;
134 PUSB_BUSIFFN_GETUSBDI_VERSION GetUSBDIVersion;
135 PUSB_BUSIFFN_QUERY_BUS_TIME QueryBusTime;
136 PUSB_BUSIFFN_SUBMIT_ISO_OUT_URB SubmitIsoOutUrb;
137 PUSB_BUSIFFN_QUERY_BUS_INFORMATION QueryBusInformation;
138 PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED IsDeviceHighSpeed;
139 PUSB_BUSIFFN_ENUM_LOG_ENTRY EnumLogEntry;
140 PUSB_BUSIFFN_QUERY_BUS_TIME_EX QueryBusTimeEx;
141 PUSB_BUSIFFN_QUERY_CONTROLLER_TYPE QueryControllerType;
142 } USB_BUS_INTERFACE_USBDI_V3, *PUSB_BUS_INTERFACE_USBDI_V3;
143
144 DEFINE_GUID(USB_BUS_INTERFACE_USBC_CONFIGURATION_GUID,
145 0x893b6a96, 0xb7f, 0x4d4d, 0xbd, 0xb4, 0xbb, 0xd4, 0xce, 0xeb, 0xb3, 0x1c);
146
147 #define USBC_FUNCTION_FLAG_APPEND_ID 0x1
148
149 typedef struct _USBC_FUNCTION_DESCRIPTOR{
150 UCHAR FunctionNumber;
151 UCHAR NumberOfInterfaces;
152 PUSB_INTERFACE_DESCRIPTOR *InterfaceDescriptorList;
153 UNICODE_STRING HardwareId;
154 UNICODE_STRING CompatibleId;
155 UNICODE_STRING FunctionDescription;
156 ULONG FunctionFlags;
157 PVOID Reserved;
158 } USBC_FUNCTION_DESCRIPTOR, *PUSBC_FUNCTION_DESCRIPTOR;
159
160 typedef
161 NTSTATUS
162 (USB_BUSIFFN *USBC_START_DEVICE_CALLBACK)(
163 IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor,
164 IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
165 OUT PUSBC_FUNCTION_DESCRIPTOR *FunctionDescriptorBuffer,
166 OUT PULONG FunctionDescriptorBufferLength,
167 IN PDEVICE_OBJECT FdoDeviceObject,
168 IN PDEVICE_OBJECT PdoDeviceObject);
169
170 typedef
171 BOOLEAN
172 (USB_BUSIFFN *USBC_PDO_ENABLE_CALLBACK)(
173 IN PVOID Context,
174 IN USHORT FirstInterfaceNumber,
175 IN USHORT NumberOfInterfaces,
176 IN UCHAR FunctionClass,
177 IN UCHAR FunctionSubClass,
178 IN UCHAR FunctionProtocol);
179
180 #define USBC_DEVICE_CONFIGURATION_INTERFACE_VERSION_1 0x0001
181
182 typedef struct _USBC_DEVICE_CONFIGURATION_INTERFACE_V1 {
183 USHORT Size;
184 USHORT Version;
185 PVOID Context;
186 PINTERFACE_REFERENCE InterfaceReference;
187 PINTERFACE_DEREFERENCE InterfaceDereference;
188 USBC_START_DEVICE_CALLBACK StartDeviceCallback;
189 USBC_PDO_ENABLE_CALLBACK PdoEnableCallback;
190 PVOID Reserved[7];
191 } USBC_DEVICE_CONFIGURATION_INTERFACE_V1, *PUSBC_DEVICE_CONFIGURATION_INTERFACE_V1;
192
193 #endif