1 /* This tests the ux_host_class_hub_transfer_request_completed.c API. */ 2 3 #include "usbx_ux_test_hub.h" 4 5 #ifdef CTEST test_application_define(void * first_unused_memory)6void test_application_define(void *first_unused_memory) 7 #else 8 void usbx_ux_host_class_hub_transfer_request_completed_test_application_define(void *first_unused_memory) 9 #endif 10 { 11 12 /* Inform user. */ 13 printf("Running ux_host_class_hub_status_get Test........................... "); 14 15 stepinfo("\n"); 16 17 initialize_hub(first_unused_memory); 18 } 19 post_init_host()20static void post_init_host() 21 { 22 23 UX_TRANSFER transfer; 24 UX_TRANSFER *actual_interrupt_transfer; 25 UX_HOST_CLASS_HUB hub; 26 27 transfer.ux_transfer_request_class_instance = (VOID *)&hub; 28 29 /** Test class in shutdown. **/ 30 hub.ux_host_class_hub_state = UX_HOST_CLASS_INSTANCE_SHUTDOWN; 31 _ux_host_class_hub_transfer_request_completed(&transfer); 32 33 /** Test aborted transfer. **/ 34 hub.ux_host_class_hub_state = UX_HOST_CLASS_INSTANCE_LIVE; 35 transfer.ux_transfer_request_completion_code = UX_TRANSFER_STATUS_ABORT; 36 _ux_host_class_hub_transfer_request_completed(&transfer); 37 38 /** Test no answer from transfer. **/ 39 hub.ux_host_class_hub_state = UX_HOST_CLASS_INSTANCE_LIVE; 40 transfer.ux_transfer_request_completion_code = UX_TRANSFER_NO_ANSWER; 41 _ux_host_class_hub_transfer_request_completed(&transfer); 42 43 /** Test completion code that triggers interrupt transfer reactivation. **/ 44 45 actual_interrupt_transfer = &g_hub_host->ux_host_class_hub_interrupt_endpoint->ux_endpoint_transfer_request; 46 actual_interrupt_transfer->ux_transfer_request_completion_code = UX_TRANSFER_STALLED; 47 48 /* First, abort current transfer. */ 49 ux_host_stack_transfer_request_abort(actual_interrupt_transfer); 50 51 /* Now call it. */ 52 _ux_host_class_hub_transfer_request_completed(actual_interrupt_transfer); 53 54 #if UX_MAX_DEVICES > 1 55 /* Make sure the interrupt EP still works. */ 56 connect_device_to_hub(); 57 58 class_dpump_get(); 59 #endif 60 } 61 post_init_device()62static void post_init_device() 63 { 64 }