Deleted Added
sdiff udiff text old ( 185290 ) new ( 186730 )
full compact
1/* $FreeBSD: head/sys/dev/usb2/include/usb2_standard.h 185290 2008-11-25 08:04:40Z alfred $ */
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
5 * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29/*
30 * This file contains standard definitions for the following USB
31 * protocol versions:
32 *
33 * USB v1.0
34 * USB v1.1
35 * USB v2.0
36 * USB v3.0
37 */
38
39#ifndef _USB2_STANDARD_H_
40#define _USB2_STANDARD_H_
41
42#include <dev/usb2/include/usb2_endian.h>
43
44/*
45 * Minimum time a device needs to be powered down to go through a
46 * power cycle. These values are not in the USB specification.
47 */
48#define USB_POWER_DOWN_TIME 200 /* ms */
49#define USB_PORT_POWER_DOWN_TIME 100 /* ms */
50
51#if 0
52/* These are the values from the USB specification. */
53#define USB_PORT_RESET_DELAY 10 /* ms */
54#define USB_PORT_ROOT_RESET_DELAY 50 /* ms */
55#define USB_PORT_RESET_RECOVERY 10 /* ms */
56#define USB_PORT_POWERUP_DELAY 100 /* ms */
57#define USB_SET_ADDRESS_SETTLE 2 /* ms */
58#define USB_RESUME_DELAY (20*5) /* ms */
59#define USB_RESUME_WAIT 10 /* ms */
60#define USB_RESUME_RECOVERY 10 /* ms */
61#define USB_EXTRA_POWER_UP_TIME 0 /* ms */
62#else
63/* Allow for marginal and non-conforming devices. */
64#define USB_PORT_RESET_DELAY 50 /* ms */
65#define USB_PORT_ROOT_RESET_DELAY 250 /* ms */
66#define USB_PORT_RESET_RECOVERY 250 /* ms */
67#define USB_PORT_POWERUP_DELAY 300 /* ms */
68#define USB_SET_ADDRESS_SETTLE 10 /* ms */
69#define USB_RESUME_DELAY (50*5) /* ms */
70#define USB_RESUME_WAIT 50 /* ms */
71#define USB_RESUME_RECOVERY 50 /* ms */
72#define USB_EXTRA_POWER_UP_TIME 20 /* ms */
73#endif
74
75#define USB_MIN_POWER 100 /* mA */
76#define USB_MAX_POWER 500 /* mA */
77
78#define USB_BUS_RESET_DELAY 100 /* ms */
79
80/*
81 * USB record layout in memory:
82 *
83 * - USB config 0
84 * - USB interfaces
85 * - USB alternative interfaces
86 * - USB pipes
87 *
88 * - USB config 1
89 * - USB interfaces
90 * - USB alternative interfaces
91 * - USB pipes
92 */
93
94/* Declaration of USB records */
95
96struct usb2_device_request {
97 uByte bmRequestType;
98 uByte bRequest;
99 uWord wValue;
100 uWord wIndex;
101 uWord wLength;
102} __packed;
103
104#define UT_WRITE 0x00
105#define UT_READ 0x80
106#define UT_STANDARD 0x00
107#define UT_CLASS 0x20
108#define UT_VENDOR 0x40
109#define UT_DEVICE 0x00
110#define UT_INTERFACE 0x01
111#define UT_ENDPOINT 0x02
112#define UT_OTHER 0x03
113
114#define UT_READ_DEVICE (UT_READ | UT_STANDARD | UT_DEVICE)
115#define UT_READ_INTERFACE (UT_READ | UT_STANDARD | UT_INTERFACE)
116#define UT_READ_ENDPOINT (UT_READ | UT_STANDARD | UT_ENDPOINT)
117#define UT_WRITE_DEVICE (UT_WRITE | UT_STANDARD | UT_DEVICE)
118#define UT_WRITE_INTERFACE (UT_WRITE | UT_STANDARD | UT_INTERFACE)
119#define UT_WRITE_ENDPOINT (UT_WRITE | UT_STANDARD | UT_ENDPOINT)
120#define UT_READ_CLASS_DEVICE (UT_READ | UT_CLASS | UT_DEVICE)
121#define UT_READ_CLASS_INTERFACE (UT_READ | UT_CLASS | UT_INTERFACE)
122#define UT_READ_CLASS_OTHER (UT_READ | UT_CLASS | UT_OTHER)
123#define UT_READ_CLASS_ENDPOINT (UT_READ | UT_CLASS | UT_ENDPOINT)
124#define UT_WRITE_CLASS_DEVICE (UT_WRITE | UT_CLASS | UT_DEVICE)
125#define UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE)
126#define UT_WRITE_CLASS_OTHER (UT_WRITE | UT_CLASS | UT_OTHER)
127#define UT_WRITE_CLASS_ENDPOINT (UT_WRITE | UT_CLASS | UT_ENDPOINT)
128#define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE)
129#define UT_READ_VENDOR_INTERFACE (UT_READ | UT_VENDOR | UT_INTERFACE)
130#define UT_READ_VENDOR_OTHER (UT_READ | UT_VENDOR | UT_OTHER)
131#define UT_READ_VENDOR_ENDPOINT (UT_READ | UT_VENDOR | UT_ENDPOINT)
132#define UT_WRITE_VENDOR_DEVICE (UT_WRITE | UT_VENDOR | UT_DEVICE)
133#define UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE)
134#define UT_WRITE_VENDOR_OTHER (UT_WRITE | UT_VENDOR | UT_OTHER)
135#define UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT)
136
137/* Requests */
138#define UR_GET_STATUS 0x00
139#define UR_CLEAR_FEATURE 0x01
140#define UR_SET_FEATURE 0x03
141#define UR_SET_ADDRESS 0x05
142#define UR_GET_DESCRIPTOR 0x06
143#define UDESC_DEVICE 0x01
144#define UDESC_CONFIG 0x02
145#define UDESC_STRING 0x03
146#define USB_LANGUAGE_TABLE 0x00 /* language ID string index */
147#define UDESC_INTERFACE 0x04
148#define UDESC_ENDPOINT 0x05
149#define UDESC_DEVICE_QUALIFIER 0x06
150#define UDESC_OTHER_SPEED_CONFIGURATION 0x07
151#define UDESC_INTERFACE_POWER 0x08
152#define UDESC_OTG 0x09
153#define UDESC_DEBUG 0x0A
154#define UDESC_IFACE_ASSOC 0x0B /* interface association */
155#define UDESC_BOS 0x0F /* binary object store */
156#define UDESC_DEVICE_CAPABILITY 0x10
157#define UDESC_CS_DEVICE 0x21 /* class specific */
158#define UDESC_CS_CONFIG 0x22
159#define UDESC_CS_STRING 0x23
160#define UDESC_CS_INTERFACE 0x24
161#define UDESC_CS_ENDPOINT 0x25
162#define UDESC_HUB 0x29
163#define UDESC_ENDPOINT_SS_COMP 0x30 /* super speed */
164#define UR_SET_DESCRIPTOR 0x07
165#define UR_GET_CONFIG 0x08
166#define UR_SET_CONFIG 0x09
167#define UR_GET_INTERFACE 0x0a
168#define UR_SET_INTERFACE 0x0b
169#define UR_SYNCH_FRAME 0x0c
170#define UR_SET_SEL 0x30
171#define UR_ISOCH_DELAY 0x31
172
173/* HUB specific request */
174#define UR_GET_BUS_STATE 0x02
175#define UR_CLEAR_TT_BUFFER 0x08
176#define UR_RESET_TT 0x09
177#define UR_GET_TT_STATE 0x0a
178#define UR_STOP_TT 0x0b
179#define UR_SET_HUB_DEPTH 0x0c
180#define UR_GET_PORT_ERR_COUNT 0x0d
181
182/* Feature numbers */
183#define UF_ENDPOINT_HALT 0
184#define UF_DEVICE_REMOTE_WAKEUP 1
185#define UF_TEST_MODE 2
186#define UF_U1_ENABLE 0x30
187#define UF_U2_ENABLE 0x31
188#define UF_LTM_ENABLE 0x32
189
190/* HUB specific features */
191#define UHF_C_HUB_LOCAL_POWER 0
192#define UHF_C_HUB_OVER_CURRENT 1
193#define UHF_PORT_CONNECTION 0
194#define UHF_PORT_ENABLE 1
195#define UHF_PORT_SUSPEND 2
196#define UHF_PORT_OVER_CURRENT 3
197#define UHF_PORT_RESET 4
198#define UHF_PORT_LINK_STATE 5
199#define UHF_PORT_POWER 8
200#define UHF_PORT_LOW_SPEED 9
201#define UHF_C_PORT_CONNECTION 16
202#define UHF_C_PORT_ENABLE 17
203#define UHF_C_PORT_SUSPEND 18
204#define UHF_C_PORT_OVER_CURRENT 19
205#define UHF_C_PORT_RESET 20
206#define UHF_PORT_TEST 21
207#define UHF_PORT_INDICATOR 22
208
209/* SuperSpeed HUB specific features */
210#define UHF_PORT_U1_TIMEOUT 23
211#define UHF_PORT_U2_TIMEOUT 24
212#define UHF_C_PORT_LINK_STATE 25
213#define UHF_C_PORT_CONFIG_ERROR 26
214#define UHF_PORT_REMOTE_WAKE_MASK 27
215#define UHF_BH_PORT_RESET 28
216#define UHF_C_BH_PORT_RESET 29
217#define UHF_FORCE_LINKPM_ACCEPT 30
218
219struct usb2_descriptor {
220 uByte bLength;
221 uByte bDescriptorType;
222 uByte bDescriptorSubtype;
223} __packed;
224
225struct usb2_device_descriptor {
226 uByte bLength;
227 uByte bDescriptorType;
228 uWord bcdUSB;
229#define UD_USB_2_0 0x0200
230#define UD_USB_3_0 0x0300
231#define UD_IS_USB2(d) ((d)->bcdUSB[1] == 0x02)
232#define UD_IS_USB3(d) ((d)->bcdUSB[1] == 0x03)
233 uByte bDeviceClass;
234 uByte bDeviceSubClass;
235 uByte bDeviceProtocol;
236 uByte bMaxPacketSize;
237 /* The fields below are not part of the initial descriptor. */
238 uWord idVendor;
239 uWord idProduct;
240 uWord bcdDevice;
241 uByte iManufacturer;
242 uByte iProduct;
243 uByte iSerialNumber;
244 uByte bNumConfigurations;
245} __packed;
246
247/* Binary Device Object Store (BOS) */
248struct usb2_bos_descriptor {
249 uByte bLength;
250 uByte bDescriptorType;
251 uWord wTotalLength;
252 uByte bNumDeviceCaps;
253} __packed;
254
255/* Binary Device Object Store Capability */
256struct usb2_bos_cap_descriptor {
257 uByte bLength;
258 uByte bDescriptorType;
259 uByte bDevCapabilityType;
260#define USB_DEVCAP_RESERVED 0x00
261#define USB_DEVCAP_WUSB 0x01
262#define USB_DEVCAP_USB2EXT 0x02
263#define USB_DEVCAP_SUPER_SPEED 0x03
264#define USB_DEVCAP_CONTAINER_ID 0x04
265 /* data ... */
266} __packed;
267
268struct usb2_devcap_usb2ext_descriptor {
269 uByte bLength;
270 uByte bDescriptorType;
271 uByte bDevCapabilityType;
272 uByte bmAttributes;
273#define USB_V2EXT_LPM 0x02
274} __packed;
275
276struct usb2_devcap_ss_descriptor {
277 uByte bLength;
278 uByte bDescriptorType;
279 uByte bDevCapabilityType;
280 uByte bmAttributes;
281 uWord wSpeedsSupported;
282 uByte bFunctionaltySupport;
283 uByte bU1DevExitLat;
284 uByte bU2DevExitLat;
285} __packed;
286
287struct usb2_devcap_container_id_descriptor {
288 uByte bLength;
289 uByte bDescriptorType;
290 uByte bDevCapabilityType;
291 uByte bReserved;
292 uByte ContainerID;
293} __packed;
294
295/* Device class codes */
296#define UDCLASS_IN_INTERFACE 0x00
297#define UDCLASS_COMM 0x02
298#define UDCLASS_HUB 0x09
299#define UDSUBCLASS_HUB 0x00
300#define UDPROTO_FSHUB 0x00
301#define UDPROTO_HSHUBSTT 0x01
302#define UDPROTO_HSHUBMTT 0x02
303#define UDCLASS_DIAGNOSTIC 0xdc
304#define UDCLASS_WIRELESS 0xe0
305#define UDSUBCLASS_RF 0x01
306#define UDPROTO_BLUETOOTH 0x01
307#define UDCLASS_VENDOR 0xff
308
309struct usb2_config_descriptor {
310 uByte bLength;
311 uByte bDescriptorType;
312 uWord wTotalLength;
313 uByte bNumInterface;
314 uByte bConfigurationValue;
315#define USB_UNCONFIG_NO 0
316 uByte iConfiguration;
317 uByte bmAttributes;
318#define UC_BUS_POWERED 0x80
319#define UC_SELF_POWERED 0x40
320#define UC_REMOTE_WAKEUP 0x20
321 uByte bMaxPower; /* max current in 2 mA units */
322#define UC_POWER_FACTOR 2
323} __packed;
324
325struct usb2_interface_descriptor {
326 uByte bLength;
327 uByte bDescriptorType;
328 uByte bInterfaceNumber;
329 uByte bAlternateSetting;
330 uByte bNumEndpoints;
331 uByte bInterfaceClass;
332 uByte bInterfaceSubClass;
333 uByte bInterfaceProtocol;
334 uByte iInterface;
335} __packed;
336
337struct usb2_interface_assoc_descriptor {
338 uByte bLength;
339 uByte bDescriptorType;
340 uByte bFirstInterface;
341 uByte bInterfaceCount;
342 uByte bFunctionClass;
343 uByte bFunctionSubClass;
344 uByte bFunctionProtocol;
345 uByte iFunction;
346} __packed;
347
348/* Interface class codes */
349#define UICLASS_UNSPEC 0x00
350#define UICLASS_AUDIO 0x01 /* audio */
351#define UISUBCLASS_AUDIOCONTROL 1
352#define UISUBCLASS_AUDIOSTREAM 2
353#define UISUBCLASS_MIDISTREAM 3
354
355#define UICLASS_CDC 0x02 /* communication */
356#define UISUBCLASS_DIRECT_LINE_CONTROL_MODEL 1
357#define UISUBCLASS_ABSTRACT_CONTROL_MODEL 2
358#define UISUBCLASS_TELEPHONE_CONTROL_MODEL 3
359#define UISUBCLASS_MULTICHANNEL_CONTROL_MODEL 4
360#define UISUBCLASS_CAPI_CONTROLMODEL 5
361#define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6
362#define UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7
363#define UISUBCLASS_WIRELESS_HANDSET_CM 8
364#define UISUBCLASS_DEVICE_MGMT 9
365#define UISUBCLASS_MOBILE_DIRECT_LINE_MODEL 10
366#define UISUBCLASS_OBEX 11
367#define UISUBCLASS_ETHERNET_EMULATION_MODEL 12
368
369#define UIPROTO_CDC_AT 1
370#define UIPROTO_CDC_ETH_512X4 0x76 /* FreeBSD specific */
371
372#define UICLASS_HID 0x03
373#define UISUBCLASS_BOOT 1
374#define UIPROTO_BOOT_KEYBOARD 1
375#define UIPROTO_MOUSE 2
376
377#define UICLASS_PHYSICAL 0x05
378#define UICLASS_IMAGE 0x06
379#define UISUBCLASS_SIC 1 /* still image class */
380#define UICLASS_PRINTER 0x07
381#define UISUBCLASS_PRINTER 1
382#define UIPROTO_PRINTER_UNI 1
383#define UIPROTO_PRINTER_BI 2
384#define UIPROTO_PRINTER_1284 3
385
386#define UICLASS_MASS 0x08
387#define UISUBCLASS_RBC 1
388#define UISUBCLASS_SFF8020I 2
389#define UISUBCLASS_QIC157 3
390#define UISUBCLASS_UFI 4
391#define UISUBCLASS_SFF8070I 5
392#define UISUBCLASS_SCSI 6
393#define UIPROTO_MASS_CBI_I 0
394#define UIPROTO_MASS_CBI 1
395#define UIPROTO_MASS_BBB_OLD 2 /* Not in the spec anymore */
396#define UIPROTO_MASS_BBB 80 /* 'P' for the Iomega Zip drive */
397
398#define UICLASS_HUB 0x09
399#define UISUBCLASS_HUB 0
400#define UIPROTO_FSHUB 0
401#define UIPROTO_HSHUBSTT 0 /* Yes, same as previous */
402#define UIPROTO_HSHUBMTT 1
403
404#define UICLASS_CDC_DATA 0x0a
405#define UISUBCLASS_DATA 0
406#define UIPROTO_DATA_ISDNBRI 0x30 /* Physical iface */
407#define UIPROTO_DATA_HDLC 0x31 /* HDLC */
408#define UIPROTO_DATA_TRANSPARENT 0x32 /* Transparent */
409#define UIPROTO_DATA_Q921M 0x50 /* Management for Q921 */
410#define UIPROTO_DATA_Q921 0x51 /* Data for Q921 */
411#define UIPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */
412#define UIPROTO_DATA_V42BIS 0x90 /* Data compression */
413#define UIPROTO_DATA_Q931 0x91 /* Euro-ISDN */
414#define UIPROTO_DATA_V120 0x92 /* V.24 rate adaption */
415#define UIPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */
416#define UIPROTO_DATA_HOST_BASED 0xfd /* Host based driver */
417#define UIPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc. */
418#define UIPROTO_DATA_VENDOR 0xff /* Vendor specific */
419
420#define UICLASS_SMARTCARD 0x0b
421#define UICLASS_FIRM_UPD 0x0c
422#define UICLASS_SECURITY 0x0d
423#define UICLASS_DIAGNOSTIC 0xdc
424#define UICLASS_WIRELESS 0xe0
425#define UISUBCLASS_RF 0x01
426#define UIPROTO_BLUETOOTH 0x01
427
428#define UICLASS_APPL_SPEC 0xfe
429#define UISUBCLASS_FIRMWARE_DOWNLOAD 1
430#define UISUBCLASS_IRDA 2
431#define UIPROTO_IRDA 0
432
433#define UICLASS_VENDOR 0xff
434#define UISUBCLASS_XBOX360_CONTROLLER 0x5d
435#define UIPROTO_XBOX360_GAMEPAD 0x01
436
437struct usb2_endpoint_descriptor {
438 uByte bLength;
439 uByte bDescriptorType;
440 uByte bEndpointAddress;
441#define UE_GET_DIR(a) ((a) & 0x80)
442#define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7))
443#define UE_DIR_IN 0x80
444#define UE_DIR_OUT 0x00
445#define UE_DIR_ANY 0xff /* for internal use only! */
446#define UE_ADDR 0x0f
447#define UE_ADDR_ANY 0xff /* for internal use only! */
448#define UE_GET_ADDR(a) ((a) & UE_ADDR)
449 uByte bmAttributes;
450#define UE_XFERTYPE 0x03
451#define UE_CONTROL 0x00
452#define UE_ISOCHRONOUS 0x01
453#define UE_BULK 0x02
454#define UE_INTERRUPT 0x03
455#define UE_BULK_INTR 0xfe /* for internal use only! */
456#define UE_TYPE_ANY 0xff /* for internal use only! */
457#define UE_GET_XFERTYPE(a) ((a) & UE_XFERTYPE)
458#define UE_ISO_TYPE 0x0c
459#define UE_ISO_ASYNC 0x04
460#define UE_ISO_ADAPT 0x08
461#define UE_ISO_SYNC 0x0c
462#define UE_GET_ISO_TYPE(a) ((a) & UE_ISO_TYPE)
463 uWord wMaxPacketSize;
464#define UE_ZERO_MPS 0xFFFF /* for internal use only */
465 uByte bInterval;
466} __packed;
467
468struct usb2_endpoint_ss_comp_descriptor {
469 uByte bLength;
470 uByte bDescriptorType;
471 uWord bMaxBurst;
472 uByte bmAttributes;
473 uWord wBytesPerInterval;
474} __packed;
475
476struct usb2_string_descriptor {
477 uByte bLength;
478 uByte bDescriptorType;
479 uWord bString[126];
480 uByte bUnused;
481} __packed;
482
483#define USB_MAKE_STRING_DESC(m,name) \
484struct name { \
485 uByte bLength; \
486 uByte bDescriptorType; \
487 uByte bData[sizeof((uint8_t []){m})]; \
488} __packed; \
489static const struct name name = { \
490 .bLength = sizeof(struct name), \
491 .bDescriptorType = UDESC_STRING, \
492 .bData = { m }, \
493}
494
495struct usb2_hub_descriptor {
496 uByte bDescLength;
497 uByte bDescriptorType;
498 uByte bNbrPorts;
499 uWord wHubCharacteristics;
500#define UHD_PWR 0x0003
501#define UHD_PWR_GANGED 0x0000
502#define UHD_PWR_INDIVIDUAL 0x0001
503#define UHD_PWR_NO_SWITCH 0x0002
504#define UHD_COMPOUND 0x0004
505#define UHD_OC 0x0018
506#define UHD_OC_GLOBAL 0x0000
507#define UHD_OC_INDIVIDUAL 0x0008
508#define UHD_OC_NONE 0x0010
509#define UHD_TT_THINK 0x0060
510#define UHD_TT_THINK_8 0x0000
511#define UHD_TT_THINK_16 0x0020
512#define UHD_TT_THINK_24 0x0040
513#define UHD_TT_THINK_32 0x0060
514#define UHD_PORT_IND 0x0080
515 uByte bPwrOn2PwrGood; /* delay in 2 ms units */
516#define UHD_PWRON_FACTOR 2
517 uByte bHubContrCurrent;
518 uByte DeviceRemovable[32]; /* max 255 ports */
519#define UHD_NOT_REMOV(desc, i) \
520 (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1)
521 uByte PortPowerCtrlMask[1]; /* deprecated */
522} __packed;
523
524struct usb2_hub_ss_descriptor {
525 uByte bDescLength;
526 uByte bDescriptorType;
527 uByte bNbrPorts; /* max 15 */
528 uWord wHubCharacteristics;
529 uByte bPwrOn2PwrGood; /* delay in 2 ms units */
530 uByte bHubContrCurrent;
531 uByte bHubHdrDecLat;
532 uWord wHubDelay;
533 uByte DeviceRemovable[2]; /* max 15 ports */
534} __packed;
535
536/* minimum HUB descriptor (8-ports maximum) */
537struct usb2_hub_descriptor_min {
538 uByte bDescLength;
539 uByte bDescriptorType;
540 uByte bNbrPorts;
541 uWord wHubCharacteristics;
542 uByte bPwrOn2PwrGood;
543 uByte bHubContrCurrent;
544 uByte DeviceRemovable[1];
545 uByte PortPowerCtrlMask[1];
546} __packed;
547
548struct usb2_device_qualifier {
549 uByte bLength;
550 uByte bDescriptorType;
551 uWord bcdUSB;
552 uByte bDeviceClass;
553 uByte bDeviceSubClass;
554 uByte bDeviceProtocol;
555 uByte bMaxPacketSize0;
556 uByte bNumConfigurations;
557 uByte bReserved;
558} __packed;
559
560struct usb2_otg_descriptor {
561 uByte bLength;
562 uByte bDescriptorType;
563 uByte bmAttributes;
564#define UOTG_SRP 0x01
565#define UOTG_HNP 0x02
566} __packed;
567
568/* OTG feature selectors */
569#define UOTG_B_HNP_ENABLE 3
570#define UOTG_A_HNP_SUPPORT 4
571#define UOTG_A_ALT_HNP_SUPPORT 5
572
573struct usb2_status {
574 uWord wStatus;
575/* Device status flags */
576#define UDS_SELF_POWERED 0x0001
577#define UDS_REMOTE_WAKEUP 0x0002
578/* Endpoint status flags */
579#define UES_HALT 0x0001
580} __packed;
581
582struct usb2_hub_status {
583 uWord wHubStatus;
584#define UHS_LOCAL_POWER 0x0001
585#define UHS_OVER_CURRENT 0x0002
586 uWord wHubChange;
587} __packed;
588
589struct usb2_port_status {
590 uWord wPortStatus;
591#define UPS_CURRENT_CONNECT_STATUS 0x0001
592#define UPS_PORT_ENABLED 0x0002
593#define UPS_SUSPEND 0x0004
594#define UPS_OVERCURRENT_INDICATOR 0x0008
595#define UPS_RESET 0x0010
596#define UPS_PORT_MODE_DEVICE 0x0020 /* currently FreeBSD specific */
597#define UPS_PORT_POWER 0x0100
598#define UPS_LOW_SPEED 0x0200
599#define UPS_HIGH_SPEED 0x0400
600#define UPS_PORT_TEST 0x0800
601#define UPS_PORT_INDICATOR 0x1000
602 uWord wPortChange;
603#define UPS_C_CONNECT_STATUS 0x0001
604#define UPS_C_PORT_ENABLED 0x0002
605#define UPS_C_SUSPEND 0x0004
606#define UPS_C_OVERCURRENT_INDICATOR 0x0008
607#define UPS_C_PORT_RESET 0x0010
608} __packed;
609
610#endif /* _USB2_STANDARD_H_ */