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