1184610Salfred/* $FreeBSD: stable/11/sys/dev/usb/usb.h 359317 2020-03-26 05:37:50Z hselasky $ */
2184610Salfred/*-
3184610Salfred * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4184610Salfred * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
5184610Salfred * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
6184610Salfred *
7184610Salfred * Redistribution and use in source and binary forms, with or without
8184610Salfred * modification, are permitted provided that the following conditions
9184610Salfred * are met:
10184610Salfred * 1. Redistributions of source code must retain the above copyright
11184610Salfred *    notice, this list of conditions and the following disclaimer.
12184610Salfred * 2. Redistributions in binary form must reproduce the above copyright
13184610Salfred *    notice, this list of conditions and the following disclaimer in the
14184610Salfred *    documentation and/or other materials provided with the distribution.
15184610Salfred *
16184610Salfred * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17184610Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18184610Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19184610Salfred * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20184610Salfred * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21184610Salfred * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22184610Salfred * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23184610Salfred * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24184610Salfred * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25184610Salfred * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26184610Salfred * SUCH DAMAGE.
27184610Salfred */
28184610Salfred
29185290Salfred/*
30185290Salfred * This file contains standard definitions for the following USB
31185290Salfred * protocol versions:
32185290Salfred *
33185290Salfred * USB v1.0
34185290Salfred * USB v1.1
35185290Salfred * USB v2.0
36185290Salfred * USB v3.0
37185290Salfred */
38185290Salfred
39194230Sthompsa#ifndef _USB_STANDARD_H_
40194230Sthompsa#define	_USB_STANDARD_H_
41184610Salfred
42194677Sthompsa#if defined(_KERNEL)
43246122Shselasky#ifndef USB_GLOBAL_INCLUDE_FILE
44194677Sthompsa#include "opt_usb.h"
45246122Shselasky#endif
46194677Sthompsa
47194677Sthompsa/* Declare parent SYSCTL USB node. */
48194677Sthompsa#ifdef SYSCTL_DECL
49194677SthompsaSYSCTL_DECL(_hw_usb);
50194677Sthompsa#endif
51194677Sthompsa
52246122Shselasky#ifndef USB_GLOBAL_INCLUDE_FILE
53194677Sthompsa#include <sys/malloc.h>
54246122Shselasky#endif
55194677Sthompsa
56194677SthompsaMALLOC_DECLARE(M_USB);
57194677SthompsaMALLOC_DECLARE(M_USBDEV);
58194677Sthompsa#endif /* _KERNEL */
59194677Sthompsa
60246122Shselasky#ifndef USB_GLOBAL_INCLUDE_FILE
61188942Sthompsa#include <dev/usb/usb_endian.h>
62194677Sthompsa#include <dev/usb/usb_freebsd.h>
63246122Shselasky#endif
64184610Salfred
65194677Sthompsa#define	USB_STACK_VERSION 2000		/* 2.0 */
66194677Sthompsa
67194677Sthompsa/* Definition of some hardcoded USB constants. */
68194677Sthompsa
69194677Sthompsa#define	USB_MAX_IPACKET		8	/* initial USB packet size */
70194677Sthompsa#define	USB_EP_MAX (2*16)		/* hardcoded */
71194677Sthompsa#define	USB_ROOT_HUB_ADDR 1		/* index */
72194677Sthompsa#define	USB_MIN_DEVICES 2		/* unused + root HUB */
73194677Sthompsa#define	USB_UNCONFIG_INDEX 0xFF		/* internal use only */
74194677Sthompsa#define	USB_IFACE_INDEX_ANY 0xFF	/* internal use only */
75194677Sthompsa#define	USB_START_ADDR 0		/* default USB device BUS address
76194677Sthompsa					 * after USB bus reset */
77194677Sthompsa#define	USB_CONTROL_ENDPOINT 0		/* default control endpoint */
78194677Sthompsa
79194677Sthompsa#define	USB_FRAMES_PER_SECOND_FS 1000	/* full speed */
80194677Sthompsa#define	USB_FRAMES_PER_SECOND_HS 8000	/* high speed */
81194677Sthompsa
82194677Sthompsa#define	USB_FS_BYTES_PER_HS_UFRAME 188	/* bytes */
83194677Sthompsa#define	USB_HS_MICRO_FRAMES_MAX 8	/* units */
84194677Sthompsa
85194677Sthompsa#define	USB_ISOC_TIME_MAX 128		/* ms */
86194677Sthompsa
87184610Salfred/*
88184610Salfred * Minimum time a device needs to be powered down to go through a
89184610Salfred * power cycle. These values are not in the USB specification.
90184610Salfred */
91184610Salfred#define	USB_POWER_DOWN_TIME	200	/* ms */
92184610Salfred#define	USB_PORT_POWER_DOWN_TIME	100	/* ms */
93184610Salfred
94186730Salfred/* Definition of software USB power modes */
95186730Salfred#define	USB_POWER_MODE_OFF 0		/* turn off device */
96186730Salfred#define	USB_POWER_MODE_ON 1		/* always on */
97186730Salfred#define	USB_POWER_MODE_SAVE 2		/* automatic suspend and resume */
98186730Salfred#define	USB_POWER_MODE_SUSPEND 3	/* force suspend */
99186730Salfred#define	USB_POWER_MODE_RESUME 4		/* force resume */
100186730Salfred
101184610Salfred/* These are the values from the USB specification. */
102241987Shselasky#define	USB_PORT_RESET_DELAY_SPEC	10	/* ms */
103241987Shselasky#define	USB_PORT_ROOT_RESET_DELAY_SPEC	50	/* ms */
104241987Shselasky#define	USB_PORT_RESET_RECOVERY_SPEC	10	/* ms */
105241987Shselasky#define	USB_PORT_POWERUP_DELAY_SPEC	100	/* ms */
106241987Shselasky#define	USB_PORT_RESUME_DELAY_SPEC	20	/* ms */
107241987Shselasky#define	USB_SET_ADDRESS_SETTLE_SPEC	2	/* ms */
108241987Shselasky#define	USB_RESUME_DELAY_SPEC		(20*5)	/* ms */
109241987Shselasky#define	USB_RESUME_WAIT_SPEC		10	/* ms */
110241987Shselasky#define	USB_RESUME_RECOVERY_SPEC	10	/* ms */
111241987Shselasky#define	USB_EXTRA_POWER_UP_TIME_SPEC	0	/* ms */
112241987Shselasky
113184610Salfred/* Allow for marginal and non-conforming devices. */
114241987Shselasky#define	USB_PORT_RESET_DELAY		50	/* ms */
115273456Shselasky#define	USB_PORT_ROOT_RESET_DELAY	200	/* ms */
116241987Shselasky#define	USB_PORT_RESET_RECOVERY		250	/* ms */
117241987Shselasky#define	USB_PORT_POWERUP_DELAY		300	/* ms */
118241987Shselasky#define	USB_PORT_RESUME_DELAY		(20*2)	/* ms */
119241987Shselasky#define	USB_SET_ADDRESS_SETTLE		10	/* ms */
120241987Shselasky#define	USB_RESUME_DELAY		(50*5)	/* ms */
121241987Shselasky#define	USB_RESUME_WAIT			50	/* ms */
122241987Shselasky#define	USB_RESUME_RECOVERY		50	/* ms */
123241987Shselasky#define	USB_EXTRA_POWER_UP_TIME		20	/* ms */
124184610Salfred
125184610Salfred#define	USB_MIN_POWER		100	/* mA */
126184610Salfred#define	USB_MAX_POWER		500	/* mA */
127184610Salfred
128184610Salfred#define	USB_BUS_RESET_DELAY	100	/* ms */
129184610Salfred
130184610Salfred/*
131184610Salfred * USB record layout in memory:
132184610Salfred *
133184610Salfred * - USB config 0
134184610Salfred *   - USB interfaces
135184610Salfred *     - USB alternative interfaces
136193644Sthompsa *       - USB endpoints
137184610Salfred *
138184610Salfred * - USB config 1
139184610Salfred *   - USB interfaces
140184610Salfred *     - USB alternative interfaces
141193644Sthompsa *       - USB endpoints
142184610Salfred */
143184610Salfred
144184610Salfred/* Declaration of USB records */
145184610Salfred
146192984Sthompsastruct usb_device_request {
147184610Salfred	uByte	bmRequestType;
148184610Salfred	uByte	bRequest;
149184610Salfred	uWord	wValue;
150184610Salfred	uWord	wIndex;
151184610Salfred	uWord	wLength;
152184610Salfred} __packed;
153192984Sthompsatypedef struct usb_device_request usb_device_request_t;
154184610Salfred
155184610Salfred#define	UT_WRITE		0x00
156184610Salfred#define	UT_READ			0x80
157184610Salfred#define	UT_STANDARD		0x00
158184610Salfred#define	UT_CLASS		0x20
159184610Salfred#define	UT_VENDOR		0x40
160184610Salfred#define	UT_DEVICE		0x00
161184610Salfred#define	UT_INTERFACE		0x01
162184610Salfred#define	UT_ENDPOINT		0x02
163184610Salfred#define	UT_OTHER		0x03
164184610Salfred
165184610Salfred#define	UT_READ_DEVICE		(UT_READ  | UT_STANDARD | UT_DEVICE)
166184610Salfred#define	UT_READ_INTERFACE	(UT_READ  | UT_STANDARD | UT_INTERFACE)
167184610Salfred#define	UT_READ_ENDPOINT	(UT_READ  | UT_STANDARD | UT_ENDPOINT)
168184610Salfred#define	UT_WRITE_DEVICE		(UT_WRITE | UT_STANDARD | UT_DEVICE)
169184610Salfred#define	UT_WRITE_INTERFACE	(UT_WRITE | UT_STANDARD | UT_INTERFACE)
170184610Salfred#define	UT_WRITE_ENDPOINT	(UT_WRITE | UT_STANDARD | UT_ENDPOINT)
171184610Salfred#define	UT_READ_CLASS_DEVICE	(UT_READ  | UT_CLASS | UT_DEVICE)
172184610Salfred#define	UT_READ_CLASS_INTERFACE	(UT_READ  | UT_CLASS | UT_INTERFACE)
173184610Salfred#define	UT_READ_CLASS_OTHER	(UT_READ  | UT_CLASS | UT_OTHER)
174184610Salfred#define	UT_READ_CLASS_ENDPOINT	(UT_READ  | UT_CLASS | UT_ENDPOINT)
175184610Salfred#define	UT_WRITE_CLASS_DEVICE	(UT_WRITE | UT_CLASS | UT_DEVICE)
176184610Salfred#define	UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE)
177184610Salfred#define	UT_WRITE_CLASS_OTHER	(UT_WRITE | UT_CLASS | UT_OTHER)
178184610Salfred#define	UT_WRITE_CLASS_ENDPOINT	(UT_WRITE | UT_CLASS | UT_ENDPOINT)
179184610Salfred#define	UT_READ_VENDOR_DEVICE	(UT_READ  | UT_VENDOR | UT_DEVICE)
180184610Salfred#define	UT_READ_VENDOR_INTERFACE (UT_READ  | UT_VENDOR | UT_INTERFACE)
181184610Salfred#define	UT_READ_VENDOR_OTHER	(UT_READ  | UT_VENDOR | UT_OTHER)
182184610Salfred#define	UT_READ_VENDOR_ENDPOINT	(UT_READ  | UT_VENDOR | UT_ENDPOINT)
183184610Salfred#define	UT_WRITE_VENDOR_DEVICE	(UT_WRITE | UT_VENDOR | UT_DEVICE)
184184610Salfred#define	UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE)
185184610Salfred#define	UT_WRITE_VENDOR_OTHER	(UT_WRITE | UT_VENDOR | UT_OTHER)
186184610Salfred#define	UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT)
187184610Salfred
188184610Salfred/* Requests */
189184610Salfred#define	UR_GET_STATUS		0x00
190184610Salfred#define	UR_CLEAR_FEATURE	0x01
191184610Salfred#define	UR_SET_FEATURE		0x03
192184610Salfred#define	UR_SET_ADDRESS		0x05
193184610Salfred#define	UR_GET_DESCRIPTOR	0x06
194184610Salfred#define	UDESC_DEVICE		0x01
195184610Salfred#define	UDESC_CONFIG		0x02
196184610Salfred#define	UDESC_STRING		0x03
197185290Salfred#define	USB_LANGUAGE_TABLE	0x00	/* language ID string index */
198185290Salfred#define	UDESC_INTERFACE		0x04
199184610Salfred#define	UDESC_ENDPOINT		0x05
200184610Salfred#define	UDESC_DEVICE_QUALIFIER	0x06
201184610Salfred#define	UDESC_OTHER_SPEED_CONFIGURATION 0x07
202184610Salfred#define	UDESC_INTERFACE_POWER	0x08
203184610Salfred#define	UDESC_OTG		0x09
204185290Salfred#define	UDESC_DEBUG		0x0A
205185290Salfred#define	UDESC_IFACE_ASSOC	0x0B	/* interface association */
206185290Salfred#define	UDESC_BOS		0x0F	/* binary object store */
207185290Salfred#define	UDESC_DEVICE_CAPABILITY	0x10
208185290Salfred#define	UDESC_CS_DEVICE		0x21	/* class specific */
209185290Salfred#define	UDESC_CS_CONFIG		0x22
210185290Salfred#define	UDESC_CS_STRING		0x23
211184610Salfred#define	UDESC_CS_INTERFACE	0x24
212184610Salfred#define	UDESC_CS_ENDPOINT	0x25
213184610Salfred#define	UDESC_HUB		0x29
214213427Shselasky#define	UDESC_SS_HUB		0x2A	/* super speed */
215185290Salfred#define	UDESC_ENDPOINT_SS_COMP	0x30	/* super speed */
216184610Salfred#define	UR_SET_DESCRIPTOR	0x07
217184610Salfred#define	UR_GET_CONFIG		0x08
218184610Salfred#define	UR_SET_CONFIG		0x09
219184610Salfred#define	UR_GET_INTERFACE	0x0a
220184610Salfred#define	UR_SET_INTERFACE	0x0b
221184610Salfred#define	UR_SYNCH_FRAME		0x0c
222185290Salfred#define	UR_SET_SEL		0x30
223185290Salfred#define	UR_ISOCH_DELAY		0x31
224184610Salfred
225184610Salfred/* HUB specific request */
226184610Salfred#define	UR_GET_BUS_STATE	0x02
227184610Salfred#define	UR_CLEAR_TT_BUFFER	0x08
228184610Salfred#define	UR_RESET_TT		0x09
229184610Salfred#define	UR_GET_TT_STATE		0x0a
230184610Salfred#define	UR_STOP_TT		0x0b
231233771Shselasky#define	UR_SET_AND_TEST		0x0c	/* USB 2.0 only */
232233771Shselasky#define	UR_SET_HUB_DEPTH	0x0c	/* USB 3.0 only */
233213427Shselasky#define	USB_SS_HUB_DEPTH_MAX	5
234185290Salfred#define	UR_GET_PORT_ERR_COUNT	0x0d
235184610Salfred
236184610Salfred/* Feature numbers */
237184610Salfred#define	UF_ENDPOINT_HALT	0
238184610Salfred#define	UF_DEVICE_REMOTE_WAKEUP	1
239184610Salfred#define	UF_TEST_MODE		2
240185290Salfred#define	UF_U1_ENABLE		0x30
241185290Salfred#define	UF_U2_ENABLE		0x31
242185290Salfred#define	UF_LTM_ENABLE		0x32
243184610Salfred
244184610Salfred/* HUB specific features */
245184610Salfred#define	UHF_C_HUB_LOCAL_POWER	0
246184610Salfred#define	UHF_C_HUB_OVER_CURRENT	1
247184610Salfred#define	UHF_PORT_CONNECTION	0
248184610Salfred#define	UHF_PORT_ENABLE		1
249184610Salfred#define	UHF_PORT_SUSPEND	2
250184610Salfred#define	UHF_PORT_OVER_CURRENT	3
251184610Salfred#define	UHF_PORT_RESET		4
252185290Salfred#define	UHF_PORT_LINK_STATE	5
253184610Salfred#define	UHF_PORT_POWER		8
254184610Salfred#define	UHF_PORT_LOW_SPEED	9
255233771Shselasky#define	UHF_PORT_L1		10
256184610Salfred#define	UHF_C_PORT_CONNECTION	16
257184610Salfred#define	UHF_C_PORT_ENABLE	17
258184610Salfred#define	UHF_C_PORT_SUSPEND	18
259184610Salfred#define	UHF_C_PORT_OVER_CURRENT	19
260184610Salfred#define	UHF_C_PORT_RESET	20
261184610Salfred#define	UHF_PORT_TEST		21
262184610Salfred#define	UHF_PORT_INDICATOR	22
263233771Shselasky#define	UHF_C_PORT_L1		23
264184610Salfred
265185290Salfred/* SuperSpeed HUB specific features */
266185290Salfred#define	UHF_PORT_U1_TIMEOUT	23
267185290Salfred#define	UHF_PORT_U2_TIMEOUT	24
268185290Salfred#define	UHF_C_PORT_LINK_STATE	25
269185290Salfred#define	UHF_C_PORT_CONFIG_ERROR	26
270185290Salfred#define	UHF_PORT_REMOTE_WAKE_MASK	27
271185290Salfred#define	UHF_BH_PORT_RESET	28
272185290Salfred#define	UHF_C_BH_PORT_RESET	29
273185290Salfred#define	UHF_FORCE_LINKPM_ACCEPT	30
274185290Salfred
275359317Shselasky/* SuperSpeed suspend support */
276359317Shselasky#define	USB_INTERFACE_FUNC_SUSPEND 0
277359317Shselasky#define	USB_INTERFACE_FUNC_SUSPEND_LP	(1 << 8)
278359317Shselasky#define	USB_INTERFACE_FUNC_SUSPEND_RW	(1 << 9)
279359317Shselasky
280192984Sthompsastruct usb_descriptor {
281184610Salfred	uByte	bLength;
282184610Salfred	uByte	bDescriptorType;
283184610Salfred	uByte	bDescriptorSubtype;
284184610Salfred} __packed;
285192984Sthompsatypedef struct usb_descriptor usb_descriptor_t;
286184610Salfred
287192984Sthompsastruct usb_device_descriptor {
288184610Salfred	uByte	bLength;
289184610Salfred	uByte	bDescriptorType;
290184610Salfred	uWord	bcdUSB;
291184610Salfred#define	UD_USB_2_0		0x0200
292185290Salfred#define	UD_USB_3_0		0x0300
293185290Salfred#define	UD_IS_USB2(d) ((d)->bcdUSB[1] == 0x02)
294185290Salfred#define	UD_IS_USB3(d) ((d)->bcdUSB[1] == 0x03)
295184610Salfred	uByte	bDeviceClass;
296184610Salfred	uByte	bDeviceSubClass;
297184610Salfred	uByte	bDeviceProtocol;
298184610Salfred	uByte	bMaxPacketSize;
299184610Salfred	/* The fields below are not part of the initial descriptor. */
300184610Salfred	uWord	idVendor;
301184610Salfred	uWord	idProduct;
302184610Salfred	uWord	bcdDevice;
303184610Salfred	uByte	iManufacturer;
304184610Salfred	uByte	iProduct;
305184610Salfred	uByte	iSerialNumber;
306184610Salfred	uByte	bNumConfigurations;
307184610Salfred} __packed;
308192984Sthompsatypedef struct usb_device_descriptor usb_device_descriptor_t;
309184610Salfred
310185290Salfred/* Binary Device Object Store (BOS) */
311192984Sthompsastruct usb_bos_descriptor {
312185290Salfred	uByte	bLength;
313185290Salfred	uByte	bDescriptorType;
314185290Salfred	uWord	wTotalLength;
315185290Salfred	uByte	bNumDeviceCaps;
316185290Salfred} __packed;
317192984Sthompsatypedef struct usb_bos_descriptor usb_bos_descriptor_t;
318185290Salfred
319185290Salfred/* Binary Device Object Store Capability */
320192984Sthompsastruct usb_bos_cap_descriptor {
321185290Salfred	uByte	bLength;
322185290Salfred	uByte	bDescriptorType;
323185290Salfred	uByte	bDevCapabilityType;
324185290Salfred#define	USB_DEVCAP_RESERVED	0x00
325185290Salfred#define	USB_DEVCAP_WUSB		0x01
326185290Salfred#define	USB_DEVCAP_USB2EXT	0x02
327185290Salfred#define	USB_DEVCAP_SUPER_SPEED	0x03
328185290Salfred#define	USB_DEVCAP_CONTAINER_ID	0x04
329185290Salfred	/* data ... */
330185290Salfred} __packed;
331192984Sthompsatypedef struct usb_bos_cap_descriptor usb_bos_cap_descriptor_t;
332185290Salfred
333192984Sthompsastruct usb_devcap_usb2ext_descriptor {
334185290Salfred	uByte	bLength;
335185290Salfred	uByte	bDescriptorType;
336185290Salfred	uByte	bDevCapabilityType;
337227401Shselasky	uDWord	bmAttributes;
338233771Shselasky#define	USB_V2EXT_LPM (1U << 1)
339233771Shselasky#define	USB_V2EXT_BESL_SUPPORTED (1U << 2)
340233771Shselasky#define	USB_V2EXT_BESL_BASELINE_VALID (1U << 3)
341233771Shselasky#define	USB_V2EXT_BESL_DEEP_VALID (1U << 4)
342233771Shselasky#define	USB_V2EXT_BESL_BASELINE_GET(x) (((x) >> 8) & 0xF)
343233771Shselasky#define	USB_V2EXT_BESL_DEEP_GET(x) (((x) >> 12) & 0xF)
344185290Salfred} __packed;
345192984Sthompsatypedef struct usb_devcap_usb2ext_descriptor usb_devcap_usb2ext_descriptor_t;
346185290Salfred
347192984Sthompsastruct usb_devcap_ss_descriptor {
348185290Salfred	uByte	bLength;
349185290Salfred	uByte	bDescriptorType;
350185290Salfred	uByte	bDevCapabilityType;
351185290Salfred	uByte	bmAttributes;
352185290Salfred	uWord	wSpeedsSupported;
353213427Shselasky	uByte	bFunctionalitySupport;
354185290Salfred	uByte	bU1DevExitLat;
355227396Shselasky	uWord	wU2DevExitLat;
356185290Salfred} __packed;
357192984Sthompsatypedef struct usb_devcap_ss_descriptor usb_devcap_ss_descriptor_t;
358185290Salfred
359192984Sthompsastruct usb_devcap_container_id_descriptor {
360185290Salfred	uByte	bLength;
361185290Salfred	uByte	bDescriptorType;
362185290Salfred	uByte	bDevCapabilityType;
363185290Salfred	uByte	bReserved;
364213427Shselasky	uByte	bContainerID;
365185290Salfred} __packed;
366192984Sthompsatypedef struct usb_devcap_container_id_descriptor
367188947Sthompsa		usb_devcap_container_id_descriptor_t;
368185290Salfred
369184610Salfred/* Device class codes */
370184610Salfred#define	UDCLASS_IN_INTERFACE	0x00
371184610Salfred#define	UDCLASS_COMM		0x02
372184610Salfred#define	UDCLASS_HUB		0x09
373184610Salfred#define	UDSUBCLASS_HUB		0x00
374184610Salfred#define	UDPROTO_FSHUB		0x00
375184610Salfred#define	UDPROTO_HSHUBSTT	0x01
376184610Salfred#define	UDPROTO_HSHUBMTT	0x02
377213427Shselasky#define	UDPROTO_SSHUB		0x03
378184610Salfred#define	UDCLASS_DIAGNOSTIC	0xdc
379184610Salfred#define	UDCLASS_WIRELESS	0xe0
380184610Salfred#define	UDSUBCLASS_RF		0x01
381184610Salfred#define	UDPROTO_BLUETOOTH	0x01
382184610Salfred#define	UDCLASS_VENDOR		0xff
383184610Salfred
384192984Sthompsastruct usb_config_descriptor {
385184610Salfred	uByte	bLength;
386184610Salfred	uByte	bDescriptorType;
387184610Salfred	uWord	wTotalLength;
388184610Salfred	uByte	bNumInterface;
389184610Salfred	uByte	bConfigurationValue;
390184610Salfred#define	USB_UNCONFIG_NO 0
391184610Salfred	uByte	iConfiguration;
392184610Salfred	uByte	bmAttributes;
393184610Salfred#define	UC_BUS_POWERED		0x80
394184610Salfred#define	UC_SELF_POWERED		0x40
395184610Salfred#define	UC_REMOTE_WAKEUP	0x20
396184610Salfred	uByte	bMaxPower;		/* max current in 2 mA units */
397184610Salfred#define	UC_POWER_FACTOR 2
398184610Salfred} __packed;
399192984Sthompsatypedef struct usb_config_descriptor usb_config_descriptor_t;
400184610Salfred
401192984Sthompsastruct usb_interface_descriptor {
402184610Salfred	uByte	bLength;
403184610Salfred	uByte	bDescriptorType;
404184610Salfred	uByte	bInterfaceNumber;
405184610Salfred	uByte	bAlternateSetting;
406184610Salfred	uByte	bNumEndpoints;
407184610Salfred	uByte	bInterfaceClass;
408184610Salfred	uByte	bInterfaceSubClass;
409184610Salfred	uByte	bInterfaceProtocol;
410184610Salfred	uByte	iInterface;
411184610Salfred} __packed;
412192984Sthompsatypedef struct usb_interface_descriptor usb_interface_descriptor_t;
413184610Salfred
414192984Sthompsastruct usb_interface_assoc_descriptor {
415185290Salfred	uByte	bLength;
416185290Salfred	uByte	bDescriptorType;
417185290Salfred	uByte	bFirstInterface;
418185290Salfred	uByte	bInterfaceCount;
419185290Salfred	uByte	bFunctionClass;
420185290Salfred	uByte	bFunctionSubClass;
421185290Salfred	uByte	bFunctionProtocol;
422185290Salfred	uByte	iFunction;
423185290Salfred} __packed;
424192984Sthompsatypedef struct usb_interface_assoc_descriptor usb_interface_assoc_descriptor_t;
425185290Salfred
426184610Salfred/* Interface class codes */
427184610Salfred#define	UICLASS_UNSPEC		0x00
428184610Salfred#define	UICLASS_AUDIO		0x01	/* audio */
429184610Salfred#define	UISUBCLASS_AUDIOCONTROL	1
430184610Salfred#define	UISUBCLASS_AUDIOSTREAM		2
431184610Salfred#define	UISUBCLASS_MIDISTREAM		3
432184610Salfred
433184610Salfred#define	UICLASS_CDC		0x02	/* communication */
434184610Salfred#define	UISUBCLASS_DIRECT_LINE_CONTROL_MODEL	1
435184610Salfred#define	UISUBCLASS_ABSTRACT_CONTROL_MODEL	2
436184610Salfred#define	UISUBCLASS_TELEPHONE_CONTROL_MODEL	3
437184610Salfred#define	UISUBCLASS_MULTICHANNEL_CONTROL_MODEL	4
438184610Salfred#define	UISUBCLASS_CAPI_CONTROLMODEL		5
439184610Salfred#define	UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6
440184610Salfred#define	UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7
441184610Salfred#define	UISUBCLASS_WIRELESS_HANDSET_CM 8
442184610Salfred#define	UISUBCLASS_DEVICE_MGMT 9
443184610Salfred#define	UISUBCLASS_MOBILE_DIRECT_LINE_MODEL 10
444184610Salfred#define	UISUBCLASS_OBEX 11
445184610Salfred#define	UISUBCLASS_ETHERNET_EMULATION_MODEL 12
446197563Sthompsa#define	UISUBCLASS_NETWORK_CONTROL_MODEL 13
447184610Salfred
448257446Sadrian#define	UIPROTO_CDC_NONE		0
449184610Salfred#define	UIPROTO_CDC_AT			1
450184610Salfred
451184610Salfred#define	UICLASS_HID		0x03
452184610Salfred#define	UISUBCLASS_BOOT		1
453184610Salfred#define	UIPROTO_BOOT_KEYBOARD	1
454184610Salfred#define	UIPROTO_MOUSE		2
455184610Salfred
456184610Salfred#define	UICLASS_PHYSICAL	0x05
457184610Salfred#define	UICLASS_IMAGE		0x06
458184610Salfred#define	UISUBCLASS_SIC		1	/* still image class */
459184610Salfred#define	UICLASS_PRINTER		0x07
460184610Salfred#define	UISUBCLASS_PRINTER	1
461184610Salfred#define	UIPROTO_PRINTER_UNI	1
462184610Salfred#define	UIPROTO_PRINTER_BI	2
463184610Salfred#define	UIPROTO_PRINTER_1284	3
464184610Salfred
465184610Salfred#define	UICLASS_MASS		0x08
466184610Salfred#define	UISUBCLASS_RBC		1
467184610Salfred#define	UISUBCLASS_SFF8020I	2
468184610Salfred#define	UISUBCLASS_QIC157	3
469184610Salfred#define	UISUBCLASS_UFI		4
470184610Salfred#define	UISUBCLASS_SFF8070I	5
471184610Salfred#define	UISUBCLASS_SCSI		6
472184610Salfred#define	UIPROTO_MASS_CBI_I	0
473184610Salfred#define	UIPROTO_MASS_CBI	1
474184610Salfred#define	UIPROTO_MASS_BBB_OLD	2	/* Not in the spec anymore */
475184610Salfred#define	UIPROTO_MASS_BBB	80	/* 'P' for the Iomega Zip drive */
476184610Salfred
477184610Salfred#define	UICLASS_HUB		0x09
478184610Salfred#define	UISUBCLASS_HUB		0
479184610Salfred#define	UIPROTO_FSHUB		0
480184610Salfred#define	UIPROTO_HSHUBSTT	0	/* Yes, same as previous */
481184610Salfred#define	UIPROTO_HSHUBMTT	1
482184610Salfred
483184610Salfred#define	UICLASS_CDC_DATA	0x0a
484197563Sthompsa#define	UISUBCLASS_DATA		0x00
485184610Salfred#define	UIPROTO_DATA_ISDNBRI		0x30	/* Physical iface */
486184610Salfred#define	UIPROTO_DATA_HDLC		0x31	/* HDLC */
487184610Salfred#define	UIPROTO_DATA_TRANSPARENT	0x32	/* Transparent */
488184610Salfred#define	UIPROTO_DATA_Q921M		0x50	/* Management for Q921 */
489184610Salfred#define	UIPROTO_DATA_Q921		0x51	/* Data for Q921 */
490184610Salfred#define	UIPROTO_DATA_Q921TM		0x52	/* TEI multiplexer for Q921 */
491184610Salfred#define	UIPROTO_DATA_V42BIS		0x90	/* Data compression */
492184610Salfred#define	UIPROTO_DATA_Q931		0x91	/* Euro-ISDN */
493184610Salfred#define	UIPROTO_DATA_V120		0x92	/* V.24 rate adaption */
494184610Salfred#define	UIPROTO_DATA_CAPI		0x93	/* CAPI 2.0 commands */
495184610Salfred#define	UIPROTO_DATA_HOST_BASED		0xfd	/* Host based driver */
496184610Salfred#define	UIPROTO_DATA_PUF		0xfe	/* see Prot. Unit Func. Desc. */
497184610Salfred#define	UIPROTO_DATA_VENDOR		0xff	/* Vendor specific */
498197563Sthompsa#define	UIPROTO_DATA_NCM		0x01	/* Network Control Model */
499184610Salfred
500184610Salfred#define	UICLASS_SMARTCARD	0x0b
501184610Salfred#define	UICLASS_FIRM_UPD	0x0c
502184610Salfred#define	UICLASS_SECURITY	0x0d
503184610Salfred#define	UICLASS_DIAGNOSTIC	0xdc
504184610Salfred#define	UICLASS_WIRELESS	0xe0
505184610Salfred#define	UISUBCLASS_RF			0x01
506184610Salfred#define	UIPROTO_BLUETOOTH		0x01
507261541Shselasky#define	UIPROTO_RNDIS			0x03
508184610Salfred
509196493Salfred#define	UICLASS_IAD		0xEF	/* Interface Association Descriptor */
510261541Shselasky#define	UISUBCLASS_SYNC			0x01
511261541Shselasky#define	UIPROTO_ACTIVESYNC		0x01
512196493Salfred
513184610Salfred#define	UICLASS_APPL_SPEC	0xfe
514184610Salfred#define	UISUBCLASS_FIRMWARE_DOWNLOAD	1
515184610Salfred#define	UISUBCLASS_IRDA			2
516184610Salfred#define	UIPROTO_IRDA			0
517184610Salfred
518184610Salfred#define	UICLASS_VENDOR		0xff
519184610Salfred#define	UISUBCLASS_XBOX360_CONTROLLER	0x5d
520184610Salfred#define	UIPROTO_XBOX360_GAMEPAD	0x01
521184610Salfred
522192984Sthompsastruct usb_endpoint_descriptor {
523184610Salfred	uByte	bLength;
524184610Salfred	uByte	bDescriptorType;
525184610Salfred	uByte	bEndpointAddress;
526184610Salfred#define	UE_GET_DIR(a)	((a) & 0x80)
527184610Salfred#define	UE_SET_DIR(a,d)	((a) | (((d)&1) << 7))
528190732Sthompsa#define	UE_DIR_IN	0x80		/* IN-token endpoint, fixed */
529190732Sthompsa#define	UE_DIR_OUT	0x00		/* OUT-token endpoint, fixed */
530190732Sthompsa#define	UE_DIR_RX	0xfd		/* for internal use only! */
531190732Sthompsa#define	UE_DIR_TX	0xfe		/* for internal use only! */
532184610Salfred#define	UE_DIR_ANY	0xff		/* for internal use only! */
533184610Salfred#define	UE_ADDR		0x0f
534184610Salfred#define	UE_ADDR_ANY	0xff		/* for internal use only! */
535184610Salfred#define	UE_GET_ADDR(a)	((a) & UE_ADDR)
536184610Salfred	uByte	bmAttributes;
537184610Salfred#define	UE_XFERTYPE	0x03
538184610Salfred#define	UE_CONTROL	0x00
539184610Salfred#define	UE_ISOCHRONOUS	0x01
540184610Salfred#define	UE_BULK	0x02
541184610Salfred#define	UE_INTERRUPT	0x03
542184610Salfred#define	UE_BULK_INTR	0xfe		/* for internal use only! */
543184610Salfred#define	UE_TYPE_ANY	0xff		/* for internal use only! */
544184610Salfred#define	UE_GET_XFERTYPE(a)	((a) & UE_XFERTYPE)
545184610Salfred#define	UE_ISO_TYPE	0x0c
546184610Salfred#define	UE_ISO_ASYNC	0x04
547184610Salfred#define	UE_ISO_ADAPT	0x08
548184610Salfred#define	UE_ISO_SYNC	0x0c
549184610Salfred#define	UE_GET_ISO_TYPE(a)	((a) & UE_ISO_TYPE)
550280598Shselasky#define	UE_ISO_USAGE	0x30
551280598Shselasky#define	UE_ISO_USAGE_DATA	0x00
552280598Shselasky#define	UE_ISO_USAGE_FEEDBACK	0x10
553280598Shselasky#define	UE_ISO_USAGE_IMPLICT_FB	0x20
554280598Shselasky#define	UE_GET_ISO_USAGE(a)	((a) & UE_ISO_USAGE)
555184610Salfred	uWord	wMaxPacketSize;
556184610Salfred#define	UE_ZERO_MPS 0xFFFF		/* for internal use only */
557184610Salfred	uByte	bInterval;
558184610Salfred} __packed;
559192984Sthompsatypedef struct usb_endpoint_descriptor usb_endpoint_descriptor_t;
560184610Salfred
561192984Sthompsastruct usb_endpoint_ss_comp_descriptor {
562185290Salfred	uByte	bLength;
563185290Salfred	uByte	bDescriptorType;
564213427Shselasky	uByte	bMaxBurst;
565185290Salfred	uByte	bmAttributes;
566239214Shselasky#define	UE_GET_BULK_STREAMS(x) ((x) & 0x0F)
567239214Shselasky#define	UE_GET_SS_ISO_MULT(x) ((x) & 0x03)
568185290Salfred	uWord	wBytesPerInterval;
569185290Salfred} __packed;
570192984Sthompsatypedef struct usb_endpoint_ss_comp_descriptor
571188947Sthompsa		usb_endpoint_ss_comp_descriptor_t;
572185290Salfred
573192984Sthompsastruct usb_string_descriptor {
574184610Salfred	uByte	bLength;
575184610Salfred	uByte	bDescriptorType;
576184610Salfred	uWord	bString[126];
577184610Salfred	uByte	bUnused;
578184610Salfred} __packed;
579192984Sthompsatypedef struct usb_string_descriptor usb_string_descriptor_t;
580184610Salfred
581184610Salfred#define	USB_MAKE_STRING_DESC(m,name)	\
582246124Shselaskystatic const struct {			\
583184610Salfred  uByte bLength;			\
584184610Salfred  uByte bDescriptorType;		\
585184610Salfred  uByte bData[sizeof((uint8_t []){m})];	\
586246124Shselasky} __packed name = {			\
587246124Shselasky  .bLength = sizeof(name),		\
588184610Salfred  .bDescriptorType = UDESC_STRING,	\
589184610Salfred  .bData = { m },			\
590184610Salfred}
591184610Salfred
592246123Shselaskystruct usb_string_lang {
593246123Shselasky	uByte bLength;
594246123Shselasky	uByte bDescriptorType;
595246123Shselasky	uByte bData[2];
596246123Shselasky} __packed;
597246123Shselaskytypedef struct usb_string_lang usb_string_lang_t;
598246123Shselasky
599192984Sthompsastruct usb_hub_descriptor {
600184610Salfred	uByte	bDescLength;
601184610Salfred	uByte	bDescriptorType;
602184610Salfred	uByte	bNbrPorts;
603184610Salfred	uWord	wHubCharacteristics;
604184610Salfred#define	UHD_PWR			0x0003
605184610Salfred#define	UHD_PWR_GANGED		0x0000
606184610Salfred#define	UHD_PWR_INDIVIDUAL	0x0001
607184610Salfred#define	UHD_PWR_NO_SWITCH	0x0002
608184610Salfred#define	UHD_COMPOUND		0x0004
609184610Salfred#define	UHD_OC			0x0018
610184610Salfred#define	UHD_OC_GLOBAL		0x0000
611184610Salfred#define	UHD_OC_INDIVIDUAL	0x0008
612184610Salfred#define	UHD_OC_NONE		0x0010
613184610Salfred#define	UHD_TT_THINK		0x0060
614184610Salfred#define	UHD_TT_THINK_8		0x0000
615184610Salfred#define	UHD_TT_THINK_16		0x0020
616184610Salfred#define	UHD_TT_THINK_24		0x0040
617184610Salfred#define	UHD_TT_THINK_32		0x0060
618184610Salfred#define	UHD_PORT_IND		0x0080
619184610Salfred	uByte	bPwrOn2PwrGood;		/* delay in 2 ms units */
620184610Salfred#define	UHD_PWRON_FACTOR 2
621184610Salfred	uByte	bHubContrCurrent;
622184610Salfred	uByte	DeviceRemovable[32];	/* max 255 ports */
623184610Salfred#define	UHD_NOT_REMOV(desc, i) \
624184610Salfred    (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1)
625185290Salfred	uByte	PortPowerCtrlMask[1];	/* deprecated */
626184610Salfred} __packed;
627192984Sthompsatypedef struct usb_hub_descriptor usb_hub_descriptor_t;
628184610Salfred
629192984Sthompsastruct usb_hub_ss_descriptor {
630213427Shselasky	uByte	bLength;
631185290Salfred	uByte	bDescriptorType;
632213427Shselasky	uByte	bNbrPorts;
633185290Salfred	uWord	wHubCharacteristics;
634185290Salfred	uByte	bPwrOn2PwrGood;		/* delay in 2 ms units */
635185290Salfred	uByte	bHubContrCurrent;
636185290Salfred	uByte	bHubHdrDecLat;
637185290Salfred	uWord	wHubDelay;
638213427Shselasky	uByte	DeviceRemovable[32];	/* max 255 ports */
639185290Salfred} __packed;
640192984Sthompsatypedef struct usb_hub_ss_descriptor usb_hub_ss_descriptor_t;
641185290Salfred
642184610Salfred/* minimum HUB descriptor (8-ports maximum) */
643192984Sthompsastruct usb_hub_descriptor_min {
644184610Salfred	uByte	bDescLength;
645184610Salfred	uByte	bDescriptorType;
646184610Salfred	uByte	bNbrPorts;
647184610Salfred	uWord	wHubCharacteristics;
648184610Salfred	uByte	bPwrOn2PwrGood;
649184610Salfred	uByte	bHubContrCurrent;
650184610Salfred	uByte	DeviceRemovable[1];
651184610Salfred	uByte	PortPowerCtrlMask[1];
652184610Salfred} __packed;
653192984Sthompsatypedef struct usb_hub_descriptor_min usb_hub_descriptor_min_t;
654184610Salfred
655192984Sthompsastruct usb_device_qualifier {
656184610Salfred	uByte	bLength;
657184610Salfred	uByte	bDescriptorType;
658184610Salfred	uWord	bcdUSB;
659184610Salfred	uByte	bDeviceClass;
660184610Salfred	uByte	bDeviceSubClass;
661184610Salfred	uByte	bDeviceProtocol;
662184610Salfred	uByte	bMaxPacketSize0;
663184610Salfred	uByte	bNumConfigurations;
664184610Salfred	uByte	bReserved;
665184610Salfred} __packed;
666192984Sthompsatypedef struct usb_device_qualifier usb_device_qualifier_t;
667184610Salfred
668192984Sthompsastruct usb_otg_descriptor {
669184610Salfred	uByte	bLength;
670184610Salfred	uByte	bDescriptorType;
671184610Salfred	uByte	bmAttributes;
672184610Salfred#define	UOTG_SRP	0x01
673184610Salfred#define	UOTG_HNP	0x02
674184610Salfred} __packed;
675192984Sthompsatypedef struct usb_otg_descriptor usb_otg_descriptor_t;
676184610Salfred
677184610Salfred/* OTG feature selectors */
678184610Salfred#define	UOTG_B_HNP_ENABLE	3
679184610Salfred#define	UOTG_A_HNP_SUPPORT	4
680184610Salfred#define	UOTG_A_ALT_HNP_SUPPORT	5
681184610Salfred
682192984Sthompsastruct usb_status {
683184610Salfred	uWord	wStatus;
684184610Salfred/* Device status flags */
685184610Salfred#define	UDS_SELF_POWERED		0x0001
686184610Salfred#define	UDS_REMOTE_WAKEUP		0x0002
687184610Salfred/* Endpoint status flags */
688184610Salfred#define	UES_HALT			0x0001
689184610Salfred} __packed;
690192984Sthompsatypedef struct usb_status usb_status_t;
691184610Salfred
692192984Sthompsastruct usb_hub_status {
693184610Salfred	uWord	wHubStatus;
694184610Salfred#define	UHS_LOCAL_POWER			0x0001
695184610Salfred#define	UHS_OVER_CURRENT		0x0002
696184610Salfred	uWord	wHubChange;
697184610Salfred} __packed;
698192984Sthompsatypedef struct usb_hub_status usb_hub_status_t;
699184610Salfred
700192984Sthompsastruct usb_port_status {
701184610Salfred	uWord	wPortStatus;
702184610Salfred#define	UPS_CURRENT_CONNECT_STATUS	0x0001
703184610Salfred#define	UPS_PORT_ENABLED		0x0002
704184610Salfred#define	UPS_SUSPEND			0x0004
705184610Salfred#define	UPS_OVERCURRENT_INDICATOR	0x0008
706184610Salfred#define	UPS_RESET			0x0010
707233771Shselasky#define	UPS_PORT_L1			0x0020	/* USB 2.0 only */
708213427Shselasky/* The link-state bits are valid for Super-Speed USB HUBs */
709213427Shselasky#define	UPS_PORT_LINK_STATE_GET(x)	(((x) >> 5) & 0xF)
710213427Shselasky#define	UPS_PORT_LINK_STATE_SET(x)	(((x) & 0xF) << 5)
711213427Shselasky#define	UPS_PORT_LS_U0		0x00
712213427Shselasky#define	UPS_PORT_LS_U1		0x01
713213427Shselasky#define	UPS_PORT_LS_U2		0x02
714213427Shselasky#define	UPS_PORT_LS_U3		0x03
715213427Shselasky#define	UPS_PORT_LS_SS_DIS	0x04
716213427Shselasky#define	UPS_PORT_LS_RX_DET	0x05
717213427Shselasky#define	UPS_PORT_LS_SS_INA	0x06
718213427Shselasky#define	UPS_PORT_LS_POLL	0x07
719213427Shselasky#define	UPS_PORT_LS_RECOVER	0x08
720213427Shselasky#define	UPS_PORT_LS_HOT_RST	0x09
721213427Shselasky#define	UPS_PORT_LS_COMP_MODE	0x0A
722213427Shselasky#define	UPS_PORT_LS_LOOPBACK	0x0B
723226803Shselasky#define	UPS_PORT_LS_RESUME	0x0F
724184610Salfred#define	UPS_PORT_POWER			0x0100
725230032Shselasky#define	UPS_PORT_POWER_SS		0x0200	/* super-speed only */
726184610Salfred#define	UPS_LOW_SPEED			0x0200
727184610Salfred#define	UPS_HIGH_SPEED			0x0400
728213427Shselasky#define	UPS_OTHER_SPEED			0x0600	/* currently FreeBSD specific */
729184610Salfred#define	UPS_PORT_TEST			0x0800
730184610Salfred#define	UPS_PORT_INDICATOR		0x1000
731187180Sthompsa#define	UPS_PORT_MODE_DEVICE		0x8000	/* currently FreeBSD specific */
732184610Salfred	uWord	wPortChange;
733184610Salfred#define	UPS_C_CONNECT_STATUS		0x0001
734184610Salfred#define	UPS_C_PORT_ENABLED		0x0002
735184610Salfred#define	UPS_C_SUSPEND			0x0004
736184610Salfred#define	UPS_C_OVERCURRENT_INDICATOR	0x0008
737184610Salfred#define	UPS_C_PORT_RESET		0x0010
738233771Shselasky#define	UPS_C_PORT_L1			0x0020	/* USB 2.0 only */
739233771Shselasky#define	UPS_C_BH_PORT_RESET		0x0020	/* USB 3.0 only */
740213427Shselasky#define	UPS_C_PORT_LINK_STATE		0x0040
741213427Shselasky#define	UPS_C_PORT_CONFIG_ERROR		0x0080
742184610Salfred} __packed;
743192984Sthompsatypedef struct usb_port_status usb_port_status_t;
744184610Salfred
745194677Sthompsa/*
746194677Sthompsa * The "USB_SPEED" macros defines all the supported USB speeds.
747194677Sthompsa */
748194677Sthompsaenum usb_dev_speed {
749194677Sthompsa	USB_SPEED_VARIABLE,
750194677Sthompsa	USB_SPEED_LOW,
751194677Sthompsa	USB_SPEED_FULL,
752194677Sthompsa	USB_SPEED_HIGH,
753194677Sthompsa	USB_SPEED_SUPER,
754194677Sthompsa};
755194677Sthompsa#define	USB_SPEED_MAX	(USB_SPEED_SUPER+1)
756194677Sthompsa
757194677Sthompsa/*
758194677Sthompsa * The "USB_REV" macros defines all the supported USB revisions.
759194677Sthompsa */
760194677Sthompsaenum usb_revision {
761194677Sthompsa	USB_REV_UNKNOWN,
762194677Sthompsa	USB_REV_PRE_1_0,
763194677Sthompsa	USB_REV_1_0,
764194677Sthompsa	USB_REV_1_1,
765194677Sthompsa	USB_REV_2_0,
766194677Sthompsa	USB_REV_2_5,
767194677Sthompsa	USB_REV_3_0
768194677Sthompsa};
769194677Sthompsa#define	USB_REV_MAX	(USB_REV_3_0+1)
770194677Sthompsa
771194677Sthompsa/*
772239214Shselasky * Supported host controller modes.
773194677Sthompsa */
774194677Sthompsaenum usb_hc_mode {
775194677Sthompsa	USB_MODE_HOST,		/* initiates transfers */
776194677Sthompsa	USB_MODE_DEVICE,	/* bus transfer target */
777194677Sthompsa	USB_MODE_DUAL		/* can be host or device */
778194677Sthompsa};
779194677Sthompsa#define	USB_MODE_MAX	(USB_MODE_DUAL+1)
780194677Sthompsa
781194677Sthompsa/*
782239214Shselasky * The "USB_STATE" enums define all the supported device states.
783194677Sthompsa */
784194677Sthompsaenum usb_dev_state {
785194677Sthompsa	USB_STATE_DETACHED,
786194677Sthompsa	USB_STATE_ATTACHED,
787194677Sthompsa	USB_STATE_POWERED,
788194677Sthompsa	USB_STATE_ADDRESSED,
789194677Sthompsa	USB_STATE_CONFIGURED,
790194677Sthompsa};
791194677Sthompsa#define	USB_STATE_MAX	(USB_STATE_CONFIGURED+1)
792239214Shselasky
793239214Shselasky/*
794239214Shselasky * The "USB_EP_MODE" macros define all the currently supported
795239214Shselasky * endpoint modes.
796239214Shselasky */
797239214Shselaskyenum usb_ep_mode {
798239214Shselasky	USB_EP_MODE_DEFAULT,
799239214Shselasky	USB_EP_MODE_STREAMS,	/* USB3.0 specific */
800239214Shselasky	USB_EP_MODE_HW_MASS_STORAGE,
801239214Shselasky	USB_EP_MODE_HW_SERIAL,
802239214Shselasky	USB_EP_MODE_HW_ETHERNET_CDC,
803239214Shselasky	USB_EP_MODE_HW_ETHERNET_NCM,
804239214Shselasky	USB_EP_MODE_MAX
805239214Shselasky};
806194230Sthompsa#endif					/* _USB_STANDARD_H_ */
807