diff options
Diffstat (limited to 'common/core/src')
| -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 |
8 files changed, 68 insertions, 24 deletions
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 |
