1184610Salfred/* $FreeBSD$ */
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);
58194677SthompsaMALLOC_DECLARE(M_USBHC);
59194677Sthompsa#endif /* _KERNEL */
60194677Sthompsa
61246122Shselasky#ifndef USB_GLOBAL_INCLUDE_FILE
62188942Sthompsa#include <dev/usb/usb_endian.h>
63194677Sthompsa#include <dev/usb/usb_freebsd.h>
64246122Shselasky#endif
65184610Salfred
66194677Sthompsa#define	USB_STACK_VERSION 2000		/* 2.0 */
67194677Sthompsa
68194677Sthompsa/* Definition of some hardcoded USB constants. */
69194677Sthompsa
70194677Sthompsa#define	USB_MAX_IPACKET		8	/* initial USB packet size */
71194677Sthompsa#define	USB_EP_MAX (2*16)		/* hardcoded */
72194677Sthompsa#define	USB_ROOT_HUB_ADDR 1		/* index */
73194677Sthompsa#define	USB_MIN_DEVICES 2		/* unused + root HUB */
74194677Sthompsa#define	USB_UNCONFIG_INDEX 0xFF		/* internal use only */
75194677Sthompsa#define	USB_IFACE_INDEX_ANY 0xFF	/* internal use only */
76194677Sthompsa#define	USB_START_ADDR 0		/* default USB device BUS address
77194677Sthompsa					 * after USB bus reset */
78194677Sthompsa#define	USB_CONTROL_ENDPOINT 0		/* default control endpoint */
79194677Sthompsa
80194677Sthompsa#define	USB_FRAMES_PER_SECOND_FS 1000	/* full speed */
81194677Sthompsa#define	USB_FRAMES_PER_SECOND_HS 8000	/* high speed */
82194677Sthompsa
83194677Sthompsa#define	USB_FS_BYTES_PER_HS_UFRAME 188	/* bytes */
84194677Sthompsa#define	USB_HS_MICRO_FRAMES_MAX 8	/* units */
85194677Sthompsa
86194677Sthompsa#define	USB_ISOC_TIME_MAX 128		/* ms */
87194677Sthompsa
88184610Salfred/*
89184610Salfred * Minimum time a device needs to be powered down to go through a
90184610Salfred * power cycle. These values are not in the USB specification.
91184610Salfred */
92184610Salfred#define	USB_POWER_DOWN_TIME	200	/* ms */
93184610Salfred#define	USB_PORT_POWER_DOWN_TIME	100	/* ms */
94184610Salfred
95186730Salfred/* Definition of software USB power modes */
96186730Salfred#define	USB_POWER_MODE_OFF 0		/* turn off device */
97186730Salfred#define	USB_POWER_MODE_ON 1		/* always on */
98186730Salfred#define	USB_POWER_MODE_SAVE 2		/* automatic suspend and resume */
99186730Salfred#define	USB_POWER_MODE_SUSPEND 3	/* force suspend */
100186730Salfred#define	USB_POWER_MODE_RESUME 4		/* force resume */
101186730Salfred
102184610Salfred/* These are the values from the USB specification. */
103241987Shselasky#define	USB_PORT_RESET_DELAY_SPEC	10	/* ms */
104241987Shselasky#define	USB_PORT_ROOT_RESET_DELAY_SPEC	50	/* ms */
105241987Shselasky#define	USB_PORT_RESET_RECOVERY_SPEC	10	/* ms */
106241987Shselasky#define	USB_PORT_POWERUP_DELAY_SPEC	100	/* ms */
107241987Shselasky#define	USB_PORT_RESUME_DELAY_SPEC	20	/* ms */
108241987Shselasky#define	USB_SET_ADDRESS_SETTLE_SPEC	2	/* ms */
109241987Shselasky#define	USB_RESUME_DELAY_SPEC		(20*5)	/* ms */
110241987Shselasky#define	USB_RESUME_WAIT_SPEC		10	/* ms */
111241987Shselasky#define	USB_RESUME_RECOVERY_SPEC	10	/* ms */
112241987Shselasky#define	USB_EXTRA_POWER_UP_TIME_SPEC	0	/* ms */
113241987Shselasky
114184610Salfred/* Allow for marginal and non-conforming devices. */
115241987Shselasky#define	USB_PORT_RESET_DELAY		50	/* ms */
116241987Shselasky#define	USB_PORT_ROOT_RESET_DELAY	250	/* ms */
117241987Shselasky#define	USB_PORT_RESET_RECOVERY		250	/* ms */
118241987Shselasky#define	USB_PORT_POWERUP_DELAY		300	/* ms */
119241987Shselasky#define	USB_PORT_RESUME_DELAY		(20*2)	/* ms */
120241987Shselasky#define	USB_SET_ADDRESS_SETTLE		10	/* ms */
121241987Shselasky#define	USB_RESUME_DELAY		(50*5)	/* ms */
122241987Shselasky#define	USB_RESUME_WAIT			50	/* ms */
123241987Shselasky#define	USB_RESUME_RECOVERY		50	/* ms */
124241987Shselasky#define	USB_EXTRA_POWER_UP_TIME		20	/* ms */
125184610Salfred
126184610Salfred#define	USB_MIN_POWER		100	/* mA */
127184610Salfred#define	USB_MAX_POWER		500	/* mA */
128184610Salfred
129184610Salfred#define	USB_BUS_RESET_DELAY	100	/* ms */
130184610Salfred
131184610Salfred/*
132184610Salfred * USB record layout in memory:
133184610Salfred *
134184610Salfred * - USB config 0
135184610Salfred *   - USB interfaces
136184610Salfred *     - USB alternative interfaces
137193644Sthompsa *       - USB endpoints
138184610Salfred *
139184610Salfred * - USB config 1
140184610Salfred *   - USB interfaces
141184610Salfred *     - USB alternative interfaces
142193644Sthompsa *       - USB endpoints
143184610Salfred */
144184610Salfred
145184610Salfred/* Declaration of USB records */
146184610Salfred
147192984Sthompsastruct usb_device_request {
148184610Salfred	uByte	bmRequestType;
149184610Salfred	uByte	bRequest;
150184610Salfred	uWord	wValue;
151184610Salfred	uWord	wIndex;
152184610Salfred	uWord	wLength;
153184610Salfred} __packed;
154192984Sthompsatypedef struct usb_device_request usb_device_request_t;
155184610Salfred
156184610Salfred#define	UT_WRITE		0x00
157184610Salfred#define	UT_READ			0x80
158184610Salfred#define	UT_STANDARD		0x00
159184610Salfred#define	UT_CLASS		0x20
160184610Salfred#define	UT_VENDOR		0x40
161184610Salfred#define	UT_DEVICE		0x00
162184610Salfred#define	UT_INTERFACE		0x01
163184610Salfred#define	UT_ENDPOINT		0x02
164184610Salfred#define	UT_OTHER		0x03
165184610Salfred
166184610Salfred#define	UT_READ_DEVICE		(UT_READ  | UT_STANDARD | UT_DEVICE)
167184610Salfred#define	UT_READ_INTERFACE	(UT_READ  | UT_STANDARD | UT_INTERFACE)
168184610Salfred#define	UT_READ_ENDPOINT	(UT_READ  | UT_STANDARD | UT_ENDPOINT)
169184610Salfred#define	UT_WRITE_DEVICE		(UT_WRITE | UT_STANDARD | UT_DEVICE)
170184610Salfred#define	UT_WRITE_INTERFACE	(UT_WRITE | UT_STANDARD | UT_INTERFACE)
171184610Salfred#define	UT_WRITE_ENDPOINT	(UT_WRITE | UT_STANDARD | UT_ENDPOINT)
172184610Salfred#define	UT_READ_CLASS_DEVICE	(UT_READ  | UT_CLASS | UT_DEVICE)
173184610Salfred#define	UT_READ_CLASS_INTERFACE	(UT_READ  | UT_CLASS | UT_INTERFACE)
174184610Salfred#define	UT_READ_CLASS_OTHER	(UT_READ  | UT_CLASS | UT_OTHER)
175184610Salfred#define	UT_READ_CLASS_ENDPOINT	(UT_READ  | UT_CLASS | UT_ENDPOINT)
176184610Salfred#define	UT_WRITE_CLASS_DEVICE	(UT_WRITE | UT_CLASS | UT_DEVICE)
177184610Salfred#define	UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE)
178184610Salfred#define	UT_WRITE_CLASS_OTHER	(UT_WRITE | UT_CLASS | UT_OTHER)
179184610Salfred#define	UT_WRITE_CLASS_ENDPOINT	(UT_WRITE | UT_CLASS | UT_ENDPOINT)
180184610Salfred#define	UT_READ_VENDOR_DEVICE	(UT_READ  | UT_VENDOR | UT_DEVICE)
181184610Salfred#define	UT_READ_VENDOR_INTERFACE (UT_READ  | UT_VENDOR | UT_INTERFACE)
182184610Salfred#define	UT_READ_VENDOR_OTHER	(UT_READ  | UT_VENDOR | UT_OTHER)
183184610Salfred#define	UT_READ_VENDOR_ENDPOINT	(UT_READ  | UT_VENDOR | UT_ENDPOINT)
184184610Salfred#define	UT_WRITE_VENDOR_DEVICE	(UT_WRITE | UT_VENDOR | UT_DEVICE)
185184610Salfred#define	UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE)
186184610Salfred#define	UT_WRITE_VENDOR_OTHER	(UT_WRITE | UT_VENDOR | UT_OTHER)
187184610Salfred#define	UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT)
188184610Salfred
189184610Salfred/* Requests */
190184610Salfred#define	UR_GET_STATUS		0x00
191184610Salfred#define	UR_CLEAR_FEATURE	0x01
192184610Salfred#define	UR_SET_FEATURE		0x03
193184610Salfred#define	UR_SET_ADDRESS		0x05
194184610Salfred#define	UR_GET_DESCRIPTOR	0x06
195184610Salfred#define	UDESC_DEVICE		0x01
196184610Salfred#define	UDESC_CONFIG		0x02
197184610Salfred#define	UDESC_STRING		0x03
198185290Salfred#define	USB_LANGUAGE_TABLE	0x00	/* language ID string index */
199185290Salfred#define	UDESC_INTERFACE		0x04
200184610Salfred#define	UDESC_ENDPOINT		0x05
201184610Salfred#define	UDESC_DEVICE_QUALIFIER	0x06
202184610Salfred#define	UDESC_OTHER_SPEED_CONFIGURATION 0x07
203184610Salfred#define	UDESC_INTERFACE_POWER	0x08
204184610Salfred#define	UDESC_OTG		0x09
205185290Salfred#define	UDESC_DEBUG		0x0A
206185290Salfred#define	UDESC_IFACE_ASSOC	0x0B	/* interface association */
207185290Salfred#define	UDESC_BOS		0x0F	/* binary object store */
208185290Salfred#define	UDESC_DEVICE_CAPABILITY	0x10
209185290Salfred#define	UDESC_CS_DEVICE		0x21	/* class specific */
210185290Salfred#define	UDESC_CS_CONFIG		0x22
211185290Salfred#define	UDESC_CS_STRING		0x23
212184610Salfred#define	UDESC_CS_INTERFACE	0x24
213184610Salfred#define	UDESC_CS_ENDPOINT	0x25
214184610Salfred#define	UDESC_HUB		0x29
215213427Shselasky#define	UDESC_SS_HUB		0x2A	/* super speed */
216185290Salfred#define	UDESC_ENDPOINT_SS_COMP	0x30	/* super speed */
217184610Salfred#define	UR_SET_DESCRIPTOR	0x07
218184610Salfred#define	UR_GET_CONFIG		0x08
219184610Salfred#define	UR_SET_CONFIG		0x09
220184610Salfred#define	UR_GET_INTERFACE	0x0a
221184610Salfred#define	UR_SET_INTERFACE	0x0b
222184610Salfred#define	UR_SYNCH_FRAME		0x0c
223185290Salfred#define	UR_SET_SEL		0x30
224185290Salfred#define	UR_ISOCH_DELAY		0x31
225184610Salfred
226184610Salfred/* HUB specific request */
227184610Salfred#define	UR_GET_BUS_STATE	0x02
228184610Salfred#define	UR_CLEAR_TT_BUFFER	0x08
229184610Salfred#define	UR_RESET_TT		0x09
230184610Salfred#define	UR_GET_TT_STATE		0x0a
231184610Salfred#define	UR_STOP_TT		0x0b
232233771Shselasky#define	UR_SET_AND_TEST		0x0c	/* USB 2.0 only */
233233771Shselasky#define	UR_SET_HUB_DEPTH	0x0c	/* USB 3.0 only */
234213427Shselasky#define	USB_SS_HUB_DEPTH_MAX	5
235185290Salfred#define	UR_GET_PORT_ERR_COUNT	0x0d
236184610Salfred
237184610Salfred/* Feature numbers */
238184610Salfred#define	UF_ENDPOINT_HALT	0
239184610Salfred#define	UF_DEVICE_REMOTE_WAKEUP	1
240184610Salfred#define	UF_TEST_MODE		2
241185290Salfred#define	UF_U1_ENABLE		0x30
242185290Salfred#define	UF_U2_ENABLE		0x31
243185290Salfred#define	UF_LTM_ENABLE		0x32
244184610Salfred
245184610Salfred/* HUB specific features */
246184610Salfred#define	UHF_C_HUB_LOCAL_POWER	0
247184610Salfred#define	UHF_C_HUB_OVER_CURRENT	1
248184610Salfred#define	UHF_PORT_CONNECTION	0
249184610Salfred#define	UHF_PORT_ENABLE		1
250184610Salfred#define	UHF_PORT_SUSPEND	2
251184610Salfred#define	UHF_PORT_OVER_CURRENT	3
252184610Salfred#define	UHF_PORT_RESET		4
253185290Salfred#define	UHF_PORT_LINK_STATE	5
254184610Salfred#define	UHF_PORT_POWER		8
255184610Salfred#define	UHF_PORT_LOW_SPEED	9
256233771Shselasky#define	UHF_PORT_L1		10
257184610Salfred#define	UHF_C_PORT_CONNECTION	16
258184610Salfred#define	UHF_C_PORT_ENABLE	17
259184610Salfred#define	UHF_C_PORT_SUSPEND	18
260184610Salfred#define	UHF_C_PORT_OVER_CURRENT	19
261184610Salfred#define	UHF_C_PORT_RESET	20
262184610Salfred#define	UHF_PORT_TEST		21
263184610Salfred#define	UHF_PORT_INDICATOR	22
264233771Shselasky#define	UHF_C_PORT_L1		23
265184610Salfred
266185290Salfred/* SuperSpeed HUB specific features */
267185290Salfred#define	UHF_PORT_U1_TIMEOUT	23
268185290Salfred#define	UHF_PORT_U2_TIMEOUT	24
269185290Salfred#define	UHF_C_PORT_LINK_STATE	25
270185290Salfred#define	UHF_C_PORT_CONFIG_ERROR	26
271185290Salfred#define	UHF_PORT_REMOTE_WAKE_MASK	27
272185290Salfred#define	UHF_BH_PORT_RESET	28
273185290Salfred#define	UHF_C_BH_PORT_RESET	29
274185290Salfred#define	UHF_FORCE_LINKPM_ACCEPT	30
275185290Salfred
276192984Sthompsastruct usb_descriptor {
277184610Salfred	uByte	bLength;
278184610Salfred	uByte	bDescriptorType;
279184610Salfred	uByte	bDescriptorSubtype;
280184610Salfred} __packed;
281192984Sthompsatypedef struct usb_descriptor usb_descriptor_t;
282184610Salfred
283192984Sthompsastruct usb_device_descriptor {
284184610Salfred	uByte	bLength;
285184610Salfred	uByte	bDescriptorType;
286184610Salfred	uWord	bcdUSB;
287184610Salfred#define	UD_USB_2_0		0x0200
288185290Salfred#define	UD_USB_3_0		0x0300
289185290Salfred#define	UD_IS_USB2(d) ((d)->bcdUSB[1] == 0x02)
290185290Salfred#define	UD_IS_USB3(d) ((d)->bcdUSB[1] == 0x03)
291184610Salfred	uByte	bDeviceClass;
292184610Salfred	uByte	bDeviceSubClass;
293184610Salfred	uByte	bDeviceProtocol;
294184610Salfred	uByte	bMaxPacketSize;
295184610Salfred	/* The fields below are not part of the initial descriptor. */
296184610Salfred	uWord	idVendor;
297184610Salfred	uWord	idProduct;
298184610Salfred	uWord	bcdDevice;
299184610Salfred	uByte	iManufacturer;
300184610Salfred	uByte	iProduct;
301184610Salfred	uByte	iSerialNumber;
302184610Salfred	uByte	bNumConfigurations;
303184610Salfred} __packed;
304192984Sthompsatypedef struct usb_device_descriptor usb_device_descriptor_t;
305184610Salfred
306185290Salfred/* Binary Device Object Store (BOS) */
307192984Sthompsastruct usb_bos_descriptor {
308185290Salfred	uByte	bLength;
309185290Salfred	uByte	bDescriptorType;
310185290Salfred	uWord	wTotalLength;
311185290Salfred	uByte	bNumDeviceCaps;
312185290Salfred} __packed;
313192984Sthompsatypedef struct usb_bos_descriptor usb_bos_descriptor_t;
314185290Salfred
315185290Salfred/* Binary Device Object Store Capability */
316192984Sthompsastruct usb_bos_cap_descriptor {
317185290Salfred	uByte	bLength;
318185290Salfred	uByte	bDescriptorType;
319185290Salfred	uByte	bDevCapabilityType;
320185290Salfred#define	USB_DEVCAP_RESERVED	0x00
321185290Salfred#define	USB_DEVCAP_WUSB		0x01
322185290Salfred#define	USB_DEVCAP_USB2EXT	0x02
323185290Salfred#define	USB_DEVCAP_SUPER_SPEED	0x03
324185290Salfred#define	USB_DEVCAP_CONTAINER_ID	0x04
325185290Salfred	/* data ... */
326185290Salfred} __packed;
327192984Sthompsatypedef struct usb_bos_cap_descriptor usb_bos_cap_descriptor_t;
328185290Salfred
329192984Sthompsastruct usb_devcap_usb2ext_descriptor {
330185290Salfred	uByte	bLength;
331185290Salfred	uByte	bDescriptorType;
332185290Salfred	uByte	bDevCapabilityType;
333227401Shselasky	uDWord	bmAttributes;
334233771Shselasky#define	USB_V2EXT_LPM (1U << 1)
335233771Shselasky#define	USB_V2EXT_BESL_SUPPORTED (1U << 2)
336233771Shselasky#define	USB_V2EXT_BESL_BASELINE_VALID (1U << 3)
337233771Shselasky#define	USB_V2EXT_BESL_DEEP_VALID (1U << 4)
338233771Shselasky#define	USB_V2EXT_BESL_BASELINE_GET(x) (((x) >> 8) & 0xF)
339233771Shselasky#define	USB_V2EXT_BESL_DEEP_GET(x) (((x) >> 12) & 0xF)
340185290Salfred} __packed;
341192984Sthompsatypedef struct usb_devcap_usb2ext_descriptor usb_devcap_usb2ext_descriptor_t;
342185290Salfred
343192984Sthompsastruct usb_devcap_ss_descriptor {
344185290Salfred	uByte	bLength;
345185290Salfred	uByte	bDescriptorType;
346185290Salfred	uByte	bDevCapabilityType;
347185290Salfred	uByte	bmAttributes;
348185290Salfred	uWord	wSpeedsSupported;
349213427Shselasky	uByte	bFunctionalitySupport;
350185290Salfred	uByte	bU1DevExitLat;
351227396Shselasky	uWord	wU2DevExitLat;
352185290Salfred} __packed;
353192984Sthompsatypedef struct usb_devcap_ss_descriptor usb_devcap_ss_descriptor_t;
354185290Salfred
355192984Sthompsastruct usb_devcap_container_id_descriptor {
356185290Salfred	uByte	bLength;
357185290Salfred	uByte	bDescriptorType;
358185290Salfred	uByte	bDevCapabilityType;
359185290Salfred	uByte	bReserved;
360213427Shselasky	uByte	bContainerID;
361185290Salfred} __packed;
362192984Sthompsatypedef struct usb_devcap_container_id_descriptor
363188947Sthompsa		usb_devcap_container_id_descriptor_t;
364185290Salfred
365184610Salfred/* Device class codes */
366184610Salfred#define	UDCLASS_IN_INTERFACE	0x00
367184610Salfred#define	UDCLASS_COMM		0x02
368184610Salfred#define	UDCLASS_HUB		0x09
369184610Salfred#define	UDSUBCLASS_HUB		0x00
370184610Salfred#define	UDPROTO_FSHUB		0x00
371184610Salfred#define	UDPROTO_HSHUBSTT	0x01
372184610Salfred#define	UDPROTO_HSHUBMTT	0x02
373213427Shselasky#define	UDPROTO_SSHUB		0x03
374184610Salfred#define	UDCLASS_DIAGNOSTIC	0xdc
375184610Salfred#define	UDCLASS_WIRELESS	0xe0
376184610Salfred#define	UDSUBCLASS_RF		0x01
377184610Salfred#define	UDPROTO_BLUETOOTH	0x01
378184610Salfred#define	UDCLASS_VENDOR		0xff
379184610Salfred
380192984Sthompsastruct usb_config_descriptor {
381184610Salfred	uByte	bLength;
382184610Salfred	uByte	bDescriptorType;
383184610Salfred	uWord	wTotalLength;
384184610Salfred	uByte	bNumInterface;
385184610Salfred	uByte	bConfigurationValue;
386184610Salfred#define	USB_UNCONFIG_NO 0
387184610Salfred	uByte	iConfiguration;
388184610Salfred	uByte	bmAttributes;
389184610Salfred#define	UC_BUS_POWERED		0x80
390184610Salfred#define	UC_SELF_POWERED		0x40
391184610Salfred#define	UC_REMOTE_WAKEUP	0x20
392184610Salfred	uByte	bMaxPower;		/* max current in 2 mA units */
393184610Salfred#define	UC_POWER_FACTOR 2
394184610Salfred} __packed;
395192984Sthompsatypedef struct usb_config_descriptor usb_config_descriptor_t;
396184610Salfred
397192984Sthompsastruct usb_interface_descriptor {
398184610Salfred	uByte	bLength;
399184610Salfred	uByte	bDescriptorType;
400184610Salfred	uByte	bInterfaceNumber;
401184610Salfred	uByte	bAlternateSetting;
402184610Salfred	uByte	bNumEndpoints;
403184610Salfred	uByte	bInterfaceClass;
404184610Salfred	uByte	bInterfaceSubClass;
405184610Salfred	uByte	bInterfaceProtocol;
406184610Salfred	uByte	iInterface;
407184610Salfred} __packed;
408192984Sthompsatypedef struct usb_interface_descriptor usb_interface_descriptor_t;
409184610Salfred
410192984Sthompsastruct usb_interface_assoc_descriptor {
411185290Salfred	uByte	bLength;
412185290Salfred	uByte	bDescriptorType;
413185290Salfred	uByte	bFirstInterface;
414185290Salfred	uByte	bInterfaceCount;
415185290Salfred	uByte	bFunctionClass;
416185290Salfred	uByte	bFunctionSubClass;
417185290Salfred	uByte	bFunctionProtocol;
418185290Salfred	uByte	iFunction;
419185290Salfred} __packed;
420192984Sthompsatypedef struct usb_interface_assoc_descriptor usb_interface_assoc_descriptor_t;
421185290Salfred
422184610Salfred/* Interface class codes */
423184610Salfred#define	UICLASS_UNSPEC		0x00
424184610Salfred#define	UICLASS_AUDIO		0x01	/* audio */
425184610Salfred#define	UISUBCLASS_AUDIOCONTROL	1
426184610Salfred#define	UISUBCLASS_AUDIOSTREAM		2
427184610Salfred#define	UISUBCLASS_MIDISTREAM		3
428184610Salfred
429184610Salfred#define	UICLASS_CDC		0x02	/* communication */
430184610Salfred#define	UISUBCLASS_DIRECT_LINE_CONTROL_MODEL	1
431184610Salfred#define	UISUBCLASS_ABSTRACT_CONTROL_MODEL	2
432184610Salfred#define	UISUBCLASS_TELEPHONE_CONTROL_MODEL	3
433184610Salfred#define	UISUBCLASS_MULTICHANNEL_CONTROL_MODEL	4
434184610Salfred#define	UISUBCLASS_CAPI_CONTROLMODEL		5
435184610Salfred#define	UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6
436184610Salfred#define	UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7
437184610Salfred#define	UISUBCLASS_WIRELESS_HANDSET_CM 8
438184610Salfred#define	UISUBCLASS_DEVICE_MGMT 9
439184610Salfred#define	UISUBCLASS_MOBILE_DIRECT_LINE_MODEL 10
440184610Salfred#define	UISUBCLASS_OBEX 11
441184610Salfred#define	UISUBCLASS_ETHERNET_EMULATION_MODEL 12
442197563Sthompsa#define	UISUBCLASS_NETWORK_CONTROL_MODEL 13
443184610Salfred
444184610Salfred#define	UIPROTO_CDC_AT			1
445184610Salfred
446184610Salfred#define	UICLASS_HID		0x03
447184610Salfred#define	UISUBCLASS_BOOT		1
448184610Salfred#define	UIPROTO_BOOT_KEYBOARD	1
449184610Salfred#define	UIPROTO_MOUSE		2
450184610Salfred
451184610Salfred#define	UICLASS_PHYSICAL	0x05
452184610Salfred#define	UICLASS_IMAGE		0x06
453184610Salfred#define	UISUBCLASS_SIC		1	/* still image class */
454184610Salfred#define	UICLASS_PRINTER		0x07
455184610Salfred#define	UISUBCLASS_PRINTER	1
456184610Salfred#define	UIPROTO_PRINTER_UNI	1
457184610Salfred#define	UIPROTO_PRINTER_BI	2
458184610Salfred#define	UIPROTO_PRINTER_1284	3
459184610Salfred
460184610Salfred#define	UICLASS_MASS		0x08
461184610Salfred#define	UISUBCLASS_RBC		1
462184610Salfred#define	UISUBCLASS_SFF8020I	2
463184610Salfred#define	UISUBCLASS_QIC157	3
464184610Salfred#define	UISUBCLASS_UFI		4
465184610Salfred#define	UISUBCLASS_SFF8070I	5
466184610Salfred#define	UISUBCLASS_SCSI		6
467184610Salfred#define	UIPROTO_MASS_CBI_I	0
468184610Salfred#define	UIPROTO_MASS_CBI	1
469184610Salfred#define	UIPROTO_MASS_BBB_OLD	2	/* Not in the spec anymore */
470184610Salfred#define	UIPROTO_MASS_BBB	80	/* 'P' for the Iomega Zip drive */
471184610Salfred
472184610Salfred#define	UICLASS_HUB		0x09
473184610Salfred#define	UISUBCLASS_HUB		0
474184610Salfred#define	UIPROTO_FSHUB		0
475184610Salfred#define	UIPROTO_HSHUBSTT	0	/* Yes, same as previous */
476184610Salfred#define	UIPROTO_HSHUBMTT	1
477184610Salfred
478184610Salfred#define	UICLASS_CDC_DATA	0x0a
479197563Sthompsa#define	UISUBCLASS_DATA		0x00
480184610Salfred#define	UIPROTO_DATA_ISDNBRI		0x30	/* Physical iface */
481184610Salfred#define	UIPROTO_DATA_HDLC		0x31	/* HDLC */
482184610Salfred#define	UIPROTO_DATA_TRANSPARENT	0x32	/* Transparent */
483184610Salfred#define	UIPROTO_DATA_Q921M		0x50	/* Management for Q921 */
484184610Salfred#define	UIPROTO_DATA_Q921		0x51	/* Data for Q921 */
485184610Salfred#define	UIPROTO_DATA_Q921TM		0x52	/* TEI multiplexer for Q921 */
486184610Salfred#define	UIPROTO_DATA_V42BIS		0x90	/* Data compression */
487184610Salfred#define	UIPROTO_DATA_Q931		0x91	/* Euro-ISDN */
488184610Salfred#define	UIPROTO_DATA_V120		0x92	/* V.24 rate adaption */
489184610Salfred#define	UIPROTO_DATA_CAPI		0x93	/* CAPI 2.0 commands */
490184610Salfred#define	UIPROTO_DATA_HOST_BASED		0xfd	/* Host based driver */
491184610Salfred#define	UIPROTO_DATA_PUF		0xfe	/* see Prot. Unit Func. Desc. */
492184610Salfred#define	UIPROTO_DATA_VENDOR		0xff	/* Vendor specific */
493197563Sthompsa#define	UIPROTO_DATA_NCM		0x01	/* Network Control Model */
494184610Salfred
495184610Salfred#define	UICLASS_SMARTCARD	0x0b
496184610Salfred#define	UICLASS_FIRM_UPD	0x0c
497184610Salfred#define	UICLASS_SECURITY	0x0d
498184610Salfred#define	UICLASS_DIAGNOSTIC	0xdc
499184610Salfred#define	UICLASS_WIRELESS	0xe0
500184610Salfred#define	UISUBCLASS_RF			0x01
501184610Salfred#define	UIPROTO_BLUETOOTH		0x01
502262363Shselasky#define	UIPROTO_RNDIS			0x03
503184610Salfred
504196493Salfred#define	UICLASS_IAD		0xEF	/* Interface Association Descriptor */
505262363Shselasky#define	UISUBCLASS_SYNC			0x01
506262363Shselasky#define	UIPROTO_ACTIVESYNC		0x01
507196493Salfred
508184610Salfred#define	UICLASS_APPL_SPEC	0xfe
509184610Salfred#define	UISUBCLASS_FIRMWARE_DOWNLOAD	1
510184610Salfred#define	UISUBCLASS_IRDA			2
511184610Salfred#define	UIPROTO_IRDA			0
512184610Salfred
513184610Salfred#define	UICLASS_VENDOR		0xff
514184610Salfred#define	UISUBCLASS_XBOX360_CONTROLLER	0x5d
515184610Salfred#define	UIPROTO_XBOX360_GAMEPAD	0x01
516184610Salfred
517192984Sthompsastruct usb_endpoint_descriptor {
518184610Salfred	uByte	bLength;
519184610Salfred	uByte	bDescriptorType;
520184610Salfred	uByte	bEndpointAddress;
521184610Salfred#define	UE_GET_DIR(a)	((a) & 0x80)
522184610Salfred#define	UE_SET_DIR(a,d)	((a) | (((d)&1) << 7))
523190732Sthompsa#define	UE_DIR_IN	0x80		/* IN-token endpoint, fixed */
524190732Sthompsa#define	UE_DIR_OUT	0x00		/* OUT-token endpoint, fixed */
525190732Sthompsa#define	UE_DIR_RX	0xfd		/* for internal use only! */
526190732Sthompsa#define	UE_DIR_TX	0xfe		/* for internal use only! */
527184610Salfred#define	UE_DIR_ANY	0xff		/* for internal use only! */
528184610Salfred#define	UE_ADDR		0x0f
529184610Salfred#define	UE_ADDR_ANY	0xff		/* for internal use only! */
530184610Salfred#define	UE_GET_ADDR(a)	((a) & UE_ADDR)
531184610Salfred	uByte	bmAttributes;
532184610Salfred#define	UE_XFERTYPE	0x03
533184610Salfred#define	UE_CONTROL	0x00
534184610Salfred#define	UE_ISOCHRONOUS	0x01
535184610Salfred#define	UE_BULK	0x02
536184610Salfred#define	UE_INTERRUPT	0x03
537184610Salfred#define	UE_BULK_INTR	0xfe		/* for internal use only! */
538184610Salfred#define	UE_TYPE_ANY	0xff		/* for internal use only! */
539184610Salfred#define	UE_GET_XFERTYPE(a)	((a) & UE_XFERTYPE)
540184610Salfred#define	UE_ISO_TYPE	0x0c
541184610Salfred#define	UE_ISO_ASYNC	0x04
542184610Salfred#define	UE_ISO_ADAPT	0x08
543184610Salfred#define	UE_ISO_SYNC	0x0c
544184610Salfred#define	UE_GET_ISO_TYPE(a)	((a) & UE_ISO_TYPE)
545184610Salfred	uWord	wMaxPacketSize;
546184610Salfred#define	UE_ZERO_MPS 0xFFFF		/* for internal use only */
547184610Salfred	uByte	bInterval;
548184610Salfred} __packed;
549192984Sthompsatypedef struct usb_endpoint_descriptor usb_endpoint_descriptor_t;
550184610Salfred
551192984Sthompsastruct usb_endpoint_ss_comp_descriptor {
552185290Salfred	uByte	bLength;
553185290Salfred	uByte	bDescriptorType;
554213427Shselasky	uByte	bMaxBurst;
555185290Salfred	uByte	bmAttributes;
556239214Shselasky#define	UE_GET_BULK_STREAMS(x) ((x) & 0x0F)
557239214Shselasky#define	UE_GET_SS_ISO_MULT(x) ((x) & 0x03)
558185290Salfred	uWord	wBytesPerInterval;
559185290Salfred} __packed;
560192984Sthompsatypedef struct usb_endpoint_ss_comp_descriptor
561188947Sthompsa		usb_endpoint_ss_comp_descriptor_t;
562185290Salfred
563192984Sthompsastruct usb_string_descriptor {
564184610Salfred	uByte	bLength;
565184610Salfred	uByte	bDescriptorType;
566184610Salfred	uWord	bString[126];
567184610Salfred	uByte	bUnused;
568184610Salfred} __packed;
569192984Sthompsatypedef struct usb_string_descriptor usb_string_descriptor_t;
570184610Salfred
571184610Salfred#define	USB_MAKE_STRING_DESC(m,name)	\
572246124Shselaskystatic const struct {			\
573184610Salfred  uByte bLength;			\
574184610Salfred  uByte bDescriptorType;		\
575184610Salfred  uByte bData[sizeof((uint8_t []){m})];	\
576246124Shselasky} __packed name = {			\
577246124Shselasky  .bLength = sizeof(name),		\
578184610Salfred  .bDescriptorType = UDESC_STRING,	\
579184610Salfred  .bData = { m },			\
580184610Salfred}
581184610Salfred
582246123Shselaskystruct usb_string_lang {
583246123Shselasky	uByte bLength;
584246123Shselasky	uByte bDescriptorType;
585246123Shselasky	uByte bData[2];
586246123Shselasky} __packed;
587246123Shselaskytypedef struct usb_string_lang usb_string_lang_t;
588246123Shselasky
589192984Sthompsastruct usb_hub_descriptor {
590184610Salfred	uByte	bDescLength;
591184610Salfred	uByte	bDescriptorType;
592184610Salfred	uByte	bNbrPorts;
593184610Salfred	uWord	wHubCharacteristics;
594184610Salfred#define	UHD_PWR			0x0003
595184610Salfred#define	UHD_PWR_GANGED		0x0000
596184610Salfred#define	UHD_PWR_INDIVIDUAL	0x0001
597184610Salfred#define	UHD_PWR_NO_SWITCH	0x0002
598184610Salfred#define	UHD_COMPOUND		0x0004
599184610Salfred#define	UHD_OC			0x0018
600184610Salfred#define	UHD_OC_GLOBAL		0x0000
601184610Salfred#define	UHD_OC_INDIVIDUAL	0x0008
602184610Salfred#define	UHD_OC_NONE		0x0010
603184610Salfred#define	UHD_TT_THINK		0x0060
604184610Salfred#define	UHD_TT_THINK_8		0x0000
605184610Salfred#define	UHD_TT_THINK_16		0x0020
606184610Salfred#define	UHD_TT_THINK_24		0x0040
607184610Salfred#define	UHD_TT_THINK_32		0x0060
608184610Salfred#define	UHD_PORT_IND		0x0080
609184610Salfred	uByte	bPwrOn2PwrGood;		/* delay in 2 ms units */
610184610Salfred#define	UHD_PWRON_FACTOR 2
611184610Salfred	uByte	bHubContrCurrent;
612184610Salfred	uByte	DeviceRemovable[32];	/* max 255 ports */
613184610Salfred#define	UHD_NOT_REMOV(desc, i) \
614184610Salfred    (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1)
615185290Salfred	uByte	PortPowerCtrlMask[1];	/* deprecated */
616184610Salfred} __packed;
617192984Sthompsatypedef struct usb_hub_descriptor usb_hub_descriptor_t;
618184610Salfred
619192984Sthompsastruct usb_hub_ss_descriptor {
620213427Shselasky	uByte	bLength;
621185290Salfred	uByte	bDescriptorType;
622213427Shselasky	uByte	bNbrPorts;
623185290Salfred	uWord	wHubCharacteristics;
624185290Salfred	uByte	bPwrOn2PwrGood;		/* delay in 2 ms units */
625185290Salfred	uByte	bHubContrCurrent;
626185290Salfred	uByte	bHubHdrDecLat;
627185290Salfred	uWord	wHubDelay;
628213427Shselasky	uByte	DeviceRemovable[32];	/* max 255 ports */
629185290Salfred} __packed;
630192984Sthompsatypedef struct usb_hub_ss_descriptor usb_hub_ss_descriptor_t;
631185290Salfred
632184610Salfred/* minimum HUB descriptor (8-ports maximum) */
633192984Sthompsastruct usb_hub_descriptor_min {
634184610Salfred	uByte	bDescLength;
635184610Salfred	uByte	bDescriptorType;
636184610Salfred	uByte	bNbrPorts;
637184610Salfred	uWord	wHubCharacteristics;
638184610Salfred	uByte	bPwrOn2PwrGood;
639184610Salfred	uByte	bHubContrCurrent;
640184610Salfred	uByte	DeviceRemovable[1];
641184610Salfred	uByte	PortPowerCtrlMask[1];
642184610Salfred} __packed;
643192984Sthompsatypedef struct usb_hub_descriptor_min usb_hub_descriptor_min_t;
644184610Salfred
645192984Sthompsastruct usb_device_qualifier {
646184610Salfred	uByte	bLength;
647184610Salfred	uByte	bDescriptorType;
648184610Salfred	uWord	bcdUSB;
649184610Salfred	uByte	bDeviceClass;
650184610Salfred	uByte	bDeviceSubClass;
651184610Salfred	uByte	bDeviceProtocol;
652184610Salfred	uByte	bMaxPacketSize0;
653184610Salfred	uByte	bNumConfigurations;
654184610Salfred	uByte	bReserved;
655184610Salfred} __packed;
656192984Sthompsatypedef struct usb_device_qualifier usb_device_qualifier_t;
657184610Salfred
658192984Sthompsastruct usb_otg_descriptor {
659184610Salfred	uByte	bLength;
660184610Salfred	uByte	bDescriptorType;
661184610Salfred	uByte	bmAttributes;
662184610Salfred#define	UOTG_SRP	0x01
663184610Salfred#define	UOTG_HNP	0x02
664184610Salfred} __packed;
665192984Sthompsatypedef struct usb_otg_descriptor usb_otg_descriptor_t;
666184610Salfred
667184610Salfred/* OTG feature selectors */
668184610Salfred#define	UOTG_B_HNP_ENABLE	3
669184610Salfred#define	UOTG_A_HNP_SUPPORT	4
670184610Salfred#define	UOTG_A_ALT_HNP_SUPPORT	5
671184610Salfred
672192984Sthompsastruct usb_status {
673184610Salfred	uWord	wStatus;
674184610Salfred/* Device status flags */
675184610Salfred#define	UDS_SELF_POWERED		0x0001
676184610Salfred#define	UDS_REMOTE_WAKEUP		0x0002
677184610Salfred/* Endpoint status flags */
678184610Salfred#define	UES_HALT			0x0001
679184610Salfred} __packed;
680192984Sthompsatypedef struct usb_status usb_status_t;
681184610Salfred
682192984Sthompsastruct usb_hub_status {
683184610Salfred	uWord	wHubStatus;
684184610Salfred#define	UHS_LOCAL_POWER			0x0001
685184610Salfred#define	UHS_OVER_CURRENT		0x0002
686184610Salfred	uWord	wHubChange;
687184610Salfred} __packed;
688192984Sthompsatypedef struct usb_hub_status usb_hub_status_t;
689184610Salfred
690192984Sthompsastruct usb_port_status {
691184610Salfred	uWord	wPortStatus;
692184610Salfred#define	UPS_CURRENT_CONNECT_STATUS	0x0001
693184610Salfred#define	UPS_PORT_ENABLED		0x0002
694184610Salfred#define	UPS_SUSPEND			0x0004
695184610Salfred#define	UPS_OVERCURRENT_INDICATOR	0x0008
696184610Salfred#define	UPS_RESET			0x0010
697233771Shselasky#define	UPS_PORT_L1			0x0020	/* USB 2.0 only */
698213427Shselasky/* The link-state bits are valid for Super-Speed USB HUBs */
699213427Shselasky#define	UPS_PORT_LINK_STATE_GET(x)	(((x) >> 5) & 0xF)
700213427Shselasky#define	UPS_PORT_LINK_STATE_SET(x)	(((x) & 0xF) << 5)
701213427Shselasky#define	UPS_PORT_LS_U0		0x00
702213427Shselasky#define	UPS_PORT_LS_U1		0x01
703213427Shselasky#define	UPS_PORT_LS_U2		0x02
704213427Shselasky#define	UPS_PORT_LS_U3		0x03
705213427Shselasky#define	UPS_PORT_LS_SS_DIS	0x04
706213427Shselasky#define	UPS_PORT_LS_RX_DET	0x05
707213427Shselasky#define	UPS_PORT_LS_SS_INA	0x06
708213427Shselasky#define	UPS_PORT_LS_POLL	0x07
709213427Shselasky#define	UPS_PORT_LS_RECOVER	0x08
710213427Shselasky#define	UPS_PORT_LS_HOT_RST	0x09
711213427Shselasky#define	UPS_PORT_LS_COMP_MODE	0x0A
712213427Shselasky#define	UPS_PORT_LS_LOOPBACK	0x0B
713226803Shselasky#define	UPS_PORT_LS_RESUME	0x0F
714184610Salfred#define	UPS_PORT_POWER			0x0100
715230032Shselasky#define	UPS_PORT_POWER_SS		0x0200	/* super-speed only */
716184610Salfred#define	UPS_LOW_SPEED			0x0200
717184610Salfred#define	UPS_HIGH_SPEED			0x0400
718213427Shselasky#define	UPS_OTHER_SPEED			0x0600	/* currently FreeBSD specific */
719184610Salfred#define	UPS_PORT_TEST			0x0800
720184610Salfred#define	UPS_PORT_INDICATOR		0x1000
721187180Sthompsa#define	UPS_PORT_MODE_DEVICE		0x8000	/* currently FreeBSD specific */
722184610Salfred	uWord	wPortChange;
723184610Salfred#define	UPS_C_CONNECT_STATUS		0x0001
724184610Salfred#define	UPS_C_PORT_ENABLED		0x0002
725184610Salfred#define	UPS_C_SUSPEND			0x0004
726184610Salfred#define	UPS_C_OVERCURRENT_INDICATOR	0x0008
727184610Salfred#define	UPS_C_PORT_RESET		0x0010
728233771Shselasky#define	UPS_C_PORT_L1			0x0020	/* USB 2.0 only */
729233771Shselasky#define	UPS_C_BH_PORT_RESET		0x0020	/* USB 3.0 only */
730213427Shselasky#define	UPS_C_PORT_LINK_STATE		0x0040
731213427Shselasky#define	UPS_C_PORT_CONFIG_ERROR		0x0080
732184610Salfred} __packed;
733192984Sthompsatypedef struct usb_port_status usb_port_status_t;
734184610Salfred
735194677Sthompsa/*
736194677Sthompsa * The "USB_SPEED" macros defines all the supported USB speeds.
737194677Sthompsa */
738194677Sthompsaenum usb_dev_speed {
739194677Sthompsa	USB_SPEED_VARIABLE,
740194677Sthompsa	USB_SPEED_LOW,
741194677Sthompsa	USB_SPEED_FULL,
742194677Sthompsa	USB_SPEED_HIGH,
743194677Sthompsa	USB_SPEED_SUPER,
744194677Sthompsa};
745194677Sthompsa#define	USB_SPEED_MAX	(USB_SPEED_SUPER+1)
746194677Sthompsa
747194677Sthompsa/*
748194677Sthompsa * The "USB_REV" macros defines all the supported USB revisions.
749194677Sthompsa */
750194677Sthompsaenum usb_revision {
751194677Sthompsa	USB_REV_UNKNOWN,
752194677Sthompsa	USB_REV_PRE_1_0,
753194677Sthompsa	USB_REV_1_0,
754194677Sthompsa	USB_REV_1_1,
755194677Sthompsa	USB_REV_2_0,
756194677Sthompsa	USB_REV_2_5,
757194677Sthompsa	USB_REV_3_0
758194677Sthompsa};
759194677Sthompsa#define	USB_REV_MAX	(USB_REV_3_0+1)
760194677Sthompsa
761194677Sthompsa/*
762239214Shselasky * Supported host controller modes.
763194677Sthompsa */
764194677Sthompsaenum usb_hc_mode {
765194677Sthompsa	USB_MODE_HOST,		/* initiates transfers */
766194677Sthompsa	USB_MODE_DEVICE,	/* bus transfer target */
767194677Sthompsa	USB_MODE_DUAL		/* can be host or device */
768194677Sthompsa};
769194677Sthompsa#define	USB_MODE_MAX	(USB_MODE_DUAL+1)
770194677Sthompsa
771194677Sthompsa/*
772239214Shselasky * The "USB_STATE" enums define all the supported device states.
773194677Sthompsa */
774194677Sthompsaenum usb_dev_state {
775194677Sthompsa	USB_STATE_DETACHED,
776194677Sthompsa	USB_STATE_ATTACHED,
777194677Sthompsa	USB_STATE_POWERED,
778194677Sthompsa	USB_STATE_ADDRESSED,
779194677Sthompsa	USB_STATE_CONFIGURED,
780194677Sthompsa};
781194677Sthompsa#define	USB_STATE_MAX	(USB_STATE_CONFIGURED+1)
782239214Shselasky
783239214Shselasky/*
784239214Shselasky * The "USB_EP_MODE" macros define all the currently supported
785239214Shselasky * endpoint modes.
786239214Shselasky */
787239214Shselaskyenum usb_ep_mode {
788239214Shselasky	USB_EP_MODE_DEFAULT,
789239214Shselasky	USB_EP_MODE_STREAMS,	/* USB3.0 specific */
790239214Shselasky	USB_EP_MODE_HW_MASS_STORAGE,
791239214Shselasky	USB_EP_MODE_HW_SERIAL,
792239214Shselasky	USB_EP_MODE_HW_ETHERNET_CDC,
793239214Shselasky	USB_EP_MODE_HW_ETHERNET_NCM,
794239214Shselasky	USB_EP_MODE_MAX
795239214Shselasky};
796194230Sthompsa#endif					/* _USB_STANDARD_H_ */
797