3 * Gerry Hamel, geh@ti.com, Texas Instruments
6 * linux/drivers/usbd/usb-function.h - USB Function
8 * Copyright (c) 2000, 2001, 2002 Lineo
9 * Copyright (c) 2001 Hewlett Packard
12 * Stuart Lynne <sl@lineo.com>,
13 * Tom Rushworth <tbr@lineo.com>,
14 * Bruce Balden <balden@lineo.com>
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 /* USB Descriptors - Create a complete description of all of the
33 * function driver capabilities. These map directly to the USB descriptors.
35 * This heirarchy is created by the functions drivers and is passed to the
36 * usb-device driver when the function driver is registered.
58 * The configuration structures refer to the USB Configurations that will be
59 * made available to a USB HOST during the enumeration process.
61 * The USB HOST will select a configuration and optionally an interface with
62 * the usb set configuration and set interface commands.
64 * The selected interface (or the default interface if not specifically
65 * selected) will define the list of endpoints that will be used.
67 * The configuration and interfaces are stored in an array that is indexed
68 * by the specified configuratin or interface number minus one.
70 * A configuration number of zero is used to specify a return to the unconfigured
76 #ifndef __USBDESCRIPTORS_H__
77 #define __USBDESCRIPTORS_H__
79 #include <asm/types.h>
82 * communications class types
84 * c.f. CDC USB Class Definitions for Communications Devices
85 * c.f. WMCD USB CDC Subclass Specification for Wireless Mobile Communications Devices
89 #define CLASS_BCD_VERSION 0x0110
91 /* c.f. CDC 4.1 Table 14 */
92 #define COMMUNICATIONS_DEVICE_CLASS 0x02
94 /* c.f. CDC 4.2 Table 15 */
95 #define COMMUNICATIONS_INTERFACE_CLASS_CONTROL 0x02
96 #define COMMUNICATIONS_INTERFACE_CLASS_DATA 0x0A
97 #define COMMUNICATIONS_INTERFACE_CLASS_VENDOR 0x0FF
99 /* c.f. CDC 4.3 Table 16 */
100 #define COMMUNICATIONS_NO_SUBCLASS 0x00
101 #define COMMUNICATIONS_DLCM_SUBCLASS 0x01
102 #define COMMUNICATIONS_ACM_SUBCLASS 0x02
103 #define COMMUNICATIONS_TCM_SUBCLASS 0x03
104 #define COMMUNICATIONS_MCCM_SUBCLASS 0x04
105 #define COMMUNICATIONS_CCM_SUBCLASS 0x05
106 #define COMMUNICATIONS_ENCM_SUBCLASS 0x06
107 #define COMMUNICATIONS_ANCM_SUBCLASS 0x07
110 #define COMMUNICATIONS_WHCM_SUBCLASS 0x08
111 #define COMMUNICATIONS_DMM_SUBCLASS 0x09
112 #define COMMUNICATIONS_MDLM_SUBCLASS 0x0a
113 #define COMMUNICATIONS_OBEX_SUBCLASS 0x0b
115 /* c.f. CDC 4.4 Table 17 */
116 #define COMMUNICATIONS_NO_PROTOCOL 0x00
117 #define COMMUNICATIONS_V25TER_PROTOCOL 0x01 /*Common AT Hayes compatible*/
119 /* c.f. CDC 4.5 Table 18 */
120 #define DATA_INTERFACE_CLASS 0x0a
122 /* c.f. CDC 4.6 No Table */
123 #define DATA_INTERFACE_SUBCLASS_NONE 0x00 /* No subclass pertinent */
125 /* c.f. CDC 4.7 Table 19 */
126 #define DATA_INTERFACE_PROTOCOL_NONE 0x00 /* No class protcol required */
129 /* c.f. CDC 5.2.3 Table 24 */
130 #define CS_INTERFACE 0x24
131 #define CS_ENDPOINT 0x25
134 * bDescriptorSubtypes
136 * c.f. CDC 5.2.3 Table 25
137 * c.f. WMCD 5.3 Table 5.3
140 #define USB_ST_HEADER 0x00
141 #define USB_ST_CMF 0x01
142 #define USB_ST_ACMF 0x02
143 #define USB_ST_DLMF 0x03
144 #define USB_ST_TRF 0x04
145 #define USB_ST_TCLF 0x05
146 #define USB_ST_UF 0x06
147 #define USB_ST_CSF 0x07
148 #define USB_ST_TOMF 0x08
149 #define USB_ST_USBTF 0x09
150 #define USB_ST_NCT 0x0a
151 #define USB_ST_PUF 0x0b
152 #define USB_ST_EUF 0x0c
153 #define USB_ST_MCMF 0x0d
154 #define USB_ST_CCMF 0x0e
155 #define USB_ST_ENF 0x0f
156 #define USB_ST_ATMNF 0x10
158 #define USB_ST_WHCM 0x11
159 #define USB_ST_MDLM 0x12
160 #define USB_ST_MDLMD 0x13
161 #define USB_ST_DMM 0x14
162 #define USB_ST_OBEX 0x15
163 #define USB_ST_CS 0x16
164 #define USB_ST_CSD 0x17
165 #define USB_ST_TCM 0x18
167 /* endpoint modifiers
168 * static struct usb_endpoint_description function_default_A_1[] = {
170 * {this_endpoint: 0, attributes: CONTROL, max_size: 8, polling_interval: 0 },
171 * {this_endpoint: 1, attributes: BULK, max_size: 64, polling_interval: 0, direction: IN},
172 * {this_endpoint: 2, attributes: BULK, max_size: 64, polling_interval: 0, direction: OUT},
173 * {this_endpoint: 3, attributes: INTERRUPT, max_size: 8, polling_interval: 0},
181 #define ISOCHRONOUS 0x01
183 #define INTERRUPT 0x03
186 /* configuration modifiers
188 #define BMATTRIBUTE_RESERVED 0x80
189 #define BMATTRIBUTE_SELF_POWERED 0x40
192 * standard usb descriptor structures
195 struct usb_endpoint_descriptor {
197 u8 bDescriptorType; /* 0x5 */
202 } __attribute__ ((packed));
204 struct usb_interface_descriptor {
206 u8 bDescriptorType; /* 0x04 */
208 u8 bAlternateSetting;
211 u8 bInterfaceSubClass;
212 u8 bInterfaceProtocol;
214 } __attribute__ ((packed));
216 struct usb_configuration_descriptor {
218 u8 bDescriptorType; /* 0x2 */
221 u8 bConfigurationValue;
225 } __attribute__ ((packed));
227 struct usb_device_descriptor {
229 u8 bDescriptorType; /* 0x01 */
241 u8 bNumConfigurations;
242 } __attribute__ ((packed));
244 struct usb_string_descriptor {
246 u8 bDescriptorType; /* 0x03 */
248 } __attribute__ ((packed));
250 struct usb_generic_descriptor {
253 u8 bDescriptorSubtype;
254 } __attribute__ ((packed));
258 * communications class descriptor structures
260 * c.f. CDC 5.2 Table 25c
263 struct usb_class_function_descriptor {
266 u8 bDescriptorSubtype;
267 } __attribute__ ((packed));
269 struct usb_class_function_descriptor_generic {
272 u8 bDescriptorSubtype;
274 } __attribute__ ((packed));
276 struct usb_class_header_function_descriptor {
279 u8 bDescriptorSubtype; /* 0x00 */
281 } __attribute__ ((packed));
283 struct usb_class_call_management_descriptor {
286 u8 bDescriptorSubtype; /* 0x01 */
289 } __attribute__ ((packed));
291 struct usb_class_abstract_control_descriptor {
294 u8 bDescriptorSubtype; /* 0x02 */
296 } __attribute__ ((packed));
298 struct usb_class_direct_line_descriptor {
301 u8 bDescriptorSubtype; /* 0x03 */
302 } __attribute__ ((packed));
304 struct usb_class_telephone_ringer_descriptor {
307 u8 bDescriptorSubtype; /* 0x04 */
309 u8 bNumRingerPatterns;
310 } __attribute__ ((packed));
312 struct usb_class_telephone_call_descriptor {
315 u8 bDescriptorSubtype; /* 0x05 */
317 } __attribute__ ((packed));
319 struct usb_class_union_function_descriptor {
322 u8 bDescriptorSubtype; /* 0x06 */
324 /* u8 bSlaveInterface0[0]; */
326 } __attribute__ ((packed));
328 struct usb_class_country_selection_descriptor {
331 u8 bDescriptorSubtype; /* 0x07 */
332 u8 iCountryCodeRelDate;
333 u16 wCountryCode0[0];
334 } __attribute__ ((packed));
337 struct usb_class_telephone_operational_descriptor {
340 u8 bDescriptorSubtype; /* 0x08 */
342 } __attribute__ ((packed));
345 struct usb_class_usb_terminal_descriptor {
348 u8 bDescriptorSubtype; /* 0x09 */
354 } __attribute__ ((packed));
356 struct usb_class_network_channel_descriptor {
359 u8 bDescriptorSubtype; /* 0x0a */
363 u8 bPhysicalInterface;
364 } __attribute__ ((packed));
366 struct usb_class_protocol_unit_function_descriptor {
369 u8 bDescriptorSubtype; /* 0x0b */
373 } __attribute__ ((packed));
375 struct usb_class_extension_unit_descriptor {
378 u8 bDescriptorSubtype; /* 0x0c */
383 } __attribute__ ((packed));
385 struct usb_class_multi_channel_descriptor {
388 u8 bDescriptorSubtype; /* 0x0d */
390 } __attribute__ ((packed));
392 struct usb_class_capi_control_descriptor {
395 u8 bDescriptorSubtype; /* 0x0e */
397 } __attribute__ ((packed));
399 struct usb_class_ethernet_networking_descriptor {
402 u8 bDescriptorSubtype; /* 0x0f */
404 u32 bmEthernetStatistics;
406 u16 wNumberMCFilters;
407 u8 bNumberPowerFilters;
408 } __attribute__ ((packed));
410 struct usb_class_atm_networking_descriptor {
413 u8 bDescriptorSubtype; /* 0x10 */
414 u8 iEndSystermIdentifier;
415 u8 bmDataCapabilities;
416 u8 bmATMDeviceStatistics;
417 u16 wType2MaxSegmentSize;
418 u16 wType3MaxSegmentSize;
420 } __attribute__ ((packed));
423 struct usb_class_mdlm_descriptor {
426 u8 bDescriptorSubtype; /* 0x12 */
429 } __attribute__ ((packed));
431 struct usb_class_mdlmd_descriptor {
434 u8 bDescriptorSubtype; /* 0x13 */
435 u8 bGuidDescriptorType;
438 } __attribute__ ((packed));
441 * HID class descriptor structures
446 struct usb_class_hid_descriptor {
451 u8 bNumDescriptors; /* 0x01 */
453 u16 wDescriptorLength0;
454 /* optional descriptors are not supported. */
455 } __attribute__((packed));
457 struct usb_class_report_descriptor {
458 u8 bLength; /* dummy */
462 } __attribute__((packed));
465 * descriptor union structures
468 struct usb_descriptor {
470 struct usb_generic_descriptor generic;
471 struct usb_endpoint_descriptor endpoint;
472 struct usb_interface_descriptor interface;
473 struct usb_configuration_descriptor configuration;
474 struct usb_device_descriptor device;
475 struct usb_string_descriptor string;
478 } __attribute__ ((packed));
480 struct usb_class_descriptor {
482 struct usb_class_function_descriptor function;
483 struct usb_class_function_descriptor_generic generic;
484 struct usb_class_header_function_descriptor header_function;
485 struct usb_class_call_management_descriptor call_management;
486 struct usb_class_abstract_control_descriptor abstract_control;
487 struct usb_class_direct_line_descriptor direct_line;
488 struct usb_class_telephone_ringer_descriptor telephone_ringer;
489 struct usb_class_telephone_operational_descriptor telephone_operational;
490 struct usb_class_telephone_call_descriptor telephone_call;
491 struct usb_class_union_function_descriptor union_function;
492 struct usb_class_country_selection_descriptor country_selection;
493 struct usb_class_usb_terminal_descriptor usb_terminal;
494 struct usb_class_network_channel_descriptor network_channel;
495 struct usb_class_extension_unit_descriptor extension_unit;
496 struct usb_class_multi_channel_descriptor multi_channel;
497 struct usb_class_capi_control_descriptor capi_control;
498 struct usb_class_ethernet_networking_descriptor ethernet_networking;
499 struct usb_class_atm_networking_descriptor atm_networking;
500 struct usb_class_mdlm_descriptor mobile_direct;
501 struct usb_class_mdlmd_descriptor mobile_direct_detail;
502 struct usb_class_hid_descriptor hid;
505 } __attribute__ ((packed));