1 #include <stdio.h>
2 #include "tx_api.h"
3 #include "ux_api.h"
4 #include "ux_system.h"
5 #include "ux_utility.h"
6 #include "ux_hcd_sim_host.h"
7 #include "ux_test.h"
8 #include "ux_test_utility_sim.h"
9 
10 
11 extern UINT  _ux_host_stack_new_endpoint_create(UX_INTERFACE *ux_interface, UCHAR * interface_endpoint);
12 
13 #define UX_TEST_MEMORY_SIZE  (32 * 1024)
14 static UX_INTERFACE test_interface;
15 static struct UX_CONFIGURATION_STRUCT  test_configuration;
16 static UCHAR test_interface_data[] = {
17     /* ---------------------------------  Endpoint Descriptor */
18     /* 0 bLength,  bDescriptorType                            */ 0x04,     0x01,
19     /* 2 bEndpintAddress, bmAttributes                        */ 0x00,     0x03,
20     /* 4 wMaxPacketSize,                                      */ 0x00,     0x04,
21     /* 6 bInterval                                            */ 0x00};
22 #ifdef CTEST
test_application_define(void * first_unused_memory)23 void test_application_define(void *first_unused_memory)
24 #else
25 void    usbx_host_stack_new_endpoint_create_overage_test_application_define(void *first_unused_memory)
26 #endif
27 {
28 
29 UINT                    status = 0;
30 UX_INTERFACE            *usbx_interface = &test_interface;
31  UCHAR* interface_endpoint = test_interface_data;
32  VOID* memory_pointer;
33 
34     /* Inform user.  */
35     printf("Running USB host Stack New Endpoint Create Coverage Test ........... ");
36 
37     memory_pointer = first_unused_memory;
38 
39     /* Initialize USBX Memory.  */
40     status =  ux_system_initialize(memory_pointer, UX_TEST_MEMORY_SIZE, UX_NULL, 0);
41 
42     test_interface.ux_interface_configuration = &test_configuration;
43 
44     status = _ux_host_stack_new_endpoint_create(usbx_interface, interface_endpoint);
45 
46     if (status == UX_DESCRIPTOR_CORRUPTED)
47         printf("   Passed\n");
48     else
49         printf("   Failure\n");
50 
51     test_control_return(0);
52     return;
53 }
54