diff options
Diffstat (limited to 'common/core')
| -rw-r--r--[-rwxr-xr-x] | common/core/inc/ux_api.h | 26 | ||||
| -rw-r--r-- | common/core/inc/ux_user_sample.h | 25 | ||||
| -rw-r--r-- | common/core/src/ux_host_stack_configuration_instance_create.c | 28 | ||||
| -rw-r--r-- | common/core/src/ux_host_stack_configuration_instance_delete.c | 14 | ||||
| -rw-r--r--[-rwxr-xr-x] | common/core/src/ux_host_stack_hcd_thread_entry.c | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | common/core/src/ux_host_stack_hcd_unregister.c | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | common/core/src/ux_host_stack_rh_change_process.c | 0 | ||||
| -rw-r--r-- | common/core/src/ux_host_stack_tasks_run.c | 39 | ||||
| -rw-r--r-- | common/core/src/ux_host_stack_transfer_request_abort.c | 11 | ||||
| -rw-r--r--[-rwxr-xr-x] | common/core/src/ux_utility_delay_ms.c | 0 |
10 files changed, 113 insertions, 30 deletions
diff --git a/common/core/inc/ux_api.h b/common/core/inc/ux_api.h index b8f0c6e..cb83675 100755..100644 --- a/common/core/inc/ux_api.h +++ b/common/core/inc/ux_api.h @@ -26,7 +26,7 @@ /* APPLICATION INTERFACE DEFINITION RELEASE */ /* */ /* ux_api.h PORTABLE C */ -/* 6.1.12 */ +/* 6.2.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -122,6 +122,12 @@ /* added shared device config */ /* descriptor for enum scan, */ /* resulting in version 6.1.12 */ +/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ +/* added some ETH error codes, */ +/* allowed align minimal def, */ +/* added interface instance */ +/* creation strategy control, */ +/* resulting in version 6.2.0 */ /* */ /**************************************************************************/ @@ -288,8 +294,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 1 -#define USBX_PATCH_VERSION 12 +#define USBX_MINOR_VERSION 2 +#define USBX_PATCH_VERSION 0 /* Macros for concatenating tokens, where UX_CONCATn concatenates n tokens. */ @@ -1102,7 +1108,6 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_NO_ALIGN 0u #define UX_ALIGN_16 0x0fu -#define UX_ALIGN_MIN 0x0fu #define UX_ALIGN_32 0x1fu #define UX_ALIGN_64 0x3fu #define UX_ALIGN_128 0x7fu @@ -1113,6 +1118,9 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_ALIGN_4096 0xfffu #define UX_SAFE_ALIGN 0xffffffffu #define UX_MAX_SCATTER_GATHER_ALIGNMENT 4096 +#ifndef UX_ALIGN_MIN +#define UX_ALIGN_MIN UX_ALIGN_16 +#endif #define UX_MAX_USB_DEVICES 127 @@ -1483,6 +1491,10 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_HOST_CLASS_AUDIO_WRONG_FREQUENCY 0x82 #define UX_CLASS_CDC_ECM_LINK_STATE_DOWN_ERROR 0x90 +#define UX_CLASS_ETH_LINK_STATE_DOWN_ERROR 0x90 +#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. */ @@ -2049,6 +2061,12 @@ typedef struct UX_CONFIGURATION_STRUCT ULONG ux_configuration_iad_protocol; } UX_CONFIGURATION; +#define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_ALL 0 /* Default: all things created. */ +#define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED 1 /* Owned: class owned things created. */ +#ifndef UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL +#define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_ALL +#endif + /* Define USBX Interface Descriptor structure. */ diff --git a/common/core/inc/ux_user_sample.h b/common/core/inc/ux_user_sample.h index 0df602e..72a7e5e 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.1.12 */ +/* 6.2.0 */ /* */ /* AUTHOR */ /* */ @@ -83,6 +83,12 @@ /* added device CDC_ACM and */ /* printer write auto ZLP, */ /* resulting in version 6.1.12 */ +/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ +/* deprecated ECM pool option, */ +/* added align minimal config, */ +/* added host stack instance */ +/* creation strategy control, */ +/* resulting in version 6.2.0 */ /* */ /**************************************************************************/ @@ -116,6 +122,10 @@ /* Override various options with default values already assigned in ux_api.h or ux_port.h. Please 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 */ + /* Defined, this value represents how many ticks per seconds for a specific hardware platform. The default is 1000 indicating 1 tick per millisecond. */ @@ -317,7 +327,9 @@ /* #define UX_HOST_CLASS_CDC_ECM_PACKET_POOL_INSTANCE_WAIT 10 */ -/* Defined, this enables CDC ECM class to use the packet pool from NetX instance. */ +/* Defined, this enables CDC ECM class to use the packet pool from NetX instance. + It's deprecated, packet pool from NetX instance is always used now. + */ /* #define UX_HOST_CLASS_CDC_ECM_USE_PACKET_POOL_FROM_NETX */ @@ -427,6 +439,15 @@ /* Defined, host audio optional interrupt endpoint is support. */ /* #define UX_HOST_CLASS_AUDIO_INTERRUPT_SUPPORT */ +/* Defined, this value controls host configuration instance creation, include all + interfaces and endpoints physical resources. + Possible settings: + UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_ALL (0) - The default, create all inside configuration. + UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED (1) - Create things owned by class driver. + Not defined, default setting is applied. + */ +/* #define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED */ + /* Defined, this value will only enable the host side of usbx. */ /* #define UX_HOST_SIDE_ONLY */ diff --git a/common/core/src/ux_host_stack_configuration_instance_create.c b/common/core/src/ux_host_stack_configuration_instance_create.c index 678b5b5..7d44c07 100644 --- a/common/core/src/ux_host_stack_configuration_instance_create.c +++ b/common/core/src/ux_host_stack_configuration_instance_create.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_stack_configuration_instance_create PORTABLE C */ -/* 6.1.12 */ +/* 6.2.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,6 +72,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ +/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ +/* added interface instance */ +/* creation strategy control, */ +/* resulting in version 6.2.0 */ /* */ /**************************************************************************/ UINT _ux_host_stack_configuration_instance_create(UX_CONFIGURATION *configuration) @@ -93,15 +97,21 @@ UINT status; /* Check if we are dealing with the first alternate setting. */ if (interface_ptr -> ux_interface_descriptor.bAlternateSetting == 0) { - /* Create the interface. */ - status = _ux_host_stack_interface_instance_create(interface_ptr); - /* Check status, the controller may have refused the endpoint creation. */ - if (status != UX_SUCCESS) - - /* An error occurred. The interface cannot be mounted. */ - return(status); - +#if UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL == UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED + + /* Create the interface, if it's usable. */ + if (interface_ptr -> ux_interface_class || configuration -> ux_configuration_device -> ux_device_class) +#endif + { + status = _ux_host_stack_interface_instance_create(interface_ptr); + + /* Check status, the controller may have refused the endpoint creation. */ + if (status != UX_SUCCESS) + + /* An error occurred. The interface cannot be mounted. */ + return(status); + } } /* Next interface. */ diff --git a/common/core/src/ux_host_stack_configuration_instance_delete.c b/common/core/src/ux_host_stack_configuration_instance_delete.c index 9413c69..5834e0d 100644 --- a/common/core/src/ux_host_stack_configuration_instance_delete.c +++ b/common/core/src/ux_host_stack_configuration_instance_delete.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_stack_configuration_instance_delete PORTABLE C */ -/* 6.1.12 */ +/* 6.2.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,6 +72,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ +/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ +/* added interface instance */ +/* creation strategy control, */ +/* resulting in version 6.2.0 */ /* */ /**************************************************************************/ VOID _ux_host_stack_configuration_instance_delete(UX_CONFIGURATION *configuration) @@ -102,7 +106,13 @@ ULONG current_alternate_setting; if (interface_ptr -> ux_interface_descriptor.bAlternateSetting == current_alternate_setting) { - _ux_host_stack_interface_instance_delete(interface_ptr); + +#if UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL == UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED + + /* If interface is usable, remove physical creates. */ + if (interface_ptr -> ux_interface_class || configuration -> ux_configuration_device -> ux_device_class) +#endif + _ux_host_stack_interface_instance_delete(interface_ptr); } interface_ptr = interface_ptr -> ux_interface_next_interface; diff --git a/common/core/src/ux_host_stack_hcd_thread_entry.c b/common/core/src/ux_host_stack_hcd_thread_entry.c index 652035b..652035b 100755..100644 --- a/common/core/src/ux_host_stack_hcd_thread_entry.c +++ b/common/core/src/ux_host_stack_hcd_thread_entry.c diff --git a/common/core/src/ux_host_stack_hcd_unregister.c b/common/core/src/ux_host_stack_hcd_unregister.c index 277cf1a..277cf1a 100755..100644 --- a/common/core/src/ux_host_stack_hcd_unregister.c +++ b/common/core/src/ux_host_stack_hcd_unregister.c diff --git a/common/core/src/ux_host_stack_rh_change_process.c b/common/core/src/ux_host_stack_rh_change_process.c index ccce8e8..ccce8e8 100755..100644 --- a/common/core/src/ux_host_stack_rh_change_process.c +++ b/common/core/src/ux_host_stack_rh_change_process.c diff --git a/common/core/src/ux_host_stack_tasks_run.c b/common/core/src/ux_host_stack_tasks_run.c index a867411..6363268 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.1.12 */ +/* 6.2.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -105,6 +105,11 @@ static inline VOID _ux_host_stack_pending_transfers_run(VOID); /* used shared descriptor in */ /* device instance for enum, */ /* resulting in version 6.1.12 */ +/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ +/* improved internal logic, */ +/* fixed activation issue on */ +/* no class linked interfaces, */ +/* resulting in version 6.2.0 */ /* */ /**************************************************************************/ UINT _ux_host_stack_tasks_run(VOID) @@ -376,7 +381,12 @@ UX_INTERFACE *interface_inst; device -> ux_device_class : device -> ux_device_enum_inst.interface -> ux_interface_class; command -> ux_host_class_command_request = UX_HOST_CLASS_COMMAND_ACTIVATE_WAIT; - status = command -> ux_host_class_command_class_ptr -> ux_host_class_entry_function(command); + + /* If there is no class linked, just next state. */ + if (command -> ux_host_class_command_class_ptr != UX_NULL) + status = command -> ux_host_class_command_class_ptr -> ux_host_class_entry_function(command); + else + status = UX_STATE_NEXT; /* No wait command or ready for next state. */ if (status == UX_FUNCTION_NOT_SUPPORTED || @@ -435,6 +445,7 @@ UX_TRANSFER *trans; UX_CONFIGURATION *configuration; UX_HOST_CLASS_COMMAND class_command; UCHAR *buffer; +INT immediate_state = UX_TRUE; /* Check if the device enumeration should be processed. */ if ((device -> ux_device_flags & UX_DEVICE_FLAG_ENUM) == 0) @@ -457,7 +468,7 @@ UCHAR *buffer; } UX_RESTORE - while (1) + while (immediate_state) { switch (device -> ux_device_enum_state) { @@ -911,12 +922,17 @@ UCHAR *buffer; class_command.ux_host_class_command_class_ptr = device -> ux_device_enum_inst.interface -> ux_interface_class; } - status = class_command.ux_host_class_command_class_ptr -> - ux_host_class_entry_function(&class_command); - if (status != UX_SUCCESS) + + /* If there class linked, start activation. */ + if (class_command.ux_host_class_command_class_ptr != UX_NULL) { - device -> ux_device_enum_state = UX_HOST_STACK_ENUM_RETRY; - continue; + status = class_command.ux_host_class_command_class_ptr -> + ux_host_class_entry_function(&class_command); + if (status != UX_SUCCESS) + { + device -> ux_device_enum_state = UX_HOST_STACK_ENUM_RETRY; + continue; + } } /* Class activate execute wait. */ @@ -1078,8 +1094,11 @@ UCHAR *buffer; device -> ux_device_enum_state = UX_STATE_RESET; } - /* Run once anyway. */ - break; + /* Invalid unhandled state. */ + _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_HOST_STACK, UX_INVALID_STATE); + + /* Break the immediate state loop. */ + immediate_state = UX_FALSE; } } 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 58591e9..ad1c5f7 100644 --- a/common/core/src/ux_host_stack_transfer_request_abort.c +++ b/common/core/src/ux_host_stack_transfer_request_abort.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_stack_transfer_request_abort PORTABLE C */ -/* 6.1.10 */ +/* 6.2.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -83,6 +83,8 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ +/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.2.0 */ /* */ /**************************************************************************/ UINT _ux_host_stack_transfer_request_abort(UX_TRANSFER *transfer_request) @@ -104,14 +106,17 @@ ULONG completion_code; /* Check pending transaction. */ if (transfer_request -> ux_transfer_request_completion_code == UX_TRANSFER_STATUS_PENDING) { - + /* Send the abort command to the controller. */ hcd -> ux_hcd_entry_function(hcd, UX_HCD_TRANSFER_ABORT, transfer_request); /* Save the completion code since we're about to set it to ABORT. The reason we can't just assume its value is PENDING is that in between the completion code check and this line, it's possible that the transfer - completed, which would've changed the completion code to SUCCESS. + completed (by HCD function call below, or ISR), which would've + changed the completion code to SUCCESS and put the semaphore. + Even it's recommended to keep completion code untouched to let things + changed later here. Such a case is valid, and we want to make sure we don't put() the transfer request's semaphore again. */ completion_code = transfer_request -> ux_transfer_request_completion_code; diff --git a/common/core/src/ux_utility_delay_ms.c b/common/core/src/ux_utility_delay_ms.c index 64a3add..64a3add 100755..100644 --- a/common/core/src/ux_utility_delay_ms.c +++ b/common/core/src/ux_utility_delay_ms.c |
