/* This test tests the case where there is an interface before the control interface. In this case, it's a storage class interface. We do this because during activation, we need to link the the control interface into the class instance, so we need to find it. */ #include "usbx_ux_test_cdc_ecm.h" static unsigned char interface_before_control_interface_framework[] = { /* Device Descriptor */ 0x12, /* bLength */ 0x01, /* bDescriptorType */ 0x10, 0x01, /* bcdUSB */ 0xef, /* bDeviceClass - Depends on bDeviceSubClass */ 0x02, /* bDeviceSubClass - Depends on bDeviceProtocol */ 0x01, /* bDeviceProtocol - There's an IAD */ 0x40, /* bMaxPacketSize0 */ 0x70, 0x07, /* idVendor */ 0x42, 0x10, /* idProduct */ 0x00, 0x01, /* bcdDevice */ 0x01, /* iManufacturer */ 0x02, /* iProduct */ 0x03, /* iSerialNumber */ 0x01, /* bNumConfigurations */ /* Configuration Descriptor */ 0x09, /* bLength */ 0x02, /* bDescriptorType */ 0x76, 0x00, /* wTotalLength */ 0x02, /* bNumInterfaces */ 0x01, /* bConfigurationValue */ 0x00, /* iConfiguration */ 0xc0, /* bmAttributes - Self-powered */ 0x00, /* bMaxPower */ /* Interface Descriptor */ 0x09, /* bLength */ 0x04, /* bDescriptorType */ 0x00, /* bInterfaceNumber */ 0x00, /* bAlternateSetting */ 0x03, /* bNumEndpoints */ 0x08, /* bInterfaceClass - Mass Storage */ 0x06, /* bInterfaceSubClass */ 0x50, /* bInterfaceProtocol */ 0x00, /* iInterface */ /* Endpoint Descriptor */ 0x07, /* bLength */ 0x05, /* bDescriptorType */ 0x81, /* bEndpointAddress */ 0x02, /* bmAttributes - Bulk */ 0x40, 0x00, /* wMaxPacketSize */ 0x00, /* bInterval */ /* Endpoint Descriptor */ 0x07, /* bLength */ 0x05, /* bDescriptorType */ 0x02, /* bEndpointAddress */ 0x02, /* bmAttributes - Bulk */ 0x40, 0x00, /* wMaxPacketSize */ 0x00, /* bInterval */ /* Endpoint Descriptor */ 0x07, /* bLength */ 0x05, /* bDescriptorType */ 0x83, /* bEndpointAddress */ 0x03, /* bmAttributes - Interrupt */ 0x40, 0x00, /* wMaxPacketSize */ 0x01, /* bInterval */ /* Interface Association Descriptor */ 0x08, /* bLength */ 0x0b, /* bDescriptorType */ 0x00, /* bFirstInterface */ 0x02, /* bInterfaceCount */ 0x02, /* bFunctionClass - CDC - Communication */ 0x06, /* bFunctionSubClass - ECM */ 0x00, /* bFunctionProtocol - No class specific protocol required */ 0x00, /* iFunction */ /* Interface Descriptor */ 0x09, /* bLength */ 0x04, /* bDescriptorType */ 0x00, /* bInterfaceNumber */ 0x00, /* bAlternateSetting */ 0x01, /* bNumEndpoints */ 0x02, /* bInterfaceClass - CDC - Communication */ 0x06, /* bInterfaceSubClass - ECM */ 0x00, /* bInterfaceProtocol - No class specific protocol required */ 0x00, /* iInterface */ /* CDC Header Functional Descriptor */ 0x05, /* bLength */ 0x24, /* bDescriptorType */ 0x00, /* bDescriptorSubType */ 0x10, 0x01, /* bcdCDC */ /* CDC ECM Functional Descriptor */ 0x0d, /* bLength */ 0x24, /* bDescriptorType */ 0x0f, /* bDescriptorSubType */ 0x04, /* iMACAddress */ 0x00, 0x00, 0x00, 0x00, /* bmEthernetStatistics */ 0xea, 0x05, /* wMaxSegmentSize */ 0x00, 0x00, /* wNumberMCFilters */ 0x00, /* bNumberPowerFilters */ /* CDC Union Functional Descriptor */ 0x05, /* bLength */ 0x24, /* bDescriptorType */ 0x06, /* bDescriptorSubType */ 0x00, /* bmMasterInterface */ 0x01, /* bmSlaveInterface0 */ /* Endpoint Descriptor */ 0x07, /* bLength */ 0x05, /* bDescriptorType */ 0x84, /* bEndpointAddress */ 0x03, /* bmAttributes - Interrupt */ 0x08, 0x00, /* wMaxPacketSize */ 0x08, /* bInterval */ /* Interface Descriptor */ 0x09, /* bLength */ 0x04, /* bDescriptorType */ 0x01, /* bInterfaceNumber */ 0x00, /* bAlternateSetting */ 0x00, /* bNumEndpoints */ 0x0a, /* bInterfaceClass - CDC - Data */ 0x00, /* bInterfaceSubClass - Should be 0x00 */ 0x00, /* bInterfaceProtocol - No class specific protocol required */ 0x00, /* iInterface */ /* Interface Descriptor */ 0x09, /* bLength */ 0x04, /* bDescriptorType */ 0x01, /* bInterfaceNumber */ 0x01, /* bAlternateSetting */ 0x02, /* bNumEndpoints */ 0x0a, /* bInterfaceClass - CDC - Data */ 0x00, /* bInterfaceSubClass - Should be 0x00 */ 0x00, /* bInterfaceProtocol - No class specific protocol required */ 0x00, /* iInterface */ /* Endpoint Descriptor */ 0x07, /* bLength */ 0x05, /* bDescriptorType */ 0x05, /* bEndpointAddress */ 0x02, /* bmAttributes - Bulk */ 0x40, 0x00, /* wMaxPacketSize */ 0x00, /* bInterval */ /* Endpoint Descriptor */ 0x07, /* bLength */ 0x05, /* bDescriptorType */ 0x86, /* bEndpointAddress */ 0x02, /* bmAttributes - Bulk */ 0x40, 0x00, /* wMaxPacketSize */ 0x00, /* bInterval */ }; static DEVICE_INIT_DATA device_init_data = { interface_before_control_interface_framework, sizeof(interface_before_control_interface_framework) }; /* Define what the initial system looks like. */ #ifdef CTEST void test_application_define(void *first_unused_memory) #else void usbx_cdc_ecm_interface_before_control_interface_test_application_define(void *first_unused_memory) #endif { /* Inform user. */ printf("Running cdc_ecm interface before control interface Test............. "); stepinfo("\n"); ux_test_cdc_ecm_initialize_use_framework(first_unused_memory, &device_init_data); } static void post_init_host() { cdc_ecm_basic_test(BASIC_TEST_HOST, BASIC_TEST_TCP); } static void post_init_device() { cdc_ecm_basic_test(BASIC_TEST_DEVICE, BASIC_TEST_TCP); }