1 /* This test is designed to test the ux_device_stack_alternate_setting_set. */
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 /* HID mouse related descriptors */
37
38 static UCHAR hid_mouse_report[] = {
39
40 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
41 0x09, 0x02, // USAGE (Mouse)
42 0xa1, 0x01, // COLLECTION (Application)
43 0x09, 0x01, // USAGE (Pointer)
44 0xa1, 0x00, // COLLECTION (Physical)
45 0x05, 0x09, // USAGE_PAGE (Button)
46 0x19, 0x01, // USAGE_MINIMUM (Button 1)
47 0x29, 0x03, // USAGE_MAXIMUM (Button 3)
48 0x15, 0x00, // LOGICAL_MINIMUM (0)
49 0x25, 0x01, // LOGICAL_MAXIMUM (1)
50 0x95, 0x03, // REPORT_COUNT (3)
51 0x75, 0x01, // REPORT_SIZE (1)
52 0x81, 0x02, // INPUT (Data,Var,Abs)
53 0x95, 0x01, // REPORT_COUNT (1)
54 0x75, 0x05, // REPORT_SIZE (5)
55 0x81, 0x03, // INPUT (Cnst,Var,Abs)
56 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
57 0x09, 0x30, // USAGE (X)
58 0x09, 0x31, // USAGE (Y)
59 0x15, 0x81, // LOGICAL_MINIMUM (-127)
60 0x25, 0x7f, // LOGICAL_MAXIMUM (127)
61 0x75, 0x08, // REPORT_SIZE (8)
62 0x95, 0x02, // REPORT_COUNT (2)
63 0x81, 0x06, // INPUT (Data,Var,Rel)
64 0x09, 0x38, // USAGE (Mouse Wheel)
65 0x15, 0x81, // LOGICAL_MINIMUM (-127)
66 0x25, 0x7f, // LOGICAL_MAXIMUM (127)
67 0x75, 0x08, // REPORT_SIZE (8)
68 0x95, 0x01, // REPORT_COUNT (1)
69 0x81, 0x06, // INPUT (Data,Var,Rel)
70 0xc0, // END_COLLECTION
71 0xc0 // END_COLLECTION
72 };
73 #define HID_MOUSE_REPORT_LENGTH (sizeof(hid_mouse_report)/sizeof(hid_mouse_report[0]))
74
75 #define LSB(x) (x & 0x00ff)
76 #define MSB(x) ((x & 0xff00) >> 8)
77
78 /* Configuration descriptor 9 bytes */
79 #define CFG_DESC(wTotalLength, bNumInterfaces, bConfigurationValue)\
80 /* Configuration 1 descriptor 9 bytes */\
81 0x09, 0x02, LSB(wTotalLength), MSB(wTotalLength),\
82 (bNumInterfaces), (bConfigurationValue), 0x00,\
83 0x20, 0x00,
84 #define CFG_DESC_LEN 9
85
86 /* DPUMP interface descriptors 9+7+7=23 bytes. */
87 #define DPUMP_IFC_DESC_ALL(ifc, bulk_in_epa, bulk_out_epa) \
88 /* Interface descriptor */\
89 0x09, 0x04, (ifc), 0x00, 0x02, 0x99, 0x99, 0x99, 0x00,\
90 /* Endpoint descriptor (Bulk Out) */\
91 0x07, 0x05, (bulk_out_epa), 0x02, 0x40, 0x00, 0x00,\
92 /* Endpoint descriptor (Bulk In) */\
93 0x07, 0x05, (bulk_in_epa), 0x02, 0x40, 0x00, 0x00,
94 #define DPUMP_IFC_DESC_ALL_LEN 23
95
96 /* HID Mouse interface descriptors 9+9=18 bytes */
97 #define HID_MOUSE_IFC0_DESC_ALL(ifc) \
98 /* Interface descriptor */\
99 0x09, 0x04, (ifc), 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,\
100 /* HID descriptor */\
101 0x09, 0x21, 0x10, 0x01, 0x21, 0x01, 0x22, LSB(HID_MOUSE_REPORT_LENGTH),\
102 MSB(HID_MOUSE_REPORT_LENGTH),
103 #define HID_MOUSE_IFC0_DESC_ALL_LEN 18
104
105 /* HID Mouse interface descriptors 9+9+7=25 bytes */
106 #define HID_MOUSE_IFC1_DESC_ALL(ifc, interrupt_epa) \
107 /* Interface descriptor */\
108 0x09, 0x04, (ifc), 0x01, 0x01, 0x03, 0x00, 0x00, 0x00,\
109 /* HID descriptor */\
110 0x09, 0x21, 0x10, 0x01, 0x21, 0x01, 0x22, LSB(HID_MOUSE_REPORT_LENGTH),\
111 MSB(HID_MOUSE_REPORT_LENGTH),\
112 /* Endpoint descriptor (Interrupt), wMaxPacketSize:0x08, n_trans:01 */\
113 0x07, 0x05, (interrupt_epa), 0x03, 0x08, 0x08, 0x08,
114 #define HID_MOUSE_IFC1_DESC_ALL_LEN 25
115
116 /* Define the counters used in the test application... */
117
118 static ULONG thread_0_counter;
119 static ULONG thread_1_counter;
120 static ULONG error_counter;
121
122 static UCHAR expect_errors = UX_FALSE;
123
124
125 /* Define USBX test global variables. */
126
127 static UX_HOST_CLASS *class_driver;
128 static UX_HOST_CLASS_DPUMP *dpump;
129 static UX_SLAVE_CLASS_DPUMP *dpump_slave = UX_NULL;
130
131
132 static UCHAR device_framework_full_speed[] = {
133
134 /* Device descriptor 18 bytes */
135 0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x08,
136 0xec, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
137 0x00, 0x01,
138
139 /* Configuration descriptor 9 bytes */
140 CFG_DESC(CFG_DESC_LEN + DPUMP_IFC_DESC_ALL_LEN + HID_MOUSE_IFC0_DESC_ALL_LEN + HID_MOUSE_IFC1_DESC_ALL_LEN, 2, 1)
141 /* DPUMP 9+9+7 =25 */
142 DPUMP_IFC_DESC_ALL(0, 0x81, 0x02)
143 /* HID 9+9 + 9+9+7=43 */
144 HID_MOUSE_IFC0_DESC_ALL(1)
145 HID_MOUSE_IFC1_DESC_ALL(1, 0x83)
146 };
147 #define DEVICE_FRAMEWORK_LENGTH_FULL_SPEED sizeof(device_framework_full_speed)
148
149 static UCHAR device_framework_high_speed[] = {
150
151 /* Device descriptor */
152 0x12, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40,
153 0x0a, 0x07, 0x25, 0x40, 0x01, 0x00, 0x01, 0x02,
154 0x03, 0x01,
155
156 /* Device qualifier descriptor */
157 0x0a, 0x06, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40,
158 0x01, 0x00,
159
160 /* Configuration descriptor */
161 CFG_DESC(CFG_DESC_LEN + DPUMP_IFC_DESC_ALL_LEN + HID_MOUSE_IFC0_DESC_ALL_LEN + HID_MOUSE_IFC1_DESC_ALL_LEN, 2, 1)
162 /* DPUMP */
163 DPUMP_IFC_DESC_ALL(0, 0x81, 0x02)
164 /* HID */
165 HID_MOUSE_IFC0_DESC_ALL(1)
166 HID_MOUSE_IFC1_DESC_ALL(1, 0x83)
167 };
168 #define DEVICE_FRAMEWORK_LENGTH_HIGH_SPEED sizeof(device_framework_high_speed)
169
170 /* String Device Framework :
171 Byte 0 and 1 : Word containing the language ID : 0x0904 for US
172 Byte 2 : Byte containing the index of the descriptor
173 Byte 3 : Byte containing the length of the descriptor string
174 */
175
176 static UCHAR string_framework[] = {
177
178 /* Manufacturer string descriptor : Index 1 */
179 0x09, 0x04, 0x01, 0x0c,
180 0x45, 0x78, 0x70, 0x72,0x65, 0x73, 0x20, 0x4c,
181 0x6f, 0x67, 0x69, 0x63,
182
183 /* Product string descriptor : Index 2 */
184 0x09, 0x04, 0x02, 0x0c,
185 0x44, 0x61, 0x74, 0x61, 0x50, 0x75, 0x6d, 0x70,
186 0x44, 0x65, 0x6d, 0x6f,
187
188 /* Serial Number string descriptor : Index 3 */
189 0x09, 0x04, 0x03, 0x04,
190 0x30, 0x30, 0x30, 0x31
191 };
192 #define STRING_FRAMEWORK_LENGTH sizeof(string_framework)
193
194 /* Multiple languages are supported on the device, to add
195 a language besides English, the unicode language code must
196 be appended to the language_id_framework array and the length
197 adjusted accordingly. */
198 static UCHAR language_id_framework[] = {
199
200 /* English. */
201 0x09, 0x04
202 };
203 #define LANGUAGE_ID_FRAMEWORK_LENGTH sizeof(language_id_framework)
204
205 /* Simulation actions. */
206
207 static UX_TEST_SIM_ENTRY_ACTION dcd_endpoint_create_fail[] = {
208 /* function, request to match,
209 port action, port status,
210 request action, request EP, request data, request actual length, request status,
211 status, additional callback,
212 no_return */
213 { UX_DCD_CREATE_ENDPOINT, NULL,
214 UX_FALSE, 0,
215 0 , 0, UX_NULL, 0, 0,
216 UX_ERROR , UX_NULL},
217 { 0 }
218 };
219
220
221 /* Define prototypes for external Host Controller's (HCDs), classes and clients. */
222
223 static VOID ux_test_instance_activate(VOID *dpump_instance);
224 static VOID ux_test_instance_deactivate(VOID *dpump_instance);
225
226 UINT _ux_host_class_dpump_entry(UX_HOST_CLASS_COMMAND *command);
227 UINT ux_hcd_sim_initialize(UX_HCD *hcd);
228 UINT _ux_host_class_dpump_write(UX_HOST_CLASS_DPUMP *dpump, UCHAR * data_pointer,
229 ULONG requested_length, ULONG *actual_length);
230 UINT _ux_host_class_dpump_read (UX_HOST_CLASS_DPUMP *dpump, UCHAR *data_pointer,
231 ULONG requested_length, ULONG *actual_length);
232
233 static TX_THREAD ux_test_thread_simulation_0;
234 static TX_THREAD ux_test_thread_simulation_1;
235 static void ux_test_thread_simulation_0_entry(ULONG);
236 static void ux_test_thread_simulation_1_entry(ULONG);
237
238
239 /* Define the ISR dispatch. */
240
241 extern VOID (*test_isr_dispatch)(void);
242
243
244 /* Prototype for test control return. */
245
246 void test_control_return(UINT status);
247
248
249 /* Define the ISR dispatch routine. */
250
test_isr(void)251 static void test_isr(void)
252 {
253
254 /* For further expansion of interrupt-level testing. */
255 }
256
257
error_callback(UINT system_level,UINT system_context,UINT error_code)258 static VOID error_callback(UINT system_level, UINT system_context, UINT error_code)
259 {
260 if (!expect_errors)
261 {
262 if (error_code != UX_DEVICE_HANDLE_UNKNOWN)
263 {
264 /* Failed test. */
265 printf("Error on line %d, system_level: %d, system_context: %d, error code: %d\n", __LINE__, system_level, system_context, error_code);
266 test_control_return(1);
267 }
268 }
269 }
270
test_ux_device_class_hid_entry(UX_SLAVE_CLASS_COMMAND * command)271 static UINT test_ux_device_class_hid_entry(UX_SLAVE_CLASS_COMMAND *command)
272 {
273 return UX_SUCCESS;
274 // return _ux_device_class_hid_entry(command);
275 }
276
277 /* Define what the initial system looks like. */
278
279 #ifdef CTEST
test_application_define(void * first_unused_memory)280 void test_application_define(void *first_unused_memory)
281 #else
282 void usbx_ux_device_stack_alternate_setting_set_test_application_define(void *first_unused_memory)
283 #endif
284 {
285
286 UINT status;
287 CHAR *stack_pointer;
288 CHAR *memory_pointer;
289 UX_SLAVE_CLASS_DPUMP_PARAMETER parameter;
290 UX_SLAVE_CLASS_HID_PARAMETER hid_parameter;
291
292
293 /* Inform user. */
294 printf("Running ux_device_stack_alternate_setting_set Test.................. ");
295
296 /* Initialize the free memory pointer. */
297 stack_pointer = (CHAR *) first_unused_memory;
298 memory_pointer = stack_pointer + (UX_TEST_STACK_SIZE * 2);
299
300 /* Initialize USBX Memory. */
301 status = ux_system_initialize(memory_pointer, UX_TEST_MEMORY_SIZE, UX_NULL, 0);
302
303 /* Check for error. */
304 if (status != UX_SUCCESS)
305 {
306
307 printf("ERROR #%d\n", __LINE__);
308 test_control_return(1);
309 }
310
311 /* Register the error callback. */
312 _ux_utility_error_callback_register(error_callback);
313
314 /* The code below is required for installing the host portion of USBX. */
315 status = ux_host_stack_initialize(UX_NULL);
316
317 /* Check for error. */
318 if (status != UX_SUCCESS)
319 {
320
321 printf("ERROR #%d\n", __LINE__);
322 test_control_return(1);
323 }
324
325 /* Register all the host class drivers for this USBX implementation. */
326 status = ux_host_stack_class_register(_ux_system_host_class_dpump_name, ux_host_class_dpump_entry);
327
328 /* Check for error. */
329 if (status != UX_SUCCESS)
330 {
331
332 printf("ERROR #%d\n", __LINE__);
333 test_control_return(1);
334 }
335
336 /* The code below is required for installing the device portion of USBX */
337 status = ux_device_stack_initialize(device_framework_high_speed, DEVICE_FRAMEWORK_LENGTH_HIGH_SPEED,
338 device_framework_full_speed, DEVICE_FRAMEWORK_LENGTH_FULL_SPEED,
339 string_framework, STRING_FRAMEWORK_LENGTH,
340 language_id_framework, LANGUAGE_ID_FRAMEWORK_LENGTH, UX_NULL);
341
342 /* Check for error. */
343 if (status != UX_SUCCESS)
344 {
345
346 printf("ERROR #%d\n", __LINE__);
347 test_control_return(1);
348 }
349
350 /* Set the parameters for callback when insertion/extraction of a Data Pump device. */
351 parameter.ux_slave_class_dpump_instance_activate = ux_test_instance_activate;
352 parameter.ux_slave_class_dpump_instance_deactivate = ux_test_instance_deactivate;
353
354 /* Initialize the device dpump class. The class is connected with interface 0 */
355 status = ux_device_stack_class_register(_ux_system_slave_class_dpump_name, _ux_device_class_dpump_entry,
356 1, 0, ¶meter);
357
358 /* Initialize the hid class parameters. */
359 hid_parameter.ux_device_class_hid_parameter_report_address = hid_mouse_report;
360 hid_parameter.ux_device_class_hid_parameter_report_length = HID_MOUSE_REPORT_LENGTH;
361 hid_parameter.ux_device_class_hid_parameter_callback = UX_NULL;
362 hid_parameter.ux_slave_class_hid_instance_activate = UX_NULL;
363
364 status |= ux_device_stack_class_register(_ux_system_slave_class_hid_name, test_ux_device_class_hid_entry,
365 1, 1, ¶meter);
366 #if UX_MAX_SLAVE_CLASS_DRIVER > 1
367 /* Check for error. */
368 if (status != UX_SUCCESS)
369 {
370
371 printf("ERROR #%d\n", __LINE__);
372 test_control_return(1);
373 }
374 #endif
375 /* Initialize the simulated device controller. */
376 status = _ux_test_dcd_sim_slave_initialize();
377
378 /* Check for error. */
379 if (status != UX_SUCCESS)
380 {
381
382 printf("ERROR #%d\n", __LINE__);
383 test_control_return(1);
384 }
385
386 /* Register all the USB host controllers available in this system */
387 status = ux_host_stack_hcd_register(_ux_system_host_hcd_simulator_name, _ux_test_hcd_sim_host_initialize,0,0);
388
389 /* Check for error. */
390 if (status != UX_SUCCESS)
391 {
392
393 printf("ERROR #%d\n", __LINE__);
394 test_control_return(1);
395 }
396
397 /* Create the main host simulation thread. */
398 status = tx_thread_create(&ux_test_thread_simulation_0, "test host simulation", ux_test_thread_simulation_0_entry, 0,
399 stack_pointer, UX_TEST_STACK_SIZE,
400 20, 20, 1, TX_AUTO_START);
401
402 /* Check for error. */
403 if (status != TX_SUCCESS)
404 {
405
406 printf("ERROR #%d\n", __LINE__);
407 test_control_return(1);
408 }
409 }
410
411
ux_test_thread_simulation_0_entry(ULONG arg)412 static void ux_test_thread_simulation_0_entry(ULONG arg)
413 {
414
415 UINT status;
416 UX_SLAVE_DEVICE *device;
417 UX_SLAVE_CLASS *class;
418 UX_SLAVE_INTERFACE *interface;
419 UX_SLAVE_ENDPOINT *endpoint;
420 UINT ux_slave_class_status;
421 ULONG endpoints_pool_number;
422
423 ux_test_dcd_sim_slave_connect(UX_HIGH_SPEED_DEVICE);
424 ux_test_hcd_sim_host_connect(UX_HIGH_SPEED_DEVICE);
425
426 /* Enumeration check. */
427 if (dpump_slave == UX_NULL)
428 {
429
430 printf("ERROR #%d: Enum fail\n", __LINE__);
431 test_control_return(1);
432 }
433
434 /* Slave device. */
435 device = &_ux_system_slave->ux_system_slave_device;
436
437 /* Expect errors so skip them in error handler. */
438 expect_errors = UX_TRUE;
439
440 #if UX_TEST_MULTI_IFC_ON
441 /* UX_MEMORY_INSUFFICIENT:
442 limit endpoint pool size so no free endpoint in pool to generate error.
443 */
444 endpoints_pool_number = device->ux_slave_device_endpoints_pool_number;
445 device->ux_slave_device_endpoints_pool_number = 0;
446
447 /* Invoke and check status. */
448 status = _ux_device_stack_alternate_setting_set(1, 1);
449 if (status != UX_MEMORY_INSUFFICIENT)
450 {
451
452 printf("ERROR #%d: Expect UX_MEMORY_INSUFFICIENT but get %x\n", __LINE__, status);
453 error_counter ++;
454 }
455 /* Restore. */
456 device->ux_slave_device_endpoints_pool_number = endpoints_pool_number;
457 #endif
458
459 /* UX_DCD_CREATE_ENDPOINT fail:
460 set DCD action to generate endpoint creation error.
461 */
462 ux_test_dcd_sim_slave_set_actions(dcd_endpoint_create_fail);
463
464 #if UX_TEST_MULTI_CLS_ON && UX_TEST_MULTI_IFC_ON
465
466 /* Invoke and check status. */
467 status = _ux_device_stack_alternate_setting_set(1, 1);
468 if (status != UX_ERROR)
469 {
470
471 printf("ERROR #%d: Expect UX_ERROR but get %x\n", __LINE__, status);
472 error_counter ++;
473 }
474
475 if (device->ux_slave_device_first_interface->ux_slave_interface_next_interface->ux_slave_interface_first_endpoint)
476 {
477
478 printf("ERROR #%d: Expect no endpoints\n", __LINE__);
479 error_counter ++;
480 }
481 /* No action replacement. */
482 ux_test_dcd_sim_slave_set_actions(UX_NULL);
483
484 /* UX_NO_CLASS_MATCH:
485 No class driver registered for the class.
486 */
487 class = _ux_system_slave -> ux_system_slave_interface_class_array[1];
488 _ux_system_slave -> ux_system_slave_interface_class_array[1] = UX_NULL;
489
490 /* Invoke and check status. */
491 status = _ux_device_stack_alternate_setting_set(1, 1);
492 if (status != UX_NO_CLASS_MATCH)
493 {
494
495 printf("ERROR #%d: Expect UX_NO_CLASS_MATCH but get %x\n", __LINE__, status);
496 error_counter ++;
497 }
498 _ux_system_slave -> ux_system_slave_interface_class_array[1] = class;
499
500 /* Select alternate setting 0. */
501 status = _ux_device_stack_alternate_setting_set(1, 0);
502 if (status != UX_SUCCESS)
503 {
504
505 printf("ERROR #%d: Expect success but get %x\n", __LINE__, status);
506 error_counter ++;
507 }
508
509 ux_slave_class_status = class->ux_slave_class_status;
510 class->ux_slave_class_status = UX_UNUSED;
511
512 /* Invoke and check status. */
513 status = _ux_device_stack_alternate_setting_set(1, 1);
514 if (status != UX_NO_CLASS_MATCH)
515 {
516
517 printf("ERROR #%d: Expect UX_NO_CLASS_MATCH but get %x\n", __LINE__, status);
518 error_counter ++;
519 }
520 class->ux_slave_class_status = ux_slave_class_status;
521
522 /* case: device_framework_length == 0 */
523 _ux_system_slave -> ux_system_slave_device_framework_length = 0;
524 status = _ux_device_stack_alternate_setting_set(1, 0);
525 if (status == UX_SUCCESS)
526 {
527
528 printf("ERROR #%d: Expect error but get %x\n", __LINE__, status);
529 error_counter ++;
530 }
531 _ux_system_slave -> ux_system_slave_device_framework_length = _ux_system_slave -> ux_system_slave_device_framework_length_high_speed;
532
533 /* Normal case: switch alternate setting several times */
534 status = _ux_device_stack_alternate_setting_set(1, 0);
535 status |= _ux_device_stack_alternate_setting_set(1, 1);
536 status |= _ux_device_stack_alternate_setting_set(1, 0);
537 status |= _ux_device_stack_alternate_setting_set(1, 1);
538 UX_TEST_CHECK_SUCCESS(status);
539
540 /* Endpoint 0x83 should be available and ready to use */
541 interface = class->ux_slave_class_interface;
542 UX_TEST_ASSERT(interface != UX_NULL);
543
544 endpoint = interface->ux_slave_interface_first_endpoint;
545 UX_TEST_ASSERT(endpoint != UX_NULL);
546
547 UX_TEST_ASSERT(endpoint->ux_slave_endpoint_descriptor.bEndpointAddress == 0x83);
548 UX_TEST_ASSERT(endpoint->ux_slave_endpoint_state == 0x00);
549 #if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 0
550 UX_TEST_ASSERT(endpoint->ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer != UX_NULL);
551 #else
552 /* HID has no implement of alternate setting change, buffer not assigned. */
553 UX_TEST_ASSERT(endpoint->ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer == UX_NULL);
554 #endif
555 #if !defined(UX_DEVICE_STANDALONE)
556 UX_TEST_ASSERT(endpoint->ux_slave_endpoint_transfer_request.ux_slave_transfer_request_semaphore.tx_semaphore_id != 0);
557 UX_TEST_ASSERT(endpoint->ux_slave_endpoint_transfer_request.ux_slave_transfer_request_semaphore.tx_semaphore_count == 0);
558 #endif
559 UX_TEST_ASSERT(endpoint->ux_slave_endpoint_transfer_request.ux_slave_transfer_request_transfer_length == 16);
560
561 #endif /* #if UX_MAX_SLAVE_CLASS_DRIVER > 1 */
562
563 /* Break on errors. */
564 expect_errors = UX_TRUE;
565
566 /* Sleep for a tick to make sure everything is complete. */
567 tx_thread_sleep(1);
568
569 /* Check for errors from other threads. */
570 if (error_counter)
571 {
572
573 /* Test error. */
574 printf("ERROR #14\n");
575 test_control_return(1);
576 }
577 else
578 {
579
580 /* Successful test. */
581 printf("SUCCESS!\n");
582 test_control_return(0);
583 }
584 }
585
ux_test_instance_activate(VOID * dpump_instance)586 static VOID ux_test_instance_activate(VOID *dpump_instance)
587 {
588
589 /* Save the DPUMP instance. */
590 dpump_slave = (UX_SLAVE_CLASS_DPUMP *) dpump_instance;
591 }
592
ux_test_instance_deactivate(VOID * dpump_instance)593 static VOID ux_test_instance_deactivate(VOID *dpump_instance)
594 {
595
596 /* Reset the DPUMP instance. */
597 dpump_slave = UX_NULL;
598 }
599
600