64 #define USB_ETH_NET_FUNC_DESC(MACAddrString,etherStat,maxSegmentSize,nMCFilters,nPowerFilters) \
65 { sizeof(S_usb_ethernet_networking_functional_descriptor) \
69 , Usb_write_word_enum_struc(maxSegmentSize) \
70 , Usb_write_word_enum_struc(nMCFilters) \
76 #define USB_CONFIG_DESC(totalsize,interfaceCount,value,stringIndex,attr,power) \
77 { sizeof(S_usb_configuration_descriptor) \
78 , CONFIGURATION_DESCRIPTOR \
79 , Usb_write_word_enum_struc(totalsize) \
87 #define USB_ENDPOINT(nb,attr,maxpktsize,interval) \
88 { sizeof(S_usb_endpoint_descriptor) \
89 , ENDPOINT_DESCRIPTOR \
92 , Usb_write_word_enum_struc(maxpktsize) \
96 #define USB_IAD(firstinterface,interfacecount,funcClass,funcSubClass,funcProto,stringIndex) \
98 sizeof(S_usb_interface_association_descriptor), \
108 #define USB_INTERFACEDESC(nb,altsetting,endpointCount,interfaceClass,interfaceSubClass,interfaceProto,stringIndex) \
109 { sizeof(S_usb_interface_descriptor) \
110 , INTERFACE_DESCRIPTOR \
115 , interfaceSubClass \
121 #define FUNC_DESC_HEADER \
127 #define FUNC_DESC_CALL_MANAGEMENT(caps,dataInterface) \
135 #define FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT(caps) \
142 #define FUNC_DESC_UNION(masterInterface,slaveInterface) \
149 #define RNDIS_INTERFACES \
155 INTERFACE0_SUB_CLASS, \
156 INTERFACE0_PROTOCOL, \
157 USB_STRING_INTERFACE_RNDIS \
161 FUNC_DESC_CALL_MANAGEMENT(0x00,0x00), \
162 FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT(0x00), \
163 FUNC_DESC_UNION(0x00,0x01), \
165 USB_ENDPOINT(ENDPOINT_NB_1,EP_ATTRIBUTES_1,EP_SIZE_1,EP_INTERVAL_1), \
172 INTERFACE1_SUB_CLASS, \
173 INTERFACE1_PROTOCOL, \
176 USB_ENDPOINT(ENDPOINT_NB_2,EP_ATTRIBUTES_2,EP_SIZE_2,EP_INTERVAL_2), \
177 USB_ENDPOINT(ENDPOINT_NB_3,EP_ATTRIBUTES_3,EP_SIZE_3,EP_INTERVAL_3)
179 #define CDC_SERIAL_INTERFACES \
185 INTERFACE2_SUB_CLASS, \
186 INTERFACE2_PROTOCOL, \
187 USB_STRING_INTERFACE_SERIAL \
191 FUNC_DESC_CALL_MANAGEMENT(0x03,0x03), \
192 FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT(0x02), \
193 FUNC_DESC_UNION(0x02,0x03), \
195 USB_ENDPOINT(ENDPOINT_NB_4,EP_ATTRIBUTES_4,EP_SIZE_4,EP_INTERVAL_4), \
201 INTERFACE3_SUB_CLASS, \
202 INTERFACE3_PROTOCOL, \
205 USB_ENDPOINT(ENDPOINT_NB_5,EP_ATTRIBUTES_5,EP_SIZE_5,EP_INTERVAL_5), \
206 USB_ENDPOINT(ENDPOINT_NB_6,EP_ATTRIBUTES_6,EP_SIZE_6,EP_INTERVAL_6)
208 #define CDC_EEM_INTERFACES \
213 EEM_INTERFACE0_CLASS, \
214 EEM_INTERFACE0_SUB_CLASS, \
215 EEM_INTERFACE0_PROTOCOL, \
216 USB_STRING_INTERFACE_EEM \
218 USB_ENDPOINT(ENDPOINT_NB_1,EP_ATTRIBUTES_1,EP_SIZE_1,EP_INTERVAL_1), \
219 USB_ENDPOINT(ENDPOINT_NB_2,EP_ATTRIBUTES_2,EP_SIZE_2,EP_INTERVAL_2)
224 #if CDC_ECM_USES_INTERRUPT_ENDPOINT
225 #define CDC_ECM_CONTROL_ENDPOINT_COUNT 1
226 #define CDC_ECM_CONTROL_ENDPOINT USB_ENDPOINT(ENDPOINT_NB_1,EP_ATTRIBUTES_1,EP_SIZE_1,EP_INTERVAL_1),
228 #define CDC_ECM_CONTROL_ENDPOINT_COUNT 0
229 #define CDC_ECM_CONTROL_ENDPOINT
233 #define CDC_ECM_INTERFACES \
237 CDC_ECM_CONTROL_ENDPOINT_COUNT, \
238 ECM_INTERFACE0_CLASS, \
239 ECM_INTERFACE0_SUB_CLASS, \
240 ECM_INTERFACE0_PROTOCOL, \
241 USB_STRING_INTERFACE_ECM \
245 FUNC_DESC_UNION(0x00,0x01), \
247 USB_ETH_NET_FUNC_DESC( \
248 USB_STRING_MAC_ADDRESS, \
254 CDC_ECM_CONTROL_ENDPOINT \
256 ECM_INTERFACE0_NB+1, \
264 USB_ENDPOINT(ENDPOINT_NB_2,EP_ATTRIBUTES_2,EP_SIZE_2,EP_INTERVAL_2), \
265 USB_ENDPOINT(ENDPOINT_NB_3,EP_ATTRIBUTES_3,EP_SIZE_3,EP_INTERVAL_3)
290 #if USB_CONF_MACINTOSH
292 FLASH uint8_t usb_dev_config_order[] = {
295 USB_CONFIG_ECM_DEBUG,
299 USB_CONFIG_RNDIS_DEBUG,
309 FLASH uint8_t usb_dev_config_order[] = {
313 USB_CONFIG_RNDIS_DEBUG,
317 #if 0 //XP may have a problem with these extra configurations
320 USB_CONFIG_ECM_DEBUG,
334 sizeof(usb_dev_desc_composite)
337 , COMPOSITE_DEVICE_CLASS
338 , COMPOSITE_DEVICE_SUB_CLASS
339 , COMPOSITE_DEVICE_PROTOCOL
347 , (
sizeof(usb_dev_config_order)/
sizeof(*usb_dev_config_order))
352 FLASH S_usb_user_configuration_descriptor_composite usb_conf_desc_composite = {
354 sizeof(usb_conf_desc_composite),
355 COMPOSITE_NB_INTERFACE,
356 USB_CONFIG_RNDIS_DEBUG,
357 USB_STRING_CONFIG_COMPOSITE,
368 USB_STRING_INTERFACE_RNDIS
377 USB_STRING_INTERFACE_SERIAL
378 ),CDC_SERIAL_INTERFACES
404 FLASH S_usb_user_configuration_descriptor_network usb_conf_desc_network = {
406 sizeof(usb_conf_desc_network),
407 NETWORK_NB_INTERFACE,
409 USB_STRING_CONFIG_RNDIS,
443 FLASH S_usb_user_configuration_descriptor_eem usb_conf_desc_eem = {
445 sizeof(usb_conf_desc_eem),
448 USB_STRING_CONFIG_EEM,
456 FLASH S_usb_user_configuration_descriptor_ecm usb_conf_desc_ecm = {
458 sizeof(usb_conf_desc_ecm),
461 USB_STRING_CONFIG_ECM,
468 FLASH S_usb_user_configuration_descriptor_ecm_debug usb_conf_desc_ecm_debug = {
470 sizeof(usb_conf_desc_ecm_debug),
472 USB_CONFIG_ECM_DEBUG,
473 USB_STRING_CONFIG_ECM_DEBUG,
484 USB_STRING_INTERFACE_ECM
485 ),CDC_ECM_INTERFACES,
493 USB_STRING_INTERFACE_SERIAL
494 ),CDC_SERIAL_INTERFACES
526 FLASH S_usb_user_configuration_descriptor_mass usb_conf_desc_mass = {
528 , CONFIGURATION_DESCRIPTOR
532 , USB_STRING_CONFIG_MS
539 , INTERFACE_DESCRIPTOR
544 , MS_INTERFACE_SUB_CLASS
545 , MS_INTERFACE_PROTOCOL
546 , USB_STRING_INTERFACE_MS
550 , ENDPOINT_DESCRIPTOR
558 , ENDPOINT_DESCRIPTOR
575 sizeof(usb_user_language_id)
584 PGM_VOID_P Usb_get_dev_desc_pointer(
void)
587 return &(usb_dev_desc_composite.
bLength);
588 #else //these are all the same length
589 if (usb_mode == rndis_only)
590 return &(usb_dev_desc_network.
bLength);
592 if (usb_mode == rndis_debug)
593 return &(usb_dev_desc_composite.
bLength);
596 return &(usb_dev_desc_eem.bLength);
598 return &(usb_dev_desc_mass.bLength);
603 U8 Usb_get_dev_desc_length(
void)
606 return sizeof(usb_dev_desc_composite);
607 #else //these are all the same size
608 if (usb_mode == rndis_only)
609 return sizeof(usb_dev_desc_network);
611 if (usb_mode == rndis_debug)
612 return sizeof(usb_dev_desc_composite);
615 return sizeof(usb_dev_desc_eem);
617 return sizeof(usb_dev_desc_mass);
622 PGM_VOID_P Usb_get_conf_desc_pointer(U8 index)
625 switch(pgm_read_byte_near(&usb_dev_config_order[index])) {
627 return &(usb_conf_desc_ecm.cfg.bLength);
628 case USB_CONFIG_ECM_DEBUG:
629 return &(usb_conf_desc_ecm_debug.cfg.bLength);
630 case USB_CONFIG_RNDIS_DEBUG:
631 return &(usb_conf_desc_composite.cfg.bLength);
632 case USB_CONFIG_RNDIS:
633 return &(usb_conf_desc_network.cfg.bLength);
635 return &(usb_conf_desc_eem.cfg.bLength);
638 return &(usb_conf_desc_mass.cfg.bLength);
646 U8 Usb_get_conf_desc_length(U8 index)
648 switch(pgm_read_byte_near(&usb_dev_config_order[index])) {
650 return sizeof(usb_conf_desc_ecm);
651 case USB_CONFIG_ECM_DEBUG:
652 return sizeof(usb_conf_desc_ecm_debug);
653 case USB_CONFIG_RNDIS_DEBUG:
654 return sizeof(usb_conf_desc_composite);
655 case USB_CONFIG_RNDIS:
656 return sizeof (usb_conf_desc_network);
658 return sizeof(usb_conf_desc_eem);
661 return sizeof(usb_conf_desc_mass);
This file contains the user callback functions corresponding to the application.
This file contains the USB driver routines.
Usb Interface Descriptor.
#define Usb_write_word_enum_struc(x)
Usb_write_word_enum_struc This macro help to fill the U16 fill in USB enumeration struct...
U8 bLength
Size of this descriptor in bytes.
This file manages the RNDIS task.
Usb Configuration Descriptor.
This file contains the usb parameters that uniquely identify the application through descriptor table...