| 1 |
// Licensed under the Apache License, Version 2.0 |
| 2 |
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 3 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. |
| 4 |
// All files in the project carrying such notice may not be copied, modified, or distributed |
| 5 |
// except according to those terms. |
| 6 |
//! USB Spec Definitions. |
| 7 |
use shared::basetsd::ULONG64; |
| 8 |
use shared::guiddef::GUID; |
| 9 |
use shared::minwindef::{UCHAR, ULONG, USHORT}; |
| 10 |
use um::winnt::WCHAR; |
| 11 |
ENUM!{enum USB_DEVICE_SPEED { |
| 12 |
UsbLowSpeed = 0, |
| 13 |
UsbFullSpeed, |
| 14 |
UsbHighSpeed, |
| 15 |
UsbSuperSpeed, |
| 16 |
}} |
| 17 |
ENUM!{enum USB_DEVICE_TYPE { |
| 18 |
Usb11Device = 0, |
| 19 |
Usb20Device, |
| 20 |
}} |
| 21 |
STRUCT!{#[repr(packed)] struct BM_REQUEST_TYPE { |
| 22 |
B: UCHAR, |
| 23 |
}} |
| 24 |
BITFIELD!{BM_REQUEST_TYPE B: UCHAR [ |
| 25 |
Recipient set_Recipient[0..2], |
| 26 |
Reserved set_Reserved[2..5], |
| 27 |
Type set_Type[5..7], |
| 28 |
Dir set_Dir[7..8], |
| 29 |
]} |
| 30 |
pub type PBM_REQUEST_TYPE = *mut BM_REQUEST_TYPE; |
| 31 |
STRUCT!{#[repr(packed)] struct USB_DEFAULT_PIPE_SETUP_PACKET_wValue_s { |
| 32 |
LowByte: UCHAR, |
| 33 |
HiByte: UCHAR, |
| 34 |
}} |
| 35 |
UNION!{#[repr(packed)] union USB_DEFAULT_PIPE_SETUP_PACKET_wValue { |
| 36 |
[u16; 1], |
| 37 |
s s_mut: USB_DEFAULT_PIPE_SETUP_PACKET_wValue_s, |
| 38 |
W W_mut: USHORT, |
| 39 |
}} |
| 40 |
STRUCT!{#[repr(packed)] struct USB_DEFAULT_PIPE_SETUP_PACKET_wIndex_s { |
| 41 |
LowByte: UCHAR, |
| 42 |
HiByte: UCHAR, |
| 43 |
}} |
| 44 |
UNION!{#[repr(packed)] union USB_DEFAULT_PIPE_SETUP_PACKET_wIndex { |
| 45 |
[u16; 1], |
| 46 |
s s_mut: USB_DEFAULT_PIPE_SETUP_PACKET_wIndex_s, |
| 47 |
W W_mut: USHORT, |
| 48 |
}} |
| 49 |
STRUCT!{#[repr(packed)] struct USB_DEFAULT_PIPE_SETUP_PACKET { |
| 50 |
bmRequestType: BM_REQUEST_TYPE, |
| 51 |
bRequest: UCHAR, |
| 52 |
wValue: USB_DEFAULT_PIPE_SETUP_PACKET_wValue, |
| 53 |
wIndex: USB_DEFAULT_PIPE_SETUP_PACKET_wIndex, |
| 54 |
wLength: USHORT, |
| 55 |
}} |
| 56 |
pub type PUSB_DEFAULT_PIPE_SETUP_PACKET = *mut USB_DEFAULT_PIPE_SETUP_PACKET; |
| 57 |
pub const BMREQUEST_HOST_TO_DEVICE: UCHAR = 0; |
| 58 |
pub const BMREQUEST_DEVICE_TO_HOST: UCHAR = 1; |
| 59 |
pub const BMREQUEST_STANDARD: UCHAR = 0; |
| 60 |
pub const BMREQUEST_CLASS: UCHAR = 1; |
| 61 |
pub const BMREQUEST_VENDOR: UCHAR = 2; |
| 62 |
pub const BMREQUEST_TO_DEVICE: UCHAR = 0; |
| 63 |
pub const BMREQUEST_TO_INTERFACE: UCHAR = 1; |
| 64 |
pub const BMREQUEST_TO_ENDPOINT: UCHAR = 2; |
| 65 |
pub const BMREQUEST_TO_OTHER: UCHAR = 3; |
| 66 |
#[inline] |
| 67 |
pub fn USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d: UCHAR, i: UCHAR) -> USHORT { |
| 68 |
(d as USHORT) << 8 | (i as USHORT) |
| 69 |
} |
| 70 |
pub const USB_REQUEST_GET_STATUS: UCHAR = 0x00; |
| 71 |
pub const USB_REQUEST_CLEAR_FEATURE: UCHAR = 0x01; |
| 72 |
pub const USB_REQUEST_SET_FEATURE: UCHAR = 0x03; |
| 73 |
pub const USB_REQUEST_SET_ADDRESS: UCHAR = 0x05; |
| 74 |
pub const USB_REQUEST_GET_DESCRIPTOR: UCHAR = 0x06; |
| 75 |
pub const USB_REQUEST_SET_DESCRIPTOR: UCHAR = 0x07; |
| 76 |
pub const USB_REQUEST_GET_CONFIGURATION: UCHAR = 0x08; |
| 77 |
pub const USB_REQUEST_SET_CONFIGURATION: UCHAR = 0x09; |
| 78 |
pub const USB_REQUEST_GET_INTERFACE: UCHAR = 0x0A; |
| 79 |
pub const USB_REQUEST_SET_INTERFACE: UCHAR = 0x0B; |
| 80 |
pub const USB_REQUEST_SYNC_FRAME: UCHAR = 0x0C; |
| 81 |
pub const USB_REQUEST_SET_SEL: UCHAR = 0x30; |
| 82 |
pub const USB_REQUEST_ISOCH_DELAY: UCHAR = 0x31; |
| 83 |
pub const USB_DEVICE_DESCRIPTOR_TYPE: UCHAR = 0x01; |
| 84 |
pub const USB_CONFIGURATION_DESCRIPTOR_TYPE: UCHAR = 0x02; |
| 85 |
pub const USB_STRING_DESCRIPTOR_TYPE: UCHAR = 0x03; |
| 86 |
pub const USB_INTERFACE_DESCRIPTOR_TYPE: UCHAR = 0x04; |
| 87 |
pub const USB_ENDPOINT_DESCRIPTOR_TYPE: UCHAR = 0x05; |
| 88 |
pub const USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE: UCHAR = 0x06; |
| 89 |
pub const USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE: UCHAR = 0x07; |
| 90 |
pub const USB_INTERFACE_POWER_DESCRIPTOR_TYPE: UCHAR = 0x08; |
| 91 |
pub const USB_OTG_DESCRIPTOR_TYPE: UCHAR = 0x09; |
| 92 |
pub const USB_DEBUG_DESCRIPTOR_TYPE: UCHAR = 0x0A; |
| 93 |
pub const USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE: UCHAR = 0x0B; |
| 94 |
pub const USB_BOS_DESCRIPTOR_TYPE: UCHAR = 0x0F; |
| 95 |
pub const USB_DEVICE_CAPABILITY_DESCRIPTOR_TYPE: UCHAR = 0x10; |
| 96 |
pub const USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_TYPE: UCHAR = 0x30; |
| 97 |
pub const USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR_TYPE: UCHAR = 0x31; |
| 98 |
pub const USB_RESERVED_DESCRIPTOR_TYPE: UCHAR = 0x06; |
| 99 |
pub const USB_CONFIG_POWER_DESCRIPTOR_TYPE: UCHAR = 0x07; |
| 100 |
pub const USB_FEATURE_ENDPOINT_STALL: UCHAR = 0x00; |
| 101 |
pub const USB_FEATURE_REMOTE_WAKEUP: UCHAR = 0x01; |
| 102 |
pub const USB_FEATURE_TEST_MODE: UCHAR = 0x02; |
| 103 |
pub const USB_FEATURE_FUNCTION_SUSPEND: UCHAR = 0x00; |
| 104 |
pub const USB_FEATURE_U1_ENABLE: UCHAR = 0x30; |
| 105 |
pub const USB_FEATURE_U2_ENABLE: UCHAR = 0x31; |
| 106 |
pub const USB_FEATURE_LTM_ENABLE: UCHAR = 0x32; |
| 107 |
pub const USB_FEATURE_LDM_ENABLE: UCHAR = 0x35; |
| 108 |
pub const USB_FEATURE_BATTERY_WAKE_MASK: UCHAR = 0x28; |
| 109 |
pub const USB_FEATURE_OS_IS_PD_AWARE: UCHAR = 0x29; |
| 110 |
pub const USB_FEATURE_POLICY_MODE: UCHAR = 0x2A; |
| 111 |
pub const USB_FEATURE_CHARGING_POLICY: UCHAR = 0x36; |
| 112 |
pub const USB_CHARGING_POLICY_DEFAULT: UCHAR = 0x00; |
| 113 |
pub const USB_CHARGING_POLICY_ICCHPF: UCHAR = 0x01; |
| 114 |
pub const USB_CHARGING_POLICY_ICCLPF: UCHAR = 0x02; |
| 115 |
pub const USB_CHARGING_POLICY_NO_POWER: UCHAR = 0x03; |
| 116 |
pub const USB_STATUS_PORT_STATUS: UCHAR = 0x00; |
| 117 |
pub const USB_STATUS_PD_STATUS: UCHAR = 0x01; |
| 118 |
pub const USB_STATUS_EXT_PORT_STATUS: UCHAR = 0x02; |
| 119 |
pub const USB_GETSTATUS_SELF_POWERED: UCHAR = 0x01; |
| 120 |
pub const USB_GETSTATUS_REMOTE_WAKEUP_ENABLED: UCHAR = 0x02; |
| 121 |
pub const USB_GETSTATUS_U1_ENABLE: UCHAR = 0x04; |
| 122 |
pub const USB_GETSTATUS_U2_ENABLE: UCHAR = 0x08; |
| 123 |
pub const USB_GETSTATUS_LTM_ENABLE: UCHAR = 0x10; |
| 124 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_STATUS { |
| 125 |
AsUshort16: USHORT, |
| 126 |
}} |
| 127 |
BITFIELD!{USB_DEVICE_STATUS AsUshort16: USHORT [ |
| 128 |
SelfPowered set_SelfPowered[0..1], |
| 129 |
RemoteWakeup set_RemoteWakeup[1..2], |
| 130 |
U1Enable set_U1Enable[2..3], |
| 131 |
U2Enable set_U2Enable[3..4], |
| 132 |
LtmEnable set_LtmEnable[4..5], |
| 133 |
Reserved set_Reserved[5..16], |
| 134 |
]} |
| 135 |
pub type PUSB_DEVICE_STATUS = *mut USB_DEVICE_STATUS; |
| 136 |
STRUCT!{#[repr(packed)] struct USB_INTERFACE_STATUS { |
| 137 |
AsUshort16: USHORT, |
| 138 |
}} |
| 139 |
BITFIELD!{USB_INTERFACE_STATUS AsUshort16: USHORT [ |
| 140 |
RemoteWakeupCapable set_RemoteWakeupCapable[0..1], |
| 141 |
RemoteWakeupEnabled set_RemoteWakeupEnabled[1..2], |
| 142 |
Reserved set_Reserved[2..16], |
| 143 |
]} |
| 144 |
pub type PUSB_INTERFACE_STATUS = *mut USB_INTERFACE_STATUS; |
| 145 |
STRUCT!{#[repr(packed)] struct USB_ENDPOINT_STATUS { |
| 146 |
AsUshort16: USHORT, |
| 147 |
}} |
| 148 |
BITFIELD!{USB_ENDPOINT_STATUS AsUshort16: USHORT [ |
| 149 |
Halt set_Halt[0..1], |
| 150 |
Reserved set_Reserved[1..16], |
| 151 |
]} |
| 152 |
pub type PUSB_ENDPOINT_STATUS = *mut USB_ENDPOINT_STATUS; |
| 153 |
STRUCT!{#[repr(packed)] struct USB_COMMON_DESCRIPTOR { |
| 154 |
bLength: UCHAR, |
| 155 |
bDescriptorType: UCHAR, |
| 156 |
}} |
| 157 |
pub type PUSB_COMMON_DESCRIPTOR = *mut USB_COMMON_DESCRIPTOR; |
| 158 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_DESCRIPTOR { |
| 159 |
bLength: UCHAR, |
| 160 |
bDescriptorType: UCHAR, |
| 161 |
bcdUSB: USHORT, |
| 162 |
bDeviceClass: UCHAR, |
| 163 |
bDeviceSubClass: UCHAR, |
| 164 |
bDeviceProtocol: UCHAR, |
| 165 |
bMaxPacketSize0: UCHAR, |
| 166 |
idVendor: USHORT, |
| 167 |
idProduct: USHORT, |
| 168 |
bcdDevice: USHORT, |
| 169 |
iManufacturer: UCHAR, |
| 170 |
iProduct: UCHAR, |
| 171 |
iSerialNumber: UCHAR, |
| 172 |
bNumConfigurations: UCHAR, |
| 173 |
}} |
| 174 |
pub type PUSB_DEVICE_DESCRIPTOR = *mut USB_DEVICE_DESCRIPTOR; |
| 175 |
pub const USB_DEVICE_CLASS_RESERVED: UCHAR = 0x00; |
| 176 |
pub const USB_DEVICE_CLASS_AUDIO: UCHAR = 0x01; |
| 177 |
pub const USB_DEVICE_CLASS_COMMUNICATIONS: UCHAR = 0x02; |
| 178 |
pub const USB_DEVICE_CLASS_HUMAN_INTERFACE: UCHAR = 0x03; |
| 179 |
pub const USB_DEVICE_CLASS_MONITOR: UCHAR = 0x04; |
| 180 |
pub const USB_DEVICE_CLASS_PHYSICAL_INTERFACE: UCHAR = 0x05; |
| 181 |
pub const USB_DEVICE_CLASS_POWER: UCHAR = 0x06; |
| 182 |
pub const USB_DEVICE_CLASS_IMAGE: UCHAR = 0x06; |
| 183 |
pub const USB_DEVICE_CLASS_PRINTER: UCHAR = 0x07; |
| 184 |
pub const USB_DEVICE_CLASS_STORAGE: UCHAR = 0x08; |
| 185 |
pub const USB_DEVICE_CLASS_HUB: UCHAR = 0x09; |
| 186 |
pub const USB_DEVICE_CLASS_CDC_DATA: UCHAR = 0x0A; |
| 187 |
pub const USB_DEVICE_CLASS_SMART_CARD: UCHAR = 0x0B; |
| 188 |
pub const USB_DEVICE_CLASS_CONTENT_SECURITY: UCHAR = 0x0D; |
| 189 |
pub const USB_DEVICE_CLASS_VIDEO: UCHAR = 0x0E; |
| 190 |
pub const USB_DEVICE_CLASS_PERSONAL_HEALTHCARE: UCHAR = 0x0F; |
| 191 |
pub const USB_DEVICE_CLASS_AUDIO_VIDEO: UCHAR = 0x10; |
| 192 |
pub const USB_DEVICE_CLASS_BILLBOARD: UCHAR = 0x11; |
| 193 |
pub const USB_DEVICE_CLASS_DIAGNOSTIC_DEVICE: UCHAR = 0xDC; |
| 194 |
pub const USB_DEVICE_CLASS_WIRELESS_CONTROLLER: UCHAR = 0xE0; |
| 195 |
pub const USB_DEVICE_CLASS_MISCELLANEOUS: UCHAR = 0xEF; |
| 196 |
pub const USB_DEVICE_CLASS_APPLICATION_SPECIFIC: UCHAR = 0xFE; |
| 197 |
pub const USB_DEVICE_CLASS_VENDOR_SPECIFIC: UCHAR = 0xFF; |
| 198 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_QUALIFIER_DESCRIPTOR { |
| 199 |
bLength: UCHAR, |
| 200 |
bDescriptorType: UCHAR, |
| 201 |
bcdUSB: USHORT, |
| 202 |
bDeviceClass: UCHAR, |
| 203 |
bDeviceSubClass: UCHAR, |
| 204 |
bDeviceProtocol: UCHAR, |
| 205 |
bMaxPacketSize0: UCHAR, |
| 206 |
bNumConfigurations: UCHAR, |
| 207 |
bReserved: UCHAR, |
| 208 |
}} |
| 209 |
pub type PUSB_DEVICE_QUALIFIER_DESCRIPTOR = *mut USB_DEVICE_QUALIFIER_DESCRIPTOR; |
| 210 |
STRUCT!{#[repr(packed)] struct USB_BOS_DESCRIPTOR { |
| 211 |
bLength: UCHAR, |
| 212 |
bDescriptorType: UCHAR, |
| 213 |
wTotalLength: USHORT, |
| 214 |
bNumDeviceCaps: UCHAR, |
| 215 |
}} |
| 216 |
pub type PUSB_BOS_DESCRIPTOR = *mut USB_BOS_DESCRIPTOR; |
| 217 |
pub const USB_DEVICE_CAPABILITY_WIRELESS_USB: UCHAR = 0x01; |
| 218 |
pub const USB_DEVICE_CAPABILITY_USB20_EXTENSION: UCHAR = 0x02; |
| 219 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_USB: UCHAR = 0x03; |
| 220 |
pub const USB_DEVICE_CAPABILITY_CONTAINER_ID: UCHAR = 0x04; |
| 221 |
pub const USB_DEVICE_CAPABILITY_PLATFORM: UCHAR = 0x05; |
| 222 |
pub const USB_DEVICE_CAPABILITY_POWER_DELIVERY: UCHAR = 0x06; |
| 223 |
pub const USB_DEVICE_CAPABILITY_BATTERY_INFO: UCHAR = 0x07; |
| 224 |
pub const USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT: UCHAR = 0x08; |
| 225 |
pub const USB_DEVICE_CAPABILITY_PD_PROVIDER_PORT: UCHAR = 0x09; |
| 226 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB: UCHAR = 0x0A; |
| 227 |
pub const USB_DEVICE_CAPABILITY_PRECISION_TIME_MEASUREMENT: UCHAR = 0x0B; |
| 228 |
pub const USB_DEVICE_CAPABILITY_BILLBOARD: UCHAR = 0x0D; |
| 229 |
pub const USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY: UCHAR = 0x10; |
| 230 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR_bmAttributes { |
| 231 |
AsUlong: ULONG, |
| 232 |
}} |
| 233 |
BITFIELD!{USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR_bmAttributes AsUlong: ULONG [ |
| 234 |
Reserved set_Reserved[0..1], |
| 235 |
LPMCapable set_LPMCapable[1..2], |
| 236 |
BESLAndAlternateHIRDSupported set_BESLAndAlternateHIRDSupported[2..3], |
| 237 |
BaselineBESLValid set_BaselineBESLValid[3..4], |
| 238 |
DeepBESLValid set_DeepBESLValid[4..5], |
| 239 |
Reserved1 set_Reserved1[5..8], |
| 240 |
BaselineBESL set_BaselineBESL[8..12], |
| 241 |
DeepBESL set_DeepBESL[12..16], |
| 242 |
Reserved2 set_Reserved2[16..32], |
| 243 |
]} |
| 244 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR { |
| 245 |
bLength: UCHAR, |
| 246 |
bDescriptorType: UCHAR, |
| 247 |
bDevCapabilityType: UCHAR, |
| 248 |
bmAttributes: USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR_bmAttributes, |
| 249 |
}} |
| 250 |
pub type PUSB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR |
| 251 |
= *mut USB_DEVICE_CAPABILITY_USB20_EXTENSION_DESCRIPTOR; |
| 252 |
pub const USB_DEVICE_CAPABILITY_USB20_EXTENSION_BMATTRIBUTES_RESERVED_MASK: ULONG = 0xFFFF00E1; |
| 253 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR_bmAttributes { |
| 254 |
AsUlong: ULONG, |
| 255 |
}} |
| 256 |
BITFIELD!{USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR_bmAttributes AsUlong: ULONG [ |
| 257 |
Reserved set_Reserved[0..1], |
| 258 |
BatteryCharging set_BatteryCharging[1..2], |
| 259 |
USBPowerDelivery set_USBPowerDelivery[2..3], |
| 260 |
Provider set_Provider[3..4], |
| 261 |
Consumer set_Consumer[4..5], |
| 262 |
ChargingPolicy set_ChargingPolicy[5..6], |
| 263 |
TypeCCurrent set_TypeCCurrent[6..7], |
| 264 |
Reserved2 set_Reserved2[7..8], |
| 265 |
ACSupply set_ACSupply[8..9], |
| 266 |
Battery set_Battery[9..10], |
| 267 |
Other set_Other[10..11], |
| 268 |
NumBatteries set_NumBatteries[11..14], |
| 269 |
UsesVbus set_UsesVbus[14..15], |
| 270 |
Reserved3 set_Reserved3[15..32], |
| 271 |
]} |
| 272 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR { |
| 273 |
bLength: UCHAR, |
| 274 |
bDescriptorType: UCHAR, |
| 275 |
bDevCapabilityType: UCHAR, |
| 276 |
bReserved: UCHAR, |
| 277 |
bmAttributes: USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR_bmAttributes, |
| 278 |
bmProviderPorts: USHORT, |
| 279 |
bmConsumerPorts: USHORT, |
| 280 |
bcdBCVersion: USHORT, |
| 281 |
bcdPDVersion: USHORT, |
| 282 |
bcdUSBTypeCVersion: USHORT, |
| 283 |
}} |
| 284 |
pub type PUSB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR |
| 285 |
= *mut USB_DEVICE_CAPABILITY_POWER_DELIVERY_DESCRIPTOR; |
| 286 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR_bmCapabilities { |
| 287 |
AsUshort: USHORT, |
| 288 |
}} |
| 289 |
BITFIELD!{USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR_bmCapabilities AsUshort: USHORT [ |
| 290 |
BatteryCharging set_BatteryCharging[0..1], |
| 291 |
USBPowerDelivery set_USBPowerDelivery[1..2], |
| 292 |
USBTypeCCurrent set_USBTypeCCurrent[2..3], |
| 293 |
Reserved set_Reserved[3..16], |
| 294 |
]} |
| 295 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR { |
| 296 |
bLength: UCHAR, |
| 297 |
bDescriptorType: UCHAR, |
| 298 |
bDevCapabilityType: UCHAR, |
| 299 |
bReserved: UCHAR, |
| 300 |
bmCapabilities: USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR_bmCapabilities, |
| 301 |
wMinVoltage: USHORT, |
| 302 |
wMaxVoltage: USHORT, |
| 303 |
wReserved: USHORT, |
| 304 |
dwMaxOperatingPower: ULONG, |
| 305 |
dwMaxPeakPower: ULONG, |
| 306 |
dwMaxPeakPowerTime: ULONG, |
| 307 |
}} |
| 308 |
pub type PUSB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR |
| 309 |
= *mut USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_DESCRIPTOR; |
| 310 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR { |
| 311 |
bLength: UCHAR, |
| 312 |
bDescriptorType: UCHAR, |
| 313 |
bDevCapabilityType: UCHAR, |
| 314 |
bmAttributes: UCHAR, |
| 315 |
wSpeedsSupported: USHORT, |
| 316 |
bFunctionalitySupport: UCHAR, |
| 317 |
bU1DevExitLat: UCHAR, |
| 318 |
wU2DevExitLat: USHORT, |
| 319 |
}} |
| 320 |
pub type PUSB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR |
| 321 |
= *mut USB_DEVICE_CAPABILITY_SUPERSPEED_USB_DESCRIPTOR; |
| 322 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_BMATTRIBUTES_RESERVED_MASK: UCHAR = 0xFD; |
| 323 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_BMATTRIBUTES_LTM_CAPABLE: UCHAR = 0x02; |
| 324 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_RESERVED_MASK: USHORT = 0xFFF0; |
| 325 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_LOW: USHORT = 0x0001; |
| 326 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_FULL: USHORT = 0x0002; |
| 327 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_HIGH: USHORT = 0x0004; |
| 328 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_SPEEDS_SUPPORTED_SUPER: USHORT = 0x0008; |
| 329 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_U1_DEVICE_EXIT_MAX_VALUE: UCHAR = 0x0A; |
| 330 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEED_U2_DEVICE_EXIT_MAX_VALUE: USHORT = 0x07FF; |
| 331 |
pub const USB_DEVICE_CAPABILITY_MAX_U1_LATENCY: UCHAR = 0x0A; |
| 332 |
pub const USB_DEVICE_CAPABILITY_MAX_U2_LATENCY: USHORT = 0x07FF; |
| 333 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_BPS: ULONG = 0; |
| 334 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_KBPS: ULONG = 1; |
| 335 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_MBPS: ULONG = 2; |
| 336 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_LSE_GBPS: ULONG = 3; |
| 337 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_MODE_SYMMETRIC: ULONG = 0; |
| 338 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_MODE_ASYMMETRIC: ULONG = 1; |
| 339 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_DIR_RX: ULONG = 0; |
| 340 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_DIR_TX: ULONG = 1; |
| 341 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_PROTOCOL_SS: ULONG = 0; |
| 342 |
pub const USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED_PROTOCOL_SSP: ULONG = 1; |
| 343 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED { |
| 344 |
AsUlong32: ULONG, |
| 345 |
}} |
| 346 |
BITFIELD!{USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED AsUlong32: ULONG [ |
| 347 |
SublinkSpeedAttrID set_SublinkSpeedAttrID[0..4], |
| 348 |
LaneSpeedExponent set_LaneSpeedExponent[4..6], |
| 349 |
SublinkTypeMode set_SublinkTypeMode[6..7], |
| 350 |
SublinkTypeDir set_SublinkTypeDir[7..8], |
| 351 |
Reserved set_Reserved[8..14], |
| 352 |
LinkProtocol set_LinkProtocol[14..16], |
| 353 |
LaneSpeedMantissa set_LaneSpeedMantissa[16..32], |
| 354 |
]} |
| 355 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_bmAttributes { |
| 356 |
AsUlong32: ULONG, |
| 357 |
}} |
| 358 |
BITFIELD!{USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_bmAttributes AsUlong32: ULONG [ |
| 359 |
SublinkSpeedAttrCount set_SublinkSpeedAttrCount[0..5], |
| 360 |
SublinkSpeedIDCount set_SublinkSpeedIDCount[5..9], |
| 361 |
Reserved set_Reserved[9..32], |
| 362 |
]} |
| 363 |
STRUCT!{#[repr(packed)] |
| 364 |
struct USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_wFunctionalitySupport { |
| 365 |
AsUshort: USHORT, |
| 366 |
}} |
| 367 |
BITFIELD!{ |
| 368 |
USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_wFunctionalitySupport AsUshort: USHORT [ |
| 369 |
SublinkSpeedAttrID set_SublinkSpeedAttrID[0..4], |
| 370 |
Reserved set_Reserved[4..8], |
| 371 |
MinRxLaneCount set_MinRxLaneCount[8..12], |
| 372 |
MinTxLaneCount set_MinTxLaneCount[12..16], |
| 373 |
]} |
| 374 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR { |
| 375 |
bLength: UCHAR, |
| 376 |
bDescriptorType: UCHAR, |
| 377 |
bDevCapabilityType: UCHAR, |
| 378 |
bReserved: UCHAR, |
| 379 |
bmAttributes: USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_bmAttributes, |
| 380 |
wFunctionalitySupport: |
| 381 |
USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR_wFunctionalitySupport, |
| 382 |
wReserved: USHORT, |
| 383 |
bmSublinkSpeedAttr: [USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_SPEED; 1], |
| 384 |
}} |
| 385 |
pub type PUSB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR |
| 386 |
= *mut USB_DEVICE_CAPABILITY_SUPERSPEEDPLUS_USB_DESCRIPTOR; |
| 387 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR { |
| 388 |
bLength: UCHAR, |
| 389 |
bDescriptorType: UCHAR, |
| 390 |
bDevCapabilityType: UCHAR, |
| 391 |
bReserved: UCHAR, |
| 392 |
ContainerID: [UCHAR; 16], |
| 393 |
}} |
| 394 |
pub type PUSB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR |
| 395 |
= *mut USB_DEVICE_CAPABILITY_CONTAINER_ID_DESCRIPTOR; |
| 396 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR_Function { |
| 397 |
bClass: UCHAR, |
| 398 |
bSubClass: UCHAR, |
| 399 |
bProtocol: UCHAR, |
| 400 |
}} |
| 401 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR { |
| 402 |
bLength: UCHAR, |
| 403 |
bDescriptorType: UCHAR, |
| 404 |
bDevCapabilityType: UCHAR, |
| 405 |
bcdVersion: USHORT, |
| 406 |
bConfigurationValue: UCHAR, |
| 407 |
bMaxPower: UCHAR, |
| 408 |
bNumFunctions: UCHAR, |
| 409 |
Function: [USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR_Function; 1], |
| 410 |
}} |
| 411 |
pub type PUSB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR |
| 412 |
= *mut USB_DEVICE_CAPABILITY_CONFIGURATION_SUMMARY_DESCRIPTOR; |
| 413 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR { |
| 414 |
bLength: UCHAR, |
| 415 |
bDescriptorType: UCHAR, |
| 416 |
bDevCapabilityType: UCHAR, |
| 417 |
bReserved: UCHAR, |
| 418 |
PlatformCapabilityUuid: GUID, |
| 419 |
CapabililityData: [UCHAR; 1], |
| 420 |
}} |
| 421 |
pub type PUSB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR |
| 422 |
= *mut USB_DEVICE_CAPABILITY_PLATFORM_DESCRIPTOR; |
| 423 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_VconnPower { |
| 424 |
AsUshort: USHORT, |
| 425 |
}} |
| 426 |
BITFIELD!{USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_VconnPower AsUshort: USHORT [ |
| 427 |
VConnPowerNeededForFullFunctionality set_VConnPowerNeededForFullFunctionality[0..3], |
| 428 |
Reserved set_Reserved[3..15], |
| 429 |
NoVconnPowerRequired set_NoVconnPowerRequired[15..16], |
| 430 |
]} |
| 431 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_AlternateMode { |
| 432 |
wSVID: USHORT, |
| 433 |
bAlternateMode: UCHAR, |
| 434 |
iAlternateModeSetting: UCHAR, |
| 435 |
}} |
| 436 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR { |
| 437 |
bLength: UCHAR, |
| 438 |
bDescriptorType: UCHAR, |
| 439 |
bDevCapabilityType: UCHAR, |
| 440 |
iAddtionalInfoURL: UCHAR, |
| 441 |
bNumberOfAlternateModes: UCHAR, |
| 442 |
bPreferredAlternateMode: UCHAR, |
| 443 |
VconnPower: USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_VconnPower, |
| 444 |
bmConfigured: [UCHAR; 32], |
| 445 |
bReserved: ULONG, |
| 446 |
AlternateMode: [USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR_AlternateMode; 1], |
| 447 |
}} |
| 448 |
pub type PUSB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR |
| 449 |
= *mut USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR; |
| 450 |
DEFINE_GUID!{GUID_USB_MSOS20_PLATFORM_CAPABILITY_ID, |
| 451 |
0xd8dd60df, 0x4589, 0x4cc7, 0x9c, 0xd2, 0x65, 0x9d, 0x9e, 0x64, 0x8a, 0x9f} |
| 452 |
STRUCT!{#[repr(packed)] struct USB_DEVICE_CAPABILITY_DESCRIPTOR { |
| 453 |
bLength: UCHAR, |
| 454 |
bDescriptorType: UCHAR, |
| 455 |
bDevCapabilityType: UCHAR, |
| 456 |
}} |
| 457 |
pub type PUSB_DEVICE_CAPABILITY_DESCRIPTOR = *mut USB_DEVICE_CAPABILITY_DESCRIPTOR; |
| 458 |
STRUCT!{#[repr(packed)] struct USB_CONFIGURATION_DESCRIPTOR { |
| 459 |
bLength: UCHAR, |
| 460 |
bDescriptorType: UCHAR, |
| 461 |
wTotalLength: USHORT, |
| 462 |
bNumInterfaces: UCHAR, |
| 463 |
bConfigurationValue: UCHAR, |
| 464 |
iConfiguration: UCHAR, |
| 465 |
bmAttributes: UCHAR, |
| 466 |
MaxPower: UCHAR, |
| 467 |
}} |
| 468 |
pub type PUSB_CONFIGURATION_DESCRIPTOR = *mut USB_CONFIGURATION_DESCRIPTOR; |
| 469 |
pub const USB_CONFIG_POWERED_MASK: UCHAR = 0xC0; |
| 470 |
pub const USB_CONFIG_BUS_POWERED: UCHAR = 0x80; |
| 471 |
pub const USB_CONFIG_SELF_POWERED: UCHAR = 0x40; |
| 472 |
pub const USB_CONFIG_REMOTE_WAKEUP: UCHAR = 0x20; |
| 473 |
pub const USB_CONFIG_RESERVED: UCHAR = 0x1F; |
| 474 |
STRUCT!{#[repr(packed)] struct USB_INTERFACE_ASSOCIATION_DESCRIPTOR { |
| 475 |
bLength: UCHAR, |
| 476 |
bDescriptorType: UCHAR, |
| 477 |
bFirstInterface: UCHAR, |
| 478 |
bInterfaceCount: UCHAR, |
| 479 |
bFunctionClass: UCHAR, |
| 480 |
bFunctionSubClass: UCHAR, |
| 481 |
bFunctionProtocol: UCHAR, |
| 482 |
iFunction: UCHAR, |
| 483 |
}} |
| 484 |
pub type PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR = *mut USB_INTERFACE_ASSOCIATION_DESCRIPTOR; |
| 485 |
STRUCT!{#[repr(packed)] struct USB_INTERFACE_DESCRIPTOR { |
| 486 |
bLength: UCHAR, |
| 487 |
bDescriptorType: UCHAR, |
| 488 |
bInterfaceNumber: UCHAR, |
| 489 |
bAlternateSetting: UCHAR, |
| 490 |
bNumEndpoints: UCHAR, |
| 491 |
bInterfaceClass: UCHAR, |
| 492 |
bInterfaceSubClass: UCHAR, |
| 493 |
bInterfaceProtocol: UCHAR, |
| 494 |
iInterface: UCHAR, |
| 495 |
}} |
| 496 |
pub type PUSB_INTERFACE_DESCRIPTOR = *mut USB_INTERFACE_DESCRIPTOR; |
| 497 |
STRUCT!{#[repr(packed)] struct USB_ENDPOINT_DESCRIPTOR { |
| 498 |
bLength: UCHAR, |
| 499 |
bDescriptorType: UCHAR, |
| 500 |
bEndpointAddress: UCHAR, |
| 501 |
bmAttributes: UCHAR, |
| 502 |
wMaxPacketSize: USHORT, |
| 503 |
bInterval: UCHAR, |
| 504 |
}} |
| 505 |
pub type PUSB_ENDPOINT_DESCRIPTOR = *mut USB_ENDPOINT_DESCRIPTOR; |
| 506 |
pub const USB_ENDPOINT_DIRECTION_MASK: UCHAR = 0x80; |
| 507 |
#[inline] |
| 508 |
pub fn USB_ENDPOINT_DIRECTION_OUT(addr: UCHAR) -> UCHAR { |
| 509 |
!(addr & USB_ENDPOINT_DIRECTION_MASK) |
| 510 |
} |
| 511 |
#[inline] |
| 512 |
pub fn USB_ENDPOINT_DIRECTION_IN(addr: UCHAR) -> UCHAR { |
| 513 |
addr & USB_ENDPOINT_DIRECTION_MASK |
| 514 |
} |
| 515 |
pub const USB_ENDPOINT_ADDRESS_MASK: UCHAR = 0x0F; |
| 516 |
pub const USB_ENDPOINT_TYPE_MASK: UCHAR = 0x03; |
| 517 |
pub const USB_ENDPOINT_TYPE_CONTROL: UCHAR = 0x00; |
| 518 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS: UCHAR = 0x01; |
| 519 |
pub const USB_ENDPOINT_TYPE_BULK: UCHAR = 0x02; |
| 520 |
pub const USB_ENDPOINT_TYPE_INTERRUPT: UCHAR = 0x03; |
| 521 |
pub const USB_ENDPOINT_TYPE_BULK_RESERVED_MASK: UCHAR = 0xFC; |
| 522 |
pub const USB_ENDPOINT_TYPE_CONTROL_RESERVED_MASK: UCHAR = 0xFC; |
| 523 |
pub const USB_20_ENDPOINT_TYPE_INTERRUPT_RESERVED_MASK: UCHAR = 0xFC; |
| 524 |
pub const USB_30_ENDPOINT_TYPE_INTERRUPT_RESERVED_MASK: UCHAR = 0xCC; |
| 525 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_RESERVED_MASK: UCHAR = 0xC0; |
| 526 |
pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_MASK: UCHAR = 0x30; |
| 527 |
pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_PERIODIC: UCHAR = 0x00; |
| 528 |
pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_NOTIFICATION: UCHAR = 0x10; |
| 529 |
pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_RESERVED10: UCHAR = 0x20; |
| 530 |
pub const USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_RESERVED11: UCHAR = 0x30; |
| 531 |
#[inline] |
| 532 |
pub fn USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE(bmAttr: UCHAR) -> UCHAR { |
| 533 |
bmAttr & USB_30_ENDPOINT_TYPE_INTERRUPT_USAGE_MASK |
| 534 |
} |
| 535 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_MASK: UCHAR = 0x0C; |
| 536 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_NO_SYNCHRONIZATION: UCHAR = 0x00; |
| 537 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_ASYNCHRONOUS: UCHAR = 0x04; |
| 538 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_ADAPTIVE: UCHAR = 0x08; |
| 539 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_SYNCHRONOUS: UCHAR = 0x0C; |
| 540 |
#[inline] |
| 541 |
pub fn USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION(bmAttr: UCHAR) -> UCHAR { |
| 542 |
bmAttr & USB_ENDPOINT_TYPE_ISOCHRONOUS_SYNCHRONIZATION_MASK |
| 543 |
} |
| 544 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_MASK: UCHAR = 0x30; |
| 545 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_DATA_ENDOINT: UCHAR = 0x00; |
| 546 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_FEEDBACK_ENDPOINT: UCHAR = 0x10; |
| 547 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_IMPLICIT_FEEDBACK_DATA_ENDPOINT: UCHAR = 0x20; |
| 548 |
pub const USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_RESERVED: UCHAR = 0x30; |
| 549 |
#[inline] |
| 550 |
pub fn USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE(bmAttr: UCHAR) -> UCHAR { |
| 551 |
bmAttr & USB_ENDPOINT_TYPE_ISOCHRONOUS_USAGE_MASK |
| 552 |
} |
| 553 |
STRUCT!{#[repr(packed)] struct USB_HIGH_SPEED_MAXPACKET { |
| 554 |
us: USHORT, |
| 555 |
}} |
| 556 |
BITFIELD!{USB_HIGH_SPEED_MAXPACKET us: USHORT [ |
| 557 |
MaxPacket set_MaxPacket[0..11], |
| 558 |
HSmux set_HSmux[11..13], |
| 559 |
Reserved set_Reserved[13..16], |
| 560 |
]} |
| 561 |
pub type PUSB_HIGH_SPEED_MAXPACKET = *mut USB_HIGH_SPEED_MAXPACKET; |
| 562 |
pub const USB_ENDPOINT_SUPERSPEED_BULK_MAX_PACKET_SIZE: USHORT = 1024; |
| 563 |
pub const USB_ENDPOINT_SUPERSPEED_CONTROL_MAX_PACKET_SIZE: USHORT = 512; |
| 564 |
pub const USB_ENDPOINT_SUPERSPEED_ISO_MAX_PACKET_SIZE: USHORT = 1024; |
| 565 |
pub const USB_ENDPOINT_SUPERSPEED_INTERRUPT_MAX_PACKET_SIZE: USHORT = 1024; |
| 566 |
STRUCT!{#[repr(packed)] struct USB_STRING_DESCRIPTOR { |
| 567 |
bLength: UCHAR, |
| 568 |
bDescriptorType: UCHAR, |
| 569 |
bString: [WCHAR; 1], |
| 570 |
}} |
| 571 |
pub type PUSB_STRING_DESCRIPTOR = *mut USB_STRING_DESCRIPTOR; |
| 572 |
pub const MAXIMUM_USB_STRING_LENGTH: UCHAR = 255; |
| 573 |
STRUCT!{#[repr(packed)] struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Bulk { |
| 574 |
BitField: UCHAR, |
| 575 |
}} |
| 576 |
BITFIELD!{USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Bulk BitField: UCHAR [ |
| 577 |
MaxStreams set_MaxStreams[0..5], |
| 578 |
Reserved1 set_Reserved1[5..8], |
| 579 |
]} |
| 580 |
STRUCT!{#[repr(packed)] |
| 581 |
struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Isochronous { |
| 582 |
BitField: UCHAR, |
| 583 |
}} |
| 584 |
BITFIELD!{USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Isochronous BitField: UCHAR [ |
| 585 |
Mult set_Mult[0..2], |
| 586 |
Reserved2 set_Reserved2[2..7], |
| 587 |
SspCompanion set_SspCompanion[7..8], |
| 588 |
]} |
| 589 |
UNION!{#[repr(packed)] union USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes { |
| 590 |
[u8; 1], |
| 591 |
AsUchar AsUchar_mut: UCHAR, |
| 592 |
Bulk Bulk_mut: USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Bulk, |
| 593 |
Isochronous Isochronous_mut: |
| 594 |
USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes_Isochronous, |
| 595 |
}} |
| 596 |
STRUCT!{#[repr(packed)] struct USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR { |
| 597 |
bLength: UCHAR, |
| 598 |
bDescriptorType: UCHAR, |
| 599 |
bMaxBurst: UCHAR, |
| 600 |
bmAttributes: USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR_bmAttributes, |
| 601 |
wBytesPerInterval: USHORT, |
| 602 |
}} |
| 603 |
pub type PUSB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR |
| 604 |
= *mut USB_SUPERSPEED_ENDPOINT_COMPANION_DESCRIPTOR; |
| 605 |
pub const USB_SUPERSPEED_ISOCHRONOUS_MAX_MULTIPLIER: UCHAR = 2; |
| 606 |
STRUCT!{#[repr(packed)] struct USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR { |
| 607 |
bLength: UCHAR, |
| 608 |
bDescriptorType: UCHAR, |
| 609 |
wReserved: USHORT, |
| 610 |
dwBytesPerInterval: ULONG, |
| 611 |
}} |
| 612 |
pub type PUSB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR |
| 613 |
= *mut USB_SUPERSPEEDPLUS_ISOCH_ENDPOINT_COMPANION_DESCRIPTOR; |
| 614 |
pub const USB_SUPERSPEEDPLUS_ISOCHRONOUS_MIN_BYTESPERINTERVAL: ULONG = 0xC001; |
| 615 |
pub const USB_SUPERSPEEDPLUS_ISOCHRONOUS_MAX_BYTESPERINTERVAL: ULONG = 0xFFFFFF; |
| 616 |
STRUCT!{#[repr(packed)] struct USB_HUB_DESCRIPTOR { |
| 617 |
bDescriptorLength: UCHAR, |
| 618 |
bDescriptorType: UCHAR, |
| 619 |
bNumberOfPorts: UCHAR, |
| 620 |
wHubCharacteristics: USHORT, |
| 621 |
bPowerOnToPowerGood: UCHAR, |
| 622 |
bHubControlCurrent: UCHAR, |
| 623 |
bRemoveAndPowerMask: [UCHAR; 64], |
| 624 |
}} |
| 625 |
pub type PUSB_HUB_DESCRIPTOR = *mut USB_HUB_DESCRIPTOR; |
| 626 |
pub const USB_20_HUB_DESCRIPTOR_TYPE: UCHAR = 0x29; |
| 627 |
STRUCT!{#[repr(packed)] struct USB_30_HUB_DESCRIPTOR { |
| 628 |
bLength: UCHAR, |
| 629 |
bDescriptorType: UCHAR, |
| 630 |
bNumberOfPorts: UCHAR, |
| 631 |
wHubCharacteristics: USHORT, |
| 632 |
bPowerOnToPowerGood: UCHAR, |
| 633 |
bHubControlCurrent: UCHAR, |
| 634 |
bHubHdrDecLat: UCHAR, |
| 635 |
wHubDelay: USHORT, |
| 636 |
DeviceRemovable: USHORT, |
| 637 |
}} |
| 638 |
pub type PUSB_30_HUB_DESCRIPTOR = *mut USB_30_HUB_DESCRIPTOR; |
| 639 |
pub const USB_30_HUB_DESCRIPTOR_TYPE: UCHAR = 0x2A; |
| 640 |
pub const USB_REQUEST_GET_STATE: UCHAR = 0x02; |
| 641 |
pub const USB_REQUEST_CLEAR_TT_BUFFER: UCHAR = 0x08; |
| 642 |
pub const USB_REQUEST_RESET_TT: UCHAR = 0x09; |
| 643 |
pub const USB_REQUEST_GET_TT_STATE: UCHAR = 0x0A; |
| 644 |
pub const USB_REQUEST_STOP_TT: UCHAR = 0x0B; |
| 645 |
pub const USB_REQUEST_SET_HUB_DEPTH: UCHAR = 0x0C; |
| 646 |
pub const USB_REQUEST_GET_PORT_ERR_COUNT: UCHAR = 0x0D; |
| 647 |
STRUCT!{#[repr(packed)] struct USB_HUB_STATUS { |
| 648 |
AsUshort16: USHORT, |
| 649 |
}} |
| 650 |
BITFIELD!{USB_HUB_STATUS AsUshort16: USHORT [ |
| 651 |
LocalPowerLost set_LocalPowerLost[0..1], |
| 652 |
OverCurrent set_OverCurrent[1..2], |
| 653 |
Reserved set_Reserved[2..16], |
| 654 |
]} |
| 655 |
pub type PUSB_HUB_STATUS = *mut USB_HUB_STATUS; |
| 656 |
STRUCT!{#[repr(packed)] struct USB_HUB_CHANGE { |
| 657 |
AsUshort16: USHORT, |
| 658 |
}} |
| 659 |
BITFIELD!{USB_HUB_CHANGE AsUshort16: USHORT [ |
| 660 |
LocalPowerChange set_LocalPowerChange[0..1], |
| 661 |
OverCurrentChange set_OverCurrentChange[1..2], |
| 662 |
Reserved set_Reserved[2..16], |
| 663 |
]} |
| 664 |
pub type PUSB_HUB_CHANGE = *mut USB_HUB_CHANGE; |
| 665 |
STRUCT!{#[repr(packed)] struct USB_HUB_STATUS_AND_CHANGE_s { |
| 666 |
HubStatus: USB_HUB_STATUS, |
| 667 |
HubChange: USB_HUB_CHANGE, |
| 668 |
}} |
| 669 |
UNION!{#[repr(packed)] union USB_HUB_STATUS_AND_CHANGE { |
| 670 |
[u32; 1], |
| 671 |
AsUlong32 AsUlong32_mut: ULONG, |
| 672 |
s s_mut: USB_HUB_STATUS_AND_CHANGE_s, |
| 673 |
}} |
| 674 |
pub type PUSB_HUB_STATUS_AND_CHANGE = *mut USB_HUB_STATUS_AND_CHANGE; |
| 675 |
STRUCT!{#[repr(packed)] struct USB_20_PORT_STATUS { |
| 676 |
AsUshort16: USHORT, |
| 677 |
}} |
| 678 |
BITFIELD!{USB_20_PORT_STATUS AsUshort16: USHORT [ |
| 679 |
CurrentConnectStatus set_CurrentConnectStatus[0..1], |
| 680 |
PortEnabledDisabled set_PortEnabledDisabled[1..2], |
| 681 |
Suspend set_Suspend[2..3], |
| 682 |
OverCurrent set_OverCurrent[3..4], |
| 683 |
Reset set_Reset[4..5], |
| 684 |
L1 set_L1[5..6], |
| 685 |
Reserved0 set_Reserved0[6..8], |
| 686 |
PortPower set_PortPower[8..9], |
| 687 |
LowSpeedDeviceAttached set_LowSpeedDeviceAttached[9..10], |
| 688 |
HighSpeedDeviceAttached set_HighSpeedDeviceAttached[10..11], |
| 689 |
PortTestMode set_PortTestMode[11..12], |
| 690 |
PortIndicatorControl set_PortIndicatorControl[12..13], |
| 691 |
Reserved1 set_Reserved1[13..16], |
| 692 |
]} |
| 693 |
pub type PUSB_20_PORT_STATUS = *mut USB_20_PORT_STATUS; |
| 694 |
pub const USB_PORT_STATUS_CONNECT: USHORT = 0x0001; |
| 695 |
pub const USB_PORT_STATUS_ENABLE: USHORT = 0x0002; |
| 696 |
pub const USB_PORT_STATUS_SUSPEND: USHORT = 0x0004; |
| 697 |
pub const USB_PORT_STATUS_OVER_CURRENT: USHORT = 0x0008; |
| 698 |
pub const USB_PORT_STATUS_RESET: USHORT = 0x0010; |
| 699 |
pub const USB_PORT_STATUS_POWER: USHORT = 0x0100; |
| 700 |
pub const USB_PORT_STATUS_LOW_SPEED: USHORT = 0x0200; |
| 701 |
pub const USB_PORT_STATUS_HIGH_SPEED: USHORT = 0x0400; |
| 702 |
STRUCT!{#[repr(packed)] struct USB_20_PORT_CHANGE { |
| 703 |
AsUshort16: USHORT, |
| 704 |
}} |
| 705 |
BITFIELD!{USB_20_PORT_CHANGE AsUshort16: USHORT [ |
| 706 |
ConnectStatusChange set_ConnectStatusChange[0..1], |
| 707 |
PortEnableDisableChange set_PortEnableDisableChange[1..2], |
| 708 |
SuspendChange set_SuspendChange[2..3], |
| 709 |
OverCurrentIndicatorChange set_OverCurrentIndicatorChange[3..4], |
| 710 |
ResetChange set_ResetChange[4..5], |
| 711 |
Reserved2 set_Reserved2[5..16], |
| 712 |
]} |
| 713 |
pub type PUSB_20_PORT_CHANGE = *mut USB_20_PORT_CHANGE; |
| 714 |
STRUCT!{#[repr(packed)] struct USB_30_PORT_STATUS { |
| 715 |
AsUshort16: USHORT, |
| 716 |
}} |
| 717 |
BITFIELD!{USB_30_PORT_STATUS AsUshort16: USHORT [ |
| 718 |
CurrentConnectStatus set_CurrentConnectStatus[0..1], |
| 719 |
PortEnabledDisabled set_PortEnabledDisabled[1..2], |
| 720 |
Reserved0 set_Reserved0[2..3], |
| 721 |
OverCurrent set_OverCurrent[3..4], |
| 722 |
Reset set_Reset[4..5], |
| 723 |
PortLinkState set_PortLinkState[5..9], |
| 724 |
PortPower set_PortPower[9..10], |
| 725 |
NegotiatedDeviceSpeed set_NegotiatedDeviceSpeed[10..13], |
| 726 |
Reserved1 set_Reserved1[13..16], |
| 727 |
]} |
| 728 |
pub type PUSB_30_PORT_STATUS = *mut USB_30_PORT_STATUS; |
| 729 |
pub const PORT_LINK_STATE_U0: USHORT = 0; |
| 730 |
pub const PORT_LINK_STATE_U1: USHORT = 1; |
| 731 |
pub const PORT_LINK_STATE_U2: USHORT = 2; |
| 732 |
pub const PORT_LINK_STATE_U3: USHORT = 3; |
| 733 |
pub const PORT_LINK_STATE_DISABLED: USHORT = 4; |
| 734 |
pub const PORT_LINK_STATE_RX_DETECT: USHORT = 5; |
| 735 |
pub const PORT_LINK_STATE_INACTIVE: USHORT = 6; |
| 736 |
pub const PORT_LINK_STATE_POLLING: USHORT = 7; |
| 737 |
pub const PORT_LINK_STATE_RECOVERY: USHORT = 8; |
| 738 |
pub const PORT_LINK_STATE_HOT_RESET: USHORT = 9; |
| 739 |
pub const PORT_LINK_STATE_COMPLIANCE_MODE: USHORT = 10; |
| 740 |
pub const PORT_LINK_STATE_LOOPBACK: USHORT = 11; |
| 741 |
pub const PORT_LINK_STATE_TEST_MODE: USHORT = 11; |
| 742 |
STRUCT!{#[repr(packed)] struct USB_30_PORT_CHANGE { |
| 743 |
AsUshort16: USHORT, |
| 744 |
}} |
| 745 |
BITFIELD!{USB_30_PORT_CHANGE AsUshort16: USHORT [ |
| 746 |
ConnectStatusChange set_ConnectStatusChange[0..1], |
| 747 |
Reserved2 set_Reserved2[1..3], |
| 748 |
OverCurrentIndicatorChange set_OverCurrentIndicatorChange[3..4], |
| 749 |
ResetChange set_ResetChange[4..5], |
| 750 |
BHResetChange set_BHResetChange[5..6], |
| 751 |
PortLinkStateChange set_PortLinkStateChange[6..7], |
| 752 |
PortConfigErrorChange set_PortConfigErrorChange[7..8], |
| 753 |
Reserved3 set_Reserved3[8..16], |
| 754 |
]} |
| 755 |
pub type PUSB_30_PORT_CHANGE = *mut USB_30_PORT_CHANGE; |
| 756 |
UNION!{#[repr(packed)] union USB_PORT_STATUS { |
| 757 |
[u16; 1], |
| 758 |
AsUshort16 AsUshort16_mut: USHORT, |
| 759 |
Usb20PortStatus Usb20PortStatus_mut: USB_20_PORT_STATUS, |
| 760 |
Usb30PortStatus Usb30PortStatus_mut: USB_30_PORT_STATUS, |
| 761 |
}} |
| 762 |
pub type PUSB_PORT_STATUS = *mut USB_PORT_STATUS; |
| 763 |
UNION!{#[repr(packed)] union USB_PORT_CHANGE { |
| 764 |
[u16; 1], |
| 765 |
AsUshort16 AsUshort16_mut: USHORT, |
| 766 |
Usb20PortChange Usb20PortChange_mut: USB_20_PORT_CHANGE, |
| 767 |
Usb30PortChange Usb30PortChange_mut: USB_30_PORT_CHANGE, |
| 768 |
}} |
| 769 |
pub type PUSB_PORT_CHANGE = *mut USB_PORT_CHANGE; |
| 770 |
STRUCT!{#[repr(packed)] struct USB_PORT_EXT_STATUS { |
| 771 |
AsUlong32: ULONG, |
| 772 |
}} |
| 773 |
BITFIELD!{USB_PORT_EXT_STATUS AsUlong32: ULONG [ |
| 774 |
RxSublinkSpeedID set_RxSublinkSpeedID[0..4], |
| 775 |
TxSublinkSpeedID set_TxSublinkSpeedID[4..8], |
| 776 |
RxLaneCount set_RxLaneCount[8..12], |
| 777 |
TxLaneCount set_TxLaneCount[12..16], |
| 778 |
Reserved set_Reserved[16..32], |
| 779 |
]} |
| 780 |
pub type PUSB_PORT_EXT_STATUS = *mut USB_PORT_EXT_STATUS; |
| 781 |
STRUCT!{#[repr(packed)] struct USB_PORT_STATUS_AND_CHANGE_s { |
| 782 |
PortStatus: USB_PORT_STATUS, |
| 783 |
PortChange: USB_PORT_CHANGE, |
| 784 |
}} |
| 785 |
UNION!{#[repr(packed)] union USB_PORT_STATUS_AND_CHANGE { |
| 786 |
[u32; 1], |
| 787 |
AsUlong32 AsUlong32_mut: ULONG, |
| 788 |
s s_mut: USB_PORT_STATUS_AND_CHANGE_s, |
| 789 |
}} |
| 790 |
pub type PUSB_PORT_STATUS_AND_CHANGE = *mut USB_PORT_STATUS_AND_CHANGE; |
| 791 |
STRUCT!{#[repr(packed)] struct USB_PORT_EXT_STATUS_AND_CHANGE_s { |
| 792 |
PortStatusChange: USB_PORT_STATUS_AND_CHANGE, |
| 793 |
PortExtStatus: USB_PORT_EXT_STATUS, |
| 794 |
}} |
| 795 |
UNION!{#[repr(packed)] union USB_PORT_EXT_STATUS_AND_CHANGE { |
| 796 |
[u64; 1], |
| 797 |
AsUlong64 AsUlong64_mut: ULONG64, |
| 798 |
s s_mut: USB_PORT_EXT_STATUS_AND_CHANGE_s, |
| 799 |
}} |
| 800 |
pub type PUSB_PORT_EXT_STATUS_AND_CHANGE = *mut USB_PORT_EXT_STATUS_AND_CHANGE; |
| 801 |
STRUCT!{#[repr(packed)] struct USB_HUB_30_PORT_REMOTE_WAKE_MASK { |
| 802 |
AsUchar8: UCHAR, |
| 803 |
}} |
| 804 |
BITFIELD!{USB_HUB_30_PORT_REMOTE_WAKE_MASK AsUchar8: UCHAR [ |
| 805 |
ConnectRemoteWakeEnable set_ConnectRemoteWakeEnable[0..1], |
| 806 |
DisconnectRemoteWakeEnable set_DisconnectRemoteWakeEnable[1..2], |
| 807 |
OverCurrentRemoteWakeEnable set_OverCurrentRemoteWakeEnable[2..3], |
| 808 |
Reserved0 set_Reserved0[3..8], |
| 809 |
]} |
| 810 |
pub type PUSB_HUB_30_PORT_REMOTE_WAKE_MASK = *mut USB_HUB_30_PORT_REMOTE_WAKE_MASK; |
| 811 |
STRUCT!{#[repr(packed)] struct USB_FUNCTION_SUSPEND_OPTIONS { |
| 812 |
AsUchar: UCHAR, |
| 813 |
}} |
| 814 |
BITFIELD!{USB_FUNCTION_SUSPEND_OPTIONS AsUchar: UCHAR [ |
| 815 |
PowerState set_PowerState[0..1], |
| 816 |
RemoteWakeEnabled set_RemoteWakeEnabled[1..2], |
| 817 |
Reserved0 set_Reserved0[2..8], |
| 818 |
]} |
| 819 |
pub type PUSB_FUNCTION_SUSPEND_OPTIONS = *mut USB_FUNCTION_SUSPEND_OPTIONS; |
| 820 |
pub const USB_FEATURE_INTERFACE_POWER_D0: USHORT = 0x0002; |
| 821 |
pub const USB_FEATURE_INTERFACE_POWER_D1: USHORT = 0x0003; |
| 822 |
pub const USB_FEATURE_INTERFACE_POWER_D2: USHORT = 0x0004; |
| 823 |
pub const USB_FEATURE_INTERFACE_POWER_D3: USHORT = 0x0005; |
| 824 |
pub const USB_SUPPORT_D0_COMMAND: UCHAR = 0x01; |
| 825 |
pub const USB_SUPPORT_D1_COMMAND: UCHAR = 0x02; |
| 826 |
pub const USB_SUPPORT_D2_COMMAND: UCHAR = 0x04; |
| 827 |
pub const USB_SUPPORT_D3_COMMAND: UCHAR = 0x08; |
| 828 |
pub const USB_SUPPORT_D1_WAKEUP: UCHAR = 0x10; |
| 829 |
pub const USB_SUPPORT_D2_WAKEUP: UCHAR = 0x20; |
| 830 |
STRUCT!{#[repr(packed)] struct USB_CONFIGURATION_POWER_DESCRIPTOR { |
| 831 |
bLength: UCHAR, |
| 832 |
bDescriptorType: UCHAR, |
| 833 |
SelfPowerConsumedD0: [UCHAR; 3], |
| 834 |
bPowerSummaryId: UCHAR, |
| 835 |
bBusPowerSavingD1: UCHAR, |
| 836 |
bSelfPowerSavingD1: UCHAR, |
| 837 |
bBusPowerSavingD2: UCHAR, |
| 838 |
bSelfPowerSavingD2: UCHAR, |
| 839 |
bBusPowerSavingD3: UCHAR, |
| 840 |
bSelfPowerSavingD3: UCHAR, |
| 841 |
TransitionTimeFromD1: USHORT, |
| 842 |
TransitionTimeFromD2: USHORT, |
| 843 |
TransitionTimeFromD3: USHORT, |
| 844 |
}} |
| 845 |
pub type PUSB_CONFIGURATION_POWER_DESCRIPTOR = *mut USB_CONFIGURATION_POWER_DESCRIPTOR; |
| 846 |
STRUCT!{#[repr(packed)] struct USB_INTERFACE_POWER_DESCRIPTOR { |
| 847 |
bLength: UCHAR, |
| 848 |
bDescriptorType: UCHAR, |
| 849 |
bmCapabilitiesFlags: UCHAR, |
| 850 |
bBusPowerSavingD1: UCHAR, |
| 851 |
bSelfPowerSavingD1: UCHAR, |
| 852 |
bBusPowerSavingD2: UCHAR, |
| 853 |
bSelfPowerSavingD2: UCHAR, |
| 854 |
bBusPowerSavingD3: UCHAR, |
| 855 |
bSelfPowerSavingD3: UCHAR, |
| 856 |
TransitionTimeFromD1: USHORT, |
| 857 |
TransitionTimeFromD2: USHORT, |
| 858 |
TransitionTimeFromD3: USHORT, |
| 859 |
}} |
| 860 |
pub type PUSB_INTERFACE_POWER_DESCRIPTOR = *mut USB_INTERFACE_POWER_DESCRIPTOR; |