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 0x02
97 /* c.f. CDC 4.3 Table 16 */
98 #define COMMUNICATIONS_NO_SUBCLASS 0x00
99 #define COMMUNICATIONS_DLCM_SUBCLASS 0x01
100 #define COMMUNICATIONS_ACM_SUBCLASS 0x02
101 #define COMMUNICATIONS_TCM_SUBCLASS 0x03
102 #define COMMUNICATIONS_MCCM_SUBCLASS 0x04
103 #define COMMUNICATIONS_CCM_SUBCLASS 0x05
104 #define COMMUNICATIONS_ENCM_SUBCLASS 0x06
105 #define COMMUNICATIONS_ANCM_SUBCLASS 0x07
108 #define COMMUNICATIONS_WHCM_SUBCLASS 0x08
109 #define COMMUNICATIONS_DMM_SUBCLASS 0x09
110 #define COMMUNICATIONS_MDLM_SUBCLASS 0x0a
111 #define COMMUNICATIONS_OBEX_SUBCLASS 0x0b
113 /* c.f. CDC 4.6 Table 18 */
114 #define DATA_INTERFACE_CLASS 0x0a
116 /* c.f. CDC 4.7 Table 19 */
117 #define COMMUNICATIONS_NO_PROTOCOL 0x00
120 /* c.f. CDC 5.2.3 Table 24 */
121 #define CS_INTERFACE 0x24
122 #define CS_ENDPOINT 0x25
125 * bDescriptorSubtypes
127 * c.f. CDC 5.2.3 Table 25
128 * c.f. WMCD 5.3 Table 5.3
131 #define USB_ST_HEADER 0x00
132 #define USB_ST_CMF 0x01
133 #define USB_ST_ACMF 0x02
134 #define USB_ST_DLMF 0x03
135 #define USB_ST_TRF 0x04
136 #define USB_ST_TCLF 0x05
137 #define USB_ST_UF 0x06
138 #define USB_ST_CSF 0x07
139 #define USB_ST_TOMF 0x08
140 #define USB_ST_USBTF 0x09
141 #define USB_ST_NCT 0x0a
142 #define USB_ST_PUF 0x0b
143 #define USB_ST_EUF 0x0c
144 #define USB_ST_MCMF 0x0d
145 #define USB_ST_CCMF 0x0e
146 #define USB_ST_ENF 0x0f
147 #define USB_ST_ATMNF 0x10
149 #define USB_ST_WHCM 0x11
150 #define USB_ST_MDLM 0x12
151 #define USB_ST_MDLMD 0x13
152 #define USB_ST_DMM 0x14
153 #define USB_ST_OBEX 0x15
154 #define USB_ST_CS 0x16
155 #define USB_ST_CSD 0x17
156 #define USB_ST_TCM 0x18
158 /* endpoint modifiers
159 * static struct usb_endpoint_description function_default_A_1[] = {
161 * {this_endpoint: 0, attributes: CONTROL, max_size: 8, polling_interval: 0 },
162 * {this_endpoint: 1, attributes: BULK, max_size: 64, polling_interval: 0, direction: IN},
163 * {this_endpoint: 2, attributes: BULK, max_size: 64, polling_interval: 0, direction: OUT},
164 * {this_endpoint: 3, attributes: INTERRUPT, max_size: 8, polling_interval: 0},
172 #define ISOCHRONOUS 0x01
174 #define INTERRUPT 0x03
177 /* configuration modifiers
179 #define BMATTRIBUTE_RESERVED 0x80
180 #define BMATTRIBUTE_SELF_POWERED 0x40
183 * standard usb descriptor structures
186 struct usb_endpoint_descriptor {
188 u8 bDescriptorType; /* 0x5 */
193 } __attribute__ ((packed));
195 struct usb_interface_descriptor {
197 u8 bDescriptorType; /* 0x04 */
199 u8 bAlternateSetting;
202 u8 bInterfaceSubClass;
203 u8 bInterfaceProtocol;
205 } __attribute__ ((packed));
207 struct usb_configuration_descriptor {
209 u8 bDescriptorType; /* 0x2 */
212 u8 bConfigurationValue;
216 } __attribute__ ((packed));
218 struct usb_device_descriptor {
220 u8 bDescriptorType; /* 0x01 */
232 u8 bNumConfigurations;
233 } __attribute__ ((packed));
235 struct usb_string_descriptor {
237 u8 bDescriptorType; /* 0x03 */
239 } __attribute__ ((packed));
241 struct usb_generic_descriptor {
244 u8 bDescriptorSubtype;
245 } __attribute__ ((packed));
249 * communications class descriptor structures
251 * c.f. CDC 5.2 Table 25c
254 struct usb_class_function_descriptor {
257 u8 bDescriptorSubtype;
258 } __attribute__ ((packed));
260 struct usb_class_function_descriptor_generic {
263 u8 bDescriptorSubtype;
265 } __attribute__ ((packed));
267 struct usb_class_header_function_descriptor {
270 u8 bDescriptorSubtype; /* 0x00 */
272 } __attribute__ ((packed));
274 struct usb_class_call_management_descriptor {
277 u8 bDescriptorSubtype; /* 0x01 */
280 } __attribute__ ((packed));
282 struct usb_class_abstract_control_descriptor {
285 u8 bDescriptorSubtype; /* 0x02 */
287 } __attribute__ ((packed));
289 struct usb_class_direct_line_descriptor {
292 u8 bDescriptorSubtype; /* 0x03 */
293 } __attribute__ ((packed));
295 struct usb_class_telephone_ringer_descriptor {
298 u8 bDescriptorSubtype; /* 0x04 */
300 u8 bNumRingerPatterns;
301 } __attribute__ ((packed));
303 struct usb_class_telephone_call_descriptor {
306 u8 bDescriptorSubtype; /* 0x05 */
308 } __attribute__ ((packed));
310 struct usb_class_union_function_descriptor {
313 u8 bDescriptorSubtype; /* 0x06 */
315 u8 bSlaveInterface0[0];
316 } __attribute__ ((packed));
318 struct usb_class_country_selection_descriptor {
321 u8 bDescriptorSubtype; /* 0x07 */
322 u8 iCountryCodeRelDate;
323 u16 wCountryCode0[0];
324 } __attribute__ ((packed));
327 struct usb_class_telephone_operational_descriptor {
330 u8 bDescriptorSubtype; /* 0x08 */
332 } __attribute__ ((packed));
335 struct usb_class_usb_terminal_descriptor {
338 u8 bDescriptorSubtype; /* 0x09 */
344 } __attribute__ ((packed));
346 struct usb_class_network_channel_descriptor {
349 u8 bDescriptorSubtype; /* 0x0a */
353 u8 bPhysicalInterface;
354 } __attribute__ ((packed));
356 struct usb_class_protocol_unit_function_descriptor {
359 u8 bDescriptorSubtype; /* 0x0b */
363 } __attribute__ ((packed));
365 struct usb_class_extension_unit_descriptor {
368 u8 bDescriptorSubtype; /* 0x0c */
373 } __attribute__ ((packed));
375 struct usb_class_multi_channel_descriptor {
378 u8 bDescriptorSubtype; /* 0x0d */
380 } __attribute__ ((packed));
382 struct usb_class_capi_control_descriptor {
385 u8 bDescriptorSubtype; /* 0x0e */
387 } __attribute__ ((packed));
389 struct usb_class_ethernet_networking_descriptor {
392 u8 bDescriptorSubtype; /* 0x0f */
394 u32 bmEthernetStatistics;
396 u16 wNumberMCFilters;
397 u8 bNumberPowerFilters;
398 } __attribute__ ((packed));
400 struct usb_class_atm_networking_descriptor {
403 u8 bDescriptorSubtype; /* 0x10 */
404 u8 iEndSystermIdentifier;
405 u8 bmDataCapabilities;
406 u8 bmATMDeviceStatistics;
407 u16 wType2MaxSegmentSize;
408 u16 wType3MaxSegmentSize;
410 } __attribute__ ((packed));
413 struct usb_class_mdlm_descriptor {
416 u8 bDescriptorSubtype; /* 0x12 */
419 } __attribute__ ((packed));
421 struct usb_class_mdlmd_descriptor {
424 u8 bDescriptorSubtype; /* 0x13 */
425 u8 bGuidDescriptorType;
428 } __attribute__ ((packed));
431 * HID class descriptor structures
436 struct usb_class_hid_descriptor {
441 u8 bNumDescriptors; /* 0x01 */
443 u16 wDescriptorLength0;
444 /* optional descriptors are not supported. */
445 } __attribute__((packed));
447 struct usb_class_report_descriptor {
448 u8 bLength; /* dummy */
452 } __attribute__((packed));
455 * descriptor union structures
458 struct usb_descriptor {
460 struct usb_generic_descriptor generic;
461 struct usb_endpoint_descriptor endpoint;
462 struct usb_interface_descriptor interface;
463 struct usb_configuration_descriptor configuration;
464 struct usb_device_descriptor device;
465 struct usb_string_descriptor string;
468 } __attribute__ ((packed));
470 struct usb_class_descriptor {
472 struct usb_class_function_descriptor function;
473 struct usb_class_function_descriptor_generic generic;
474 struct usb_class_header_function_descriptor header_function;
475 struct usb_class_call_management_descriptor call_management;
476 struct usb_class_abstract_control_descriptor abstract_control;
477 struct usb_class_direct_line_descriptor direct_line;
478 struct usb_class_telephone_ringer_descriptor telephone_ringer;
479 struct usb_class_telephone_operational_descriptor telephone_operational;
480 struct usb_class_telephone_call_descriptor telephone_call;
481 struct usb_class_union_function_descriptor union_function;
482 struct usb_class_country_selection_descriptor country_selection;
483 struct usb_class_usb_terminal_descriptor usb_terminal;
484 struct usb_class_network_channel_descriptor network_channel;
485 struct usb_class_extension_unit_descriptor extension_unit;
486 struct usb_class_multi_channel_descriptor multi_channel;
487 struct usb_class_capi_control_descriptor capi_control;
488 struct usb_class_ethernet_networking_descriptor ethernet_networking;
489 struct usb_class_atm_networking_descriptor atm_networking;
490 struct usb_class_mdlm_descriptor mobile_direct;
491 struct usb_class_mdlmd_descriptor mobile_direct_detail;
492 struct usb_class_hid_descriptor hid;
495 } __attribute__ ((packed));