51 #ifndef USB_USERCONFIG_H_
52 #define USB_USERCONFIG_H_
59 #include <avr/pgmspace.h>
67 #define USB_SPECIFICATION 0x0200
68 #if USB_CONF_MACINTOSH
69 #define COMPOSITE_DEVICE_CLASS 0x02 // Misc
70 #define COMPOSITE_DEVICE_SUB_CLASS 0x00 // Common
71 #define COMPOSITE_DEVICE_PROTOCOL 0x00 // IAD
72 #else //Windows wants these for composite device
74 #define COMPOSITE_DEVICE_CLASS 0xEF // Misc
75 #define COMPOSITE_DEVICE_SUB_CLASS 0x02 // Common
76 #define COMPOSITE_DEVICE_PROTOCOL 0x01 // IAD
79 #define NETWORK_DEVICE_CLASS 0x02 // CDC ACM
80 #define NETWORK_DEVICE_SUB_CLASS 0x02 //
81 #define NETWORK_DEVICE_PROTOCOL 0xFF // Vendor-specific
83 #define MASS_DEVICE_CLASS 0x00 //
84 #define MASS_DEVICE_SUB_CLASS 0x00 //
85 #define MASS_DEVICE_PROTOCOL 0x00 //
87 #define EEM_DEVICE_CLASS 0x02 // CDC
88 #define EEM_DEVICE_SUB_CLASS 0x0C // EEM
89 #define EEM_DEVICE_PROTOCOL 0x07 // EEM
91 #define EP_CONTROL_LENGTH 64
92 #define VENDOR_ID 0x03EB // Atmel vendor ID = 03EBh
94 #if USB_CONF_MACINTOSH
97 #define COMPOSITE_PRODUCT_ID 0x9921 //Product ID for composite device
98 #define NETWORK_PRODUCT_ID 0x9919 //Product ID for just CDC-ECM device
100 #define COMPOSITE_PRODUCT_ID 0x2021 //Product ID for composite device
101 #define NETWORK_PRODUCT_ID 0x2019 //Product ID for just RNDIS device
104 #define MASS_PRODUCT_ID 0x202F //Product ID for mass storage
105 #define RELEASE_NUMBER 0x1000
112 USB_STRING_MAC_ADDRESS,
113 USB_STRING_CONFIG_COMPOSITE,
114 USB_STRING_CONFIG_RNDIS,
115 USB_STRING_CONFIG_EEM,
116 USB_STRING_CONFIG_ECM,
117 USB_STRING_CONFIG_ECM_DEBUG,
118 USB_STRING_CONFIG_MS,
119 USB_STRING_INTERFACE_RNDIS,
120 USB_STRING_INTERFACE_EEM,
121 USB_STRING_INTERFACE_ECM,
122 USB_STRING_INTERFACE_ECM_ATTACHED,
123 USB_STRING_INTERFACE_ECM_DETACHED,
124 USB_STRING_INTERFACE_SERIAL,
125 USB_STRING_INTERFACE_MS,
130 USB_CONFIG_UNCONFIGURED = 0,
132 USB_CONFIG_RNDIS = 1,
133 USB_CONFIG_RNDIS_DEBUG = 1+(1<<7),
136 USB_CONFIG_ECM_DEBUG = 2+(1<<7),
145 #define USB_CONFIG_HAS_DEBUG_PORT(x) ((x==USB_CONFIG_ECM_DEBUG)||(x==USB_CONFIG_RNDIS_DEBUG))
150 #define NETWORK_NB_INTERFACE 2
151 #define COMPOSITE_NB_INTERFACE 4
152 #define MASS_NB_INTERFACE 1
153 #define EEM_NB_INTERFACE 1
156 #define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED
157 #define MAX_POWER 50 // 100 mA
162 #define INTERFACE0_NB 0
164 #define NB_ENDPOINT0 1
165 #define INTERFACE0_CLASS 0x02 // CDC ACM Com
166 #define INTERFACE0_SUB_CLASS 0x02
167 #define INTERFACE0_PROTOCOL 0xFF // Vendor specific
168 #define INTERFACE0_INDEX 0
171 #define INTERFACE1_NB 1
173 #define NB_ENDPOINT1 2
174 #define INTERFACE1_CLASS 0x0A // CDC ACM Data
175 #define INTERFACE1_SUB_CLASS 0
176 #define INTERFACE1_PROTOCOL 0
177 #define INTERFACE1_INDEX 0
181 #define ENDPOINT_NB_1 0x80 | INT_EP
182 #define EP_ATTRIBUTES_1 0x03 // BULK = 0x02, INTERUPT = 0x03
183 #define EP_SIZE_1 0x08
184 #define EP_INTERVAL_1 0x01 //ms interrupt pooling from host
188 #define ENDPOINT_NB_2 0x80 | TX_EP
189 #define EP_ATTRIBUTES_2 0x02 // BULK = 0x02, INTERUPT = 0x03
190 #define EP_SIZE_2 0x40 //64 byte max size
191 #define EP_INTERVAL_2 0x01
195 #define ENDPOINT_NB_3 RX_EP
196 #define EP_ATTRIBUTES_3 0x02 // BULK = 0x02, INTERUPT = 0x03
197 #define EP_SIZE_3 0x40 //64 byte max size
198 #define EP_INTERVAL_3 0x01
203 #define INTERFACE2_NB 2
205 #define NB_ENDPOINT2 1
206 #define INTERFACE2_CLASS 0x02 // CDC ACM Com
207 #define INTERFACE2_SUB_CLASS 0x02
208 #define INTERFACE2_PROTOCOL 0x01
209 #define INTERFACE2_INDEX 0
212 #define INTERFACE3_NB 3
214 #define NB_ENDPOINT3 2
215 #define INTERFACE3_CLASS 0x0A // CDC ACM Data
216 #define INTERFACE3_SUB_CLASS 0
217 #define INTERFACE3_PROTOCOL 0
218 #define INTERFACE3_INDEX 0
222 #define TX_EP_SIZE 0x20
223 #define ENDPOINT_NB_4 0x80 | VCP_INT_EP
224 #define EP_ATTRIBUTES_4 0x03 // BULK = 0x02, INTERUPT = 0x03
225 #define EP_SIZE_4 TX_EP_SIZE
226 #define EP_INTERVAL_4 0xFF //ms interrupt pooling from host
230 #define ENDPOINT_NB_5 0x80 | VCP_TX_EP
231 #define EP_ATTRIBUTES_5 0x02 // BULK = 0x02, INTERUPT = 0x03
232 #define EP_SIZE_5 0x20
233 #define EP_INTERVAL_5 0x01
237 #define ENDPOINT_NB_6 VCP_RX_EP
238 #define EP_ATTRIBUTES_6 0x02 // BULK = 0x02, INTERUPT = 0x03
239 #define EP_SIZE_6 0x20
240 #define EP_INTERVAL_6 0x01
244 #define MS_INTERFACE_NB 0
245 #define MS_ALTERNATE 0
246 #define MS_NB_ENDPOINT 2
247 #define MS_INTERFACE_CLASS 0x08 // Mass Storage Class
248 #define MS_INTERFACE_SUB_CLASS 0x06 // SCSI transparent Command Set
249 #define MS_INTERFACE_PROTOCOL 0x50 // Bulk-Only Transport
250 #define MS_INTERFACE_INDEX 0
253 #define MS_ENDPOINT_NB_1 (MS_IN_EP | 0x80)
254 #define MS_EP_ATTRIBUTES_1 0x02 // BULK = 0x02, INTERUPT = 0x03
255 #define MS_EP_IN_LENGTH 64
256 #define MS_EP_SIZE_1 MS_EP_IN_LENGTH
257 #define MS_EP_INTERVAL_1 0x00
261 #define MS_ENDPOINT_NB_2 MS_OUT_EP
262 #define MS_EP_ATTRIBUTES_2 0x02 // BULK = 0x02, INTERUPT = 0x03
263 #define MS_EP_IN_LENGTH 64
264 #define MS_EP_SIZE_2 MS_EP_IN_LENGTH
265 #define MS_EP_INTERVAL_2 0x00
270 #define EEM_INTERFACE0_NB 0
271 #define EEM_ALTERNATE0 0
272 #define EEM_NB_ENDPOINT0 2
273 #define EEM_INTERFACE0_CLASS 0x02 // CDC ACM Com
274 #define EEM_INTERFACE0_SUB_CLASS 0x0C // EEM
275 #define EEM_INTERFACE0_PROTOCOL 0x07 // EEM
276 #define EEM_INTERFACE0_INDEX 0
280 #define EEM_ENDPOINT_NB_1 0x80 | TX_EP
281 #define EEM_EP_ATTRIBUTES_1 0x02 // BULK = 0x02, INTERUPT = 0x03
282 #define EEM_EP_SIZE_1 0x40 //64 byte max size
283 #define EEM_EP_INTERVAL_1 0x01
287 #define EEM_ENDPOINT_NB_2 RX_EP
288 #define EEM_EP_ATTRIBUTES_2 0x02 // BULK = 0x02, INTERUPT = 0x03
289 #define EEM_EP_SIZE_2 0x40 //64 byte max size
290 #define EEM_EP_INTERVAL_2 0x01
295 #define ECM_INTERFACE0_NB 0
296 #define ECM_ALTERNATE0 0
297 #define ECM_NB_ENDPOINT0 2
298 #define ECM_INTERFACE0_CLASS 0x02 // CDC ACM Com
299 #define ECM_INTERFACE0_SUB_CLASS 0x06 // ECM
300 #define ECM_INTERFACE0_PROTOCOL 0x00 // Empty
301 #define ECM_INTERFACE0_INDEX 0
305 #define DEVICE_STATUS 0x00 // TBD
306 #define INTERFACE_STATUS 0x00 // TBD
310 #define LANGUAGE_ID 0x0409
403 #define DSC_TYPE_IAD 11
412 U8 bFunctionSubClass;
413 U8 bFunctionProtocol;
415 } S_usb_interface_association_descriptor;
424 S_usb_interface_association_descriptor iad0;
426 U8 CS1_INTERFACE[19];
432 S_usb_interface_association_descriptor iad1;
434 U8 CS2_INTERFACE[19];
440 } S_usb_user_configuration_descriptor_composite;
447 U8 CS1_INTERFACE[19];
453 } S_usb_user_configuration_descriptor_network;
462 } S_usb_user_configuration_descriptor_eem;
471 U8 bDescriptorSubtype;
473 U32 bmEthernetStatistics;
475 U16 wNumberMCFilters;
476 U8 bNumberPowerFilters;
477 } S_usb_ethernet_networking_functional_descriptor;
485 U8 CS1_INTERFACE[5+5];
486 S_usb_ethernet_networking_functional_descriptor fd0;
487 #if CDC_ECM_USES_INTERRUPT_ENDPOINT
496 } S_usb_user_configuration_descriptor_ecm;
503 S_usb_interface_association_descriptor iad0;
505 U8 CS1_INTERFACE[5+5];
506 S_usb_ethernet_networking_functional_descriptor fd0;
507 #if CDC_ECM_USES_INTERRUPT_ENDPOINT
517 S_usb_interface_association_descriptor iad1;
519 U8 CS2_INTERFACE[19];
525 } S_usb_user_configuration_descriptor_ecm_debug;
537 } S_usb_user_configuration_descriptor_mass;
541 PGM_VOID_P Usb_get_dev_desc_pointer(
void);
542 U8 Usb_get_dev_desc_length(
void);
543 PGM_VOID_P Usb_get_conf_desc_pointer(U8 index) ;
544 U8 Usb_get_conf_desc_length(U8 index);
546 #endif //USB_USERCONFIG_H_
This file contains the possible external configuration of the USB.
U16 bscUSB
Binay Coded Decimal Spec. release.
U8 bDeviceSubClass
Sub-class code assigned by the USB.
Usb Device Qualifier Descriptor.
U8 bDeviceSubClass
Sub-class code assigned by the USB.
U8 bNumEndpoints
Number of EP except EP 0.
U8 bDescriptorType
STRING descriptor type.
U8 bNumInterfaces
number of interfaces for this conf.
U8 bDescriptorType
ENDPOINT descriptor type.
U8 bLength
size of this descriptor in bytes
U8 bInterfaceSubClass
Sub-class code assigned by the USB.
U8 iSerialNumber
Index of S.N. string descriptor.
U16 wLength
Number of bytes to transfer if Data.
U8 bLength
Size of this descriptor in bytes.
U16 idVendor
Vendor ID. ATMEL = 0x03EB.
U8 iInterface
Index of string descriptor.
U8 bDeviceProtocol
Protocol code assigned by the USB.
U8 bInterfaceProtocol
Protocol code assigned by the USB.
U8 bLength
size of this descriptor in bytes
U16 wValue
field that varies according to request
U8 bNumConfigurations
Number of possible configurations.
U8 bLength
size of this descriptor in bytes
U16 bcdDevice
Device release number.
U8 iConfiguration
index of string descriptor
U8 bmAttributes
Endpoint's attributes.
Usb Interface Descriptor.
U8 bConfigurationValue
value for SetConfiguration resquest
U8 bMaxPacketSize0
Max packet size for EP0.
U8 bDeviceProtocol
Protocol code assigned by the USB.
U8 bLength
Size of this descriptor in bytes.
U8 bInterfaceNumber
Number of interface.
U8 bInterfaceClass
Class code assigned by the USB.
U8 bDescriptorType
INTERFACE descriptor type.
U8 iProduct
Index of prod. string descriptor.
U8 bReserved
Reserved for future use, must be zero.
U16 bscUSB
Binay Coded Decimal Spec. release.
U8 MaxPower
maximum power consumption
U8 bLength
Size of this descriptor in bytes.
Usb Configuration Descriptor.
U8 bmAttibutes
Configuration characteristics.
U16 wIndex
field that varies according to request
This file contains the USB endpoint 0 management routines corresponding to the standard enumeration p...
U8 bDescriptorType
Device Qualifier descriptor type.
U16 wMaxPacketSize
Maximum packet size for this EP.
U8 bDeviceClass
Class code assigned by the USB.
U8 bRequest
Specific request.
U8 bDescriptorType
CONFIGURATION descriptor type.
U8 bEndpointAddress
Address of the endpoint.
U8 bDeviceClass
Class code assigned by the USB.
U8 bMaxPacketSize0
Max packet size for EP0.
U8 bmRequestType
Characteristics of the request.
U8 bAlternateSetting
value to select alternate setting
U8 iManufacturer
Index of manu. string descriptor.
U16 idProduct
Product ID assigned by the manufacturer.
U16 wTotalLength
total length of data returned
U8 bDescriptorType
DEVICE descriptor type.
U8 bInterval
Interval for polling EP in ms.
U8 bNumConfigurations
Number of possible configurations.