1 /* This is the test control routine of the USBX kernel.  All tests are dispatched from this routine.  */
2 
3 #include "tx_api.h"
4 #include "fx_api.h"
5 #include "nx_api.h"
6 #include "ux_api.h"
7 #include <stdio.h>
8 
9 #include "ux_test.h"
10 #include "ux_test_hcd_sim_host.h"
11 #include "ux_test_dcd_sim_slave.h"
12 #include "ux_test_utility_sim.h"
13 
14 #define TEST_STACK_SIZE         6144
15 
16 /* Define the test control USBX objects...  */
17 
18 TX_THREAD               test_control_thread;
19 TX_THREAD               test_thread;
20 
21 
22 /* Define the test control global variables.   */
23 
24 ULONG           test_control_return_status;
25 ULONG           test_control_successful_tests;
26 ULONG           test_control_failed_tests;
27 ULONG           test_control_system_errors;
28 
29 
30 
31 /* Remember the start of free memory.  */
32 
33 UCHAR           *test_free_memory_ptr;
34 
35 
36 /* Define the function pointer for ISR dispatch.  */
37 
38 VOID            (*test_isr_dispatch)(void);
39 
40 
41 UCHAR           test_control_thread_stack[TEST_STACK_SIZE];
42 UCHAR           tests_memory[1024*1024*1024];
43 
44 /* Define the external reference for the preempt disable flag.  */
45 
46 extern volatile UINT   _tx_thread_preempt_disable;
47 extern volatile ULONG  _tx_thread_system_state;
48 
49 
50 /* Define test entry pointer type.  */
51 
52 typedef  struct TEST_ENTRY_STRUCT
53 {
54 
55 VOID        (*test_entry)(void *);
56 } TEST_ENTRY;
57 
58 /* Demos */
59 
60 void    usbx_hid_keyboard_key_press_release_demo_application_define(void *);
61 
62 /* Define the prototypes for the test entry points.  */
63 
64 void    usbx_dpump_basic_test_application_define(void *);
65 
66 /* Utility */
67 
68 void    usbx_ux_utility_descriptor_pack_test_application_define(void *);
69 void    usbx_ux_utility_descriptor_parse_test_application_define(void *);
70 void    usbx_ux_utility_event_flags_test_application_define(void *);
71 void    usbx_ux_utility_memory_safe_test_application_define(void *);
72 void    usbx_ux_utility_memory_test_application_define(void *);
73 void    usbx_ux_utility_mutex_test_application_define(void *);
74 void    usbx_ux_utility_pci_write_test_application_define(void *);
75 void    usbx_ux_utility_pci_read_test_application_define(void *);
76 void    usbx_ux_utility_pci_class_scan_test_application_define(void *);
77 void    usbx_ux_utility_physical_address_test_application_define(void *);
78 void    usbx_ux_utility_semaphore_test_application_define(void *);
79 void    usbx_ux_utility_string_length_check_test_application_define(void *);
80 void    usbx_ux_utility_thread_create_test_application_define(void *);
81 void    usbx_ux_utility_thread_schedule_other_test_application_define(void *);
82 void    usbx_ux_utility_thread_suspend_test_application_define(void *);
83 void    usbx_ux_utility_thread_identify_test_application_define(void *);
84 void    usbx_ux_utility_timer_test_application_define(void *);
85 void    usbx_ux_utility_unicode_to_string_test_application_define(void *);
86 
87 /* General/stack */
88 void    usbx_host_stack_new_endpoint_create_overage_test_application_define(void*);
89 void    usbx_host_stack_class_unregister_coverage_test_application_define(void *);
90 void    usbx_host_device_basic_test_application_define(void *);
91 void    usbx_host_device_basic_memory_test_application_define(void *);
92 void    usbx_host_device_initialize_test_application_define(void *);
93 
94 void    usbx_device_stack_standard_request_test_application_define(void *);
95 void    usbx_ux_device_stack_class_register_test_application_define(void *);
96 void    usbx_ux_device_stack_class_unregister_test_application_define(void *);
97 void    usbx_ux_device_stack_clear_feature_coverage_test_application_define(void *);
98 void    usbx_ux_host_stack_uninitialize_test_application_define(void *);
99 void    usbx_ux_host_stack_hcd_unregister_test_application_define(void *);
100 void    usbx_ux_host_stack_class_unregister_test_application_define(void *);
101 
102 /* CDC */
103 
104 void    usbx_cdc_acm_basic_test_original_application_define(void *);
105 void    usbx_cdc_acm_basic_test_application_define(void *);
106 void    usbx_cdc_acm_basic_memory_test_application_define(void *);
107 void    usbx_cdc_acm_configure_test_application_define(void *);
108 void    usbx_ux_device_class_cdc_acm_activate_test_application_define(void *);
109 void    usbx_cdc_acm_device_dtr_rts_reset_on_disconnect_test_application_define(void *);
110 void    usbx_ux_device_class_cdc_acm_deactivate_test_application_define(void *);
111 void    usbx_ux_device_class_cdc_acm_ioctl_test_application_define(void *);
112 void    usbx_ux_device_class_cdc_acm_transmission_test_application_define(void *);
113 void    usbx_ux_device_class_cdc_acm_write_test_application_define(void *);
114 void    usbx_ux_device_class_cdc_acm_timeout_test_application_define(void *);
115 void    usbx_ux_host_class_cdc_acm_activate_test_application_define(void *);
116 void    usbx_ux_host_class_cdc_acm_capabilities_get_test_application_define(void *);
117 void    usbx_ux_host_class_cdc_acm_deactivate_test_application_define(void *);
118 void    usbx_ux_host_class_cdc_acm_endpoints_get_test_application_define(void *);
119 void    usbx_ux_host_class_cdc_acm_entry_test_application_define(void *);
120 void    usbx_ux_host_class_cdc_acm_read_test_application_define(void *);
121 void    usbx_ux_host_class_cdc_acm_transfer_request_completed_test_application_define(void *);
122 void    usbx_ux_device_class_cdc_acm_bulkout_thread_test_application_define(void *);
123 void    usbx_uxe_device_cdc_acm_test_application_define(void *);
124 
125 /* HID */
126 
127 void    usbx_ux_device_class_hid_basic_memory_test_application_define(void *);
128 void    usbx_hid_keyboard_basic_test_application_define(void *);
129 void    usbx_ux_host_class_hid_report_get_test_application_define(void *);
130 void    usbx_hid_report_descriptor_global_item_test_application_define(void *);
131 void    usbx_hid_report_descriptor_item_size_test_application_define(void *);
132 void    usbx_hid_report_descriptor_usages_single_test_application_define(void *);
133 void    usbx_hid_report_descriptor_usages_min_max_test_application_define(void *);
134 void    usbx_hid_report_descriptor_multiple_fields_test_application_define(void *);
135 void    usbx_hid_report_descriptor_single_usage_multiple_data_test_application_define(void *);
136 void    usbx_hid_report_descriptor_multiple_reports_input_test_application_define(void *);
137 void    usbx_hid_report_descriptor_multiple_reports_output_test_application_define(void *);
138 void    usbx_hid_report_descriptor_multiple_reports_feature_test_application_define(void *);
139 void    usbx_hid_report_descriptor_multiple_fields_and_reports_test(void *);
140 void    usbx_hid_report_descriptor_previous_report_test_application_define(void *);
141 void    usbx_hid_report_descriptor_push_pop_test_application_define(void *);
142 void    usbx_hid_report_descriptor_decompress_test_application_define(void *);
143 void    usbx_hid_report_descriptor_decompress_array_test_application_define(void *);
144 void    usbx_hid_report_descriptor_delimiter_test_application_define(void *);
145 void    usbx_hid_report_descriptor_global_item_persist_test_application_define(void *);
146 void    usbx_hid_report_descriptor_extended_usage_test_application_define(void *);
147 void    usbx_hid_report_descriptor_multiple_collections_test_application_define(void *);
148 void    usbx_hid_report_descriptor_usages_overflow_test_application_define(void *);
149 void    usbx_hid_report_descriptor_usages_overflow_via_max_test_application_define(void *);
150 void    usbx_hid_report_descriptor_collection_overflow_test_application_define(void *);
151 void    usbx_hid_report_descriptor_end_collection_error_test_application_define(void *);
152 void    usbx_hid_report_descriptor_example_andisplay_test_application_define(void *);
153 void    usbx_hid_report_descriptor_example_delimit_test_application_define(void *);
154 void    usbx_hid_report_descriptor_example_digit_test_application_define(void *);
155 void    usbx_hid_report_descriptor_example_display_test_application_define(void *);
156 void    usbx_hid_report_descriptor_example_joystk_test_application_define(void *);
157 void    usbx_hid_report_descriptor_example_keybrd_test_application_define(void *);
158 void    usbx_hid_report_descriptor_example_monitor_test_application_define(void *);
159 void    usbx_hid_report_descriptor_example_mouse_test_application_define(void *);
160 void    usbx_hid_report_descriptor_example_pwr_test_application_define(void *);
161 void    usbx_hid_report_descriptor_example_remote_test_application_define(void *);
162 void    usbx_hid_report_descriptor_example_tele_test_application_define(void *);
163 void    usbx_hid_report_descriptor_get_zero_length_item_data_test_application_define(void *);
164 void    usbx_hid_report_descriptor_invalid_length_test_application_define(void *);
165 void    usbx_hid_report_descriptor_invalid_item_test_application_define(void *);
166 void    usbx_hid_report_descriptor_delimiter_nested_open_test_application_define(void *);
167 void    usbx_hid_report_descriptor_delimiter_nested_close_test_application_define(void *);
168 void    usbx_hid_report_descriptor_delimiter_unknown_test_application_define(void *);
169 void    usbx_hid_report_descriptor_unknown_local_tag_test_application_define(void *);
170 void    usbx_hid_report_descriptor_unknown_global_tag_test_application_define(void *);
171 void    usbx_hid_report_descriptor_incoherent_usage_min_max_test_application_define(void *);
172 void    usbx_hid_report_descriptor_report_size_overflow_test_application_define(void *);
173 void    usbx_hid_report_descriptor_report_count_overflow_test_application_define(void *);
174 void    usbx_hid_report_descriptor_push_overflow_tag_test_application_define(void *);
175 void    usbx_hid_report_descriptor_pop_underflow_tag_test_application_define(void *);
176 void    usbx_hid_keyboard_extraction_test_application_define(void *);
177 void    usbx_hid_keyboard_extraction_test2_application_define(void *);
178 void    usbx_hid_keyboard_callback_test_application_define(void *);
179 void    usbx_hid_mouse_basic_test_application_define(void *);
180 void    usbx_hid_mouse_extraction_test_application_define(void *);
181 void    usbx_hid_mouse_extraction_test2_application_define(void *);
182 void    usbx_hid_remote_control_tests_application_define(void *);
183 void    usbx_ux_host_class_hid_remote_control_entry_test2_application_define(void *);
184 void    usbx_ux_host_class_hid_remote_control_activate_test_application_define(void *);
185 void    usbx_hid_remote_control_extraction_test_application_define(void *);
186 void    usbx_hid_remote_control_extraction_test2_application_define(void *);
187 void    usbx_hid_report_descriptor_compress_test_application_define(void *);
188 void    usbx_hid_report_descriptor_compress_and_decompress_test_application_define(void *);
189 void    usbx_hid_transfer_request_completed_test_application_define(void *);
190 void    usbx_hid_transfer_request_completed_raw_test_application_define(void *);
191 void    usbx_hid_transfer_request_completed_decompressed_test_application_define(void *);
192 void    usbx_ux_host_class_hid_client_register_test_application_define(void *);
193 void    usbx_ux_host_class_hid_report_set_test_application_define(void *);
194 void    usbx_hid_keyboard_key_get_test_application_define(void *);
195 void    usbx_ux_host_class_hid_client_search_test_application_define(void *);
196 void    usbx_ux_device_class_hid_control_request_test_application_define(void *);
197 void    usbx_ux_device_class_hid_report_set_test_application_define(void *);
198 void    usbx_ux_device_class_hid_interrupt_thread_test_application_define(void *);
199 void    usbx_hid_keyboard_key_test_application_define(void *);
200 void    usbx_hid_keyboard_key_with_report_id_test_application_define(void *);
201 void    usbx_ux_device_class_hid_descriptor_send_test_application_define(void *);
202 void    usbx_control_transfer_stall_test(void *);
203 void    usbx_hid_interrupt_endpoint_get_report_test_application_define(void *);
204 void    usbx_ux_device_class_hid_event_get_AND_set_test_application_define(void *);
205 void    usbx_ux_host_class_hid_report_add_test_application_define(void *);
206 void    usbx_ux_host_class_hid_idle_set_test_application_define(void *);
207 void    usbx_ux_host_class_hid_interrupt_endpoint_search_test_application_define(void *);
208 void    usbx_ux_host_class_hid_keyboard_activate_test_application_define(void *);
209 void    usbx_ux_host_class_hid_report_id_get_test_application_define(void *);
210 void    usbx_ux_host_class_hid_periodic_report_start_test_application_define(void *);
211 void    usbx_ux_host_class_hid_descriptor_parse_coverage_test_application_define(void *);
212 void    usbx_ux_host_class_hid_descriptor_parse_test_application_define(void *);
213 void    usbx_ux_host_class_hid_descriptor_parse_test2_application_define(void *);
214 void    usbx_ux_host_class_hid_mouse_activate_test_application_define(void *);
215 void    usbx_ux_host_class_hid_activate_test_application_define(void *);
216 void    usbx_ux_host_class_hid_report_callback_register_test_application_define(void *);
217 void    usbx_ux_host_class_hid_entry_test_application_define(void *);
218 void    usbx_ux_host_class_hid_periodic_report_stop_test_application_define(void *);
219 void    usbx_ux_host_class_hid_keyboard_entry_test_application_define(void *);
220 void    usbx_ux_host_class_hid_keyboard_ioctl_test_application_define(void *);
221 void    usbx_ux_host_class_hid_mouse_entry_test_application_define(void *);
222 void    usbx_ux_host_class_hid_mouse_positions_get_test_application_define(void *);
223 void    usbx_ux_host_class_hid_mouse_buttons_get_test_application_define(void *);
224 void    usbx_ux_host_class_hid_mouse_wheel_get_test_application_define(void *);
225 void    usbx_ux_host_class_hid_remote_control_entry_test_application_define(void *);
226 void    usbx_ux_host_class_hid_remote_control_usage_get_test_application_define(void *);
227 void    usbx_ux_host_class_hid_configure_test_application_define(void *);
228 void    usbx_ux_device_class_hid_entry_test_application_define(void *);
229 void    usbx_ux_device_class_hid_deactivate_test_application_define(void *);
230 void    usbx_ux_device_class_hid_activate_test_application_define(void *);
231 void    usbx_ux_host_class_hid_keyboard_thread_test_application_define(void *);
232 void    usbx_ux_host_class_hid_keyboard_thread_test2_application_define(void *);
233 void    usbx_ux_host_class_hid_deactivate_test_application_define(void *);
234 void    usbx_ux_host_class_hid_deactivate_test2_application_define(void *);
235 void    usbx_ux_host_class_hid_descriptor_parse_test3_application_define(void *);
236 void    usbx_ux_host_class_hid_descriptor_parse_test4_application_define(void *);
237 void    usbx_ux_host_class_hid_descriptor_parse_test5_application_define(void *);
238 void    usbx_ux_host_class_hid_descriptor_parse_test6_application_define(void *);
239 void    usbx_ux_host_class_hid_descriptor_parse_test7_application_define(void *);
240 void    usbx_ux_host_class_hid_report_descriptor_get_test_application_define(void *);
241 void    usbx_ux_host_class_hid_remote_control_callback_test_application_define(void *);
242 void    usbx_ux_host_class_hid_interrupt_endpoint_search_test2_application_define(void *);
243 void    usbx_ux_host_class_hid_periodic_report_start_test2_application_define(void *);
244 void    usbx_ux_host_class_hid_report_get_test2_application_define(void *);
245 void    usbx_ux_host_class_hid_main_item_parse_test_application_define(void *);
246 void    usbx_ux_host_class_hid_main_item_parse_test2_application_define(void *);
247 void    usbx_ux_host_class_hid_mouse_entry_test3_application_define(void *);
248 void    usbx_ux_host_class_hid_mouse_entry_test2_application_define(void *);
249 void    usbx_ux_host_class_hid_remote_control_entry_test3_application_define(void *);
250 void    usbx_ux_host_class_hid_transfer_request_completed_test_application_define(void *);
251 void    usbx_ux_host_class_hid_keyboard_callback_test2_application_define(void *);
252 void    usbx_ux_host_class_hid_idle_get_test_application_define(void *);
253 void    usbx_ux_host_class_hid_remote_control_activate_test2_application_define(void *);
254 void    usbx_ux_host_class_hid_client_register_test2_application_define(void *);
255 void    usbx_ux_host_class_hid_report_descriptor_get_test_application_define(void *);
256 void    usbx_ux_host_class_hid_report_descriptor_get_test2_application_define(void *);
257 void    usbx_ux_host_class_hid_report_descriptor_get_test3_application_define(void *);
258 void    usbx_ux_host_class_hid_report_descriptor_get_test4_application_define(void *);
259 void    usbx_ux_host_class_hid_deactivate_test3_application_define(void *);
260 void    usbx_ux_host_class_hid_local_item_parse_test_application_define(void *);
261 void    usbx_ux_device_class_hid_uninitialize_test_application_define(void *);
262 void    usbx_ux_device_class_hid_initialize_test_application_define(void *);
263 void    usbx_ux_device_class_hid_report_set_test2_application_define(void *);
264 void    usbx_ux_device_class_hid_activate_test2_application_define(void *);
265 void    usbx_ux_device_class_hid_activate_test3_application_define(void *);
266 void    usbx_ux_device_class_hid_interrupt_thread_test2_application_define(void *);
267 void    usbx_ux_device_class_hid_report_test_application_define(void *);
268 void    usbx_hid_report_descriptor_compress_array_test_application_define(void *);
269 void    usbx_ux_device_class_hid_idle_rate_test_application_define(void *);
270 
271 
272 /* Storage */
273 void    usbx_host_class_storage_entry_overage_test_application_define(void *);
274 void    usbx_host_class_storage_max_lun_get_coverage_test_application_define(void *);
275 void    usbx_storage_basic_memory_test_application_define(void *);
276 void    usbx_storage_tests_application_define(void *);
277 void    usbx_storage_multi_lun_test_application_define(void *);
278 void    usbx_storage_direct_calls_test_application_define(void *);
279 void    usbx_ux_device_class_storage_vendor_strings_test_application_define(void *);
280 void    usbx_ux_device_class_storage_test_ready_test_application_define(void *);
281 void    usbx_ux_device_class_storage_control_request_test_application_define(void *);
282 void    usbx_ux_device_class_storage_entry_test_application_define(void *);
283 void    usbx_ux_device_class_storage_format_test_application_define(void *);
284 void    usbx_ux_device_class_storage_mode_select_test_application_define(void *);
285 void    usbx_ux_device_class_storage_mode_sense_test_application_define(void *);
286 void    usbx_ux_device_class_storage_request_sense_test_application_define(void *);
287 void    usbx_ux_device_class_storage_start_stop_test_application_define(void *);
288 void    usbx_ux_device_class_storage_prevent_allow_media_removal_test_application_define(void *);
289 void    usbx_ux_device_class_storage_verify_test_application_define(void *);
290 void    usbx_ux_device_class_storage_uninitialize_test_application_define(void *);
291 void    usbx_ux_device_class_storage_inquiry_test_application_define(void *);
292 void    usbx_ux_device_class_storage_initialize_test_application_define(void *);
293 void    usbx_ux_device_class_storage_synchronize_cache_test_application_define(void *);
294 void    usbx_ux_device_class_storage_read_test_application_define(void *);
295 void    usbx_ux_device_class_storage_write_test_application_define(void *);
296 void    usbx_ux_device_class_storage_thread_test_application_define(void *);
297 void    usbx_ux_device_class_storage_request_sense_coverage_test_application_define(void *);
298 void    usbx_ux_host_class_storage_configure_overage_test_application_define(void *);
299 void    usbx_ux_host_class_storage_request_sense_test_application_define(void *);
300 void    usbx_ux_host_class_storage_media_capacity_get_test_application_define(void *);
301 void    usbx_ux_host_class_storage_max_lun_get_test_application_define(void *);
302 void    usbx_ux_host_class_storage_configure_test_application_define(void *);
303 void    usbx_ux_host_class_storage_activate_test_application_define(void *);
304 void    usbx_ux_host_class_storage_device_support_check_test_application_define(void *);
305 void    usbx_ux_host_class_storage_device_initialize_test_application_define(void *);
306 void    usbx_ux_host_class_storage_media_get_test_application_define(void *);
307 void    usbx_ux_host_class_storage_media_mount_test_application_define(void *);
308 void    usbx_ux_host_class_storage_media_open_test_application_define(void *);
309 void    usbx_ux_host_class_storage_media_read_test_application_define(void *);
310 void    usbx_ux_host_class_storage_media_write_test_application_define(void *);
311 void    usbx_ux_host_class_storage_media_protection_check_test_application_define(void *);
312 void    usbx_ux_host_class_storage_media_recovery_sense_get_test_application_define(void *);
313 void    usbx_ux_host_class_storage_start_stop_test_application_define(void *);
314 void    usbx_ux_host_class_storage_transport_bo_test_application_define(void *);
315 void    usbx_ux_host_class_storage_driver_entry_test_application_define(void *);
316 void    usbx_ux_host_class_storage_entry_test_application_define(void *);
317 
318 /* RNDIS */
319 
320 void    usbx_rndis_basic_test_application_define(void *);
321 
322 /* Host stack */
323 void    usbx_ux_host_class_stack_device_configuration_reset_coverage_test_application_define(void *);
324 void    usbx_ux_host_stack_bandwidth_test_application_define(void *);
325 void    usbx_ux_host_stack_class_device_scan_test_application_define(void *);
326 void    usbx_ux_host_stack_class_get_test_application_define(void *);
327 void    usbx_ux_host_stack_class_instance_destroy_test_application_define(void *);
328 void    usbx_ux_host_stack_class_instance_get_test_application_define(void *);
329 void    usbx_ux_host_stack_class_instance_verify_test_application_define(void *);
330 void    usbx_ux_host_stack_class_interface_scan_test_application_define(void *);
331 void    usbx_ux_host_stack_class_register_test_application_define(void *);
332 void    usbx_ux_host_stack_configuration_descriptor_parse_test_application_define(void *);
333 void    usbx_ux_host_stack_configuration_enumerate_test_application_define(void *);
334 void    usbx_ux_host_stack_configuration_instance_delete_test_application_define(void *);
335 void    usbx_ux_host_stack_configuration_interface_get_test_application_define(void *);
336 void    usbx_ux_host_stack_configuration_set_test_application_define(void *);
337 void    usbx_ux_host_stack_device_address_set_test_application_define(void *);
338 void    usbx_ux_host_stack_device_get_test_application_define(void *);
339 void    usbx_ux_host_stack_device_remove_test_application_define(void *);
340 void    usbx_ux_host_stack_endpoint_instance_create_test_application_define(void *);
341 void    usbx_ux_host_stack_endpoint_instance_test_application_define(void *);
342 void    usbx_ux_host_stack_endpoint_reset_test_application_define(void *);
343 void    usbx_ux_host_stack_hcd_transfer_request_test_application_define(void *);
344 void    usbx_ux_host_stack_hcd_register_test_application_define(void *);
345 void    usbx_ux_host_stack_interface_endpoint_get_test_application_define(void *);
346 void    usbx_ux_host_stack_interface_setting_select_test_application_define(void *);
347 void    usbx_ux_host_stack_interfaces_scan_test_application_define(void *);
348 void    usbx_ux_host_stack_new_configuration_create_test_application_define(void *);
349 void    usbx_ux_host_stack_new_device_get_test_application_define(void *);
350 void    usbx_ux_host_stack_new_device_create_test_application_define(void *);
351 void    usbx_ux_host_stack_new_interface_create_test_application_define(void *);
352 void    usbx_ux_host_stack_rh_change_process_test_application_define(void *);
353 void    usbx_ux_host_stack_rh_device_insertion_test_application_define(void *);
354 void    usbx_ux_host_stack_device_configuration_get_test_application_define(void *);
355 void    usbx_ux_host_stack_device_configuration_reset_select_test_application_define(void *);
356 void    usbx_ux_host_stack_hcd_thread_entry_test_application_define(void *);
357 void    usbx_ux_host_stack_transfer_request_test_application_define(void *);
358 void    usbx_ux_host_class_storage_thread_entry_test_application_define(void *);
359 //void    usbx_ux_host_stack_transfer_request_abort_test_application_define(void *);
360 
361 /* Device Stack */
362 void    usbx_ux_device_stack_alternate_setting_get_test_application_define(void *);
363 void    usbx_ux_device_stack_alternate_setting_set_test_application_define(void *);
364 void    usbx_ux_device_stack_configuration_set_test_application_define(void *);
365 void    usbx_ux_device_stack_control_request_process_coverage_test_application_define(void *);
366 void    usbx_ux_device_stack_control_request_process_test_application_define(void *);
367 void    usbx_ux_device_stack_descriptor_send_test_application_define(void *);
368 void    usbx_ux_host_stack_device_descriptor_read_test_application_define(void *);
369 void    usbx_ux_device_stack_get_status_test_application_define(void *);
370 void    usbx_ux_device_stack_interface_delete_test_application_define(void *);
371 void    usbx_ux_device_stack_interface_set_test_application_define(void *);
372 void    usbx_ux_device_stack_interface_start_test_application_define(void *);
373 void    usbx_ux_device_stack_remote_wakeup_test_application_define(void *);
374 void    usbx_ux_device_stack_set_feature_test_application_define(void *);
375 void    usbx_ux_device_stack_transfer_request_test_application_define(void *);
376 void    usbx_ux_device_stack_endpoint_stall_test_application_define(void *);
377 void    usbx_ux_device_stack_initialize_test_application_define(void *);
378 
379 /* CDC-ECM */
380 
381 void    usbx_cdc_ecm_basic_test_application_define(void *);
382 void    usbx_cdc_ecm_basic_ipv6_test_application_define(void *);
383 void    usbx_cdc_ecm_disconnect_and_reconnect_test_application_define(void *);
384 void    usbx_cdc_ecm_alternate_setting_change_to_zero_test_application_define(void *);
385 void    usbx_ux_host_class_cdc_ecm_transmission_callback_test_application_define(void *);
386 void    usbx_cdc_ecm_host_bulk_out_transfer_arming_during_link_down_test_application_define(void *);
387 void    usbx_cdc_ecm_host_bulk_out_transfer_fail_test_application_define(void *);
388 void    usbx_ux_host_class_cdc_ecm_write_test_application_define(void *);
389 void    usbx_cdc_ecm_host_bulk_in_transfer_arming_fails_due_to_link_down_and_thread_waiting_test_application_define(void *);
390 void    usbx_cdc_ecm_host_non_ip_packet_received_test_application_define(void *);
391 void    usbx_cdc_ecm_host_bulk_in_transfer_fail_test_application_define(void *);
392 void    usbx_cdc_ecm_host_thread_link_down_before_transfer_test_application_define(void *);
393 void    usbx_cdc_ecm_host_thread_packet_allocate_fail_test_application_define(void *);
394 void    usbx_cdc_ecm_mac_address_test_application_define(void *);
395 void    usbx_cdc_ecm_mac_address_invalid_length_test_application_define(void *);
396 void    usbx_cdc_ecm_no_functional_descriptor_test_application_define(void *);
397 void    usbx_ux_host_class_cdc_ecm_mac_address_get_test_application_define(void *);
398 void    usbx_cdc_ecm_host_bulk_in_transfer_arming_during_link_down_test_application_define(void *);
399 void    usbx_ux_host_class_cdc_ecm_interrupt_notification_test_application_define(void *);
400 void    usbx_cdc_ecm_link_down_while_ongoing_transfers_test_application_define(void *);
401 void    usbx_ux_host_class_cdc_ecm_entry_test_application_define(void *);
402 void    usbx_cdc_ecm_host_bulk_in_transfer_arming_during_deactivate_test_application_define(void *);
403 void    usbx_cdc_ecm_host_first_interrupt_transfer_fail_test_application_define(void *);
404 void    usbx_cdc_ecm_host_packet_pool_create_fail_test_application_define(void *);
405 void    usbx_cdc_ecm_host_thread_create_fail_test_application_define(void *);
406 void    usbx_cdc_ecm_host_interrupt_notification_semaphore_create_fail_test_application_define(void *);
407 void    usbx_cdc_ecm_host_bulk_out_semaphore_create_fail_test_application_define(void *);
408 void    usbx_cdc_ecm_host_bulk_in_semaphore_create_fail_test_application_define(void *);
409 void    usbx_cdc_ecm_control_interface_no_interrupt_endpoint_test_application_define(void *);
410 void    usbx_cdc_ecm_data_interface_no_bulk_in_endpoint_test_application_define(void *);
411 void    usbx_cdc_ecm_data_interface_non_bulk_out_and_non_bulk_in_endpoint_test_application_define(void *);
412 void    usbx_cdc_ecm_data_interface_no_bulk_out_endpoint_test_application_define(void *);
413 void    usbx_cdc_ecm_data_interface_setting_select_fails_test_application_define(void *);
414 void    usbx_cdc_ecm_invalid_alternate_setting_after_zero_endpoint_data_interface_test_application_define(void *);
415 void    usbx_cdc_ecm_non_data_interface_after_zero_endpoint_data_interface_test_application_define(void *);
416 void    usbx_cdc_ecm_one_data_interface_with_no_endpoints_test_application_define(void *);
417 void    usbx_cdc_ecm_no_control_interface_test_application_define(void *);
418 void    usbx_cdc_ecm_interface_before_control_interface_test_application_define(void *);
419 void    usbx_cdc_ecm_basic_memory_test_application_define(void *);
420 void    usbx_ux_host_class_cdc_ecm_activate_test_application_define(void *);
421 void    usbx_cdc_ecm_default_data_interface_with_endpoints_test_application_define(void *);
422 void    usbx_ux_host_class_cdc_ecm_write_test_application_define(void *);
423 void    usbx_ux_host_class_cdc_ecm_interrupt_notification_test_application_define(void *);
424 void    usbx_ux_device_class_cdc_ecm_uninitialize_test_application_define(void *);
425 void    usbx_ux_device_class_cdc_ecm_deactivate_test_application_define(void *);
426 void    usbx_ux_device_class_cdc_ecm_initialize_test_application_define(void *);
427 void    usbx_ux_device_class_cdc_ecm_activate_test_application_define(void *);
428 void    usbx_ux_device_class_cdc_ecm_interrupt_thread_test_application_define(void *);
429 void    usbx_ux_device_class_cdc_ecm_bulkin_thread_test_application_define(void *);
430 void    usbx_ux_device_class_cdc_ecm_bulkout_thread_test_application_define(void *);
431 void    usbx_ux_device_class_cdc_ecm_control_request_test_application_define(void *);
432 void    usbx_ux_device_class_cdc_ecm_change_test_application_define(void *);
433 void    usbx_ux_device_class_cdc_ecm_entry_test_application_define(void *);
434 
435 /* Hub */
436 void    usbx_host_class_hub_port_change_connection_process_coverage_test_application_define(void *);
437 void    usbx_hub_basic_test_application_define(void *);
438 void    usbx_hub_basic_memory_test_application_define(void *);
439 void    usbx_hub_get_status_fails_during_configuration_test_application_define(void *);
440 void    usbx_bus_powered_hub_connected_to_self_and_bus_powered_hub_test_application_define(void *);
441 void    usbx_hub_invalid_hub_descriptor_length_test_application_define(void *);
442 void    usbx_hub_full_speed_hub_test_application_define(void *);
443 void    usbx_hub_multiple_tt_test_application_define(void *);
444 void    usbx_hub_invalid_device_protocol_test_application_define(void *);
445 void    usbx_ux_host_class_hub_descriptor_get_coverage_test_application_define(void *);
446 void    usbx_ux_host_class_hub_entry_test_application_define(void *);
447 void    usbx_hub_request_to_hub_itself_test_application_define(void *);
448 void    usbx_hub_no_endpoints_test_application_define(void *);
449 void    usbx_hub_interrupt_out_endpoint_test_application_define(void *);
450 void    usbx_hub_non_interrupt_in_endpoint_test_application_define(void *);
451 void    usbx_hub_hub_device_disconnect_test_application_define(void *);
452 void    usbx_hub_quick_hub_device_reconnection_test_application_define(void *);
453 void    usbx_hub_hub_device_enumeration_keeps_failing_test_application_define(void *);
454 void    usbx_hub_port_reset_fails_during_hub_device_enumeration_test_application_define(void *);
455 void    usbx_hub_get_port_status_fails_during_hub_device_enumeration_test_application_define(void *);
456 void    usbx_hub_low_speed_hub_device_test_application_define(void *);
457 void    usbx_hub_full_speed_hub_device_test_application_define(void *);
458 void    usbx_hub_quick_hub_device_disconnection_test_application_define(void *);
459 void    usbx_hub_port_change_enable_test_application_define(void *);
460 void    usbx_hub_get_hub_status_fails_during_hub_device_enumeration_test_application_define(void *);
461 void    usbx_hub_port_change_suspend_test_application_define(void *);
462 void    usbx_hub_port_change_over_current_test_application_define(void *);
463 void    usbx_hub_port_change_reset_test_application_define(void *);
464 void    usbx_hub_port_reset_fails_due_to_unset_port_enabled_bit_test_application_define(void *);
465 void    usbx_hub_get_hub_status_fails_during_port_reset_test_application_define(void *);
466 void    usbx_hub_no_power_switching_test_application_define(void *);
467 void    usbx_ux_host_class_hub_status_get_test_application_define(void *);
468 void    usbx_hub_hub_status_get_invalid_length_test_application_define(void *);
469 void    usbx_ux_host_class_hub_transfer_request_completed_test_application_define(void *);
470 
471 /* Pictbridge */
472 
473 void usbx_pictbridge_basic_test_application_define(void *);
474 
475 /* Audio */
476 
477 void    usbx_audio10_device_basic_test_application_define(void *);
478 void    usbx_audio10_iad_device_basic_test_application_define(void *);
479 void    usbx_audio10_iad_device_control_test_application_define(void *);
480 void    usbx_audio20_device_basic_test_application_define(void *);
481 void    usbx_uxe_device_audio_test_application_define(void *);
482 
483 /* Video */
484 
485 void    usbx_host_class_video_basic_test_application_define(void *);
486 
487 /* Printer */
488 
489 void    usbx_host_class_printer_basic_test_application_define(void *);
490 void    usbx_uxe_device_printer_test_application_define(void *);
491 
492 
493 /* CTest application define  */
494 
495 void test_application_define(void *first_unused_memory);
496 
497 /* Define the array of test entry points.  */
498 
499 TEST_ENTRY  test_control_tests[] =
500 {
501 #ifdef CTEST
502     test_application_define,
503 #else
504 
505     /* MSC */
506     // usbx_storage_tests_application_define,
507     usbx_host_class_storage_entry_overage_test_application_define,
508     usbx_host_class_storage_max_lun_get_coverage_test_application_define,
509 
510     usbx_host_stack_new_endpoint_create_overage_test_application_define,
511     usbx_host_stack_class_unregister_coverage_test_application_define,
512     usbx_storage_basic_memory_test_application_define,
513     usbx_storage_multi_lun_test_application_define,
514     usbx_ux_device_class_storage_request_sense_coverage_test_application_define,
515     usbx_ux_device_class_storage_vendor_strings_test_application_define,
516     usbx_ux_device_class_storage_test_ready_test_application_define,
517     usbx_ux_device_class_storage_control_request_test_application_define,
518     usbx_ux_device_class_storage_entry_test_application_define,
519     usbx_ux_device_class_storage_format_test_application_define,
520     usbx_ux_device_class_storage_mode_select_test_application_define,
521     usbx_ux_device_class_storage_mode_sense_test_application_define,
522     usbx_ux_device_class_storage_request_sense_test_application_define,
523     usbx_ux_device_class_storage_start_stop_test_application_define,
524     usbx_ux_device_class_storage_prevent_allow_media_removal_test_application_define,
525     usbx_ux_device_class_storage_verify_test_application_define,
526     usbx_ux_device_class_storage_uninitialize_test_application_define,
527     usbx_ux_device_class_storage_inquiry_test_application_define,
528     usbx_ux_device_class_storage_initialize_test_application_define,
529     usbx_ux_device_class_storage_synchronize_cache_test_application_define,
530     usbx_ux_device_class_storage_read_test_application_define,
531 
532     usbx_ux_device_class_storage_write_test_application_define,
533     usbx_ux_device_class_storage_thread_test_application_define,
534     usbx_ux_host_class_storage_configure_overage_test_application_define,
535     usbx_ux_host_class_storage_request_sense_test_application_define,
536     usbx_ux_host_class_storage_media_capacity_get_test_application_define,
537     usbx_ux_host_class_storage_max_lun_get_test_application_define,
538     usbx_ux_host_class_storage_configure_test_application_define,
539     usbx_ux_host_class_storage_activate_test_application_define,
540     usbx_ux_host_class_storage_device_support_check_test_application_define,
541     usbx_ux_host_class_storage_device_initialize_test_application_define,
542     usbx_ux_host_class_storage_media_mount_test_application_define,
543     usbx_ux_host_class_storage_media_open_test_application_define,
544     usbx_ux_host_class_storage_media_read_test_application_define,
545     usbx_ux_host_class_storage_media_write_test_application_define,
546     usbx_ux_host_class_storage_media_protection_check_test_application_define,
547     usbx_ux_host_class_storage_media_recovery_sense_get_test_application_define,
548     usbx_ux_host_class_storage_start_stop_test_application_define,
549     usbx_ux_host_class_storage_transport_bo_test_application_define,
550     usbx_ux_host_class_storage_driver_entry_test_application_define,
551     usbx_ux_host_class_storage_thread_entry_test_application_define,
552     usbx_ux_host_class_storage_entry_test_application_define,
553 
554     /* Utility */
555 
556     usbx_ux_utility_descriptor_pack_test_application_define,
557     usbx_ux_utility_descriptor_parse_test_application_define,
558     usbx_ux_utility_event_flags_test_application_define,
559     usbx_ux_utility_memory_safe_test_application_define,
560     usbx_ux_utility_memory_test_application_define,
561     usbx_ux_utility_mutex_test_application_define,
562     usbx_ux_utility_pci_write_test_application_define,
563     usbx_ux_utility_pci_read_test_application_define,
564     usbx_ux_utility_pci_class_scan_test_application_define,
565     usbx_ux_utility_physical_address_test_application_define,
566     usbx_ux_utility_semaphore_test_application_define,
567     usbx_ux_utility_string_length_check_test_application_define,
568     usbx_ux_utility_thread_create_test_application_define,
569     usbx_ux_utility_thread_schedule_other_test_application_define,
570     usbx_ux_utility_thread_suspend_test_application_define,
571     usbx_ux_utility_thread_identify_test_application_define,
572     usbx_ux_utility_timer_test_application_define,
573     usbx_ux_utility_unicode_to_string_test_application_define,
574 
575     /* Host stack */
576 
577     usbx_ux_host_stack_uninitialize_test_application_define,
578     usbx_ux_host_stack_hcd_unregister_test_application_define,
579     usbx_ux_host_stack_class_unregister_test_application_define,
580 
581     //usbx_ux_host_stack_transfer_request_abort_test_application_define,
582     usbx_ux_host_class_stack_device_configuration_reset_coverage_test_application_define,
583     usbx_ux_host_stack_bandwidth_test_application_define,
584     usbx_ux_host_stack_class_device_scan_test_application_define,
585     usbx_ux_host_stack_class_get_test_application_define,
586     usbx_ux_host_stack_class_instance_destroy_test_application_define,
587     usbx_ux_host_stack_class_instance_get_test_application_define,
588     usbx_ux_host_stack_class_interface_scan_test_application_define,
589     usbx_ux_host_stack_class_register_test_application_define,
590     usbx_ux_host_stack_configuration_descriptor_parse_test_application_define,
591     usbx_ux_host_stack_configuration_enumerate_test_application_define,
592     usbx_ux_host_stack_configuration_instance_delete_test_application_define,
593     usbx_ux_host_stack_configuration_interface_get_test_application_define,
594     usbx_ux_host_stack_configuration_set_test_application_define,
595     usbx_ux_host_stack_device_address_set_test_application_define,
596     usbx_ux_host_stack_device_get_test_application_define,
597     usbx_ux_host_stack_device_remove_test_application_define,
598     usbx_ux_host_stack_endpoint_instance_create_test_application_define,
599     usbx_ux_host_stack_endpoint_instance_test_application_define,
600     usbx_ux_host_stack_hcd_transfer_request_test_application_define,
601     usbx_ux_host_stack_hcd_register_test_application_define,
602     usbx_ux_host_stack_interface_endpoint_get_test_application_define,
603     usbx_ux_host_stack_interfaces_scan_test_application_define,
604     usbx_ux_host_stack_new_device_get_test_application_define,
605     usbx_ux_host_stack_rh_device_insertion_test_application_define,
606     usbx_ux_host_stack_device_configuration_get_test_application_define,
607     usbx_ux_host_stack_device_configuration_reset_select_test_application_define,
608     usbx_ux_host_stack_hcd_thread_entry_test_application_define,
609     usbx_ux_host_stack_transfer_request_test_application_define,
610 
611     /* Device Stack */
612 
613     usbx_ux_device_stack_alternate_setting_get_test_application_define,
614     usbx_ux_device_stack_alternate_setting_set_test_application_define,
615     usbx_ux_device_stack_class_register_test_application_define,
616     usbx_ux_device_stack_class_unregister_test_application_define,
617     usbx_ux_device_stack_configuration_set_test_application_define,
618     usbx_ux_device_stack_control_request_process_coverage_test_application_define,
619     usbx_ux_device_stack_control_request_process_test_application_define,
620     usbx_ux_host_stack_device_descriptor_read_test_application_define,
621     usbx_ux_device_stack_get_status_test_application_define,
622     usbx_ux_device_stack_interface_delete_test_application_define,
623     usbx_ux_device_stack_interface_set_test_application_define,
624     usbx_ux_device_stack_interface_start_test_application_define,
625     usbx_ux_device_stack_set_feature_test_application_define,
626     usbx_ux_device_stack_transfer_request_test_application_define,
627     usbx_ux_device_stack_endpoint_stall_test_application_define,
628     usbx_ux_device_stack_initialize_test_application_define,
629     usbx_ux_device_stack_clear_feature_coverage_test_application_define,
630 
631 #if !defined(UX_DEVICE_STANDALONE) && !defined(UX_HOST_STANDALONE)
632 
633     /* MSC */
634     usbx_storage_tests_application_define,
635 
636     /* Stack (with CDC ACM)  */
637     usbx_ux_host_stack_class_instance_verify_test_application_define,
638     usbx_ux_host_stack_endpoint_reset_test_application_define,
639     usbx_ux_host_stack_interface_setting_select_test_application_define,
640     usbx_ux_host_stack_new_configuration_create_test_application_define,
641     usbx_ux_host_stack_new_device_create_test_application_define,
642     usbx_ux_host_stack_new_interface_create_test_application_define,
643     usbx_ux_host_stack_rh_change_process_test_application_define,
644 
645     usbx_device_stack_standard_request_test_application_define,
646     usbx_ux_device_stack_descriptor_send_test_application_define,
647     usbx_ux_device_stack_remote_wakeup_test_application_define,
648 
649     /* Audio */
650     usbx_audio10_device_basic_test_application_define,
651     usbx_audio10_iad_device_basic_test_application_define,
652     usbx_audio10_iad_device_control_test_application_define,
653     usbx_audio20_device_basic_test_application_define,
654     usbx_uxe_device_audio_test_application_define,
655 
656     /* Hub */
657     usbx_host_class_hub_port_change_connection_process_coverage_test_application_define,
658     usbx_ux_host_class_hub_transfer_request_completed_test_application_define,
659     usbx_hub_hub_status_get_invalid_length_test_application_define,
660     usbx_ux_host_class_hub_status_get_test_application_define,
661     usbx_hub_no_power_switching_test_application_define,
662     usbx_hub_get_hub_status_fails_during_port_reset_test_application_define,
663     usbx_hub_port_reset_fails_due_to_unset_port_enabled_bit_test_application_define,
664     usbx_hub_port_change_reset_test_application_define,
665     usbx_hub_port_change_over_current_test_application_define,
666     usbx_hub_port_change_suspend_test_application_define,
667     usbx_hub_get_hub_status_fails_during_hub_device_enumeration_test_application_define,
668     usbx_hub_port_change_enable_test_application_define,
669     usbx_hub_quick_hub_device_disconnection_test_application_define,
670     usbx_hub_full_speed_hub_device_test_application_define,
671     usbx_hub_low_speed_hub_device_test_application_define,
672     usbx_hub_port_reset_fails_during_hub_device_enumeration_test_application_define,
673     usbx_hub_get_port_status_fails_during_hub_device_enumeration_test_application_define,
674     usbx_hub_hub_device_enumeration_keeps_failing_test_application_define,
675     usbx_hub_quick_hub_device_reconnection_test_application_define,
676     usbx_hub_hub_device_disconnect_test_application_define,
677     usbx_hub_non_interrupt_in_endpoint_test_application_define,
678     usbx_hub_interrupt_out_endpoint_test_application_define,
679     usbx_hub_no_endpoints_test_application_define,
680     usbx_hub_request_to_hub_itself_test_application_define,
681     usbx_ux_host_class_hub_descriptor_get_coverage_test_application_define,
682     usbx_ux_host_class_hub_entry_test_application_define,
683     usbx_hub_invalid_device_protocol_test_application_define,
684     usbx_hub_basic_test_application_define,
685     usbx_hub_basic_memory_test_application_define,
686     usbx_hub_get_status_fails_during_configuration_test_application_define,
687     usbx_bus_powered_hub_connected_to_self_and_bus_powered_hub_test_application_define,
688     usbx_hub_invalid_hub_descriptor_length_test_application_define,
689     usbx_hub_full_speed_hub_test_application_define,
690     usbx_hub_multiple_tt_test_application_define,
691 
692     /* CDC-ECM */
693 
694     usbx_cdc_ecm_disconnect_and_reconnect_test_application_define,
695     usbx_cdc_ecm_alternate_setting_change_to_zero_test_application_define,
696     usbx_ux_host_class_cdc_ecm_interrupt_notification_test_application_define,
697     usbx_ux_host_class_cdc_ecm_transmission_callback_test_application_define,
698     usbx_cdc_ecm_host_bulk_out_transfer_arming_during_link_down_test_application_define,
699     usbx_cdc_ecm_host_bulk_out_transfer_fail_test_application_define,
700     usbx_ux_host_class_cdc_ecm_write_test_application_define,
701     usbx_cdc_ecm_host_bulk_in_transfer_arming_fails_due_to_link_down_and_thread_waiting_test_application_define,
702     usbx_cdc_ecm_host_non_ip_packet_received_test_application_define,
703     usbx_cdc_ecm_host_bulk_in_transfer_fail_test_application_define,
704     usbx_cdc_ecm_host_thread_packet_allocate_fail_test_application_define,
705     usbx_cdc_ecm_host_thread_link_down_before_transfer_test_application_define,
706     usbx_cdc_ecm_host_packet_pool_create_fail_test_application_define,
707     usbx_cdc_ecm_mac_address_test_application_define,
708     usbx_cdc_ecm_basic_test_application_define,
709     usbx_cdc_ecm_basic_ipv6_test_application_define,
710     usbx_cdc_ecm_mac_address_invalid_length_test_application_define,
711     usbx_cdc_ecm_no_functional_descriptor_test_application_define,
712     usbx_ux_host_class_cdc_ecm_mac_address_get_test_application_define,
713     usbx_cdc_ecm_host_bulk_in_transfer_arming_during_link_down_test_application_define,
714     usbx_ux_host_class_cdc_ecm_entry_test_application_define,
715     usbx_cdc_ecm_host_bulk_in_transfer_arming_during_deactivate_test_application_define,
716     usbx_cdc_ecm_host_first_interrupt_transfer_fail_test_application_define,
717     usbx_cdc_ecm_host_thread_create_fail_test_application_define,
718     usbx_cdc_ecm_host_interrupt_notification_semaphore_create_fail_test_application_define,
719     usbx_cdc_ecm_host_bulk_out_semaphore_create_fail_test_application_define,
720     usbx_cdc_ecm_host_bulk_in_semaphore_create_fail_test_application_define,
721     usbx_cdc_ecm_control_interface_no_interrupt_endpoint_test_application_define,
722     usbx_cdc_ecm_data_interface_setting_select_fails_test_application_define,
723     usbx_cdc_ecm_data_interface_no_bulk_in_endpoint_test_application_define,
724     usbx_cdc_ecm_data_interface_non_bulk_out_and_non_bulk_in_endpoint_test_application_define,
725     usbx_cdc_ecm_data_interface_no_bulk_out_endpoint_test_application_define,
726     usbx_cdc_ecm_one_data_interface_with_no_endpoints_test_application_define,
727     usbx_cdc_ecm_invalid_alternate_setting_after_zero_endpoint_data_interface_test_application_define,
728     usbx_cdc_ecm_non_data_interface_after_zero_endpoint_data_interface_test_application_define,
729     usbx_cdc_ecm_default_data_interface_with_endpoints_test_application_define,
730     usbx_cdc_ecm_no_control_interface_test_application_define,
731     usbx_cdc_ecm_interface_before_control_interface_test_application_define,
732     usbx_cdc_ecm_basic_memory_test_application_define,
733     usbx_ux_device_class_cdc_ecm_uninitialize_test_application_define,
734     usbx_ux_device_class_cdc_ecm_deactivate_test_application_define,
735     usbx_ux_device_class_cdc_ecm_initialize_test_application_define,
736     usbx_ux_device_class_cdc_ecm_activate_test_application_define,
737     usbx_ux_device_class_cdc_ecm_interrupt_thread_test_application_define,
738     usbx_ux_device_class_cdc_ecm_bulkin_thread_test_application_define,
739     usbx_ux_device_class_cdc_ecm_bulkout_thread_test_application_define,
740     usbx_ux_device_class_cdc_ecm_control_request_test_application_define,
741     usbx_ux_device_class_cdc_ecm_change_test_application_define,
742     usbx_ux_device_class_cdc_ecm_entry_test_application_define,
743     usbx_cdc_ecm_link_down_while_ongoing_transfers_test_application_define,
744 
745     /* RNDIS */
746 
747     usbx_rndis_basic_test_application_define,
748 
749     /* CDC-ACM. */
750 
751     usbx_cdc_acm_basic_test_application_define,
752     usbx_cdc_acm_basic_memory_test_application_define,
753     usbx_cdc_acm_configure_test_application_define,
754     usbx_cdc_acm_device_dtr_rts_reset_on_disconnect_test_application_define,
755     usbx_ux_device_class_cdc_acm_activate_test_application_define,
756     usbx_ux_device_class_cdc_acm_deactivate_test_application_define,
757     usbx_ux_device_class_cdc_acm_ioctl_test_application_define,
758     usbx_ux_device_class_cdc_acm_transmission_test_application_define,
759     usbx_ux_device_class_cdc_acm_write_test_application_define,
760     usbx_ux_device_class_cdc_acm_timeout_test_application_define,
761     usbx_ux_host_class_cdc_acm_activate_test_application_define,
762     usbx_ux_host_class_cdc_acm_capabilities_get_test_application_define,
763     usbx_ux_host_class_cdc_acm_deactivate_test_application_define,
764     usbx_ux_host_class_cdc_acm_endpoints_get_test_application_define,
765     usbx_ux_host_class_cdc_acm_entry_test_application_define,
766     usbx_ux_host_class_cdc_acm_read_test_application_define,
767     usbx_ux_host_class_cdc_acm_transfer_request_completed_test_application_define,
768     usbx_ux_device_class_cdc_acm_bulkout_thread_test_application_define,
769     usbx_uxe_device_cdc_acm_test_application_define,
770 
771     /* DPUMP. */
772 
773     usbx_dpump_basic_test_application_define,
774 
775     /* Printer */
776 
777     usbx_host_class_printer_basic_test_application_define,
778     usbx_uxe_device_printer_test_application_define,
779 
780     /* Host & Device basic. */
781 
782     usbx_host_device_basic_test_application_define,
783     usbx_host_device_basic_memory_test_application_define,
784     usbx_host_device_initialize_test_application_define,
785 
786     /* HID */
787 
788     usbx_hid_report_descriptor_compress_array_test_application_define,
789     usbx_hid_remote_control_tests_application_define,
790     usbx_ux_host_class_hid_remote_control_entry_test_application_define,
791     usbx_ux_host_class_hid_remote_control_entry_test2_application_define,
792     usbx_ux_host_class_hid_remote_control_entry_test3_application_define,
793     usbx_ux_host_class_hid_remote_control_usage_get_test_application_define,
794     usbx_hid_keyboard_basic_test_application_define,
795     usbx_hid_keyboard_key_test_application_define,
796     usbx_ux_device_class_hid_activate_test_application_define,
797     usbx_ux_device_class_hid_control_request_test_application_define,
798     usbx_ux_device_class_hid_deactivate_test_application_define,
799     usbx_ux_device_class_hid_descriptor_send_test_application_define,
800     usbx_ux_device_class_hid_entry_test_application_define,
801     usbx_ux_device_class_hid_event_get_AND_set_test_application_define,
802     usbx_ux_device_class_hid_initialize_test_application_define,
803     usbx_ux_device_class_hid_interrupt_thread_test_application_define,
804     usbx_ux_device_class_hid_interrupt_thread_test2_application_define,
805     usbx_ux_device_class_hid_report_test_application_define,
806     usbx_ux_host_class_hid_activate_test_application_define,
807     usbx_ux_host_class_hid_client_register_test_application_define,
808     usbx_ux_host_class_hid_client_register_test2_application_define,
809     usbx_ux_host_class_hid_client_search_test_application_define,
810     usbx_ux_host_class_hid_configure_test_application_define,
811     usbx_ux_host_class_hid_deactivate_test_application_define,
812     usbx_ux_host_class_hid_deactivate_test3_application_define,
813     usbx_ux_host_class_hid_descriptor_parse_coverage_test_application_define,
814     usbx_ux_host_class_hid_descriptor_parse_test_application_define,
815     usbx_ux_host_class_hid_descriptor_parse_test2_application_define,
816     usbx_ux_host_class_hid_descriptor_parse_test4_application_define,
817     usbx_ux_host_class_hid_descriptor_parse_test5_application_define,
818     usbx_ux_host_class_hid_entry_test_application_define,
819     usbx_ux_host_class_hid_idle_get_test_application_define,
820     usbx_ux_host_class_hid_idle_set_test_application_define,
821     usbx_ux_host_class_hid_keyboard_activate_test_application_define,
822     usbx_ux_host_class_hid_keyboard_entry_test_application_define,
823     usbx_ux_host_class_hid_keyboard_ioctl_test_application_define,
824     usbx_ux_host_class_hid_keyboard_thread_test_application_define,
825     usbx_ux_host_class_hid_keyboard_thread_test2_application_define,
826     usbx_ux_host_class_hid_main_item_parse_test_application_define,
827     usbx_ux_host_class_hid_main_item_parse_test2_application_define,
828     usbx_ux_host_class_hid_mouse_activate_test_application_define,
829     usbx_ux_host_class_hid_mouse_entry_test_application_define,
830     usbx_ux_host_class_hid_mouse_entry_test3_application_define,
831     usbx_ux_host_class_hid_mouse_buttons_get_test_application_define,
832     usbx_ux_host_class_hid_mouse_positions_get_test_application_define,
833     usbx_ux_host_class_hid_mouse_wheel_get_test_application_define,
834     usbx_ux_host_class_hid_periodic_report_start_test_application_define,
835     usbx_ux_host_class_hid_periodic_report_start_test2_application_define,
836     usbx_ux_host_class_hid_periodic_report_stop_test_application_define,
837     usbx_ux_host_class_hid_remote_control_activate_test_application_define,
838     usbx_ux_host_class_hid_report_add_test_application_define,
839     usbx_ux_host_class_hid_report_callback_register_test_application_define,
840     usbx_ux_host_class_hid_report_get_test_application_define,
841     usbx_ux_host_class_hid_report_get_test2_application_define,
842     usbx_ux_host_class_hid_report_id_get_test_application_define,
843     usbx_ux_host_class_hid_report_set_test_application_define,
844     usbx_ux_host_class_hid_transfer_request_completed_test_application_define,
845     usbx_hid_keyboard_key_get_test_application_define,
846     usbx_hid_transfer_request_completed_decompressed_test_application_define,
847     usbx_hid_transfer_request_completed_test_application_define,
848     usbx_hid_transfer_request_completed_raw_test_application_define,
849     usbx_hid_report_descriptor_compress_test_application_define,
850     usbx_hid_report_descriptor_compress_and_decompress_test_application_define,
851     usbx_hid_report_descriptor_get_zero_length_item_data_test_application_define,
852     usbx_hid_report_descriptor_global_item_test_application_define,
853     usbx_hid_report_descriptor_global_item_persist_test_application_define,
854     usbx_hid_report_descriptor_report_size_overflow_test_application_define,
855     usbx_hid_report_descriptor_report_count_overflow_test_application_define,
856     usbx_hid_report_descriptor_pop_underflow_tag_test_application_define,
857     usbx_hid_report_descriptor_push_overflow_tag_test_application_define,
858     usbx_hid_report_descriptor_push_pop_test_application_define,
859     usbx_hid_report_descriptor_unknown_global_tag_test_application_define,
860     usbx_hid_report_descriptor_end_collection_error_test_application_define,
861     usbx_hid_report_descriptor_collection_overflow_test_application_define,
862     usbx_hid_report_descriptor_multiple_collections_test_application_define,
863     usbx_hid_report_descriptor_unknown_local_tag_test_application_define,
864     usbx_hid_report_descriptor_incoherent_usage_min_max_test_application_define,
865     usbx_hid_report_descriptor_delimiter_unknown_test_application_define,
866     usbx_hid_report_descriptor_delimiter_nested_close_test_application_define,
867     usbx_hid_report_descriptor_delimiter_nested_open_test_application_define,
868     usbx_hid_report_descriptor_invalid_length_test_application_define,
869     usbx_hid_report_descriptor_invalid_item_test_application_define,
870     usbx_ux_host_class_hid_local_item_parse_test_application_define,
871     usbx_hid_mouse_basic_test_application_define,
872     usbx_ux_device_class_hid_basic_memory_test_application_define,
873     usbx_ux_device_class_hid_idle_rate_test_application_define,
874 
875     usbx_host_class_video_basic_test_application_define,
876 
877 #endif /* !defined(UX_DEVICE_STANDALONE) && !defined(UX_HOST_STANDALONE) */
878 #endif /* CTEST */
879     TX_NULL,
880 };
881 
882 /* Define thread prototypes.  */
883 
884 void  test_control_thread_entry(ULONG thread_input);
885 void  test_thread_entry(ULONG thread_input);
886 void  test_control_return(UINT status);
887 void  test_control_cleanup(void);
888 
889 
890 /* Define necessary external references.  */
891 
892 #ifdef __ghs
893 extern TX_MUTEX                 __ghLockMutex;
894 #endif
895 
896 extern TX_TIMER                 *_tx_timer_created_ptr;
897 extern ULONG                    _tx_timer_created_count;
898 #ifndef TX_TIMER_PROCESS_IN_ISR
899 extern TX_THREAD                _tx_timer_thread;
900 #endif
901 extern TX_THREAD                *_tx_thread_created_ptr;
902 extern ULONG                    _tx_thread_created_count;
903 extern TX_SEMAPHORE             *_tx_semaphore_created_ptr;
904 extern ULONG                    _tx_semaphore_created_count;
905 extern TX_QUEUE                 *_tx_queue_created_ptr;
906 extern ULONG                    _tx_queue_created_count;
907 extern TX_MUTEX                 *_tx_mutex_created_ptr;
908 extern ULONG                    _tx_mutex_created_count;
909 extern TX_EVENT_FLAGS_GROUP     *_tx_event_flags_created_ptr;
910 extern ULONG                    _tx_event_flags_created_count;
911 extern TX_BYTE_POOL             *_tx_byte_pool_created_ptr;
912 extern ULONG                    _tx_byte_pool_created_count;
913 extern TX_BLOCK_POOL            *_tx_block_pool_created_ptr;
914 extern ULONG                    _tx_block_pool_created_count;
915 
916 extern NX_PACKET_POOL *         _nx_packet_pool_created_ptr;
917 extern ULONG                    _nx_packet_pool_created_count;
918 extern NX_IP *                  _nx_ip_created_ptr;
919 extern ULONG                    _nx_ip_created_count;
920 
921 #ifdef EXTERNAL_EXIT
922 void external_exit(UINT code);
923 #endif
924 
925 
926 /* Define the interrupt processing dispatcher.  The individual tests will set this up when they desire
927    asynchrony processing for testing purposes.  */
928 
test_interrupt_dispatch(void)929 void test_interrupt_dispatch(void)
930 {
931 
932 #ifndef TX_DISABLE_ERROR_CHECKING
933 
934     /* Test calling tx_thread_relinquish from ISR to see if the error checking throws it out.  */
935     tx_thread_relinquish();
936 #endif
937 
938     /* Check for something to run... */
939     if (test_isr_dispatch)
940     {
941 
942         (test_isr_dispatch)();
943     }
944 }
945 
946 
947 /* Define init timer entry.  */
948 
init_timer_entry(ULONG timer_input)949 static void   init_timer_entry(ULONG timer_input)
950 {
951 
952 }
953 
954 
955 /* Define main entry point.  */
956 #ifndef EXTERNAL_MAIN
main()957 void main()
958 {
959 
960     /* Enter the USBX kernel.  */
961     tx_kernel_enter();
962 }
963 #endif
964 
965 
966 /* Define what the initial system looks like.  */
967 
tx_application_define(void * first_unused_memory)968 void    tx_application_define(void *first_unused_memory)
969 {
970 
971     /* Initialize the test error/success counters.  */
972     test_control_successful_tests =  0;
973     test_control_failed_tests =      0;
974     test_control_system_errors =     0;
975 
976     /* Create the test control thread.  */
977     tx_thread_create(&test_control_thread, "test control thread", test_control_thread_entry, 0,
978             test_control_thread_stack, TEST_STACK_SIZE,
979             17, 15, TX_NO_TIME_SLICE, TX_AUTO_START);
980 
981     /* Remember the free memory pointer.  */
982     test_free_memory_ptr =  &tests_memory[0];
983 }
984 
985 
986 
987 /* Define the test control thread.  This thread is responsible for dispatching all of the
988    tests in the USBX test suite.  */
989 
test_control_thread_entry(ULONG thread_input)990 void  test_control_thread_entry(ULONG thread_input)
991 {
992 
993 ULONG   previous_test_control_failed_tests;
994 ULONG   previous_thread_created_count;
995 UINT    i;
996 
997     /* Raise the priority of the control thread to 0.  */
998     tx_thread_priority_change(&test_control_thread, 0, &i);
999 
1000     /* Print out banner.  */
1001     printf("********************** USBX Validation/Regression Test Suite *********************************\n\n");
1002 
1003     /* Print version id.  */
1004     printf("Version: %s Data width: x%i\n\n", _ux_version_id, (int)sizeof(void*) * 8);
1005 
1006     /* Print out the tests... */
1007     printf("Running validation/regression test:\n\n");
1008 
1009     /* Loop to process all tests...  */
1010     i =  0;
1011     while (test_control_tests[i].test_entry != TX_NULL)
1012     {
1013 
1014         /* Clear the ISR dispatch.  */
1015         test_isr_dispatch =  TX_NULL;
1016 
1017         /* Save the number of failed tests for comparison. */
1018         previous_test_control_failed_tests = test_control_failed_tests;
1019 
1020         /* Save previous thread count.  */
1021         previous_thread_created_count = _tx_thread_created_count;
1022 
1023         /* Dispatch the test.  */
1024         (test_control_tests[i++].test_entry)(test_free_memory_ptr);
1025 
1026         /* Clear the ISR dispatch.  */
1027         test_isr_dispatch =  TX_NULL;
1028 
1029         /* Did the test entry run successfully? */
1030         if (test_control_failed_tests == previous_test_control_failed_tests &&
1031             previous_thread_created_count != _tx_thread_created_count)
1032 
1033             /* Suspend control test to allow test to run.  */
1034             tx_thread_suspend(&test_control_thread);
1035 
1036         /* Test finished, cleanup in preparation for the next test.  */
1037         test_control_cleanup();
1038     }
1039 
1040     /* Finished with all tests, print results and return!  */
1041     printf("**** Testing Complete ****\n");
1042     printf("**** Test Summary:  Tests Passed:  %lu   Tests Failed:  %lu    System Errors:   %lu\n", test_control_successful_tests, test_control_failed_tests, test_control_system_errors);
1043 
1044 #ifndef EXTERNAL_EXIT
1045     exit(test_control_failed_tests);
1046 #else
1047     external_exit(0);
1048 #endif
1049 }
1050 
disable_test_actions(VOID)1051 static VOID disable_test_actions(VOID)
1052 {
1053 
1054     /* Note: There shouldn't be any actions left. */
1055     ux_test_cleanup_everything();
1056 
1057     ux_test_utility_sim_cleanup();
1058     ux_test_hcd_sim_host_cleanup();
1059     ux_test_dcd_sim_slave_cleanup();
1060 }
1061 
1062 
test_control_return(UINT status)1063 void  test_control_return(UINT status)
1064 {
1065 
1066 UINT    old_posture =  TX_INT_ENABLE;
1067 
1068     disable_test_actions();
1069 
1070     /* Save the status in a global.  */
1071     test_control_return_status =  status;
1072 
1073     /* Ensure interrupts are enabled.  */
1074     old_posture =  tx_interrupt_control(TX_INT_ENABLE);
1075 
1076     /* Determine if it was successful or not.  */
1077     if (status)
1078         test_control_failed_tests++;
1079     else
1080         test_control_successful_tests++;
1081 
1082     /* Now check for system errors.  */
1083 
1084     /* Is preempt disable flag set?  */
1085     if (_tx_thread_preempt_disable)
1086     {
1087 
1088         /* System error - preempt disable should never be set inside of a thread!  */
1089         printf("    ***** SYSTEM ERROR ***** _tx_thread_preempt_disable is non-zero!\n");
1090         test_control_system_errors++;
1091     }
1092 
1093     /* Is system state set?  */
1094     if (_tx_thread_system_state)
1095     {
1096 
1097         /* System error - system state should never be set inside of a thread!  */
1098         printf("    ***** SYSTEM ERROR ***** _tx_thread_system_state is non-zero!\n");
1099         test_control_system_errors++;
1100     }
1101 
1102     /* Are interrupts disabled?  */
1103     if (old_posture == TX_INT_DISABLE)
1104     {
1105 
1106         /* System error - interrupts should always be enabled in our test threads!  */
1107         printf("    ***** SYSTEM ERROR ***** test returned with interrupts disabled!\n");
1108         test_control_system_errors++;
1109     }
1110 
1111     /* Resume the control thread to fully exit the test.  */
1112     tx_thread_resume(&test_control_thread);
1113 }
1114 
1115 
test_control_cleanup(void)1116 void  test_control_cleanup(void)
1117 {
1118 
1119 TX_MUTEX    *mutex_ptr;
1120 TX_THREAD   *thread_ptr;
1121 
1122 
1123     /* FIXME: Cleanup of FileX, and USBX resources should be added here... and perhaps some checks for memory leaks, etc.  */
1124 
1125     /* Disable testing actions generation */
1126     disable_test_actions();
1127 
1128     /* Delete all IP instances.   */
1129     while (_nx_ip_created_ptr)
1130     {
1131 
1132         /* Delete all UDP sockets.  */
1133         while (_nx_ip_created_ptr -> nx_ip_udp_created_sockets_ptr)
1134         {
1135 
1136             /* Make sure the UDP socket is unbound.  */
1137             nx_udp_socket_unbind(_nx_ip_created_ptr -> nx_ip_udp_created_sockets_ptr);
1138 
1139             /* Delete the UDP socket.  */
1140             nx_udp_socket_delete(_nx_ip_created_ptr -> nx_ip_udp_created_sockets_ptr);
1141         }
1142 
1143         /* Delete all TCP sockets.  */
1144         while (_nx_ip_created_ptr -> nx_ip_tcp_created_sockets_ptr)
1145         {
1146 
1147             /* When disconnecting TCP sockets, NetX sends a RST packet. Since the link
1148                is down, the driver will report an error. So, turn of errors during this
1149                time.  */
1150             ux_test_ignore_all_errors();
1151 
1152             /* Disconnect.  */
1153             nx_tcp_socket_disconnect(_nx_ip_created_ptr -> nx_ip_tcp_created_sockets_ptr, NX_NO_WAIT);
1154 
1155             /* Re-enable errors.  */
1156             ux_test_unignore_all_errors();
1157 
1158             /* Make sure the TCP client socket is unbound.  */
1159             nx_tcp_client_socket_unbind(_nx_ip_created_ptr -> nx_ip_tcp_created_sockets_ptr);
1160 
1161             /* Make sure the TCP server socket is unaccepted.  */
1162             nx_tcp_server_socket_unaccept(_nx_ip_created_ptr -> nx_ip_tcp_created_sockets_ptr);
1163 
1164             /* Delete the TCP socket.  */
1165             nx_tcp_socket_delete(_nx_ip_created_ptr -> nx_ip_tcp_created_sockets_ptr);
1166         }
1167 
1168         /* Clear all listen requests.  */
1169         while (_nx_ip_created_ptr -> nx_ip_tcp_active_listen_requests)
1170         {
1171 
1172             /* Make sure the TCP server socket is unlistened.  */
1173             nx_tcp_server_socket_unlisten(_nx_ip_created_ptr, (_nx_ip_created_ptr -> nx_ip_tcp_active_listen_requests) -> nx_tcp_listen_port);
1174         }
1175 
1176         /* Delete the IP instance.  */
1177         nx_ip_delete(_nx_ip_created_ptr);
1178     }
1179 
1180     /* Delete all the packet pools.  */
1181     while (_nx_packet_pool_created_ptr)
1182     {
1183         nx_packet_pool_delete(_nx_packet_pool_created_ptr);
1184     }
1185 
1186     /* Delete all queues.  */
1187     while(_tx_queue_created_ptr)
1188     {
1189 
1190         /* Delete queue.  */
1191         tx_queue_delete(_tx_queue_created_ptr);
1192     }
1193 
1194     /* Delete all semaphores.  */
1195     while(_tx_semaphore_created_ptr)
1196     {
1197 
1198         /* Delete semaphore.  */
1199         tx_semaphore_delete(_tx_semaphore_created_ptr);
1200     }
1201 
1202     /* Delete all event flag groups.  */
1203     while(_tx_event_flags_created_ptr)
1204     {
1205 
1206         /* Delete event flag group.  */
1207         tx_event_flags_delete(_tx_event_flags_created_ptr);
1208     }
1209 
1210     /* Delete all byte pools.  */
1211     while(_tx_byte_pool_created_ptr)
1212     {
1213 
1214         /* Delete byte pool.  */
1215         tx_byte_pool_delete(_tx_byte_pool_created_ptr);
1216     }
1217 
1218     /* Delete all block pools.  */
1219     while(_tx_block_pool_created_ptr)
1220     {
1221 
1222         /* Delete block pool.  */
1223         tx_block_pool_delete(_tx_block_pool_created_ptr);
1224     }
1225 
1226     /* Delete all timers.  */
1227     while(_tx_timer_created_ptr)
1228     {
1229 
1230         /* Deactivate timer.  */
1231         tx_timer_deactivate(_tx_timer_created_ptr);
1232 
1233         /* Delete timer.  */
1234         tx_timer_delete(_tx_timer_created_ptr);
1235     }
1236 
1237     /* Delete all mutexes (except for system mutex).  */
1238     while(_tx_mutex_created_ptr)
1239     {
1240 
1241         /* Setup working mutex pointer.  */
1242         mutex_ptr =  _tx_mutex_created_ptr;
1243 
1244 #ifdef __ghs
1245 
1246         /* Determine if the mutex is the GHS system mutex.  If so, don't delete!  */
1247         if (mutex_ptr == &__ghLockMutex)
1248         {
1249 
1250             /* Move to next mutex.  */
1251             mutex_ptr =  mutex_ptr -> tx_mutex_created_next;
1252         }
1253 
1254         /* Determine if there are no more mutexes to delete.  */
1255         if (_tx_mutex_created_count == 1)
1256             break;
1257 #endif
1258 
1259         /* Delete mutex.  */
1260         tx_mutex_delete(mutex_ptr);
1261     }
1262 
1263     /* Delete all threads, except for timer thread, and test control thread.  */
1264     while (_tx_thread_created_ptr)
1265     {
1266 
1267         /* Setup working pointer.  */
1268         thread_ptr =  _tx_thread_created_ptr;
1269 
1270 
1271 #ifdef TX_TIMER_PROCESS_IN_ISR
1272 
1273         /* Determine if there are more threads to delete.  */
1274         if (_tx_thread_created_count == 1)
1275             break;
1276 
1277         /* Determine if this thread is the test control thread.  */
1278         if (thread_ptr == &test_control_thread)
1279         {
1280 
1281             /* Move to the next thread pointer.  */
1282             thread_ptr =  thread_ptr -> tx_thread_created_next;
1283         }
1284 #else
1285 
1286         /* Determine if there are more threads to delete.  */
1287         if (_tx_thread_created_count == 2)
1288             break;
1289 
1290         /* Move to the thread not protected.  */
1291         while ((thread_ptr == &_tx_timer_thread) || (thread_ptr == &test_control_thread))
1292         {
1293 
1294             /* Yes, move to the next thread.  */
1295             thread_ptr =  thread_ptr -> tx_thread_created_next;
1296         }
1297 #endif
1298 
1299         /* First terminate the thread to ensure it is ready for deletion.  */
1300         tx_thread_terminate(thread_ptr);
1301 
1302         /* Delete the thread.  */
1303         tx_thread_delete(thread_ptr);
1304     }
1305 
1306     /* At this point, only the test control thread and the system timer thread and/or mutex should still be
1307        in the system.  */
1308 }
1309 
1310 
1311 
1312 
1313