diff options
| author | Chaoqiong Xiao <[email protected]> | 2023-03-08 08:32:02 +0000 |
|---|---|---|
| committer | Chaoqiong Xiao <[email protected]> | 2023-03-08 08:32:02 +0000 |
| commit | 2d357c5912709485aac36a3bf3800cf282477d34 (patch) | |
| tree | 70e5abeff5343d3ff88577e6bfca3f0bac11ce9e /common/usbx_host_classes | |
| parent | 813361a875870d3c3c4ae7b830a54e0748e889e1 (diff) | |
Release 6.2.1 on 08 Mar 2023. Expand to see details.v6.2.1_rel
e180182e Update owners
a6785db8 Update for release.
bc77918b Improve host audio sampling set and check (fixed a memory issue).
97d66e5d Add optimization options to ux_user.h
eea2c732 USBX device printer error checking support.
1760cc8c USBX device audio error checking support
a39f2f26 Fixed a macro name issue in device audio 1.0
83278dd8 Supported multiple report IDs in host HID.
c548fe33 Fixed host CDC-ACM capability get.
b64f8cdb Fix vendor request handling.
Diffstat (limited to 'common/usbx_host_classes')
9 files changed, 87 insertions, 43 deletions
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c b/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c index 244451c..7a97642 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_audio_streaming_sampling_set PORTABLE C */ -/* 6.1.12 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -96,6 +96,9 @@ /* fixed error return code, */ /* used endpoints get API, */ /* resulting in version 6.1.12 */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved frequency check, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _ux_host_class_audio_streaming_sampling_set(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_SAMPLING *audio_sampling) @@ -305,10 +308,10 @@ ULONG res_bytes; transfer -> ux_transfer_request_value = UX_CLASS_AUDIO10_EP_SAMPLING_FREQ_CONTROL << 8; transfer -> ux_transfer_request_index = audio -> ux_host_class_audio_isochronous_endpoint -> ux_endpoint_descriptor.bEndpointAddress; status = _ux_host_stack_transfer_request(transfer); - } - /* Free buffer. */ - _ux_utility_memory_free(control_buffer); + /* Clear 4th byte in case it's changed occasionally. */ + control_buffer[3] = 0; + } /* Check frequency. */ if (status == UX_SUCCESS) @@ -317,18 +320,24 @@ ULONG res_bytes; if (audio_sampling -> ux_host_class_audio_sampling_frequency != frequency) status = UX_HOST_CLASS_AUDIO_WRONG_FREQUENCY; } + + /* Free buffer. */ + _ux_utility_memory_free(control_buffer); } /* Update packet processing parameters. */ - audio -> ux_host_class_audio_packet_freq = - (device -> ux_device_speed == UX_HIGH_SPEED_DEVICE) ? - 8000 : 1000; - audio -> ux_host_class_audio_packet_freq <<= - audio -> ux_host_class_audio_isochronous_endpoint -> - ux_endpoint_descriptor.bInterval - 1; /* Max 8000 << 15, no overflow. */ - res_bytes = audio_sampling -> ux_host_class_audio_sampling_resolution; - if (UX_OVERFLOW_CHECK_ADD_ULONG(res_bytes, 7)) - status = UX_MATH_OVERFLOW; + if (status == UX_SUCCESS) + { + audio -> ux_host_class_audio_packet_freq = + (device -> ux_device_speed == UX_HIGH_SPEED_DEVICE) ? + 8000 : 1000; + audio -> ux_host_class_audio_packet_freq <<= + audio -> ux_host_class_audio_isochronous_endpoint -> + ux_endpoint_descriptor.bInterval - 1; /* Max 8000 << 15, no overflow. */ + res_bytes = audio_sampling -> ux_host_class_audio_sampling_resolution; + if (UX_OVERFLOW_CHECK_ADD_ULONG(res_bytes, 7)) + status = UX_MATH_OVERFLOW; + } if (status == UX_SUCCESS) { res_bytes += 7; diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_capabilities_get.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_capabilities_get.c index 2a1c863..e67367e 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_capabilities_get.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_capabilities_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_cdc_acm_capabilities_get PORTABLE C */ -/* 6.1 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,6 +72,10 @@ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ +/* fixed capabilities get from */ +/* multiple CDC-ACM functions, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _ux_host_class_cdc_acm_capabilities_get(UX_HOST_CLASS_CDC_ACM *cdc_acm) @@ -190,10 +194,10 @@ ULONG interface_found; _ux_utility_descriptor_parse(descriptor, _ux_system_interface_descriptor_structure, UX_INTERFACE_DESCRIPTOR_ENTRIES, (UCHAR *) &interface_descriptor); - /* Ensure we have the correct interface for Audio streaming. */ - if ((interface_descriptor.bInterfaceClass == UX_HOST_CLASS_CDC_CONTROL_CLASS) && - ((interface_descriptor.bInterfaceSubClass == UX_HOST_CLASS_CDC_ACM_SUBCLASS) || - (interface_descriptor.bInterfaceSubClass == UX_HOST_CLASS_CDC_DLC_SUBCLASS))) + /* Ensure we have the correct interface for CDC control (current interface). */ + if (interface_descriptor.bInterfaceNumber == + cdc_acm -> ux_host_class_cdc_acm_interface -> + ux_interface_descriptor.bInterfaceNumber) { /* Mark we have found it. */ diff --git a/common/usbx_host_classes/src/ux_host_class_hid_transfer_request_completed.c b/common/usbx_host_classes/src/ux_host_class_hid_transfer_request_completed.c index b4f8bb4..7014b26 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_transfer_request_completed.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_transfer_request_completed.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hid_transfer_request_completed PORTABLE C */ -/* 6.1 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -74,6 +74,9 @@ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ +/* supported report IDs, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ VOID _ux_host_class_hid_transfer_request_completed(UX_TRANSFER *transfer_request) @@ -128,16 +131,44 @@ ULONG field_report_count; /* We know this incoming report is for the Input report. */ hid_report = hid -> ux_host_class_hid_parser.ux_host_class_hid_parser_input_report; - /* initialize some of the callback structure which are generic to any - reporting method. */ - callback.ux_host_class_hid_report_callback_client = hid_client; - callback.ux_host_class_hid_report_callback_id = hid_report -> ux_host_class_hid_report_id; - + /* If there are multiple HID reports, report ID must be checked. */ + if (hid_report -> ux_host_class_hid_report_next_report != UX_NULL) + { + + /* Scan the reports to find the report expected. */ + while(1) + { + + /* Check report ID at buffer start. */ + if (*(UCHAR*)report_buffer == hid_report -> ux_host_class_hid_report_id) + break; + + /* If there is no more report, it's done. */ + if (hid_report -> ux_host_class_hid_report_next_report == UX_NULL) + break; + + /* There is more reports, next. */ + hid_report = hid_report -> ux_host_class_hid_report_next_report; + } + + /* Check if the report is what we expected. */ + if (*(UCHAR*)report_buffer != hid_report -> ux_host_class_hid_report_id) + + /* Report not found. */ + hid_report = UX_NULL; + } + /* For this report to be used, the HID client must have registered the report. We check the call back function. */ - if (hid_report -> ux_host_class_hid_report_callback_function != UX_NULL) + if ((hid_report != UX_NULL) && + (hid_report -> ux_host_class_hid_report_callback_function != UX_NULL)) { + /* initialize some of the callback structure which are generic to any + reporting method. */ + callback.ux_host_class_hid_report_callback_client = hid_client; + callback.ux_host_class_hid_report_callback_id = hid_report -> ux_host_class_hid_report_id; + /* The report is now in memory in a raw format the application may desire to handle it that way! */ if (hid_report -> ux_host_class_hid_report_callback_flags & UX_HOST_CLASS_HID_REPORT_RAW) { diff --git a/common/usbx_host_classes/src/ux_host_class_hub_tasks_run.c b/common/usbx_host_classes/src/ux_host_class_hub_tasks_run.c index d702e95..ef4d399 100644 --- a/common/usbx_host_classes/src/ux_host_class_hub_tasks_run.c +++ b/common/usbx_host_classes/src/ux_host_class_hub_tasks_run.c @@ -40,7 +40,7 @@ static inline VOID _ux_host_class_hub_inst_tasks_run(UX_HOST_CLASS_HUB *hub); /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hub_tasks_run PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -90,10 +90,10 @@ static inline VOID _ux_host_class_hub_inst_tasks_run(UX_HOST_CLASS_HUB *hub); /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* fixed reset speed handling, */ /* resulting in version 6.2.0 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* fixed compile issue if only */ /* one device is supported, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _ux_host_class_hub_tasks_run(UX_HOST_CLASS *hub_class) diff --git a/common/usbx_host_classes/src/ux_host_class_storage_check_run.c b/common/usbx_host_classes/src/ux_host_class_storage_check_run.c index 6c8eb86..3063cee 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_check_run.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_check_run.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_check_run PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,9 +79,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* checked device state, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_check_run(UX_HOST_CLASS_STORAGE *storage) diff --git a/common/usbx_host_classes/src/ux_host_class_storage_lock.c b/common/usbx_host_classes/src/ux_host_class_storage_lock.c index a2a0616..045b1b2 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_lock.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_lock.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_lock PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -71,9 +71,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* checked device state, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_lock(UX_HOST_CLASS_STORAGE *storage, ULONG wait) diff --git a/common/usbx_host_classes/src/ux_host_class_storage_media_read.c b/common/usbx_host_classes/src/ux_host_class_storage_media_read.c index 61cdcf7..6134a69 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_media_read.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_media_read.c @@ -82,7 +82,7 @@ ULONG command_length; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_media_read PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -123,9 +123,9 @@ ULONG command_length; /* 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), */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* checked device removal, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_media_read(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start, diff --git a/common/usbx_host_classes/src/ux_host_class_storage_media_write.c b/common/usbx_host_classes/src/ux_host_class_storage_media_write.c index 4ad2d17..fb89183 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_media_write.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_media_write.c @@ -81,7 +81,7 @@ ULONG command_length; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_media_write PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -122,9 +122,9 @@ ULONG command_length; /* 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), */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* checked device removal, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_media_write(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start, diff --git a/common/usbx_host_classes/src/ux_host_class_storage_read_write_run.c b/common/usbx_host_classes/src/ux_host_class_storage_read_write_run.c index 6077eb9..79c3b13 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_read_write_run.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_read_write_run.c @@ -43,7 +43,7 @@ extern VOID _ux_host_class_storage_write_initialize(UX_HOST_CLASS_STORAGE *stora /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_read_write_run PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -93,9 +93,9 @@ extern VOID _ux_host_class_storage_write_initialize(UX_HOST_CLASS_STORAGE *stora /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* checked device state, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_read_write_run(UX_HOST_CLASS_STORAGE *storage, |
