1 /* This tests the case where the bulk out transfer fails (in the cdc_ecm_write). */
2 
3 #include "usbx_ux_test_cdc_ecm.h"
4 
5 /* Define what the initial system looks like.  */
6 #ifdef CTEST
test_application_define(void * first_unused_memory)7 void test_application_define(void *first_unused_memory)
8 #else
9 void usbx_cdc_ecm_host_bulk_out_transfer_fail_test_application_define(void *first_unused_memory)
10 #endif
11 {
12 
13     /* Inform user.  */
14     printf("Running CDC-ECM Host Bulk Out Transfer Fail Test.................... ");
15 
16     stepinfo("\n");
17 
18     ux_test_cdc_ecm_initialize(first_unused_memory);
19 }
20 
post_init_host()21 static void post_init_host()
22 {
23 
24     /* Create the action for having bulk in transfer fail. */
25     UX_TEST_ACTION bulk_transfer_fail_action = {0};
26     bulk_transfer_fail_action.usbx_function = UX_TEST_OVERRIDE_UX_HCD_SIM_HOST_ENTRY;
27     bulk_transfer_fail_action.function = UX_HCD_TRANSFER_REQUEST;
28     bulk_transfer_fail_action.req_action = UX_TEST_MATCH_EP;
29     bulk_transfer_fail_action.req_ep_address = 0x02;
30     bulk_transfer_fail_action.no_return = 0;
31     bulk_transfer_fail_action.status = UX_ERROR;
32     ux_test_add_action_to_main_list(bulk_transfer_fail_action);
33 
34     /* Now send a packet so write function will run. */
35     write_packet_tcp(&tcp_socket_host, &packet_pool_host, 0, "host");
36 
37     /* Ensure write failed. */
38     UX_TEST_CHECK_SUCCESS(ux_test_wait_for_empty_actions());
39 
40     /* Now we're done. */
41 }
42 
post_init_device()43 static void post_init_device()
44 {
45 }
46