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