diff options
| author | Chaoqiong Xiao <[email protected]> | 2023-10-23 05:31:40 +0000 |
|---|---|---|
| committer | Chaoqiong Xiao <[email protected]> | 2023-10-23 05:31:40 +0000 |
| commit | 26585e42dccf2e1ce954d8cdb4890fac72d04864 (patch) | |
| tree | fea8480672351b161488e07c31e3d704d82ee10a /common/core | |
| parent | 7c928b43db68b72970b3effd5a2582eb5a6869c7 (diff) | |
Update on 23 Oct 2023. Expand to see details.v6.3.0_rel
52c60057 Update headers and readme for 6.3.0 release.
5360ad52 Host H264 frame support.
4b097e80 Add javascript to codeql detection
70278ae3 Fixed use after free issues.
5560620e Improved standalone enum transfer flow. Turn off ASIX in standalone build. Im...
39a01206 Improved host HID clients (mouse/keyboard/remote control) deactivation sequence.
be2c7fd5 Improved standalone host CDC ACM control and data instance link management (MSRC 81489,81570)
c2368eb2 Improved AC AS management and error handing.
b9c23b38 PIMA Host/device optional interrupt endpoint support and host unused semaphore removal.
34ca3af9 Removed interface link in class linked to device.
5d3c9dd0 Improved endpoints get error handling (host CDC-ECM/ACM, storage). Moved stor...
71b08ad1 Improved host audio descriptors validation
4717e3f1 Enable weekly pipeline build to avoid CodeQL expiration
ca408b54 Checked XML tag nesting depth in Pictbridge object parsing
c300a00c Limited pictbridge array element to hexa output array size.
0e644aaa Reject fake CDC-ECM data interface not located next to its control interface.
911007a9 Improved host HID usage handling.
d0576877 Enable dummy check of python for CodeQL
2761e105 Fixed some split transfer issue.
db0dbeda Added packet length validation for received nx packet.
f5007249 Fix PIMA issues on data set extraction
3ec66399 Fixing device RNDIS bugs with zero copy
1ec77d6b Fix device HID issue when adding class memory man and zero copy.
d52e55c0 Add zero copy support in device printer
a5cb883f Added zero copy support in device CDC_ECM and RNDIS
1f967ae2 Enable codeql in onebranch pipeline
de265dbc Enable zero copy for device audio and video
53aee275 Refined memory management to reduce overhead.
Diffstat (limited to 'common/core')
49 files changed, 1611 insertions, 1221 deletions
diff --git a/common/core/CMakeLists.txt b/common/core/CMakeLists.txt index 1cbb4d5..0e795d8 100644 --- a/common/core/CMakeLists.txt +++ b/common/core/CMakeLists.txt @@ -185,6 +185,8 @@ target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_memory_copy.c ${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_memory_free.c ${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_memory_free_block_best_get.c + ${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_memory_byte_pool_create.c + ${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_memory_byte_pool_search.c ${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_memory_set.c ${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_mutex_create.c ${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_mutex_delete.c diff --git a/common/core/inc/ux_api.h b/common/core/inc/ux_api.h index 006fa58..bb9c1b8 100644 --- a/common/core/inc/ux_api.h +++ b/common/core/inc/ux_api.h @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Application Interface (API) */ /** */ @@ -21,28 +21,28 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* APPLICATION INTERFACE DEFINITION RELEASE */ -/* */ -/* ux_api.h PORTABLE C */ -/* 6.x */ +/**************************************************************************/ +/* */ +/* APPLICATION INTERFACE DEFINITION RELEASE */ +/* */ +/* ux_api.h PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This file defines the basic Application Interface (API) to the */ -/* high-performance USBX real-time USB stack. All service prototypes */ -/* and data structure definitions are defined in this file. */ -/* Please note that basic data type definitions and other architecture-*/ -/* specific information is contained in the file ux_port.h. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* This file defines the basic Application Interface (API) to the */ +/* high-performance USBX real-time USB stack. All service prototypes */ +/* and data structure definitions are defined in this file. */ +/* Please note that basic data type definitions and other architecture-*/ +/* specific information is contained in the file ux_port.h. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* added query usage of device */ @@ -133,16 +133,17 @@ /* max class driver configure, */ /* added a new error code, */ /* resulting in version 6.2.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* refined memory management, */ /* added a new mode to manage */ /* endpoint buffer in classes, */ /* optimized USB descriptors, */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ -#ifndef UX_API_H +#ifndef UX_API_H #define UX_API_H /* Determine if a C++ compiler is being used. If so, ensure that standard @@ -161,7 +162,7 @@ extern "C" { /* Process compile options: * - * - UX_HOST_SIDE_ONLY/UX_HOST_STANDALONE: + * - UX_HOST_SIDE_ONLY/UX_HOST_STANDALONE: * Must not be defined at the same time, * When defined, only host/device side APIs are available. * @@ -289,7 +290,7 @@ typedef signed char SCHAR; /* Define USBX device max bInterfaceNumber of interfaces (0 ~ n), it must be larger than max bInterfaceNumber in USB framework descriptors. */ -#ifndef UX_MAX_SLAVE_INTERFACES +#ifndef UX_MAX_SLAVE_INTERFACES #define UX_MAX_SLAVE_INTERFACES 16 #endif @@ -339,8 +340,8 @@ typedef signed char SCHAR; /* Define basic constants for the USBX Stack. */ #define AZURE_RTOS_USBX #define USBX_MAJOR_VERSION 6 -#define USBX_MINOR_VERSION 2 -#define USBX_PATCH_VERSION 1 +#define USBX_MINOR_VERSION 3 +#define USBX_PATCH_VERSION 0 /* Macros for concatenating tokens, where UX_CONCATn concatenates n tokens. */ @@ -428,7 +429,7 @@ typedef signed char SCHAR; #ifndef UX_DEBUG_LOG_SIZE #define UX_DEBUG_LOG_SIZE (1024 * 32) #endif - + /* Map the error log macros to internal USBX function. */ #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); @@ -444,8 +445,8 @@ VOID _ux_utility_debug_log(UCHAR *debug_location, UCHAR *debug_message, ULONG de /* If Log is not defined, map it to nothing so that debug messages can stay in the code. */ #define UX_DEBUG_LOG(debug_location, debug_message, debug_code, debug_parameter_1, debug_parameter_2) -#endif - +#endif + /* Determine if tracing is enabled. */ #if defined(TX_ENABLE_EVENT_TRACE) && !defined(UX_STANDALONE) @@ -482,7 +483,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_TRACE_HOST_OBJECT_TYPE_INTERFACE (UX_TRACE_OBJECT_TYPE_BASE + 2) #define UX_TRACE_HOST_OBJECT_TYPE_ENDPOINT (UX_TRACE_OBJECT_TYPE_BASE + 3) #define UX_TRACE_HOST_OBJECT_TYPE_CLASS_INSTANCE (UX_TRACE_OBJECT_TYPE_BASE + 4) - + #define UX_TRACE_DEVICE_OBJECT_TYPE_DEVICE (UX_TRACE_OBJECT_TYPE_BASE + 5) #define UX_TRACE_DEVICE_OBJECT_TYPE_INTERFACE (UX_TRACE_OBJECT_TYPE_BASE + 6) #define UX_TRACE_DEVICE_OBJECT_TYPE_ENDPOINT (UX_TRACE_OBJECT_TYPE_BASE + 7) @@ -491,13 +492,13 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL /* Define event filters that can be used to selectively disable certain events or groups of events. */ #define UX_TRACE_ALL_EVENTS 0x7F000000 /* All USBX events */ -#define UX_TRACE_ERRORS 0x01000000 /* USBX Errors events */ -#define UX_TRACE_HOST_STACK_EVENTS 0x02000000 /* USBX Host Class Events */ -#define UX_TRACE_DEVICE_STACK_EVENTS 0x04000000 /* USBX Device Class Events */ -#define UX_TRACE_HOST_CONTROLLER_EVENTS 0x08000000 /* USBX Host Controller Events */ -#define UX_TRACE_DEVICE_CONTROLLER_EVENTS 0x10000000 /* USBX Device Controllers Events */ -#define UX_TRACE_HOST_CLASS_EVENTS 0x20000000 /* USBX Host Class Events */ -#define UX_TRACE_DEVICE_CLASS_EVENTS 0x40000000 /* USBX Device Class Events */ +#define UX_TRACE_ERRORS 0x01000000 /* USBX Errors events */ +#define UX_TRACE_HOST_STACK_EVENTS 0x02000000 /* USBX Host Class Events */ +#define UX_TRACE_DEVICE_STACK_EVENTS 0x04000000 /* USBX Device Class Events */ +#define UX_TRACE_HOST_CONTROLLER_EVENTS 0x08000000 /* USBX Host Controller Events */ +#define UX_TRACE_DEVICE_CONTROLLER_EVENTS 0x10000000 /* USBX Device Controllers Events */ +#define UX_TRACE_HOST_CLASS_EVENTS 0x20000000 /* USBX Host Class Events */ +#define UX_TRACE_DEVICE_CLASS_EVENTS 0x40000000 /* USBX Device Class Events */ /* Define the trace events in USBX, if not defined. */ @@ -505,219 +506,219 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL /* Define the USBX host stack events. */ #define UX_TRACE_HOST_STACK_EVENTS_BASE 600 -#define UX_TRACE_HOST_STACK_CLASS_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 1) /* I1 = class , I2 = class instance */ -#define UX_TRACE_HOST_STACK_CLASS_INSTANCE_DESTROY (UX_TRACE_HOST_STACK_EVENTS_BASE + 2) /* I1 = class , I2 = class instance */ -#define UX_TRACE_HOST_STACK_CONFIGURATION_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 3) /* I1 = configuration */ -#define UX_TRACE_HOST_STACK_CONFIGURATION_ENUMERATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 4) /* I1 = device */ -#define UX_TRACE_HOST_STACK_CONFIGURATION_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 5) /* I1 = configuration */ -#define UX_TRACE_HOST_STACK_CONFIGURATION_INSTANCE_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 6) /* I1 = configuration */ -#define UX_TRACE_HOST_STACK_CONFIGURATION_SET (UX_TRACE_HOST_STACK_EVENTS_BASE + 7) /* I1 = configuration */ -#define UX_TRACE_HOST_STACK_DEVICE_ADDRESS_SET (UX_TRACE_HOST_STACK_EVENTS_BASE + 8) /* I1 = device , I2 = device address */ -#define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_GET (UX_TRACE_HOST_STACK_EVENTS_BASE + 9) /* I1 = device , I2 = configuration */ -#define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_SELECT (UX_TRACE_HOST_STACK_EVENTS_BASE + 10) /* I1 = device , I2 = configuration */ -#define UX_TRACE_HOST_STACK_DEVICE_DESCRIPTOR_READ (UX_TRACE_HOST_STACK_EVENTS_BASE + 11) /* I1 = device */ -#define UX_TRACE_HOST_STACK_DEVICE_GET (UX_TRACE_HOST_STACK_EVENTS_BASE + 12) /* I1 = device index */ -#define UX_TRACE_HOST_STACK_DEVICE_REMOVE (UX_TRACE_HOST_STACK_EVENTS_BASE + 13) /* I1 = hcd , I2 = parent , I3 = port index , I4 = device */ -#define UX_TRACE_HOST_STACK_DEVICE_RESOURCE_FREE (UX_TRACE_HOST_STACK_EVENTS_BASE + 14) /* I1 = device */ -#define UX_TRACE_HOST_STACK_ENDPOINT_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 15) /* I1 = device , I2 = endpoint */ -#define UX_TRACE_HOST_STACK_ENDPOINT_INSTANCE_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 16) /* I1 = device , I2 = endpoint */ -#define UX_TRACE_HOST_STACK_ENDPOINT_RESET (UX_TRACE_HOST_STACK_EVENTS_BASE + 17) /* I1 = device , I2 = endpoint */ -#define UX_TRACE_HOST_STACK_ENDPOINT_TRANSFER_ABORT (UX_TRACE_HOST_STACK_EVENTS_BASE + 18) /* I1 = endpoint */ -#define UX_TRACE_HOST_STACK_HCD_REGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 19) /* I1 = hcd name , I2 = parameter 1 , I3 = parameter 2 */ -#define UX_TRACE_HOST_STACK_INITIALIZE (UX_TRACE_HOST_STACK_EVENTS_BASE + 20) /* */ -#define UX_TRACE_HOST_STACK_INTERFACE_ENDPOINT_GET (UX_TRACE_HOST_STACK_EVENTS_BASE + 21) /* I1 = interface , I2 = endpoint index */ -#define UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 22) /* I1 = interface */ -#define UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 23) /* I1 = interface */ -#define UX_TRACE_HOST_STACK_INTERFACE_SET (UX_TRACE_HOST_STACK_EVENTS_BASE + 24) /* I1 = interface */ -#define UX_TRACE_HOST_STACK_INTERFACE_SETTING_SELECT (UX_TRACE_HOST_STACK_EVENTS_BASE + 25) /* I1 = interface */ -#define UX_TRACE_HOST_STACK_NEW_CONFIGURATION_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 26) /* I1 = device , I2 = configuration */ -#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 */ -#define UX_TRACE_HOST_STACK_NEW_ENDPOINT_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 28) /* I1 = interface , I2 = endpoint */ -#define UX_TRACE_HOST_STACK_RH_CHANGE_PROCESS (UX_TRACE_HOST_STACK_EVENTS_BASE + 29) /* I1 = port index */ -#define UX_TRACE_HOST_STACK_RH_DEVICE_EXTRACTION (UX_TRACE_HOST_STACK_EVENTS_BASE + 30) /* I1 = hcd , I2 = port index */ -#define UX_TRACE_HOST_STACK_RH_DEVICE_INSERTION (UX_TRACE_HOST_STACK_EVENTS_BASE + 31) /* I1 = hcd , I2 = port index */ -#define UX_TRACE_HOST_STACK_TRANSFER_REQUEST (UX_TRACE_HOST_STACK_EVENTS_BASE + 32) /* I1 = device , I2 = endpoint , I3 = transfer request */ -#define UX_TRACE_HOST_STACK_TRANSFER_REQUEST_ABORT (UX_TRACE_HOST_STACK_EVENTS_BASE + 33) /* I1 = device , I2 = endpoint , I3 = transfer request */ -#define UX_TRACE_HOST_STACK_UNINITIALIZE (UX_TRACE_HOST_STACK_EVENTS_BASE + 34) /* */ -#define UX_TRACE_HOST_STACK_HCD_UNREGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 35) /* I1 = hcd name , I2 = parameter 1 , I3 = parameter 2 */ -#define UX_TRACE_HOST_STACK_CLASS_REGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 36) /* I1 = class name , I2 = entry function */ -#define UX_TRACE_HOST_STACK_CLASS_UNREGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 37) /* I1 = class entry */ -#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 */ -#define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_ACTIVATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 39) /* I1 = device , I2 = configuration */ -#define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_DEACTIVATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 40) /* I1 = device , I2 = configuration */ - -/* Define the USBX host class events. */ +#define UX_TRACE_HOST_STACK_CLASS_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 1) /* I1 = class , I2 = class instance */ +#define UX_TRACE_HOST_STACK_CLASS_INSTANCE_DESTROY (UX_TRACE_HOST_STACK_EVENTS_BASE + 2) /* I1 = class , I2 = class instance */ +#define UX_TRACE_HOST_STACK_CONFIGURATION_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 3) /* I1 = configuration */ +#define UX_TRACE_HOST_STACK_CONFIGURATION_ENUMERATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 4) /* I1 = device */ +#define UX_TRACE_HOST_STACK_CONFIGURATION_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 5) /* I1 = configuration */ +#define UX_TRACE_HOST_STACK_CONFIGURATION_INSTANCE_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 6) /* I1 = configuration */ +#define UX_TRACE_HOST_STACK_CONFIGURATION_SET (UX_TRACE_HOST_STACK_EVENTS_BASE + 7) /* I1 = configuration */ +#define UX_TRACE_HOST_STACK_DEVICE_ADDRESS_SET (UX_TRACE_HOST_STACK_EVENTS_BASE + 8) /* I1 = device , I2 = device address */ +#define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_GET (UX_TRACE_HOST_STACK_EVENTS_BASE + 9) /* I1 = device , I2 = configuration */ +#define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_SELECT (UX_TRACE_HOST_STACK_EVENTS_BASE + 10) /* I1 = device , I2 = configuration */ +#define UX_TRACE_HOST_STACK_DEVICE_DESCRIPTOR_READ (UX_TRACE_HOST_STACK_EVENTS_BASE + 11) /* I1 = device */ +#define UX_TRACE_HOST_STACK_DEVICE_GET (UX_TRACE_HOST_STACK_EVENTS_BASE + 12) /* I1 = device index */ +#define UX_TRACE_HOST_STACK_DEVICE_REMOVE (UX_TRACE_HOST_STACK_EVENTS_BASE + 13) /* I1 = hcd , I2 = parent , I3 = port index , I4 = device */ +#define UX_TRACE_HOST_STACK_DEVICE_RESOURCE_FREE (UX_TRACE_HOST_STACK_EVENTS_BASE + 14) /* I1 = device */ +#define UX_TRACE_HOST_STACK_ENDPOINT_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 15) /* I1 = device , I2 = endpoint */ +#define UX_TRACE_HOST_STACK_ENDPOINT_INSTANCE_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 16) /* I1 = device , I2 = endpoint */ +#define UX_TRACE_HOST_STACK_ENDPOINT_RESET (UX_TRACE_HOST_STACK_EVENTS_BASE + 17) /* I1 = device , I2 = endpoint */ +#define UX_TRACE_HOST_STACK_ENDPOINT_TRANSFER_ABORT (UX_TRACE_HOST_STACK_EVENTS_BASE + 18) /* I1 = endpoint */ +#define UX_TRACE_HOST_STACK_HCD_REGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 19) /* I1 = hcd name , I2 = parameter 1 , I3 = parameter 2 */ +#define UX_TRACE_HOST_STACK_INITIALIZE (UX_TRACE_HOST_STACK_EVENTS_BASE + 20) /* */ +#define UX_TRACE_HOST_STACK_INTERFACE_ENDPOINT_GET (UX_TRACE_HOST_STACK_EVENTS_BASE + 21) /* I1 = interface , I2 = endpoint index */ +#define UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 22) /* I1 = interface */ +#define UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 23) /* I1 = interface */ +#define UX_TRACE_HOST_STACK_INTERFACE_SET (UX_TRACE_HOST_STACK_EVENTS_BASE + 24) /* I1 = interface */ +#define UX_TRACE_HOST_STACK_INTERFACE_SETTING_SELECT (UX_TRACE_HOST_STACK_EVENTS_BASE + 25) /* I1 = interface */ +#define UX_TRACE_HOST_STACK_NEW_CONFIGURATION_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 26) /* I1 = device , I2 = configuration */ +#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 */ +#define UX_TRACE_HOST_STACK_NEW_ENDPOINT_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 28) /* I1 = interface , I2 = endpoint */ +#define UX_TRACE_HOST_STACK_RH_CHANGE_PROCESS (UX_TRACE_HOST_STACK_EVENTS_BASE + 29) /* I1 = port index */ +#define UX_TRACE_HOST_STACK_RH_DEVICE_EXTRACTION (UX_TRACE_HOST_STACK_EVENTS_BASE + 30) /* I1 = hcd , I2 = port index */ +#define UX_TRACE_HOST_STACK_RH_DEVICE_INSERTION (UX_TRACE_HOST_STACK_EVENTS_BASE + 31) /* I1 = hcd , I2 = port index */ +#define UX_TRACE_HOST_STACK_TRANSFER_REQUEST (UX_TRACE_HOST_STACK_EVENTS_BASE + 32) /* I1 = device , I2 = endpoint , I3 = transfer request */ +#define UX_TRACE_HOST_STACK_TRANSFER_REQUEST_ABORT (UX_TRACE_HOST_STACK_EVENTS_BASE + 33) /* I1 = device , I2 = endpoint , I3 = transfer request */ +#define UX_TRACE_HOST_STACK_UNINITIALIZE (UX_TRACE_HOST_STACK_EVENTS_BASE + 34) /* */ +#define UX_TRACE_HOST_STACK_HCD_UNREGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 35) /* I1 = hcd name , I2 = parameter 1 , I3 = parameter 2 */ +#define UX_TRACE_HOST_STACK_CLASS_REGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 36) /* I1 = class name , I2 = entry function */ +#define UX_TRACE_HOST_STACK_CLASS_UNREGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 37) /* I1 = class entry */ +#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 */ +#define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_ACTIVATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 39) /* I1 = device , I2 = configuration */ +#define UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_DEACTIVATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 40) /* I1 = device , I2 = configuration */ + +/* Define the USBX host class events. */ + +#define UX_TRACE_HOST_CLASS_EVENTS_BASE 650 +#define UX_TRACE_HOST_CLASS_ASIX_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 1) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_ASIX_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 2) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_ASIX_INTERRUPT_NOTIFICATION (UX_TRACE_HOST_CLASS_EVENTS_BASE + 3) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_ASIX_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 4) /* I1 = class instance , I2 = data pointer , I3 = requested length */ +#define UX_TRACE_HOST_CLASS_ASIX_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 5) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_EVENTS_BASE 650 -#define UX_TRACE_HOST_CLASS_ASIX_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 1) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_ASIX_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 2) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_ASIX_INTERRUPT_NOTIFICATION (UX_TRACE_HOST_CLASS_EVENTS_BASE + 3) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_ASIX_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 4) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_ASIX_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 5) /* I1 = class instance , I2 = data pointer , I3 = requested length */ - -#define UX_TRACE_HOST_CLASS_AUDIO_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 10) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_AUDIO_CONTROL_VALUE_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 11) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_AUDIO_CONTROL_VALUE_SET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 12) /* I1 = class instance , I2 = audio control */ -#define UX_TRACE_HOST_CLASS_AUDIO_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 13) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_AUDIO_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 14) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_AUDIO_STREAMING_SAMPLING_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 15) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_AUDIO_STREAMING_SAMPLING_SET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 16) /* I1 = class instance , I2 = audio sampling */ -#define UX_TRACE_HOST_CLASS_AUDIO_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 17) /* I1 = class instance , I2 = data pointer , I3 = requested length */ - -#define UX_TRACE_HOST_CLASS_CDC_ACM_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 20) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 21) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 22) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_GET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 23) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_STATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 24) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SEND_BREAK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 25) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_ABORT_IN_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 26) /* I1 = class instance , I2 = endpoint */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_ABORT_OUT_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 27) /* I1 = class instance , I2 = endpointr */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_NOTIFICATION_CALLBACK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 28) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_GET_DEVICE_STATUS (UX_TRACE_HOST_CLASS_EVENTS_BASE + 29) /* I1 = class instance , I2 = device status */ +#define UX_TRACE_HOST_CLASS_AUDIO_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 10) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_AUDIO_CONTROL_VALUE_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 11) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_AUDIO_CONTROL_VALUE_SET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 12) /* I1 = class instance , I2 = audio control */ +#define UX_TRACE_HOST_CLASS_AUDIO_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 13) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_AUDIO_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 14) /* I1 = class instance , I2 = data pointer , I3 = requested length */ +#define UX_TRACE_HOST_CLASS_AUDIO_STREAMING_SAMPLING_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 15) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_AUDIO_STREAMING_SAMPLING_SET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 16) /* I1 = class instance , I2 = audio sampling */ +#define UX_TRACE_HOST_CLASS_AUDIO_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 17) /* I1 = class instance , I2 = data pointer , I3 = requested length */ + +#define UX_TRACE_HOST_CLASS_CDC_ACM_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 20) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 21) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 22) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_GET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 23) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SET_LINE_STATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 24) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_SEND_BREAK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 25) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_ABORT_IN_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 26) /* I1 = class instance , I2 = endpoint */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_ABORT_OUT_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 27) /* I1 = class instance , I2 = endpointr */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_NOTIFICATION_CALLBACK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 28) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_IOCTL_GET_DEVICE_STATUS (UX_TRACE_HOST_CLASS_EVENTS_BASE + 29) /* I1 = class instance , I2 = device status */ #define UX_TRACE_HOST_CLASS_CDC_ACM_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 30) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_RECEPTION_START (UX_TRACE_HOST_CLASS_EVENTS_BASE + 31) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_CDC_ACM_RECEPTION_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 32) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_RECEPTION_START (UX_TRACE_HOST_CLASS_EVENTS_BASE + 31) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_CDC_ACM_RECEPTION_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 32) /* I1 = class instance */ #define UX_TRACE_HOST_CLASS_CDC_ACM_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 33) /* I1 = class instance , I2 = data pointer , I3 = requested length */ - -#define UX_TRACE_HOST_CLASS_CDC_ECM_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 35) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_CDC_ECM_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 36) /* I1 = class instance */ + +#define UX_TRACE_HOST_CLASS_CDC_ECM_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 35) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_CDC_ECM_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 36) /* I1 = class instance */ #define UX_TRACE_HOST_CLASS_CDC_ECM_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 37) /* I1 = class instance , I2 = data pointer , I3 = requested length */ #define UX_TRACE_HOST_CLASS_CDC_ECM_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 38) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_CDC_ECM_INTERRUPT_NOTIFICATION (UX_TRACE_HOST_CLASS_EVENTS_BASE + 39) /* I1 = class instance */ - -#define UX_TRACE_HOST_CLASS_HID_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 40) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_HID_CLIENT_REGISTER (UX_TRACE_HOST_CLASS_EVENTS_BASE + 41) /* I1 = hid client name */ -#define UX_TRACE_HOST_CLASS_HID_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 42) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_HID_IDLE_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 43) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_HID_IDLE_SET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 44) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_HID_KEYBOARD_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 45) /* I1 = class instance , I2 = hid client instance */ -#define UX_TRACE_HOST_CLASS_HID_KEYBOARD_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 46) /* I1 = class instance , I2 = hid client instance */ -#define UX_TRACE_HOST_CLASS_HID_MOUSE_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 47) /* I1 = class instance , I2 = hid client instance */ -#define UX_TRACE_HOST_CLASS_HID_MOUSE_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 48) /* I1 = class instance , I2 = hid client instance */ -#define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 49) /* I1 = class instance , I2 = hid client instance */ -#define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 50) /* I1 = class instance , I2 = hid client instance */ -#define UX_TRACE_HOST_CLASS_HID_REPORT_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 51) /* I1 = class instance , I2 = client report */ -#define UX_TRACE_HOST_CLASS_HID_REPORT_SET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 52) /* I1 = class instance , I2 = client report */ -#define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_CALLBACK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 53) /* I1 = client instance , I2 = remote control instance */ - -#define UX_TRACE_HOST_CLASS_HUB_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 60) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_HUB_CHANGE_DETECT (UX_TRACE_HOST_CLASS_EVENTS_BASE + 62) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_CDC_ECM_INTERRUPT_NOTIFICATION (UX_TRACE_HOST_CLASS_EVENTS_BASE + 39) /* I1 = class instance */ + +#define UX_TRACE_HOST_CLASS_HID_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 40) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_HID_CLIENT_REGISTER (UX_TRACE_HOST_CLASS_EVENTS_BASE + 41) /* I1 = hid client name */ +#define UX_TRACE_HOST_CLASS_HID_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 42) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_HID_IDLE_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 43) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_HID_IDLE_SET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 44) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_HID_KEYBOARD_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 45) /* I1 = class instance , I2 = hid client instance */ +#define UX_TRACE_HOST_CLASS_HID_KEYBOARD_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 46) /* I1 = class instance , I2 = hid client instance */ +#define UX_TRACE_HOST_CLASS_HID_MOUSE_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 47) /* I1 = class instance , I2 = hid client instance */ +#define UX_TRACE_HOST_CLASS_HID_MOUSE_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 48) /* I1 = class instance , I2 = hid client instance */ +#define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 49) /* I1 = class instance , I2 = hid client instance */ +#define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 50) /* I1 = class instance , I2 = hid client instance */ +#define UX_TRACE_HOST_CLASS_HID_REPORT_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 51) /* I1 = class instance , I2 = client report */ +#define UX_TRACE_HOST_CLASS_HID_REPORT_SET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 52) /* I1 = class instance , I2 = client report */ +#define UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_CALLBACK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 53) /* I1 = client instance , I2 = remote control instance */ + +#define UX_TRACE_HOST_CLASS_HUB_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 60) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_HUB_CHANGE_DETECT (UX_TRACE_HOST_CLASS_EVENTS_BASE + 62) /* I1 = class instance */ #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 */ -#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 */ +#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 */ #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 */ #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 */ #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 */ -#define UX_TRACE_HOST_CLASS_HUB_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 68) /* I1 = class instance */ - -#define UX_TRACE_HOST_CLASS_PIMA_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 70) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PIMA_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 71) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PIMA_DEVICE_INFO_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 72) /* I1 = class instance , I2 = pima device */ -#define UX_TRACE_HOST_CLASS_PIMA_DEVICE_RESET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 73) /* I1 = class instance */ -#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 */ -#define UX_TRACE_HOST_CLASS_PIMA_NUM_OBJECTS_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 75) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_CLOSE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 76) /* I1 = class instance , I2 = object */ -#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_COPY (UX_TRACE_HOST_CLASS_EVENTS_BASE + 77) /* I1 = class instance , I2 = object handle */ -#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_DELETE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 78) /* I1 = class instance , I2 = object handle */ -#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 79) /* I1 = class instance , I2 = object handle , I3 = object */ -#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_INFO_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 80) /* I1 = class instance , I2 = object handle , I3 = object */ -#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_INFO_SEND (UX_TRACE_HOST_CLASS_EVENTS_BASE + 81) /* I1 = class instance , I2 = object */ -#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_MOVE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 82) /* I1 = class instance , I2 = object handle */ -#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 */ -#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_TRANSFER_ABORT (UX_TRACE_HOST_CLASS_EVENTS_BASE + 84) /* I1 = class instance , I2 = object handle , I3 = object */ -#define UX_TRACE_HOST_CLASS_PIMA_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 85) /* I1 = class instance , I2 = data pointer , I3 = data length */ +#define UX_TRACE_HOST_CLASS_HUB_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 68) /* I1 = class instance */ + +#define UX_TRACE_HOST_CLASS_PIMA_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 70) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PIMA_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 71) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PIMA_DEVICE_INFO_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 72) /* I1 = class instance , I2 = pima device */ +#define UX_TRACE_HOST_CLASS_PIMA_DEVICE_RESET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 73) /* I1 = class instance */ +#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 */ +#define UX_TRACE_HOST_CLASS_PIMA_NUM_OBJECTS_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 75) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_CLOSE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 76) /* I1 = class instance , I2 = object */ +#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_COPY (UX_TRACE_HOST_CLASS_EVENTS_BASE + 77) /* I1 = class instance , I2 = object handle */ +#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_DELETE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 78) /* I1 = class instance , I2 = object handle */ +#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 79) /* I1 = class instance , I2 = object handle , I3 = object */ +#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_INFO_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 80) /* I1 = class instance , I2 = object handle , I3 = object */ +#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_INFO_SEND (UX_TRACE_HOST_CLASS_EVENTS_BASE + 81) /* I1 = class instance , I2 = object */ +#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_MOVE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 82) /* I1 = class instance , I2 = object handle */ +#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 */ +#define UX_TRACE_HOST_CLASS_PIMA_OBJECT_TRANSFER_ABORT (UX_TRACE_HOST_CLASS_EVENTS_BASE + 84) /* I1 = class instance , I2 = object handle , I3 = object */ +#define UX_TRACE_HOST_CLASS_PIMA_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 85) /* I1 = class instance , I2 = data pointer , I3 = data length */ #define UX_TRACE_HOST_CLASS_PIMA_REQUEST_CANCEL (UX_TRACE_HOST_CLASS_EVENTS_BASE + 86) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PIMA_SESSION_CLOSE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 87) /* I1 = class instance , I2 = pima session */ -#define UX_TRACE_HOST_CLASS_PIMA_SESSION_OPEN (UX_TRACE_HOST_CLASS_EVENTS_BASE + 88) /* I1 = class instance , I2 = pima session */ -#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 */ -#define UX_TRACE_HOST_CLASS_PIMA_STORAGE_INFO_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 90) /* I1 = class instance , I2 = storage ID , I3 = storage */ -#define UX_TRACE_HOST_CLASS_PIMA_THUMB_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 91) /* I1 = class instance , I2 = object handle */ -#define UX_TRACE_HOST_CLASS_PIMA_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 92) /* I1 = class instance , I2 = data pointer , I3 = data length */ - -#define UX_TRACE_HOST_CLASS_PRINTER_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 100) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PRINTER_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 101) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PRINTER_NAME_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 102) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PRINTER_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 103) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_PRINTER_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 104) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_PRINTER_SOFT_RESET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 105) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PRINTER_STATUS_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 106) /* I1 = class instance , I2 = printer status */ -#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 */ - -#define UX_TRACE_HOST_CLASS_PROLIFIC_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 110) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 111) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 112) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_GET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 113) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_STATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 114) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_PURGE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 115) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SEND_BREAK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 116) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_ABORT_IN_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 117) /* I1 = class instance , I2 = endpoint */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_ABORT_OUT_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 118) /* I1 = class instance , I2 = endpointr */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_REPORT_DEVICE_STATUS_CHANGE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 119) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_GET_DEVICE_STATUS (UX_TRACE_HOST_CLASS_EVENTS_BASE + 120) /* I1 = class instance , I2 = device status */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 121) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_RECEPTION_START (UX_TRACE_HOST_CLASS_EVENTS_BASE + 122) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_RECEPTION_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 123) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_PROLIFIC_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 124) /* I1 = class instance , I2 = data pointer , I3 = requested length */ - -#define UX_TRACE_HOST_CLASS_STORAGE_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 130) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_STORAGE_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 131) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_CAPACITY_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 132) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_FORMAT_CAPACITY_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 133) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_MOUNT (UX_TRACE_HOST_CLASS_EVENTS_BASE + 134) /* I1 = class instance , I2 = sector */ -#define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_OPEN (UX_TRACE_HOST_CLASS_EVENTS_BASE + 135) /* I1 = class instance , I2 = media */ -#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 */ -#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 */ -#define UX_TRACE_HOST_CLASS_STORAGE_REQUEST_SENSE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 138) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_STORAGE_START_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 139) /* I1 = class instance , I2 = start stop signal */ -#define UX_TRACE_HOST_CLASS_STORAGE_UNIT_READY_TEST (UX_TRACE_HOST_CLASS_EVENTS_BASE + 140) /* I1 = class instance */ - -#define UX_TRACE_HOST_CLASS_DPUMP_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 150) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_DPUMP_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 151) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_DPUMP_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 152) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_DPUMP_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 153) /* I1 = class instance , I2 = data pointer , I3 = requested length */ - -#define UX_TRACE_HOST_CLASS_SWAR_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 160) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_SWAR_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 161) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_IN_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 162) /* I1 = class instance , I2 = endpoint */ -#define UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_OUT_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 163) /* I1 = class instance , I2 = endpointr */ +#define UX_TRACE_HOST_CLASS_PIMA_SESSION_CLOSE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 87) /* I1 = class instance , I2 = pima session */ +#define UX_TRACE_HOST_CLASS_PIMA_SESSION_OPEN (UX_TRACE_HOST_CLASS_EVENTS_BASE + 88) /* I1 = class instance , I2 = pima session */ +#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 */ +#define UX_TRACE_HOST_CLASS_PIMA_STORAGE_INFO_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 90) /* I1 = class instance , I2 = storage ID , I3 = storage */ +#define UX_TRACE_HOST_CLASS_PIMA_THUMB_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 91) /* I1 = class instance , I2 = object handle */ +#define UX_TRACE_HOST_CLASS_PIMA_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 92) /* I1 = class instance , I2 = data pointer , I3 = data length */ + +#define UX_TRACE_HOST_CLASS_PRINTER_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 100) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PRINTER_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 101) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PRINTER_NAME_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 102) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PRINTER_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 103) /* I1 = class instance , I2 = data pointer , I3 = requested length */ +#define UX_TRACE_HOST_CLASS_PRINTER_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 104) /* I1 = class instance , I2 = data pointer , I3 = requested length */ +#define UX_TRACE_HOST_CLASS_PRINTER_SOFT_RESET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 105) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PRINTER_STATUS_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 106) /* I1 = class instance , I2 = printer status */ +#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 */ + +#define UX_TRACE_HOST_CLASS_PROLIFIC_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 110) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 111) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 112) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_GET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 113) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SET_LINE_STATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 114) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_PURGE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 115) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_SEND_BREAK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 116) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_ABORT_IN_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 117) /* I1 = class instance , I2 = endpoint */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_ABORT_OUT_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 118) /* I1 = class instance , I2 = endpointr */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_REPORT_DEVICE_STATUS_CHANGE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 119) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_IOCTL_GET_DEVICE_STATUS (UX_TRACE_HOST_CLASS_EVENTS_BASE + 120) /* I1 = class instance , I2 = device status */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 121) /* I1 = class instance , I2 = data pointer , I3 = requested length */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_RECEPTION_START (UX_TRACE_HOST_CLASS_EVENTS_BASE + 122) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_RECEPTION_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 123) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_PROLIFIC_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 124) /* I1 = class instance , I2 = data pointer , I3 = requested length */ + +#define UX_TRACE_HOST_CLASS_STORAGE_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 130) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_STORAGE_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 131) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_CAPACITY_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 132) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_FORMAT_CAPACITY_GET (UX_TRACE_HOST_CLASS_EVENTS_BASE + 133) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_MOUNT (UX_TRACE_HOST_CLASS_EVENTS_BASE + 134) /* I1 = class instance , I2 = sector */ +#define UX_TRACE_HOST_CLASS_STORAGE_MEDIA_OPEN (UX_TRACE_HOST_CLASS_EVENTS_BASE + 135) /* I1 = class instance , I2 = media */ +#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 */ +#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 */ +#define UX_TRACE_HOST_CLASS_STORAGE_REQUEST_SENSE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 138) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_STORAGE_START_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 139) /* I1 = class instance , I2 = start stop signal */ +#define UX_TRACE_HOST_CLASS_STORAGE_UNIT_READY_TEST (UX_TRACE_HOST_CLASS_EVENTS_BASE + 140) /* I1 = class instance */ + +#define UX_TRACE_HOST_CLASS_DPUMP_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 150) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_DPUMP_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 151) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_DPUMP_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 152) /* I1 = class instance , I2 = data pointer , I3 = requested length */ +#define UX_TRACE_HOST_CLASS_DPUMP_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 153) /* I1 = class instance , I2 = data pointer , I3 = requested length */ + +#define UX_TRACE_HOST_CLASS_SWAR_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 160) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_SWAR_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 161) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_IN_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 162) /* I1 = class instance , I2 = endpoint */ +#define UX_TRACE_HOST_CLASS_SWAR_IOCTL_ABORT_OUT_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 163) /* I1 = class instance , I2 = endpointr */ #define UX_TRACE_HOST_CLASS_SWAR_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 164) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_SWAR_RECEPTION_START (UX_TRACE_HOST_CLASS_EVENTS_BASE + 165) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_SWAR_RECEPTION_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 166) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_SWAR_RECEPTION_START (UX_TRACE_HOST_CLASS_EVENTS_BASE + 165) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_SWAR_RECEPTION_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 166) /* I1 = class instance */ #define UX_TRACE_HOST_CLASS_SWAR_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 167) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_GSER_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 170) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_GSER_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 171) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_SET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 172) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_GET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 173) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_SET_LINE_STATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 174) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_PURGE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 175) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_SEND_BREAK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 176) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_ABORT_IN_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 177) /* I1 = class instance , I2 = endpoint */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_ABORT_OUT_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 178) /* I1 = class instance , I2 = endpointr */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_REPORT_DEVICE_STATUS_CHANGE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 179) /* I1 = class instance , I2 = parameter */ -#define UX_TRACE_HOST_CLASS_GSER_IOCTL_GET_DEVICE_STATUS (UX_TRACE_HOST_CLASS_EVENTS_BASE + 180) /* I1 = class instance , I2 = device status */ -#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 */ -#define UX_TRACE_HOST_CLASS_GSER_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 182) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -#define UX_TRACE_HOST_CLASS_GSER_RECEPTION_START (UX_TRACE_HOST_CLASS_EVENTS_BASE + 183) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_GSER_RECEPTION_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 184) /* I1 = class instance */ -#define UX_TRACE_HOST_CLASS_GSER_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 185) /* I1 = class instance , I2 = data pointer , I3 = requested length */ +#define UX_TRACE_HOST_CLASS_GSER_ACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 170) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_GSER_DEACTIVATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 171) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_SET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 172) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_GET_LINE_CODING (UX_TRACE_HOST_CLASS_EVENTS_BASE + 173) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_SET_LINE_STATE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 174) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_PURGE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 175) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_SEND_BREAK (UX_TRACE_HOST_CLASS_EVENTS_BASE + 176) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_ABORT_IN_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 177) /* I1 = class instance , I2 = endpoint */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_ABORT_OUT_PIPE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 178) /* I1 = class instance , I2 = endpointr */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_REPORT_DEVICE_STATUS_CHANGE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 179) /* I1 = class instance , I2 = parameter */ +#define UX_TRACE_HOST_CLASS_GSER_IOCTL_GET_DEVICE_STATUS (UX_TRACE_HOST_CLASS_EVENTS_BASE + 180) /* I1 = class instance , I2 = device status */ +#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 */ +#define UX_TRACE_HOST_CLASS_GSER_READ (UX_TRACE_HOST_CLASS_EVENTS_BASE + 182) /* I1 = class instance , I2 = data pointer , I3 = requested length */ +#define UX_TRACE_HOST_CLASS_GSER_RECEPTION_START (UX_TRACE_HOST_CLASS_EVENTS_BASE + 183) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_GSER_RECEPTION_STOP (UX_TRACE_HOST_CLASS_EVENTS_BASE + 184) /* I1 = class instance */ +#define UX_TRACE_HOST_CLASS_GSER_WRITE (UX_TRACE_HOST_CLASS_EVENTS_BASE + 185) /* I1 = class instance , I2 = data pointer , I3 = requested length */ -/* Define the USBX device stack events. */ +/* Define the USBX device stack events. */ -#define UX_TRACE_DEVICE_STACK_EVENTS_BASE 850 -#define UX_TRACE_DEVICE_STACK_ALTERNATE_SETTING_GET (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 1) /* I1 = interface value */ -#define UX_TRACE_DEVICE_STACK_ALTERNATE_SETTING_SET (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 2) /* I1 = interface value , I2 = alternate setting value */ +#define UX_TRACE_DEVICE_STACK_EVENTS_BASE 850 +#define UX_TRACE_DEVICE_STACK_ALTERNATE_SETTING_GET (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 1) /* I1 = interface value */ +#define UX_TRACE_DEVICE_STACK_ALTERNATE_SETTING_SET (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 2) /* I1 = interface value , I2 = alternate setting value */ #define UX_TRACE_DEVICE_STACK_CLASS_REGISTER (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 3) /* I1 = class name , I2 = interface number, I3 = parameter */ #define UX_TRACE_DEVICE_STACK_CLEAR_FEATURE (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 4) /* I1 = request type , I2 = request value , I3 = request index */ #define UX_TRACE_DEVICE_STACK_CONFIGURATION_GET (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 5) /* I1 = configuration value */ #define UX_TRACE_DEVICE_STACK_CONFIGURATION_SET (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 6) /* I1 = configuration value */ -#define UX_TRACE_DEVICE_STACK_CONNECT (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 7) /* */ -#define UX_TRACE_DEVICE_STACK_DESCRIPTOR_SEND (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 8) /* I1 = descriptor type , I2 = request index */ +#define UX_TRACE_DEVICE_STACK_CONNECT (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 7) /* */ +#define UX_TRACE_DEVICE_STACK_DESCRIPTOR_SEND (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 8) /* I1 = descriptor type , I2 = request index */ #define UX_TRACE_DEVICE_STACK_DISCONNECT (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 9) /* I1 = device */ #define UX_TRACE_DEVICE_STACK_ENDPOINT_STALL (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 10) /* I1 = endpoint */ -#define UX_TRACE_DEVICE_STACK_GET_STATUS (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 11) /* I1 = request type , I2 = request value , I3 = request index */ -#define UX_TRACE_DEVICE_STACK_HOST_WAKEUP (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 12) /* */ -#define UX_TRACE_DEVICE_STACK_INITIALIZE (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 13) /* */ -#define UX_TRACE_DEVICE_STACK_INTERFACE_DELETE (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 14) /* I1 = interface */ +#define UX_TRACE_DEVICE_STACK_GET_STATUS (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 11) /* I1 = request type , I2 = request value , I3 = request index */ +#define UX_TRACE_DEVICE_STACK_HOST_WAKEUP (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 12) /* */ +#define UX_TRACE_DEVICE_STACK_INITIALIZE (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 13) /* */ +#define UX_TRACE_DEVICE_STACK_INTERFACE_DELETE (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 14) /* I1 = interface */ #define UX_TRACE_DEVICE_STACK_INTERFACE_GET (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 15) /* I1 = interface value */ #define UX_TRACE_DEVICE_STACK_INTERFACE_SET (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 16) /* I1 = alternate setting value */ #define UX_TRACE_DEVICE_STACK_SET_FEATURE (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 17) /* I1 = request value , I2 = request index */ @@ -726,23 +727,23 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_TRACE_DEVICE_STACK_TRANSFER_REQUEST (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 20) /* I1 = transfer request */ #define UX_TRACE_DEVICE_STACK_MICROSOFT_EXTENSION_REGISTER (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 21) /* I1 = transfer request */ #define UX_TRACE_DEVICE_STACK_CLASS_UNREGISTER (UX_TRACE_DEVICE_STACK_EVENTS_BASE + 22) /* I1 = class name */ - -/* Define the USBX device stack events first. */ -#define UX_TRACE_DEVICE_CLASS_EVENTS_BASE 900 -#define UX_TRACE_DEVICE_CLASS_DPUMP_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 1) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_DPUMP_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 2) /* I1 = class instance */ +/* Define the USBX device stack events first. */ + +#define UX_TRACE_DEVICE_CLASS_EVENTS_BASE 900 +#define UX_TRACE_DEVICE_CLASS_DPUMP_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 1) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_DPUMP_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 2) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_DPUMP_READ (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 3) /* I1 = class instance , I2 = buffer , I3 = requested_length */ #define UX_TRACE_DEVICE_CLASS_DPUMP_WRITE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 4) /* I1 = class instance , I2 = buffer , I3 = requested_length */ #define UX_TRACE_DEVICE_CLASS_DPUMP_CHANGE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 5) /* I1 = class instance , I2 = buffer , I3 = requested_length */ - -#define UX_TRACE_DEVICE_CLASS_CDC_ACM_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 10) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_CDC_ACM_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 11) /* I1 = class instance */ + +#define UX_TRACE_DEVICE_CLASS_CDC_ACM_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 10) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_CDC_ACM_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 11) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_CDC_ACM_READ (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 12) /* I1 = class instance , I2 = buffer , I3 = requested_length */ #define UX_TRACE_DEVICE_CLASS_CDC_ACM_WRITE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 13) /* I1 = class instance , I2 = buffer , I3 = requested_length */ - -#define UX_TRACE_DEVICE_CLASS_HID_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 20) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_HID_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 21) /* I1 = class instance */ + +#define UX_TRACE_DEVICE_CLASS_HID_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 20) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_HID_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 21) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_HID_EVENT_GET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 22) /* I1 = class instance , I2 = hid event */ #define UX_TRACE_DEVICE_CLASS_HID_EVENT_SET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 23) /* I1 = class instance , I2 = hid event */ #define UX_TRACE_DEVICE_CLASS_HID_REPORT_GET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 24) /* I1 = class instance , I2 = descriptor type , I3 = request index */ @@ -751,13 +752,13 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_TRACE_DEVICE_CLASS_HID_READ (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 27) /* I1 = class instance , I2 = buffer , I3 = requested_length */ #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 */ #define UX_TRACE_DEVICE_CLASS_HID_RECEIVER_EVENT_FREE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 29) /* I1 = class instance , I2 = receiver event */ - -#define UX_TRACE_DEVICE_CLASS_PIMA_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 30) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_PIMA_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 31) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_PIMA_DEVICE_INFO_SEND (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 32) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_PIMA_EVENT_GET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 33) /* I1 = class instance , I2 = pima event */ -#define UX_TRACE_DEVICE_CLASS_PIMA_EVENT_SET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 34) /* I1 = class instance , I2 = pima event */ -#define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_ADD (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 35) /* I1 = class instance , I2 = object handle */ + +#define UX_TRACE_DEVICE_CLASS_PIMA_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 30) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_PIMA_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 31) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_PIMA_DEVICE_INFO_SEND (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 32) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_PIMA_EVENT_GET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 33) /* I1 = class instance , I2 = pima event */ +#define UX_TRACE_DEVICE_CLASS_PIMA_EVENT_SET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 34) /* I1 = class instance , I2 = pima event */ +#define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_ADD (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 35) /* I1 = class instance , I2 = object handle */ #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_DATA_GET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 36) /* I1 = class instance , I2 = object handle */ #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_DATA_SEND (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 37) /* I1 = class instance , I2 = object handle */ #define UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_DELETE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 38) /* I1 = class instance , I2 = object handle */ @@ -781,54 +782,54 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_TRACE_DEVICE_CLASS_PIMA_STORAGE_FORMAT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 56) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_PIMA_DEVICE_RESET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 57) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_PIMA_SET_OBJECT_PROP_VALUE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 58) /* I1 = class instance */ - -#define UX_TRACE_DEVICE_CLASS_RNDIS_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 60) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_RNDIS_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 61) /* I1 = class instance */ + +#define UX_TRACE_DEVICE_CLASS_RNDIS_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 60) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_RNDIS_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 61) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_RNDIS_PACKET_RECEIVE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 62) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_RNDIS_PACKET_TRANSMIT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 63) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_RNDIS_MSG_QUERY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 64) /* I1 = class instance , I2 = rndis OID */ #define UX_TRACE_DEVICE_CLASS_RNDIS_MSG_KEEP_ALIVE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 65) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_RNDIS_MSG_RESET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 66) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_RNDIS_MSG_SET (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 67) /* I1 = class instance , I2 = rndis OID */ - -#define UX_TRACE_DEVICE_CLASS_STORAGE_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 70) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 71) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_FORMAT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 72) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_INQUIRY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 73) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_MODE_SELECT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 74) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_MODE_SENSE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 75) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_PREVENT_ALLOW_MEDIA_REMOVAL (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 76) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_READ (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 77) /* I1 = class instance , I2 = lun , I3 = sector , I4 = number sectors */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_READ_CAPACITY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 78) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_READ_FORMAT_CAPACITY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 79) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_READ_TOC (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 80) /* I1 = class instance , I2 = lun */ -#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 */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_TEST_READY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 82) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_START_STOP (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 83) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_VERIFY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 84) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_WRITE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 85) /* I1 = class instance , I2 = lun , I3 = sector , I4 = number sectors */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_GET_CONFIGURATION (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 86) /* I1 = class instance , I2 = lun */ + +#define UX_TRACE_DEVICE_CLASS_STORAGE_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 70) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 71) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_FORMAT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 72) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_INQUIRY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 73) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_MODE_SELECT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 74) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_MODE_SENSE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 75) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_PREVENT_ALLOW_MEDIA_REMOVAL (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 76) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_READ (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 77) /* I1 = class instance , I2 = lun , I3 = sector , I4 = number sectors */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_READ_CAPACITY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 78) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_READ_FORMAT_CAPACITY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 79) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_READ_TOC (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 80) /* I1 = class instance , I2 = lun */ +#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 */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_TEST_READY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 82) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_START_STOP (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 83) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_VERIFY (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 84) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_WRITE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 85) /* I1 = class instance , I2 = lun , I3 = sector , I4 = number sectors */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_GET_CONFIGURATION (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 86) /* I1 = class instance , I2 = lun */ #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 */ -#define UX_TRACE_DEVICE_CLASS_STORAGE_OTHER (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 88) /* I1 = class instance , I2 = lun */ +#define UX_TRACE_DEVICE_CLASS_STORAGE_OTHER (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 88) /* I1 = class instance , I2 = lun */ -#define UX_TRACE_DEVICE_CLASS_CDC_ECM_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 90) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_CDC_ECM_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 91) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_CDC_ECM_CHANGE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 92) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_CDC_ECM_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 90) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_CDC_ECM_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 91) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_CDC_ECM_CHANGE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 92) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_CDC_ECM_READ (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 93) /* I1 = class instance , I2 = buffer , I3 = requested_length */ #define UX_TRACE_DEVICE_CLASS_CDC_ECM_WRITE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 94) /* I1 = class instance , I2 = buffer , I3 = requested_length */ #define UX_TRACE_DEVICE_CLASS_CDC_ECM_PACKET_TRANSMIT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 95) /* I1 = class instance , I2 = buffer , I3 = requested_length */ #define UX_TRACE_DEVICE_CLASS_CDC_ECM_PACKET_RECEIVE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 96) /* I1 = class instance , I2 = buffer , I3 = requested_length */ - -#define UX_TRACE_DEVICE_CLASS_DFU_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 97) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_DFU_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 98) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_PRINTER_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 100) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_PRINTER_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 101) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_DFU_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 97) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_DFU_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 98) /* I1 = class instance */ + +#define UX_TRACE_DEVICE_CLASS_PRINTER_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 100) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_PRINTER_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 101) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_PRINTER_READ (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 102) /* I1 = class instance , I2 = buffer , I3 = requested_length */ #define UX_TRACE_DEVICE_CLASS_PRINTER_WRITE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 103) /* I1 = class instance , I2 = buffer , I3 = requested_length */ -#define UX_TRACE_DEVICE_CLASS_CCID_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 110) /* I1 = class instance */ -#define UX_TRACE_DEVICE_CLASS_CCID_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 111) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_CCID_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 110) /* I1 = class instance */ +#define UX_TRACE_DEVICE_CLASS_CCID_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 111) /* I1 = class instance */ #define UX_TRACE_DEVICE_CLASS_CCID_REQ_ABORT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 112) /* I1 = class instance , I2 = slot */ #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_ON (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 113) /* I1 = class instance , I2 = slot */ #define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_OFF (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 114) /* I1 = class instance , I2 = slot */ @@ -859,10 +860,10 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #else -#define UX_TRACE_OBJECT_REGISTER(t,p,n,a,b) -#define UX_TRACE_OBJECT_UNREGISTER(o) -#define UX_TRACE_IN_LINE_INSERT(i,a,b,c,d,f,g,h) -#define UX_TRACE_EVENT_UPDATE(e,t,i,a,b,c,d) +#define UX_TRACE_OBJECT_REGISTER(t,p,n,a,b) +#define UX_TRACE_OBJECT_UNREGISTER(o) +#define UX_TRACE_IN_LINE_INSERT(i,a,b,c,d,f,g,h) +#define UX_TRACE_EVENT_UPDATE(e,t,i,a,b,c,d) #endif @@ -883,7 +884,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_SYSTEM_CONTEXT_HOST_STACK 10 -/* Defines the number of ThreadX timer ticks per seconds. By default, the ThreadX timer tick is 10ms, +/* Defines the number of ThreadX timer ticks per seconds. By default, the ThreadX timer tick is 10ms, so the default value for this constant is 100. If TX_TIMER_TICKS_PER_SECOND is defined, this value is derived from TX_TIMER_TICKS_PER_SECOND. */ @@ -1115,13 +1116,13 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_SETUP_INDEX 4u #define UX_SETUP_LENGTH 6u #define UX_SETUP_SIZE 8u - - -/* Define USBX standard commands. */ - + + +/* Define USBX standard commands. */ + #define UX_GET_STATUS 0u #define UX_CLEAR_FEATURE 1u -#define UX_SET_FEATURE 3u +#define UX_SET_FEATURE 3u #define UX_SET_ADDRESS 5u #define UX_GET_DESCRIPTOR 6u #define UX_SET_DESCRIPTOR 7u @@ -1130,19 +1131,19 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_GET_INTERFACE 10u #define UX_SET_INTERFACE 11u #define UX_SYNCH_FRAME 12u - - -/* Define USBX command sub constants. */ - + + +/* Define USBX command sub constants. */ + #define UX_ENDPOINT_HALT 0u - + /* Define USBX feature selector constants. */ #define UX_REQUEST_FEATURE_ENDPOINT_HALT 0u #define UX_REQUEST_FEATURE_DEVICE_REMOTE_WAKEUP 1u #define UX_REQUEST_FEATURE_TEST_MODE 2u -/* Define Generic USBX constants. */ - +/* Define Generic USBX constants. */ + #define UX_UNUSED 0 #define UX_USED 1 @@ -1152,10 +1153,11 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_CACHE_SAFE_MEMORY 1 #define UX_NO_ALIGN 0u +#define UX_ALIGN_8 0x07u #define UX_ALIGN_16 0x0fu #define UX_ALIGN_32 0x1fu #define UX_ALIGN_64 0x3fu -#define UX_ALIGN_128 0x7fu +#define UX_ALIGN_128 0x7fu #define UX_ALIGN_256 0xffu #define UX_ALIGN_512 0x1ffu #define UX_ALIGN_1024 0x3ffu @@ -1164,28 +1166,28 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_SAFE_ALIGN 0xffffffffu #define UX_MAX_SCATTER_GATHER_ALIGNMENT 4096 #ifndef UX_ALIGN_MIN -#define UX_ALIGN_MIN UX_ALIGN_16 +#define UX_ALIGN_MIN UX_ALIGN_8 #endif - + #define UX_MAX_USB_DEVICES 127 - + #define UX_ENDPOINT_DIRECTION 0x80u #define UX_ENDPOINT_IN 0x80u #define UX_ENDPOINT_OUT 0x00u - + #define UX_MASK_ENDPOINT_TYPE 3u #define UX_CONTROL_ENDPOINT 0u #define UX_ISOCHRONOUS_ENDPOINT 1u #define UX_BULK_ENDPOINT 2u #define UX_INTERRUPT_ENDPOINT 3u - + #define UX_ISOCHRONOUS_ENDPOINT_IN 0x81u #define UX_ISOCHRONOUS_ENDPOINT_OUT 0x01u #define UX_BULK_ENDPOINT_IN 0x82u #define UX_BULK_ENDPOINT_OUT 0x02u #define UX_INTERRUPT_ENDPOINT_IN 0x83u #define UX_INTERRUPT_ENDPOINT_OUT 0x03u - + #define UX_MAX_PACKET_SIZE_MASK 0x7ffu #define UX_MAX_NUMBER_OF_TRANSACTIONS_MASK 0x1800u #define UX_MAX_NUMBER_OF_TRANSACTIONS_SHIFT 11 @@ -1196,18 +1198,18 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_REQUEST_DIRECTION 0x80u #define UX_REQUEST_IN 0x80u #define UX_REQUEST_OUT 0x00u - + #define UX_REQUEST_TYPE 0x60u #define UX_REQUEST_TYPE_STANDARD 0x00u #define UX_REQUEST_TYPE_CLASS 0x20u #define UX_REQUEST_TYPE_VENDOR 0x40u - + #define UX_REQUEST_TARGET 0x03u #define UX_REQUEST_TARGET_DEVICE 0x00u #define UX_REQUEST_TARGET_INTERFACE 0x01u #define UX_REQUEST_TARGET_ENDPOINT 0x02u #define UX_REQUEST_TARGET_OTHER 0x03u - + #define UX_DEVICE_RESET 0 #define UX_DEVICE_ATTACHED 1 #define UX_DEVICE_ADDRESSED 2 @@ -1220,11 +1222,11 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_DEVICE_BUS_RESET_COMPLETED 9 #define UX_DEVICE_REMOVED 10 #define UX_DEVICE_FORCE_DISCONNECT 11 - + #define UX_ENDPOINT_RESET 0 #define UX_ENDPOINT_RUNNING 1 #define UX_ENDPOINT_HALTED 2 - + #define UX_DEVICE_DESCRIPTOR_ITEM 1u #define UX_CONFIGURATION_DESCRIPTOR_ITEM 2u #define UX_STRING_DESCRIPTOR_ITEM 3u @@ -1238,7 +1240,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_DEVICE_CAPABILITY_DESCRIPTOR_ITEM 16u #define UX_DFU_FUNCTIONAL_DESCRIPTOR_ITEM 0x21u #define UX_HUB_DESCRIPTOR_ITEM 0x29u - + #define UX_CAPABILITY_WIRELESS_USB 0x01u #define UX_CAPABILITY_USB_2_0_EXTENSION 0x02u #define UX_CAPABILITY_SUPERSPEED_USB 0x03u @@ -1264,7 +1266,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #ifndef UX_NON_CONTROL_TRANSFER_TIMEOUT #define UX_NON_CONTROL_TRANSFER_TIMEOUT 50000 #endif -#define UX_PORT_ENABLE_WAIT 50 +#define UX_PORT_ENABLE_WAIT 50 #define UX_DEVICE_ADDRESS_SET_WAIT 50 #define UX_HIGH_SPEED_DETECTION_HANDSHAKE_SUSPEND_WAIT 200 #define UX_ENUMERATION_THREAD_WAIT 200 @@ -1281,35 +1283,35 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL /* USBX 5.8 BACKWARD COMPATIBILITY DEFINITIONS. THESE DEFINITIONS ARE NOW OBSOLETE BUT DEFINED HERE FOR COMPATIBILITY REASONS. */ - + #ifndef UX_CONTROL_TRANSFER_TIMEOUT_IN_MS #define UX_CONTROL_TRANSFER_TIMEOUT_IN_MS 10000 -#endif +#endif #ifndef UX_NON_CONTROL_TRANSFER_TIMEOUT_IN_MS #define UX_NON_CONTROL_TRANSFER_TIMEOUT_IN_MS 50000 -#endif +#endif -#ifndef UX_PORT_ENABLE_WAIT_IN_MS +#ifndef UX_PORT_ENABLE_WAIT_IN_MS #define UX_PORT_ENABLE_WAIT_IN_MS 500 #endif -#ifndef UX_DEVICE_ADDRESS_SET_WAIT_IN_MS +#ifndef UX_DEVICE_ADDRESS_SET_WAIT_IN_MS #define UX_DEVICE_ADDRESS_SET_WAIT_IN_MS 500 #endif -#ifndef UX_HIGH_SPEED_DETECTION_HANDSHAKE_SUSPEND_WAIT_IN_MS +#ifndef UX_HIGH_SPEED_DETECTION_HANDSHAKE_SUSPEND_WAIT_IN_MS #define UX_HIGH_SPEED_DETECTION_HANDSHAKE_SUSPEND_WAIT_IN_MS 2000 #endif /* END OF 5.8 BACKWARD COMPATIBILITY DEFINITIONS. */ - + #define UX_TRANSFER_PHASE_SETUP 1 #define UX_TRANSFER_PHASE_DATA_IN 2 #define UX_TRANSFER_PHASE_DATA_OUT 3 #define UX_TRANSFER_PHASE_STATUS_IN 4 #define UX_TRANSFER_PHASE_STATUS_OUT 5 - + /* Host change callback events : _callback(event, *class, *instance) */ @@ -1330,15 +1332,15 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_STANDALONE_WAIT_BACKGROUND_TASK 0x00u -/* Define USBX transfer request status constants. */ - +/* Define USBX transfer request status constants. */ + #define UX_TRANSFER_STATUS_NOT_PENDING 0 #define UX_TRANSFER_STATUS_PENDING 1 -#define UX_TRANSFER_STATUS_COMPLETED 2 +#define UX_TRANSFER_STATUS_COMPLETED 2 #define UX_TRANSFER_STATUS_ABORT 4 - -/* Define USBX device power constants. */ - + +/* Define USBX device power constants. */ + #define UX_DEVICE_BUS_POWERED 1u #define UX_DEVICE_SELF_POWERED 2u #define UX_MAX_SELF_POWER (500u/2) @@ -1354,49 +1356,49 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_OTG_HNP_SUPPORT 2u #define UX_HCD_OTG_CAPABLE 1u #define UX_DCD_OTG_CAPABLE 1u - -#define UX_OTG_FEATURE_B_HNP_ENABLE 3u -#define UX_OTG_FEATURE_A_HNP_SUPPORT 4u -#define UX_OTG_FEATURE_A_ALT_HNP_SUPPORT 5u + +#define UX_OTG_FEATURE_B_HNP_ENABLE 3u +#define UX_OTG_FEATURE_A_HNP_SUPPORT 4u +#define UX_OTG_FEATURE_A_ALT_HNP_SUPPORT 5u #define UX_OTG_STATUS_SELECTOR 0xF000u #define UX_OTG_HOST_REQUEST_FLAG 0x01u - + #define UX_OTG_IDLE 0u -#define UX_OTG_IDLE_TO_HOST 1u -#define UX_OTG_IDLE_TO_SLAVE 2u -#define UX_OTG_HOST_TO_IDLE 3u -#define UX_OTG_HOST_TO_SLAVE 4u -#define UX_OTG_SLAVE_TO_IDLE 5u -#define UX_OTG_SLAVE_TO_HOST 6u -#define UX_OTG_SLAVE_SRP 7u - -#define UX_OTG_MODE_IDLE 0u -#define UX_OTG_MODE_SLAVE 1u -#define UX_OTG_MODE_HOST 2u +#define UX_OTG_IDLE_TO_HOST 1u +#define UX_OTG_IDLE_TO_SLAVE 2u +#define UX_OTG_HOST_TO_IDLE 3u +#define UX_OTG_HOST_TO_SLAVE 4u +#define UX_OTG_SLAVE_TO_IDLE 5u +#define UX_OTG_SLAVE_TO_HOST 6u +#define UX_OTG_SLAVE_SRP 7u + +#define UX_OTG_MODE_IDLE 0u +#define UX_OTG_MODE_SLAVE 1u +#define UX_OTG_MODE_HOST 2u -#define UX_OTG_DEVICE_IDLE 0u -#define UX_OTG_DEVICE_A 1u -#define UX_OTG_DEVICE_B 2u +#define UX_OTG_DEVICE_IDLE 0u +#define UX_OTG_DEVICE_A 1u +#define UX_OTG_DEVICE_B 2u + +#define UX_OTG_VBUS_IDLE 0u +#define UX_OTG_VBUS_ON 1u +#define UX_OTG_VBUS_OFF 2u -#define UX_OTG_VBUS_IDLE 0u -#define UX_OTG_VBUS_ON 1u -#define UX_OTG_VBUS_OFF 2u - #define UX_OTG_HNP_THREAD_SLEEP_TIME (2 * UX_PERIODIC_RATE) -/* Define USBX device speed constants. */ - +/* Define USBX device speed constants. */ + #define UX_DEFAULT_HS_MPS 64 #define UX_DEFAULT_MPS 8 - + #define UX_LOW_SPEED_DEVICE 0 #define UX_FULL_SPEED_DEVICE 1 -#define UX_HIGH_SPEED_DEVICE 2 - - -/* Define USBX generic port status constants. */ - +#define UX_HIGH_SPEED_DEVICE 2 + + +/* Define USBX generic port status constants. */ + #define UX_PS_CCS 0x01u #define UX_PS_CPE 0x01u #define UX_PS_PES 0x02u @@ -1407,7 +1409,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_PS_DS_LS 0x00u #define UX_PS_DS_FS 0x40u #define UX_PS_DS_HS 0x80u - + #define UX_PS_DS 6u @@ -1434,23 +1436,23 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_STATE_IS_LOCKED(s) ((s) >= UX_STATE_LOCK) /* Locked but not pendint */ -/* Define USBX Error Code constants. The following format describes +/* Define USBX Error Code constants. The following format describes their meaning: - - 0x00 : Success - 0x0x : State machine return codes - 0x1x : Configuration errors - 0x2x : USB transport errors - 0x3x : USB controller errors - 0x4x : USB topology errors - 0x5x : USB API errors - 0x6x : USB Generic Class errors - 0x7x : USB HID Class errors - 0x8x : USB Audio Class errors - 0x9x : USB CDC-ECM Class errors + + 0x00 : Success + 0x0x : State machine return codes + 0x1x : Configuration errors + 0x2x : USB transport errors + 0x3x : USB controller errors + 0x4x : USB topology errors + 0x5x : USB API errors + 0x6x : USB Generic Class errors + 0x7x : USB HID Class errors + 0x8x : USB Audio Class errors + 0x9x : USB CDC-ECM Class errors ... 0xfx : General errors -*/ +*/ #define UX_SUCCESS 0 @@ -1476,7 +1478,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_MEMORY_ARRAY_FULL 0x1a #define UX_FATAL_ERROR 0x1b #define UX_ALREADY_ACTIVATED 0x1c - + #define UX_TRANSFER_STALLED 0x21 #define UX_TRANSFER_NO_ANSWER 0x22 #define UX_TRANSFER_ERROR 0x23 @@ -1486,17 +1488,17 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_TRANSFER_BUFFER_OVERFLOW 0x27 #define UX_TRANSFER_APPLICATION_RESET 0x28 #define UX_TRANSFER_DATA_LESS_THAN_EXPECTED 0x29 - + #define UX_PORT_RESET_FAILED 0x31 #define UX_CONTROLLER_INIT_FAILED 0x32 #define UX_CONTROLLER_DEAD 0x33 - + #define UX_NO_BANDWIDTH_AVAILABLE 0x41 #define UX_DESCRIPTOR_CORRUPTED 0x42 #define UX_OVER_CURRENT_CONDITION 0x43 #define UX_DEVICE_ENUMERATION_FAILURE 0x44 #define UX_TOO_MANY_HUB_PORTS 0x45 - + #define UX_DEVICE_HANDLE_UNKNOWN 0x50 #define UX_CONFIGURATION_HANDLE_UNKNOWN 0x51 #define UX_INTERFACE_HANDLE_UNKNOWN 0x52 @@ -1513,7 +1515,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_BUFFER_OVERFLOW 0x5d #define UX_NO_ALTERNATE_SETTING 0x5e #define UX_NO_DEVICE_CONNECTED 0x5f - + #define UX_HOST_CLASS_PROTOCOL_ERROR 0x60 #define UX_HOST_CLASS_MEMORY_ERROR 0x61 #define UX_HOST_CLASS_MEDIA_NOT_SUPPORTED 0x62 @@ -1531,7 +1533,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_HOST_CLASS_HID_REPORT_ERROR 0x79 #define UX_HOST_CLASS_HID_PERIODIC_REPORT_ERROR 0x7A #define UX_HOST_CLASS_HID_UNKNOWN 0x7B - + #define UX_HOST_CLASS_AUDIO_WRONG_TYPE 0x80 #define UX_HOST_CLASS_AUDIO_WRONG_INTERFACE 0x81 #define UX_HOST_CLASS_AUDIO_WRONG_FREQUENCY 0x82 @@ -1541,10 +1543,10 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_CLASS_ETH_PACKET_POOL_ERROR 0x91 #define UX_CLASS_ETH_PACKET_ERROR 0x92 #define UX_CLASS_ETH_SIZE_ERROR 0x93 - - -/* Define USBX HCD API function constants. */ - + + +/* Define USBX HCD API function constants. */ + #define UX_HCD_DISABLE_CONTROLLER 1 #define UX_HCD_GET_PORT_STATUS 2 #define UX_HCD_ENABLE_PORT 3 @@ -1565,9 +1567,9 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_HCD_PROCESS_DONE_QUEUE 17 #define UX_HCD_TASKS_RUN 17 #define UX_HCD_UNINITIALIZE 18 - -/* Define USBX DCD API function constants. */ - + +/* Define USBX DCD API function constants. */ + #define UX_DCD_DISABLE_CONTROLLER 1 #define UX_DCD_GET_PORT_STATUS 2 #define UX_DCD_ENABLE_PORT 3 @@ -1591,35 +1593,35 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_DCD_CHANGE_STATE 19 #define UX_DCD_STALL_ENDPOINT 20 #define UX_DCD_ENDPOINT_STATUS 21 - - -/* Define USBX generic host controller constants. */ - + + +/* Define USBX generic host controller constants. */ + #define UX_HCD_STATUS_UNUSED 0 #define UX_HCD_STATUS_HALTED 1 #define UX_HCD_STATUS_OPERATIONAL 2 #define UX_HCD_STATUS_DEAD 3 - -/* Define USBX generic SLAVE controller constants. */ - + +/* Define USBX generic SLAVE controller constants. */ + #define UX_DCD_STATUS_HALTED 0 #define UX_DCD_STATUS_OPERATIONAL 1 #define UX_DCD_STATUS_DEAD 2 - -/* Define USBX SLAVE controller VBUS constants. */ - + +/* Define USBX SLAVE controller VBUS constants. */ + #define UX_DCD_VBUS_RESET 0 #define UX_DCD_VBUS_SET 1 - -/* Define USBX class interface constants. */ - + +/* Define USBX class interface constants. */ + #define UX_HOST_CLASS_COMMAND_QUERY 1 #define UX_HOST_CLASS_COMMAND_ACTIVATE 2 #define UX_HOST_CLASS_COMMAND_DEACTIVATE 3 #define UX_HOST_CLASS_COMMAND_DESTROY 4 #define UX_HOST_CLASS_COMMAND_ACTIVATE_START UX_HOST_CLASS_COMMAND_ACTIVATE #define UX_HOST_CLASS_COMMAND_ACTIVATE_WAIT 5 - + #define UX_SLAVE_CLASS_COMMAND_QUERY 1 #define UX_SLAVE_CLASS_COMMAND_ACTIVATE 2 #define UX_SLAVE_CLASS_COMMAND_DEACTIVATE 3 @@ -1627,29 +1629,29 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_SLAVE_CLASS_COMMAND_INITIALIZE 5 #define UX_SLAVE_CLASS_COMMAND_CHANGE 6 #define UX_SLAVE_CLASS_COMMAND_UNINITIALIZE 7 - + #define UX_HOST_CLASS_COMMAND_USAGE_PIDVID 1 #define UX_HOST_CLASS_COMMAND_USAGE_CSP 2 #define UX_HOST_CLASS_COMMAND_USAGE_DCSP 3 - + #define UX_HOST_CLASS_INSTANCE_FREE 0 #define UX_HOST_CLASS_INSTANCE_LIVE 1 #define UX_HOST_CLASS_INSTANCE_SHUTDOWN 2 #define UX_HOST_CLASS_INSTANCE_MOUNTING 3 -/* Define USBX root HUB constants. */ - +/* Define USBX root HUB constants. */ + #define UX_RH_ENUMERATION_RETRY 3 #define UX_RH_ENUMERATION_RETRY_DELAY 100 - -/* Define USBX PCI driver constants. */ - + +/* Define USBX PCI driver constants. */ + #define UX_PCI_NB_FUNCTIONS 7 #define UX_PCI_NB_DEVICE 32 #define UX_PCI_NB_BUS 0xff - + #define UX_PCI_CMD_IO_ENABLE 0x0001u #define UX_PCI_CMD_MEM_ENABLE 0x0002u #define UX_PCI_CMD_MASTER_ENABLE 0x0004u @@ -1660,10 +1662,10 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_PCI_CMD_WAIT_CYCLE_CTRL_ENABLE 0x0080u #define UX_PCI_CMD_SERR_ENABLE 0x0100u #define UX_PCI_CMD_FBB_ENABLE 0x0200u - + #define UX_PCI_CFG_CTRL_ADDRESS 0x0cf8u #define UX_PCI_CFG_DATA_ADDRESS 0x0cfcu - + #define UX_PCI_CFG_VENDOR_ID 0x00 #define UX_PCI_CFG_DEVICE_ID 0x02 #define UX_PCI_CFG_COMMAND 0x04 @@ -1692,10 +1694,10 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_PCI_CFG_INT_PIN 0x3d #define UX_PCI_CFG_MIN_GNT 0x3e #define UX_PCI_CFG_MAX_LATENCY 0x3f - + #define UX_PCI_CFG_SBRN 0x60 #define UX_PCI_CFG_FLADJ 0x61 - + /* Define DFU constants. */ #define UX_SYSTEM_DFU_STATE_APP_IDLE 0 #define UX_SYSTEM_DFU_STATE_APP_DETACH 1 @@ -1703,14 +1705,14 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_SYSTEM_DFU_STATE_DFU_DNLOAD_SYNC 3 #define UX_SYSTEM_DFU_STATE_DFU_DNBUSY 4 #define UX_SYSTEM_DFU_STATE_DFU_DNLOAD_IDLE 5 -#define UX_SYSTEM_DFU_STATE_DFU_MANIFEST_SYNC 6 +#define UX_SYSTEM_DFU_STATE_DFU_MANIFEST_SYNC 6 #define UX_SYSTEM_DFU_STATE_DFU_MANIFEST 7 -#define UX_SYSTEM_DFU_STATE_DFU_MANIFEST_WAIT_RESET 8 +#define UX_SYSTEM_DFU_STATE_DFU_MANIFEST_WAIT_RESET 8 #define UX_SYSTEM_DFU_STATE_DFU_UPLOAD_IDLE 9 #define UX_SYSTEM_DFU_STATE_DFU_ERROR 10 -/* Define basic class constants. */ - +/* Define basic class constants. */ + #define UX_HOST_CLASS_PRINTER_NAME_LENGTH 64 @@ -1741,8 +1743,8 @@ typedef struct UX_HOST_CLASS_COMMAND_STRUCT UINT ux_host_class_command_iad_class; UINT ux_host_class_command_iad_subclass; UINT ux_host_class_command_iad_protocol; - - struct UX_HOST_CLASS_STRUCT + + struct UX_HOST_CLASS_STRUCT *ux_host_class_command_class_ptr; } UX_HOST_CLASS_COMMAND; @@ -1778,7 +1780,7 @@ typedef struct UX_TRANSFER_STRUCT { ULONG ux_transfer_request_status; - struct UX_ENDPOINT_STRUCT + struct UX_ENDPOINT_STRUCT *ux_transfer_request_endpoint; UCHAR * ux_transfer_request_data_pointer; ULONG ux_transfer_request_requested_length; @@ -1793,7 +1795,7 @@ typedef struct UX_TRANSFER_STRUCT ULONG ux_transfer_request_timeout_value; UINT ux_transfer_request_completion_code; ULONG ux_transfer_request_packet_length; - struct UX_TRANSFER_STRUCT + struct UX_TRANSFER_STRUCT *ux_transfer_request_next_transfer_request; VOID *ux_transfer_request_user_specific; #if !defined(UX_HOST_STANDALONE) @@ -1846,16 +1848,16 @@ typedef struct UX_ENDPOINT_STRUCT ULONG ux_endpoint; ULONG ux_endpoint_state; - void *ux_endpoint_ed; - struct UX_ENDPOINT_DESCRIPTOR_STRUCT + void *ux_endpoint_ed; + struct UX_ENDPOINT_DESCRIPTOR_STRUCT ux_endpoint_descriptor; - struct UX_ENDPOINT_STRUCT + struct UX_ENDPOINT_STRUCT *ux_endpoint_next_endpoint; - struct UX_INTERFACE_STRUCT + struct UX_INTERFACE_STRUCT *ux_endpoint_interface; - struct UX_DEVICE_STRUCT + struct UX_DEVICE_STRUCT *ux_endpoint_device; - struct UX_TRANSFER_STRUCT + struct UX_TRANSFER_STRUCT ux_endpoint_transfer_request; } UX_ENDPOINT; @@ -1957,7 +1959,7 @@ typedef struct UX_INTERFACE_ASSOCIATION_DESCRIPTOR_STRUCT UCHAR bFunctionProtocol; UCHAR iFunction; } UX_INTERFACE_ASSOCIATION_DESCRIPTOR; - + #define UX_INTERFACE_ASSOCIATION_DESCRIPTOR_ENTRIES 8 #define UX_INTERFACE_ASSOCIATION_DESCRIPTOR_LENGTH 8 @@ -1980,25 +1982,25 @@ typedef struct UX_DEVICE_STRUCT #if !defined(UX_HOST_STANDALONE) UX_SEMAPHORE ux_device_protection_semaphore; #endif - struct UX_HOST_CLASS_STRUCT + struct UX_HOST_CLASS_STRUCT *ux_device_class; VOID *ux_device_class_instance; - struct UX_CONFIGURATION_STRUCT + struct UX_CONFIGURATION_STRUCT *ux_device_first_configuration; - struct UX_DEVICE_DESCRIPTOR_STRUCT + struct UX_DEVICE_DESCRIPTOR_STRUCT ux_device_descriptor; - struct UX_ENDPOINT_STRUCT + struct UX_ENDPOINT_STRUCT ux_device_control_endpoint; ULONG ux_device_port_location; #if UX_MAX_HCD > 1 - struct UX_HCD_STRUCT + struct UX_HCD_STRUCT *ux_device_hcd; #endif #if UX_MAX_DEVICES > 1 struct UX_DEVICE_STRUCT *ux_device_parent; ULONG ux_device_max_power; - struct UX_HUB_TT_STRUCT + struct UX_HUB_TT_STRUCT ux_device_hub_tt[UX_MAX_TT]; #endif @@ -2102,13 +2104,13 @@ typedef struct UX_CONFIGURATION_STRUCT ULONG ux_configuration_handle; ULONG ux_configuration_state; ULONG ux_configuration_otg_capabilities; - struct UX_CONFIGURATION_DESCRIPTOR_STRUCT + struct UX_CONFIGURATION_DESCRIPTOR_STRUCT ux_configuration_descriptor; - struct UX_INTERFACE_STRUCT + struct UX_INTERFACE_STRUCT *ux_configuration_first_interface; - struct UX_CONFIGURATION_STRUCT + struct UX_CONFIGURATION_STRUCT *ux_configuration_next_configuration; - struct UX_DEVICE_STRUCT + struct UX_DEVICE_STRUCT *ux_configuration_device; ULONG ux_configuration_iad_class; ULONG ux_configuration_iad_subclass; @@ -2138,7 +2140,7 @@ typedef struct UX_INTERFACE_DESCRIPTOR_STRUCT UCHAR iInterface; UCHAR _align_size[3]; } UX_INTERFACE_DESCRIPTOR; - + #define UX_INTERFACE_DESCRIPTOR_ENTRIES 9 #define UX_INTERFACE_DESCRIPTOR_LENGTH 9 @@ -2151,16 +2153,16 @@ typedef struct UX_INTERFACE_STRUCT ULONG ux_interface_handle; ULONG ux_interface_state; UINT ux_interface_current_alternate_setting; - struct UX_INTERFACE_DESCRIPTOR_STRUCT + struct UX_INTERFACE_DESCRIPTOR_STRUCT ux_interface_descriptor; - struct UX_HOST_CLASS_STRUCT + struct UX_HOST_CLASS_STRUCT *ux_interface_class; VOID *ux_interface_class_instance; - struct UX_ENDPOINT_STRUCT + struct UX_ENDPOINT_STRUCT *ux_interface_first_endpoint; - struct UX_INTERFACE_STRUCT + struct UX_INTERFACE_STRUCT *ux_interface_next_interface; - struct UX_CONFIGURATION_STRUCT + struct UX_CONFIGURATION_STRUCT *ux_interface_configuration; ULONG ux_interface_iad_class; ULONG ux_interface_iad_subclass; @@ -2242,7 +2244,7 @@ typedef struct UX_DFU_FUNCTIONAL_DESCRIPTOR_STRUCT USHORT bcdDFUVersion; UCHAR _align_size[2]; } UX_DFU_FUNCTIONAL_DESCRIPTOR; - + #define UX_DFU_FUNCTIONAL_DESCRIPTOR_ENTRIES 6 #define UX_DFU_FUNCTIONAL_DESCRIPTOR_LENGTH 9 @@ -2250,7 +2252,7 @@ typedef struct UX_DFU_FUNCTIONAL_DESCRIPTOR_STRUCT /* Define USBX Host Controller structure. */ typedef struct UX_HCD_STRUCT -{ +{ #if defined(UX_NAME_REFERENCED_BY_POINTER) const UCHAR *ux_hcd_name; @@ -2294,7 +2296,7 @@ typedef struct UX_SLAVE_TRANSFER_STRUCT ULONG ux_slave_transfer_request_status; ULONG ux_slave_transfer_request_type; - struct UX_SLAVE_ENDPOINT_STRUCT + struct UX_SLAVE_ENDPOINT_STRUCT *ux_slave_transfer_request_endpoint; UCHAR *ux_slave_transfer_request_data_pointer; UCHAR *ux_slave_transfer_request_current_data_pointer; @@ -2324,20 +2326,20 @@ typedef struct UX_SLAVE_TRANSFER_STRUCT /* Define USBX Device Controller Endpoint structure. */ typedef struct UX_SLAVE_ENDPOINT_STRUCT -{ +{ ULONG ux_slave_endpoint_status; ULONG ux_slave_endpoint_state; - void *ux_slave_endpoint_ed; - struct UX_ENDPOINT_DESCRIPTOR_STRUCT + void *ux_slave_endpoint_ed; + struct UX_ENDPOINT_DESCRIPTOR_STRUCT ux_slave_endpoint_descriptor; - struct UX_SLAVE_ENDPOINT_STRUCT + struct UX_SLAVE_ENDPOINT_STRUCT *ux_slave_endpoint_next_endpoint; - struct UX_SLAVE_INTERFACE_STRUCT + struct UX_SLAVE_INTERFACE_STRUCT *ux_slave_endpoint_interface; - struct UX_SLAVE_DEVICE_STRUCT + struct UX_SLAVE_DEVICE_STRUCT *ux_slave_endpoint_device; - struct UX_SLAVE_TRANSFER_STRUCT + struct UX_SLAVE_TRANSFER_STRUCT ux_slave_endpoint_transfer_request; } UX_SLAVE_ENDPOINT; @@ -2345,17 +2347,17 @@ typedef struct UX_SLAVE_ENDPOINT_STRUCT /* Define USBX Device Controller Interface structure. */ typedef struct UX_SLAVE_INTERFACE_STRUCT -{ +{ ULONG ux_slave_interface_status; - struct UX_SLAVE_CLASS_STRUCT + struct UX_SLAVE_CLASS_STRUCT *ux_slave_interface_class; VOID *ux_slave_interface_class_instance; - struct UX_INTERFACE_DESCRIPTOR_STRUCT + struct UX_INTERFACE_DESCRIPTOR_STRUCT ux_slave_interface_descriptor; - struct UX_SLAVE_INTERFACE_STRUCT + struct UX_SLAVE_INTERFACE_STRUCT *ux_slave_interface_next_interface; - struct UX_SLAVE_ENDPOINT_STRUCT + struct UX_SLAVE_ENDPOINT_STRUCT *ux_slave_interface_first_endpoint; } UX_SLAVE_INTERFACE; @@ -2363,33 +2365,33 @@ typedef struct UX_SLAVE_INTERFACE_STRUCT /* Define USBX Device Controller structure. */ typedef struct UX_SLAVE_DEVICE_STRUCT -{ +{ - ULONG ux_slave_device_state; - struct UX_DEVICE_DESCRIPTOR_STRUCT + ULONG ux_slave_device_state; + struct UX_DEVICE_DESCRIPTOR_STRUCT ux_slave_device_descriptor; - struct UX_SLAVE_ENDPOINT_STRUCT + struct UX_SLAVE_ENDPOINT_STRUCT ux_slave_device_control_endpoint; ULONG ux_slave_device_configuration_selected; - struct UX_CONFIGURATION_DESCRIPTOR_STRUCT + struct UX_CONFIGURATION_DESCRIPTOR_STRUCT ux_slave_device_configuration_descriptor; - struct UX_SLAVE_INTERFACE_STRUCT + struct UX_SLAVE_INTERFACE_STRUCT *ux_slave_device_first_interface; - struct UX_SLAVE_INTERFACE_STRUCT + struct UX_SLAVE_INTERFACE_STRUCT *ux_slave_device_interfaces_pool; ULONG ux_slave_device_interfaces_pool_number; - struct UX_SLAVE_ENDPOINT_STRUCT + struct UX_SLAVE_ENDPOINT_STRUCT *ux_slave_device_endpoints_pool; ULONG ux_slave_device_endpoints_pool_number; - ULONG ux_slave_device_power_state; - + ULONG ux_slave_device_power_state; + } UX_SLAVE_DEVICE; /* Define USBX Device Controller structure. */ typedef struct UX_SLAVE_DCD_STRUCT -{ +{ UINT ux_slave_dcd_status; UINT ux_slave_dcd_controller_type; @@ -2419,11 +2421,11 @@ typedef struct UX_SLAVE_CLASS_COMMAND_STRUCT UINT ux_slave_class_command_class; UINT ux_slave_class_command_subclass; UINT ux_slave_class_command_protocol; - struct UX_SLAVE_CLASS_STRUCT + struct UX_SLAVE_CLASS_STRUCT *ux_slave_class_command_class_ptr; VOID *ux_slave_class_command_parameter; VOID *ux_slave_class_command_interface_number; - + } UX_SLAVE_CLASS_COMMAND; @@ -2448,53 +2450,81 @@ typedef struct UX_SLAVE_CLASS_STRUCT #else UINT (*ux_slave_class_task_function)(VOID *class_instance); #endif - VOID *ux_slave_class_interface_parameter; - ULONG ux_slave_class_interface_number; - ULONG ux_slave_class_configuration_number; - struct UX_SLAVE_INTERFACE_STRUCT + VOID *ux_slave_class_interface_parameter; + ULONG ux_slave_class_interface_number; + ULONG ux_slave_class_configuration_number; + struct UX_SLAVE_INTERFACE_STRUCT *ux_slave_class_interface; } UX_SLAVE_CLASS; +#define UX_UCHAR_POINTER_ADD(a,b) (((UCHAR *) (a)) + ((UINT) (b))) +#define UX_UCHAR_POINTER_SUB(a,b) (((UCHAR *) (a)) - ((UINT) (b))) +#define UX_UCHAR_POINTER_DIF(a,b) ((ULONG)(((UCHAR *) (a)) - ((UCHAR *) (b)))) +#define UX_ULONG_POINTER_ADD(a,b) (((ULONG *) (a)) + ((UINT) (b))) +#define UX_ULONG_POINTER_SUB(a,b) (((ULONG *) (a)) - ((UINT) (b))) +#define UX_ULONG_POINTER_DIF(a,b) ((ULONG)(((ULONG *) (a)) - ((ULONG *) (b)))) +#define UX_POINTER_TO_ULONG_CONVERT(a) ((ULONG) ((VOID *) (a))) +#define UX_ULONG_TO_POINTER_CONVERT(a) ((VOID *) ((ULONG) (a))) +#define UX_POINTER_TO_ALIGN_TYPE_CONVERT(a) ((ALIGN_TYPE) ((VOID *) (a))) +#define UX_ALIGN_TYPE_TO_POINTER_CONVERT(a) ((VOID *) ((ALIGN_TYPE) (a))) +#define UX_LOOP_FOREVER ((UINT) 1) +#define UX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR **) ((VOID *) (a))) +#define UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(a) ((UCHAR **) ((VOID *) (a))) +#define UX_VOID_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR *) ((VOID *) (a))) +#define UX_VOID_TO_INDIRECT_UCHAR_POINTER_CONVERT(a) ((UCHAR **) ((VOID *) (a))) +#define UX_VOID_TO_BYTE_POOL_POINTER_CONVERT(a) ((UX_MEMORY_BYTE_POOL *) ((VOID *) (a))) +#define UX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR *) ((VOID *) (a))) +#ifndef UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT +#define UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(a) ((ALIGN_TYPE *) ((VOID *) (a))) +#endif +#define UX_UCHAR_TO_INDIRECT_BYTE_POOL_POINTER(a) ((UX_MEMORY_BYTE_POOL **) ((VOID *) (a))) +#define UX_MEMORY_BLOCK_HEADER_SIZE (sizeof(UCHAR *) + sizeof(ALIGN_TYPE)) + +#ifndef UX_BYTE_BLOCK_FREE +#define UX_BYTE_BLOCK_FREE ((ULONG) 0xFFFFEEEEUL) +#endif + +#ifndef UX_BYTE_BLOCK_MIN +#define UX_BYTE_BLOCK_MIN ((ULONG) 20) +#endif + /* Define USBX Memory Management structure. */ -typedef struct UX_MEMORY_BLOCK_STRUCT +typedef struct UX_MEMORY_BYTE_POOL_STRUCT { - ULONG ux_memory_block_size; - ULONG ux_memory_block_status; - struct UX_MEMORY_BLOCK_STRUCT - *ux_memory_block_next; - struct UX_MEMORY_BLOCK_STRUCT - *ux_memory_block_previous; -} UX_MEMORY_BLOCK; + /* Define the number of available bytes in the pool. */ + ULONG ux_byte_pool_available; + /* Define the number of fragments in the pool. */ + UINT ux_byte_pool_fragments; -typedef struct UX_SYSTEM_STRUCT -{ + /* Define the search pointer used for initial searching for memory in a byte pool. */ + UCHAR *ux_byte_pool_search; + + /* Save the start address of the byte pool's memory area. */ + UCHAR *ux_byte_pool_start; + + /* Save the byte pool's size in bytes. */ + ULONG ux_byte_pool_size; - UX_MEMORY_BLOCK *ux_system_regular_memory_pool_start; - ULONG ux_system_regular_memory_pool_size; - ULONG ux_system_regular_memory_pool_free; - UX_MEMORY_BLOCK *ux_system_cache_safe_memory_pool_start; - ULONG ux_system_cache_safe_memory_pool_size; - ULONG ux_system_cache_safe_memory_pool_free; #ifdef UX_ENABLE_MEMORY_STATISTICS - UCHAR *ux_system_regular_memory_pool_base; - ALIGN_TYPE ux_system_regular_memory_pool_max_start_offset; - ALIGN_TYPE ux_system_regular_memory_pool_min_free; - UCHAR *ux_system_cache_safe_memory_pool_base; - ALIGN_TYPE ux_system_cache_safe_memory_pool_max_start_offset; - ALIGN_TYPE ux_system_cache_safe_memory_pool_min_free; - ULONG ux_system_regular_memory_pool_alloc_count; - ULONG ux_system_regular_memory_pool_alloc_total; - ULONG ux_system_regular_memory_pool_alloc_max_count; - ULONG ux_system_regular_memory_pool_alloc_max_total; - ULONG ux_system_cache_safe_memory_pool_alloc_count; - ULONG ux_system_cache_safe_memory_pool_alloc_total; - ULONG ux_system_cache_safe_memory_pool_alloc_max_count; - ULONG ux_system_cache_safe_memory_pool_alloc_max_total; + ALIGN_TYPE ux_byte_pool_min_free; + ULONG ux_byte_pool_alloc_count; + ULONG ux_byte_pool_alloc_total; + ULONG ux_byte_pool_alloc_max_count; + ULONG ux_byte_pool_alloc_max_total; #endif +} UX_MEMORY_BYTE_POOL; + +#define UX_MEMORY_BYTE_POOL_REGULAR 0 +#define UX_MEMORY_BYTE_POOL_CACHE_SAFE 1 +#define UX_MEMORY_BYTE_POOL_NUM 2 + +typedef struct UX_SYSTEM_STRUCT +{ + UX_MEMORY_BYTE_POOL *ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_NUM]; UINT ux_system_thread_lowest_priority; #if !defined(UX_STANDALONE) @@ -2522,7 +2552,7 @@ typedef struct UX_SYSTEM_STRUCT /* Define USBX System Host Data structure. */ typedef struct UX_SYSTEM_HOST_STRUCT -{ +{ #if UX_MAX_CLASS_DRIVER > 1 UINT ux_system_host_max_class; @@ -2607,7 +2637,7 @@ typedef struct UX_SYSTEM_HOST_STRUCT typedef struct UX_SYSTEM_SLAVE_STRUCT -{ +{ UX_SLAVE_DCD ux_system_slave_dcd; UX_SLAVE_DEVICE ux_system_slave_device; @@ -2652,7 +2682,7 @@ typedef struct UX_SYSTEM_SLAVE_STRUCT #endif typedef struct UX_SYSTEM_OTG_STRUCT -{ +{ #if !defined(UX_OTG_STANDALONE) UX_THREAD ux_system_otg_thread; @@ -2678,7 +2708,7 @@ typedef struct UX_SYSTEM_OTG_STRUCT typedef struct UX_HOST_CLASS_DPUMP_STRUCT { - struct UX_HOST_CLASS_DPUMP_STRUCT + struct UX_HOST_CLASS_DPUMP_STRUCT *ux_host_class_dpump_next_instance; UX_HOST_CLASS *ux_host_class_dpump_class; UX_DEVICE *ux_host_class_dpump_device; @@ -2695,8 +2725,8 @@ typedef struct UX_HOST_CLASS_DPUMP_STRUCT } UX_HOST_CLASS_DPUMP; -/* Define the system API mappings based on the error checking - selected by the user. Note: this section is only applicable to +/* Define the system API mappings based on the error checking + selected by the user. Note: this section is only applicable to application source code, hence the conditional that turns off this stuff when the include file is processed by the ThreadX source. */ @@ -2814,19 +2844,19 @@ typedef struct UX_HOST_CLASS_DPUMP_STRUCT #define ux_hcd_sim_host_initialize _ux_hcd_sim_host_initialize #define ux_dcd_sim_slave_initialize _ux_dcd_sim_slave_initialize -#define ux_network_driver_init _ux_network_driver_init +#define ux_network_driver_init _ux_network_driver_init #endif /* Define USBX API prototypes. */ -UINT ux_system_initialize(VOID *non_cached_memory_pool_start, ULONG non_cached_memory_size, +UINT ux_system_initialize(VOID *non_cached_memory_pool_start, ULONG non_cached_memory_size, VOID *cached_memory_pool_start, ULONG cached_memory_size); UINT ux_system_uninitialize(VOID); UINT ux_system_tasks_run(VOID); -UINT uxe_system_initialize(VOID *non_cached_memory_pool_start, ULONG non_cached_memory_size, +UINT uxe_system_initialize(VOID *non_cached_memory_pool_start, ULONG non_cached_memory_size, VOID *cached_memory_pool_start, ULONG cached_memory_size); @@ -2873,7 +2903,7 @@ UINT ux_dcd_at91_initialize(ULONG dcd_io); UINT ux_dcd_isp1181_initialize(ULONG dcd_io, ULONG dcd_irq, ULONG dcd_vbus_address); UINT ux_dcd_ml6965_initialize(ULONG dcd_io, ULONG dcd_irq, ULONG dcd_vbus_address); UINT ux_dcd_sim_slave_initialize(VOID); - + UINT ux_device_class_storage_entry(UX_SLAVE_CLASS_COMMAND *command); VOID ux_device_class_storage_thread(ULONG); UINT ux_device_stack_alternate_setting_get(ULONG interface_value); diff --git a/common/core/inc/ux_device_class_dpump.h b/common/core/inc/ux_device_class_dpump.h index 76f5581..1f4bb4b 100644 --- a/common/core/inc/ux_device_class_dpump.h +++ b/common/core/inc/ux_device_class_dpump.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_device_class_dpump.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -50,10 +50,10 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_device_stack.h b/common/core/inc/ux_device_stack.h index cafe533..03bc9b9 100644 --- a/common/core/inc/ux_device_stack.h +++ b/common/core/inc/ux_device_stack.h @@ -25,7 +25,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_device_stack.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -53,9 +53,9 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_host_stack.h b/common/core/inc/ux_host_stack.h index b4a6ac0..d174bc1 100644 --- a/common/core/inc/ux_host_stack.h +++ b/common/core/inc/ux_host_stack.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_stack.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -65,9 +65,9 @@ /* names conflict C++ keyword, */ /* added standalone HUB, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_system.h b/common/core/inc/ux_system.h index 9734f1d..33f95ee 100644 --- a/common/core/inc/ux_system.h +++ b/common/core/inc/ux_system.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_system.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -53,9 +53,9 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* added device CCID name, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_user_sample.h b/common/core/inc/ux_user_sample.h index 28a0934..c86531f 100644 --- a/common/core/inc/ux_user_sample.h +++ b/common/core/inc/ux_user_sample.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* ux_user.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* */ /* AUTHOR */ /* */ @@ -99,14 +99,15 @@ /* added option to enable */ /* basic USBX error checking, */ /* resulting in version 6.2.1 */ -/* xx-xx-xxxx Xiuwen Cai, CQ Xiao Modified comment(s), */ +/* 10-31-2023 Xiuwen Cai, CQ Xiao Modified comment(s), */ +/* refined memory management, */ /* added zero copy support */ /* in many device classes, */ /* added a new mode to manage */ /* endpoint buffer in classes, */ /* added option for get string */ /* requests with zero wIndex, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ @@ -141,8 +142,8 @@ also refer to ux_port.h for descriptions on each of these options. */ /* Defined, this value represents minimal allocated memory alignment in number of bytes. - The default is UX_ALIGN_16 (0x0f) to align allocated memory to 16 bytes. */ -/* #define UX_ALIGN_MIN UX_ALIGN_16 */ + The default is UX_ALIGN_8 (0x07) to align allocated memory to 8 bytes. */ +/* #define UX_ALIGN_MIN UX_ALIGN_8 */ /* Defined, this value represents how many ticks per seconds for a specific hardware platform. The default is 1000 indicating 1 tick per millisecond. */ @@ -239,7 +240,7 @@ */ /* #define UX_DEVICE_CLASS_CDC_ACM_ZERO_COPY */ -/* Defined, it enables zero copy and flexible queue support (works if HID owns endpoint buffer). +/* Defined, it enables device HID zero copy and flexible queue support (works if HID owns endpoint buffer). Enabled, the internal queue buffer is directly used for transfer, the APIs are kept to keep backword compatibility, to AVOID KEEPING BUFFERS IN APPLICATION. Flexible queue introduces initialization parameter _event_max_number and _event_max_length, @@ -252,6 +253,27 @@ */ /* #define UX_DEVICE_CLASS_HID_ZERO_COPY */ +/* Defined, it enables device CDC_ECM zero copy support (works if CDC_ECM owns endpoint buffer). + Enabled, it requires that the NX IP default packet pool is in cache safe area, and buffer max + size is larger than UX_DEVICE_CLASS_CDC_ECM_ETHERNET_PACKET_SIZE (1536). + */ +/* #define UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY */ + +/* Defined, it enables device RNDIS zero copy support (works if RNDIS owns endpoint buffer). + Enabled, it requires that the NX IP default packet pool is in cache safe area, and buffer max + size is larger than UX_DEVICE_CLASS_RNDIS_MAX_PACKET_TRANSFER_SIZE (1600). + */ +/* #define UX_DEVICE_CLASS_RNDIS_ZERO_COPY */ + +/* Defined, it enables zero copy support (works if PRINTER owns endpoint buffer). + Defined, it enables zero copy for bulk in/out endpoints (write/read). In this case, the endpoint + buffer is not allocated in class, application must provide the buffer for read/write, and the + buffer must meet device controller driver (DCD) buffer requirements (e.g., aligned and cache + safe if buffer is for DMA). + */ +/* #define UX_DEVICE_CLASS_PRINTER_ZERO_COPY */ + + /* Defined, this value represents the maximum number of bytes that can be received or transmitted on any endpoint. This value cannot be less than the maximum packet size of any endpoint. The default is 4096 bytes but can be reduced in memory constrained environments. For cd-rom support in the storage diff --git a/common/core/inc/ux_utility.h b/common/core/inc/ux_utility.h index 8b42fae..aacabff 100644 --- a/common/core/inc/ux_utility.h +++ b/common/core/inc/ux_utility.h @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Utility */ /** */ @@ -26,20 +26,20 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_utility.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ +/* */ /* This file contains all the header and extern functions used by the */ -/* USBX components that utilize utility functions. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* USBX components that utilize utility functions. */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* added timer delete, used UX */ @@ -57,10 +57,11 @@ /* added macros for RTOS calls,*/ /* fixed OHCI PRSC issue, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* refined memory management, */ /* added new function to check */ /* parsed size of descriptor, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ @@ -86,9 +87,10 @@ VOID _ux_utility_memory_copy(VOID *memory_destination, VOID *memory_ VOID _ux_utility_memory_free(VOID *memory); ULONG _ux_utility_string_length_get(UCHAR *string); UINT _ux_utility_string_length_check(UCHAR *input_string, UINT *string_length_ptr, UINT max_string_length); -UX_MEMORY_BLOCK *_ux_utility_memory_free_block_best_get(ULONG memory_cache_flag, ULONG memory_size_requested); +UCHAR *_ux_utility_memory_byte_pool_search(UX_MEMORY_BYTE_POOL *pool_ptr, ULONG memory_size); +UINT _ux_utility_memory_byte_pool_create(UX_MEMORY_BYTE_POOL *pool_ptr, VOID *pool_start, ULONG pool_size); VOID _ux_utility_memory_set(VOID *destination, UCHAR value, ULONG length); -ULONG _ux_utility_pci_class_scan(ULONG pci_class, ULONG bus_number, ULONG device_number, +ULONG _ux_utility_pci_class_scan(ULONG pci_class, ULONG bus_number, ULONG device_number, ULONG function_number, ULONG *current_bus_number, ULONG *current_device_number, ULONG *current_function_number); ULONG _ux_utility_pci_read(ULONG bus_number, ULONG device_number, ULONG function_number, @@ -116,9 +118,9 @@ UINT _ux_utility_semaphore_create(UX_SEMAPHORE *semaphore, CHAR *sem UINT _ux_utility_semaphore_delete(UX_SEMAPHORE *semaphore); UINT _ux_utility_semaphore_get(UX_SEMAPHORE *semaphore, ULONG semaphore_signal); UINT _ux_utility_semaphore_put(UX_SEMAPHORE *semaphore); -UINT _ux_utility_thread_create(UX_THREAD *thread_ptr, CHAR *name, +UINT _ux_utility_thread_create(UX_THREAD *thread_ptr, CHAR *name, VOID (*entry_function)(ULONG), ULONG entry_input, - VOID *stack_start, ULONG stack_size, + VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold, ULONG time_slice, UINT auto_start); UINT _ux_utility_thread_delete(UX_THREAD *thread_ptr); @@ -129,12 +131,12 @@ UINT _ux_utility_thread_sleep(ULONG ticks); UINT _ux_utility_thread_suspend(UX_THREAD *thread_ptr); UX_THREAD *_ux_utility_thread_identify(VOID); UINT _ux_utility_timer_create(UX_TIMER *timer, CHAR *timer_name, VOID (*expiration_function) (ULONG), - ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, + ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT activation_flag); UINT _ux_utility_timer_delete(UX_TIMER *timer); UINT _ux_utility_event_flags_create(UX_EVENT_FLAGS_GROUP*group_ptr, CHAR *name); UINT _ux_utility_event_flags_delete(UX_EVENT_FLAGS_GROUP*group_ptr); -UINT _ux_utility_event_flags_get(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG requested_flags, +UINT _ux_utility_event_flags_get(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG requested_flags, UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option); UINT _ux_utility_event_flags_set(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG flags_to_set, UINT set_option); @@ -399,7 +401,7 @@ VOID* _ux_utility_memory_allocate_add_safe(ULONG align,ULONG cache,UL /* Define the system API mappings. - Note: this section is only applicable to + Note: this section is only applicable to application source code, hence the conditional that turns off this stuff when the include file is processed by the ThreadX source. */ @@ -450,8 +452,8 @@ VOID* _ux_utility_memory_allocate_add_safe(ULONG align,ULONG cache,UL #define ux_utility_event_flags_set _ux_utility_event_flags_set #define ux_utility_unicode_to_string _ux_utility_unicode_to_string #define ux_utility_string_to_unicode _ux_utility_string_to_unicode -#define ux_utility_delay_ms _ux_utility_delay_ms -#define ux_utility_error_callback_register _ux_utility_error_callback_register +#define ux_utility_delay_ms _ux_utility_delay_ms +#define ux_utility_error_callback_register _ux_utility_error_callback_register #define ux_system_error_handler _ux_system_error_handler #define ux_utility_time_get _ux_utility_time_get diff --git a/common/core/src/ux_device_class_dpump_activate.c b/common/core/src/ux_device_class_dpump_activate.c index ab6963b..7c0f61e 100644 --- a/common/core/src/ux_device_class_dpump_activate.c +++ b/common/core/src/ux_device_class_dpump_activate.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_dpump_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -73,10 +73,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_dpump_activate(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/core/src/ux_device_class_dpump_change.c b/common/core/src/ux_device_class_dpump_change.c index 24f52ae..ef22087 100644 --- a/common/core/src/ux_device_class_dpump_change.c +++ b/common/core/src/ux_device_class_dpump_change.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_dpump_change PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -76,10 +76,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_dpump_change(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/core/src/ux_device_class_dpump_initialize.c b/common/core/src/ux_device_class_dpump_initialize.c index 853b4f8..bcd3641 100644 --- a/common/core/src/ux_device_class_dpump_initialize.c +++ b/common/core/src/ux_device_class_dpump_initialize.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_dpump_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,10 +70,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_dpump_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/core/src/ux_device_class_dpump_read.c b/common/core/src/ux_device_class_dpump_read.c index c93df01..c70b4e6 100644 --- a/common/core/src/ux_device_class_dpump_read.c +++ b/common/core/src/ux_device_class_dpump_read.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_dpump_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,10 +70,10 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_dpump_read(UX_SLAVE_CLASS_DPUMP *dpump, UCHAR *buffer, diff --git a/common/core/src/ux_device_class_dpump_read_run.c b/common/core/src/ux_device_class_dpump_read_run.c index 0bd3da4..16fd2f4 100644 --- a/common/core/src/ux_device_class_dpump_read_run.c +++ b/common/core/src/ux_device_class_dpump_read_run.c @@ -39,7 +39,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_dpump_read_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -78,10 +78,10 @@ /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_dpump_read_run(UX_SLAVE_CLASS_DPUMP *dpump, UCHAR *buffer, diff --git a/common/core/src/ux_device_class_dpump_write.c b/common/core/src/ux_device_class_dpump_write.c index 2e950aa..b739dff 100644 --- a/common/core/src/ux_device_class_dpump_write.c +++ b/common/core/src/ux_device_class_dpump_write.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_dpump_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,10 +70,10 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_dpump_write(UX_SLAVE_CLASS_DPUMP *dpump, UCHAR *buffer, diff --git a/common/core/src/ux_device_class_dpump_write_run.c b/common/core/src/ux_device_class_dpump_write_run.c index b08e49b..9a4bce1 100644 --- a/common/core/src/ux_device_class_dpump_write_run.c +++ b/common/core/src/ux_device_class_dpump_write_run.c @@ -39,7 +39,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_dpump_write_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -78,10 +78,10 @@ /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_dpump_write_run(UX_SLAVE_CLASS_DPUMP *dpump, UCHAR *buffer, diff --git a/common/core/src/ux_device_stack_class_register.c b/common/core/src/ux_device_stack_class_register.c index ad61647..aa799d6 100644 --- a/common/core/src/ux_device_stack_class_register.c +++ b/common/core/src/ux_device_stack_class_register.c @@ -172,7 +172,7 @@ ULONG class_index; /* FUNCTION RELEASE */ /* */ /* _uxe_device_stack_class_register PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -206,7 +206,7 @@ ULONG class_index; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_stack_class_register(UCHAR *class_name, diff --git a/common/core/src/ux_device_stack_class_unregister.c b/common/core/src/ux_device_stack_class_unregister.c index 8d1bde0..0e8fe58 100644 --- a/common/core/src/ux_device_stack_class_unregister.c +++ b/common/core/src/ux_device_stack_class_unregister.c @@ -156,7 +156,7 @@ ULONG class_index; /* FUNCTION RELEASE */ /* */ /* _uxe_device_stack_class_unregister PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -187,7 +187,7 @@ ULONG class_index; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_stack_class_unregister(UCHAR *class_name, diff --git a/common/core/src/ux_device_stack_control_request_process.c b/common/core/src/ux_device_stack_control_request_process.c index 826097a..e8a2a98 100644 --- a/common/core/src/ux_device_stack_control_request_process.c +++ b/common/core/src/ux_device_stack_control_request_process.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_stack_control_request_process PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -94,10 +94,10 @@ /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* fixed vendor request issue, */ /* resulting in version 6.2.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* improved interface request */ /* process with print class, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_stack_control_request_process(UX_SLAVE_TRANSFER *transfer_request) diff --git a/common/core/src/ux_device_stack_descriptor_send.c b/common/core/src/ux_device_stack_descriptor_send.c index 4ce10a8..b7b5a57 100644 --- a/common/core/src/ux_device_stack_descriptor_send.c +++ b/common/core/src/ux_device_stack_descriptor_send.c @@ -41,7 +41,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_stack_descriptor_send PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -89,11 +89,11 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* moved compile option check, */ /* added support for get string*/ /* requests with zero wIndex, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_stack_descriptor_send(ULONG descriptor_type, ULONG request_index, ULONG host_length) diff --git a/common/core/src/ux_device_stack_initialize.c b/common/core/src/ux_device_stack_initialize.c index 5b7a9b1..d6b628e 100644 --- a/common/core/src/ux_device_stack_initialize.c +++ b/common/core/src/ux_device_stack_initialize.c @@ -54,7 +54,7 @@ UX_SYSTEM_SLAVE *_ux_system_slave; /* FUNCTION RELEASE */ /* */ /* _ux_device_stack_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -109,10 +109,10 @@ UX_SYSTEM_SLAVE *_ux_system_slave; /* added CCID support, */ /* added video support, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_stack_initialize(UCHAR * device_framework_high_speed, ULONG device_framework_length_high_speed, @@ -474,7 +474,7 @@ UCHAR *memory; /* FUNCTION RELEASE */ /* */ /* _uxe_device_stack_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -505,7 +505,7 @@ UCHAR *memory; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_stack_initialize(UCHAR * device_framework_high_speed, ULONG device_framework_length_high_speed, diff --git a/common/core/src/ux_device_stack_uninitialize.c b/common/core/src/ux_device_stack_uninitialize.c index 4622e38..0112878 100644 --- a/common/core/src/ux_device_stack_uninitialize.c +++ b/common/core/src/ux_device_stack_uninitialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_stack_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,10 +72,10 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_stack_uninitialize(VOID) diff --git a/common/core/src/ux_hcd_sim_host_initialize.c b/common/core/src/ux_hcd_sim_host_initialize.c index 65a3947..cc895c0 100644 --- a/common/core/src/ux_hcd_sim_host_initialize.c +++ b/common/core/src/ux_hcd_sim_host_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Host Simulator Controller Driver */ /** */ @@ -30,43 +30,43 @@ #include "ux_dcd_sim_slave.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_hcd_sim_host_initialize PORTABLE C */ -/* 6.1.10 */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_hcd_sim_host_initialize PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the simulated host controller */ -/* */ -/* INPUT */ -/* */ -/* HCD Pointer to HCD */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ -/* _ux_hcd_sim_host_periodic_tree_create Create periodic tree */ -/* _ux_utility_memory_allocate Allocate memory block */ -/* _ux_utility_semaphore_put Semaphore put */ -/* _ux_utility_timer_create Create timer */ -/* */ -/* CALLED BY */ -/* */ +/* */ +/* This function initializes the simulated host controller */ +/* */ +/* INPUT */ +/* */ +/* HCD Pointer to HCD */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ +/* _ux_hcd_sim_host_periodic_tree_create Create periodic tree */ +/* _ux_utility_memory_allocate Allocate memory block */ +/* _ux_utility_semaphore_put Semaphore put */ +/* _ux_utility_timer_create Create timer */ +/* */ +/* CALLED BY */ +/* */ /* Host Simulator Controller Driver */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* optimized based on compile */ @@ -81,6 +81,9 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* refined memory management, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_hcd_sim_host_initialize(UX_HCD *hcd) @@ -89,12 +92,12 @@ UINT _ux_hcd_sim_host_initialize(UX_HCD *hcd) UX_SLAVE_DCD *dcd; UX_DCD_SIM_SLAVE *dcd_sim_slave; UX_HCD_SIM_HOST *hcd_sim_host; -UINT status; +UINT status = UX_ERROR; /* The controller initialized here is of host simulator type. */ hcd -> ux_hcd_controller_type = UX_HCD_SIM_HOST_CONTROLLER; - + /* Allocate memory for this host simulator HCD instance. */ hcd_sim_host = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, sizeof(UX_HCD_SIM_HOST)); if (hcd_sim_host == UX_NULL) @@ -119,14 +122,17 @@ UINT status; hcd -> ux_hcd_status = UX_HCD_STATUS_HALTED; /* Allocate the list of EDs. All EDs are allocated on 16 byte memory boundary. */ - hcd_sim_host -> ux_hcd_sim_host_ed_list = _ux_utility_memory_allocate(UX_ALIGN_16, UX_REGULAR_MEMORY, (ULONG)sizeof(UX_HCD_SIM_HOST_ED) * _ux_system_host -> ux_system_host_max_ed); - if (hcd_sim_host -> ux_hcd_sim_host_ed_list == UX_NULL) - status = UX_MEMORY_INSUFFICIENT; - else - status = UX_SUCCESS; + if (_ux_system_host -> ux_system_host_max_ed != 0) + { + hcd_sim_host -> ux_hcd_sim_host_ed_list = _ux_utility_memory_allocate(UX_ALIGN_16, UX_REGULAR_MEMORY, (ULONG)sizeof(UX_HCD_SIM_HOST_ED) * _ux_system_host -> ux_system_host_max_ed); + if (hcd_sim_host -> ux_hcd_sim_host_ed_list == UX_NULL) + status = UX_MEMORY_INSUFFICIENT; + else + status = UX_SUCCESS; + } /* Allocate the list of TDs. All TDs are allocated on 32 byte memory boundary. */ - if (status == UX_SUCCESS) + if ((status == UX_SUCCESS) && (_ux_system_host -> ux_system_host_max_td != 0)) { hcd_sim_host -> ux_hcd_sim_host_td_list = _ux_utility_memory_allocate(UX_ALIGN_32, UX_REGULAR_MEMORY, (ULONG)sizeof(UX_HCD_SIM_HOST_TD) * _ux_system_host -> ux_system_host_max_td); if (hcd_sim_host -> ux_hcd_sim_host_td_list == UX_NULL) @@ -134,7 +140,7 @@ UINT status; } /* Allocate the list of isochronous TDs. All TDs are allocated on 32 byte memory boundary. */ - if (status == UX_SUCCESS) + if ((status == UX_SUCCESS) && (_ux_system_host -> ux_system_host_max_iso_td != 0)) { hcd_sim_host -> ux_hcd_sim_host_iso_td_list = _ux_utility_memory_allocate(UX_ALIGN_32, UX_REGULAR_MEMORY, (ULONG)sizeof(UX_HCD_SIM_HOST_ISO_TD) * _ux_system_host -> ux_system_host_max_iso_td); if (hcd_sim_host -> ux_hcd_sim_host_iso_td_list == UX_NULL) @@ -156,7 +162,7 @@ UINT status; /* The periodic scheduler is not active. */ hcd_sim_host -> ux_hcd_sim_host_periodic_scheduler_active = 0; - + /* We start a timer that will invoke the simulator every timer tick. */ status = _ux_host_timer_create(&hcd_sim_host -> ux_hcd_sim_host_timer, "USBX Simulation Timer", _ux_hcd_sim_host_timer_function, (ULONG) (ALIGN_TYPE) hcd_sim_host, 1, 1, UX_AUTO_ACTIVATE); @@ -197,7 +203,7 @@ UINT status; } } - /* Get the number of ports on the controller. The number of ports needs to be reflected both + /* Get the number of ports on the controller. The number of ports needs to be reflected both for the generic HCD container and the local sim_host container. In the simulator, the number of ports is hardwired to 1 only. */ hcd -> ux_hcd_nb_root_hubs = 1; diff --git a/common/core/src/ux_hcd_sim_host_uninitialize.c b/common/core/src/ux_hcd_sim_host_uninitialize.c index bfd8a48..234c595 100644 --- a/common/core/src/ux_hcd_sim_host_uninitialize.c +++ b/common/core/src/ux_hcd_sim_host_uninitialize.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_hcd_sim_host_uninitialize PORTABLE C */ -/* 6.1.10 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,6 +70,9 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* refined memory management, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_hcd_sim_host_uninitialize(UX_HCD_SIM_HOST *hcd_sim_host) @@ -115,9 +118,14 @@ UINT td_index; #endif /* Free TD/ED memories. */ - _ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_iso_td_list); - _ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_td_list); - _ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_ed_list); + if (hcd_sim_host -> ux_hcd_sim_host_iso_td_list) + _ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_iso_td_list); + + if (hcd_sim_host -> ux_hcd_sim_host_td_list) + _ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_td_list); + + if (hcd_sim_host -> ux_hcd_sim_host_ed_list) + _ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_ed_list); /* Free simulated host controller memory. */ _ux_utility_memory_free(hcd_sim_host); diff --git a/common/core/src/ux_host_stack_class_get.c b/common/core/src/ux_host_stack_class_get.c index 9f52c22..2654670 100644 --- a/common/core/src/ux_host_stack_class_get.c +++ b/common/core/src/ux_host_stack_class_get.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_stack_class_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -78,8 +78,8 @@ /* optimized based on compile */ /* definitions, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_stack_class_get(UCHAR *class_name, UX_HOST_CLASS **host_class) @@ -145,7 +145,7 @@ ULONG class_index; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_class_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -175,7 +175,7 @@ ULONG class_index; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_class_get(UCHAR *class_name, UX_HOST_CLASS **host_class) diff --git a/common/core/src/ux_host_stack_class_instance_get.c b/common/core/src/ux_host_stack_class_instance_get.c index fbdf2a0..8a19038 100644 --- a/common/core/src/ux_host_stack_class_instance_get.c +++ b/common/core/src/ux_host_stack_class_instance_get.c @@ -119,7 +119,7 @@ VOID **current_class_instance; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_class_instance_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -151,7 +151,7 @@ VOID **current_class_instance; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_class_instance_get(UX_HOST_CLASS *host_class, UINT class_index, VOID **class_instance) diff --git a/common/core/src/ux_host_stack_class_register.c b/common/core/src/ux_host_stack_class_register.c index fdbb034..376a0d2 100644 --- a/common/core/src/ux_host_stack_class_register.c +++ b/common/core/src/ux_host_stack_class_register.c @@ -180,7 +180,7 @@ ULONG class_index; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_class_register PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -211,7 +211,7 @@ ULONG class_index; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_class_register(UCHAR *class_name, diff --git a/common/core/src/ux_host_stack_configuration_interface_get.c b/common/core/src/ux_host_stack_configuration_interface_get.c index b18444e..679cc75 100644 --- a/common/core/src/ux_host_stack_configuration_interface_get.c +++ b/common/core/src/ux_host_stack_configuration_interface_get.c @@ -193,7 +193,7 @@ UX_INTERFACE *current_interface; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_configuration_interface_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -227,7 +227,7 @@ UX_INTERFACE *current_interface; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_configuration_interface_get(UX_CONFIGURATION *configuration, diff --git a/common/core/src/ux_host_stack_device_configuration_activate.c b/common/core/src/ux_host_stack_device_configuration_activate.c index 06b4fd8..3665d34 100644 --- a/common/core/src/ux_host_stack_device_configuration_activate.c +++ b/common/core/src/ux_host_stack_device_configuration_activate.c @@ -191,7 +191,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_device_configuration_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -222,7 +222,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_device_configuration_activate(UX_CONFIGURATION *configuration) diff --git a/common/core/src/ux_host_stack_device_configuration_deactivate.c b/common/core/src/ux_host_stack_device_configuration_deactivate.c index 69198bd..5d35776 100644 --- a/common/core/src/ux_host_stack_device_configuration_deactivate.c +++ b/common/core/src/ux_host_stack_device_configuration_deactivate.c @@ -200,7 +200,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_device_configuration_deactivate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -231,7 +231,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_device_configuration_deactivate(UX_DEVICE *device) diff --git a/common/core/src/ux_host_stack_device_configuration_get.c b/common/core/src/ux_host_stack_device_configuration_get.c index cb47600..5feb9f6 100644 --- a/common/core/src/ux_host_stack_device_configuration_get.c +++ b/common/core/src/ux_host_stack_device_configuration_get.c @@ -140,7 +140,7 @@ UX_CONFIGURATION *current_configuration; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_device_configuration_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -173,7 +173,7 @@ UX_CONFIGURATION *current_configuration; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_device_configuration_get(UX_DEVICE *device, UINT configuration_index, diff --git a/common/core/src/ux_host_stack_device_get.c b/common/core/src/ux_host_stack_device_get.c index de20f99..3ddb9d7 100644 --- a/common/core/src/ux_host_stack_device_get.c +++ b/common/core/src/ux_host_stack_device_get.c @@ -155,7 +155,7 @@ ULONG current_device_index; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_device_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -185,7 +185,7 @@ ULONG current_device_index; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_device_get(ULONG device_index, UX_DEVICE **device) diff --git a/common/core/src/ux_host_stack_device_string_get.c b/common/core/src/ux_host_stack_device_string_get.c index 2c44a31..db84f26 100644 --- a/common/core/src/ux_host_stack_device_string_get.c +++ b/common/core/src/ux_host_stack_device_string_get.c @@ -154,7 +154,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_device_string_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -190,7 +190,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_device_string_get(UX_DEVICE *device, UCHAR *descriptor_buffer, ULONG length, ULONG language_id, ULONG string_index) diff --git a/common/core/src/ux_host_stack_endpoint_transfer_abort.c b/common/core/src/ux_host_stack_endpoint_transfer_abort.c index fdef80b..b212a8c 100644 --- a/common/core/src/ux_host_stack_endpoint_transfer_abort.c +++ b/common/core/src/ux_host_stack_endpoint_transfer_abort.c @@ -98,7 +98,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_endpoint_transfer_abort PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -129,7 +129,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint) diff --git a/common/core/src/ux_host_stack_hcd_register.c b/common/core/src/ux_host_stack_hcd_register.c index cd9f868..2816e00 100644 --- a/common/core/src/ux_host_stack_hcd_register.c +++ b/common/core/src/ux_host_stack_hcd_register.c @@ -163,7 +163,7 @@ ULONG hcd_index; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_hcd_register PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -193,7 +193,7 @@ ULONG hcd_index; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_hcd_register(UCHAR *hcd_name, diff --git a/common/core/src/ux_host_stack_hcd_unregister.c b/common/core/src/ux_host_stack_hcd_unregister.c index 9baed92..08bb43f 100644 --- a/common/core/src/ux_host_stack_hcd_unregister.c +++ b/common/core/src/ux_host_stack_hcd_unregister.c @@ -202,7 +202,7 @@ UINT hcd_name_length = 0; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_hcd_unregister PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -234,7 +234,7 @@ UINT hcd_name_length = 0; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_hcd_unregister(UCHAR *hcd_name, diff --git a/common/core/src/ux_host_stack_interface_endpoint_get.c b/common/core/src/ux_host_stack_interface_endpoint_get.c index 9bec702..bf098ad 100644 --- a/common/core/src/ux_host_stack_interface_endpoint_get.c +++ b/common/core/src/ux_host_stack_interface_endpoint_get.c @@ -142,7 +142,7 @@ UX_ENDPOINT *current_endpoint; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_interface_endpoint_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -174,7 +174,7 @@ UX_ENDPOINT *current_endpoint; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_interface_endpoint_get(UX_INTERFACE *interface_ptr, UINT endpoint_index, UX_ENDPOINT **endpoint) diff --git a/common/core/src/ux_host_stack_interface_setting_select.c b/common/core/src/ux_host_stack_interface_setting_select.c index fd96be9..5b634ba 100644 --- a/common/core/src/ux_host_stack_interface_setting_select.c +++ b/common/core/src/ux_host_stack_interface_setting_select.c @@ -221,7 +221,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_interface_setting_select PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -252,7 +252,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_interface_setting_select(UX_INTERFACE *interface_ptr) diff --git a/common/core/src/ux_host_stack_tasks_run.c b/common/core/src/ux_host_stack_tasks_run.c index 6363268..ed893aa 100644 --- a/common/core/src/ux_host_stack_tasks_run.c +++ b/common/core/src/ux_host_stack_tasks_run.c @@ -44,7 +44,7 @@ static inline VOID _ux_host_stack_pending_transfers_run(VOID); /* FUNCTION RELEASE */ /* */ /* _ux_host_stack_tasks_run PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -110,6 +110,9 @@ static inline VOID _ux_host_stack_pending_transfers_run(VOID); /* fixed activation issue on */ /* no class linked interfaces, */ /* resulting in version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved enum transfer, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_stack_tasks_run(VOID) @@ -200,8 +203,8 @@ static inline VOID _ux_host_stack_enum_address_sent(UX_DEVICE *device) { /* Address (request wValue) applied to device. */ - device -> ux_device_address = - device -> ux_device_enum_trans -> ux_transfer_request_value; + device -> ux_device_address = device -> ux_device_control_endpoint. + ux_endpoint_transfer_request.ux_transfer_request_value & 0x7F; device -> ux_device_state = UX_DEVICE_ADDRESSED; /* Unlock enumeration. */ @@ -625,7 +628,7 @@ INT immediate_state = UX_TRUE; case UX_HOST_STACK_ENUM_DEVICE_ADDR_SENT: /* Transfer error check. */ - trans = device -> ux_device_enum_trans; + trans = &device -> ux_device_control_endpoint.ux_endpoint_transfer_request; if (trans -> ux_transfer_request_completion_code != UX_SUCCESS) { device -> ux_device_enum_state = UX_HOST_STACK_ENUM_RETRY; @@ -659,7 +662,7 @@ INT immediate_state = UX_TRUE; case UX_HOST_STACK_ENUM_DEVICE_DESCR_PARSE: /* Transfer error check. */ - trans = device -> ux_device_enum_trans; + trans = &device -> ux_device_control_endpoint.ux_endpoint_transfer_request; buffer = trans -> ux_transfer_request_data_pointer; if (UX_HOST_STACK_ENUM_TRANS_ERROR(trans)) { @@ -707,6 +710,7 @@ INT immediate_state = UX_TRUE; trans -> ux_transfer_request_requested_length = UX_DEVICE_DESCRIPTOR_LENGTH; /* Issue GetDescriptor(Device) again and parse it. */ + device -> ux_device_enum_trans = trans; UX_TRANSFER_STATE_RESET(trans); device -> ux_device_enum_state = UX_HOST_STACK_ENUM_TRANS_WAIT; device -> ux_device_enum_next_state = UX_HOST_STACK_ENUM_DEVICE_DESCR_PARSE; @@ -744,7 +748,7 @@ INT immediate_state = UX_TRUE; case UX_HOST_STACK_ENUM_CONFIG_DESCR_PARSE: /* Transfer error check. */ - trans = device -> ux_device_enum_trans; + trans = &device -> ux_device_control_endpoint.ux_endpoint_transfer_request; buffer = trans -> ux_transfer_request_data_pointer; if (UX_HOST_STACK_ENUM_TRANS_ERROR(trans)) { @@ -792,6 +796,7 @@ INT immediate_state = UX_TRUE; configuration -> ux_configuration_descriptor.wTotalLength; /* Start transfer again. */ + device -> ux_device_enum_trans = trans; UX_TRANSFER_STATE_RESET(device -> ux_device_enum_trans); device -> ux_device_enum_state = UX_HOST_STACK_ENUM_TRANS_WAIT; device -> ux_device_enum_next_state = UX_HOST_STACK_ENUM_CONFIG_DESCR_PARSE; @@ -866,7 +871,7 @@ INT immediate_state = UX_TRUE; continue; case UX_HOST_STACK_ENUM_CONFIG_ACTIVATE: - trans = device -> ux_device_enum_trans; + trans = &device -> ux_device_control_endpoint.ux_endpoint_transfer_request; if (UX_HOST_STACK_ENUM_TRANS_ERROR(trans)) { device -> ux_device_enum_state = UX_HOST_STACK_ENUM_RETRY; @@ -960,6 +965,7 @@ INT immediate_state = UX_TRUE; /* Transfer done - next state. */ if (status == UX_STATE_NEXT || status == UX_STATE_IDLE) { + device -> ux_device_enum_trans = UX_NULL; device -> ux_device_enum_state = device -> ux_device_enum_next_state; continue; } @@ -979,6 +985,7 @@ INT immediate_state = UX_TRUE; _ux_utility_memory_free(device -> ux_device_enum_inst.ptr); device -> ux_device_enum_inst.ptr = UX_NULL; } + device -> ux_device_enum_trans = UX_NULL; device -> ux_device_enum_state = UX_HOST_STACK_ENUM_FAIL; continue; } @@ -996,6 +1003,7 @@ INT immediate_state = UX_TRUE; _ux_utility_memory_free(device -> ux_device_enum_inst.ptr); device -> ux_device_enum_inst.ptr = UX_NULL; } + device -> ux_device_enum_trans = UX_NULL; device -> ux_device_enum_state = UX_HOST_STACK_ENUM_RETRY; continue; } diff --git a/common/core/src/ux_host_stack_transfer_request.c b/common/core/src/ux_host_stack_transfer_request.c index 876f528..71c3ae7 100644 --- a/common/core/src/ux_host_stack_transfer_request.c +++ b/common/core/src/ux_host_stack_transfer_request.c @@ -224,7 +224,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_transfer_request PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -253,7 +253,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_transfer_request(UX_TRANSFER *transfer_request) diff --git a/common/core/src/ux_host_stack_transfer_request_abort.c b/common/core/src/ux_host_stack_transfer_request_abort.c index ea84afd..aee4078 100644 --- a/common/core/src/ux_host_stack_transfer_request_abort.c +++ b/common/core/src/ux_host_stack_transfer_request_abort.c @@ -153,7 +153,7 @@ ULONG completion_code; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_transfer_request_abort PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -183,7 +183,7 @@ ULONG completion_code; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_transfer_request_abort(UX_TRANSFER *transfer_request) diff --git a/common/core/src/ux_host_stack_transfer_run.c b/common/core/src/ux_host_stack_transfer_run.c index c9478db..6308fc7 100644 --- a/common/core/src/ux_host_stack_transfer_run.c +++ b/common/core/src/ux_host_stack_transfer_run.c @@ -300,7 +300,7 @@ UX_TRANSFER *previous; /* FUNCTION RELEASE */ /* */ /* _uxe_host_stack_transfer_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -329,7 +329,7 @@ UX_TRANSFER *previous; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_stack_transfer_run(UX_TRANSFER *transfer_request) diff --git a/common/core/src/ux_system_initialize.c b/common/core/src/ux_system_initialize.c index 06fc65e..a8fe4fd 100644 --- a/common/core/src/ux_system_initialize.c +++ b/common/core/src/ux_system_initialize.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** System */ /** */ @@ -64,46 +64,46 @@ UCHAR _ux_system_usb_2_0_extension_descriptor_structure[] = {1,1 UCHAR _ux_system_container_id_descriptor_structure[] = {1,1,1,1,4,4,4,4}; -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_system_initialize PORTABLE C */ -/* 6.x */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_system_initialize PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function initializes the various control data structures for */ -/* the USBX system. */ -/* */ -/* INPUT */ -/* */ +/* */ +/* This function initializes the various control data structures for */ +/* the USBX system. */ +/* */ +/* INPUT */ +/* */ /* regular_memory_pool_start Start of non cached memory pool */ -/* regular_memory_size Size of non cached memory pool */ +/* regular_memory_size Size of non cached memory pool */ /* cache_safe_memory_pool_start Start of cached memory pool */ -/* cache_safe_memory_size Size of cached memory pool */ -/* */ -/* OUTPUT */ -/* */ +/* cache_safe_memory_size Size of cached memory pool */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* _ux_utility_memory_allocate Allocate memory */ -/* _ux_utility_memory_set Set memory */ +/* _ux_utility_memory_set Set memory */ /* _ux_utility_mutex_create Create mutex */ -/* */ -/* CALLED BY */ -/* */ -/* Application */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* Application */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* verified memset and memcpy */ @@ -115,24 +115,28 @@ UCHAR _ux_system_container_id_descriptor_structure[] = {1,1 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* refined memory management, */ /* added UX_ASSERT check for */ /* STD descriptor parse size, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ -UINT _ux_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size, +UINT _ux_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size, VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size) { - -UX_MEMORY_BLOCK *memory_block; ALIGN_TYPE int_memory_pool_start; VOID *regular_memory_pool_end; +VOID *cache_safe_memory_pool_end; ULONG memory_pool_offset; #if !defined(UX_STANDALONE) UINT status; #endif +ULONG pool_size; + /* Check if the regular memory pool is valid. */ + if ((regular_memory_pool_start == UX_NULL) || (regular_memory_size == 0)) + return(UX_INVALID_PARAMETER); /* Reset memory block */ _ux_utility_memory_set(regular_memory_pool_start, 0, regular_memory_size); /* Use case of memset is verified. */ @@ -150,8 +154,8 @@ UINT status; /* Add to the memory offset the size of the allocated block. */ memory_pool_offset += (ULONG)sizeof(UX_SYSTEM_HOST); - -#endif + +#endif #ifndef UX_HOST_SIDE_ONLY @@ -160,8 +164,8 @@ UINT status; /* Add to the memory offset the size of the allocated block. */ memory_pool_offset += (ULONG)sizeof(UX_SYSTEM_SLAVE); - -#endif + +#endif #ifdef UX_OTG_SUPPORT @@ -171,18 +175,36 @@ UINT status; /* Add to the memory offset the size of the allocated block. */ memory_pool_offset += (ULONG)sizeof(UX_SYSTEM_OTG); -#endif +#endif + /* Set the regular memory pool structure. */ + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR] = (UX_MEMORY_BYTE_POOL *) (((UCHAR *) regular_memory_pool_start) + memory_pool_offset); + + /* Add to the memory offset the size of the allocated block. */ + memory_pool_offset += (ULONG)sizeof(UX_MEMORY_BYTE_POOL); + + /* Check if the cache save memory pool is valid. */ + if ((cache_safe_memory_pool_start != UX_NULL) && (cache_safe_memory_size != 0)) + { - /* Set the cache safe memory for the dynamic pool */ - _ux_system -> ux_system_regular_memory_pool_start = (UX_MEMORY_BLOCK *) (((UCHAR *) regular_memory_pool_start) - + memory_pool_offset); + /* Set the cache safe memory pool structure. */ + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE] = (UX_MEMORY_BYTE_POOL *) (((UCHAR *) regular_memory_pool_start) + memory_pool_offset); + + /* Add to the memory offset the size of the allocated block. */ + memory_pool_offset += (ULONG)sizeof(UX_MEMORY_BYTE_POOL); + } + else + { + + /* Set the cache safe memory pool structure to regular pool. */ + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE] = _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR]; + } /* Make sure the regular memory pool is aligned properly */ - int_memory_pool_start = (ALIGN_TYPE) _ux_system -> ux_system_regular_memory_pool_start; - int_memory_pool_start += UX_ALIGN_MIN; - int_memory_pool_start &= ~((ALIGN_TYPE)UX_ALIGN_MIN); - + int_memory_pool_start = (ALIGN_TYPE) (((UCHAR *) regular_memory_pool_start) + memory_pool_offset); + int_memory_pool_start += UX_ALIGN_MIN; + int_memory_pool_start &= ~((ALIGN_TYPE)UX_ALIGN_MIN); + /* Set the end of the regular memory pool. */ regular_memory_pool_end = (void *) (((UCHAR *) regular_memory_pool_start) + regular_memory_size); @@ -194,53 +216,48 @@ UINT status; return(UX_MEMORY_INSUFFICIENT); } - /* Now, we have a project structure allocated, save the regular memory allocation details */ - _ux_system -> ux_system_regular_memory_pool_size = (ULONG) (((ALIGN_TYPE) regular_memory_pool_end) - int_memory_pool_start); - _ux_system -> ux_system_regular_memory_pool_free = _ux_system -> ux_system_regular_memory_pool_size; - _ux_system -> ux_system_regular_memory_pool_start = (UX_MEMORY_BLOCK *) int_memory_pool_start; + /* get the regular memory pool size. */ + pool_size = (ULONG) (((ALIGN_TYPE) regular_memory_pool_end) - int_memory_pool_start); - /* Build the first free memory block */ - memory_block = _ux_system -> ux_system_regular_memory_pool_start; - memory_block -> ux_memory_block_size = _ux_system -> ux_system_regular_memory_pool_size - (ULONG)sizeof(UX_MEMORY_BLOCK); - memory_block -> ux_memory_block_status = UX_MEMORY_UNUSED; + /* Create the regular memory pool. */ + _ux_utility_memory_byte_pool_create(_ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR], + (UX_MEMORY_BYTE_POOL *)int_memory_pool_start, + pool_size); /* Check the definition of the cache safe pool. If the application or controller do not require any cache safe memory, define the cached safe memory region as the regular memory region. */ - if (cache_safe_memory_pool_start == UX_NULL) + if ((cache_safe_memory_pool_start != UX_NULL) && (cache_safe_memory_size != 0)) { - /* Cache safe memory is the same as regular memory. */ - _ux_system -> ux_system_cache_safe_memory_pool_size = _ux_system -> ux_system_regular_memory_pool_size; - _ux_system -> ux_system_cache_safe_memory_pool_free = _ux_system -> ux_system_regular_memory_pool_free; - _ux_system -> ux_system_cache_safe_memory_pool_start = _ux_system -> ux_system_regular_memory_pool_start; - } - else - { - + /* Reset this memory block */ + _ux_utility_memory_set(cache_safe_memory_pool_start, 0, cache_safe_memory_size); /* Use case of memset is verified. */ + /* Make sure the cache safe memory pool is aligned properly */ int_memory_pool_start = (ALIGN_TYPE) cache_safe_memory_pool_start; int_memory_pool_start += UX_ALIGN_MIN; int_memory_pool_start &= ~((ALIGN_TYPE)UX_ALIGN_MIN); - - /* Save the cache safe memory allocation details */ - _ux_system -> ux_system_cache_safe_memory_pool_size = cache_safe_memory_size - UX_ALIGN_MIN; - _ux_system -> ux_system_cache_safe_memory_pool_free = _ux_system -> ux_system_cache_safe_memory_pool_size; - _ux_system -> ux_system_cache_safe_memory_pool_start = (UX_MEMORY_BLOCK *) int_memory_pool_start; - - /* Reset this memory block */ - _ux_utility_memory_set(_ux_system -> ux_system_cache_safe_memory_pool_start, 0, _ux_system -> ux_system_cache_safe_memory_pool_size); /* Use case of memset is verified. */ - - /* Build the first free memory block */ - memory_block = _ux_system -> ux_system_cache_safe_memory_pool_start; - memory_block -> ux_memory_block_size = _ux_system -> ux_system_cache_safe_memory_pool_size - (ULONG)sizeof(UX_MEMORY_BLOCK); - memory_block -> ux_memory_block_status = UX_MEMORY_UNUSED; + + cache_safe_memory_pool_end = (void *) (((UCHAR *) cache_safe_memory_pool_start) + cache_safe_memory_size); + + /* Check if we have memory available. */ + if (int_memory_pool_start >= (ALIGN_TYPE) cache_safe_memory_pool_end) + { + + /* No memory available. */ + return(UX_MEMORY_INSUFFICIENT); + } + + pool_size = (ULONG) (((ALIGN_TYPE) cache_safe_memory_pool_end) - int_memory_pool_start); + + _ux_utility_memory_byte_pool_create(_ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE], + (UX_MEMORY_BYTE_POOL *)int_memory_pool_start, pool_size); } #ifdef UX_ENABLE_MEMORY_STATISTICS - _ux_system -> ux_system_regular_memory_pool_base = (UCHAR *) _ux_system -> ux_system_regular_memory_pool_start; - _ux_system -> ux_system_regular_memory_pool_min_free = _ux_system -> ux_system_regular_memory_pool_free; - _ux_system -> ux_system_cache_safe_memory_pool_base = (UCHAR *) _ux_system -> ux_system_cache_safe_memory_pool_start; - _ux_system -> ux_system_cache_safe_memory_pool_min_free = _ux_system -> ux_system_cache_safe_memory_pool_free; + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR] -> ux_byte_pool_min_free = + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR] -> ux_byte_pool_available; + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE] -> ux_byte_pool_min_free = + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE] -> ux_byte_pool_available; /* Other fields are kept zero. */ #endif @@ -255,10 +272,10 @@ UINT status; /* Setup the head and tail pointers. */ _ux_system -> ux_system_debug_log_head = _ux_system -> ux_system_debug_log_buffer; _ux_system -> ux_system_debug_log_tail = _ux_system -> ux_system_debug_log_buffer; - + /* Keep the size in system structure variable. */ _ux_system -> ux_system_debug_log_size = UX_DEBUG_LOG_SIZE; - + #endif #if !defined(UX_STANDALONE) @@ -278,7 +295,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_system_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -310,10 +327,10 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ -UINT _uxe_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size, +UINT _uxe_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size, VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size) { @@ -333,8 +350,8 @@ UINT _uxe_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memo /* Sanity check. */ if ((regular_memory_pool_start == UX_NULL) || (regular_memory_size == 0)) return(UX_INVALID_PARAMETER); - + /* Invoke system initialization function. */ - return(_ux_system_initialize(regular_memory_pool_start, regular_memory_size, + return(_ux_system_initialize(regular_memory_pool_start, regular_memory_size, cache_safe_memory_pool_start, cache_safe_memory_size)); } diff --git a/common/core/src/ux_utility_descriptor_pack.c b/common/core/src/ux_utility_descriptor_pack.c index bc85c55..292d8de 100644 --- a/common/core/src/ux_utility_descriptor_pack.c +++ b/common/core/src/ux_utility_descriptor_pack.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_utility_descriptor_pack PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,9 +72,9 @@ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* optimized USB descriptors, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_utility_descriptor_pack(UCHAR * descriptor, UCHAR * descriptor_structure, diff --git a/common/core/src/ux_utility_descriptor_parse.c b/common/core/src/ux_utility_descriptor_parse.c index 86bbd85..827db24 100644 --- a/common/core/src/ux_utility_descriptor_parse.c +++ b/common/core/src/ux_utility_descriptor_parse.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_utility_descriptor_parse PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,9 +72,9 @@ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* optimized USB descriptors, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_utility_descriptor_parse(UCHAR * raw_descriptor, UCHAR * descriptor_structure, @@ -133,7 +133,7 @@ VOID _ux_utility_descriptor_parse(UCHAR * raw_descriptor, UCHAR * descriptor_st /* FUNCTION RELEASE */ /* */ /* _ux_utility_descriptor_parse_size PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -165,7 +165,7 @@ VOID _ux_utility_descriptor_parse(UCHAR * raw_descriptor, UCHAR * descriptor_st /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ ULONG _ux_utility_descriptor_parse_size(UCHAR * descriptor_structure, UINT descriptor_entries, UINT size_align_mask) diff --git a/common/core/src/ux_utility_memory_allocate.c b/common/core/src/ux_utility_memory_allocate.c index 547b03d..37a46bf 100644 --- a/common/core/src/ux_utility_memory_allocate.c +++ b/common/core/src/ux_utility_memory_allocate.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Utility */ /** */ @@ -27,45 +27,44 @@ #include "ux_api.h" - -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_utility_memory_allocate PORTABLE C */ -/* 6.x */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_utility_memory_allocate PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function allocates a block of memory for the specified size */ +/* */ +/* This function allocates a block of memory for the specified size */ /* and alignment. */ -/* */ -/* INPUT */ -/* */ -/* memory_alignment Memory alignment required */ -/* memory_cache_flag Memory pool source */ -/* memory_size_requested Number of bytes required */ -/* */ -/* OUTPUT */ -/* */ -/* Pointer to block of memory */ -/* */ -/* CALLS */ -/* */ -/* _ux_utility_memory_free_block_best_get Get best fit block of memory */ -/* _ux_utility_memory_set Set block of memory */ -/* */ -/* CALLED BY */ -/* */ -/* USBX Components */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* INPUT */ +/* */ +/* memory_alignment Memory alignment required */ +/* memory_cache_flag Memory pool source */ +/* memory_size_requested Number of bytes required */ +/* */ +/* OUTPUT */ +/* */ +/* Pointer to block of memory */ +/* */ +/* CALLS */ +/* */ +/* _ux_utility_memory_free_block_best_get Get best fit block of memory */ +/* _ux_utility_memory_set Set block of memory */ +/* */ +/* CALLED BY */ +/* */ +/* USBX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* verified memset and memcpy */ @@ -77,24 +76,54 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* refined memory management, */ /* fixed issue in 64-bit env, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID *_ux_utility_memory_allocate(ULONG memory_alignment, ULONG memory_cache_flag, ULONG memory_size_requested) { +UX_MEMORY_BYTE_POOL *pool_ptr; +UCHAR *current_ptr; +UCHAR *work_ptr; +UCHAR *next_ptr; +ALIGN_TYPE *free_ptr; +UCHAR **this_block_link_ptr; +UCHAR **next_block_link_ptr; +ULONG available_bytes; -UX_MEMORY_BLOCK *memory_block; -UX_MEMORY_BLOCK *new_memory_block; -UX_MEMORY_BLOCK *leftover_memory_block; -ULONG memory_for_alignment; -ULONG memory_removed_from_pool; -ULONG leftover; -UCHAR *memory_buffer; ALIGN_TYPE int_memory_buffer; +#ifdef UX_ENABLE_MEMORY_STATISTICS +UINT index; +#endif + /* Get the pool ptr */ + if (memory_cache_flag == UX_REGULAR_MEMORY) + { + pool_ptr = _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR]; + } + else if (memory_cache_flag == UX_CACHE_SAFE_MEMORY) + { + pool_ptr = _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE]; + } + else + { + return(UX_NULL); + } + + /* Check if pool_ptr is NX_NULL */ + if (pool_ptr == UX_NULL) + { + return(UX_NULL); + } + + /* Check if the memory size requested is 0. */ + if (memory_size_requested == 0) + { + return(UX_NULL); + } /* Get the mutex as this is a critical section. */ _ux_system_mutex_on(&_ux_system -> ux_system_mutex); @@ -105,99 +134,58 @@ ALIGN_TYPE int_memory_buffer; if (memory_alignment == UX_SAFE_ALIGN) { - /* We will use the memory_size_requested for the alignment. + /* We will use the memory_size_requested for the alignment. But we check to see if we have a minimum or maximum alignment. */ if (memory_size_requested < UX_ALIGN_MIN) - + /* No need to bother about alignment for small packets sizes. */ memory_alignment = UX_NO_ALIGN; - - else - { - - /* Check if we are over the maximum. */ - if (memory_size_requested > UX_MAX_SCATTER_GATHER_ALIGNMENT) - - /* We are over the max alignment required. Use the maximum instead. */ - memory_alignment = UX_MAX_SCATTER_GATHER_ALIGNMENT - 1; - else - { - /* We are not over the maximum, so approximate the alignment according to the size of the memory. - Check range for alignment on 4096 bytes. */ - if (memory_size_requested >= UX_ALIGN_2048 + 1) - memory_alignment = UX_ALIGN_4096; + /* Check if we are over the maximum. */ + else if (memory_size_requested > UX_MAX_SCATTER_GATHER_ALIGNMENT) + + /* We are over the max alignment required. Use the maximum instead. */ + memory_alignment = UX_MAX_SCATTER_GATHER_ALIGNMENT - 1; + + /* We are not over the maximum, so approximate the alignment according to the size of the memory. + Check range for alignment on 4096 bytes. */ + else if (memory_size_requested >= UX_ALIGN_2048 + 1) + memory_alignment = UX_ALIGN_4096; + + /* Check range for alignment on 2048 bytes. */ + else if (memory_size_requested >= UX_ALIGN_1024 + 1) + memory_alignment = UX_ALIGN_2048; + + /* Check range for alignment on 1024 bytes. */ + else if (memory_size_requested >= UX_ALIGN_512 + 1) + memory_alignment = UX_ALIGN_1024; + + /* Check range for alignment on 512 bytes. */ + else if (memory_size_requested >= UX_ALIGN_256 + 1) + memory_alignment = UX_ALIGN_512; - else - { + /* Check range for alignment on 256 bytes. */ + else if (memory_size_requested >= UX_ALIGN_128 + 1) + memory_alignment = UX_ALIGN_256; - /* Check range for alignment on 2048 bytes. */ - if (memory_size_requested >= UX_ALIGN_1024 + 1) - memory_alignment = UX_ALIGN_2048; - - else - { + /* Check range for alignment on 128 bytes. */ + else if (memory_size_requested >= UX_ALIGN_64 + 1) + memory_alignment = UX_ALIGN_128; - /* Check range for alignment on 1024 bytes. */ - if (memory_size_requested >= UX_ALIGN_512 + 1) - memory_alignment = UX_ALIGN_1024; - - else - { + /* Check range for alignment on 64 bytes. */ + else if (memory_size_requested >= UX_ALIGN_32 + 1) + memory_alignment = UX_ALIGN_64; - /* Check range for alignment on 512 bytes. */ - if (memory_size_requested >= UX_ALIGN_256 + 1) - memory_alignment = UX_ALIGN_512; - - else - { + /* Check range for alignment on 32 bytes. */ + else if (memory_size_requested >= UX_ALIGN_16 + 1) + memory_alignment = UX_ALIGN_32; - /* Check range for alignment on 256 bytes. */ - if (memory_size_requested >= UX_ALIGN_128 + 1) - memory_alignment = UX_ALIGN_256; - - else - { - - /* Check range for alignment on 128 bytes. */ - if (memory_size_requested >= UX_ALIGN_64 + 1) - memory_alignment = UX_ALIGN_128; - - else - { - - /* Check range for alignment on 128 bytes. */ - if (memory_size_requested >= UX_ALIGN_64 + 1) - memory_alignment = UX_ALIGN_128; - - else - { - - /* Check range for alignment on 64 bytes. */ - if (memory_size_requested >= UX_ALIGN_32 + 1) - memory_alignment = UX_ALIGN_64; - - else - { - - /* Check range for alignment on 32 bytes. */ - if (memory_size_requested >= UX_ALIGN_16 + 1) - memory_alignment = UX_ALIGN_32; - - else - memory_alignment = UX_ALIGN_MIN; - + /* Check range for alignment on 16 bytes. */ + else if (memory_size_requested >= UX_ALIGN_8 + 1) + memory_alignment = UX_ALIGN_16; - } - } - } - } - } - } - } - } - } - } + else + memory_alignment = UX_ALIGN_MIN; } #else @@ -205,204 +193,161 @@ ALIGN_TYPE int_memory_buffer; /* Check if safe alignment requested, in this case switch to UX_NO_ALIGN. */ if (memory_alignment == UX_SAFE_ALIGN) memory_alignment = UX_NO_ALIGN; - + #endif /* Ensure the alignment meats the minimum. */ if (memory_alignment < UX_ALIGN_MIN) memory_alignment = UX_ALIGN_MIN; - /* Adjust the memory alignment since our macros are one minus the desired alignment. - Also determine the amount of extra memory we need for the alignment, which is one - minus the actual alignment. */ - memory_for_alignment = memory_alignment; - memory_alignment++; + /* We need to make sure that the next memory block buffer is 8-byte aligned too. We + do this by first adjusting the requested memory to be 8-byte aligned. One problem + now is that the memory block might not be a size that is a multiple of 8, so we need + to add the amount of memory required such that the memory buffer after the block has + the correct alignment. For example, if the memory block has a size of 12, then we need + to make sure it is placed on an 8-byte alignment that is after a 8-byte alignment so + that the memory right after the memory block is 8-byte aligned (16). */ + memory_size_requested = (memory_size_requested + UX_ALIGN_MIN) & (~(ULONG)UX_ALIGN_MIN); + memory_size_requested += (((ULONG)(UX_MEMORY_BLOCK_HEADER_SIZE + UX_ALIGN_MIN) & (~(ULONG)UX_ALIGN_MIN)) - (ULONG)UX_MEMORY_BLOCK_HEADER_SIZE); - /* We need to make sure that the next memory block buffer is 16-byte aligned too. We - do this by first adjusting the requested memory to be 16-byte aligned. One problem - now is that the memory block might not be a size that is a multiple of 16, so we need - to add the amount of memory required such that the memory buffer after the block has - the correct alignment. For example, if the memory block has a size of 24, then we need - to make sure it is placed on an 8-byte alignment that is after a 16-byte alignment so - that the memory right after the memory block is 16-byte aligned (8 + 24 = 32). */ - memory_size_requested = (memory_size_requested + UX_ALIGN_MIN) & (~(ULONG)UX_ALIGN_MIN); - memory_size_requested += (((ULONG)sizeof(UX_MEMORY_BLOCK) + UX_ALIGN_MIN) & (~(ULONG)UX_ALIGN_MIN)) - (ULONG)sizeof(UX_MEMORY_BLOCK); - - /* Try to find the best block for this memory by requesting the maximum amount of - memory we'll need which is calculated as follows: the amount memory requested by - the caller plus the maximum amount of memory wasted due to alignment plus 2 memory - blocks structs - one for the new memory block we'll create for the user block and one - that we might create if there is extra memory after doing the alignment. */ - memory_block = _ux_utility_memory_free_block_best_get(memory_cache_flag, memory_size_requested + memory_for_alignment + (ULONG)sizeof(UX_MEMORY_BLOCK)); + if (memory_alignment <= UX_ALIGN_MIN) + current_ptr = _ux_utility_memory_byte_pool_search(pool_ptr, memory_size_requested); + else + current_ptr = _ux_utility_memory_byte_pool_search(pool_ptr, memory_size_requested + memory_alignment); - /* If the block returned is NULL, there is no free memory in the pool - for that size. */ - if (memory_block == UX_NULL) + /* Check if we found a memory block. */ + if (current_ptr == UX_NULL) { - /* Release the protection. */ + /* We could not find a memory block. */ _ux_system_mutex_off(&_ux_system -> ux_system_mutex); - /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_MEMORY_INSUFFICIENT, memory_size_requested, 0, 0, UX_TRACE_ERRORS, 0, 0) /* Error trap. */ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_UTILITY, UX_MEMORY_INSUFFICIENT); - /* Return NULL to indicate no block was found. */ return(UX_NULL); } + /* Pickup the next block's pointer. */ + this_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(current_ptr); + next_ptr = *this_block_link_ptr; + + /* Calculate the number of bytes available in this block. */ + available_bytes = UX_UCHAR_POINTER_DIF(next_ptr, current_ptr); + available_bytes = available_bytes - UX_MEMORY_BLOCK_HEADER_SIZE; + /* Get the memory buffer for this block. */ - int_memory_buffer = (ALIGN_TYPE) ((UCHAR *) memory_block + sizeof(UX_MEMORY_BLOCK)); + int_memory_buffer = (ALIGN_TYPE) (UX_UCHAR_POINTER_ADD(current_ptr, UX_MEMORY_BLOCK_HEADER_SIZE)); - /* Are we already aligned? */ - if ((int_memory_buffer & (memory_alignment - 1)) == 0) + /* In case we are not aligned */ + if ((int_memory_buffer & memory_alignment) != 0) { - /* Setup the new memory block. */ - new_memory_block = (UX_MEMORY_BLOCK *) ((UCHAR *) memory_block + sizeof(UX_MEMORY_BLOCK) + memory_size_requested); - new_memory_block -> ux_memory_block_next = memory_block -> ux_memory_block_next; - new_memory_block -> ux_memory_block_previous = memory_block; - new_memory_block -> ux_memory_block_size = memory_block -> ux_memory_block_size - memory_size_requested - (ULONG)sizeof(UX_MEMORY_BLOCK); - new_memory_block -> ux_memory_block_status = UX_MEMORY_UNUSED; + /* No, we need to align the memory buffer. */ + int_memory_buffer += (ALIGN_TYPE)UX_MEMORY_BLOCK_HEADER_SIZE; + int_memory_buffer += memory_alignment; + int_memory_buffer &= ~((ALIGN_TYPE) memory_alignment); + int_memory_buffer -= (ALIGN_TYPE)UX_MEMORY_BLOCK_HEADER_SIZE; - /* Update the current memory block. */ - memory_block -> ux_memory_block_size = memory_size_requested; - memory_block -> ux_memory_block_next = new_memory_block; - memory_block -> ux_memory_block_status = UX_MEMORY_USED | memory_cache_flag; + /* Setup the new free block. */ + next_ptr = (UCHAR *)int_memory_buffer; - /* Declare how much memory we removed from the pool. */ - memory_removed_from_pool = memory_block -> ux_memory_block_size + (ULONG)sizeof(UX_MEMORY_BLOCK); - } - else - { + /* Setup the new free block. */ + next_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(next_ptr); + *next_block_link_ptr = *this_block_link_ptr; + work_ptr = UX_UCHAR_POINTER_ADD(next_ptr, (sizeof(UCHAR *))); + free_ptr = UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(work_ptr); + *free_ptr = UX_BYTE_BLOCK_FREE; - /* Align the buffer. The first thing we do is increment by the size of a - memory block because we have to make sure we have enough memory for at - least that. */ - int_memory_buffer += (ULONG)sizeof(UX_MEMORY_BLOCK); - int_memory_buffer += memory_alignment - 1; - int_memory_buffer &= ~(((ALIGN_TYPE) memory_alignment) - 1); + /* Increase the total fragment counter. */ + pool_ptr -> ux_byte_pool_fragments++; - /* Setup the new memory block. Note that its size is updated again later. */ - new_memory_block = (UX_MEMORY_BLOCK *) (int_memory_buffer - (ULONG)sizeof(UX_MEMORY_BLOCK)); - new_memory_block -> ux_memory_block_previous = memory_block; - new_memory_block -> ux_memory_block_next = memory_block -> ux_memory_block_next; - new_memory_block -> ux_memory_block_size = memory_block -> ux_memory_block_size; - new_memory_block -> ux_memory_block_status = UX_MEMORY_USED | memory_cache_flag; + /* Update the current pointer to point at the newly created block. */ + *this_block_link_ptr = next_ptr; - /* Update the current memory block. */ - int_memory_buffer = (ALIGN_TYPE) ((UCHAR *) memory_block + sizeof(UX_MEMORY_BLOCK)); - memory_block -> ux_memory_block_next = new_memory_block; - memory_block -> ux_memory_block_size = (ULONG) ((ALIGN_TYPE) new_memory_block - int_memory_buffer); + /* Calculate the available bytes. */ + available_bytes -= UX_UCHAR_POINTER_DIF(next_ptr, current_ptr); - /* Update the new memory block's size. */ - new_memory_block -> ux_memory_block_size -= (memory_block -> ux_memory_block_size + (ULONG)sizeof(UX_MEMORY_BLOCK)); + /* Set Current pointer to the aligned memory buffer. */ + current_ptr = next_ptr; + } - /* Calculate how much memory is leftover in the new memory block after doing - the alignment. */ - leftover = new_memory_block -> ux_memory_block_size - memory_size_requested; + /* Now we are aligned, determine if we need to split this block. */ + if ((available_bytes - memory_size_requested) >= ((ULONG) UX_BYTE_BLOCK_MIN)) + { - /* Can we fit another block after the new block? */ - if (leftover > sizeof(UX_MEMORY_BLOCK)) - { + /* Split the block. */ + next_ptr = UX_UCHAR_POINTER_ADD(current_ptr, (memory_size_requested + UX_MEMORY_BLOCK_HEADER_SIZE)); - /* Setup the leftover memory block. */ - leftover_memory_block = (UX_MEMORY_BLOCK *) (((ALIGN_TYPE) new_memory_block + sizeof(UX_MEMORY_BLOCK) + memory_size_requested)); - leftover_memory_block -> ux_memory_block_next = new_memory_block -> ux_memory_block_next; - leftover_memory_block -> ux_memory_block_previous = new_memory_block; - leftover_memory_block -> ux_memory_block_size = leftover - (ULONG)sizeof(UX_MEMORY_BLOCK); - leftover_memory_block -> ux_memory_block_status = UX_MEMORY_UNUSED; + /* Setup the new free block. */ + next_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(next_ptr); + this_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(current_ptr); + *next_block_link_ptr = *this_block_link_ptr; + work_ptr = UX_UCHAR_POINTER_ADD(next_ptr, (sizeof(UCHAR *))); + free_ptr = UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(work_ptr); + *free_ptr = UX_BYTE_BLOCK_FREE; - new_memory_block -> ux_memory_block_next = leftover_memory_block; - new_memory_block -> ux_memory_block_size -= leftover; - } + /* Increase the total fragment counter. */ + pool_ptr -> ux_byte_pool_fragments++; - /* Declare how much memory we removed from the pool. */ - memory_removed_from_pool = new_memory_block -> ux_memory_block_size + (ULONG)sizeof(UX_MEMORY_BLOCK); + /* Update the current pointer to point at the newly created block. */ + *this_block_link_ptr = next_ptr; - /* The new memory block is the one we give to the user. */ - memory_block = new_memory_block; + /* Set available equal to memory size for subsequent calculation. */ + available_bytes = memory_size_requested; } - /* The memory to be returned is after the block header. */ - memory_buffer = ((UCHAR *) memory_block) + sizeof(UX_MEMORY_BLOCK); + /* In any case, mark the current block as allocated. */ + work_ptr = UX_UCHAR_POINTER_ADD(current_ptr, (sizeof(UCHAR *))); + this_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(work_ptr); + *this_block_link_ptr = UX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(pool_ptr); - /* Clear the memory block. */ - _ux_utility_memory_set(memory_buffer, 0, memory_size_requested); /* Use case of memset is verified. */ + /* Reduce the number of available bytes in the pool. */ + pool_ptr -> ux_byte_pool_available = pool_ptr -> ux_byte_pool_available - (available_bytes + UX_MEMORY_BLOCK_HEADER_SIZE); - /* Update the memory free in the pool. */ - if (_ux_system -> ux_system_cache_safe_memory_pool_start == _ux_system -> ux_system_regular_memory_pool_start) + /* Determine if the search pointer needs to be updated. This is only done + if the search pointer matches the block to be returned. */ + if (current_ptr == pool_ptr -> ux_byte_pool_search) { - /* There is only one memory pool. */ - _ux_system -> ux_system_regular_memory_pool_free -= memory_removed_from_pool; + /* Yes, update the search pointer to the next block. */ + this_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(current_ptr); + pool_ptr -> ux_byte_pool_search = *this_block_link_ptr; } - else - { - - switch (memory_cache_flag) - { - - case UX_CACHE_SAFE_MEMORY: - /* Update the amount of free memory in the cache safe memory pool. */ - _ux_system -> ux_system_cache_safe_memory_pool_free -= memory_removed_from_pool; - - break; - default: - /* Update the amount of free memory in the regular memory pool. */ - _ux_system -> ux_system_regular_memory_pool_free -= memory_removed_from_pool; - break; + /* Adjust the pointer for the application. */ + work_ptr = UX_UCHAR_POINTER_ADD(current_ptr, UX_MEMORY_BLOCK_HEADER_SIZE); - } - } + /* Clear the memory block. */ + _ux_utility_memory_set(work_ptr, 0, available_bytes); /* Use case of memset is verified. */ #ifdef UX_ENABLE_MEMORY_STATISTICS /* Update allocate count, total size. */ if (memory_cache_flag == UX_REGULAR_MEMORY) - { - _ux_system -> ux_system_regular_memory_pool_alloc_count ++; - _ux_system -> ux_system_regular_memory_pool_alloc_total += memory_size_requested; - if (_ux_system -> ux_system_regular_memory_pool_alloc_max_count < _ux_system -> ux_system_regular_memory_pool_alloc_count) - _ux_system -> ux_system_regular_memory_pool_alloc_max_count = _ux_system -> ux_system_regular_memory_pool_alloc_count; - if (_ux_system -> ux_system_regular_memory_pool_alloc_max_total < _ux_system -> ux_system_regular_memory_pool_alloc_total) - _ux_system -> ux_system_regular_memory_pool_alloc_max_total = _ux_system -> ux_system_regular_memory_pool_alloc_total; - } + index = UX_MEMORY_BYTE_POOL_REGULAR; else - { - _ux_system -> ux_system_cache_safe_memory_pool_alloc_count ++; - _ux_system -> ux_system_cache_safe_memory_pool_alloc_total += memory_size_requested; - if (_ux_system -> ux_system_cache_safe_memory_pool_alloc_max_count < _ux_system -> ux_system_cache_safe_memory_pool_alloc_count) - _ux_system -> ux_system_cache_safe_memory_pool_alloc_max_count = _ux_system -> ux_system_cache_safe_memory_pool_alloc_count; - if (_ux_system -> ux_system_cache_safe_memory_pool_alloc_max_total < _ux_system -> ux_system_cache_safe_memory_pool_alloc_total) - _ux_system -> ux_system_cache_safe_memory_pool_alloc_max_total = _ux_system -> ux_system_cache_safe_memory_pool_alloc_total; - } + index = UX_MEMORY_BYTE_POOL_CACHE_SAFE; + + /* Update allocate count, total size. */ + _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_count ++; + _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_total += (available_bytes + UX_MEMORY_BLOCK_HEADER_SIZE); - /* Log max usage of regular memory pool. */ - memory_removed_from_pool = (ALIGN_TYPE)_ux_system -> ux_system_regular_memory_pool_start - - (ALIGN_TYPE)_ux_system -> ux_system_regular_memory_pool_base; - if (memory_removed_from_pool > _ux_system -> ux_system_regular_memory_pool_max_start_offset) - _ux_system -> ux_system_regular_memory_pool_max_start_offset = memory_removed_from_pool; - if (_ux_system -> ux_system_regular_memory_pool_min_free > _ux_system -> ux_system_regular_memory_pool_free) - _ux_system -> ux_system_regular_memory_pool_min_free = _ux_system -> ux_system_regular_memory_pool_free; + if (_ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_max_count < _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_count) + _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_max_count = _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_count; - /* Log max usage of cache safe memory pool. */ - memory_removed_from_pool = (ALIGN_TYPE)_ux_system -> ux_system_cache_safe_memory_pool_start - - (ALIGN_TYPE)_ux_system -> ux_system_cache_safe_memory_pool_base; - if (memory_removed_from_pool > _ux_system -> ux_system_cache_safe_memory_pool_max_start_offset) - _ux_system -> ux_system_cache_safe_memory_pool_max_start_offset = memory_removed_from_pool; - if (_ux_system -> ux_system_cache_safe_memory_pool_min_free > _ux_system -> ux_system_cache_safe_memory_pool_free) - _ux_system -> ux_system_cache_safe_memory_pool_min_free = _ux_system -> ux_system_cache_safe_memory_pool_free; + if (_ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_max_total < _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_total) + _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_max_total = _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_total; + /* Log max usage of memory pool. */ + if (_ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_min_free > _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_available) + _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_min_free = _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_available; #endif /* Release the protection. */ _ux_system_mutex_off(&_ux_system -> ux_system_mutex); - /* The memory block pointer contains a memory area properly - aligned. */ - return(memory_buffer); -} + return(work_ptr); +} diff --git a/common/core/src/ux_utility_memory_byte_pool_create.c b/common/core/src/ux_utility_memory_byte_pool_create.c new file mode 100644 index 0000000..2d36225 --- /dev/null +++ b/common/core/src/ux_utility_memory_byte_pool_create.c @@ -0,0 +1,130 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) Microsoft Corporation. All rights reserved. */ +/* */ +/* This software is licensed under the Microsoft Software License */ +/* Terms for Microsoft Azure RTOS. Full text of the license can be */ +/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ +/* and in the root directory of this software. */ +/* */ +/**************************************************************************/ + + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** USBX Component */ +/** */ +/** USBX main stack */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + + +/* Include necessary system files. */ + +#define UX_SOURCE_CODE + +#include "ux_api.h" + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_utility_memory_byte_pool_create PORTABLE C */ +/* 6.3.0 */ +/* AUTHOR */ +/* */ +/* Yajun Xia, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function creates a pool of memory bytes in the specified */ +/* memory area. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* pool_start Address of beginning of pool area */ +/* pool_size Number of bytes in the byte pool */ +/* */ +/* OUTPUT */ +/* */ +/* UX_SUCCESS Successful completion status */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* USBX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ +/* */ +/**************************************************************************/ +UINT _ux_utility_memory_byte_pool_create(UX_MEMORY_BYTE_POOL *pool_ptr, VOID *pool_start, ULONG pool_size) +{ + +UCHAR *block_ptr; +UCHAR **block_indirect_ptr; +UCHAR *temp_ptr; +ALIGN_TYPE *free_ptr; + + + /* Initialize the byte pool control block to all zeros. */ + _ux_utility_memory_set((UCHAR *)pool_ptr, 0, sizeof(UX_MEMORY_BYTE_POOL)); /* Use case of memset is verified. */ + + /* Round the pool size down to something that is evenly divisible by + an ULONG. */ + pool_size = (pool_size/(sizeof(ALIGN_TYPE))) * (sizeof(ALIGN_TYPE)); + + /* Save the start and size of the pool. */ + pool_ptr -> ux_byte_pool_start = UX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); + pool_ptr -> ux_byte_pool_size = pool_size; + pool_ptr -> ux_byte_pool_search = UX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); + + /* Initially, the pool will have two blocks. One large block at the + beginning that is available and a small allocated block at the end + of the pool that is there just for the algorithm. Be sure to count + the available block's header in the available bytes count. */ + pool_ptr -> ux_byte_pool_available = pool_size - ((sizeof(VOID *)) + (sizeof(ALIGN_TYPE))); + pool_ptr -> ux_byte_pool_fragments = ((UINT) 2); + + /* Each block contains a "next" pointer that points to the next block in the pool followed by a ALIGN_TYPE + field that contains either the constant UX_BYTE_BLOCK_FREE (if the block is free) or a pointer to the + owning pool (if the block is allocated). */ + + /* Calculate the end of the pool's memory area. */ + block_ptr = UX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); + block_ptr = UX_UCHAR_POINTER_ADD(block_ptr, pool_size); + + /* Backup the end of the pool pointer and build the pre-allocated block. */ + block_ptr = UX_UCHAR_POINTER_SUB(block_ptr, (sizeof(ALIGN_TYPE))); + + /* Cast the pool pointer into a ULONG. */ + temp_ptr = UX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(pool_ptr); + block_indirect_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(block_ptr); + *block_indirect_ptr = temp_ptr; + + block_ptr = UX_UCHAR_POINTER_SUB(block_ptr, (sizeof(UCHAR *))); + block_indirect_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(block_ptr); + *block_indirect_ptr = UX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); + + /* Now setup the large available block in the pool. */ + temp_ptr = UX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); + block_indirect_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(temp_ptr); + *block_indirect_ptr = block_ptr; + block_ptr = UX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start); + block_ptr = UX_UCHAR_POINTER_ADD(block_ptr, (sizeof(UCHAR *))); + free_ptr = UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(block_ptr); + *free_ptr = UX_BYTE_BLOCK_FREE; + + /* Return UX_SUCCESS. */ + return(UX_SUCCESS); +} diff --git a/common/core/src/ux_utility_memory_byte_pool_search.c b/common/core/src/ux_utility_memory_byte_pool_search.c new file mode 100644 index 0000000..b688d01 --- /dev/null +++ b/common/core/src/ux_utility_memory_byte_pool_search.c @@ -0,0 +1,215 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) Microsoft Corporation. All rights reserved. */ +/* */ +/* This software is licensed under the Microsoft Software License */ +/* Terms for Microsoft Azure RTOS. Full text of the license can be */ +/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ +/* and in the root directory of this software. */ +/* */ +/**************************************************************************/ + + +/**************************************************************************/ +/**************************************************************************/ +/** */ +/** USBX Component */ +/** */ +/** USBX main stack */ +/** */ +/**************************************************************************/ +/**************************************************************************/ + + +/* Include necessary system files. */ + +#define UX_SOURCE_CODE + +#include "ux_api.h" + + +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_utility_memory_byte_pool_search PORTABLE C */ +/* 6.3.0 */ +/* AUTHOR */ +/* */ +/* Yajun Xia, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function searches a byte pool for a memory block to satisfy */ +/* the requested number of bytes. Merging of adjacent free blocks */ +/* takes place during the search. */ +/* */ +/* INPUT */ +/* */ +/* pool_ptr Pointer to pool control block */ +/* memory_size Number of bytes required */ +/* */ +/* OUTPUT */ +/* */ +/* UCHAR * Pointer to the allocated memory, */ +/* if successful. Otherwise, a */ +/* NULL is returned */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* USBX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ +/* */ +/**************************************************************************/ +UCHAR *_ux_utility_memory_byte_pool_search(UX_MEMORY_BYTE_POOL *pool_ptr, ULONG memory_size) +{ +UCHAR *current_ptr; +UCHAR *next_ptr; +UCHAR **this_block_link_ptr; +UCHAR **next_block_link_ptr; +ULONG available_bytes; +UINT examine_blocks; +UINT first_free_block_found = UX_FALSE; +ALIGN_TYPE *free_ptr; +UCHAR *work_ptr; +ULONG total_theoretical_available; + + /* First, determine if there are enough bytes in the pool. */ + /* Theoretical bytes available = free bytes + ((fragments-2) * overhead of each block) */ + total_theoretical_available = pool_ptr -> ux_byte_pool_available + ((pool_ptr -> ux_byte_pool_fragments - 2) * UX_MEMORY_BLOCK_HEADER_SIZE); + if (memory_size >= total_theoretical_available) + { + + /* Not enough memory, return a NULL pointer. */ + return(UX_NULL); + } + + /* Check if the search pointer is valid. */ + if ((pool_ptr -> ux_byte_pool_search < pool_ptr -> ux_byte_pool_start) || + (pool_ptr -> ux_byte_pool_search > pool_ptr -> ux_byte_pool_start + pool_ptr -> ux_byte_pool_size)) + { + + /* Return a NULL pointer. */ + return(UX_NULL); + } + + /* Walk through the memory pool in search for a large enough block. */ + current_ptr = pool_ptr -> ux_byte_pool_search; + examine_blocks = pool_ptr -> ux_byte_pool_fragments + ((UINT) 1); + available_bytes = ((ULONG) 0); + do + { + /* Check to see if this block is free. */ + work_ptr = UX_UCHAR_POINTER_ADD(current_ptr, (sizeof(UCHAR *))); + free_ptr = UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(work_ptr); + if ((*free_ptr) == UX_BYTE_BLOCK_FREE) + { + + /* Determine if this is the first free block. */ + if (first_free_block_found == UX_FALSE) + { + /* This is the first free block. */ + pool_ptr->ux_byte_pool_search = current_ptr; + + /* Set the flag to indicate we have found the first free + block. */ + first_free_block_found = UX_TRUE; + } + + /* Block is free, see if it is large enough. */ + + /* Pickup the next block's pointer. */ + this_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(current_ptr); + next_ptr = *this_block_link_ptr; + + /* Calculate the number of bytes available in this block. */ + available_bytes = UX_UCHAR_POINTER_DIF(next_ptr, current_ptr); + available_bytes = available_bytes - UX_MEMORY_BLOCK_HEADER_SIZE; + + /* If this is large enough, we are done because our first-fit algorithm + has been satisfied! */ + if (available_bytes >= memory_size) + { + + /* Get out of the search loop! */ + break; + } + else + { + + /* Clear the available bytes variable. */ + available_bytes = ((ULONG) 0); + + /* Not enough memory, check to see if the neighbor is + free and can be merged. */ + work_ptr = UX_UCHAR_POINTER_ADD(next_ptr, (sizeof(UCHAR *))); + free_ptr = UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(work_ptr); + if ((*free_ptr) == UX_BYTE_BLOCK_FREE) + { + + /* Yes, neighbor block can be merged! This is quickly accomplished + by updating the current block with the next blocks pointer. */ + next_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(next_ptr); + *this_block_link_ptr = *next_block_link_ptr; + + /* Reduce the fragment total. We don't need to increase the bytes + available because all free headers are also included in the available + count. */ + pool_ptr -> ux_byte_pool_fragments--; + + /* See if the search pointer is affected. */ + if (pool_ptr -> ux_byte_pool_search == next_ptr) + { + /* Yes, update the search pointer. */ + pool_ptr -> ux_byte_pool_search = current_ptr; + } + } + else + { + /* Neighbor is not free so we can skip over it! */ + next_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(next_ptr); + current_ptr = *next_block_link_ptr; + + /* Decrement the examined block count to account for this one. */ + if (examine_blocks != ((UINT) 0)) + { + examine_blocks--; + } + } + } + } + else + { + + /* Block is not free, move to next block. */ + this_block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(current_ptr); + current_ptr = *this_block_link_ptr; + } + + /* Another block has been searched... decrement counter. */ + if (examine_blocks != ((UINT) 0)) + { + + examine_blocks--; + } + + } while(examine_blocks != ((UINT) 0)); + + /* If a block was found, just return. */ + if (available_bytes == ((ULONG) 0)) + { + return(UX_NULL); + } + + /* Return the search pointer. */ + return(current_ptr); +} diff --git a/common/core/src/ux_utility_memory_free.c b/common/core/src/ux_utility_memory_free.c index bbab0e9..cbd38e3 100644 --- a/common/core/src/ux_utility_memory_free.c +++ b/common/core/src/ux_utility_memory_free.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Utility */ /** */ @@ -28,60 +28,71 @@ #include "ux_api.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_utility_memory_free PORTABLE C */ -/* 6.1.10 */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_utility_memory_free PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function frees a previously allocated memory block. */ -/* */ -/* INPUT */ -/* */ -/* memory Pointer to memory block */ -/* */ -/* OUTPUT */ -/* */ -/* None */ -/* */ -/* CALLS */ -/* */ -/* _ux_utility_mutex_on Start system protection */ -/* _ux_utility_mutex_off End system protection */ -/* */ -/* CALLED BY */ -/* */ -/* USBX Components */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* This function frees a previously allocated memory block. */ +/* */ +/* INPUT */ +/* */ +/* memory Pointer to memory block */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* _ux_utility_mutex_on Start system protection */ +/* _ux_utility_mutex_off End system protection */ +/* */ +/* CALLED BY */ +/* */ +/* USBX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ +/* 10-31-2023 Yajun Xia, CQ Xiao Modified comment(s), */ +/* added some error traps, */ +/* refined memory management, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_utility_memory_free(VOID *memory) { +UX_MEMORY_BYTE_POOL *pool_ptr; +UCHAR *work_ptr; +UCHAR *temp_ptr; +UCHAR *next_block_ptr; -UX_MEMORY_BLOCK *memory_block; -UX_MEMORY_BLOCK *next_block; -ULONG memory_size_returned; -UCHAR *memory_address; +ALIGN_TYPE *free_ptr; +UX_MEMORY_BYTE_POOL **byte_pool_ptr; +UCHAR **block_link_ptr; #ifdef UX_ENABLE_MEMORY_POOL_SANITY_CHECK +UCHAR *memory_address; UCHAR *regular_start, *regular_end; UCHAR *cache_safe_start, *cache_safe_end; #endif +#ifdef UX_ENABLE_MEMORY_STATISTICS +UINT index; +#endif /* Get the mutex as this is a critical section. */ _ux_system_mutex_on(&_ux_system -> ux_system_mutex); @@ -89,12 +100,13 @@ UCHAR *cache_safe_start, *cache_safe_end; #ifdef UX_ENABLE_MEMORY_POOL_SANITY_CHECK /* Sanity check, check if the memory is in memory pool. */ - regular_start = (UCHAR *)_ux_system -> ux_system_regular_memory_pool_start; - regular_end = regular_start + _ux_system -> ux_system_regular_memory_pool_size; - regular_start += sizeof(UX_MEMORY_BLOCK); - cache_safe_start = (UCHAR *)_ux_system -> ux_system_cache_safe_memory_pool_start; - cache_safe_end = cache_safe_start + _ux_system -> ux_system_cache_safe_memory_pool_size; - cache_safe_start += sizeof(UX_MEMORY_BLOCK); + regular_start = (UCHAR *)_ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR] -> ux_byte_pool_start; + regular_end = regular_start + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR] -> ux_byte_pool_size; + regular_start += UX_MEMORY_BLOCK_HEADER_SIZE; + cache_safe_start = (UCHAR *)_ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE] -> ux_byte_pool_start; + cache_safe_end = cache_safe_start + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE] -> ux_byte_pool_size; + cache_safe_start += UX_MEMORY_BLOCK_HEADER_SIZE; + memory_address = (UCHAR *)memory; if (!((memory_address >= regular_start && memory_address < regular_end) || (memory_address >= cache_safe_start && memory_address < cache_safe_end))) @@ -112,117 +124,103 @@ UCHAR *cache_safe_start, *cache_safe_end; } #endif - /* The memory block for this memory pointer is located right before the - memory. */ - memory_block = (UX_MEMORY_BLOCK *) (((UCHAR *) memory) - sizeof(UX_MEMORY_BLOCK)); - - /* Keep track of the memory returned to the pool. */ - memory_size_returned = memory_block -> ux_memory_block_size + (ULONG)sizeof(UX_MEMORY_BLOCK); + /* Set the pool pointer to NULL. */ + pool_ptr = UX_NULL; - /* Check this memory block to see if it valid. */ - if (memory_block -> ux_memory_block_status != (UX_MEMORY_USED | UX_REGULAR_MEMORY) && - memory_block -> ux_memory_block_status != (UX_MEMORY_USED | UX_CACHE_SAFE_MEMORY)) + /* Determine if the memory pointer is valid. */ + work_ptr = UX_VOID_TO_UCHAR_POINTER_CONVERT(memory); + if (work_ptr != UX_NULL) { - /* Not valid. Release the protection. */ - _ux_system_mutex_off(&_ux_system -> ux_system_mutex); + /* Back off the memory pointer to pickup its header. */ + work_ptr = UX_UCHAR_POINTER_SUB(work_ptr, UX_MEMORY_BLOCK_HEADER_SIZE); - /* Error trap. */ - _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_UTILITY, UX_MEMORY_CORRUPTED); + /* There is a pointer, pickup the pool pointer address. */ + temp_ptr = UX_UCHAR_POINTER_ADD(work_ptr, (sizeof(UCHAR *))); + free_ptr = UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(temp_ptr); + if ((*free_ptr) != UX_BYTE_BLOCK_FREE) + { - /* If trace is enabled, insert this event into the trace buffer. */ - UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_MEMORY_CORRUPTED, memory, 0, 0, UX_TRACE_ERRORS, 0, 0) + /* Pickup the pool pointer. */ + temp_ptr = UX_UCHAR_POINTER_ADD(work_ptr, (sizeof(UCHAR *))); + byte_pool_ptr = UX_UCHAR_TO_INDIRECT_BYTE_POOL_POINTER(temp_ptr); + pool_ptr = *byte_pool_ptr; - /* Return to caller. */ - return; - } + /* See if we have a valid pool pointer. */ + if ((pool_ptr == UX_NULL) || + ((pool_ptr != _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR]) && + (pool_ptr != _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_CACHE_SAFE]))) + { -#ifdef UX_ENABLE_MEMORY_STATISTICS + /* Release the protection. */ + _ux_system_mutex_off(&_ux_system -> ux_system_mutex); - /* Update allocate count, total size. */ - if (memory_block -> ux_memory_block_status == (UX_MEMORY_USED | UX_REGULAR_MEMORY)) - { - _ux_system -> ux_system_regular_memory_pool_alloc_count --; - _ux_system -> ux_system_regular_memory_pool_alloc_total -= memory_block -> ux_memory_block_size; - } - else - { - _ux_system -> ux_system_cache_safe_memory_pool_alloc_count --; - _ux_system -> ux_system_cache_safe_memory_pool_alloc_total -= memory_block -> ux_memory_block_size; - } -#endif + /* Error trap: maybe double free/memory issue here! */ + _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, + UX_SYSTEM_CONTEXT_UTILITY, UX_MEMORY_CORRUPTED); - /* We mark this memory block as being unused. */ - memory_block -> ux_memory_block_status = UX_MEMORY_UNUSED; - - /* Now we must concatenate as many free blocks as possible, - that include the blocks before and the blocks after the current - block. Scan memory backwards. */ + /* Return to caller. */ + return; + } + } + else + { + /* Release the protection. */ + _ux_system_mutex_off(&_ux_system -> ux_system_mutex); - while (memory_block -> ux_memory_block_previous !=UX_NULL) - { + /* Error trap: maybe double free/memory issue here! */ + _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, + UX_SYSTEM_CONTEXT_UTILITY, UX_MEMORY_CORRUPTED); - /* Check if the block is free. */ - if (memory_block -> ux_memory_block_previous -> ux_memory_block_status == UX_MEMORY_UNUSED) + /* Return to caller. */ + return; + } + } + else + { - /* The memory block before is free. This will be our starting point to - concatenate memory. */ - memory_block = memory_block -> ux_memory_block_previous; + /* Release the protection. */ + _ux_system_mutex_off(&_ux_system -> ux_system_mutex); - else + /* Error trap: maybe double free/bad flow here! */ + _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, + UX_SYSTEM_CONTEXT_UTILITY, UX_MEMORY_CORRUPTED); - /* The previous memory block is not free. */ - break; + /* Return to caller. */ + return; } - /* The pointer to the memory block is now our first free block. We use this - starting address to concatenate all the contiguous memory block. */ - next_block = memory_block -> ux_memory_block_next; - while (next_block != UX_NULL) - { + /* At this point, we know that the pool pointer is valid. */ - /* Determine if the memory block is used. */ - if (next_block -> ux_memory_block_status != UX_MEMORY_UNUSED) - { + /* Release the memory. */ + temp_ptr = UX_UCHAR_POINTER_ADD(work_ptr, (sizeof(UCHAR *))); + free_ptr = UX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(temp_ptr); + *free_ptr = UX_BYTE_BLOCK_FREE; - /* Yes, move to next block. */ - memory_block -> ux_memory_block_next = next_block; - next_block -> ux_memory_block_previous = memory_block; - break; - } + /* Update the number of available bytes in the pool. */ + block_link_ptr = UX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(work_ptr); + next_block_ptr = *block_link_ptr; + pool_ptr -> ux_byte_pool_available = + pool_ptr -> ux_byte_pool_available + UX_UCHAR_POINTER_DIF(next_block_ptr, work_ptr); - memory_block -> ux_memory_block_next = next_block -> ux_memory_block_next; - memory_block -> ux_memory_block_size += next_block -> ux_memory_block_size + (ULONG)sizeof(UX_MEMORY_BLOCK); - next_block = next_block -> ux_memory_block_next; - } - - /* Update the memory free in the appropriate pool. We need to know if this - block is in regular memory or cache safe memory. */ - if(_ux_system -> ux_system_cache_safe_memory_pool_start == _ux_system -> ux_system_regular_memory_pool_start) + /* Determine if the free block is prior to current search pointer. */ + if (work_ptr < (pool_ptr -> ux_byte_pool_search)) { - /* There is only one regular memory pool. */ - _ux_system -> ux_system_regular_memory_pool_free += memory_size_returned; - + /* Yes, update the search pointer to the released block. */ + pool_ptr -> ux_byte_pool_search = work_ptr; } - else - { - - /* Which pool is this memory in ? */ - memory_address = (UCHAR *) _ux_system -> ux_system_regular_memory_pool_start; - - /* If the memory address is in this range, we are in the regular memory pool. */ - if ((UCHAR *) memory_block >= memory_address && (UCHAR *) memory_block < (memory_address + _ux_system -> ux_system_regular_memory_pool_size)) - /* Update the regular memory pool. */ - _ux_system -> ux_system_regular_memory_pool_free += memory_size_returned; +#ifdef UX_ENABLE_MEMORY_STATISTICS + if (((UCHAR*)memory >= _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR] -> ux_byte_pool_start) && + ((UCHAR*)memory < (_ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR] -> ux_byte_pool_start + _ux_system -> ux_system_memory_byte_pool[UX_MEMORY_BYTE_POOL_REGULAR] -> ux_byte_pool_size))) + index = UX_MEMORY_BYTE_POOL_REGULAR; + else + index = UX_MEMORY_BYTE_POOL_CACHE_SAFE; - else - - /* Update the cache safe memory pool. */ - _ux_system -> ux_system_cache_safe_memory_pool_free += memory_size_returned; - - } + _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_count --; + _ux_system -> ux_system_memory_byte_pool[index] -> ux_byte_pool_alloc_total -= UX_UCHAR_POINTER_DIF(next_block_ptr, work_ptr); +#endif /* Release the protection. */ _ux_system_mutex_off(&_ux_system -> ux_system_mutex); diff --git a/common/core/src/ux_utility_memory_free_block_best_get.c b/common/core/src/ux_utility_memory_free_block_best_get.c index 87179f3..b7203bd 100644 --- a/common/core/src/ux_utility_memory_free_block_best_get.c +++ b/common/core/src/ux_utility_memory_free_block_best_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** USBX main stack */ /** */ @@ -28,57 +28,64 @@ #include "ux_api.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_utility_memory_free_block_best_get PORTABLE C */ -/* 6.1 */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_utility_memory_free_block_best_get PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function returns the best free memory block. */ -/* */ -/* INPUT */ -/* */ -/* memory_cache_flag Memory pool source */ -/* memory_size_requested Size of memory requested */ -/* */ -/* OUTPUT */ -/* */ -/* Pointer to best free block */ -/* */ -/* CALLS */ -/* */ +/* */ +/* This function returns the best free memory block. */ +/* */ +/* It's deprecated. */ +/* */ +/* INPUT */ +/* */ +/* memory_cache_flag Memory pool source */ +/* memory_size_requested Size of memory requested */ +/* */ +/* OUTPUT */ +/* */ +/* Pointer to best free block */ +/* */ +/* CALLS */ +/* */ /* None */ -/* */ -/* CALLED BY */ -/* */ -/* USBX Components */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* USBX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* deprecated for memory */ +/* footprint optimization, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ -UX_MEMORY_BLOCK *_ux_utility_memory_free_block_best_get(ULONG memory_cache_flag, +#if 0 +UX_MEMORY_BLOCK *_ux_utility_memory_free_block_best_get(ULONG memory_cache_flag, ULONG memory_size_requested) { UX_MEMORY_BLOCK *memory_block; UX_MEMORY_BLOCK *best_memory_block; - + /* Reset the free memory block. */ best_memory_block = UX_NULL; - + /* Check the type of memory we need. */ switch (memory_cache_flag) { @@ -88,15 +95,15 @@ UX_MEMORY_BLOCK *best_memory_block; /* Start at the beginning of the regular memory pool. */ memory_block = _ux_system -> ux_system_regular_memory_pool_start; break; - + case UX_CACHE_SAFE_MEMORY : /* Start at the beginning of the cache safe memory pool. */ memory_block = _ux_system -> ux_system_cache_safe_memory_pool_start; break; - + default : - + /* Wrong memory type. */ return(UX_NULL); @@ -110,11 +117,11 @@ UX_MEMORY_BLOCK *best_memory_block; if (memory_block -> ux_memory_block_status == UX_MEMORY_UNUSED) { - /* Check the size of this free block and see if it will + /* Check the size of this free block and see if it will fit the memory requirement. */ if (memory_block -> ux_memory_block_size > memory_size_requested) { - + /* This memory block will do. Now see if it is the best. The best memory block is the one whose memory is closest to the memory requested. */ @@ -129,15 +136,15 @@ UX_MEMORY_BLOCK *best_memory_block; /* We have discovered a better fit block. */ best_memory_block = memory_block; - } + } } } - /* Search the next free block until the end. */ + /* Search the next free block until the end. */ memory_block = memory_block -> ux_memory_block_next; } /* If no free memory block was found, the return value will be NULL. */ - return(best_memory_block); -} - + return(best_memory_block); +} +#endif |
