1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   Application Interface (API)                                         */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
27 /*                                                                        */
28 /*    ux_api.h                                            PORTABLE C      */
29 /*                                                           6.3.0        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Chaoqiong Xiao, Microsoft Corporation                               */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file defines the basic Application Interface (API) to the      */
37 /*    high-performance USBX real-time USB stack.  All service prototypes  */
38 /*    and data structure definitions are defined in this file.            */
39 /*    Please note that basic data type definitions and other architecture-*/
40 /*    specific information is contained in the file ux_port.h.            */
41 /*                                                                        */
42 /*  RELEASE HISTORY                                                       */
43 /*                                                                        */
44 /*    DATE              NAME                      DESCRIPTION             */
45 /*                                                                        */
46 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
47 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
48 /*                                            added query usage of device */
49 /*                                            ClassSubclassProtocol,      */
50 /*                                            added option to disable FX  */
51 /*                                            media integration, prefixed */
52 /*                                            UX to MS_TO_TICK, added     */
53 /*                                            APIs and macros related to  */
54 /*                                            uninitialize, optimized     */
55 /*                                            based on compile            */
56 /*                                            definitions, updated        */
57 /*                                            product constants, used     */
58 /*                                            host class extension        */
59 /*                                            pointer for class specific  */
60 /*                                            structured data, used UX    */
61 /*                                            prefix to refer to TX       */
62 /*                                            symbols instead of using    */
63 /*                                            them directly,              */
64 /*                                            resulting in version 6.1    */
65 /*  11-09-2020     Chaoqiong Xiao           Modified comment(s),          */
66 /*                                            used unsigned defines,      */
67 /*                                            added HCD uninit command,   */
68 /*                                            modified HCD status code,   */
69 /*                                            fixed compile warnings,     */
70 /*                                            resulting in version 6.1.2  */
71 /*  12-31-2020     Chaoqiong Xiao           Modified comment(s),          */
72 /*                                            added BOS support,          */
73 /*                                            resulting in version 6.1.3  */
74 /*  02-02-2021     Chaoqiong Xiao           Modified comment(s),          */
75 /*                                            added configuration activate*/
76 /*                                            and deactivate support,     */
77 /*                                            added host printer get      */
78 /*                                            device ID support,          */
79 /*                                            added host device string    */
80 /*                                            descriptor get support,     */
81 /*                                            added events for device     */
82 /*                                            connection/disconnection,   */
83 /*                                            resulting in version 6.1.4  */
84 /*  03-02-2021     Chaoqiong Xiao           Modified comment(s),          */
85 /*                                            resulting in version 6.1.5  */
86 /*  04-02-2021     Chaoqiong Xiao           Modified comment(s),          */
87 /*                                            added macros for Word/DWord */
88 /*                                            to bytes extraction,        */
89 /*                                            resulting in version 6.1.6  */
90 /*  06-02-2021     Chaoqiong Xiao           Modified comment(s),          */
91 /*                                            added trace dependency test,*/
92 /*                                            changed transfer timeout    */
93 /*                                            value,                      */
94 /*                                            resulting in version 6.1.7  */
95 /*  08-02-2021     Chaoqiong Xiao           Modified comment(s),          */
96 /*                                            fixed spelling error,       */
97 /*                                            fixed trace ID order error, */
98 /*                                            resulting in version 6.1.8  */
99 /*  10-15-2021     Chaoqiong Xiao           Modified comment(s),          */
100 /*                                            improved assert macros,     */
101 /*                                            added transfer size field,  */
102 /*                                            improved traceX support,    */
103 /*                                            resulting in version 6.1.9  */
104 /*  01-31-2022     Chaoqiong Xiao           Modified comment(s),          */
105 /*                                            added too many ports error, */
106 /*                                            moved tx_api.h include and  */
107 /*                                            typedefs to ux_port.h,      */
108 /*                                            added standalone support,   */
109 /*                                            added device HID trace IDs, */
110 /*                                            added some general errors,  */
111 /*                                            added printer trace IDs,    */
112 /*                                            resulting in version 6.1.10 */
113 /*  04-25-2022     Chaoqiong Xiao           Modified comment(s),          */
114 /*                                            assumed OS types to avoid   */
115 /*                                            standalone compiling error, */
116 /*                                            added CCID trace IDs,       */
117 /*                                            resulting in version 6.1.11 */
118 /*  07-29-2022     Chaoqiong Xiao           Modified comment(s),          */
119 /*                                            fixed parameter/variable    */
120 /*                                            names conflict C++ keyword, */
121 /*                                            added feedback size defs,   */
122 /*                                            added shared device config  */
123 /*                                            descriptor for enum scan,   */
124 /*                                            resulting in version 6.1.12 */
125 /*  10-31-2022     Chaoqiong Xiao           Modified comment(s),          */
126 /*                                            added some ETH error codes, */
127 /*                                            allowed align minimal def,  */
128 /*                                            added interface instance    */
129 /*                                            creation strategy control,  */
130 /*                                            resulting in version 6.2.0  */
131 /*  03-08-2023     Chaoqiong Xiao           Modified comment(s),          */
132 /*                                            accepted UX_MAX_CLASSES as  */
133 /*                                            max class driver configure, */
134 /*                                            added a new error code,     */
135 /*                                            resulting in version 6.2.1  */
136 /*  10-31-2023     Chaoqiong Xiao           Modified comment(s),          */
137 /*                                            refined memory management,  */
138 /*                                            added a new mode to manage  */
139 /*                                            endpoint buffer in classes, */
140 /*                                            optimized USB descriptors,  */
141 /*                                            added error checks support, */
142 /*                                            resulting in version 6.3.0  */
143 /*                                                                        */
144 /**************************************************************************/
145 
146 #ifndef UX_API_H
147 #define UX_API_H
148 
149 /* Determine if a C++ compiler is being used.  If so, ensure that standard
150    C is used to process the API information.  */
151 
152 #ifdef   __cplusplus
153 
154 /* Yes, C++ compiler is present.  Use standard C.  */
155 extern   "C" {
156 
157 #endif
158 
159 /* Include USBX port specific file.  */
160 
161 #include "ux_port.h"
162 
163 /* Process compile options:
164  *
165  * - UX_HOST_SIDE_ONLY/UX_HOST_STANDALONE:
166  *   Must not be defined at the same time,
167  *   When defined, only host/device side APIs are available.
168  *
169  * - UX_STANDALONE:
170  *   Defined, whole RTOS dependencies are removed from USBX.
171  *
172  * - UX_DEVICE_STANDALONE/UX_HOST_STANDALONE
173  *   Internal definitions for different parts,
174  *   _DEVICE_STANDALONE removes RTOS dependencies of DCD, device stack and classes,
175  *   _HOST_STANDALONE removes RTOS dependencies of HCD, host stack and classes,
176  *   if UX_STANDALONE is not defined, RTOS is always enabled in system and utilities.
177  */
178 #if defined(UX_STANDALONE)
179 #if !defined(UX_DEVICE_STANDALONE)
180 #define UX_DEVICE_STANDALONE
181 #endif
182 #if !defined(UX_HOST_STANDALONE)
183 #define UX_HOST_STANDALONE
184 #endif
185 #if !defined(UX_OTG_STANDALONE)
186 #define UX_OTG_STANDALONE
187 #endif
188 #else
189 #if defined(UX_DEVICE_STANDALONE) && defined(UX_HOST_STANDALONE) && defined(UX_OTG_STANDALONE) ||\
190     defined(UX_DEVICE_STANDALONE) && defined(UX_DEVICE_SIDE_ONLY) ||\
191     defined(UX_HOST_STANDALONE) && defined(UX_HOST_SIDE_ONLY)
192 #define UX_STANDALONE
193 #endif
194 #endif
195 
196 /* Internal option: enable the basic USBX error checking. This define is typically used
197    while debugging application.  */
198 #if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_SYSTEM_ENABLE_ERROR_CHECKING)
199 #define UX_SYSTEM_ENABLE_ERROR_CHECKING
200 #endif
201 
202 /* Internal option: enable the basic USBX error checking. This define is typically used
203    while debugging application.  */
204 #if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_STACK_ENABLE_ERROR_CHECKING)
205 #define UX_DEVICE_STACK_ENABLE_ERROR_CHECKING
206 #endif
207 
208 /* Internal option: enable the basic USBX error checking. This define is typically used
209    while debugging application.  */
210 #if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_HOST_STACK_ENABLE_ERROR_CHECKING)
211 #define UX_HOST_STACK_ENABLE_ERROR_CHECKING
212 #endif
213 
214 /* Defined, this value represents the endpoint buffer owner.
215    0 - The default, endpoint buffer is managed by core stack. Each endpoint takes UX_SLAVE_REQUEST_DATA_MAX_LENGTH bytes.
216    1 - Endpoint buffer managed by classes. In this case not all endpoints consume UX_SLAVE_REQUEST_DATA_MAX_LENGTH bytes.
217 */
218 #ifndef UX_DEVICE_ENDPOINT_BUFFER_OWNER
219 #define UX_DEVICE_ENDPOINT_BUFFER_OWNER             0
220 #endif
221 #define UX_DEVICE_ENDPOINT_BUFFER_OWNER_CORE        0
222 #define UX_DEVICE_ENDPOINT_BUFFER_OWNER_CLASS       1
223 
224 /* Define the maximum length for class names (exclude string null-terminator).  */
225 #define UX_MAX_CLASS_NAME_LENGTH    63
226 
227 /* Define the maximum length for HCD names (exclude string null-terminator).  */
228 #define UX_MAX_HCD_NAME_LENGTH      63
229 
230 /* Disable warning of parameter not used. */
231 #ifndef UX_PARAMETER_NOT_USED
232 #define UX_PARAMETER_NOT_USED(p) ((VOID)(p))
233 #endif
234 
235 /* Define additional generic USBX types.  */
236 
237 #ifndef SCHAR
238 typedef signed char               SCHAR;
239 #endif
240 
241 /* If the port file did not define the memory barrier instruction, define it
242    to nothing since this is platform-specific.  */
243 #ifndef UX_DATA_MEMORY_BARRIER
244 #define UX_DATA_MEMORY_BARRIER
245 #endif
246 
247 
248 /* This defines the ASSERT and process on ASSERT fail. */
249 #ifdef UX_ENABLE_ASSERT
250 #ifndef UX_ASSERT_FAIL
251 #ifdef TX_API_H
252 #define UX_ASSERT_FAIL                                      for (;;) {tx_thread_sleep(UX_WAIT_FOREVER); }
253 #else
254 #define UX_ASSERT_FAIL                                      for (;;) {}
255 #endif
256 #endif
257 #define UX_ASSERT(s)                                        if (!(s)) {UX_ASSERT_FAIL}
258 #else
259 #define UX_ASSERT(s)
260 #endif /* UX_ENABLE_ASSERT */
261 
262 
263 /* Convert from millisecond to ThreadX Tick value. */
264 #define UX_MS_TO_TICK(ms)                                  ((ms) * (UX_PERIODIC_RATE) / 1000)
265 #define UX_MS_TO_TICK_NON_ZERO(ms)                         UX_MAX(1, UX_MS_TO_TICK(ms))
266 
267 /* Deprecated, left to be compatible with apps already using MS_TO_TICK.  */
268 #define MS_TO_TICK(ms)                                     UX_MS_TO_TICK(ms)
269 
270 
271 /* If UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE is defined,
272    it define USBX device max number of endpoints (1~n).
273    else max number of endpoints are from scan result.
274    It must be equal to or larger than max number of endpoints
275    can be activated at the same time.  */
276 #ifndef UX_MAX_DEVICE_ENDPOINTS
277 #define UX_MAX_DEVICE_ENDPOINTS                             6
278 #endif
279 
280 /* If UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE is defined,
281    it define USBX device max number of interfacess (1~n).
282    else max number of interfacess are from scan result.
283    It must be equal to or larger than max number of interfaces
284    in a activated configuration.  */
285 #ifndef UX_MAX_DEVICE_INTERFACES
286 #define UX_MAX_DEVICE_INTERFACES                            6
287 #endif
288 
289 
290 /* Define USBX device max bInterfaceNumber of interfaces (0 ~ n),
291    it must be larger than max bInterfaceNumber in USB
292    framework descriptors.  */
293 #ifndef UX_MAX_SLAVE_INTERFACES
294 #define UX_MAX_SLAVE_INTERFACES                             16
295 #endif
296 
297 /* Define USBX max number of classes (1 ~ n).  */
298 #ifndef UX_MAX_CLASSES
299 #define UX_MAX_CLASSES                                      2
300 #endif
301 #ifndef UX_MAX_CLASS_DRIVER
302 #define UX_MAX_CLASS_DRIVER                                 UX_MAX_CLASSES
303 #endif
304 
305 /* Define USBX max number of devices (1 ~ n).  */
306 #ifndef UX_MAX_DEVICES
307 #define UX_MAX_DEVICES                                      4
308 #endif
309 
310 /* Define USBX max number of HCDs (1 ~ n).  */
311 #ifndef UX_MAX_HCD
312 #define UX_MAX_HCD                                          2
313 #endif
314 
315 /* Define USBX max root hub port (1 ~ n).  */
316 #ifndef UX_MAX_ROOTHUB_PORT
317 #define UX_MAX_ROOTHUB_PORT                                 4
318 #endif
319 
320 /* Define USBX max TT.  */
321 #ifndef UX_MAX_TT
322 #define UX_MAX_TT                                           8
323 #endif
324 
325 /* Define USBX Host Enum Thread Stack Size. */
326 #ifndef UX_HOST_ENUM_THREAD_STACK_SIZE
327 #define UX_HOST_ENUM_THREAD_STACK_SIZE                      UX_THREAD_STACK_SIZE
328 #endif
329 
330 /* Define USBX Host Thread Stack Size. */
331 #ifndef UX_HOST_HCD_THREAD_STACK_SIZE
332 #define UX_HOST_HCD_THREAD_STACK_SIZE                       UX_THREAD_STACK_SIZE
333 #endif
334 
335 /* Define USBX Host HNP Polling Thread Stack Size */
336 #ifndef UX_HOST_HNP_POLLING_THREAD_STACK
337 #define UX_HOST_HNP_POLLING_THREAD_STACK                    UX_THREAD_STACK_SIZE
338 #endif
339 
340 /* Define basic constants for the USBX Stack.  */
341 #define AZURE_RTOS_USBX
342 #define USBX_MAJOR_VERSION            6
343 #define USBX_MINOR_VERSION            3
344 #define USBX_PATCH_VERSION            0
345 
346 /* Macros for concatenating tokens, where UX_CONCATn concatenates n tokens.  */
347 
348 #define UX_CONCAT_BASE(x,y)           x ## y
349 #define UX_CONCAT2(s0,s1)             UX_CONCAT_BASE(s0,s1)
350 
351 /* Static assert that can report an error at compile time.  */
352 #define UX_COMPILE_TIME_ASSERT(exp, meaningful_name_as_variable) \
353     typedef char UX_CONCAT2(meaningful_name_as_variable, __LINE__)[!(exp) ? -1 : 1];
354 
355 /* Arithmetic.  */
356 
357 #define UX_MIN(a, b)                  ((a) < (b) ? (a) : (b))
358 #define UX_MAX(a, b)                  ((a) > (b) ? (a) : (b))
359 
360 #define UX_W0(word)                   ( (word)         & 0xFF)
361 #define UX_W1(word)                   (((word)  >>  8) & 0xFF)
362 
363 #define UX_DW0(dword)                 ( (dword)        & 0xFF)
364 #define UX_DW1(dword)                 (((dword) >>  8) & 0xFF)
365 #define UX_DW2(dword)                 (((dword) >> 16) & 0xFF)
366 #define UX_DW3(dword)                 (((dword) >> 24) & 0xFF)
367 
368 /* Safe arithmetic check macros.  */
369 
370 #ifndef UX_DISABLE_ARITHMETIC_CHECK
371 
372 /* Calculate and check if result overflow/underflow.  */
373 
374 #define UX_OVERFLOW_CHECK_ADD_ULONG(a, b)        ((a) > 0xFFFFFFFFul - (b))
375 #define UX_OVERFLOW_CHECK_ADD_USHORT(a, b)       ((a) > 0xFFFFul - (b))
376 #define UX_OVERFLOW_CHECK_ADD_UCHAR(a, b)        ((a) > 0xFFul - (b))
377 
378 #define UX_UNDERFLOW_CHECK_MINUS(a, b)           ((a) < (b))
379 
380 /* Overflow check optimized in case multiplying a 2nd factor of const.  */
381 #define UX_OVERFLOW_CHECK_MULC_ULONG(v, c)       (((c) != 0) && ((v) > 0xFFFFFFFFul / (c)))
382 #define UX_OVERFLOW_CHECK_MULC_USHORT(v, c)      (((c) != 0) && ((v) > 0xFFFFul / (c)))
383 #define UX_OVERFLOW_CHECK_MULC_UCHAR(v, c)       (((c) != 0) && ((v) > 0xFFul / (c)))
384 
385 /* Overflow check optimized in case multiplying factors of variables and division instruction unavailable.  */
386 #define UX_OVERFLOW_CHECK_MULV_ULONG(v, v1)      ((v) * (v1) < UX_MIN(v, v1))
387 #define UX_OVERFLOW_CHECK_MULV_USHORT(v, v1)     ((USHORT)((v) * (v1)) < UX_MIN(v, v1))
388 #define UX_OVERFLOW_CHECK_MULV_UCHAR(v, v1)      ((UCHAR)((v) * (v1)) < UX_MIN(v, v1))
389 
390 #else
391 
392 /* There is no overflow/underflow, always 0 (false).  */
393 
394 #define UX_OVERFLOW_CHECK_ADD_ULONG(a, b)        (0)
395 #define UX_OVERFLOW_CHECK_ADD_USHORT(a, b)       (0)
396 #define UX_OVERFLOW_CHECK_ADD_UCHAR(a, b)        (0)
397 
398 #define UX_OVERFLOW_CHECK_MULC_ULONG(v, c)       (0)
399 #define UX_OVERFLOW_CHECK_MULC_USHORT(v, c)      (0)
400 #define UX_OVERFLOW_CHECK_MULC_UCHAR(v, c)       (0)
401 
402 #define UX_OVERFLOW_CHECK_MULV_ULONG(v, v1)      (0)
403 #define UX_OVERFLOW_CHECK_MULV_USHORT(v, v1)     (0)
404 #define UX_OVERFLOW_CHECK_MULV_UCHAR(v, v1)      (0)
405 #endif
406 
407 /* Define the default extension to hold the control block for 64-bit mode.  */
408 
409 #ifndef UX_THREAD_EXTENSION_PTR_SET
410 #define UX_THREAD_EXTENSION_PTR_SET(a, b)
411 #endif
412 
413 #ifndef UX_THREAD_EXTENSION_PTR_GET
414 #define UX_THREAD_EXTENSION_PTR_GET(a, b, c)            (a) = (b *)(c);
415 #endif
416 
417 #ifndef UX_TIMER_EXTENSION_PTR_SET
418 #define UX_TIMER_EXTENSION_PTR_SET(a, b)
419 #endif
420 
421 #ifndef UX_TIMER_EXTENSION_PTR_GET
422 #define UX_TIMER_EXTENSION_PTR_GET(a, b, c)             (a) = (b *)(c);
423 #endif
424 
425 /* Determine if error log is enabled.  */
426 
427 #ifdef UX_ENABLE_DEBUG_LOG
428 
429 #ifndef UX_DEBUG_LOG_SIZE
430 #define UX_DEBUG_LOG_SIZE                                   (1024 * 32)
431 #endif
432 
433 /* Map the error log macros to internal USBX function.  */
434 
435 #define UX_DEBUG_LOG(debug_location, debug_message, debug_code, debug_parameter_1, debug_parameter_2)  _ux_utility_debug_log((UCHAR *) debug_location, (UCHAR *) debug_message, (ULONG) debug_code, (ULONG) debug_parameter_1, (ULONG) debug_parameter_2);
436 
437 VOID _ux_utility_debug_log(UCHAR *debug_location, UCHAR *debug_message, ULONG debug_code, ULONG debug_parameter_1, ULONG debug_parameter_2);
438 
439 /* DEBUG LOG MESSAGES SHOULD BE WRITTEN LIKE THIS IN THE CODE :    */
440 /* If error log is enabled, insert this error message into the log buffer.  */
441 /* UX_DEBUG_LOG("_ux_host_stack_rh_device_insertion", "Device insertion", port_index, port_index, 0) */
442 
443 
444 #else
445 
446 /* If Log is not defined, map it to nothing so that debug messages can stay in the code.  */
447 #define UX_DEBUG_LOG(debug_location, debug_message, debug_code, debug_parameter_1, debug_parameter_2)
448 #endif
449 
450 /* Determine if tracing is enabled.  */
451 
452 #if defined(TX_ENABLE_EVENT_TRACE) && !defined(UX_STANDALONE)
453 #define UX_ENABLE_EVENT_TRACE
454 #endif
455 
456 #ifdef UX_ENABLE_EVENT_TRACE
457 
458 /* Trace is enabled. Remap calls so that interrupts can be disabled around the actual event logging.  */
459 
460 #include "tx_trace.h"
461 
462 
463 /* Map the trace macros to internal USBX versions so we can get interrupt protection.  */
464 
465 #define UX_TRACE_OBJECT_REGISTER(t,p,n,a,b)                 _ux_trace_object_register(t, (VOID *) p, (CHAR *) n, (ULONG) a, (ULONG) b);
466 #define UX_TRACE_OBJECT_UNREGISTER(o)                       _ux_trace_object_unregister((VOID *) o);
467 #define UX_TRACE_IN_LINE_INSERT(i,a,b,c,d,f,g,h)            _ux_trace_event_insert((ULONG) i, (ULONG) a, (ULONG) b, (ULONG) c, (ULONG) d, (ULONG) f, g, h);
468 #define UX_TRACE_EVENT_UPDATE(e,t,i,a,b,c,d)                _ux_trace_event_update((TX_TRACE_BUFFER_ENTRY *) e, (ULONG) t, (ULONG) i, (ULONG) a, (ULONG) b, (ULONG) c, (ULONG) d);
469 
470 
471 /* Define USBX trace prototypes.  */
472 
473 VOID    _ux_trace_object_register(UCHAR object_type, VOID *object_ptr, CHAR *object_name, ULONG parameter_1, ULONG parameter_2);
474 VOID    _ux_trace_object_unregister(VOID *object_ptr);
475 VOID    _ux_trace_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, TX_TRACE_BUFFER_ENTRY **current_event, ULONG *current_timestamp);
476 VOID    _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4);
477 
478 
479 /* Define USBX event trace constants.  */
480 
481 #define UX_TRACE_OBJECT_TYPE_BASE                                       20
482 #define UX_TRACE_HOST_OBJECT_TYPE_DEVICE                                (UX_TRACE_OBJECT_TYPE_BASE + 1)
483 #define UX_TRACE_HOST_OBJECT_TYPE_INTERFACE                             (UX_TRACE_OBJECT_TYPE_BASE + 2)
484 #define UX_TRACE_HOST_OBJECT_TYPE_ENDPOINT                              (UX_TRACE_OBJECT_TYPE_BASE + 3)
485 #define UX_TRACE_HOST_OBJECT_TYPE_CLASS_INSTANCE                        (UX_TRACE_OBJECT_TYPE_BASE + 4)
486 
487 #define UX_TRACE_DEVICE_OBJECT_TYPE_DEVICE                              (UX_TRACE_OBJECT_TYPE_BASE + 5)
488 #define UX_TRACE_DEVICE_OBJECT_TYPE_INTERFACE                           (UX_TRACE_OBJECT_TYPE_BASE + 6)
489 #define UX_TRACE_DEVICE_OBJECT_TYPE_ENDPOINT                            (UX_TRACE_OBJECT_TYPE_BASE + 7)
490 #define UX_TRACE_DEVICE_OBJECT_TYPE_CLASS_INSTANCE                      (UX_TRACE_OBJECT_TYPE_BASE + 8)
491 
492 /* Define event filters that can be used to selectively disable certain events or groups of events.  */
493 
494 #define UX_TRACE_ALL_EVENTS                                             0x7F000000  /* All USBX events                          */
495 #define UX_TRACE_ERRORS                                                 0x01000000  /* USBX Errors events                       */
496 #define UX_TRACE_HOST_STACK_EVENTS                                      0x02000000  /* USBX Host Class Events                   */
497 #define UX_TRACE_DEVICE_STACK_EVENTS                                    0x04000000  /* USBX Device Class Events                 */
498 #define UX_TRACE_HOST_CONTROLLER_EVENTS                                 0x08000000  /* USBX Host Controller Events              */
499 #define UX_TRACE_DEVICE_CONTROLLER_EVENTS                               0x10000000  /* USBX Device Controllers Events           */
500 #define UX_TRACE_HOST_CLASS_EVENTS                                      0x20000000  /* USBX Host Class Events                   */
501 #define UX_TRACE_DEVICE_CLASS_EVENTS                                    0x40000000  /* USBX Device Class Events                 */
502 
503 
504 /* Define the trace events in USBX, if not defined.  */
505 
506 /* Define the USBX host stack events.  */
507 
508 #define UX_TRACE_HOST_STACK_EVENTS_BASE                                 600
509 #define UX_TRACE_HOST_STACK_CLASS_INSTANCE_CREATE                       (UX_TRACE_HOST_STACK_EVENTS_BASE + 1)               /* I1 = class           , I2 = class instance                                                       */
510 #define UX_TRACE_HOST_STACK_CLASS_INSTANCE_DESTROY                      (UX_TRACE_HOST_STACK_EVENTS_BASE + 2)               /* I1 = class           , I2 = class instance                                                       */
511 #define UX_TRACE_HOST_STACK_CONFIGURATION_DELETE                        (UX_TRACE_HOST_STACK_EVENTS_BASE + 3)               /* I1 = configuration                                                                               */
512 #define UX_TRACE_HOST_STACK_CONFIGURATION_ENUMERATE                     (UX_TRACE_HOST_STACK_EVENTS_BASE + 4)               /* I1 = device                                                                                      */
513 #define UX_TRACE_HOST_STACK_CONFIGURATION_INSTANCE_CREATE               (UX_TRACE_HOST_STACK_EVENTS_BASE + 5)               /* I1 = configuration                                                                               */
514 #define UX_TRACE_HOST_STACK_CONFIGURATION_INSTANCE_DELETE               (UX_TRACE_HOST_STACK_EVENTS_BASE + 6)               /* I1 = configuration                                                                               */
515 #define UX_TRACE_HOST_STACK_CONFIGURATION_SET                           (UX_TRACE_HOST_STACK_EVENTS_BASE + 7)               /* I1 = configuration                                                                               */
516 #define UX_TRACE_HOST_STACK_DEVICE_ADDRESS_SET                          (UX_TRACE_HOST_STACK_EVENTS_BASE + 8)               /* I1 = device          , I2 = device address                                                       */
517 #define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_GET                    (UX_TRACE_HOST_STACK_EVENTS_BASE + 9)               /* I1 = device          , I2 = configuration                                                        */
518 #define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_SELECT                 (UX_TRACE_HOST_STACK_EVENTS_BASE + 10)              /* I1 = device          , I2 = configuration                                                        */
519 #define UX_TRACE_HOST_STACK_DEVICE_DESCRIPTOR_READ                      (UX_TRACE_HOST_STACK_EVENTS_BASE + 11)              /* I1 = device                                                                                      */
520 #define UX_TRACE_HOST_STACK_DEVICE_GET                                  (UX_TRACE_HOST_STACK_EVENTS_BASE + 12)              /* I1 = device index                                                                                */
521 #define UX_TRACE_HOST_STACK_DEVICE_REMOVE                               (UX_TRACE_HOST_STACK_EVENTS_BASE + 13)              /* I1 = hcd             , I2 = parent          , I3 = port index        , I4 = device               */
522 #define UX_TRACE_HOST_STACK_DEVICE_RESOURCE_FREE                        (UX_TRACE_HOST_STACK_EVENTS_BASE + 14)              /* I1 = device                                                                                      */
523 #define UX_TRACE_HOST_STACK_ENDPOINT_INSTANCE_CREATE                    (UX_TRACE_HOST_STACK_EVENTS_BASE + 15)              /* I1 = device          , I2 = endpoint                                                             */
524 #define UX_TRACE_HOST_STACK_ENDPOINT_INSTANCE_DELETE                    (UX_TRACE_HOST_STACK_EVENTS_BASE + 16)              /* I1 = device          , I2 = endpoint                                                             */
525 #define UX_TRACE_HOST_STACK_ENDPOINT_RESET                              (UX_TRACE_HOST_STACK_EVENTS_BASE + 17)              /* I1 = device          , I2 = endpoint                                                             */
526 #define UX_TRACE_HOST_STACK_ENDPOINT_TRANSFER_ABORT                     (UX_TRACE_HOST_STACK_EVENTS_BASE + 18)              /* I1 = endpoint                                                                                    */
527 #define UX_TRACE_HOST_STACK_HCD_REGISTER                                (UX_TRACE_HOST_STACK_EVENTS_BASE + 19)              /* I1 = hcd name        , I2 = parameter 1     , I3 = parameter 2                                   */
528 #define UX_TRACE_HOST_STACK_INITIALIZE                                  (UX_TRACE_HOST_STACK_EVENTS_BASE + 20)              /*                                                                                                  */
529 #define UX_TRACE_HOST_STACK_INTERFACE_ENDPOINT_GET                      (UX_TRACE_HOST_STACK_EVENTS_BASE + 21)              /* I1 = interface       , I2 = endpoint index                                                       */
530 #define UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_CREATE                   (UX_TRACE_HOST_STACK_EVENTS_BASE + 22)              /* I1 = interface                                                                                   */
531 #define UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_DELETE                   (UX_TRACE_HOST_STACK_EVENTS_BASE + 23)              /* I1 = interface                                                                                   */
532 #define UX_TRACE_HOST_STACK_INTERFACE_SET                               (UX_TRACE_HOST_STACK_EVENTS_BASE + 24)              /* I1 = interface                                                                                   */
533 #define UX_TRACE_HOST_STACK_INTERFACE_SETTING_SELECT                    (UX_TRACE_HOST_STACK_EVENTS_BASE + 25)              /* I1 = interface                                                                                   */
534 #define UX_TRACE_HOST_STACK_NEW_CONFIGURATION_CREATE                    (UX_TRACE_HOST_STACK_EVENTS_BASE + 26)              /* I1 = device          , I2 = configuration                                                        */
535 #define UX_TRACE_HOST_STACK_NEW_DEVICE_CREATE                           (UX_TRACE_HOST_STACK_EVENTS_BASE + 27)              /* I1 = hcd             , I2 = device owner    , I3 = port index        , I4 = device               */
536 #define UX_TRACE_HOST_STACK_NEW_ENDPOINT_CREATE                         (UX_TRACE_HOST_STACK_EVENTS_BASE + 28)              /* I1 = interface       , I2 = endpoint                                                             */
537 #define UX_TRACE_HOST_STACK_RH_CHANGE_PROCESS                           (UX_TRACE_HOST_STACK_EVENTS_BASE + 29)              /* I1 = port index                                                                                  */
538 #define UX_TRACE_HOST_STACK_RH_DEVICE_EXTRACTION                        (UX_TRACE_HOST_STACK_EVENTS_BASE + 30)              /* I1 = hcd             , I2 = port index                                                           */
539 #define UX_TRACE_HOST_STACK_RH_DEVICE_INSERTION                         (UX_TRACE_HOST_STACK_EVENTS_BASE + 31)              /* I1 = hcd             , I2 = port index                                                           */
540 #define UX_TRACE_HOST_STACK_TRANSFER_REQUEST                            (UX_TRACE_HOST_STACK_EVENTS_BASE + 32)              /* I1 = device          , I2 = endpoint        , I3 = transfer request                              */
541 #define UX_TRACE_HOST_STACK_TRANSFER_REQUEST_ABORT                      (UX_TRACE_HOST_STACK_EVENTS_BASE + 33)              /* I1 = device          , I2 = endpoint        , I3 = transfer request                              */
542 #define UX_TRACE_HOST_STACK_UNINITIALIZE                                (UX_TRACE_HOST_STACK_EVENTS_BASE + 34)              /*                                                                                                  */
543 #define UX_TRACE_HOST_STACK_HCD_UNREGISTER                              (UX_TRACE_HOST_STACK_EVENTS_BASE + 35)              /* I1 = hcd name        , I2 = parameter 1     , I3 = parameter 2                                   */
544 #define UX_TRACE_HOST_STACK_CLASS_REGISTER                              (UX_TRACE_HOST_STACK_EVENTS_BASE + 36)              /* I1 = class name      , I2 = entry function                                                       */
545 #define UX_TRACE_HOST_STACK_CLASS_UNREGISTER                            (UX_TRACE_HOST_STACK_EVENTS_BASE + 37)              /* I1 = class entry                                                                                 */
546 #define UX_TRACE_HOST_STACK_DEVICE_STRING_GET                           (UX_TRACE_HOST_STACK_EVENTS_BASE + 38)              /* I1 = device          , I2 = buffer          , I3 = length            , I4 = (langID<<16) | index */
547 #define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_ACTIVATE               (UX_TRACE_HOST_STACK_EVENTS_BASE + 39)              /* I1 = device          , I2 = configuration                                                        */
548 #define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_DEACTIVATE             (UX_TRACE_HOST_STACK_EVENTS_BASE + 40)              /* I1 = device          , I2 = configuration                                                        */
549 
550 /* Define the USBX host class events.  */
551 
552 #define UX_TRACE_HOST_CLASS_EVENTS_BASE                                 650
553 #define UX_TRACE_HOST_CLASS_ASIX_ACTIVATE                               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 1)               /* I1 = class instance                                                                              */
554 #define UX_TRACE_HOST_CLASS_ASIX_DEACTIVATE                             (UX_TRACE_HOST_CLASS_EVENTS_BASE + 2)               /* I1 = class instance                                                                              */
555 #define UX_TRACE_HOST_CLASS_ASIX_INTERRUPT_NOTIFICATION                 (UX_TRACE_HOST_CLASS_EVENTS_BASE + 3)               /* I1 = class instance                                                                              */
556 #define UX_TRACE_HOST_CLASS_ASIX_READ                                   (UX_TRACE_HOST_CLASS_EVENTS_BASE + 4)               /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
557 #define UX_TRACE_HOST_CLASS_ASIX_WRITE                                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 5)               /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
558 
559 #define UX_TRACE_HOST_CLASS_AUDIO_ACTIVATE                              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 10)              /* I1 = class instance                                                                              */
560 #define UX_TRACE_HOST_CLASS_AUDIO_CONTROL_VALUE_GET                     (UX_TRACE_HOST_CLASS_EVENTS_BASE + 11)              /* I1 = class instance                                                                              */
561 #define UX_TRACE_HOST_CLASS_AUDIO_CONTROL_VALUE_SET                     (UX_TRACE_HOST_CLASS_EVENTS_BASE + 12)              /* I1 = class instance  , I2 = audio control                                                        */
562 #define UX_TRACE_HOST_CLASS_AUDIO_DEACTIVATE                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 13)              /* I1 = class instance                                                                              */
563 #define UX_TRACE_HOST_CLASS_AUDIO_READ                                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 14)              /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
564 #define UX_TRACE_HOST_CLASS_AUDIO_STREAMING_SAMPLING_GET                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 15)              /* I1 = class instance                                                                              */
565 #define UX_TRACE_HOST_CLASS_AUDIO_STREAMING_SAMPLING_SET                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 16)              /* I1 = class instance  , I2 = audio sampling                                                       */
566 #define UX_TRACE_HOST_CLASS_AUDIO_WRITE                                 (UX_TRACE_HOST_CLASS_EVENTS_BASE + 17)              /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
567 
568 #define UX_TRACE_HOST_CLASS_CDC_ACM_ACTIVATE                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 20)              /* I1 = class instance                                                                              */
569 #define UX_TRACE_HOST_CLASS_CDC_ACM_DEACTIVATE                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 21)              /* I1 = class instance                                                                              */
570 #define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_CODING               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 22)              /* I1 = class instance  , I2 = parameter                                                            */
571 #define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_GET_LINE_CODING               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 23)              /* I1 = class instance  , I2 = parameter                                                            */
572 #define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_STATE                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 24)              /* I1 = class instance  , I2 = parameter                                                            */
573 #define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SEND_BREAK                    (UX_TRACE_HOST_CLASS_EVENTS_BASE + 25)              /* I1 = class instance  , I2 = parameter                                                            */
574 #define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_ABORT_IN_PIPE                 (UX_TRACE_HOST_CLASS_EVENTS_BASE + 26)              /* I1 = class instance  , I2 = endpoint                                                             */
575 #define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_ABORT_OUT_PIPE                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 27)              /* I1 = class instance  , I2 = endpointr                                                            */
576 #define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_NOTIFICATION_CALLBACK         (UX_TRACE_HOST_CLASS_EVENTS_BASE + 28)              /* I1 = class instance  , I2 = parameter                                                            */
577 #define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_GET_DEVICE_STATUS             (UX_TRACE_HOST_CLASS_EVENTS_BASE + 29)              /* I1 = class instance  , I2 = device status                                                        */
578 #define UX_TRACE_HOST_CLASS_CDC_ACM_READ                                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 30)              /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
579 #define UX_TRACE_HOST_CLASS_CDC_ACM_RECEPTION_START                     (UX_TRACE_HOST_CLASS_EVENTS_BASE + 31)              /* I1 = class instance                                                                              */
580 #define UX_TRACE_HOST_CLASS_CDC_ACM_RECEPTION_STOP                      (UX_TRACE_HOST_CLASS_EVENTS_BASE + 32)              /* I1 = class instance                                                                              */
581 #define UX_TRACE_HOST_CLASS_CDC_ACM_WRITE                               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 33)              /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
582 
583 #define UX_TRACE_HOST_CLASS_CDC_ECM_ACTIVATE                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 35)              /* I1 = class instance                                                                              */
584 #define UX_TRACE_HOST_CLASS_CDC_ECM_DEACTIVATE                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 36)              /* I1 = class instance                                                                              */
585 #define UX_TRACE_HOST_CLASS_CDC_ECM_READ                                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 37)              /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
586 #define UX_TRACE_HOST_CLASS_CDC_ECM_WRITE                               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 38)              /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
587 #define UX_TRACE_HOST_CLASS_CDC_ECM_INTERRUPT_NOTIFICATION              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 39)              /* I1 = class instance                                                                              */
588 
589 #define UX_TRACE_HOST_CLASS_HID_ACTIVATE                                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 40)              /* I1 = class instance                                                                              */
590 #define UX_TRACE_HOST_CLASS_HID_CLIENT_REGISTER                         (UX_TRACE_HOST_CLASS_EVENTS_BASE + 41)              /* I1 = hid client name                                                                             */
591 #define UX_TRACE_HOST_CLASS_HID_DEACTIVATE                              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 42)              /* I1 = class instance                                                                              */
592 #define UX_TRACE_HOST_CLASS_HID_IDLE_GET                                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 43)              /* I1 = class instance                                                                              */
593 #define UX_TRACE_HOST_CLASS_HID_IDLE_SET                                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 44)              /* I1 = class instance                                                                              */
594 #define UX_TRACE_HOST_CLASS_HID_KEYBOARD_ACTIVATE                       (UX_TRACE_HOST_CLASS_EVENTS_BASE + 45)              /* I1 = class instance  , I2 = hid client instance                                                  */
595 #define UX_TRACE_HOST_CLASS_HID_KEYBOARD_DEACTIVATE                     (UX_TRACE_HOST_CLASS_EVENTS_BASE + 46)              /* I1 = class instance  , I2 = hid client instance                                                  */
596 #define UX_TRACE_HOST_CLASS_HID_MOUSE_ACTIVATE                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 47)              /* I1 = class instance  , I2 = hid client instance                                                  */
597 #define UX_TRACE_HOST_CLASS_HID_MOUSE_DEACTIVATE                        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 48)              /* I1 = class instance  , I2 = hid client instance                                                  */
598 #define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_ACTIVATE                 (UX_TRACE_HOST_CLASS_EVENTS_BASE + 49)              /* I1 = class instance  , I2 = hid client instance                                                  */
599 #define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_DEACTIVATE               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 50)              /* I1 = class instance  , I2 = hid client instance                                                  */
600 #define UX_TRACE_HOST_CLASS_HID_REPORT_GET                              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 51)              /* I1 = class instance  , I2 = client report                                                        */
601 #define UX_TRACE_HOST_CLASS_HID_REPORT_SET                              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 52)              /* I1 = class instance  , I2 = client report                                                        */
602 #define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_CALLBACK                 (UX_TRACE_HOST_CLASS_EVENTS_BASE + 53)              /* I1 = client instance , I2 = remote control instance                                              */
603 
604 #define UX_TRACE_HOST_CLASS_HUB_ACTIVATE                                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 60)              /* I1 = class instance                                                                              */
605 #define UX_TRACE_HOST_CLASS_HUB_CHANGE_DETECT                           (UX_TRACE_HOST_CLASS_EVENTS_BASE + 62)              /* I1 = class instance                                                                              */
606 #define UX_TRACE_HOST_CLASS_HUB_PORT_CHANGE_CONNECTION_PROCESS          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 63)              /* I1 = class instance  , I2 = port            , I3 = port status                                   */
607 #define UX_TRACE_HOST_CLASS_HUB_PORT_CHANGE_ENABLE_PROCESS              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 64)              /* I1 = class instance  , I2 = port            , I3 = port status                                   */
608 #define UX_TRACE_HOST_CLASS_HUB_PORT_CHANGE_OVER_CURRENT_PROCESS        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 65)              /* I1 = class instance  , I2 = port            , I3 = port status                                   */
609 #define UX_TRACE_HOST_CLASS_HUB_PORT_CHANGE_RESET_PROCESS               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 66)              /* I1 = class instance  , I2 = port            , I3 = port status                                   */
610 #define UX_TRACE_HOST_CLASS_HUB_PORT_CHANGE_SUSPEND_PROCESS             (UX_TRACE_HOST_CLASS_EVENTS_BASE + 67)              /* I1 = class instance  , I2 = port            , I3 = port status                                   */
611 #define UX_TRACE_HOST_CLASS_HUB_DEACTIVATE                              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 68)              /* I1 = class instance                                                                              */
612 
613 #define UX_TRACE_HOST_CLASS_PIMA_ACTIVATE                               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 70)              /* I1 = class instance                                                                              */
614 #define UX_TRACE_HOST_CLASS_PIMA_DEACTIVATE                             (UX_TRACE_HOST_CLASS_EVENTS_BASE + 71)              /* I1 = class instance                                                                              */
615 #define UX_TRACE_HOST_CLASS_PIMA_DEVICE_INFO_GET                        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 72)              /* I1 = class instance  , I2 = pima device                                                          */
616 #define UX_TRACE_HOST_CLASS_PIMA_DEVICE_RESET                           (UX_TRACE_HOST_CLASS_EVENTS_BASE + 73)              /* I1 = class instance                                                                              */
617 #define UX_TRACE_HOST_CLASS_PIMA_NOTIFICATION                           (UX_TRACE_HOST_CLASS_EVENTS_BASE + 74)              /* I1 = class instance  , I2 = event code      , I3 = transaction ID    , I4 = parameter1           */
618 #define UX_TRACE_HOST_CLASS_PIMA_NUM_OBJECTS_GET                        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 75)              /* I1 = class instance                                                                              */
619 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_CLOSE                           (UX_TRACE_HOST_CLASS_EVENTS_BASE + 76)              /* I1 = class instance  , I2 = object                                                               */
620 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_COPY                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 77)              /* I1 = class instance  , I2 = object handle                                                        */
621 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_DELETE                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 78)              /* I1 = class instance  , I2 = object handle                                                        */
622 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_GET                             (UX_TRACE_HOST_CLASS_EVENTS_BASE + 79)              /* I1 = class instance  , I2 = object handle   , I3 = object                                        */
623 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_INFO_GET                        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 80)              /* I1 = class instance  , I2 = object handle   , I3 = object                                        */
624 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_INFO_SEND                       (UX_TRACE_HOST_CLASS_EVENTS_BASE + 81)              /* I1 = class instance  , I2 = object                                                               */
625 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_MOVE                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 82)              /* I1 = class instance  , I2 = object handle                                                        */
626 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_SEND                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 83)              /* I1 = class instance  , I2 = object          , I3 = object_buffer     , I4 = object length        */
627 #define UX_TRACE_HOST_CLASS_PIMA_OBJECT_TRANSFER_ABORT                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 84)              /* I1 = class instance  , I2 = object handle   , I3 = object                                        */
628 #define UX_TRACE_HOST_CLASS_PIMA_READ                                   (UX_TRACE_HOST_CLASS_EVENTS_BASE + 85)              /* I1 = class instance  , I2 = data pointer    , I3 = data length                                   */
629 #define UX_TRACE_HOST_CLASS_PIMA_REQUEST_CANCEL                         (UX_TRACE_HOST_CLASS_EVENTS_BASE + 86)              /* I1 = class instance                                                                              */
630 #define UX_TRACE_HOST_CLASS_PIMA_SESSION_CLOSE                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 87)              /* I1 = class instance  , I2 = pima session                                                         */
631 #define UX_TRACE_HOST_CLASS_PIMA_SESSION_OPEN                           (UX_TRACE_HOST_CLASS_EVENTS_BASE + 88)              /* I1 = class instance  , I2 = pima session                                                         */
632 #define UX_TRACE_HOST_CLASS_PIMA_STORAGE_IDS_GET                        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 89)              /* I1 = class instance  , I2 = storage ID array, I3 = storage ID length                             */
633 #define UX_TRACE_HOST_CLASS_PIMA_STORAGE_INFO_GET                       (UX_TRACE_HOST_CLASS_EVENTS_BASE + 90)              /* I1 = class instance  , I2 = storage ID      , I3 = storage                                       */
634 #define UX_TRACE_HOST_CLASS_PIMA_THUMB_GET                              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 91)              /* I1 = class instance  , I2 = object handle                                                        */
635 #define UX_TRACE_HOST_CLASS_PIMA_WRITE                                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 92)              /* I1 = class instance  , I2 = data pointer    , I3 = data length                                   */
636 
637 #define UX_TRACE_HOST_CLASS_PRINTER_ACTIVATE                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 100)             /* I1 = class instance                                                                              */
638 #define UX_TRACE_HOST_CLASS_PRINTER_DEACTIVATE                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 101)             /* I1 = class instance                                                                              */
639 #define UX_TRACE_HOST_CLASS_PRINTER_NAME_GET                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 102)             /* I1 = class instance                                                                              */
640 #define UX_TRACE_HOST_CLASS_PRINTER_READ                                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 103)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
641 #define UX_TRACE_HOST_CLASS_PRINTER_WRITE                               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 104)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
642 #define UX_TRACE_HOST_CLASS_PRINTER_SOFT_RESET                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 105)             /* I1 = class instance                                                                              */
643 #define UX_TRACE_HOST_CLASS_PRINTER_STATUS_GET                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 106)             /* I1 = class instance  , I2 = printer status                                                       */
644 #define UX_TRACE_HOST_CLASS_PRINTER_DEVICE_ID_GET                       (UX_TRACE_HOST_CLASS_EVENTS_BASE + 107)             /* I1 = class instance  , I2 = printer         , I3 = data pointer      , I4 = buffer length        */
645 
646 #define UX_TRACE_HOST_CLASS_PROLIFIC_ACTIVATE                           (UX_TRACE_HOST_CLASS_EVENTS_BASE + 110)             /* I1 = class instance                                                                              */
647 #define UX_TRACE_HOST_CLASS_PROLIFIC_DEACTIVATE                         (UX_TRACE_HOST_CLASS_EVENTS_BASE + 111)             /* I1 = class instance                                                                              */
648 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_CODING              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 112)             /* I1 = class instance  , I2 = parameter                                                            */
649 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_GET_LINE_CODING              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 113)             /* I1 = class instance  , I2 = parameter                                                            */
650 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_STATE               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 114)             /* I1 = class instance  , I2 = parameter                                                            */
651 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_PURGE                        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 115)             /* I1 = class instance  , I2 = parameter                                                            */
652 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SEND_BREAK                   (UX_TRACE_HOST_CLASS_EVENTS_BASE + 116)             /* I1 = class instance                                                                              */
653 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_ABORT_IN_PIPE                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 117)             /* I1 = class instance  , I2 = endpoint                                                             */
654 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_ABORT_OUT_PIPE               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 118)             /* I1 = class instance  , I2 = endpointr                                                            */
655 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_REPORT_DEVICE_STATUS_CHANGE  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 119)             /* I1 = class instance  , I2 = parameter                                                            */
656 #define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_GET_DEVICE_STATUS            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 120)             /* I1 = class instance  , I2 = device status                                                        */
657 #define UX_TRACE_HOST_CLASS_PROLIFIC_READ                               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 121)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
658 #define UX_TRACE_HOST_CLASS_PROLIFIC_RECEPTION_START                    (UX_TRACE_HOST_CLASS_EVENTS_BASE + 122)             /* I1 = class instance                                                                              */
659 #define UX_TRACE_HOST_CLASS_PROLIFIC_RECEPTION_STOP                     (UX_TRACE_HOST_CLASS_EVENTS_BASE + 123)             /* I1 = class instance                                                                              */
660 #define UX_TRACE_HOST_CLASS_PROLIFIC_WRITE                              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 124)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
661 
662 #define UX_TRACE_HOST_CLASS_STORAGE_ACTIVATE                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 130)             /* I1 = class instance                                                                              */
663 #define UX_TRACE_HOST_CLASS_STORAGE_DEACTIVATE                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 131)             /* I1 = class instance                                                                              */
664 #define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_CAPACITY_GET                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 132)             /* I1 = class instance                                                                              */
665 #define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_FORMAT_CAPACITY_GET           (UX_TRACE_HOST_CLASS_EVENTS_BASE + 133)             /* I1 = class instance                                                                              */
666 #define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_MOUNT                         (UX_TRACE_HOST_CLASS_EVENTS_BASE + 134)             /* I1 = class instance  , I2 = sector                                                               */
667 #define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_OPEN                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 135)             /* I1 = class instance  , I2 = media                                                                */
668 #define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_READ                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 136)             /* I1 = class instance  , I2 = sector start    , I3 = sector count      , I4 = data pointer         */
669 #define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_WRITE                         (UX_TRACE_HOST_CLASS_EVENTS_BASE + 137)             /* I1 = class instance  , I2 = sector start    , I3 = sector count      , I4 = data pointer         */
670 #define UX_TRACE_HOST_CLASS_STORAGE_REQUEST_SENSE                       (UX_TRACE_HOST_CLASS_EVENTS_BASE + 138)             /* I1 = class instance                                                                              */
671 #define UX_TRACE_HOST_CLASS_STORAGE_START_STOP                          (UX_TRACE_HOST_CLASS_EVENTS_BASE + 139)             /* I1 = class instance  , I2 = start stop signal                                                    */
672 #define UX_TRACE_HOST_CLASS_STORAGE_UNIT_READY_TEST                     (UX_TRACE_HOST_CLASS_EVENTS_BASE + 140)             /* I1 = class instance                                                                              */
673 
674 #define UX_TRACE_HOST_CLASS_DPUMP_ACTIVATE                              (UX_TRACE_HOST_CLASS_EVENTS_BASE + 150)             /* I1 = class instance                                                                              */
675 #define UX_TRACE_HOST_CLASS_DPUMP_DEACTIVATE                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 151)             /* I1 = class instance                                                                              */
676 #define UX_TRACE_HOST_CLASS_DPUMP_READ                                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 152)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
677 #define UX_TRACE_HOST_CLASS_DPUMP_WRITE                                 (UX_TRACE_HOST_CLASS_EVENTS_BASE + 153)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
678 
679 #define UX_TRACE_HOST_CLASS_SWAR_ACTIVATE                               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 160)              /* I1 = class instance                                                                              */
680 #define UX_TRACE_HOST_CLASS_SWAR_DEACTIVATE                             (UX_TRACE_HOST_CLASS_EVENTS_BASE + 161)              /* I1 = class instance                                                                              */
681 #define UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_IN_PIPE                    (UX_TRACE_HOST_CLASS_EVENTS_BASE + 162)              /* I1 = class instance  , I2 = endpoint                                                             */
682 #define UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_OUT_PIPE                   (UX_TRACE_HOST_CLASS_EVENTS_BASE + 163)              /* I1 = class instance  , I2 = endpointr                                                            */
683 #define UX_TRACE_HOST_CLASS_SWAR_READ                                   (UX_TRACE_HOST_CLASS_EVENTS_BASE + 164)              /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
684 #define UX_TRACE_HOST_CLASS_SWAR_RECEPTION_START                        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 165)              /* I1 = class instance                                                                              */
685 #define UX_TRACE_HOST_CLASS_SWAR_RECEPTION_STOP                         (UX_TRACE_HOST_CLASS_EVENTS_BASE + 166)              /* I1 = class instance                                                                              */
686 #define UX_TRACE_HOST_CLASS_SWAR_WRITE                                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 167)              /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
687 
688 #define UX_TRACE_HOST_CLASS_GSER_ACTIVATE                               (UX_TRACE_HOST_CLASS_EVENTS_BASE + 170)             /* I1 = class instance                                                                              */
689 #define UX_TRACE_HOST_CLASS_GSER_DEACTIVATE                             (UX_TRACE_HOST_CLASS_EVENTS_BASE + 171)             /* I1 = class instance                                                                              */
690 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_SET_LINE_CODING                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 172)             /* I1 = class instance  , I2 = parameter                                                            */
691 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_GET_LINE_CODING                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 173)             /* I1 = class instance  , I2 = parameter                                                            */
692 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_SET_LINE_STATE                   (UX_TRACE_HOST_CLASS_EVENTS_BASE + 174)             /* I1 = class instance  , I2 = parameter                                                            */
693 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_PURGE                            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 175)             /* I1 = class instance  , I2 = parameter                                                            */
694 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_SEND_BREAK                       (UX_TRACE_HOST_CLASS_EVENTS_BASE + 176)             /* I1 = class instance                                                                              */
695 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_ABORT_IN_PIPE                    (UX_TRACE_HOST_CLASS_EVENTS_BASE + 177)             /* I1 = class instance  , I2 = endpoint                                                             */
696 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_ABORT_OUT_PIPE                   (UX_TRACE_HOST_CLASS_EVENTS_BASE + 178)             /* I1 = class instance  , I2 = endpointr                                                            */
697 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_REPORT_DEVICE_STATUS_CHANGE      (UX_TRACE_HOST_CLASS_EVENTS_BASE + 179)             /* I1 = class instance  , I2 = parameter                                                            */
698 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_GET_DEVICE_STATUS                (UX_TRACE_HOST_CLASS_EVENTS_BASE + 180)             /* I1 = class instance  , I2 = device status                                                        */
699 #define UX_TRACE_HOST_CLASS_GSER_IOCTL_NOTIFICATION_CALLBACK            (UX_TRACE_HOST_CLASS_EVENTS_BASE + 181)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
700 #define UX_TRACE_HOST_CLASS_GSER_READ                                   (UX_TRACE_HOST_CLASS_EVENTS_BASE + 182)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
701 #define UX_TRACE_HOST_CLASS_GSER_RECEPTION_START                        (UX_TRACE_HOST_CLASS_EVENTS_BASE + 183)             /* I1 = class instance                                                                              */
702 #define UX_TRACE_HOST_CLASS_GSER_RECEPTION_STOP                         (UX_TRACE_HOST_CLASS_EVENTS_BASE + 184)             /* I1 = class instance                                                                              */
703 #define UX_TRACE_HOST_CLASS_GSER_WRITE                                  (UX_TRACE_HOST_CLASS_EVENTS_BASE + 185)             /* I1 = class instance  , I2 = data pointer    , I3 = requested length                              */
704 
705 /* Define the USBX device stack events.  */
706 
707 #define UX_TRACE_DEVICE_STACK_EVENTS_BASE                               850
708 #define UX_TRACE_DEVICE_STACK_ALTERNATE_SETTING_GET                     (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 1)             /* I1 = interface value                                                                             */
709 #define UX_TRACE_DEVICE_STACK_ALTERNATE_SETTING_SET                     (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 2)             /* I1 = interface value , I2 = alternate setting value                                              */
710 #define UX_TRACE_DEVICE_STACK_CLASS_REGISTER                            (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 3)             /* I1 = class name      , I2 = interface number, I3 = parameter                                     */
711 #define UX_TRACE_DEVICE_STACK_CLEAR_FEATURE                             (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 4)             /* I1 = request type    , I2 = request value   , I3 = request index                                 */
712 #define UX_TRACE_DEVICE_STACK_CONFIGURATION_GET                         (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 5)             /* I1 = configuration value                                                                         */
713 #define UX_TRACE_DEVICE_STACK_CONFIGURATION_SET                         (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 6)             /* I1 = configuration value                                                                         */
714 #define UX_TRACE_DEVICE_STACK_CONNECT                                   (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 7)             /*                                                                                                  */
715 #define UX_TRACE_DEVICE_STACK_DESCRIPTOR_SEND                           (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 8)             /* I1 = descriptor type , I2 = request index                                                        */
716 #define UX_TRACE_DEVICE_STACK_DISCONNECT                                (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 9)             /* I1 = device                                                                                      */
717 #define UX_TRACE_DEVICE_STACK_ENDPOINT_STALL                            (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 10)            /* I1 = endpoint                                                                                    */
718 #define UX_TRACE_DEVICE_STACK_GET_STATUS                                (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 11)            /* I1 = request type    , I2 = request value   , I3 = request index                                 */
719 #define UX_TRACE_DEVICE_STACK_HOST_WAKEUP                               (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 12)            /*                                                                                                  */
720 #define UX_TRACE_DEVICE_STACK_INITIALIZE                                (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 13)            /*                                                                                                  */
721 #define UX_TRACE_DEVICE_STACK_INTERFACE_DELETE                          (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 14)            /* I1 = interface                                                                                   */
722 #define UX_TRACE_DEVICE_STACK_INTERFACE_GET                             (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 15)            /* I1 = interface value                                                                             */
723 #define UX_TRACE_DEVICE_STACK_INTERFACE_SET                             (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 16)            /* I1 = alternate setting value                                                                     */
724 #define UX_TRACE_DEVICE_STACK_SET_FEATURE                               (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 17)            /* I1 = request value   , I2 = request index                                                        */
725 #define UX_TRACE_DEVICE_STACK_TRANSFER_ABORT                            (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 18)            /* I1 = transfer request, I2 = completion code                                                      */
726 #define UX_TRACE_DEVICE_STACK_TRANSFER_ALL_REQUEST_ABORT                (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 19)            /* I1 = endpoint        , I2 = completion code                                                      */
727 #define UX_TRACE_DEVICE_STACK_TRANSFER_REQUEST                          (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 20)            /* I1 = transfer request                                                                            */
728 #define UX_TRACE_DEVICE_STACK_MICROSOFT_EXTENSION_REGISTER              (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 21)            /* I1 = transfer request                                                                            */
729 #define UX_TRACE_DEVICE_STACK_CLASS_UNREGISTER                          (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 22)            /* I1 = class name                                                                                  */
730 
731 /* Define the USBX device stack events first.  */
732 
733 #define UX_TRACE_DEVICE_CLASS_EVENTS_BASE                               900
734 #define UX_TRACE_DEVICE_CLASS_DPUMP_ACTIVATE                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 1)             /* I1 = class instance                                                                              */
735 #define UX_TRACE_DEVICE_CLASS_DPUMP_DEACTIVATE                          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 2)             /* I1 = class instance                                                                              */
736 #define UX_TRACE_DEVICE_CLASS_DPUMP_READ                                (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 3)             /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
737 #define UX_TRACE_DEVICE_CLASS_DPUMP_WRITE                               (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 4)             /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
738 #define UX_TRACE_DEVICE_CLASS_DPUMP_CHANGE                              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 5)             /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
739 
740 #define UX_TRACE_DEVICE_CLASS_CDC_ACM_ACTIVATE                          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 10)            /* I1 = class instance                                                                              */
741 #define UX_TRACE_DEVICE_CLASS_CDC_ACM_DEACTIVATE                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 11)            /* I1 = class instance                                                                              */
742 #define UX_TRACE_DEVICE_CLASS_CDC_ACM_READ                              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 12)            /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
743 #define UX_TRACE_DEVICE_CLASS_CDC_ACM_WRITE                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 13)            /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
744 
745 #define UX_TRACE_DEVICE_CLASS_HID_ACTIVATE                              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 20)            /* I1 = class instance                                                                              */
746 #define UX_TRACE_DEVICE_CLASS_HID_DEACTIVATE                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 21)            /* I1 = class instance                                                                              */
747 #define UX_TRACE_DEVICE_CLASS_HID_EVENT_GET                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 22)            /* I1 = class instance  , I2 = hid event                                                            */
748 #define UX_TRACE_DEVICE_CLASS_HID_EVENT_SET                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 23)            /* I1 = class instance  , I2 = hid event                                                            */
749 #define UX_TRACE_DEVICE_CLASS_HID_REPORT_GET                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 24)            /* I1 = class instance  , I2 = descriptor type , I3 = request index                                 */
750 #define UX_TRACE_DEVICE_CLASS_HID_REPORT_SET                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 25)            /* I1 = class instance  , I2 = descriptor type , I3 = request index                                 */
751 #define UX_TRACE_DEVICE_CLASS_HID_DESCRIPTOR_SEND                       (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 26)            /* I1 = class instance  , I2 = descriptor type , I3 = request index                                 */
752 #define UX_TRACE_DEVICE_CLASS_HID_READ                                  (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 27)            /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
753 #define UX_TRACE_DEVICE_CLASS_HID_RECEIVER_EVENT_GET                    (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 28)            /* I1 = class instance  , I2 = receiver event  , I3 = wait_option                                   */
754 #define UX_TRACE_DEVICE_CLASS_HID_RECEIVER_EVENT_FREE                   (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 29)            /* I1 = class instance  , I2 = receiver event                                                       */
755 
756 #define UX_TRACE_DEVICE_CLASS_PIMA_ACTIVATE                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 30)            /* I1 = class instance                                                                              */
757 #define UX_TRACE_DEVICE_CLASS_PIMA_DEACTIVATE                           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 31)            /* I1 = class instance                                                                              */
758 #define UX_TRACE_DEVICE_CLASS_PIMA_DEVICE_INFO_SEND                     (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 32)            /* I1 = class instance                                                                              */
759 #define UX_TRACE_DEVICE_CLASS_PIMA_EVENT_GET                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 33)            /* I1 = class instance  , I2 = pima event                                                           */
760 #define UX_TRACE_DEVICE_CLASS_PIMA_EVENT_SET                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 34)            /* I1 = class instance  , I2 = pima event                                                           */
761 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_ADD                           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 35)            /* I1 = class instance  , I2 = object handle                                                        */
762 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_DATA_GET                      (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 36)            /* I1 = class instance  , I2 = object handle                                                        */
763 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_DATA_SEND                     (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 37)            /* I1 = class instance  , I2 = object handle                                                        */
764 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_DELETE                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 38)            /* I1 = class instance  , I2 = object handle                                                        */
765 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_HANDLES_SEND                  (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 39)            /* I1 = class instance  , I2 = storage id      , I3 = object format code, I4 = object association   */
766 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_INFO_GET                      (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 40)            /* I1 = class instance  , I2 = object handle                                                        */
767 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_INFO_SEND                     (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 41)            /* I1 = class instance                                                                              */
768 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECTS_NUMBER_SEND                  (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 42)            /* I1 = class instance  , I2 = storage id      , I3 = object format code, I4 = object association   */
769 #define UX_TRACE_DEVICE_CLASS_PIMA_PARTIAL_OBJECT_DATA_GET              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 43)            /* I1 = class instance  , I2 = object handle   , I3 = offset requested  , I4 = length requested     */
770 #define UX_TRACE_DEVICE_CLASS_PIMA_RESPONSE_SEND                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 44)            /* I1 = class instance  , I2 = response code   , I3 = number parameter  , I4 = pima parameter 1     */
771 #define UX_TRACE_DEVICE_CLASS_PIMA_STORAGE_ID_SEND                      (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 45)            /* I1 = class instance                                                                              */
772 #define UX_TRACE_DEVICE_CLASS_PIMA_STORAGE_INFO_SEND                    (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 46)            /* I1 = class instance                                                                              */
773 #define UX_TRACE_DEVICE_CLASS_PIMA_GET_DEVICE_PROP_DESC_GET             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 47)            /* I1 = class instance                                                                              */
774 #define UX_TRACE_DEVICE_CLASS_PIMA_GET_DEVICE_PROP_VALUE                (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 48)            /* I1 = class instance                                                                              */
775 #define UX_TRACE_DEVICE_CLASS_PIMA_GET_DEVICE_PROP_VALUE_SET            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 49)            /* I1 = class instance                                                                              */
776 #define UX_TRACE_DEVICE_CLASS_PIMA_GET_OBJECT_PROP_DESC                 (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 50)            /* I1 = class instance                                                                              */
777 #define UX_TRACE_DEVICE_CLASS_PIMA_GET_OBJECT_PROP_VALUE                (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 51)            /* I1 = class instance                                                                              */
778 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECTS_PROPS_SUPPORTED_GET          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 52)            /* I1 = class instance                                                                              */
779 #define UX_TRACE_DEVICE_CLASS_PIMA_GET_OBJECT_REFERENCES                (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 53)            /* I1 = class instance                                                                              */
780 #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECTS_PROPS_SUPPORTED_SET          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 54)            /* I1 = class instance                                                                              */
781 #define UX_TRACE_DEVICE_CLASS_PIMA_SET_OBJECT_REFERENCES                (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 55)            /* I1 = class instance                                                                              */
782 #define UX_TRACE_DEVICE_CLASS_PIMA_STORAGE_FORMAT                       (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 56)            /* I1 = class instance                                                                              */
783 #define UX_TRACE_DEVICE_CLASS_PIMA_DEVICE_RESET                         (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 57)            /* I1 = class instance                                                                              */
784 #define UX_TRACE_DEVICE_CLASS_PIMA_SET_OBJECT_PROP_VALUE                (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 58)            /* I1 = class instance                                                                              */
785 
786 #define UX_TRACE_DEVICE_CLASS_RNDIS_ACTIVATE                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 60)            /* I1 = class instance                                                                              */
787 #define UX_TRACE_DEVICE_CLASS_RNDIS_DEACTIVATE                          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 61)            /* I1 = class instance                                                                              */
788 #define UX_TRACE_DEVICE_CLASS_RNDIS_PACKET_RECEIVE                      (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 62)            /* I1 = class instance                                                                              */
789 #define UX_TRACE_DEVICE_CLASS_RNDIS_PACKET_TRANSMIT                     (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 63)            /* I1 = class instance                                                                              */
790 #define UX_TRACE_DEVICE_CLASS_RNDIS_MSG_QUERY                           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 64)            /* I1 = class instance  , I2 = rndis OID                                                            */
791 #define UX_TRACE_DEVICE_CLASS_RNDIS_MSG_KEEP_ALIVE                      (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 65)            /* I1 = class instance                                                                              */
792 #define UX_TRACE_DEVICE_CLASS_RNDIS_MSG_RESET                           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 66)            /* I1 = class instance                                                                              */
793 #define UX_TRACE_DEVICE_CLASS_RNDIS_MSG_SET                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 67)            /* I1 = class instance  , I2 = rndis OID                                                            */
794 
795 #define UX_TRACE_DEVICE_CLASS_STORAGE_ACTIVATE                          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 70)            /* I1 = class instance                                                                              */
796 #define UX_TRACE_DEVICE_CLASS_STORAGE_DEACTIVATE                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 71)            /* I1 = class instance                                                                              */
797 #define UX_TRACE_DEVICE_CLASS_STORAGE_FORMAT                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 72)            /* I1 = class instance  , I2 = lun                                                                  */
798 #define UX_TRACE_DEVICE_CLASS_STORAGE_INQUIRY                           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 73)            /* I1 = class instance  , I2 = lun                                                                  */
799 #define UX_TRACE_DEVICE_CLASS_STORAGE_MODE_SELECT                       (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 74)            /* I1 = class instance  , I2 = lun                                                                  */
800 #define UX_TRACE_DEVICE_CLASS_STORAGE_MODE_SENSE                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 75)            /* I1 = class instance  , I2 = lun                                                                  */
801 #define UX_TRACE_DEVICE_CLASS_STORAGE_PREVENT_ALLOW_MEDIA_REMOVAL       (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 76)            /* I1 = class instance  , I2 = lun                                                                  */
802 #define UX_TRACE_DEVICE_CLASS_STORAGE_READ                              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 77)            /* I1 = class instance  , I2 = lun             , I3 = sector              , I4 = number sectors     */
803 #define UX_TRACE_DEVICE_CLASS_STORAGE_READ_CAPACITY                     (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 78)            /* I1 = class instance  , I2 = lun                                                                  */
804 #define UX_TRACE_DEVICE_CLASS_STORAGE_READ_FORMAT_CAPACITY              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 79)            /* I1 = class instance  , I2 = lun                                                                  */
805 #define UX_TRACE_DEVICE_CLASS_STORAGE_READ_TOC                          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 80)            /* I1 = class instance  , I2 = lun                                                                  */
806 #define UX_TRACE_DEVICE_CLASS_STORAGE_REQUEST_SENSE                     (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 81)            /* I1 = class instance  , I2 = lun             , I3 = sense key           , I4 = code               */
807 #define UX_TRACE_DEVICE_CLASS_STORAGE_TEST_READY                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 82)            /* I1 = class instance  , I2 = lun                                                                  */
808 #define UX_TRACE_DEVICE_CLASS_STORAGE_START_STOP                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 83)            /* I1 = class instance  , I2 = lun                                                                  */
809 #define UX_TRACE_DEVICE_CLASS_STORAGE_VERIFY                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 84)            /* I1 = class instance  , I2 = lun                                                                  */
810 #define UX_TRACE_DEVICE_CLASS_STORAGE_WRITE                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 85)            /* I1 = class instance  , I2 = lun             , I3 = sector              , I4 = number sectors     */
811 #define UX_TRACE_DEVICE_CLASS_STORAGE_GET_CONFIGURATION                 (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 86)            /* I1 = class instance  , I2 = lun                                                                  */
812 #define UX_TRACE_DEVICE_CLASS_STORAGE_SYNCHRONIZE_CACHE                 (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 87)            /* I1 = class instance  , I2 = lun             , I3 = sector              , I4 = number sectors     */
813 #define UX_TRACE_DEVICE_CLASS_STORAGE_OTHER                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 88)            /* I1 = class instance  , I2 = lun                                                                  */
814 
815 #define UX_TRACE_DEVICE_CLASS_CDC_ECM_ACTIVATE                          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 90)            /* I1 = class instance                                                                              */
816 #define UX_TRACE_DEVICE_CLASS_CDC_ECM_DEACTIVATE                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 91)            /* I1 = class instance                                                                              */
817 #define UX_TRACE_DEVICE_CLASS_CDC_ECM_CHANGE                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 92)            /* I1 = class instance                                                                              */
818 #define UX_TRACE_DEVICE_CLASS_CDC_ECM_READ                              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 93)            /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
819 #define UX_TRACE_DEVICE_CLASS_CDC_ECM_WRITE                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 94)            /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
820 #define UX_TRACE_DEVICE_CLASS_CDC_ECM_PACKET_TRANSMIT                   (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 95)            /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
821 #define UX_TRACE_DEVICE_CLASS_CDC_ECM_PACKET_RECEIVE                    (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 96)            /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
822 
823 #define UX_TRACE_DEVICE_CLASS_DFU_ACTIVATE                              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 97)            /* I1 = class instance                                                                              */
824 #define UX_TRACE_DEVICE_CLASS_DFU_DEACTIVATE                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 98)            /* I1 = class instance                                                                              */
825 
826 #define UX_TRACE_DEVICE_CLASS_PRINTER_ACTIVATE                          (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 100)           /* I1 = class instance                                                                              */
827 #define UX_TRACE_DEVICE_CLASS_PRINTER_DEACTIVATE                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 101)           /* I1 = class instance                                                                              */
828 #define UX_TRACE_DEVICE_CLASS_PRINTER_READ                              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 102)           /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
829 #define UX_TRACE_DEVICE_CLASS_PRINTER_WRITE                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 103)           /* I1 = class instance  , I2 = buffer          , I3 = requested_length                              */
830 
831 #define UX_TRACE_DEVICE_CLASS_CCID_ACTIVATE                             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 110)           /* I1 = class instance                                                                              */
832 #define UX_TRACE_DEVICE_CLASS_CCID_DEACTIVATE                           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 111)           /* I1 = class instance                                                                              */
833 #define UX_TRACE_DEVICE_CLASS_CCID_REQ_ABORT                            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 112)           /* I1 = class instance  , I2 = slot                                                                 */
834 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_ON               (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 113)           /* I1 = class instance  , I2 = slot                                                                 */
835 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_OFF              (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 114)           /* I1 = class instance  , I2 = slot                                                                 */
836 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_GET_SLOT_STATUS            (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 115)           /* I1 = class instance  , I2 = slot                                                                 */
837 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_XFR_BLOCK                  (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 116)           /* I1 = class instance  , I2 = slot                                                                 */
838 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_GET_PARAMETERS             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 117)           /* I1 = class instance  , I2 = slot                                                                 */
839 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_RESET_PARAMETERS           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 118)           /* I1 = class instance  , I2 = slot                                                                 */
840 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 119)           /* I1 = class instance  , I2 = slot                                                                 */
841 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ESCAPE                     (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 120)           /* I1 = class instance  , I2 = slot                                                                 */
842 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_CLOCK                  (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 121)           /* I1 = class instance  , I2 = slot                                                                 */
843 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU                    (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 122)           /* I1 = class instance  , I2 = slot                                                                 */
844 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE                     (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 123)           /* I1 = class instance  , I2 = slot                                                                 */
845 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_MECHANICAL                 (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 124)           /* I1 = class instance  , I2 = slot                                                                 */
846 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ABORT                      (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 125)           /* I1 = class instance  , I2 = slot                                                                 */
847 #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_SET_RATE_CLOCK             (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 126)           /* I1 = class instance  , I2 = slot                                                                 */
848 #define UX_TRACE_DEVICE_CLASS_CCID_RDR_TO_PC_RESPONSE                   (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 127)           /* I1 = class instance  , I2 = slot                                                                 */
849 #define UX_TRACE_DEVICE_CLASS_CCID_ICC_INSERT                           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 128)           /* I1 = class instance  , I2 = slot                                                                 */
850 #define UX_TRACE_DEVICE_CLASS_CCID_ICC_REMOVE                           (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 129)           /* I1 = class instance  , I2 = slot                                                                 */
851 #define UX_TRACE_DEVICE_CLASS_CCID_AUTO_SEQ_START                       (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 130)           /* I1 = class instance  , I2 = slot                                                                 */
852 #define UX_TRACE_DEVICE_CLASS_CCID_AUTO_SEQ_STOP                        (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 131)           /* I1 = class instance  , I2 = slot                                                                 */
853 #define UX_TRACE_DEVICE_CLASS_CCID_TIME_EXTENSION                       (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 132)           /* I1 = class instance  , I2 = slot            , I3 = time                                          */
854 #define UX_TRACE_DEVICE_CLASS_CCID_HARDWARE_ERROR                       (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 133)           /* I1 = class instance  , I2 = slot                                                                 */
855 
856 
857 /* Define the USBX Error Event.  */
858 
859 #define UX_TRACE_ERROR                                                  999
860 
861 
862 #else
863 #define UX_TRACE_OBJECT_REGISTER(t,p,n,a,b)
864 #define UX_TRACE_OBJECT_UNREGISTER(o)
865 #define UX_TRACE_IN_LINE_INSERT(i,a,b,c,d,f,g,h)
866 #define UX_TRACE_EVENT_UPDATE(e,t,i,a,b,c,d)
867 #endif
868 
869 
870 /* Define the system level for error trapping. */
871 #define UX_SYSTEM_LEVEL_INTERRUPT                                       1
872 #define UX_SYSTEM_LEVEL_THREAD                                          2
873 
874 /* Define the system context for error trapping. */
875 #define UX_SYSTEM_CONTEXT_HCD                                           1
876 #define UX_SYSTEM_CONTEXT_DCD                                           2
877 #define UX_SYSTEM_CONTEXT_INIT                                          3
878 #define UX_SYSTEM_CONTEXT_ENUMERATOR                                    4
879 #define UX_SYSTEM_CONTEXT_ROOT_HUB                                      5
880 #define UX_SYSTEM_CONTEXT_HUB                                           6
881 #define UX_SYSTEM_CONTEXT_CLASS                                         7
882 #define UX_SYSTEM_CONTEXT_UTILITY                                       8
883 #define UX_SYSTEM_CONTEXT_DEVICE_STACK                                  9
884 #define UX_SYSTEM_CONTEXT_HOST_STACK                                    10
885 
886 
887 /* Defines the number of ThreadX timer ticks per seconds. By default, the ThreadX timer tick is 10ms,
888    so the default value for this constant is 100.  If TX_TIMER_TICKS_PER_SECOND is defined,
889    this value is derived from TX_TIMER_TICKS_PER_SECOND.  */
890 
891 #ifndef UX_PERIODIC_RATE
892 #ifdef TX_TIMER_TICKS_PER_SECOND
893 #define UX_PERIODIC_RATE                                                (TX_TIMER_TICKS_PER_SECOND)
894 #else
895 #define UX_PERIODIC_RATE                                                100
896 #endif
897 #endif
898 
899 
900 /* Define interrupts lockout constructs to protect the memory allocation/release which could happen
901    under ISR in the device stack.  */
902 
903 #ifndef UX_INTERRUPT_SAVE_AREA
904 #ifdef  TX_INTERRUPT_SAVE_AREA
905 #define UX_INTERRUPT_SAVE_AREA                                          TX_INTERRUPT_SAVE_AREA
906 #else
907 #define UX_INTERRUPT_SAVE_AREA                                          ALIGN_TYPE saved_flags;
908 #endif
909 #endif
910 
911 #ifndef UX_DISABLE
912 #ifdef  TX_DISABLE
913 #define UX_DISABLE                                                      TX_DISABLE
914 #else
915 #define UX_DISABLE                                                      saved_flags = _ux_utility_interrupt_disable();
916 #endif
917 #endif
918 
919 #ifndef UX_RESTORE
920 #ifdef  TX_RESTORE
921 #define UX_RESTORE                                                      TX_RESTORE
922 #else
923 #define UX_RESTORE                                                      _ux_utility_interrupt_restore(saved_flags);
924 #endif
925 #endif
926 
927 #ifndef UX_INT_SAVE_AREA    /* Backword compatible.  */
928 #define UX_INT_SAVE_AREA                                                UX_INTERRUPT_SAVE_AREA
929 #endif
930 #ifndef UX_DISABLE_INTS     /* Backword compatible.  */
931 #define UX_DISABLE_INTS                                                 UX_DISABLE
932 #endif
933 #ifndef UX_RESTORE_INTS     /* Backword compatible.  */
934 #define UX_RESTORE_INTS                                                 UX_RESTORE
935 #endif
936 
937 
938 /* Define thread/timer related things.  */
939 
940 #ifndef UX_EMPTY
941 #ifdef  TX_EMPTY
942 #define UX_EMPTY                                                        TX_EMPTY
943 #else
944 #define UX_EMPTY                                                        (0)
945 #endif
946 #endif
947 
948 #ifndef UX_TIMER
949 #ifdef  TX_API_H
950 #define UX_TIMER                                                        TX_TIMER
951 #else
952 #define UX_TIMER                                                        VOID* /* Dummy type for standalone compile.  */
953 #endif
954 #endif
955 
956 #ifndef UX_THREAD
957 #ifdef  TX_API_H
958 #define UX_THREAD                                                       TX_THREAD
959 #else
960 #define UX_THREAD                                                       VOID* /* Dummy type for standalone compile.  */
961 #endif
962 #endif
963 
964 #ifndef UX_AUTO_START
965 #ifdef  TX_AUTO_START
966 #define UX_AUTO_START                                                   TX_AUTO_START
967 #else
968 #define UX_AUTO_START                                                   (1ul)
969 #endif
970 #endif
971 
972 #ifndef UX_DONT_START
973 #ifdef  TX_DONT_START
974 #define UX_DONT_START                                                   TX_DONT_START
975 #else
976 #define UX_DONT_START                                                   (0ul)
977 #endif
978 #endif
979 
980 #ifndef UX_AUTO_ACTIVATE
981 #ifdef  TX_AUTO_ACTIVATE
982 #define UX_AUTO_ACTIVATE                                                TX_AUTO_ACTIVATE
983 #else
984 #define UX_AUTO_ACTIVATE                                                (1ul)
985 #endif
986 #endif
987 
988 #ifndef UX_NO_ACTIVATE
989 #ifdef  TX_NO_ACTIVATE
990 #define UX_NO_ACTIVATE                                                  TX_NO_ACTIVATE
991 #else
992 #define UX_NO_ACTIVATE                                                  (0ul)
993 #endif
994 #endif
995 
996 #ifndef UX_THREAD_GET_SYSTEM_STATE
997 #define UX_THREAD_GET_SYSTEM_STATE                                      TX_THREAD_GET_SYSTEM_STATE
998 #endif
999 
1000 #ifndef UX_WAIT_FOREVER
1001 #ifdef  TX_WAIT_FOREVER
1002 #define UX_WAIT_FOREVER                                                 TX_WAIT_FOREVER
1003 #else
1004 #define UX_WAIT_FOREVER                                                 (0xFFFFFFFFul)
1005 #endif
1006 #endif
1007 
1008 #ifndef UX_NO_WAIT
1009 #ifdef  TX_NO_WAIT
1010 #define UX_NO_WAIT                                                      TX_NO_WAIT
1011 #else
1012 #define UX_NO_WAIT                                                      (0ul)
1013 #endif
1014 #endif
1015 
1016 #ifndef UX_NO_TIME_SLICE
1017 #ifdef  TX_NO_TIME_SLICE
1018 #define UX_NO_TIME_SLICE                                                TX_NO_TIME_SLICE
1019 #else
1020 #define UX_NO_TIME_SLICE                                                (0ul)
1021 #endif
1022 #endif
1023 
1024 
1025 /* Define semaphore related things.  */
1026 
1027 #ifndef UX_SEMAPHORE
1028 #ifdef  TX_API_H
1029 #define UX_SEMAPHORE                                                    TX_SEMAPHORE
1030 #else
1031 #define UX_SEMAPHORE                                                    VOID* /* Dummy type for standalone compile.  */
1032 #endif
1033 #endif
1034 
1035 
1036 /* Define mutex related things.  */
1037 
1038 #ifndef UX_MUTEX
1039 #ifdef  TX_API_H
1040 #define UX_MUTEX                                                        TX_MUTEX
1041 #else
1042 #define UX_MUTEX                                                        VOID* /* Dummy type for standalone compile.  */
1043 #endif
1044 #endif
1045 
1046 
1047 /* Define event flags group related things.  */
1048 
1049 #ifndef UX_EVENT_FLAGS_GROUP
1050 #ifdef  TX_API_H
1051 #define UX_EVENT_FLAGS_GROUP                                            TX_EVENT_FLAGS_GROUP
1052 #else
1053 #define UX_EVENT_FLAGS_GROUP                                            VOID* /* Dummy type for standalone compile.  */
1054 #endif
1055 #endif
1056 
1057 #ifndef UX_OR_CLEAR
1058 #ifdef  TX_OR_CLEAR
1059 #define UX_OR_CLEAR                                                     TX_OR_CLEAR
1060 #else
1061 #define UX_OR_CLEAR                                                     (1u)
1062 #endif
1063 #endif
1064 
1065 #ifndef UX_OR
1066 #ifdef  TX_OR
1067 #define UX_OR                                                           TX_OR
1068 #else
1069 #define UX_OR                                                           (0u)
1070 #endif
1071 #endif
1072 
1073 #ifndef UX_AND_CLEAR
1074 #ifdef  TX_AND_CLEAR
1075 #define UX_AND_CLEAR                                                    TX_AND_CLEAR
1076 #else
1077 #define UX_AND_CLEAR                                                    (3u)
1078 #endif
1079 #endif
1080 
1081 #ifndef UX_AND
1082 #ifdef  TX_AND
1083 #define UX_AND                                                          TX_AND
1084 #else
1085 #define UX_AND                                                          (2u)
1086 #endif
1087 #endif
1088 
1089 #ifndef UX_NO_EVENTS
1090 #ifdef  TX_NO_EVENTS
1091 #define UX_NO_EVENTS                                                    TX_NO_EVENTS
1092 #else
1093 #define UX_NO_EVENTS                                                    (7u)
1094 #endif
1095 #endif
1096 
1097 
1098 /* Define basic USBX constants.  */
1099 
1100 #define UX_NULL                                                         ((void*)0)
1101 #define UX_INVALID_PTR                                                  ((void*)(~((ALIGN_TYPE)0)))
1102 #define UX_TRUE                                                         1u
1103 #define UX_FALSE                                                        0u
1104 #define UX_TT_MASK                                                      0x1FFu
1105 #define UX_TT_BANDWIDTH                                                 6000u
1106 #define UX_SLAVE_ENDPOINT_DEFAULT_BUFFER_SIZE                           256u
1107 
1108 #define UX_MAX_BYTES_PER_FRAME_FS                                       1157u
1109 #define UX_MAX_BYTES_PER_MICROFRAME_HS                                  5785u
1110 
1111 /* Define USBX command request constants.  */
1112 
1113 #define UX_SETUP_REQUEST_TYPE                                           0u
1114 #define UX_SETUP_REQUEST                                                1u
1115 #define UX_SETUP_VALUE                                                  2u
1116 #define UX_SETUP_INDEX                                                  4u
1117 #define UX_SETUP_LENGTH                                                 6u
1118 #define UX_SETUP_SIZE                                                   8u
1119 
1120 
1121 /* Define USBX standard commands.  */
1122 
1123 #define UX_GET_STATUS                                                   0u
1124 #define UX_CLEAR_FEATURE                                                1u
1125 #define UX_SET_FEATURE                                                  3u
1126 #define UX_SET_ADDRESS                                                  5u
1127 #define UX_GET_DESCRIPTOR                                               6u
1128 #define UX_SET_DESCRIPTOR                                               7u
1129 #define UX_GET_CONFIGURATION                                            8u
1130 #define UX_SET_CONFIGURATION                                            9u
1131 #define UX_GET_INTERFACE                                                10u
1132 #define UX_SET_INTERFACE                                                11u
1133 #define UX_SYNCH_FRAME                                                  12u
1134 
1135 
1136 /* Define USBX command sub constants.  */
1137 
1138 #define UX_ENDPOINT_HALT                                                0u
1139 
1140 /* Define USBX feature selector constants.  */
1141 #define UX_REQUEST_FEATURE_ENDPOINT_HALT                                0u
1142 #define UX_REQUEST_FEATURE_DEVICE_REMOTE_WAKEUP                         1u
1143 #define UX_REQUEST_FEATURE_TEST_MODE                                    2u
1144 
1145 /* Define Generic USBX constants.  */
1146 
1147 #define UX_UNUSED                                                       0
1148 #define UX_USED                                                         1
1149 
1150 #define UX_MEMORY_UNUSED                                                0x00000000u
1151 #define UX_MEMORY_USED                                                  0x80000000u
1152 #define UX_REGULAR_MEMORY                                               0
1153 #define UX_CACHE_SAFE_MEMORY                                            1
1154 
1155 #define UX_NO_ALIGN                                                     0u
1156 #define UX_ALIGN_8                                                      0x07u
1157 #define UX_ALIGN_16                                                     0x0fu
1158 #define UX_ALIGN_32                                                     0x1fu
1159 #define UX_ALIGN_64                                                     0x3fu
1160 #define UX_ALIGN_128                                                    0x7fu
1161 #define UX_ALIGN_256                                                    0xffu
1162 #define UX_ALIGN_512                                                    0x1ffu
1163 #define UX_ALIGN_1024                                                   0x3ffu
1164 #define UX_ALIGN_2048                                                   0x7ffu
1165 #define UX_ALIGN_4096                                                   0xfffu
1166 #define UX_SAFE_ALIGN                                                   0xffffffffu
1167 #define UX_MAX_SCATTER_GATHER_ALIGNMENT                                 4096
1168 #ifndef UX_ALIGN_MIN
1169 #define UX_ALIGN_MIN                                                    UX_ALIGN_8
1170 #endif
1171 
1172 #define UX_MAX_USB_DEVICES                                              127
1173 
1174 #define UX_ENDPOINT_DIRECTION                                           0x80u
1175 #define UX_ENDPOINT_IN                                                  0x80u
1176 #define UX_ENDPOINT_OUT                                                 0x00u
1177 
1178 #define UX_MASK_ENDPOINT_TYPE                                           3u
1179 #define UX_CONTROL_ENDPOINT                                             0u
1180 #define UX_ISOCHRONOUS_ENDPOINT                                         1u
1181 #define UX_BULK_ENDPOINT                                                2u
1182 #define UX_INTERRUPT_ENDPOINT                                           3u
1183 
1184 #define UX_ISOCHRONOUS_ENDPOINT_IN                                      0x81u
1185 #define UX_ISOCHRONOUS_ENDPOINT_OUT                                     0x01u
1186 #define UX_BULK_ENDPOINT_IN                                             0x82u
1187 #define UX_BULK_ENDPOINT_OUT                                            0x02u
1188 #define UX_INTERRUPT_ENDPOINT_IN                                        0x83u
1189 #define UX_INTERRUPT_ENDPOINT_OUT                                       0x03u
1190 
1191 #define UX_MAX_PACKET_SIZE_MASK                                         0x7ffu
1192 #define UX_MAX_NUMBER_OF_TRANSACTIONS_MASK                              0x1800u
1193 #define UX_MAX_NUMBER_OF_TRANSACTIONS_SHIFT                             11
1194 
1195 #define UX_FEEDBACK_SIZE_FULL_SPEED                                     3   /* 10.10 format fits into 3 bytes.  */
1196 #define UX_FEEDBACK_SIZE_HIGH_SPEED                                     4   /* 12.13 format fits into 4 bytes.  */
1197 
1198 #define UX_REQUEST_DIRECTION                                            0x80u
1199 #define UX_REQUEST_IN                                                   0x80u
1200 #define UX_REQUEST_OUT                                                  0x00u
1201 
1202 #define UX_REQUEST_TYPE                                                 0x60u
1203 #define UX_REQUEST_TYPE_STANDARD                                        0x00u
1204 #define UX_REQUEST_TYPE_CLASS                                           0x20u
1205 #define UX_REQUEST_TYPE_VENDOR                                          0x40u
1206 
1207 #define UX_REQUEST_TARGET                                               0x03u
1208 #define UX_REQUEST_TARGET_DEVICE                                        0x00u
1209 #define UX_REQUEST_TARGET_INTERFACE                                     0x01u
1210 #define UX_REQUEST_TARGET_ENDPOINT                                      0x02u
1211 #define UX_REQUEST_TARGET_OTHER                                         0x03u
1212 
1213 #define UX_DEVICE_RESET                                                 0
1214 #define UX_DEVICE_ATTACHED                                              1
1215 #define UX_DEVICE_ADDRESSED                                             2
1216 #define UX_DEVICE_CONFIGURED                                            3
1217 #define UX_DEVICE_SUSPENDED                                             4
1218 #define UX_DEVICE_RESUMED                                               5
1219 #define UX_DEVICE_SELF_POWERED_STATE                                    6
1220 #define UX_DEVICE_BUS_POWERED_STATE                                     7
1221 #define UX_DEVICE_REMOTE_WAKEUP                                         8
1222 #define UX_DEVICE_BUS_RESET_COMPLETED                                   9
1223 #define UX_DEVICE_REMOVED                                               10
1224 #define UX_DEVICE_FORCE_DISCONNECT                                      11
1225 
1226 #define UX_ENDPOINT_RESET                                               0
1227 #define UX_ENDPOINT_RUNNING                                             1
1228 #define UX_ENDPOINT_HALTED                                              2
1229 
1230 #define UX_DEVICE_DESCRIPTOR_ITEM                                       1u
1231 #define UX_CONFIGURATION_DESCRIPTOR_ITEM                                2u
1232 #define UX_STRING_DESCRIPTOR_ITEM                                       3u
1233 #define UX_INTERFACE_DESCRIPTOR_ITEM                                    4u
1234 #define UX_ENDPOINT_DESCRIPTOR_ITEM                                     5u
1235 #define UX_DEVICE_QUALIFIER_DESCRIPTOR_ITEM                             6u
1236 #define UX_OTHER_SPEED_DESCRIPTOR_ITEM                                  7u
1237 #define UX_OTG_DESCRIPTOR_ITEM                                          9u
1238 #define UX_INTERFACE_ASSOCIATION_DESCRIPTOR_ITEM                        11u
1239 #define UX_BOS_DESCRIPTOR_ITEM                                          15u
1240 #define UX_DEVICE_CAPABILITY_DESCRIPTOR_ITEM                            16u
1241 #define UX_DFU_FUNCTIONAL_DESCRIPTOR_ITEM                               0x21u
1242 #define UX_HUB_DESCRIPTOR_ITEM                                          0x29u
1243 
1244 #define UX_CAPABILITY_WIRELESS_USB                                      0x01u
1245 #define UX_CAPABILITY_USB_2_0_EXTENSION                                 0x02u
1246 #define UX_CAPABILITY_SUPERSPEED_USB                                    0x03u
1247 #define UX_CAPABILITY_CONTAINER_ID                                      0x04u
1248 #define UX_CAPABILITY_PLATFORM                                          0x05u
1249 #define UX_CAPABILITY_POWER_DELIVERY                                    0x06u
1250 #define UX_CAPABILITY_BATTERY_INFO                                      0x07u
1251 #define UX_CAPABILITY_PD_CONSUMER_PORT                                  0x08u
1252 #define UX_CAPABILITY_PD_PROVIDER_PORT                                  0x09u
1253 #define UX_CAPABILITY_SUPERSPEED_PLUS                                   0x0Au
1254 #define UX_CAPABILITY_PRECISION_TIME_MEASUREMENT                        0x0Bu
1255 #define UX_CAPABILITY_WIRELESS_USB_EXT                                  0x0Cu
1256 #define UX_CAPABILITY_BILLBOARD                                         0x0Du
1257 #define UX_CAPABILITY_AUTHENTICATION                                    0x0Eu
1258 #define UX_CAPABILITY_BILLBOARD_EX                                      0x0Fu
1259 #define UX_CAPABILITY_CONFIGURATION_SUMMARY                             0x10u
1260 
1261 
1262 #ifndef UX_CONTROL_TRANSFER_TIMEOUT
1263 #define UX_CONTROL_TRANSFER_TIMEOUT                                     10000
1264 #endif
1265 
1266 #ifndef UX_NON_CONTROL_TRANSFER_TIMEOUT
1267 #define UX_NON_CONTROL_TRANSFER_TIMEOUT                                 50000
1268 #endif
1269 #define UX_PORT_ENABLE_WAIT                                             50
1270 #define UX_DEVICE_ADDRESS_SET_WAIT                                      50
1271 #define UX_HIGH_SPEED_DETECTION_HANDSHAKE_SUSPEND_WAIT                  200
1272 #define UX_ENUMERATION_THREAD_WAIT                                      200
1273 
1274 
1275 /* USB Billboard constants.  */
1276 
1277 #define UX_CLASS_BILLBOARD_CLASS                                        0x11
1278 #define UX_CLASS_BILLBOARD_SUBCLASS                                     0x00
1279 #define UX_CLASS_BILLBOARD_PROTOCOL                                     0x00
1280 #define UX_CLASS_BILLBOARD_DESCRIPTOR_BILLBOARD                         0x0D
1281 #define UX_CLASS_BILLBOARD_DESCRIPTOR_ALTERNATE_MODE                    0x0F
1282 #define UX_CLASS_BILLBOARD_MAX_NUM_ALT_MODE                             0x34
1283 
1284 /* USBX 5.8 BACKWARD COMPATIBILITY DEFINITIONS. THESE DEFINITIONS ARE NOW OBSOLETE
1285    BUT DEFINED HERE FOR COMPATIBILITY REASONS.  */
1286 
1287 #ifndef UX_CONTROL_TRANSFER_TIMEOUT_IN_MS
1288 #define UX_CONTROL_TRANSFER_TIMEOUT_IN_MS                               10000
1289 #endif
1290 
1291 #ifndef UX_NON_CONTROL_TRANSFER_TIMEOUT_IN_MS
1292 #define UX_NON_CONTROL_TRANSFER_TIMEOUT_IN_MS                           50000
1293 #endif
1294 
1295 #ifndef UX_PORT_ENABLE_WAIT_IN_MS
1296 #define UX_PORT_ENABLE_WAIT_IN_MS                                       500
1297 #endif
1298 
1299 #ifndef UX_DEVICE_ADDRESS_SET_WAIT_IN_MS
1300 #define UX_DEVICE_ADDRESS_SET_WAIT_IN_MS                                500
1301 #endif
1302 
1303 #ifndef UX_HIGH_SPEED_DETECTION_HANDSHAKE_SUSPEND_WAIT_IN_MS
1304 #define UX_HIGH_SPEED_DETECTION_HANDSHAKE_SUSPEND_WAIT_IN_MS            2000
1305 #endif
1306 
1307 /* END OF 5.8 BACKWARD COMPATIBILITY DEFINITIONS. */
1308 
1309 #define UX_TRANSFER_PHASE_SETUP                                         1
1310 #define UX_TRANSFER_PHASE_DATA_IN                                       2
1311 #define UX_TRANSFER_PHASE_DATA_OUT                                      3
1312 #define UX_TRANSFER_PHASE_STATUS_IN                                     4
1313 #define UX_TRANSFER_PHASE_STATUS_OUT                                    5
1314 
1315 
1316 /* Host change callback events : _callback(event, *class, *instance)  */
1317 
1318 #define UX_DEVICE_INSERTION                                             0x01u
1319 #define UX_DEVICE_REMOVAL                                               0x02u
1320 #define UX_HID_CLIENT_INSERTION                                         0x03u
1321 #define UX_HID_CLIENT_REMOVAL                                           0x04u
1322 #define UX_STORAGE_MEDIA_INSERTION                                      0x05u
1323 #define UX_STORAGE_MEDIA_REMOVAL                                        0x06u
1324 
1325 /* Host change callback events : _callback(event, NULL, *device_instance)  */
1326 
1327 #define UX_DEVICE_CONNECTION                                            0x81u
1328 #define UX_DEVICE_DISCONNECTION                                         0x82u
1329 
1330 /* Host change callback events : _callback(event, NULL, NULL)  */
1331 
1332 #define UX_STANDALONE_WAIT_BACKGROUND_TASK                              0x00u
1333 
1334 
1335 /* Define USBX transfer request status constants.  */
1336 
1337 #define UX_TRANSFER_STATUS_NOT_PENDING                                  0
1338 #define UX_TRANSFER_STATUS_PENDING                                      1
1339 #define UX_TRANSFER_STATUS_COMPLETED                                    2
1340 #define UX_TRANSFER_STATUS_ABORT                                        4
1341 
1342 /* Define USBX device power constants.  */
1343 
1344 #define UX_DEVICE_BUS_POWERED                                           1u
1345 #define UX_DEVICE_SELF_POWERED                                          2u
1346 #define UX_MAX_SELF_POWER                                               (500u/2)
1347 #define UX_MAX_BUS_POWER                                                (100u/2)
1348 #define UX_CONFIGURATION_DEVICE_BUS_POWERED                             0x80u
1349 #define UX_CONFIGURATION_DEVICE_SELF_POWERED                            0x40u
1350 #define UX_STATUS_DEVICE_SELF_POWERED                                   1u
1351 
1352 /* Define USBX OTG constants.  */
1353 
1354 #define UX_OTG_BM_ATTRIBUTES                                            2u
1355 #define UX_OTG_SRP_SUPPORT                                              1u
1356 #define UX_OTG_HNP_SUPPORT                                              2u
1357 #define UX_HCD_OTG_CAPABLE                                              1u
1358 #define UX_DCD_OTG_CAPABLE                                              1u
1359 
1360 #define UX_OTG_FEATURE_B_HNP_ENABLE                                     3u
1361 #define UX_OTG_FEATURE_A_HNP_SUPPORT                                    4u
1362 #define UX_OTG_FEATURE_A_ALT_HNP_SUPPORT                                5u
1363 #define UX_OTG_STATUS_SELECTOR                                          0xF000u
1364 #define UX_OTG_HOST_REQUEST_FLAG                                        0x01u
1365 
1366 #define UX_OTG_IDLE                                                     0u
1367 #define UX_OTG_IDLE_TO_HOST                                             1u
1368 #define UX_OTG_IDLE_TO_SLAVE                                            2u
1369 #define UX_OTG_HOST_TO_IDLE                                             3u
1370 #define UX_OTG_HOST_TO_SLAVE                                            4u
1371 #define UX_OTG_SLAVE_TO_IDLE                                            5u
1372 #define UX_OTG_SLAVE_TO_HOST                                            6u
1373 #define UX_OTG_SLAVE_SRP                                                7u
1374 
1375 #define UX_OTG_MODE_IDLE                                                0u
1376 #define UX_OTG_MODE_SLAVE                                               1u
1377 #define UX_OTG_MODE_HOST                                                2u
1378 
1379 #define UX_OTG_DEVICE_IDLE                                              0u
1380 #define UX_OTG_DEVICE_A                                                 1u
1381 #define UX_OTG_DEVICE_B                                                 2u
1382 
1383 #define UX_OTG_VBUS_IDLE                                                0u
1384 #define UX_OTG_VBUS_ON                                                  1u
1385 #define UX_OTG_VBUS_OFF                                                 2u
1386 
1387 
1388 #define UX_OTG_HNP_THREAD_SLEEP_TIME                                    (2 * UX_PERIODIC_RATE)
1389 
1390 /* Define USBX device speed constants.  */
1391 
1392 #define UX_DEFAULT_HS_MPS                                               64
1393 #define UX_DEFAULT_MPS                                                  8
1394 
1395 #define UX_LOW_SPEED_DEVICE                                             0
1396 #define UX_FULL_SPEED_DEVICE                                            1
1397 #define UX_HIGH_SPEED_DEVICE                                            2
1398 
1399 
1400 /* Define USBX generic port status constants.  */
1401 
1402 #define UX_PS_CCS                                                       0x01u
1403 #define UX_PS_CPE                                                       0x01u
1404 #define UX_PS_PES                                                       0x02u
1405 #define UX_PS_PSS                                                       0x04u
1406 #define UX_PS_POCI                                                      0x08u
1407 #define UX_PS_PRS                                                       0x10u
1408 #define UX_PS_PPS                                                       0x20u
1409 #define UX_PS_DS_LS                                                     0x00u
1410 #define UX_PS_DS_FS                                                     0x40u
1411 #define UX_PS_DS_HS                                                     0x80u
1412 
1413 #define UX_PS_DS                                                        6u
1414 
1415 
1416 /* Define USBX generic state machine constants.  */
1417 
1418 #define UX_STATE_RESET                                                  0u
1419 #define UX_STATE_EXIT                                                   1u
1420 #define UX_STATE_IDLE                                                   2u
1421 #define UX_STATE_ERROR                                                  3u
1422 #define UX_STATE_NEXT                                                   4u
1423 #define UX_STATE_WAIT                                                   5u
1424 #define UX_STATE_LOCK                                                   6u
1425 #define UX_STATE_BUSY                                                   6u
1426 #define UX_STATE_STEP                                                   0x20u
1427 #define UX_STATE_STACK_STEP                                             0x20u
1428 #define UX_STATE_DRIVER_STEP                                            0x40u
1429 #define UX_STATE_CLASS_STEP                                             0x60u
1430 #define UX_STATE_APP_STEP                                               0x80u
1431 
1432 #define UX_STATE_IS_RESET(s)                            (!(s))                          /* Reset state  */
1433 #define UX_STATE_IS_FATAL(s)                            ((s) && (s) < UX_STATE_ERROR)   /* Fatal, break all pending loops.  */
1434 #define UX_STATE_IS_ERROR(s)                            ((s) == UX_STATE_ERROR)         /* General error  */
1435 #define UX_STATE_IS_BUSY(s)                             ((s) >= UX_STATE_WAIT)          /* Locked or pending  */
1436 #define UX_STATE_IS_LOCKED(s)                           ((s) >= UX_STATE_LOCK)          /* Locked but not pendint  */
1437 
1438 
1439 /* Define USBX Error Code constants. The following format describes
1440    their meaning:
1441 
1442         0x00    : Success
1443         0x0x    : State machine return codes
1444         0x1x    : Configuration errors
1445         0x2x    : USB transport errors
1446         0x3x    : USB controller errors
1447         0x4x    : USB topology errors
1448         0x5x    : USB API errors
1449         0x6x    : USB Generic Class errors
1450         0x7x    : USB HID Class errors
1451         0x8x    : USB Audio Class errors
1452         0x9x    : USB CDC-ECM Class errors
1453         ...
1454         0xfx    : General errors
1455 */
1456 
1457 #define UX_SUCCESS                                                      0
1458 
1459 #define UX_ERROR                                                        0xff
1460 #define UX_BUSY                                                         0xfe
1461 #define UX_TIMEOUT                                                      0xfd
1462 #define UX_REENTRY                                                      0xfc
1463 #define UX_INVALID_STATE                                                0xfb
1464 #define UX_INVALID_PARAMETER                                            0xfa
1465 #define UX_ABORTED                                                      0xf9
1466 #define UX_MATH_OVERFLOW                                                0xf8
1467 #define UX_INVALID_BUILD_OPTION                                         0xf7
1468 
1469 #define UX_TOO_MANY_DEVICES                                             0x11
1470 #define UX_MEMORY_INSUFFICIENT                                          0x12
1471 #define UX_NO_TD_AVAILABLE                                              0x13
1472 #define UX_NO_ED_AVAILABLE                                              0x14
1473 #define UX_SEMAPHORE_ERROR                                              0x15
1474 #define UX_THREAD_ERROR                                                 0x16
1475 #define UX_MUTEX_ERROR                                                  0x17
1476 #define UX_EVENT_ERROR                                                  0x18
1477 #define UX_MEMORY_CORRUPTED                                             0x19
1478 #define UX_MEMORY_ARRAY_FULL                                            0x1a
1479 #define UX_FATAL_ERROR                                                  0x1b
1480 #define UX_ALREADY_ACTIVATED                                            0x1c
1481 
1482 #define UX_TRANSFER_STALLED                                             0x21
1483 #define UX_TRANSFER_NO_ANSWER                                           0x22
1484 #define UX_TRANSFER_ERROR                                               0x23
1485 #define UX_TRANSFER_MISSED_FRAME                                        0x24
1486 #define UX_TRANSFER_NOT_READY                                           0x25
1487 #define UX_TRANSFER_BUS_RESET                                           0x26
1488 #define UX_TRANSFER_BUFFER_OVERFLOW                                     0x27
1489 #define UX_TRANSFER_APPLICATION_RESET                                   0x28
1490 #define UX_TRANSFER_DATA_LESS_THAN_EXPECTED                             0x29
1491 
1492 #define UX_PORT_RESET_FAILED                                            0x31
1493 #define UX_CONTROLLER_INIT_FAILED                                       0x32
1494 #define UX_CONTROLLER_DEAD                                              0x33
1495 
1496 #define UX_NO_BANDWIDTH_AVAILABLE                                       0x41
1497 #define UX_DESCRIPTOR_CORRUPTED                                         0x42
1498 #define UX_OVER_CURRENT_CONDITION                                       0x43
1499 #define UX_DEVICE_ENUMERATION_FAILURE                                   0x44
1500 #define UX_TOO_MANY_HUB_PORTS                                           0x45
1501 
1502 #define UX_DEVICE_HANDLE_UNKNOWN                                        0x50
1503 #define UX_CONFIGURATION_HANDLE_UNKNOWN                                 0x51
1504 #define UX_INTERFACE_HANDLE_UNKNOWN                                     0x52
1505 #define UX_ENDPOINT_HANDLE_UNKNOWN                                      0x53
1506 #define UX_FUNCTION_NOT_SUPPORTED                                       0x54
1507 #define UX_CONTROLLER_UNKNOWN                                           0x55
1508 #define UX_PORT_INDEX_UNKNOWN                                           0x56
1509 #define UX_NO_CLASS_MATCH                                               0x57
1510 #define UX_HOST_CLASS_ALREADY_INSTALLED                                 0x58
1511 #define UX_HOST_CLASS_UNKNOWN                                           0x59
1512 #define UX_CONNECTION_INCOMPATIBLE                                      0x5a
1513 #define UX_HOST_CLASS_INSTANCE_UNKNOWN                                  0x5b
1514 #define UX_TRANSFER_TIMEOUT                                             0x5c
1515 #define UX_BUFFER_OVERFLOW                                              0x5d
1516 #define UX_NO_ALTERNATE_SETTING                                         0x5e
1517 #define UX_NO_DEVICE_CONNECTED                                          0x5f
1518 
1519 #define UX_HOST_CLASS_PROTOCOL_ERROR                                    0x60
1520 #define UX_HOST_CLASS_MEMORY_ERROR                                      0x61
1521 #define UX_HOST_CLASS_MEDIA_NOT_SUPPORTED                               0x62
1522 #define UX_CLASS_MALFORMED_PACKET_RECEIVED_ERROR                        0x63
1523 
1524 #define UX_HOST_CLASS_HID_REPORT_OVERFLOW                               0x70
1525 #define UX_HOST_CLASS_HID_USAGE_OVERFLOW                                0x71
1526 #define UX_HOST_CLASS_HID_TAG_UNSUPPORTED                               0x72
1527 #define UX_HOST_CLASS_HID_PUSH_OVERFLOW                                 0x73
1528 #define UX_HOST_CLASS_HID_POP_UNDERFLOW                                 0x74
1529 #define UX_HOST_CLASS_HID_COLLECTION_OVERFLOW                           0x75
1530 #define UX_HOST_CLASS_HID_COLLECTION_UNDERFLOW                          0x76
1531 #define UX_HOST_CLASS_HID_MIN_MAX_ERROR                                 0x77
1532 #define UX_HOST_CLASS_HID_DELIMITER_ERROR                               0x78
1533 #define UX_HOST_CLASS_HID_REPORT_ERROR                                  0x79
1534 #define UX_HOST_CLASS_HID_PERIODIC_REPORT_ERROR                         0x7A
1535 #define UX_HOST_CLASS_HID_UNKNOWN                                       0x7B
1536 
1537 #define UX_HOST_CLASS_AUDIO_WRONG_TYPE                                  0x80
1538 #define UX_HOST_CLASS_AUDIO_WRONG_INTERFACE                             0x81
1539 #define UX_HOST_CLASS_AUDIO_WRONG_FREQUENCY                             0x82
1540 
1541 #define UX_CLASS_CDC_ECM_LINK_STATE_DOWN_ERROR                          0x90
1542 #define UX_CLASS_ETH_LINK_STATE_DOWN_ERROR                              0x90
1543 #define UX_CLASS_ETH_PACKET_POOL_ERROR                                  0x91
1544 #define UX_CLASS_ETH_PACKET_ERROR                                       0x92
1545 #define UX_CLASS_ETH_SIZE_ERROR                                         0x93
1546 
1547 
1548 /* Define USBX HCD API function constants.  */
1549 
1550 #define UX_HCD_DISABLE_CONTROLLER                                       1
1551 #define UX_HCD_GET_PORT_STATUS                                          2
1552 #define UX_HCD_ENABLE_PORT                                              3
1553 #define UX_HCD_DISABLE_PORT                                             4
1554 #define UX_HCD_POWER_ON_PORT                                            5
1555 #define UX_HCD_POWER_DOWN_PORT                                          6
1556 #define UX_HCD_SUSPEND_PORT                                             7
1557 #define UX_HCD_RESUME_PORT                                              8
1558 #define UX_HCD_RESET_PORT                                               9
1559 #define UX_HCD_GET_FRAME_NUMBER                                         10
1560 #define UX_HCD_SET_FRAME_NUMBER                                         11
1561 #define UX_HCD_TRANSFER_REQUEST                                         12
1562 #define UX_HCD_TRANSFER_RUN                                             12
1563 #define UX_HCD_TRANSFER_ABORT                                           13
1564 #define UX_HCD_CREATE_ENDPOINT                                          14
1565 #define UX_HCD_DESTROY_ENDPOINT                                         15
1566 #define UX_HCD_RESET_ENDPOINT                                           16
1567 #define UX_HCD_PROCESS_DONE_QUEUE                                       17
1568 #define UX_HCD_TASKS_RUN                                                17
1569 #define UX_HCD_UNINITIALIZE                                             18
1570 
1571 /* Define USBX DCD API function constants.  */
1572 
1573 #define UX_DCD_DISABLE_CONTROLLER                                       1
1574 #define UX_DCD_GET_PORT_STATUS                                          2
1575 #define UX_DCD_ENABLE_PORT                                              3
1576 #define UX_DCD_DISABLE_PORT                                             4
1577 #define UX_DCD_POWER_ON_PORT                                            5
1578 #define UX_DCD_POWER_DOWN_PORT                                          6
1579 #define UX_DCD_SUSPEND_PORT                                             7
1580 #define UX_DCD_RESUME_PORT                                              8
1581 #define UX_DCD_RESET_PORT                                               9
1582 #define UX_DCD_GET_FRAME_NUMBER                                         10
1583 #define UX_DCD_SET_FRAME_NUMBER                                         11
1584 #define UX_DCD_TRANSFER_REQUEST                                         12
1585 #define UX_DCD_TRANSFER_RUN                                             12
1586 #define UX_DCD_TRANSFER_ABORT                                           13
1587 #define UX_DCD_CREATE_ENDPOINT                                          14
1588 #define UX_DCD_DESTROY_ENDPOINT                                         15
1589 #define UX_DCD_RESET_ENDPOINT                                           16
1590 #define UX_DCD_SET_DEVICE_ADDRESS                                       17
1591 #define UX_DCD_ISR_PENDING                                              18
1592 #define UX_DCD_TASKS_RUN                                                18
1593 #define UX_DCD_CHANGE_STATE                                             19
1594 #define UX_DCD_STALL_ENDPOINT                                           20
1595 #define UX_DCD_ENDPOINT_STATUS                                          21
1596 
1597 
1598 /* Define USBX generic host controller constants.  */
1599 
1600 #define UX_HCD_STATUS_UNUSED                                            0
1601 #define UX_HCD_STATUS_HALTED                                            1
1602 #define UX_HCD_STATUS_OPERATIONAL                                       2
1603 #define UX_HCD_STATUS_DEAD                                              3
1604 
1605 /* Define USBX generic SLAVE controller constants.  */
1606 
1607 #define UX_DCD_STATUS_HALTED                                            0
1608 #define UX_DCD_STATUS_OPERATIONAL                                       1
1609 #define UX_DCD_STATUS_DEAD                                              2
1610 
1611 /* Define USBX  SLAVE controller VBUS constants.  */
1612 
1613 #define UX_DCD_VBUS_RESET                                               0
1614 #define UX_DCD_VBUS_SET                                                 1
1615 
1616 /* Define USBX class interface constants.  */
1617 
1618 #define UX_HOST_CLASS_COMMAND_QUERY                                     1
1619 #define UX_HOST_CLASS_COMMAND_ACTIVATE                                  2
1620 #define UX_HOST_CLASS_COMMAND_DEACTIVATE                                3
1621 #define UX_HOST_CLASS_COMMAND_DESTROY                                   4
1622 #define UX_HOST_CLASS_COMMAND_ACTIVATE_START                            UX_HOST_CLASS_COMMAND_ACTIVATE
1623 #define UX_HOST_CLASS_COMMAND_ACTIVATE_WAIT                             5
1624 
1625 #define UX_SLAVE_CLASS_COMMAND_QUERY                                    1
1626 #define UX_SLAVE_CLASS_COMMAND_ACTIVATE                                 2
1627 #define UX_SLAVE_CLASS_COMMAND_DEACTIVATE                               3
1628 #define UX_SLAVE_CLASS_COMMAND_REQUEST                                  4
1629 #define UX_SLAVE_CLASS_COMMAND_INITIALIZE                               5
1630 #define UX_SLAVE_CLASS_COMMAND_CHANGE                                   6
1631 #define UX_SLAVE_CLASS_COMMAND_UNINITIALIZE                             7
1632 
1633 #define UX_HOST_CLASS_COMMAND_USAGE_PIDVID                              1
1634 #define UX_HOST_CLASS_COMMAND_USAGE_CSP                                 2
1635 #define UX_HOST_CLASS_COMMAND_USAGE_DCSP                                3
1636 
1637 #define UX_HOST_CLASS_INSTANCE_FREE                                     0
1638 #define UX_HOST_CLASS_INSTANCE_LIVE                                     1
1639 #define UX_HOST_CLASS_INSTANCE_SHUTDOWN                                 2
1640 #define UX_HOST_CLASS_INSTANCE_MOUNTING                                 3
1641 
1642 
1643 /* Define USBX root HUB constants.  */
1644 
1645 #define UX_RH_ENUMERATION_RETRY                                         3
1646 #define UX_RH_ENUMERATION_RETRY_DELAY                                   100
1647 
1648 
1649 /* Define USBX PCI driver constants.  */
1650 
1651 #define UX_PCI_NB_FUNCTIONS                                             7
1652 #define UX_PCI_NB_DEVICE                                                32
1653 #define UX_PCI_NB_BUS                                                   0xff
1654 
1655 #define UX_PCI_CMD_IO_ENABLE                                            0x0001u
1656 #define UX_PCI_CMD_MEM_ENABLE                                           0x0002u
1657 #define UX_PCI_CMD_MASTER_ENABLE                                        0x0004u
1658 #define UX_PCI_CMD_MONITOR_ENABLE                                       0x0008u
1659 #define UX_PCI_CMD_MEM_WRITE_INV_ENABLE                                 0x0010u
1660 #define UX_PCI_CMD_SNOOP_PALETTE_ENABLE                                 0x0020u
1661 #define UX_PCI_CMD_PARITY_ERROR_ENABLE                                  0x0040u
1662 #define UX_PCI_CMD_WAIT_CYCLE_CTRL_ENABLE                               0x0080u
1663 #define UX_PCI_CMD_SERR_ENABLE                                          0x0100u
1664 #define UX_PCI_CMD_FBB_ENABLE                                           0x0200u
1665 
1666 #define UX_PCI_CFG_CTRL_ADDRESS                                         0x0cf8u
1667 #define UX_PCI_CFG_DATA_ADDRESS                                         0x0cfcu
1668 
1669 #define UX_PCI_CFG_VENDOR_ID                                            0x00
1670 #define UX_PCI_CFG_DEVICE_ID                                            0x02
1671 #define UX_PCI_CFG_COMMAND                                              0x04
1672 #define UX_PCI_CFG_STATUS                                               0x06
1673 #define UX_PCI_CFG_REVISION                                             0x08
1674 #define UX_PCI_CFG_PROGRAMMING_IF                                       0x09
1675 #define UX_PCI_CFG_SUBCLASS                                             0x0a
1676 #define UX_PCI_CFG_CLASS                                                0x0b
1677 #define UX_PCI_CFG_CACHE_LINE_SIZE                                      0x0c
1678 #define UX_PCI_CFG_LATENCY_TIMER                                        0x0d
1679 #define UX_PCI_CFG_HEADER_TYPE                                          0x0e
1680 #define UX_PCI_CFG_BIST                                                 0x0f
1681 #define UX_PCI_CFG_BASE_ADDRESS_0                                       0x10
1682 #define UX_PCI_CFG_BASE_ADDRESS_1                                       0x14
1683 #define UX_PCI_CFG_BASE_ADDRESS_2                                       0x18
1684 #define UX_PCI_CFG_BASE_ADDRESS_3                                       0x1c
1685 #define UX_PCI_CFG_BASE_ADDRESS_4                                       0x20
1686 #define UX_PCI_CFG_BASE_ADDRESS_5                                       0x24
1687 #define UX_PCI_CFG_CARDBUS_CIS                                          0x28
1688 #define UX_PCI_CFG_SUB_VENDOR_ID                                        0x2c
1689 #define UX_PCI_CFG_SUB_SYSTEM_ID                                        0x2e
1690 #define UX_PCI_CFG_EXPANSION_ROM_ADDRESS                                0x30
1691 #define UX_PCI_CFG_RESERVED_0                                           0x34
1692 #define UX_PCI_CFG_RESERVED_1                                           0x38
1693 #define UX_PCI_CFG_INT_LINE                                             0x3c
1694 #define UX_PCI_CFG_INT_PIN                                              0x3d
1695 #define UX_PCI_CFG_MIN_GNT                                              0x3e
1696 #define UX_PCI_CFG_MAX_LATENCY                                          0x3f
1697 
1698 #define UX_PCI_CFG_SBRN                                                 0x60
1699 #define UX_PCI_CFG_FLADJ                                                0x61
1700 
1701 /* Define DFU constants.  */
1702 #define UX_SYSTEM_DFU_STATE_APP_IDLE                                    0
1703 #define UX_SYSTEM_DFU_STATE_APP_DETACH                                  1
1704 #define UX_SYSTEM_DFU_STATE_DFU_IDLE                                    2
1705 #define UX_SYSTEM_DFU_STATE_DFU_DNLOAD_SYNC                             3
1706 #define UX_SYSTEM_DFU_STATE_DFU_DNBUSY                                  4
1707 #define UX_SYSTEM_DFU_STATE_DFU_DNLOAD_IDLE                             5
1708 #define UX_SYSTEM_DFU_STATE_DFU_MANIFEST_SYNC                           6
1709 #define UX_SYSTEM_DFU_STATE_DFU_MANIFEST                                7
1710 #define UX_SYSTEM_DFU_STATE_DFU_MANIFEST_WAIT_RESET                     8
1711 #define UX_SYSTEM_DFU_STATE_DFU_UPLOAD_IDLE                             9
1712 #define UX_SYSTEM_DFU_STATE_DFU_ERROR                                   10
1713 
1714 /* Define basic class constants.  */
1715 
1716 #define UX_HOST_CLASS_PRINTER_NAME_LENGTH                               64
1717 
1718 
1719 /* Define USBX 2.0 TT Instance structure.  */
1720 
1721 typedef struct UX_HUB_TT_STRUCT
1722 {
1723 
1724     ULONG           ux_hub_tt_port_mapping;
1725     ULONG           ux_hub_tt_max_bandwidth;
1726 } UX_HUB_TT;
1727 
1728 
1729 /* Define USBX Class calling command structure.  */
1730 
1731 typedef struct UX_HOST_CLASS_COMMAND_STRUCT
1732 {
1733 
1734     UINT            ux_host_class_command_request;
1735     VOID            *ux_host_class_command_container;
1736     VOID            *ux_host_class_command_instance;
1737     UINT            ux_host_class_command_usage;
1738     UINT            ux_host_class_command_pid;
1739     UINT            ux_host_class_command_vid;
1740     UINT            ux_host_class_command_class;
1741     UINT            ux_host_class_command_subclass;
1742     UINT            ux_host_class_command_protocol;
1743     UINT            ux_host_class_command_iad_class;
1744     UINT            ux_host_class_command_iad_subclass;
1745     UINT            ux_host_class_command_iad_protocol;
1746 
1747     struct UX_HOST_CLASS_STRUCT
1748                     *ux_host_class_command_class_ptr;
1749 } UX_HOST_CLASS_COMMAND;
1750 
1751 
1752 /* Define USBX Class container structure.  */
1753 
1754 typedef struct UX_HOST_CLASS_STRUCT
1755 {
1756 
1757 #if defined(UX_NAME_REFERENCED_BY_POINTER)
1758     const UCHAR     *ux_host_class_name;
1759 #else
1760     UCHAR           ux_host_class_name[UX_MAX_CLASS_NAME_LENGTH + 1]; /* "+1" for string null-terminator */
1761 #endif
1762 
1763 #if defined(UX_HOST_STANDALONE)
1764     UINT            (*ux_host_class_task_function)(struct UX_HOST_CLASS_STRUCT *);
1765 #endif
1766 
1767     UINT            ux_host_class_status;
1768     UINT            (*ux_host_class_entry_function) (struct UX_HOST_CLASS_COMMAND_STRUCT *);
1769     VOID            *ux_host_class_first_instance;
1770     VOID            *ux_host_class_client;
1771     VOID            *ux_host_class_media;
1772     VOID            *ux_host_class_ext;
1773 
1774 } UX_HOST_CLASS;
1775 
1776 
1777 /* Define USBX transfer request structure.  */
1778 
1779 typedef struct UX_TRANSFER_STRUCT
1780 {
1781 
1782     ULONG           ux_transfer_request_status;
1783     struct UX_ENDPOINT_STRUCT
1784                     *ux_transfer_request_endpoint;
1785     UCHAR *         ux_transfer_request_data_pointer;
1786     ULONG           ux_transfer_request_requested_length;
1787     ULONG           ux_transfer_request_actual_length;
1788     UINT            ux_transfer_request_type;
1789     UINT            ux_transfer_request_function;
1790     UINT            ux_transfer_request_value;
1791     UINT            ux_transfer_request_index;
1792     VOID            (*ux_transfer_request_completion_function) (struct UX_TRANSFER_STRUCT *);
1793     VOID            *ux_transfer_request_class_instance;
1794     ULONG           ux_transfer_request_maximum_length;
1795     ULONG           ux_transfer_request_timeout_value;
1796     UINT            ux_transfer_request_completion_code;
1797     ULONG           ux_transfer_request_packet_length;
1798     struct UX_TRANSFER_STRUCT
1799                     *ux_transfer_request_next_transfer_request;
1800     VOID            *ux_transfer_request_user_specific;
1801 #if !defined(UX_HOST_STANDALONE)
1802     UX_SEMAPHORE    ux_transfer_request_semaphore;
1803     UX_THREAD       *ux_transfer_request_thread_pending;
1804 #else
1805     UINT            ux_transfer_request_state;
1806     ULONG           ux_transfer_request_time_start;
1807     ULONG           ux_transfer_request_flags;
1808     struct UX_TRANSFER_STRUCT
1809                     *ux_transfer_request_next_pending;
1810 #endif
1811 } UX_TRANSFER;
1812 
1813 #if defined(UX_HOST_STANDALONE)
1814 #define UX_TRANSFER_STATE_RESET(tr)             ((tr)->ux_transfer_request_state = UX_STATE_RESET)
1815 #define UX_TRANSFER_STATE_IDLE(tr)              ((tr)->ux_transfer_request_state = UX_STATE_IDLE)
1816 #define UX_TRANSFER_STATE_IS_BUSY(tr)           UX_STATE_IS_BUSY((tr)->ux_transfer_request_state)
1817 #define UX_TRANSFER_STATE_IS_IDLE(tr)           ((tr)->ux_transfer_request_state == UX_STATE_IDLE)
1818 
1819 #define UX_TRANSFER_FLAGS_RESET(tr)             ((tr)->ux_transfer_request_flags = 0)
1820 #define UX_TRANSFER_FLAG_LOCK                   (0x1u << 0)
1821 #define UX_TRANSFER_FLAG_AUTO_WAIT              (0x1u << 1) /* Wait until transfer done.  */
1822 #define UX_TRANSFER_FLAG_AUTO_DEVICE_UNLOCK     (0x1u << 2) /* In wait case, unlock device after transfer done.  */
1823 #endif
1824 
1825 
1826 /* Define USBX Endpoint Descriptor structure.  */
1827 
1828 typedef struct UX_ENDPOINT_DESCRIPTOR_STRUCT
1829 {
1830 
1831     UCHAR           bLength;
1832     UCHAR           bDescriptorType;
1833     UCHAR           bEndpointAddress;
1834     UCHAR           bmAttributes;
1835     USHORT          wMaxPacketSize;
1836     UCHAR           bInterval;
1837     UCHAR           _align_size[1];
1838 } UX_ENDPOINT_DESCRIPTOR;
1839 
1840 #define UX_ENDPOINT_DESCRIPTOR_ENTRIES                                  6
1841 #define UX_ENDPOINT_DESCRIPTOR_LENGTH                                   7
1842 
1843 
1844 /* Define USBX Endpoint Container structure.  */
1845 
1846 typedef struct UX_ENDPOINT_STRUCT
1847 {
1848 
1849     ULONG           ux_endpoint;
1850     ULONG           ux_endpoint_state;
1851     void            *ux_endpoint_ed;
1852     struct UX_ENDPOINT_DESCRIPTOR_STRUCT
1853                     ux_endpoint_descriptor;
1854     struct UX_ENDPOINT_STRUCT
1855                     *ux_endpoint_next_endpoint;
1856     struct UX_INTERFACE_STRUCT
1857                     *ux_endpoint_interface;
1858     struct UX_DEVICE_STRUCT
1859                     *ux_endpoint_device;
1860     struct UX_TRANSFER_STRUCT
1861                     ux_endpoint_transfer_request;
1862 } UX_ENDPOINT;
1863 
1864 
1865 /* Define USBX Device Descriptor structure.  */
1866 
1867 typedef struct UX_DEVICE_DESCRIPTOR_STRUCT
1868 {
1869 
1870     UCHAR           bLength;
1871     UCHAR           bDescriptorType;
1872     USHORT          bcdUSB;
1873     UCHAR           bDeviceClass;
1874     UCHAR           bDeviceSubClass;
1875     UCHAR           bDeviceProtocol;
1876     UCHAR           bMaxPacketSize0;
1877     USHORT          idVendor;
1878     USHORT          idProduct;
1879     USHORT          bcdDevice;
1880     UCHAR           iManufacturer;
1881     UCHAR           iProduct;
1882     UCHAR           iSerialNumber;
1883     UCHAR           bNumConfigurations;
1884     UCHAR           _align_size[2];
1885 } UX_DEVICE_DESCRIPTOR;
1886 
1887 #define UX_DEVICE_DESCRIPTOR_ENTRIES                                    14
1888 #define UX_DEVICE_DESCRIPTOR_LENGTH                                     18
1889 
1890 
1891 /* Define USBX Device Qualifier Descriptor structure.  */
1892 
1893 typedef struct UX_DEVICE_QUALIFIER_DESCRIPTOR_STRUCT
1894 {
1895 
1896     UCHAR           bLength;
1897     UCHAR           bDescriptorType;
1898     USHORT          bcdUSB;
1899     UCHAR           bDeviceClass;
1900     UCHAR           bDeviceSubClass;
1901     UCHAR           bDeviceProtocol;
1902     UCHAR           bMaxPacketSize0;
1903     UCHAR           bNumConfigurations;
1904     UCHAR           bReserved;
1905     UCHAR           _align_size[2];
1906 } UX_DEVICE_QUALIFIER_DESCRIPTOR;
1907 
1908 #define UX_DEVICE_QUALIFIER_DESCRIPTOR_ENTRIES                          9
1909 #define UX_DEVICE_QUALIFIER_DESCRIPTOR_LENGTH                           10
1910 
1911 
1912 /* Define USBX Other Speed Descriptor structure.  */
1913 
1914 typedef struct UX_OTHER_SPEED_DESCRIPTOR_STRUCT
1915 {
1916 
1917     UCHAR           bLength;
1918     UCHAR           bDescriptorType;
1919     USHORT          wTotalLength;
1920     UCHAR           bNumInterfaces;
1921     UCHAR           bConfigurationValue;
1922     UCHAR           iConfiguration;
1923     UCHAR           bmAttributes;
1924     ULONG           MaxPower;
1925 } UX_OTHER_SPEED_DESCRIPTOR;
1926 
1927 #define UX_OTHER_SPEED_DESCRIPTOR_ENTRIES                               8
1928 #define UX_OTHER_SPEED_DESCRIPTOR_LENGTH                                9
1929 
1930 
1931 /* Define USBX OTG Descriptor structure.  */
1932 
1933 typedef struct UX_OTG_DESCRIPTOR_STRUCT
1934 {
1935 
1936     UCHAR           bLength;
1937     UCHAR           bDescriptorType;
1938     UCHAR           bmAttributes;
1939     UCHAR           _align_bcdOTG[1];
1940     USHORT          bcdOTG;
1941     UCHAR           _algin_size[2];
1942 } UX_OTG_DESCRIPTOR;
1943 
1944 #define UX_OTG_DESCRIPTOR_ENTRIES                          4
1945 #define UX_OTG_DESCRIPTOR_LENGTH                           5
1946 
1947 
1948 /* Define USBX Interface Association Descriptor structure.  */
1949 
1950 typedef struct UX_INTERFACE_ASSOCIATION_DESCRIPTOR_STRUCT
1951 {
1952 
1953     UCHAR           bLength;
1954     UCHAR           bDescriptorType;
1955     UCHAR           bFirstInterface;
1956     UCHAR           bInterfaceCount;
1957     UCHAR           bFunctionClass;
1958     UCHAR           bFunctionSubClass;
1959     UCHAR           bFunctionProtocol;
1960     UCHAR           iFunction;
1961 } UX_INTERFACE_ASSOCIATION_DESCRIPTOR;
1962 
1963 #define UX_INTERFACE_ASSOCIATION_DESCRIPTOR_ENTRIES         8
1964 #define UX_INTERFACE_ASSOCIATION_DESCRIPTOR_LENGTH          8
1965 
1966 
1967 /* Define USBX Device Container structure.  */
1968 
1969 typedef struct UX_DEVICE_STRUCT
1970 {
1971 
1972     ULONG           ux_device_handle;
1973     ULONG           ux_device_type;
1974     ULONG           ux_device_state;
1975     ULONG           ux_device_address;
1976     ULONG           ux_device_speed;
1977     ULONG           ux_device_power_source;
1978     struct UX_CONFIGURATION_STRUCT
1979                     *ux_device_current_configuration;
1980     UCHAR           *ux_device_packed_configuration;
1981     ULONG           ux_device_packed_configuration_keep_count;
1982 #if !defined(UX_HOST_STANDALONE)
1983     UX_SEMAPHORE    ux_device_protection_semaphore;
1984 #endif
1985     struct UX_HOST_CLASS_STRUCT
1986                     *ux_device_class;
1987     VOID            *ux_device_class_instance;
1988     struct UX_CONFIGURATION_STRUCT
1989                     *ux_device_first_configuration;
1990     struct UX_DEVICE_DESCRIPTOR_STRUCT
1991                     ux_device_descriptor;
1992     struct UX_ENDPOINT_STRUCT
1993                     ux_device_control_endpoint;
1994     ULONG           ux_device_port_location;
1995 #if UX_MAX_HCD > 1
1996     struct UX_HCD_STRUCT
1997                     *ux_device_hcd;
1998 #endif
1999 #if UX_MAX_DEVICES > 1
2000     struct UX_DEVICE_STRUCT
2001                     *ux_device_parent;
2002     ULONG           ux_device_max_power;
2003     struct UX_HUB_TT_STRUCT
2004                     ux_device_hub_tt[UX_MAX_TT];
2005 #endif
2006 
2007 #if defined(UX_HOST_STANDALONE)
2008     ULONG           ux_device_flags;
2009 
2010     struct UX_DEVICE_STRUCT
2011                     *ux_device_enum_next;
2012     struct UX_TRANSFER_STRUCT
2013                     *ux_device_enum_trans;
2014     union {
2015         struct UX_DEVICE_STRUCT
2016                     *device;
2017         struct UX_CONFIGURATION_STRUCT
2018                     *configuration;
2019         struct UX_INTERFACE_STRUCT
2020                     *interface;
2021         VOID        *ptr;
2022     }               ux_device_enum_inst;
2023 
2024     ULONG           ux_device_enum_wait_start;
2025     ULONG           ux_device_enum_wait_ms;
2026 
2027     UCHAR           ux_device_enum_state;
2028     UCHAR           ux_device_dbg_state;
2029     UCHAR           ux_device_enum_next_state;
2030     UCHAR           ux_device_enum_retry;
2031     UCHAR           ux_device_enum_port_status;
2032     UCHAR           ux_device_enum_index;
2033     UCHAR           reserved[2];
2034     ULONG           ux_device_dbg_state_count;
2035 #endif
2036 
2037 } UX_DEVICE;
2038 
2039 #if defined(UX_HOST_STANDALONE)
2040 #define UX_DEVICE_FLAG_LOCK                     0x01u
2041 #define UX_DEVICE_FLAG_RESET                    0x02u
2042 #define UX_DEVICE_FLAG_ENUM                     0x04u
2043 #define UX_DEVICE_FLAG_PROTECT                  0x08u
2044 #endif
2045 
2046 #if UX_MAX_HCD > 1
2047 #define UX_DEVICE_HCD_GET(d)                    ((d)->ux_device_hcd)
2048 #define UX_DEVICE_HCD_SET(d,h)                  do { (d)->ux_device_hcd = (h); } while(0)
2049 #define UX_DEVICE_HCD_MATCH(d,h)                ((d)->ux_device_hcd == (h))
2050 #else
2051 #define UX_DEVICE_HCD_GET(d)                    (_ux_system_host->ux_system_host_hcd_array)
2052 #define UX_DEVICE_HCD_SET(d,h)
2053 #define UX_DEVICE_HCD_MATCH(d,h)                (_ux_system_host->ux_system_host_hcd_array == (h))
2054 #endif
2055 
2056 
2057 #if UX_MAX_DEVICES > 1
2058 #define UX_DEVICE_PARENT_GET(d)                 ((d)->ux_device_parent)
2059 #define UX_DEVICE_PARENT_SET(d,p)               do { (d)->ux_device_parent = (p); } while(0)
2060 #define UX_DEVICE_PARENT_MATCH(d,p)             ((d)->ux_device_parent == (p))
2061 #define UX_DEVICE_PARENT_IS_HUB(d)              ((d)->ux_device_parent != UX_NULL)
2062 #define UX_DEVICE_PARENT_IS_ROOTHUB(d)          ((d)->ux_device_parent == UX_NULL)
2063 #define UX_DEVICE_MAX_POWER_GET(d)              ((d)->ux_device_max_power)
2064 #define UX_DEVICE_MAX_POWER_SET(d,p)            do {(d)->ux_device_max_power = (p); } while(0)
2065 #else
2066 #define UX_DEVICE_PARENT_GET(d)                 (UX_NULL)
2067 #define UX_DEVICE_PARENT_SET(d,p)               UX_PARAMETER_NOT_USED(p)
2068 #define UX_DEVICE_PARENT_MATCH(d,p)             ((p) == UX_NULL)
2069 #define UX_DEVICE_PARENT_IS_HUB(d)              (UX_FALSE)
2070 #define UX_DEVICE_PARENT_IS_ROOTHUB(d)          (UX_TRUE)
2071 #define UX_DEVICE_MAX_POWER_GET(d)              (UX_MAX_SELF_POWER)
2072 #define UX_DEVICE_MAX_POWER_SET(d,p)            UX_PARAMETER_NOT_USED(p)
2073 #endif
2074 #define UX_DEVICE_PORT_LOCATION_GET(d)          ((d)->ux_device_port_location)
2075 #define UX_DEVICE_PORT_LOCATION_SET(d,l)        do { (d)->ux_device_port_location = (l); } while(0)
2076 #define UX_DEVICE_PORT_LOCATION_MATCH(d,l)      ((d)->ux_device_port_location == (l))
2077 
2078 
2079 /* Define USBX Configuration Descriptor structure.  */
2080 
2081 typedef struct UX_CONFIGURATION_DESCRIPTOR_STRUCT
2082 {
2083 
2084     UCHAR           bLength;
2085     UCHAR           bDescriptorType;
2086     USHORT          wTotalLength;
2087     UCHAR           bNumInterfaces;
2088     UCHAR           bConfigurationValue;
2089     UCHAR           iConfiguration;
2090     UCHAR           bmAttributes;
2091     ULONG           MaxPower;
2092 } UX_CONFIGURATION_DESCRIPTOR;
2093 
2094 
2095 #define UX_CONFIGURATION_DESCRIPTOR_ENTRIES                             8
2096 #define UX_CONFIGURATION_DESCRIPTOR_LENGTH                              9
2097 
2098 
2099 /* Define USBX Configuration Container structure.  */
2100 
2101 typedef struct UX_CONFIGURATION_STRUCT
2102 {
2103 
2104     ULONG           ux_configuration_handle;
2105     ULONG           ux_configuration_state;
2106     ULONG           ux_configuration_otg_capabilities;
2107     struct UX_CONFIGURATION_DESCRIPTOR_STRUCT
2108                     ux_configuration_descriptor;
2109     struct UX_INTERFACE_STRUCT
2110                     *ux_configuration_first_interface;
2111     struct UX_CONFIGURATION_STRUCT
2112                     *ux_configuration_next_configuration;
2113     struct UX_DEVICE_STRUCT
2114                     *ux_configuration_device;
2115     ULONG           ux_configuration_iad_class;
2116     ULONG           ux_configuration_iad_subclass;
2117     ULONG           ux_configuration_iad_protocol;
2118 } UX_CONFIGURATION;
2119 
2120 #define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_ALL     0 /* Default: all things created.  */
2121 #define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED   1 /* Owned: class owned things created.  */
2122 #ifndef UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL
2123 #define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_ALL
2124 #endif
2125 
2126 
2127 /* Define USBX Interface Descriptor structure.  */
2128 
2129 typedef struct UX_INTERFACE_DESCRIPTOR_STRUCT
2130 {
2131 
2132     UCHAR           bLength;
2133     UCHAR           bDescriptorType;
2134     UCHAR           bInterfaceNumber;
2135     UCHAR           bAlternateSetting;
2136     UCHAR           bNumEndpoints;
2137     UCHAR           bInterfaceClass;
2138     UCHAR           bInterfaceSubClass;
2139     UCHAR           bInterfaceProtocol;
2140     UCHAR           iInterface;
2141     UCHAR           _align_size[3];
2142 } UX_INTERFACE_DESCRIPTOR;
2143 
2144 #define UX_INTERFACE_DESCRIPTOR_ENTRIES                                 9
2145 #define UX_INTERFACE_DESCRIPTOR_LENGTH                                  9
2146 
2147 
2148 /* Define USBX Interface Container structure.  */
2149 
2150 typedef struct UX_INTERFACE_STRUCT
2151 {
2152 
2153     ULONG           ux_interface_handle;
2154     ULONG           ux_interface_state;
2155     UINT            ux_interface_current_alternate_setting;
2156     struct UX_INTERFACE_DESCRIPTOR_STRUCT
2157                     ux_interface_descriptor;
2158     struct UX_HOST_CLASS_STRUCT
2159                     *ux_interface_class;
2160     VOID            *ux_interface_class_instance;
2161     struct UX_ENDPOINT_STRUCT
2162                     *ux_interface_first_endpoint;
2163     struct UX_INTERFACE_STRUCT
2164                     *ux_interface_next_interface;
2165     struct UX_CONFIGURATION_STRUCT
2166                     *ux_interface_configuration;
2167     ULONG           ux_interface_iad_class;
2168     ULONG           ux_interface_iad_subclass;
2169     ULONG           ux_interface_iad_protocol;
2170 
2171 } UX_INTERFACE;
2172 
2173 
2174 /* Define USBX String Descriptor structure.  */
2175 
2176 typedef struct UX_STRING_DESCRIPTOR_STRUCT
2177 {
2178 
2179     UCHAR           bLength;
2180     UCHAR           bDescriptorType;
2181     UCHAR           bString[2];
2182 } UX_STRING_DESCRIPTOR;
2183 
2184 #define UX_STRING_DESCRIPTOR_ENTRIES                                    3
2185 #define UX_STRING_DESCRIPTOR_LENGTH                                     4
2186 
2187 
2188 /* Define USBX BOS Descriptor structure.  */
2189 
2190 typedef struct UX_BOS_DESCRIPTOR_STRUCT
2191 {
2192     UCHAR           bLength;
2193     UCHAR           bDescriptorType;
2194     USHORT          wTotalLength;
2195     UCHAR           bNumDeviceCaps;
2196     UCHAR           _align_size[3];
2197 } UX_BOS_DESCRIPTOR;
2198 
2199 #define UX_BOS_DESCRIPTOR_ENTRIES                                       4
2200 #define UX_BOS_DESCRIPTOR_LENGTH                                        5
2201 
2202 
2203 /* Define USBX USB 2.0 Descriptor structure.  */
2204 
2205 typedef struct UX_USB_2_0_EXTENSION_DESCRIPTOR_STRUCT
2206 {
2207     UCHAR           bLength;
2208     UCHAR           bDescriptorType;
2209     UCHAR           bDevCapabilityType;
2210     UCHAR           _align_bmAttributes[1];
2211     ULONG           bmAttributes;
2212 } UX_USB_2_0_EXTENSION_DESCRIPTOR;
2213 
2214 #define UX_USB_2_0_EXTENSION_DESCRIPTOR_ENTRIES                         4
2215 #define UX_USB_2_0_EXTENSION_DESCRIPTOR_LENGTH                          7
2216 
2217 
2218 /* Define USBX Container ID Descriptor structure.  */
2219 
2220 typedef struct UX_CONTAINER_ID_DESCRIPTOR_STRUCT
2221 {
2222     UCHAR           bLength;
2223     UCHAR           bDescriptorType;
2224     UCHAR           bDevCapabilityType;
2225     UCHAR           bReserved;
2226     ULONG           ContainerID[4];
2227 } UX_CONTAINER_ID_DESCRIPTOR;
2228 
2229 #define UX_CONTAINER_ID_DESCRIPTOR_ENTRIES                              8
2230 #define UX_CONTAINER_ID_DESCRIPTOR_LENGTH                               20
2231 
2232 
2233 /* Define USBX DFU functional descriptor.  */
2234 
2235 typedef struct UX_DFU_FUNCTIONAL_DESCRIPTOR_STRUCT
2236 {
2237 
2238     UCHAR           bLength;
2239     UCHAR           bDescriptorType;
2240     UCHAR           bmAttributes;
2241     UCHAR           _align_wDetachTimeOut[1];
2242     USHORT          wDetachTimeOut;
2243     USHORT          wTransferSize;
2244     USHORT          bcdDFUVersion;
2245     UCHAR           _align_size[2];
2246 } UX_DFU_FUNCTIONAL_DESCRIPTOR;
2247 
2248 #define UX_DFU_FUNCTIONAL_DESCRIPTOR_ENTRIES                            6
2249 #define UX_DFU_FUNCTIONAL_DESCRIPTOR_LENGTH                             9
2250 
2251 
2252 /* Define USBX Host Controller structure.  */
2253 
2254 typedef struct UX_HCD_STRUCT
2255 {
2256 
2257 #if defined(UX_NAME_REFERENCED_BY_POINTER)
2258     const UCHAR     *ux_hcd_name;
2259 #else
2260     UCHAR           ux_hcd_name[UX_MAX_HCD_NAME_LENGTH + 1]; /* "+1" for string null-terminator */
2261 #endif
2262 
2263     UINT            ux_hcd_status;
2264     UINT            ux_hcd_controller_type;
2265     UINT            ux_hcd_irq;
2266     UINT            ux_hcd_nb_root_hubs;
2267     UINT            ux_hcd_root_hub_signal[UX_MAX_ROOTHUB_PORT];
2268     UINT            ux_hcd_nb_devices;
2269     UINT            ux_hcd_thread_signal;
2270     ULONG           ux_hcd_rh_device_connection;
2271     ULONG           ux_hcd_io;
2272     UINT            (*ux_hcd_entry_function) (struct UX_HCD_STRUCT *, UINT, VOID *);
2273     void            *ux_hcd_controller_hardware;
2274 
2275 #if defined(UX_OTG_SUPPORT)
2276     UINT            ux_hcd_otg_capabilities;
2277 #endif
2278 
2279 #if UX_MAX_DEVICES > 1
2280     UCHAR           ux_hcd_address[16];
2281     UINT            ux_hcd_power_switch;
2282     ULONG           ux_hcd_available_bandwidth;
2283     ULONG           ux_hcd_version;
2284 #endif
2285 
2286 #if defined(UX_HOST_STANDALONE)
2287     ULONG           ux_hcd_flags;
2288 #endif
2289 } UX_HCD;
2290 
2291 
2292 /* Define USBX Device Transfer Request structure.  */
2293 
2294 typedef struct UX_SLAVE_TRANSFER_STRUCT
2295 {
2296 
2297     ULONG           ux_slave_transfer_request_status;
2298     ULONG           ux_slave_transfer_request_type;
2299     struct UX_SLAVE_ENDPOINT_STRUCT
2300                     *ux_slave_transfer_request_endpoint;
2301     UCHAR           *ux_slave_transfer_request_data_pointer;
2302     UCHAR           *ux_slave_transfer_request_current_data_pointer;
2303     ULONG           ux_slave_transfer_request_requested_length;
2304     ULONG           ux_slave_transfer_request_actual_length;
2305     ULONG           ux_slave_transfer_request_in_transfer_length;
2306     ULONG           ux_slave_transfer_request_transfer_length;
2307     ULONG           ux_slave_transfer_request_completion_code;
2308     ULONG           ux_slave_transfer_request_phase;
2309     VOID            (*ux_slave_transfer_request_completion_function) (struct UX_SLAVE_TRANSFER_STRUCT *);
2310 #if defined(UX_DEVICE_STANDALONE)
2311     ULONG           ux_slave_transfer_request_state;
2312 #else
2313     UX_SEMAPHORE    ux_slave_transfer_request_semaphore;
2314 #endif
2315     ULONG           ux_slave_transfer_request_timeout;
2316     ULONG           ux_slave_transfer_request_force_zlp;
2317     UCHAR           ux_slave_transfer_request_setup[UX_SETUP_SIZE];
2318     ULONG           ux_slave_transfer_request_status_phase_ignore;
2319 } UX_SLAVE_TRANSFER;
2320 
2321 #if defined(UX_DEVICE_STANDALONE)
2322 #define UX_SLAVE_TRANSFER_STATE_RESET(tr) ((tr)->ux_slave_transfer_request_state = UX_STATE_RESET)
2323 #endif
2324 
2325 
2326 /* Define USBX Device Controller Endpoint structure.  */
2327 
2328 typedef struct UX_SLAVE_ENDPOINT_STRUCT
2329 {
2330 
2331     ULONG           ux_slave_endpoint_status;
2332     ULONG           ux_slave_endpoint_state;
2333     void            *ux_slave_endpoint_ed;
2334     struct UX_ENDPOINT_DESCRIPTOR_STRUCT
2335                     ux_slave_endpoint_descriptor;
2336     struct UX_SLAVE_ENDPOINT_STRUCT
2337                     *ux_slave_endpoint_next_endpoint;
2338     struct UX_SLAVE_INTERFACE_STRUCT
2339                     *ux_slave_endpoint_interface;
2340     struct UX_SLAVE_DEVICE_STRUCT
2341                     *ux_slave_endpoint_device;
2342     struct UX_SLAVE_TRANSFER_STRUCT
2343                     ux_slave_endpoint_transfer_request;
2344 } UX_SLAVE_ENDPOINT;
2345 
2346 
2347 /* Define USBX Device Controller Interface structure.  */
2348 
2349 typedef struct UX_SLAVE_INTERFACE_STRUCT
2350 {
2351     ULONG           ux_slave_interface_status;
2352     struct UX_SLAVE_CLASS_STRUCT
2353                     *ux_slave_interface_class;
2354     VOID            *ux_slave_interface_class_instance;
2355 
2356     struct UX_INTERFACE_DESCRIPTOR_STRUCT
2357                     ux_slave_interface_descriptor;
2358     struct UX_SLAVE_INTERFACE_STRUCT
2359                     *ux_slave_interface_next_interface;
2360     struct UX_SLAVE_ENDPOINT_STRUCT
2361                     *ux_slave_interface_first_endpoint;
2362 } UX_SLAVE_INTERFACE;
2363 
2364 
2365 /* Define USBX Device Controller structure.  */
2366 
2367 typedef struct UX_SLAVE_DEVICE_STRUCT
2368 {
2369 
2370     ULONG           ux_slave_device_state;
2371     struct UX_DEVICE_DESCRIPTOR_STRUCT
2372                     ux_slave_device_descriptor;
2373     struct UX_SLAVE_ENDPOINT_STRUCT
2374                     ux_slave_device_control_endpoint;
2375     ULONG           ux_slave_device_configuration_selected;
2376     struct UX_CONFIGURATION_DESCRIPTOR_STRUCT
2377                     ux_slave_device_configuration_descriptor;
2378     struct UX_SLAVE_INTERFACE_STRUCT
2379                     *ux_slave_device_first_interface;
2380     struct UX_SLAVE_INTERFACE_STRUCT
2381                     *ux_slave_device_interfaces_pool;
2382     ULONG           ux_slave_device_interfaces_pool_number;
2383     struct UX_SLAVE_ENDPOINT_STRUCT
2384                     *ux_slave_device_endpoints_pool;
2385     ULONG           ux_slave_device_endpoints_pool_number;
2386     ULONG           ux_slave_device_power_state;
2387 
2388 } UX_SLAVE_DEVICE;
2389 
2390 
2391 /* Define USBX Device Controller structure.  */
2392 
2393 typedef struct UX_SLAVE_DCD_STRUCT
2394 {
2395 
2396     UINT            ux_slave_dcd_status;
2397     UINT            ux_slave_dcd_controller_type;
2398     UINT            ux_slave_dcd_otg_capabilities;
2399     UINT            ux_slave_dcd_irq;
2400     ULONG           ux_slave_dcd_io;
2401     ULONG           ux_slave_dcd_device_address;
2402     UINT            (*ux_slave_dcd_function) (struct UX_SLAVE_DCD_STRUCT *,UINT, VOID *);
2403     void            *ux_slave_dcd_controller_hardware;
2404 
2405 #if defined(UX_DEVICE_STANDALONE)
2406     UINT            (*ux_device_dcd_task_function)(struct UX_SLAVE_DCD_STRUCT *);
2407 #endif
2408 
2409 } UX_SLAVE_DCD;
2410 
2411 /* Define USBX Device Class Command container structure.  */
2412 
2413 typedef struct UX_SLAVE_CLASS_COMMAND_STRUCT
2414 {
2415 
2416     UINT            ux_slave_class_command_request;
2417     VOID            *ux_slave_class_command_container;
2418     VOID            *ux_slave_class_command_interface;
2419     UINT            ux_slave_class_command_pid;
2420     UINT            ux_slave_class_command_vid;
2421     UINT            ux_slave_class_command_class;
2422     UINT            ux_slave_class_command_subclass;
2423     UINT            ux_slave_class_command_protocol;
2424     struct UX_SLAVE_CLASS_STRUCT
2425                     *ux_slave_class_command_class_ptr;
2426     VOID            *ux_slave_class_command_parameter;
2427     VOID            *ux_slave_class_command_interface_number;
2428 
2429 } UX_SLAVE_CLASS_COMMAND;
2430 
2431 
2432 /* Define USBX Device Class container structure.  */
2433 
2434 typedef struct UX_SLAVE_CLASS_STRUCT
2435 {
2436 
2437 #if defined(UX_NAME_REFERENCED_BY_POINTER)
2438     const UCHAR     *ux_slave_class_name;
2439 #else
2440     UCHAR           ux_slave_class_name[UX_MAX_CLASS_NAME_LENGTH + 1]; /* "+1" for string null-terminator */
2441 #endif
2442 
2443     UINT            ux_slave_class_status;
2444     UINT            (*ux_slave_class_entry_function) (struct UX_SLAVE_CLASS_COMMAND_STRUCT *);
2445     VOID            *ux_slave_class_instance;
2446     VOID            *ux_slave_class_client;
2447 #if !defined(UX_DEVICE_STANDALONE)
2448     UX_THREAD       ux_slave_class_thread;
2449     VOID            *ux_slave_class_thread_stack;
2450 #else
2451     UINT            (*ux_slave_class_task_function)(VOID *class_instance);
2452 #endif
2453     VOID            *ux_slave_class_interface_parameter;
2454     ULONG           ux_slave_class_interface_number;
2455     ULONG           ux_slave_class_configuration_number;
2456     struct UX_SLAVE_INTERFACE_STRUCT
2457                     *ux_slave_class_interface;
2458 
2459 } UX_SLAVE_CLASS;
2460 
2461 #define UX_UCHAR_POINTER_ADD(a,b)                       (((UCHAR *) (a)) + ((UINT) (b)))
2462 #define UX_UCHAR_POINTER_SUB(a,b)                       (((UCHAR *) (a)) - ((UINT) (b)))
2463 #define UX_UCHAR_POINTER_DIF(a,b)                       ((ULONG)(((UCHAR *) (a)) - ((UCHAR *) (b))))
2464 #define UX_ULONG_POINTER_ADD(a,b)                       (((ULONG *) (a)) + ((UINT) (b)))
2465 #define UX_ULONG_POINTER_SUB(a,b)                       (((ULONG *) (a)) - ((UINT) (b)))
2466 #define UX_ULONG_POINTER_DIF(a,b)                       ((ULONG)(((ULONG *) (a)) - ((ULONG *) (b))))
2467 #define UX_POINTER_TO_ULONG_CONVERT(a)                  ((ULONG) ((VOID *) (a)))
2468 #define UX_ULONG_TO_POINTER_CONVERT(a)                  ((VOID *) ((ULONG) (a)))
2469 #define UX_POINTER_TO_ALIGN_TYPE_CONVERT(a)             ((ALIGN_TYPE) ((VOID *) (a)))
2470 #define UX_ALIGN_TYPE_TO_POINTER_CONVERT(a)             ((VOID *) ((ALIGN_TYPE) (a)))
2471 #define UX_LOOP_FOREVER                                 ((UINT) 1)
2472 #define UX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(a)    ((UCHAR **) ((VOID *) (a)))
2473 #define UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(a)   ((UCHAR **) ((VOID *) (a)))
2474 #define UX_VOID_TO_UCHAR_POINTER_CONVERT(a)             ((UCHAR *) ((VOID *) (a)))
2475 #define UX_VOID_TO_INDIRECT_UCHAR_POINTER_CONVERT(a)    ((UCHAR **) ((VOID *) (a)))
2476 #define UX_VOID_TO_BYTE_POOL_POINTER_CONVERT(a)         ((UX_MEMORY_BYTE_POOL *) ((VOID *) (a)))
2477 #define UX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(a)        ((UCHAR *) ((VOID *) (a)))
2478 #ifndef UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT
2479 #define UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(a)       ((ALIGN_TYPE *) ((VOID *) (a)))
2480 #endif
2481 #define UX_UCHAR_TO_INDIRECT_BYTE_POOL_POINTER(a)       ((UX_MEMORY_BYTE_POOL **) ((VOID *) (a)))
2482 #define UX_MEMORY_BLOCK_HEADER_SIZE                     (sizeof(UCHAR *) + sizeof(ALIGN_TYPE))
2483 
2484 #ifndef UX_BYTE_BLOCK_FREE
2485 #define UX_BYTE_BLOCK_FREE                              ((ULONG) 0xFFFFEEEEUL)
2486 #endif
2487 
2488 #ifndef UX_BYTE_BLOCK_MIN
2489 #define UX_BYTE_BLOCK_MIN                               ((ULONG) 20)
2490 #endif
2491 
2492 /* Define USBX Memory Management structure.  */
2493 
2494 typedef struct UX_MEMORY_BYTE_POOL_STRUCT
2495 {
2496 
2497     /* Define the number of available bytes in the pool.  */
2498     ULONG           ux_byte_pool_available;
2499 
2500     /* Define the number of fragments in the pool.  */
2501     UINT            ux_byte_pool_fragments;
2502 
2503     /* Define the search pointer used for initial searching for memory in a byte pool.  */
2504     UCHAR           *ux_byte_pool_search;
2505 
2506     /* Save the start address of the byte pool's memory area.  */
2507     UCHAR           *ux_byte_pool_start;
2508 
2509     /* Save the byte pool's size in bytes.  */
2510     ULONG           ux_byte_pool_size;
2511 
2512 #ifdef UX_ENABLE_MEMORY_STATISTICS
2513     ALIGN_TYPE      ux_byte_pool_min_free;
2514     ULONG           ux_byte_pool_alloc_count;
2515     ULONG           ux_byte_pool_alloc_total;
2516     ULONG           ux_byte_pool_alloc_max_count;
2517     ULONG           ux_byte_pool_alloc_max_total;
2518 #endif
2519 } UX_MEMORY_BYTE_POOL;
2520 
2521 #define UX_MEMORY_BYTE_POOL_REGULAR 0
2522 #define UX_MEMORY_BYTE_POOL_CACHE_SAFE 1
2523 #define UX_MEMORY_BYTE_POOL_NUM 2
2524 
2525 typedef struct UX_SYSTEM_STRUCT
2526 {
2527     UX_MEMORY_BYTE_POOL *ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_NUM];
2528 
2529     UINT            ux_system_thread_lowest_priority;
2530 #if !defined(UX_STANDALONE)
2531     UX_MUTEX        ux_system_mutex;
2532 #endif
2533 
2534 #ifndef UX_DISABLE_ERROR_HANDLER
2535     UINT            ux_system_last_error;
2536     UINT            ux_system_error_count;
2537     VOID            (*ux_system_error_callback_function) (UINT system_level, UINT system_context, UINT error_code);
2538 #endif
2539 
2540 #ifdef UX_ENABLE_DEBUG_LOG
2541     ULONG           ux_system_debug_code;
2542     ULONG           ux_system_debug_count;
2543     UCHAR           *ux_system_debug_log_buffer;
2544     UCHAR           *ux_system_debug_log_head;
2545     UCHAR           *ux_system_debug_log_tail;
2546     ULONG           ux_system_debug_log_size;
2547     VOID            (*ux_system_debug_callback_function) (UCHAR *debug_message, ULONG debug_value);
2548 #endif
2549 } UX_SYSTEM;
2550 
2551 
2552 /* Define USBX System Host Data structure.  */
2553 
2554 typedef struct UX_SYSTEM_HOST_STRUCT
2555 {
2556 
2557 #if UX_MAX_CLASS_DRIVER > 1
2558     UINT            ux_system_host_max_class;
2559 #endif
2560     UX_HOST_CLASS   *ux_system_host_class_array;
2561 
2562 #if UX_MAX_HCD > 1
2563     UINT            ux_system_host_max_hcd;
2564 #endif
2565     UINT            ux_system_host_registered_hcd;
2566     UX_HCD          *ux_system_host_hcd_array;
2567 
2568 #if UX_MAX_DEVICES > 1
2569     ULONG           ux_system_host_max_devices;
2570 #endif
2571     UX_DEVICE       *ux_system_host_device_array;
2572 
2573     ULONG           ux_system_host_max_ed;
2574     ULONG           ux_system_host_max_td;
2575     ULONG           ux_system_host_max_iso_td;
2576 
2577 #if !defined(UX_HOST_STANDALONE)
2578     UCHAR           *ux_system_host_enum_thread_stack;
2579     UX_THREAD       ux_system_host_enum_thread;
2580     UX_SEMAPHORE    ux_system_host_enum_semaphore;
2581 #endif
2582 
2583 #if UX_MAX_DEVICES > 1
2584     VOID            (*ux_system_host_enum_hub_function) (VOID);
2585 #endif
2586 
2587 #if !defined(UX_HOST_STANDALONE)
2588     UCHAR           *ux_system_host_hcd_thread_stack;
2589     UX_THREAD       ux_system_host_hcd_thread;
2590     UX_SEMAPHORE    ux_system_host_hcd_semaphore;
2591 #endif
2592 
2593 #if defined(UX_OTG_SUPPORT) && !defined(UX_OTG_STANDALONE)
2594     UCHAR           *ux_system_host_hnp_polling_thread_stack;
2595     UX_THREAD       ux_system_host_hnp_polling_thread;
2596 #endif
2597 
2598 #if defined(UX_HOST_STANDALONE)
2599     struct UX_DEVICE_STRUCT
2600                     *ux_system_host_enum_device;
2601     struct UX_DEVICE_STRUCT
2602                     *ux_system_host_enum_lock;
2603     struct UX_TRANSFER_STRUCT
2604                     *ux_system_host_pending_transfers;
2605 #if UX_MAX_DEVICES > 1
2606     struct UX_HOST_CLASS_HUB_STRUCT
2607                     *ux_system_host_hub_list;
2608 #endif
2609 #endif
2610 
2611     UINT            (*ux_system_host_change_function) (ULONG, UX_HOST_CLASS *, VOID *);
2612 } UX_SYSTEM_HOST;
2613 
2614 #if UX_MAX_CLASS_DRIVER > 1
2615 #define UX_SYSTEM_HOST_MAX_CLASS_GET()          (_ux_system_host->ux_system_host_max_class)
2616 #define UX_SYSTEM_HOST_MAX_CLASS_SET(n)         do { _ux_system_host->ux_system_host_max_class = (n); } while(0)
2617 #else
2618 #define UX_SYSTEM_HOST_MAX_CLASS_GET()          (1)
2619 #define UX_SYSTEM_HOST_MAX_CLASS_SET(n)         UX_PARAMETER_NOT_USED(n)
2620 #endif
2621 
2622 #if UX_MAX_HCD > 1
2623 #define UX_SYSTEM_HOST_MAX_HCD_GET()            (_ux_system_host->ux_system_host_max_hcd)
2624 #define UX_SYSTEM_HOST_MAX_HCD_SET(n)           do { _ux_system_host->ux_system_host_max_hcd = (n); } while(0)
2625 #else
2626 #define UX_SYSTEM_HOST_MAX_HCD_GET()            (1)
2627 #define UX_SYSTEM_HOST_MAX_HCD_SET(n)           UX_PARAMETER_NOT_USED(n)
2628 #endif
2629 
2630 #if UX_MAX_DEVICES > 1
2631 #define UX_SYSTEM_HOST_MAX_DEVICES_SET(n)       do { _ux_system_host->ux_system_host_max_devices = (n); } while(0)
2632 #define UX_SYSTEM_HOST_MAX_DEVICES_GET()        (_ux_system_host->ux_system_host_max_devices)
2633 #else
2634 #define UX_SYSTEM_HOST_MAX_DEVICES_SET(n)       UX_PARAMETER_NOT_USED(n)
2635 #define UX_SYSTEM_HOST_MAX_DEVICES_GET()        (1)
2636 #endif
2637 
2638 
2639 typedef struct UX_SYSTEM_SLAVE_STRUCT
2640 {
2641 
2642     UX_SLAVE_DCD    ux_system_slave_dcd;
2643     UX_SLAVE_DEVICE ux_system_slave_device;
2644     UCHAR           *ux_system_slave_device_framework;
2645     ULONG           ux_system_slave_device_framework_length;
2646     UCHAR           *ux_system_slave_device_framework_full_speed;
2647     ULONG           ux_system_slave_device_framework_length_full_speed;
2648     UCHAR           *ux_system_slave_device_framework_high_speed;
2649     ULONG           ux_system_slave_device_framework_length_high_speed;
2650     UCHAR           *ux_system_slave_string_framework;
2651     ULONG           ux_system_slave_string_framework_length;
2652     UCHAR           *ux_system_slave_language_id_framework;
2653     ULONG           ux_system_slave_language_id_framework_length;
2654     UCHAR           *ux_system_slave_dfu_framework;
2655     ULONG           ux_system_slave_dfu_framework_length;
2656 #if UX_MAX_SLAVE_CLASS_DRIVER > 1
2657     UINT            ux_system_slave_max_class;
2658 #endif
2659     UX_SLAVE_CLASS  *ux_system_slave_class_array;
2660     UX_SLAVE_CLASS  *ux_system_slave_interface_class_array[UX_MAX_SLAVE_INTERFACES];
2661     ULONG           ux_system_slave_speed;
2662     ULONG           ux_system_slave_power_state;
2663     ULONG           ux_system_slave_remote_wakeup_capability;
2664     ULONG           ux_system_slave_remote_wakeup_enabled;
2665     ULONG           ux_system_slave_device_dfu_capabilities;
2666     ULONG           ux_system_slave_device_dfu_detach_timeout;
2667     ULONG           ux_system_slave_device_dfu_transfer_size;
2668     ULONG           ux_system_slave_device_dfu_state_machine;
2669     ULONG           ux_system_slave_device_dfu_mode;
2670     UINT            (*ux_system_slave_change_function) (ULONG);
2671     ULONG           ux_system_slave_device_vendor_request;
2672     UINT            (*ux_system_slave_device_vendor_request_function) (ULONG, ULONG, ULONG, ULONG, UCHAR *, ULONG *);
2673 
2674 } UX_SYSTEM_SLAVE;
2675 
2676 #if UX_MAX_SLAVE_CLASS_DRIVER > 1
2677 #define UX_SYSTEM_DEVICE_MAX_CLASS_SET(n)       do { _ux_system_slave->ux_system_slave_max_class = (n); } while(0)
2678 #define UX_SYSTEM_DEVICE_MAX_CLASS_GET()        (_ux_system_slave->ux_system_slave_max_class)
2679 #else
2680 #define UX_SYSTEM_DEVICE_MAX_CLASS_SET(n)       do { UX_PARAMETER_NOT_USED(n); } while(0)
2681 #define UX_SYSTEM_DEVICE_MAX_CLASS_GET()        (1)
2682 #endif
2683 
2684 typedef struct UX_SYSTEM_OTG_STRUCT
2685 {
2686 
2687 #if !defined(UX_OTG_STANDALONE)
2688     UX_THREAD       ux_system_otg_thread;
2689     UCHAR           *ux_system_otg_thread_stack;
2690     UX_SEMAPHORE    ux_system_otg_semaphore;
2691 #endif
2692     UINT            (*ux_system_otg_function) (ULONG);
2693     ULONG           ux_system_otg_mode;
2694     ULONG           ux_system_otg_io;
2695     ULONG           ux_system_otg_vbus_state;
2696     ULONG           ux_system_otg_change_mode_event;
2697     ULONG           ux_system_otg_change_vbus_event;
2698     ULONG           ux_system_otg_slave_role_swap_flag;
2699     ULONG           ux_system_otg_slave_set_feature_flag;
2700     ULONG           ux_system_otg_device_type;
2701     VOID            (*ux_system_otg_vbus_function) (ULONG);
2702     VOID            (*ux_system_otg_change_mode_callback) (ULONG);
2703 } UX_SYSTEM_OTG;
2704 
2705 /* Define Data Pump Class instance structure.  */
2706 
2707 
2708 typedef struct UX_HOST_CLASS_DPUMP_STRUCT
2709 {
2710 
2711     struct UX_HOST_CLASS_DPUMP_STRUCT
2712                     *ux_host_class_dpump_next_instance;
2713     UX_HOST_CLASS   *ux_host_class_dpump_class;
2714     UX_DEVICE       *ux_host_class_dpump_device;
2715     UX_INTERFACE    *ux_host_class_dpump_interface;
2716     UX_ENDPOINT     *ux_host_class_dpump_bulk_out_endpoint;
2717     UX_ENDPOINT     *ux_host_class_dpump_bulk_in_endpoint;
2718     UX_ENDPOINT     *ux_host_class_dpump_interrupt_endpoint;
2719     UINT            ux_host_class_dpump_state;
2720 #if !defined(UX_HOST_STANDALONE)
2721     UX_SEMAPHORE    ux_host_class_dpump_semaphore;
2722 #else
2723     ULONG           ux_host_class_dpump_flags;
2724 #endif
2725 } UX_HOST_CLASS_DPUMP;
2726 
2727 
2728 /* Define the system API mappings based on the error checking
2729    selected by the user.  Note: this section is only applicable to
2730    application source code, hence the conditional that turns off this
2731    stuff when the include file is processed by the ThreadX source. */
2732 
2733 #ifndef  UX_SOURCE_CODE
2734 
2735 
2736 /* Define USBX Services.  */
2737 
2738 #if defined(UX_SYSTEM_ENABLE_ERROR_CHECKING)
2739 #define ux_system_initialize                                    _ux_system_initialize
2740 #else
2741 #define ux_system_initialize                                    _uxe_system_initialize
2742 #endif
2743 
2744 #define ux_system_uninitialize                                  _ux_system_uninitialize
2745 #define ux_system_tasks_run                                     _ux_system_tasks_run
2746 
2747 #define ux_host_class_hub_entry                                 _ux_host_class_hub_entry
2748 
2749 #define ux_host_class_storage_entry                             _ux_host_class_storage_entry
2750 
2751 #if defined(UX_HOST_STACK_ENABLE_ERROR_CHECKING)
2752 
2753 #define ux_host_stack_class_get                                 _uxe_host_stack_class_get
2754 #define ux_host_stack_class_instance_get                        _uxe_host_stack_class_instance_get
2755 #define ux_host_stack_class_register                            _uxe_host_stack_class_register
2756 #define ux_host_stack_device_configuration_activate             _uxe_host_stack_device_configuration_activate
2757 #define ux_host_stack_device_configuration_deactivate           _uxe_host_stack_device_configuration_deactivate
2758 #define ux_host_stack_device_configuration_get                  _uxe_host_stack_device_configuration_get
2759 #define ux_host_stack_device_get                                _uxe_host_stack_device_get
2760 #define ux_host_stack_device_string_get                         _uxe_host_stack_device_string_get
2761 #define ux_host_stack_endpoint_transfer_abort                   _uxe_host_stack_endpoint_transfer_abort
2762 #define ux_host_stack_hcd_register                              _uxe_host_stack_hcd_register
2763 #define ux_host_stack_hcd_unregister                            _uxe_host_stack_hcd_unregister
2764 #define ux_host_stack_interface_endpoint_get                    _uxe_host_stack_interface_endpoint_get
2765 #define ux_host_stack_interface_setting_select                  _uxe_host_stack_interface_setting_select
2766 #define ux_host_stack_transfer_request                          _uxe_host_stack_transfer_request
2767 #define ux_host_stack_transfer_request_abort                    _uxe_host_stack_transfer_request_abort
2768 
2769 #else
2770 
2771 #define ux_host_stack_class_get                                 _ux_host_stack_class_get
2772 #define ux_host_stack_class_instance_get                        _ux_host_stack_class_instance_get
2773 #define ux_host_stack_class_register                            _ux_host_stack_class_register
2774 #define ux_host_stack_device_configuration_activate             _ux_host_stack_device_configuration_activate
2775 #define ux_host_stack_device_configuration_deactivate           _ux_host_stack_device_configuration_deactivate
2776 #define ux_host_stack_device_configuration_get                  _ux_host_stack_device_configuration_get
2777 #define ux_host_stack_device_get                                _ux_host_stack_device_get
2778 #define ux_host_stack_device_string_get                         _ux_host_stack_device_string_get
2779 #define ux_host_stack_endpoint_transfer_abort                   _ux_host_stack_endpoint_transfer_abort
2780 #define ux_host_stack_hcd_register                              _ux_host_stack_hcd_register
2781 #define ux_host_stack_hcd_unregister                            _ux_host_stack_hcd_unregister
2782 #define ux_host_stack_interface_endpoint_get                    _ux_host_stack_interface_endpoint_get
2783 #define ux_host_stack_interface_setting_select                  _ux_host_stack_interface_setting_select
2784 #define ux_host_stack_transfer_request                          _ux_host_stack_transfer_request
2785 #define ux_host_stack_transfer_request_abort                    _ux_host_stack_transfer_request_abort
2786 
2787 #endif
2788 
2789 #define ux_host_stack_class_instance_create                     _ux_host_stack_class_instance_create
2790 #define ux_host_stack_class_instance_destroy                    _ux_host_stack_class_instance_destroy
2791 #define ux_host_stack_class_unregister                          _ux_host_stack_class_unregister
2792 #define ux_host_stack_configuration_interface_get               _ux_host_stack_configuration_interface_get
2793 #define ux_host_stack_device_configuration_reset                _ux_host_stack_device_configuration_reset
2794 #define ux_host_stack_device_configuration_select               _ux_host_stack_device_configuration_select
2795 #define ux_host_stack_initialize                                _ux_host_stack_initialize
2796 #define ux_host_stack_uninitialize                              _ux_host_stack_uninitialize
2797 #define ux_host_stack_hnp_polling_thread_entry                  _ux_host_stack_hnp_polling_thread_entry
2798 #define ux_host_stack_role_swap                                 _ux_host_stack_role_swap
2799 
2800 #define ux_host_stack_tasks_run                                 _ux_host_stack_tasks_run
2801 #define ux_host_stack_transfer_run                              _ux_host_stack_transfer_run
2802 
2803 #define ux_utility_pci_class_scan                               _ux_utility_pci_class_scan
2804 #define ux_utility_pci_read                                     _ux_utility_pci_read
2805 #define ux_utility_pci_write                                    _ux_utility_pci_write
2806 
2807 #if defined(UX_DEVICE_STACK_ENABLE_ERROR_CHECKING)
2808 
2809 #define ux_device_stack_class_register                          _uxe_device_stack_class_register
2810 #define ux_device_stack_class_unregister                        _uxe_device_stack_class_unregister
2811 #define ux_device_stack_initialize                              _uxe_device_stack_initialize
2812 
2813 #else
2814 
2815 #define ux_device_stack_class_register                          _ux_device_stack_class_register
2816 #define ux_device_stack_class_unregister                        _ux_device_stack_class_unregister
2817 #define ux_device_stack_initialize                              _ux_device_stack_initialize
2818 
2819 #endif
2820 #define ux_device_stack_uninitialize                            _ux_device_stack_uninitialize
2821 
2822 #define ux_device_stack_alternate_setting_get                   _ux_device_stack_alternate_setting_get
2823 #define ux_device_stack_alternate_setting_set                   _ux_device_stack_alternate_setting_set
2824 #define ux_device_stack_configuration_get                       _ux_device_stack_configuration_get
2825 #define ux_device_stack_configuration_set                       _ux_device_stack_configuration_set
2826 #define ux_device_stack_descriptor_send                         _ux_device_stack_descriptor_send
2827 #define ux_device_stack_connect                                 _ux_device_stack_connect
2828 #define ux_device_stack_disconnect                              _ux_device_stack_disconnect
2829 #define ux_device_stack_endpoint_stall                          _ux_device_stack_endpoint_stall
2830 #define ux_device_stack_host_wakeup                             _ux_device_stack_host_wakeup
2831 #define ux_device_stack_interface_delete                        _ux_device_stack_interface_delete
2832 #define ux_device_stack_interface_get                           _ux_device_stack_interface_get
2833 #define ux_device_stack_interface_set                           _ux_device_stack_interface_set
2834 #define ux_device_stack_interface_start                         _ux_device_stack_interface_start
2835 #define ux_device_stack_transfer_request                        _ux_device_stack_transfer_request
2836 #define ux_device_stack_transfer_abort                          _ux_device_stack_transfer_abort
2837 
2838 #define ux_device_stack_tasks_run                               _ux_device_stack_tasks_run
2839 #define ux_device_stack_transfer_run                            _ux_device_stack_transfer_run
2840 
2841 #define ux_hcd_ehci_initialize                                  _ux_hcd_ehci_initialize
2842 #define ux_hcd_isp1161_initialize                               _ux_hcd_isp1161_initialize
2843 #define ux_hcd_ohci_initialize                                  _ux_hcd_ohci_initialize
2844 #define ux_hcd_sim_host_initialize                              _ux_hcd_sim_host_initialize
2845 #define ux_dcd_sim_slave_initialize                             _ux_dcd_sim_slave_initialize
2846 
2847 #define ux_network_driver_init                                  _ux_network_driver_init
2848 
2849 #endif
2850 
2851 
2852 /* Define USBX API prototypes.  */
2853 
2854 UINT    ux_system_initialize(VOID *non_cached_memory_pool_start, ULONG non_cached_memory_size,
2855                                 VOID *cached_memory_pool_start, ULONG cached_memory_size);
2856 UINT    ux_system_uninitialize(VOID);
2857 UINT    ux_system_tasks_run(VOID);
2858 
2859 UINT    uxe_system_initialize(VOID *non_cached_memory_pool_start, ULONG non_cached_memory_size,
2860                                 VOID *cached_memory_pool_start, ULONG cached_memory_size);
2861 
2862 
2863 /* Define USBX Host API prototypes.  */
2864 
2865 UINT    ux_hcd_ehci_initialize(UX_HCD *hcd);
2866 UINT    ux_hcd_isp1161_initialize(UX_HCD *hcd);
2867 UINT    ux_hcd_ohci_initialize(UX_HCD *hcd);
2868 UINT    ux_hcd_sim_host_initialize(UX_HCD *hcd);
2869 
2870 UINT    ux_host_stack_class_get(UCHAR *class_name, UX_HOST_CLASS **host_class);
2871 UINT    ux_host_stack_class_instance_create(UX_HOST_CLASS *host_class, VOID *class_instance);
2872 UINT    ux_host_stack_class_instance_destroy(UX_HOST_CLASS *host_class, VOID *class_instance);
2873 UINT    ux_host_stack_class_instance_get(UX_HOST_CLASS *host_class, UINT class_index, VOID **class_instance);
2874 UINT    ux_host_stack_class_register(UCHAR *class_name, UINT (*class_entry_function)(struct UX_HOST_CLASS_COMMAND_STRUCT *));
2875 UINT    ux_host_stack_class_unregister(UINT (*class_entry_function)(struct UX_HOST_CLASS_COMMAND_STRUCT *));
2876 UINT    ux_host_stack_configuration_interface_get(UX_CONFIGURATION *configuration, UINT interface_index,
2877                                     UINT alternate_setting_index, UX_INTERFACE **ux_interface);
2878 UINT    ux_host_stack_device_configuration_activate(UX_CONFIGURATION *configuration);
2879 UINT    ux_host_stack_device_configuration_deactivate(UX_DEVICE *device);
2880 UINT    ux_host_stack_device_configuration_get(UX_DEVICE *device, UINT configuration_index, UX_CONFIGURATION **configuration);
2881 UINT    ux_host_stack_device_configuration_select(UX_CONFIGURATION *configuration);
2882 UINT    ux_host_stack_device_get(ULONG device_index, UX_DEVICE **device);
2883 UINT    ux_host_stack_device_string_get(UX_DEVICE *device, UCHAR *descriptor_buffer, ULONG length, ULONG language_id, ULONG string_index);
2884 UINT    ux_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint);
2885 UINT    ux_host_stack_hcd_register(UCHAR *hcd_name, UINT (*hcd_initialize_function)(struct UX_HCD_STRUCT *), ULONG hcd_param1, ULONG hcd_param2);
2886 UINT    ux_host_stack_hcd_unregister(UCHAR *hcd_name, ULONG hcd_param1, ULONG hcd_param2);
2887 UINT    ux_host_stack_initialize(UINT (*ux_system_host_change_function)(ULONG, UX_HOST_CLASS *, VOID *));
2888 UINT    ux_host_stack_uninitialize(VOID);
2889 UINT    ux_host_stack_interface_endpoint_get(UX_INTERFACE *ux_interface, UINT endpoint_index, UX_ENDPOINT **endpoint);
2890 UINT    ux_host_stack_interface_setting_select(UX_INTERFACE *ux_interface);
2891 UINT    ux_host_stack_transfer_request(UX_TRANSFER *transfer_request);
2892 UINT    ux_host_stack_transfer_request_abort(UX_TRANSFER *transfer_request);
2893 VOID    ux_host_stack_hnp_polling_thread_entry(ULONG id);
2894 UINT    ux_host_stack_role_swap(UX_DEVICE *device);
2895 UINT    ux_host_stack_device_configuration_reset(UX_DEVICE *device);
2896 
2897 UINT    ux_host_stack_tasks_run(VOID);
2898 UINT    ux_host_stack_transfer_run(UX_TRANSFER *transfer_request);
2899 
2900 /* Define USBX Device API prototypes.  */
2901 
2902 UINT    ux_dcd_at91_initialize(ULONG dcd_io);
2903 UINT    ux_dcd_isp1181_initialize(ULONG dcd_io, ULONG dcd_irq, ULONG dcd_vbus_address);
2904 UINT    ux_dcd_ml6965_initialize(ULONG dcd_io, ULONG dcd_irq, ULONG dcd_vbus_address);
2905 UINT    ux_dcd_sim_slave_initialize(VOID);
2906 
2907 UINT    ux_device_class_storage_entry(UX_SLAVE_CLASS_COMMAND *command);
2908 VOID    ux_device_class_storage_thread(ULONG);
2909 UINT    ux_device_stack_alternate_setting_get(ULONG interface_value);
2910 UINT    ux_device_stack_alternate_setting_set(ULONG interface_value, ULONG alternate_setting_value);
2911 UINT    ux_device_stack_class_register(UCHAR *class_name,
2912                                     UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *),
2913                                     ULONG configuration_number,
2914                                     ULONG interface_number,
2915                                     VOID *parameter);
2916 UINT    ux_device_stack_class_unregister(UCHAR *class_name,
2917                                     UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *));
2918 UINT    ux_device_stack_configuration_get(VOID);
2919 UINT    ux_device_stack_configuration_set(ULONG configuration_value);
2920 UINT    ux_device_stack_descriptor_send(ULONG descriptor_type, ULONG request_index, ULONG host_length);
2921 UINT    ux_device_stack_disconnect(VOID);
2922 UINT    ux_device_stack_endpoint_stall(UX_SLAVE_ENDPOINT *endpoint);
2923 UINT    ux_device_stack_host_wakeup(VOID);
2924 UINT    ux_device_stack_initialize(UCHAR * device_framework_high_speed, ULONG device_framework_length_high_speed,
2925                                     UCHAR * device_framework_full_speed, ULONG device_framework_length_full_speed,
2926                                     UCHAR * string_framework, ULONG string_framework_length,
2927                                     UCHAR * language_id_framework, ULONG language_id_framework_length,
2928                                     UINT (*ux_system_slave_change_function)(ULONG));
2929 UINT    ux_device_stack_uninitialize(VOID);
2930 UINT    ux_device_stack_interface_delete(UX_SLAVE_INTERFACE *ux_interface);
2931 UINT    ux_device_stack_interface_get(UINT interface_value);
2932 UINT    ux_device_stack_interface_set(UCHAR * device_framework, ULONG device_framework_length,
2933                                     ULONG alternate_setting_value);
2934 UINT    ux_device_stack_interface_start(UX_SLAVE_INTERFACE *ux_interface);
2935 UINT    ux_device_stack_transfer_request(UX_SLAVE_TRANSFER *transfer_request, ULONG slave_length, ULONG host_length);
2936 UINT    ux_device_stack_transfer_request_abort(UX_SLAVE_TRANSFER *transfer_request, ULONG completion_code);
2937 
2938 UINT    ux_device_stack_tasks_run(VOID);
2939 UINT    ux_device_stack_transfer_run(UX_SLAVE_TRANSFER *transfer_request, ULONG slave_length, ULONG host_length);
2940 
2941 /* Include USBX utility and system file.  */
2942 
2943 #include "ux_utility.h"
2944 #include "ux_system.h"
2945 
2946 
2947 
2948 
2949 /* Determine if a C++ compiler is being used.  If so, complete the standard
2950    C conditional started above.  */
2951 #ifdef   __cplusplus
2952         }
2953 #endif
2954 
2955 
2956 #endif
2957 
2958 
2959