1 /* This test is designed to test the ux_host_stack_bandwidth_.... */
2
3 #include <stdio.h>
4 #include "tx_api.h"
5 #include "ux_api.h"
6 #include "ux_system.h"
7 #include "ux_utility.h"
8
9 #include "ux_host_stack.h"
10 #include "ux_device_stack.h"
11
12 #include "ux_device_class_cdc_acm.h"
13 #include "ux_host_class_cdc_acm.h"
14
15 #include "ux_host_class_dpump.h"
16 #include "ux_device_class_dpump.h"
17
18 #include "ux_host_class_hid.h"
19 #include "ux_device_class_hid.h"
20
21 #include "ux_host_class_storage.h"
22 #include "ux_device_class_storage.h"
23
24 #include "ux_test_dcd_sim_slave.h"
25 #include "ux_test_hcd_sim_host.h"
26 #include "ux_test_utility_sim.h"
27
28
29 /* Define USBX test constants. */
30
31 #define UX_TEST_STACK_SIZE 4096
32 #define UX_TEST_BUFFER_SIZE 2048
33 #define UX_TEST_RUN 1
34 #define UX_TEST_MEMORY_SIZE (64*1024)
35
36 #define LSB(x) ( (x) & 0x00ff)
37 #define MSB(x) (((x) & 0xff00) >> 8)
38
39 /* Configuration descriptor 9 bytes */
40 #define CFG_DESC(wTotalLength, bNumInterfaces, bConfigurationValue)\
41 /* Configuration 1 descriptor 9 bytes */\
42 0x09, 0x02, LSB(wTotalLength), MSB(wTotalLength),\
43 (bNumInterfaces), (bConfigurationValue), 0x00,\
44 0x40, 0x00,
45 #define CFG_DESC_LEN 9
46
47 /* DPUMP interface descriptors. */
48 #define DPUMP_IFC_DESC(ifc, alt, nb_ep) \
49 /* Interface descriptor */\
50 0x09, 0x04, (ifc), (alt), (nb_ep), 0x99, 0x99, 0x99, 0x00,
51
52 #define DPUMP_IFC_EP_DESC(epaddr, eptype, epsize) \
53 /* Endpoint descriptor */\
54 0x07, 0x05, (epaddr), (eptype), LSB(epsize), MSB(epsize), 0x01,
55
56 #define DPUMP_IFC_DESC_ALL_LEN(nb_ep) (9 + (nb_ep) * 7)
57
58 #define CFG_DESC_ALL_LEN (CFG_DESC_LEN + \
59 DPUMP_IFC_DESC_ALL_LEN(0) + \
60 DPUMP_IFC_DESC_ALL_LEN(1) + \
61 DPUMP_IFC_DESC_ALL_LEN(2) + \
62 DPUMP_IFC_DESC_ALL_LEN(3) + \
63 DPUMP_IFC_DESC_ALL_LEN(4) \
64 )
65
66 #define CFG_DESC_ALL_LS \
67 CFG_DESC(CFG_DESC_ALL_LEN, 5, 1)\
68 DPUMP_IFC_DESC(0, 0, 0)\
69 DPUMP_IFC_DESC(0, 1, 1)\
70 DPUMP_IFC_EP_DESC(0x81, 3, 8)\
71 DPUMP_IFC_DESC(0, 2, 2)\
72 DPUMP_IFC_EP_DESC(0x81, 3, 8)\
73 DPUMP_IFC_EP_DESC(0x02, 3, 8)\
74 DPUMP_IFC_DESC(0, 3, 3)\
75 DPUMP_IFC_EP_DESC(0x81, 3, 8)\
76 DPUMP_IFC_EP_DESC(0x02, 3, 8)\
77 DPUMP_IFC_EP_DESC(0x83, 3, 8)\
78 DPUMP_IFC_DESC(0, 4, 6)\
79 DPUMP_IFC_EP_DESC(0x81, 3, 8)\
80 DPUMP_IFC_EP_DESC(0x02, 3, 8)\
81 DPUMP_IFC_EP_DESC(0x83, 3, 8)\
82 DPUMP_IFC_EP_DESC(0x04, 3, 8)\
83 DPUMP_IFC_EP_DESC(0x85, 3, 8)\
84 DPUMP_IFC_EP_DESC(0x06, 3, 8)
85
86 #define CFG_DESC_ALL_FS \
87 CFG_DESC(CFG_DESC_ALL_LEN, 5, 1)\
88 DPUMP_IFC_DESC(0, 0, 0)\
89 DPUMP_IFC_DESC(0, 1, 1)\
90 DPUMP_IFC_EP_DESC(0x81, 3, 64)\
91 DPUMP_IFC_DESC(0, 2, 2)\
92 DPUMP_IFC_EP_DESC(0x81, 3, 64)\
93 DPUMP_IFC_EP_DESC(0x02, 3, 64)\
94 DPUMP_IFC_DESC(0, 3, 3)\
95 DPUMP_IFC_EP_DESC(0x81, 3, 64)\
96 DPUMP_IFC_EP_DESC(0x02, 3, 64)\
97 DPUMP_IFC_EP_DESC(0x83, 3, 64)\
98 DPUMP_IFC_DESC(0, 4, 4)\
99 DPUMP_IFC_EP_DESC(0x81, 3, 64)\
100 DPUMP_IFC_EP_DESC(0x02, 3, 64)\
101 DPUMP_IFC_EP_DESC(0x83, 3, 64)\
102 DPUMP_IFC_EP_DESC(0x04, 3, 64)
103
104 #define CFG_DESC_ALL_HS \
105 CFG_DESC(CFG_DESC_ALL_LEN, 5, 1)\
106 DPUMP_IFC_DESC(0, 0, 0)\
107 DPUMP_IFC_DESC(0, 1, 1)\
108 DPUMP_IFC_EP_DESC(0x81, 3, 1024)\
109 DPUMP_IFC_DESC(0, 2, 2)\
110 DPUMP_IFC_EP_DESC(0x81, 3, 1024)\
111 DPUMP_IFC_EP_DESC(0x02, 3, 1024)\
112 DPUMP_IFC_DESC(0, 3, 3)\
113 DPUMP_IFC_EP_DESC(0x81, 3, 1024)\
114 DPUMP_IFC_EP_DESC(0x02, 3, 1024)\
115 DPUMP_IFC_EP_DESC(0x83, 3, 1024)\
116 DPUMP_IFC_DESC(0, 4, 4)\
117 DPUMP_IFC_EP_DESC(0x81, 3, 1024)\
118 DPUMP_IFC_EP_DESC(0x02, 3, 1024)\
119 DPUMP_IFC_EP_DESC(0x83, 3, 1024)\
120 DPUMP_IFC_EP_DESC(0x04, 3, 1024)
121
122 /* Define the counters used in the test application... */
123
124 static ULONG thread_0_counter;
125 static ULONG thread_1_counter;
126 static ULONG error_counter;
127
128 static UCHAR error_callback_ignore = UX_FALSE;
129 static ULONG error_callback_counter;
130
131 static UCHAR buffer[UX_TEST_BUFFER_SIZE];
132
133 /* Define USBX test global variables. */
134
135 static UX_HOST_CLASS *class_driver;
136 static UX_HOST_CLASS_DPUMP *dpump;
137 static UX_SLAVE_CLASS_DPUMP *dpump_slave = UX_NULL;
138
139 static UCHAR device_framework_low_speed[] = {
140
141 /* Device descriptor 18 bytes */
142 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08,
143 0xec, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
144 0x00, 0x01,
145
146 CFG_DESC_ALL_LS
147 };
148 #define DEVICE_FRAMEWORK_LENGTH_LOW_SPEED sizeof(device_framework_low_speed)
149
150 static UCHAR device_framework_full_speed[] = {
151
152 /* Device descriptor 18 bytes */
153 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08,
154 0xec, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
155 0x00, 0x01,
156
157 CFG_DESC_ALL_FS
158 };
159 #define DEVICE_FRAMEWORK_LENGTH_FULL_SPEED sizeof(device_framework_full_speed)
160
161 static UCHAR device_framework_high_speed[] = {
162
163 /* Device descriptor */
164 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40,
165 0x0a, 0x07, 0x25, 0x40, 0x01, 0x00, 0x01, 0x02,
166 0x03, 0x01,
167
168 /* Device qualifier descriptor */
169 0x0a, 0x06, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40,
170 0x01, 0x00,
171
172 CFG_DESC_ALL_HS
173 };
174 #define DEVICE_FRAMEWORK_LENGTH_HIGH_SPEED sizeof(device_framework_high_speed)
175
176 /* String Device Framework :
177 Byte 0 and 1 : Word containing the language ID : 0x0904 for US
178 Byte 2 : Byte containing the index of the descriptor
179 Byte 3 : Byte containing the length of the descriptor string
180 */
181
182 static UCHAR string_framework[] = {
183
184 /* Manufacturer string descriptor : Index 1 */
185 0x09, 0x04, 0x01, 0x0c,
186 0x45, 0x78, 0x70, 0x72,0x65, 0x73, 0x20, 0x4c,
187 0x6f, 0x67, 0x69, 0x63,
188
189 /* Product string descriptor : Index 2 */
190 0x09, 0x04, 0x02, 0x0c,
191 0x44, 0x61, 0x74, 0x61, 0x50, 0x75, 0x6d, 0x70,
192 0x44, 0x65, 0x6d, 0x6f,
193
194 /* Serial Number string descriptor : Index 3 */
195 0x09, 0x04, 0x03, 0x04,
196 0x30, 0x30, 0x30, 0x31
197 };
198 #define STRING_FRAMEWORK_LENGTH sizeof(string_framework)
199
200 /* Multiple languages are supported on the device, to add
201 a language besides English, the unicode language code must
202 be appended to the language_id_framework array and the length
203 adjusted accordingly. */
204 static UCHAR language_id_framework[] = {
205
206 /* English. */
207 0x09, 0x04
208 };
209 #define LANGUAGE_ID_FRAMEWORK_LENGTH sizeof(language_id_framework)
210
211 /* Define prototypes for external Host Controller's (HCDs), classes and clients. */
212
213 static VOID ux_test_instance_activate(VOID *dpump_instance);
214 static VOID ux_test_instance_deactivate(VOID *dpump_instance);
215
216 UINT _ux_host_class_dpump_entry(UX_HOST_CLASS_COMMAND *command);
217 UINT ux_hcd_sim_initialize(UX_HCD *hcd);
218 UINT _ux_host_class_dpump_write(UX_HOST_CLASS_DPUMP *dpump, UCHAR * data_pointer,
219 ULONG requested_length, ULONG *actual_length);
220 UINT _ux_host_class_dpump_read (UX_HOST_CLASS_DPUMP *dpump, UCHAR *data_pointer,
221 ULONG requested_length, ULONG *actual_length);
222
223 static TX_THREAD ux_test_thread_simulation_0;
224 static TX_THREAD ux_test_thread_simulation_1;
225 static void ux_test_thread_simulation_0_entry(ULONG);
226 static void ux_test_thread_simulation_1_entry(ULONG);
227
228
229 /* Define the ISR dispatch. */
230
231 extern VOID (*test_isr_dispatch)(void);
232
233
234 /* Prototype for test control return. */
235
236 void test_control_return(UINT status);
237
238
239 /* Define the ISR dispatch routine. */
240
test_isr(void)241 static void test_isr(void)
242 {
243
244 /* For further expansion of interrupt-level testing. */
245 }
246
247
error_callback(UINT system_level,UINT system_context,UINT error_code)248 static VOID error_callback(UINT system_level, UINT system_context, UINT error_code)
249 {
250
251 error_callback_counter ++;
252
253 if (!error_callback_ignore)
254 {
255 {
256 /* Failed test. */
257 printf("Error #%d, system_level: %d, system_context: %d, error_code: 0x%x\n", __LINE__, system_level, system_context, error_code);
258 test_control_return(1);
259 }
260 }
261 }
262
test_ux_device_class_dpump_entry(UX_SLAVE_CLASS_COMMAND * command)263 static UINT test_ux_device_class_dpump_entry(UX_SLAVE_CLASS_COMMAND *command)
264 {
265 switch(command->ux_slave_class_command_request)
266 {
267 case UX_SLAVE_CLASS_COMMAND_INITIALIZE:
268 case UX_SLAVE_CLASS_COMMAND_QUERY:
269 case UX_SLAVE_CLASS_COMMAND_CHANGE:
270 return UX_SUCCESS;
271
272 default:
273 return UX_NO_CLASS_MATCH;
274 }
275 }
276
test_ux_host_class_dpump_entry(UX_HOST_CLASS_COMMAND * command)277 static UINT test_ux_host_class_dpump_entry(UX_HOST_CLASS_COMMAND *command)
278 {
279 switch (command -> ux_host_class_command_request)
280 {
281 case UX_HOST_CLASS_COMMAND_QUERY:
282 case UX_HOST_CLASS_COMMAND_ACTIVATE:
283 return UX_SUCCESS;
284
285 default:
286 return UX_NO_CLASS_MATCH;
287 }
288 }
289
290 /* Define what the initial system looks like. */
291
292 #ifdef CTEST
test_application_define(void * first_unused_memory)293 void test_application_define(void *first_unused_memory)
294 #else
295 void usbx_ux_host_stack_bandwidth_test_application_define(void *first_unused_memory)
296 #endif
297 {
298
299 UINT status;
300 CHAR *stack_pointer;
301 CHAR *memory_pointer;
302 UX_SLAVE_CLASS_DPUMP_PARAMETER parameter;
303
304 /* Initialize the free memory pointer. */
305 stack_pointer = (CHAR *) first_unused_memory;
306 memory_pointer = stack_pointer + (UX_TEST_STACK_SIZE * 2);
307
308 /* Initialize USBX Memory. */
309 status = ux_system_initialize(memory_pointer, UX_TEST_MEMORY_SIZE, UX_NULL, 0);
310
311 /* Check for error. */
312 if (status != UX_SUCCESS)
313 {
314
315 printf("Running ux_host_stack_bandwidth_... Test............................ ERROR #1\n");
316 test_control_return(1);
317 }
318
319 /* Register the error callback. */
320 _ux_utility_error_callback_register(error_callback);
321
322 /* The code below is required for installing the host portion of USBX. */
323 status = ux_host_stack_initialize(UX_NULL);
324
325 /* Check for error. */
326 if (status != UX_SUCCESS)
327 {
328
329 printf("Running ux_host_stack_bandwidth_... Test............................ ERROR #2\n");
330 test_control_return(1);
331 }
332
333 /* Register all the host class drivers for this USBX implementation. */
334 status = ux_host_stack_class_register(_ux_system_host_class_dpump_name, test_ux_host_class_dpump_entry);
335
336 /* Check for error. */
337 if (status != UX_SUCCESS)
338 {
339
340 printf("Running ux_host_stack_bandwidth_... Test............................ ERROR #3\n");
341 test_control_return(1);
342 }
343
344 /* The code below is required for installing the device portion of USBX */
345 status = ux_device_stack_initialize(device_framework_high_speed, DEVICE_FRAMEWORK_LENGTH_HIGH_SPEED,
346 device_framework_full_speed, DEVICE_FRAMEWORK_LENGTH_FULL_SPEED,
347 string_framework, STRING_FRAMEWORK_LENGTH,
348 language_id_framework, LANGUAGE_ID_FRAMEWORK_LENGTH, UX_NULL);
349
350 /* Check for error. */
351 if (status != UX_SUCCESS)
352 {
353
354 printf("Running ux_host_stack_bandwidth_... Test............................ ERROR #5\n");
355 test_control_return(1);
356 }
357
358 /* Set the parameters for callback when insertion/extraction of a Data Pump device. */
359 parameter.ux_slave_class_dpump_instance_activate = UX_NULL;
360 parameter.ux_slave_class_dpump_instance_deactivate = UX_NULL;
361
362 /* Initialize the device dpump class. The class is connected with interface 0 */
363 status = ux_device_stack_class_register(_ux_system_slave_class_dpump_name, test_ux_device_class_dpump_entry,
364 1, 0, ¶meter);
365
366 /* Check for error. */
367 if (status != UX_SUCCESS)
368 {
369
370 printf("Running ux_host_stack_bandwidth_... Test............................ ERROR #6\n");
371 test_control_return(1);
372 }
373
374 /* Initialize the simulated device controller. */
375 status = _ux_test_dcd_sim_slave_initialize();
376
377 /* Check for error. */
378 if (status != UX_SUCCESS)
379 {
380
381 printf("Running ux_host_stack_bandwidth_... Test............................ ERROR #7\n");
382 test_control_return(1);
383 }
384
385 /* Register all the USB host controllers available in this system */
386 status = ux_host_stack_hcd_register(_ux_system_host_hcd_simulator_name, _ux_test_hcd_sim_host_initialize,0,0);
387
388 /* Check for error. */
389 if (status != UX_SUCCESS)
390 {
391
392 printf("Running ux_host_stack_bandwidth_... Test............................ ERROR #4\n");
393 test_control_return(1);
394 }
395
396 /* Create the main host simulation thread. */
397 status = tx_thread_create(&ux_test_thread_simulation_0, "test host simulation", ux_test_thread_simulation_0_entry, 0,
398 stack_pointer, UX_TEST_STACK_SIZE,
399 20, 20, 1, TX_AUTO_START);
400
401 /* Check for error. */
402 if (status != TX_SUCCESS)
403 {
404
405 printf("Running ux_host_stack_bandwidth_... Test............................ ERROR #8\n");
406 test_control_return(1);
407 }
408 }
409
410
ux_test_thread_simulation_0_entry(ULONG arg)411 static void ux_test_thread_simulation_0_entry(ULONG arg)
412 {
413
414 UINT status;
415 INT i;
416 INT test;
417 UX_HCD *hcd;
418 UX_DEVICE *device;
419 UX_CONFIGURATION *configuration;
420 UX_INTERFACE *interface;
421 UX_INTERFACE *interfaces[8];
422 UX_DEVICE hub[3];
423 struct _test_def {
424 UCHAR speed;
425 UCHAR *framework;
426 ULONG framework_length;
427 ULONG hcd_version;
428 ULONG available_bandwidth;
429 UX_DEVICE *parent;
430 UCHAR parent_speed;
431 ULONG tt_mask;
432 ULONG tt_bandwidth;
433 UINT status0;
434 UINT status1_invert;
435 } tests[] = {
436 {UX_LOW_SPEED_DEVICE , device_framework_low_speed , DEVICE_FRAMEWORK_LENGTH_LOW_SPEED , 0x110, 48*8*5, UX_NULL},
437 {UX_LOW_SPEED_DEVICE , device_framework_low_speed , DEVICE_FRAMEWORK_LENGTH_LOW_SPEED , 0x200, 48 , UX_NULL},
438 {UX_FULL_SPEED_DEVICE, device_framework_full_speed, DEVICE_FRAMEWORK_LENGTH_FULL_SPEED, 0x110, 128*5 , UX_NULL},
439 {UX_FULL_SPEED_DEVICE, device_framework_full_speed, DEVICE_FRAMEWORK_LENGTH_FULL_SPEED, 0x200, 128 , UX_NULL},
440 {UX_HIGH_SPEED_DEVICE, device_framework_high_speed, DEVICE_FRAMEWORK_LENGTH_HIGH_SPEED, 0x110, 2048 , UX_NULL},
441 {UX_HIGH_SPEED_DEVICE, device_framework_high_speed, DEVICE_FRAMEWORK_LENGTH_HIGH_SPEED, 0x200, 2048 , UX_NULL},
442
443 {UX_FULL_SPEED_DEVICE, device_framework_full_speed, DEVICE_FRAMEWORK_LENGTH_FULL_SPEED, 0x200, 6000 , &hub[2], UX_HIGH_SPEED_DEVICE, 0x0, 128, UX_NO_BANDWIDTH_AVAILABLE},
444 {UX_FULL_SPEED_DEVICE, device_framework_full_speed, DEVICE_FRAMEWORK_LENGTH_FULL_SPEED, 0x200, 6000 , &hub[2], UX_HIGH_SPEED_DEVICE, 0x3, 128},
445
446 {UX_FULL_SPEED_DEVICE, device_framework_full_speed, DEVICE_FRAMEWORK_LENGTH_FULL_SPEED, 0x200, 6000 , &hub[2], UX_FULL_SPEED_DEVICE, 0x3, 128, UX_SUCCESS, UX_TRUE},
447 };
448
449 #if UX_MAX_DEVICES > 1
450
451 /* Inform user. */
452 printf("Running ux_host_stack_bandwidth_... Test............................ ");
453
454 hcd = &_ux_system_host -> ux_system_host_hcd_array[0];
455
456 /* Build a hub list for tests: hub0 (hs) <- hub1 (fs) <- hub2 (fs). */
457 ux_utility_memory_set(hub, 0, sizeof(hub));
458 hub[0].ux_device_speed = UX_HIGH_SPEED_DEVICE;
459 hub[0].ux_device_parent = UX_NULL;
460 hub[0].ux_device_port_location = 0;
461 hub[0].ux_device_hub_tt[0].ux_hub_tt_max_bandwidth = UX_TT_BANDWIDTH;
462 hub[0].ux_device_hub_tt[0].ux_hub_tt_port_mapping = 0;
463 hub[0].ux_device_hub_tt[1].ux_hub_tt_max_bandwidth = UX_TT_BANDWIDTH;
464 hub[0].ux_device_hub_tt[1].ux_hub_tt_port_mapping = UX_TT_MASK;
465 hub[1].ux_device_speed = UX_FULL_SPEED_DEVICE;
466 hub[1].ux_device_parent = &hub[0];
467 hub[1].ux_device_port_location = 2;
468 hub[2].ux_device_speed = UX_FULL_SPEED_DEVICE;
469 hub[2].ux_device_parent = &hub[1];
470 hub[2].ux_device_port_location = 3;
471
472 ux_test_hcd_sim_host_connect(UX_FULL_SPEED_DEVICE);
473
474 error_callback_ignore = UX_TRUE;
475
476 for (test = 0; test < sizeof(tests)/sizeof(struct _test_def); test ++)
477 {
478
479 /* Disconnect. */
480 ux_test_dcd_sim_slave_disconnect();
481 ux_test_hcd_sim_host_disconnect();
482
483 /* Connect. */
484 hcd -> ux_hcd_version = tests[test].hcd_version;
485 hcd -> ux_hcd_available_bandwidth = tests[test].available_bandwidth;
486 ux_test_dcd_sim_slave_connect_framework(tests[test].framework, tests[test].framework_length);
487 ux_test_hcd_sim_host_connect(tests[test].speed);
488 tx_thread_sleep(200);
489
490 status = ux_host_stack_device_get(0, &device);
491 if (status != UX_SUCCESS)
492 {
493
494 printf("ERROR #%d.%d: device_get fail\n", __LINE__, test);
495 test_control_return(1);
496 }
497
498 status = ux_host_stack_device_configuration_get(device, 0, &configuration);
499 if (status != UX_SUCCESS)
500 {
501
502 printf("ERROR #%d.%d: cfg_get fail\n", __LINE__, test);
503 test_control_return(1);
504 }
505
506 interface = configuration->ux_configuration_first_interface;
507 for (i = 0; i < 8; i ++)
508 {
509
510 if (interface == UX_NULL)
511 break;
512
513 interfaces[i] = interface;
514 interface = interface->ux_interface_next_interface;
515 }
516
517 /* Set configure. */
518 status = ux_host_stack_device_configuration_select(configuration);
519 if (status != UX_SUCCESS)
520 {
521
522 printf("ERROR #%d.%d: cfg_set fail\n", __LINE__, test);
523 test_control_return(1);
524 }
525
526 /* Modify parent. */
527 if (tests[test].parent)
528 {
529 device->ux_device_parent = tests[test].parent;
530 hub[0].ux_device_speed = tests[test].parent_speed;
531 hub[0].ux_device_hub_tt[1].ux_hub_tt_port_mapping = tests[test].tt_mask;
532 hub[0].ux_device_hub_tt[1].ux_hub_tt_max_bandwidth = tests[test].tt_bandwidth;
533 }
534
535 /* Switch to interface 0.1, bandwith OK */
536 status = ux_host_stack_interface_setting_select(interfaces[1]);
537 if (status != tests[test].status0)
538 {
539
540 printf("ERROR #%d.%d: ifc_set status not expected: %x<>%x\n", __LINE__, test, tests[test].status0, status);
541 error_counter ++;
542 }
543
544 /* Switch to interface 0.4, bandwidth FAIL */
545 error_callback_counter = 0;
546 status = ux_host_stack_interface_setting_select(interfaces[4]);
547 if (tests[test].status1_invert)
548 {
549 if (status != UX_SUCCESS)
550 {
551
552 printf("ERROR #%d.%d: Expect ifc_set pass\n", __LINE__, test);
553 error_counter ++;
554 }
555 }
556 else
557 {
558 if (status == UX_SUCCESS)
559 {
560
561 printf("ERROR #%d.%d: Expect ifc_set fail\n", __LINE__, test);
562 error_counter ++;
563 }
564 if (error_callback_counter == 0)
565 {
566
567 printf("ERROR #%d.%d: Expect error\n", __LINE__, test);
568 error_counter ++;
569 }
570 }
571
572 /* Restore parent. */
573 if (tests[test].parent)
574 {
575
576 device->ux_device_parent = UX_NULL;
577 hub[0].ux_device_speed = UX_HIGH_SPEED_DEVICE;
578 hub[0].ux_device_hub_tt[1].ux_hub_tt_port_mapping = UX_TT_MASK;
579 hub[0].ux_device_hub_tt[1].ux_hub_tt_max_bandwidth = UX_TT_BANDWIDTH;
580 }
581 }
582 error_callback_ignore = UX_FALSE;
583
584 #else
585
586 /* Inform user. */
587 printf("Running ux_host_stack_bandwidth_... Skip for max 1 device .......... ");
588 #endif
589
590 /* Sleep for a tick to make sure everything is complete. */
591 tx_thread_sleep(1);
592
593 /* Check for errors from other threads. */
594 if (error_counter)
595 {
596
597 /* Test error. */
598 printf("ERROR #14\n");
599 test_control_return(1);
600 }
601 else
602 {
603
604 /* Successful test. */
605 printf("SUCCESS!\n");
606 test_control_return(0);
607 }
608 }
609