/* This test tests the case where there is no control interface. */ #include "usbx_ux_test_cdc_ecm.h" static unsigned char no_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 */ 0x29, 0x00, /* wTotalLength */ 0x02, /* bNumInterfaces */ 0x01, /* bConfigurationValue */ 0x00, /* iConfiguration */ 0xc0, /* bmAttributes - Self-powered */ 0x00, /* bMaxPower */ /* 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 = { no_control_interface_framework, sizeof(no_control_interface_framework), .dont_register_hcd = 1 }; /* Define what the initial system looks like. */ #ifdef CTEST void test_application_define(void *first_unused_memory) #else void usbx_cdc_ecm_no_control_interface_test_application_define(void *first_unused_memory) #endif { /* Inform user. */ printf("Running CDC-ECM No Control Interface Test........................... "); stepinfo("\n"); ux_test_cdc_ecm_initialize_use_framework(first_unused_memory, &device_init_data); } static void post_init_host() { /* We expect this to fail multiple times since enumeration tries multiple times. */ ux_test_add_action_to_main_list_multiple(create_error_match_action(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_DESCRIPTOR_CORRUPTED), 3); ux_test_add_action_to_main_list(create_error_match_action(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_ROOT_HUB, UX_DEVICE_ENUMERATION_FAILURE)); /* Begin enumeration. */ UX_TEST_CHECK_SUCCESS(ux_host_stack_hcd_register(_ux_system_host_hcd_simulator_name, _ux_test_hcd_sim_host_initialize, 0, 0)); /* The HCD init function put()s the HCD semaphore, so we can do this here. */ ux_test_wait_for_enum_thread_completion(); /* Enumeration should've failed. */ UX_TEST_ASSERT(ux_test_check_actions_empty()); UX_TEST_ASSERT(cdc_ecm_host_from_system_change_function == UX_NULL); } static void post_init_device() { }