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/usbx_host_classes | |
| 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/usbx_host_classes')
140 files changed, 914 insertions, 709 deletions
diff --git a/common/usbx_host_classes/inc/ux_host_class_audio.h b/common/usbx_host_classes/inc/ux_host_class_audio.h index 2405ab3..dde751d 100644 --- a/common/usbx_host_classes/inc/ux_host_class_audio.h +++ b/common/usbx_host_classes/inc/ux_host_class_audio.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_class_audio.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -57,9 +57,10 @@ /* added feedback support, */ /* added Audio 2.0 support, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved AC AS management, */ /* optimized USB descriptors, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ @@ -458,6 +459,7 @@ typedef struct UX_HOST_CLASS_AUDIO_STRUCT #if defined(UX_HOST_CLASS_AUDIO_INTERRUPT_SUPPORT) UX_HOST_CLASS_AUDIO_AC *ux_host_class_audio_ac; + ULONG ux_host_class_audio_ac_as; #endif struct UX_HOST_CLASS_AUDIO_TRANSFER_REQUEST_STRUCT *ux_host_class_audio_head_transfer_request; diff --git a/common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h b/common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h index f5332d0..fa1c183 100644 --- a/common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h +++ b/common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_class_cdc_ecm.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -60,9 +60,9 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* supported NX packet chain, */ /* resulting in version 6.2.0 */ -/* 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 */ /* */ /**************************************************************************/ diff --git a/common/usbx_host_classes/inc/ux_host_class_hid.h b/common/usbx_host_classes/inc/ux_host_class_hid.h index 81074b4..4720cc7 100644 --- a/common/usbx_host_classes/inc/ux_host_class_hid.h +++ b/common/usbx_host_classes/inc/ux_host_class_hid.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_class_hid.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -55,9 +55,9 @@ /* added interrupt OUT support,*/ /* added standalone mode, */ /* resulting in version 6.1.10 */ -/* 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 */ /* */ /**************************************************************************/ diff --git a/common/usbx_host_classes/inc/ux_host_class_hub.h b/common/usbx_host_classes/inc/ux_host_class_hub.h index d008672..3204387 100644 --- a/common/usbx_host_classes/inc/ux_host_class_hub.h +++ b/common/usbx_host_classes/inc/ux_host_class_hub.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_class_hub.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -50,9 +50,9 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.12 */ -/* 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 */ /* */ /**************************************************************************/ diff --git a/common/usbx_host_classes/inc/ux_host_class_pima.h b/common/usbx_host_classes/inc/ux_host_class_pima.h index 9230395..7b4b915 100644 --- a/common/usbx_host_classes/inc/ux_host_class_pima.h +++ b/common/usbx_host_classes/inc/ux_host_class_pima.h @@ -21,12 +21,12 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* COMPONENT DEFINITION RELEASE */ -/* */ -/* ux_host_class_pima.h PORTABLE C */ -/* 6.x */ +/**************************************************************************/ +/* */ +/* COMPONENT DEFINITION RELEASE */ +/* */ +/* ux_host_class_pima.h PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -53,11 +53,13 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* improved internal checks, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* removed unused semaphore, */ +/* optimized PIMA data sets, */ /* increased default buffer */ /* length to get device info, */ -/* added error checks support, */ -/* resulting in version 6.x */ +/* added error checks support, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ @@ -403,7 +405,6 @@ typedef struct UX_HOST_CLASS_PIMA_STRUCT struct UX_HOST_CLASS_PIMA_SESSION_STRUCT *ux_host_class_pima_session; UCHAR *ux_host_class_pima_container; - UX_SEMAPHORE ux_host_class_pima_semaphore; VOID *ux_host_class_pima_application; ULONG ux_host_class_pima_zlp_flag; @@ -447,10 +448,11 @@ typedef struct UX_HOST_CLASS_PIMA_OBJECT_STRUCT { ULONG ux_host_class_pima_object_storage_id; - ULONG ux_host_class_pima_object_format; - ULONG ux_host_class_pima_object_protection_satus; + USHORT ux_host_class_pima_object_format; + USHORT ux_host_class_pima_object_protection_status; ULONG ux_host_class_pima_object_compressed_size; - ULONG ux_host_class_pima_object_thumb_format; + USHORT ux_host_class_pima_object_thumb_format; + USHORT _align_thumb_compressed_size; ULONG ux_host_class_pima_object_thumb_compressed_size; ULONG ux_host_class_pima_object_thumb_pix_width; ULONG ux_host_class_pima_object_thumb_pix_height; @@ -458,7 +460,8 @@ typedef struct UX_HOST_CLASS_PIMA_OBJECT_STRUCT ULONG ux_host_class_pima_object_image_pix_height; ULONG ux_host_class_pima_object_image_bit_depth; ULONG ux_host_class_pima_object_parent_object; - ULONG ux_host_class_pima_object_association_type; + USHORT ux_host_class_pima_object_association_type; + USHORT _align_association_desc; ULONG ux_host_class_pima_object_association_desc; ULONG ux_host_class_pima_object_sequence_number; UCHAR ux_host_class_pima_object_filename[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string. */ @@ -515,9 +518,10 @@ typedef struct UX_HOST_CLASS_PIMA_DEVICE_STRUCT typedef struct UX_HOST_CLASS_PIMA_STORAGE_STRUCT { - ULONG ux_host_class_pima_storage_type; - ULONG ux_host_class_pima_storage_file_system_type; - ULONG ux_host_class_pima_storage_access_capability; + USHORT ux_host_class_pima_storage_type; + USHORT ux_host_class_pima_storage_file_system_type; + USHORT ux_host_class_pima_storage_access_capability; + USHORT _align_max_capacity_low; ULONG ux_host_class_pima_storage_max_capacity_low; ULONG ux_host_class_pima_storage_max_capacity_high; ULONG ux_host_class_pima_storage_free_space_bytes_low; diff --git a/common/usbx_host_classes/inc/ux_host_class_printer.h b/common/usbx_host_classes/inc/ux_host_class_printer.h index 982d263..c8ff5e0 100644 --- a/common/usbx_host_classes/inc/ux_host_class_printer.h +++ b/common/usbx_host_classes/inc/ux_host_class_printer.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_class_printer.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -57,9 +57,9 @@ /* added standalone support, */ /* added a new protocol const, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ +/* 10-31-2023 Yajun xia Modified comment(s), */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ diff --git a/common/usbx_host_classes/inc/ux_host_class_storage.h b/common/usbx_host_classes/inc/ux_host_class_storage.h index c28ccea..215511e 100644 --- a/common/usbx_host_classes/inc/ux_host_class_storage.h +++ b/common/usbx_host_classes/inc/ux_host_class_storage.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_class_storage.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -64,9 +64,9 @@ /* 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 error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ diff --git a/common/usbx_host_classes/inc/ux_host_class_video.h b/common/usbx_host_classes/inc/ux_host_class_video.h index 60164e7..095ecc3 100644 --- a/common/usbx_host_classes/inc/ux_host_class_video.h +++ b/common/usbx_host_classes/inc/ux_host_class_video.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_class_video.h PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -56,10 +56,12 @@ /* according to UVC 1.5 Class */ /* specification, */ /* resulting in version 6.1.8 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* added format and frame data */ +/* fields for H264 support, */ /* optimized USB descriptors, */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ @@ -607,6 +609,7 @@ typedef struct UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA_STRUCT ULONG ux_host_class_video_parameter_format_requested; ULONG ux_host_class_video_parameter_format_subtype; + UCHAR *ux_host_class_video_parameter_format_guid; /* not NULL if GUID is available for the subtype. */ ULONG ux_host_class_video_parameter_number_frame_descriptors; } UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA; @@ -619,7 +622,8 @@ typedef struct UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA_STRUCT ULONG ux_host_class_video_parameter_frame_width; ULONG ux_host_class_video_parameter_frame_height; ULONG ux_host_class_video_parameter_default_frame_interval; - ULONG ux_host_class_video_parameter_frame_interval_type; + ULONG ux_host_class_video_parameter_frame_interval_type; /* 0: continuous {min,max,step}, n: discrete */ + UCHAR *ux_host_class_video_parameter_frame_intervals; /* {dwMin,dwMax,dwStep},... or dw1,dw2,... depending on interval type. */ } UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA; diff --git a/common/usbx_host_classes/src/ux_host_class_asix_activate.c b/common/usbx_host_classes/src/ux_host_class_asix_activate.c index 760b59e..98a3018 100644 --- a/common/usbx_host_classes/src/ux_host_class_asix_activate.c +++ b/common/usbx_host_classes/src/ux_host_class_asix_activate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_asix_activate PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -91,15 +91,18 @@ /* added reception buffer, */ /* removed internal NX pool, */ /* resulting in version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* masked in standalone build, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_asix_activate(UX_HOST_CLASS_COMMAND *command) { -#if NX_PHYSICAL_HEADER < 20 +#if (NX_PHYSICAL_HEADER < 20) || defined(UX_HOST_STANDALONE) UX_PARAMETER_NOT_USED(command); - /* Error trap - function not supported due to NX lib settings. */ + /* Function not supported due to NX lib settings/standalone mode. */ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_FUNCTION_NOT_SUPPORTED); return(UX_FUNCTION_NOT_SUPPORTED); #else diff --git a/common/usbx_host_classes/src/ux_host_class_asix_configure.c b/common/usbx_host_classes/src/ux_host_class_asix_configure.c index 8e32a37..cf5cad0 100644 --- a/common/usbx_host_classes/src/ux_host_class_asix_configure.c +++ b/common/usbx_host_classes/src/ux_host_class_asix_configure.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_asix_configure PORTABLE C */ -/* 6.1 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -74,6 +74,9 @@ /* optimized based on compile */ /* definitions, */ /* resulting in version 6.1 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* removed interface link, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_asix_configure(UX_HOST_CLASS_ASIX *asix) @@ -141,20 +144,6 @@ UX_DEVICE *parent_device; the interrupt endpoint is hooked to it. */ status = _ux_host_stack_configuration_interface_get(configuration, 0, 0, &asix -> ux_host_class_asix_interface); - /* Check status for error. */ - if (status == UX_SUCCESS) - { - - /* Store the instance in the interface container, this is for the USB stack - when it needs to invoke the class. */ - asix -> ux_host_class_asix_interface -> ux_interface_class_instance = (VOID *) asix; - - /* Store the class container in the interface. The device has the correct class, duplicate it to the - interface. */ - asix -> ux_host_class_asix_interface -> ux_interface_class = asix -> ux_host_class_asix_device -> ux_device_class ; - - } - /* Return completion status. */ return(status); } diff --git a/common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c b/common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c index 8054e95..bb91171 100644 --- a/common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c +++ b/common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_asix_transmission_callback PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -81,10 +81,10 @@ /* supported NX packet chain, */ /* fixed empty queue handling, */ /* resulting in version 6.2.0 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* fixed compile warnings, */ /* improved 64-bit support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_host_class_asix_transmission_callback (UX_TRANSFER *transfer_request) diff --git a/common/usbx_host_classes/src/ux_host_class_asix_write.c b/common/usbx_host_classes/src/ux_host_class_asix_write.c index 5ca7a60..ec6d710 100644 --- a/common/usbx_host_classes/src/ux_host_class_asix_write.c +++ b/common/usbx_host_classes/src/ux_host_class_asix_write.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_asix_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -82,10 +82,10 @@ /* added queue modify protect, */ /* improved error check, */ /* resulting in version 6.2.0 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* fixed compile warnings, */ /* improved 64-bit support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_asix_write(VOID *asix_class, NX_PACKET *packet) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_activate.c b/common/usbx_host_classes/src/ux_host_class_audio_activate.c index 7e2d370..23f4113 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_activate.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_activate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_audio_activate PORTABLE C */ -/* 6.1.12 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -88,6 +88,11 @@ /* added feedback support, */ /* refined error handling, */ /* resulting in version 6.1.12 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved AC AS management, */ +/* improved error handling, */ +/* improved descriptors check, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_audio_activate(UX_HOST_CLASS_COMMAND *command) @@ -195,6 +200,11 @@ UINT status; /* In this case, bFirstInterface@2 is AC, followed ASes. */ /* Use bInterfaceCount@3. */ + if (iad[3] <= 1) + { + _ux_utility_memory_free(ac); + return(UX_DESCRIPTOR_CORRUPTED); + } as_count = (ULONG)iad[3] - 1; break; } @@ -204,6 +214,11 @@ UINT status; { /* In this case, bInCollection@7 is AS count. */ + if (desc[7] < 1 || (8 + desc[7]) != desc[0]) + { + _ux_utility_memory_free(ac); + return(UX_DESCRIPTOR_CORRUPTED); + } as_count = (ULONG)uac10_acd[7]; break; } @@ -341,47 +356,58 @@ UINT status; #if defined(UX_HOST_CLASS_AUDIO_INTERRUPT_SUPPORT) - /* Find AC and link them. */ - ac = (UX_HOST_CLASS_AUDIO_AC *)audio -> ux_host_class_audio_class -> ux_host_class_first_instance; - while(ac) + /* Find AC and link it if there is no error. */ + if (status == UX_SUCCESS) { - /* Check interface number to see if it's right AC. */ - if (audio -> ux_host_class_audio_control_interface_number == - ac -> ux_host_class_audio_interface -> ux_interface_descriptor.bInterfaceNumber) + ac = (UX_HOST_CLASS_AUDIO_AC *)audio -> ux_host_class_audio_class -> ux_host_class_first_instance; + while(ac) { - /* Save AS to AC controlled list. */ - for (pos = 0; pos < ac -> ux_host_class_audio_as_count; pos ++) + /* Check interface number to see if it's right AC. */ + if ((ac -> ux_host_class_audio_interface -> ux_interface_configuration == + interface_ptr -> ux_interface_configuration) && + (ac -> ux_host_class_audio_interface -> ux_interface_descriptor.bInterfaceNumber == + audio -> ux_host_class_audio_control_interface_number) && + (ac -> ux_host_class_audio_interface -> ux_interface_descriptor.bInterfaceClass == + UX_HOST_CLASS_AUDIO_CLASS) && + (ac -> ux_host_class_audio_interface -> ux_interface_descriptor.bInterfaceSubClass == + UX_HOST_CLASS_AUDIO_SUBCLASS_CONTROL)) { - if (ac -> ux_host_class_audio_as[pos] == UX_NULL) + + /* Save AS to AC controlled list. */ + for (pos = 0; pos < ac -> ux_host_class_audio_as_count; pos ++) { + if (ac -> ux_host_class_audio_as[pos] == UX_NULL) + { - /* This AC is for current AS. */ - audio -> ux_host_class_audio_ac = ac; - ac -> ux_host_class_audio_as[pos] = audio; + /* This AC is for current AS. */ + audio -> ux_host_class_audio_ac = ac; + audio -> ux_host_class_audio_ac_as = pos; + ac -> ux_host_class_audio_as[pos] = audio; + break; + } + } + + /* If there is no place for AS, something wrong. */ + if (pos >= ac -> ux_host_class_audio_as_count) + { + status = UX_DESCRIPTOR_CORRUPTED; break; } } - /* If there is no place for AS, something wrong. */ - if (pos >= ac -> ux_host_class_audio_as_count) - { - status = UX_DESCRIPTOR_CORRUPTED; + /* If AC is found and linked, done. */ + if (audio -> ux_host_class_audio_ac != UX_NULL) break; - } - } - /* If AC is found and linked, done. */ - if (audio -> ux_host_class_audio_ac != UX_NULL) - break; - - /* If there is error, break. */ - if (status != UX_SUCCESS) - break; + /* If there is error, break. */ + if (status != UX_SUCCESS) + break; - /* Check next AC/AS. */ - ac = (UX_HOST_CLASS_AUDIO_AC *)ac -> ux_host_class_audio_next_instance; + /* Check next AC/AS. */ + ac = (UX_HOST_CLASS_AUDIO_AC *)ac -> ux_host_class_audio_next_instance; + } } #endif @@ -417,6 +443,11 @@ UINT status; /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, status, audio, 0, 0, UX_TRACE_ERRORS, 0, 0) +#if defined(UX_HOST_CLASS_AUDIO_INTERRUPT_SUPPORT) + + /* When there is error, AC is not linked (last possible error), no need to unlink. */ +#endif + /* Error, destroy the class instance. */ _ux_host_stack_class_instance_destroy(audio -> ux_host_class_audio_class, (VOID *) audio); diff --git a/common/usbx_host_classes/src/ux_host_class_audio_control_get.c b/common/usbx_host_classes/src/ux_host_class_audio_control_get.c index 64eaee7..a2fde91 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_control_get.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_control_get.c @@ -358,7 +358,7 @@ UCHAR * control_buffer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_control_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -388,7 +388,7 @@ UCHAR * control_buffer; /* */ /* 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_class_audio_control_get(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_control_request.c b/common/usbx_host_classes/src/ux_host_class_audio_control_request.c index 0f9ecf9..8c8bd0d 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_control_request.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_control_request.c @@ -174,7 +174,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_control_request PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -217,7 +217,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_class_audio_control_request(UX_HOST_CLASS_AUDIO *audio, diff --git a/common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c b/common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c index a2059e1..bfed2bd 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c @@ -208,7 +208,7 @@ UCHAR * control_buffer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_control_value_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -240,7 +240,7 @@ UCHAR * control_buffer; /* */ /* 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_class_audio_control_value_get(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c b/common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c index 97c4ffb..084d906 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c @@ -270,7 +270,7 @@ UCHAR * control_buffer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_control_value_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -302,7 +302,7 @@ UCHAR * control_buffer; /* */ /* 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_class_audio_control_value_set(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_deactivate.c b/common/usbx_host_classes/src/ux_host_class_audio_deactivate.c index 2cfd15d..a035c87 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_deactivate.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_deactivate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_audio_deactivate PORTABLE C */ -/* 6.1.12 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -81,6 +81,9 @@ /* protect reentry with mutex, */ /* added feedback support, */ /* resulting in version 6.1.12 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved AC AS management, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_audio_deactivate(UX_HOST_CLASS_COMMAND *command) @@ -89,6 +92,7 @@ UINT _ux_host_class_audio_deactivate(UX_HOST_CLASS_COMMAND *command) UX_HOST_CLASS_AUDIO *audio; #if defined(UX_HOST_CLASS_AUDIO_INTERRUPT_SUPPORT) UX_HOST_CLASS_AUDIO_AC *ac; +UINT i; #endif /* Get the instance for this class. */ @@ -109,7 +113,14 @@ UX_HOST_CLASS_AUDIO_AC *ac; /* The enumeration thread needs to sleep a while to allow the application or the class that may be using endpoints to exit properly. */ - _ux_host_thread_schedule_other(UX_THREAD_PRIORITY_ENUM); + _ux_host_thread_schedule_other(UX_THREAD_PRIORITY_ENUM); + + /* Clear the links in AS interfaces. */ + for (i = 0; i < ac -> ux_host_class_audio_as_count; i++) + { + if (ac -> ux_host_class_audio_as[i]) + ac -> ux_host_class_audio_as[i] -> ux_host_class_audio_ac = UX_NULL; + } /* Destroy the instance. */ _ux_host_stack_class_instance_destroy(audio -> ux_host_class_audio_class, (VOID *) audio); @@ -139,6 +150,14 @@ UX_HOST_CLASS_AUDIO_AC *ac; endpoints to exit properly. */ _ux_host_thread_schedule_other(UX_THREAD_PRIORITY_ENUM); +#if defined(UX_HOST_CLASS_AUDIO_INTERRUPT_SUPPORT) + + /* Clear the links in AC interface. */ + ac = audio -> ux_host_class_audio_ac; + if (ac) + ac -> ux_host_class_audio_as[audio -> ux_host_class_audio_ac_as] = UX_NULL; +#endif + /* Destroy the instance. */ _ux_host_stack_class_instance_destroy(audio -> ux_host_class_audio_class, (VOID *) audio); diff --git a/common/usbx_host_classes/src/ux_host_class_audio_descriptors_parse.c b/common/usbx_host_classes/src/ux_host_class_audio_descriptors_parse.c index 0170b31..800a153 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_descriptors_parse.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_descriptors_parse.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_audio_descriptors_parse PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,8 +79,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 07-29-2022 Chaoqiong Xiao Initial Version 6.1.12 */ -/* 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_class_audio_descriptors_parse(UX_HOST_CLASS_AUDIO *audio, @@ -213,7 +213,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_descriptors_parse PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -247,7 +247,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_class_audio_descriptors_parse(UX_HOST_CLASS_AUDIO *audio, diff --git a/common/usbx_host_classes/src/ux_host_class_audio_device_type_get.c b/common/usbx_host_classes/src/ux_host_class_audio_device_type_get.c index c0fe1af..b23b3e5 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_device_type_get.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_device_type_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_audio_device_type_get PORTABLE C */ -/* 6.1.12 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -71,6 +71,9 @@ /* removed protocol store, */ /* added audio 2.0 support, */ /* resulting in version 6.1.12 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved descriptors check, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_audio_device_type_get(UX_HOST_CLASS_AUDIO *audio) @@ -146,21 +149,22 @@ UINT i; /* Ensure we have the correct interface for Audio Control. */ if ((descriptor[5] == UX_HOST_CLASS_AUDIO_CLASS) && (descriptor[6] == UX_HOST_CLASS_AUDIO_SUBCLASS_CONTROL)) + { interface_descriptor = descriptor; + + /* Check if interface is out of IAD. */ + if(iad) + { + if ((iad[2] > interface_descriptor[2]) || + (iad[2] + iad[3] <= interface_descriptor[2])) + iad = UX_NULL; + } + } else { interface_descriptor = UX_NULL; descriptor_found = UX_FALSE; - } - - /* Check IAD. */ - if (iad) - { - - /* Check if interface is out of IAD. */ - if ((iad[2] > interface_descriptor[2]) || - (iad[2] + iad[3] <= interface_descriptor[2])) - iad = UX_NULL; + iad = UX_NULL; } break; diff --git a/common/usbx_host_classes/src/ux_host_class_audio_entity_control_get.c b/common/usbx_host_classes/src/ux_host_class_audio_entity_control_get.c index a17eb54..91a1c69 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_entity_control_get.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_entity_control_get.c @@ -341,7 +341,7 @@ ULONG n_subs, sub, pos, min, max, res, size; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_entity_control_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -373,7 +373,7 @@ ULONG n_subs, sub, pos, min, max, res, size; /* */ /* 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_class_audio_entity_control_get(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_entity_control_value_get.c b/common/usbx_host_classes/src/ux_host_class_audio_entity_control_value_get.c index 948a3f4..c5b880e 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_entity_control_value_get.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_entity_control_value_get.c @@ -158,7 +158,7 @@ ULONG actual_size; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_entity_control_value_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -190,7 +190,7 @@ ULONG actual_size; /* */ /* 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_class_audio_entity_control_value_get(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_entity_control_value_set.c b/common/usbx_host_classes/src/ux_host_class_audio_entity_control_value_set.c index 16e9088..f080d07 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_entity_control_value_set.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_entity_control_value_set.c @@ -148,7 +148,7 @@ ULONG actual_size; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_entity_control_value_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -180,7 +180,7 @@ ULONG actual_size; /* */ /* 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_class_audio_entity_control_value_set(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_feedback_get.c b/common/usbx_host_classes/src/ux_host_class_audio_feedback_get.c index 2b5bea1..8afc310 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_feedback_get.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_feedback_get.c @@ -105,7 +105,7 @@ UINT _ux_host_class_audio_feedback_get(UX_HOST_CLASS_AUDIO *audio, UCHAR *feedb /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_feedback_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -136,7 +136,7 @@ UINT _ux_host_class_audio_feedback_get(UX_HOST_CLASS_AUDIO *audio, UCHAR *feedb /* */ /* 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_class_audio_feedback_get(UX_HOST_CLASS_AUDIO *audio, UCHAR *feedback) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_feedback_set.c b/common/usbx_host_classes/src/ux_host_class_audio_feedback_set.c index 69eb990..f55c560 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_feedback_set.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_feedback_set.c @@ -122,7 +122,7 @@ UX_TRANSFER *transfer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_feedback_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -153,7 +153,7 @@ UX_TRANSFER *transfer; /* */ /* 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_class_audio_feedback_set(UX_HOST_CLASS_AUDIO *audio, UCHAR *feedback) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_interrupt_start.c b/common/usbx_host_classes/src/ux_host_class_audio_interrupt_start.c index ddeb6c3..5eb74a8 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_interrupt_start.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_interrupt_start.c @@ -145,7 +145,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_interrupt_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -179,7 +179,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_class_audio_interrupt_start(UX_HOST_CLASS_AUDIO_AC *audio, diff --git a/common/usbx_host_classes/src/ux_host_class_audio_raw_sampling_parse.c b/common/usbx_host_classes/src/ux_host_class_audio_raw_sampling_parse.c index 94d793a..acc4611 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_raw_sampling_parse.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_raw_sampling_parse.c @@ -752,7 +752,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_raw_sampling_parse PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -788,7 +788,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_class_audio_raw_sampling_parse(UX_HOST_CLASS_AUDIO *audio, diff --git a/common/usbx_host_classes/src/ux_host_class_audio_read.c b/common/usbx_host_classes/src/ux_host_class_audio_read.c index b7654b9..739e82f 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_read.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_read.c @@ -155,7 +155,7 @@ ULONG mps; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -185,7 +185,7 @@ ULONG mps; /* */ /* 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_class_audio_read(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_TRANSFER_REQUEST *audio_transfer_request) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_stop.c b/common/usbx_host_classes/src/ux_host_class_audio_stop.c index 5c33ffa..54d7b2d 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_stop.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_stop.c @@ -174,7 +174,7 @@ UINT streaming_interface; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_stop PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -203,7 +203,7 @@ UINT streaming_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_class_audio_stop(UX_HOST_CLASS_AUDIO *audio) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c b/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c index 5c9c1af..6e8ebe2 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c @@ -410,7 +410,7 @@ UINT previous_match_found; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_streaming_sampling_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -442,7 +442,7 @@ UINT previous_match_found; /* */ /* 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_class_audio_streaming_sampling_get(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_SAMPLING_CHARACTERISTICS *audio_sampling) 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 c7731b8..f734f02 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 @@ -393,7 +393,7 @@ ULONG res_bytes; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_streaming_sampling_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -425,7 +425,7 @@ ULONG res_bytes; /* */ /* 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_class_audio_streaming_sampling_set(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_SAMPLING *audio_sampling) diff --git a/common/usbx_host_classes/src/ux_host_class_audio_write.c b/common/usbx_host_classes/src/ux_host_class_audio_write.c index f2724f8..5fd94e2 100644 --- a/common/usbx_host_classes/src/ux_host_class_audio_write.c +++ b/common/usbx_host_classes/src/ux_host_class_audio_write.c @@ -151,7 +151,7 @@ ULONG mps; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_audio_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -181,7 +181,7 @@ ULONG mps; /* */ /* 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_class_audio_write(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_TRANSFER_REQUEST *audio_transfer_request) diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_activate.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_activate.c index 83dc55c..4131167 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_activate.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_activate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_cdc_acm_activate PORTABLE C */ -/* 6.1.12 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -87,6 +87,9 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved control searching, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_cdc_acm_activate(UX_HOST_CLASS_COMMAND *command) @@ -214,14 +217,15 @@ UX_HOST_CLASS_CDC_ACM_LINE_STATE line_state; while(cdc_acm_inst) { - /* If this data interface is inside the associate list, link it. */ - if (cdc_acm_inst -> ux_host_class_cdc_acm_interfaces_bitmap & - (1ul << interface_ptr -> ux_interface_descriptor.bInterfaceNumber)) + /* If this data interface is on the same device and inside the associate list, link it. */ + if ((cdc_acm_inst -> ux_host_class_cdc_acm_device == + cdc_acm -> ux_host_class_cdc_acm_device) && + (cdc_acm_inst -> ux_host_class_cdc_acm_interfaces_bitmap & + (1ul << interface_ptr -> ux_interface_descriptor.bInterfaceNumber))) { - /* Save control instance and we are done. */ + /* Save control instance. */ cdc_acm -> ux_host_class_cdc_acm_control = cdc_acm_inst; - break; } /* Next instance. */ diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_command.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_command.c index ac077b7..76f466d 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_command.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_command.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_cdc_acm_command PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -82,8 +82,8 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_cdc_acm_command(UX_HOST_CLASS_CDC_ACM *cdc_acm, ULONG command, @@ -218,7 +218,7 @@ ULONG request_direction; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_cdc_acm_command PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -253,7 +253,7 @@ ULONG request_direction; /* */ /* 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_class_cdc_acm_command(UX_HOST_CLASS_CDC_ACM *cdc_acm, ULONG command, diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_deactivate.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_deactivate.c index 8663547..b61411c 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_deactivate.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_deactivate.c @@ -87,6 +87,8 @@ UX_HOST_CLASS_CDC_ACM *cdc_acm; UX_TRANSFER *transfer_request; #if !defined(UX_HOST_STANDALONE) UINT status; +#else +UX_HOST_CLASS_CDC_ACM *cdc_acm_inst; #endif /* Get the instance for this class. */ @@ -120,6 +122,27 @@ UINT status; /* Free data buffer for the interrupt transfer. */ _ux_utility_memory_free(transfer_request -> ux_transfer_request_data_pointer); } + +#if defined(UX_HOST_STANDALONE) + + /* Linked from data instance must be removed then. */ + /* We scan CDC ACM instances to find the master instance. */ + /* Get first instance linked to the class. */ + cdc_acm_inst = (UX_HOST_CLASS_CDC_ACM *) cdc_acm -> + ux_host_class_cdc_acm_class -> ux_host_class_first_instance; + + /* Scan all instances. */ + while(cdc_acm_inst) + { + + /* If this data interface is linking to the control instance, unlink it. */ + if (cdc_acm_inst -> ux_host_class_cdc_acm_control == cdc_acm) + cdc_acm_inst -> ux_host_class_cdc_acm_control = UX_NULL; + + /* Next instance. */ + cdc_acm_inst = cdc_acm_inst -> ux_host_class_cdc_acm_next_instance; + } +#endif } else { diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c index 8a99c7a..724d117 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_cdc_acm_endpoints_get PORTABLE C */ -/* 6.1.11 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,6 +79,9 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* checked endpoint get status,*/ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_cdc_acm_endpoints_get(UX_HOST_CLASS_CDC_ACM *cdc_acm) @@ -100,7 +103,11 @@ UX_TRANSFER *transfer_request; { /* Get interface endpoint. */ - _ux_host_stack_interface_endpoint_get(cdc_acm -> ux_host_class_cdc_acm_interface, endpoint_index, &endpoint); + status = _ux_host_stack_interface_endpoint_get(cdc_acm -> ux_host_class_cdc_acm_interface, endpoint_index, &endpoint); + + /* Check status. */ + if (status != UX_SUCCESS) + continue; /* Check if endpoint is bulk and OUT. */ if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_OUT) && @@ -163,7 +170,11 @@ UX_TRANSFER *transfer_request; { /* Get the endpoint handle. */ - _ux_host_stack_interface_endpoint_get(cdc_acm -> ux_host_class_cdc_acm_interface, endpoint_index, &endpoint); + status = _ux_host_stack_interface_endpoint_get(cdc_acm -> ux_host_class_cdc_acm_interface, endpoint_index, &endpoint); + + /* Check status. */ + if (status != UX_SUCCESS) + continue; /* Check if endpoint is Interrupt and IN. */ if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_IN) && diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_entry.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_entry.c index e126dec..4a2a90a 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_entry.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_entry.c @@ -492,6 +492,7 @@ ULONG tick, diff; if (cdc_acm -> ux_host_class_cdc_acm_status == UX_SUCCESS) { + /* We are here only if it's control interface. */ /* We scan CDC ACM instances to find the DATA instance. */ /* Get class. */ cdc_acm_class = cdc_acm -> ux_host_class_cdc_acm_class; @@ -499,21 +500,22 @@ ULONG tick, diff; /* Get first instance linked to the class. */ cdc_acm_inst = (UX_HOST_CLASS_CDC_ACM *)cdc_acm_class -> ux_host_class_first_instance; - /* Scan all instances. */ + /* Scan all data instances to update control links. */ while(cdc_acm_inst) { /* Get interface of the instance. */ interface_ptr = cdc_acm_inst -> ux_host_class_cdc_acm_interface; - /* If this data interface is inside the associate list, link it. */ - if (cdc_acm -> ux_host_class_cdc_acm_interfaces_bitmap & - (1ul << interface_ptr -> ux_interface_descriptor.bInterfaceNumber)) + /* If this data interface is inside the associate list on the same device, link it. */ + if ((cdc_acm_inst -> ux_host_class_cdc_acm_device == + cdc_acm -> ux_host_class_cdc_acm_device) && + (cdc_acm -> ux_host_class_cdc_acm_interfaces_bitmap & + (1ul << interface_ptr -> ux_interface_descriptor.bInterfaceNumber))) { - /* Save control instance and we are done. */ + /* Link this control to the data instance. */ cdc_acm_inst -> ux_host_class_cdc_acm_control = cdc_acm; - break; } /* Next instance. */ diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_ioctl.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_ioctl.c index 78fa6ce..2dd98a4 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_ioctl.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_ioctl.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_cdc_acm_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,8 +79,8 @@ /* 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), */ -/* resulting in version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_cdc_acm_ioctl(UX_HOST_CLASS_CDC_ACM *cdc_acm, ULONG ioctl_function, @@ -348,7 +348,7 @@ UX_TRANSFER *transfer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_cdc_acm_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -379,7 +379,7 @@ UX_TRANSFER *transfer; /* */ /* 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_class_cdc_acm_ioctl(UX_HOST_CLASS_CDC_ACM *cdc_acm, ULONG ioctl_function, diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_read.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_read.c index 4bb0c5c..619b563 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_read.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_read.c @@ -238,7 +238,7 @@ ULONG transfer_flags; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_cdc_acm_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -270,7 +270,7 @@ ULONG transfer_flags; /* */ /* 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_class_cdc_acm_read (UX_HOST_CLASS_CDC_ACM *cdc_acm, UCHAR *data_pointer, diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_reception_start.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_reception_start.c index 547176a..98e7823 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_reception_start.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_reception_start.c @@ -148,7 +148,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_cdc_acm_reception_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -179,7 +179,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_class_cdc_acm_reception_start (UX_HOST_CLASS_CDC_ACM *cdc_acm, diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_reception_stop.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_reception_stop.c index 7030a40..477d916 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_reception_stop.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_reception_stop.c @@ -146,7 +146,7 @@ UX_TRANSFER *transfer_request; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_cdc_acm_reception_stop PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -176,7 +176,7 @@ UX_TRANSFER *transfer_request; /* */ /* 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_class_cdc_acm_reception_stop(UX_HOST_CLASS_CDC_ACM *cdc_acm, diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_write.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_write.c index 5bf47e7..23656fb 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_write.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_write.c @@ -254,7 +254,7 @@ ULONG transfer_flags; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_cdc_acm_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -286,7 +286,7 @@ ULONG transfer_flags; /* */ /* 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_class_cdc_acm_write(UX_HOST_CLASS_CDC_ACM *cdc_acm, UCHAR *data_pointer, diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_write_with_callback.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_write_with_callback.c index a9dfa11..8019c88 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_write_with_callback.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_write_with_callback.c @@ -167,7 +167,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_cdc_acm_write_with_callback PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -199,7 +199,7 @@ ULONG transfer_request_length; /* */ /* 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_class_cdc_acm_write_with_callback(UX_HOST_CLASS_CDC_ACM *cdc_acm, diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c index f261331..119d291 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c @@ -104,6 +104,10 @@ UX_HOST_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_ASSERT /* deprecated ECM pool option, */ /* supported NX packet chain, */ /* resulting in version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* rejected the CDC ECM data */ +/* interface not next to ctrl, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_cdc_ecm_activate(UX_HOST_CLASS_COMMAND *command) @@ -163,8 +167,13 @@ UX_INTERFACE *cur_interface; if (cur_interface -> ux_interface_descriptor.bInterfaceClass == UX_HOST_CLASS_CDC_CONTROL_CLASS) { - /* Save it. */ - control_interface = cur_interface; + /* Is this the right one before current interface? */ + if (cur_interface -> ux_interface_next_interface == interface_ptr) + { + + /* Save it. */ + control_interface = cur_interface; + } } /* Advance current interface. */ diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_endpoints_get.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_endpoints_get.c index 81ece89..59e24b1 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_endpoints_get.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_endpoints_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_cdc_ecm_endpoints_get PORTABLE C */ -/* 6.1.9 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -73,6 +73,9 @@ /* use pre-calculated value */ /* instead of wMaxPacketSize, */ /* resulting in version 6.1.9 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* checked endpoint get status,*/ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_cdc_ecm_endpoints_get(UX_HOST_CLASS_CDC_ECM *cdc_ecm) @@ -131,7 +134,11 @@ UX_INTERFACE *data_interface; { /* Get interface endpoint. */ - _ux_host_stack_interface_endpoint_get(data_interface, endpoint_index, &endpoint); + status = _ux_host_stack_interface_endpoint_get(data_interface, endpoint_index, &endpoint); + + /* Check status. */ + if (status != UX_SUCCESS) + continue; /* Check if endpoint is bulk and OUT. */ if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_OUT) && @@ -173,7 +180,11 @@ UX_INTERFACE *data_interface; { /* Get the endpoint handle. */ - _ux_host_stack_interface_endpoint_get(data_interface, endpoint_index, &endpoint); + status = _ux_host_stack_interface_endpoint_get(data_interface, endpoint_index, &endpoint); + + /* Check status. */ + if (status != UX_SUCCESS) + continue; /* Check if endpoint is bulk and IN. */ if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_IN) && @@ -217,7 +228,11 @@ UX_INTERFACE *data_interface; { /* Get the endpoint handle. */ - _ux_host_stack_interface_endpoint_get(cdc_ecm -> ux_host_class_cdc_ecm_interface_control, endpoint_index, &endpoint); + status = _ux_host_stack_interface_endpoint_get(cdc_ecm -> ux_host_class_cdc_ecm_interface_control, endpoint_index, &endpoint); + + /* Check status. */ + if (status != UX_SUCCESS) + continue; /* Check if endpoint is Interrupt and IN. */ if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_IN) && diff --git a/common/usbx_host_classes/src/ux_host_class_gser_activate.c b/common/usbx_host_classes/src/ux_host_class_gser_activate.c index 1615a8f..f619452 100644 --- a/common/usbx_host_classes/src/ux_host_class_gser_activate.c +++ b/common/usbx_host_classes/src/ux_host_class_gser_activate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_gser_activate PORTABLE C */ -/* 6.1.11 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -75,6 +75,9 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved error handling, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_gser_activate(UX_HOST_CLASS_COMMAND *command) @@ -83,6 +86,7 @@ UINT _ux_host_class_gser_activate(UX_HOST_CLASS_COMMAND *command) UX_DEVICE *device; UX_HOST_CLASS_GSER *gser; UINT status; +ULONG interface_index; /* The Generic Modem class is always activated by the device descriptor. */ @@ -139,6 +143,13 @@ UINT status; return(UX_SUCCESS); } + /* Free created resources. */ + for (interface_index = 0; interface_index < UX_HOST_CLASS_GSER_INTERFACE_NUMBER; interface_index ++) + { + if (_ux_host_semaphore_created(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore)) + _ux_host_semaphore_delete(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore); + } + /* Destroy class instance. */ _ux_host_stack_class_instance_destroy(gser -> ux_host_class_gser_class, (VOID *) gser); diff --git a/common/usbx_host_classes/src/ux_host_class_gser_command.c b/common/usbx_host_classes/src/ux_host_class_gser_command.c index 361dca0..ba51435 100644 --- a/common/usbx_host_classes/src/ux_host_class_gser_command.c +++ b/common/usbx_host_classes/src/ux_host_class_gser_command.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_gser_command PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -82,8 +82,8 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* refined macros names, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_gser_command(UX_HOST_CLASS_GSER *gser, ULONG interface_index, ULONG command, @@ -174,7 +174,7 @@ ULONG request_direction; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_gser_command PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -208,7 +208,7 @@ ULONG request_direction; /* */ /* 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_class_gser_command(UX_HOST_CLASS_GSER *gser, ULONG interface_index, ULONG command, diff --git a/common/usbx_host_classes/src/ux_host_class_gser_configure.c b/common/usbx_host_classes/src/ux_host_class_gser_configure.c index 1455e59..c345d37 100644 --- a/common/usbx_host_classes/src/ux_host_class_gser_configure.c +++ b/common/usbx_host_classes/src/ux_host_class_gser_configure.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_gser_configure PORTABLE C */ -/* 6.1.10 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -77,6 +77,9 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* refined macros names, */ /* resulting in version 6.1.10 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* removed interface link, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_gser_configure(UX_HOST_CLASS_GSER *gser) @@ -147,29 +150,19 @@ UX_DEVICE *parent_device; /* Get that interface. */ status = _ux_host_stack_configuration_interface_get(configuration, interface_index, 0, &gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_interface); - - /* Should not fail. But do a sanity check. */ - if (status == UX_SUCCESS) - { - - /* Store the instance in the interface container, this is for the USB stack - when it needs to invoke the class. */ - gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_interface -> ux_interface_class_instance = (VOID *) gser; - - /* Store the class container in the interface. The device has the correct class, duplicate it to the - interface. */ - gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_interface -> ux_interface_class = gser -> ux_host_class_gser_device -> ux_device_class ; - /* Create the semaphore to protect 2 threads from accessing the same gser instance. */ - status = _ux_host_semaphore_create(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore, "ux_host_class_gser_semaphore", 1); + /* If any of interface expected not exist, reject the device. */ + if (status != UX_SUCCESS) + return(status); - /* Check status. */ - if (status != UX_SUCCESS) - return(UX_SEMAPHORE_ERROR); + /* Create the semaphore to protect 2 threads from accessing the same gser instance. */ + status = _ux_host_semaphore_create(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore, "ux_host_class_gser_semaphore", 1); - } + /* Check status. */ + if (status != UX_SUCCESS) + return(UX_SEMAPHORE_ERROR); } - + /* Return completion status. */ return(UX_SUCCESS); } diff --git a/common/usbx_host_classes/src/ux_host_class_gser_ioctl.c b/common/usbx_host_classes/src/ux_host_class_gser_ioctl.c index 410ca2b..a705542 100644 --- a/common/usbx_host_classes/src/ux_host_class_gser_ioctl.c +++ b/common/usbx_host_classes/src/ux_host_class_gser_ioctl.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_gser_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -76,8 +76,8 @@ /* 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 Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_gser_ioctl(UX_HOST_CLASS_GSER *gser, ULONG interface_index, ULONG ioctl_function, @@ -295,7 +295,7 @@ ULONG value; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_gser_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -326,7 +326,7 @@ ULONG value; /* */ /* 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_class_gser_ioctl(UX_HOST_CLASS_GSER *gser, ULONG interface_index, ULONG ioctl_function, diff --git a/common/usbx_host_classes/src/ux_host_class_gser_read.c b/common/usbx_host_classes/src/ux_host_class_gser_read.c index f1bba72..18ab0e9 100644 --- a/common/usbx_host_classes/src/ux_host_class_gser_read.c +++ b/common/usbx_host_classes/src/ux_host_class_gser_read.c @@ -223,7 +223,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_gser_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -255,7 +255,7 @@ ULONG transfer_request_length; /* */ /* 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_class_gser_read(UX_HOST_CLASS_GSER *gser, diff --git a/common/usbx_host_classes/src/ux_host_class_gser_reception_start.c b/common/usbx_host_classes/src/ux_host_class_gser_reception_start.c index bdd8150..7cf5aae 100644 --- a/common/usbx_host_classes/src/ux_host_class_gser_reception_start.c +++ b/common/usbx_host_classes/src/ux_host_class_gser_reception_start.c @@ -141,7 +141,7 @@ ULONG interface_index; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_gser_reception_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -172,7 +172,7 @@ ULONG interface_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_class_gser_reception_start (UX_HOST_CLASS_GSER *gser, diff --git a/common/usbx_host_classes/src/ux_host_class_gser_reception_stop.c b/common/usbx_host_classes/src/ux_host_class_gser_reception_stop.c index c5d8ecc..976d74b 100644 --- a/common/usbx_host_classes/src/ux_host_class_gser_reception_stop.c +++ b/common/usbx_host_classes/src/ux_host_class_gser_reception_stop.c @@ -117,7 +117,7 @@ ULONG interface_index; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_gser_reception_stop PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -147,7 +147,7 @@ ULONG interface_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_class_gser_reception_stop (UX_HOST_CLASS_GSER *gser, diff --git a/common/usbx_host_classes/src/ux_host_class_gser_write.c b/common/usbx_host_classes/src/ux_host_class_gser_write.c index d2b4e4a..dc6efd2 100644 --- a/common/usbx_host_classes/src/ux_host_class_gser_write.c +++ b/common/usbx_host_classes/src/ux_host_class_gser_write.c @@ -217,7 +217,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_gser_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -249,7 +249,7 @@ ULONG transfer_request_length; /* */ /* 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_class_gser_write(UX_HOST_CLASS_GSER *gser, diff --git a/common/usbx_host_classes/src/ux_host_class_hid_client_register.c b/common/usbx_host_classes/src/ux_host_class_hid_client_register.c index 3497abe..11deb1e 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_client_register.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_client_register.c @@ -194,7 +194,7 @@ UINT client_name_length = 0; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_client_register PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -224,7 +224,7 @@ UINT client_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_class_hid_client_register(UCHAR *hid_client_name, diff --git a/common/usbx_host_classes/src/ux_host_class_hid_field_decompress.c b/common/usbx_host_classes/src/ux_host_class_hid_field_decompress.c index afb7287..e1b1d89 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_field_decompress.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_field_decompress.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hid_field_decompress PORTABLE C */ -/* 6.1 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -69,6 +69,9 @@ /* 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 Chaoqiong Xiao Modified comment(s), */ +/* improved usage handling, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_hid_field_decompress(UX_HOST_CLASS_HID_FIELD *hid_field, UCHAR *report_buffer, UX_HOST_CLASS_HID_CLIENT_REPORT *client_report) @@ -130,8 +133,11 @@ ULONG report_content; if (hid_field -> ux_host_class_hid_field_value & UX_HOST_CLASS_HID_ITEM_VARIABLE) { - /* Take the usage directly from the usage array. */ - field_usage = *(hid_field -> ux_host_class_hid_field_usages + field_report_count); + /* Take the usage directly from the usage array (if specified). */ + if (hid_field -> ux_host_class_hid_field_usages) + field_usage = *(hid_field -> ux_host_class_hid_field_usages + field_report_count); + else + field_usage = 0; } else { diff --git a/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c b/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c index d748966..7f38d0c 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c @@ -215,7 +215,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_report_idle_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -246,7 +246,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_class_hid_idle_get(UX_HOST_CLASS_HID *hid, USHORT *idle_time, USHORT report_id) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_idle_set.c b/common/usbx_host_classes/src/ux_host_class_hid_idle_set.c index 64662fb..2a5a8a8 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_idle_set.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_idle_set.c @@ -155,7 +155,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_idle_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -186,7 +186,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_class_hid_idle_set(UX_HOST_CLASS_HID *hid, USHORT idle_time, USHORT report_id) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_idle_set_run.c b/common/usbx_host_classes/src/ux_host_class_hid_idle_set_run.c index 3c5d9aa..b55b04c 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_idle_set_run.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_idle_set_run.c @@ -184,7 +184,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_idle_set_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -215,7 +215,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_class_hid_idle_set_run(UX_HOST_CLASS_HID *hid, USHORT idle_time, USHORT report_id) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c index afd243d..f38831b 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hid_keyboard_deactivate PORTABLE C */ -/* 6.1.11 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -78,6 +78,9 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved unload sequence, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_hid_keyboard_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command) @@ -108,23 +111,11 @@ UINT status = UX_SUCCESS; /* Terminate the thread. */ _ux_utility_thread_delete(&keyboard_instance -> ux_host_class_hid_keyboard_thread); - - /* Return to the pool the thread stack. */ - _ux_utility_memory_free(keyboard_instance -> ux_host_class_hid_keyboard_thread_stack); #endif - /* Free memory for key states. */ - _ux_utility_memory_free(keyboard_instance -> ux_host_class_hid_keyboard_key_state); - /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_HID_KEYBOARD_DEACTIVATE, hid, keyboard_instance, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0) - /* Unload all the memory used by the keyboard client. */ - _ux_utility_memory_free(keyboard_instance -> ux_host_class_hid_keyboard_usage_array); - - /* Now free the instance memory. */ - _ux_utility_memory_free(hid_client -> ux_host_class_hid_client_local_instance); - /* We may need to inform the application if a function has been programmed in the system structure. */ if (_ux_system_host -> ux_system_host_change_function != UX_NULL) @@ -133,7 +124,22 @@ UINT status = UX_SUCCESS; /* Call system change function. */ _ux_system_host -> ux_system_host_change_function(UX_HID_CLIENT_REMOVAL, hid -> ux_host_class_hid_class, (VOID *) hid_client); } - + +#if !defined(UX_HOST_STANDALONE) + + /* Return to the pool the thread stack. */ + _ux_utility_memory_free(keyboard_instance -> ux_host_class_hid_keyboard_thread_stack); +#endif + + /* Free memory for key states. */ + _ux_utility_memory_free(keyboard_instance -> ux_host_class_hid_keyboard_key_state); + + /* Unload all the memory used by the keyboard client. */ + _ux_utility_memory_free(keyboard_instance -> ux_host_class_hid_keyboard_usage_array); + + /* Now free the instance memory. */ + _ux_utility_memory_free(hid_client -> ux_host_class_hid_client_local_instance); + /* Return completion status. */ return(status); } diff --git a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_ioctl.c b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_ioctl.c index 47f532c..afd6613 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_ioctl.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_ioctl.c @@ -129,7 +129,7 @@ UINT status = UX_SUCCESS; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_keyboard_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -160,7 +160,7 @@ UINT status = UX_SUCCESS; /* */ /* 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_class_hid_keyboard_ioctl(UX_HOST_CLASS_HID_KEYBOARD *keyboard_instance, diff --git a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_key_get.c b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_key_get.c index 3e18fea..6bbfe17 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_key_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_key_get.c @@ -128,7 +128,7 @@ UX_HOST_CLASS_HID *hid; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_keyboard_key_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -159,7 +159,7 @@ UX_HOST_CLASS_HID *hid; /* */ /* 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_class_hid_keyboard_key_get(UX_HOST_CLASS_HID_KEYBOARD *keyboard_instance, diff --git a/common/usbx_host_classes/src/ux_host_class_hid_mouse_buttons_get.c b/common/usbx_host_classes/src/ux_host_class_hid_mouse_buttons_get.c index d6cdc14..6703951 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_mouse_buttons_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_mouse_buttons_get.c @@ -105,7 +105,7 @@ UX_HOST_CLASS_HID *hid; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_mouse_buttons_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -135,7 +135,7 @@ UX_HOST_CLASS_HID *hid; /* */ /* 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_class_hid_mouse_buttons_get(UX_HOST_CLASS_HID_MOUSE *mouse_instance, diff --git a/common/usbx_host_classes/src/ux_host_class_hid_mouse_deactivate.c b/common/usbx_host_classes/src/ux_host_class_hid_mouse_deactivate.c index c7cf7db..5f61106 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_mouse_deactivate.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_mouse_deactivate.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hid_mouse_deactivate PORTABLE C */ -/* 6.1 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,6 +70,9 @@ /* 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 Chaoqiong Xiao Modified comment(s), */ +/* improved unload sequence, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_hid_mouse_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command) @@ -92,9 +95,6 @@ UINT status; /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_HID_MOUSE_DEACTIVATE, hid, hid_client -> ux_host_class_hid_client_local_instance, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0) - /* Now free the instance memory. */ - _ux_utility_memory_free(hid_client -> ux_host_class_hid_client_local_instance); - /* We may need to inform the application if a function has been programmed in the system structure. */ if (_ux_system_host -> ux_system_host_change_function != UX_NULL) @@ -104,6 +104,9 @@ UINT status; _ux_system_host -> ux_system_host_change_function(UX_HID_CLIENT_REMOVAL, hid -> ux_host_class_hid_class, (VOID *) hid_client); } + /* Now free the instance memory. */ + _ux_utility_memory_free(hid_client -> ux_host_class_hid_client_local_instance); + /* Return completion status. */ return(status); } diff --git a/common/usbx_host_classes/src/ux_host_class_hid_mouse_position_get.c b/common/usbx_host_classes/src/ux_host_class_hid_mouse_position_get.c index 3c4425f..6031ac2 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_mouse_position_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_mouse_position_get.c @@ -111,7 +111,7 @@ UX_HOST_CLASS_HID *hid; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_mouse_position_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -142,7 +142,7 @@ UX_HOST_CLASS_HID *hid; /* */ /* 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_class_hid_mouse_position_get(UX_HOST_CLASS_HID_MOUSE *mouse_instance, diff --git a/common/usbx_host_classes/src/ux_host_class_hid_mouse_wheel_get.c b/common/usbx_host_classes/src/ux_host_class_hid_mouse_wheel_get.c index 5826a61..7b5020e 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_mouse_wheel_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_mouse_wheel_get.c @@ -105,7 +105,7 @@ UX_HOST_CLASS_HID *hid; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_mouse_wheel_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -135,7 +135,7 @@ UX_HOST_CLASS_HID *hid; /* */ /* 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_class_hid_mouse_wheel_get(UX_HOST_CLASS_HID_MOUSE *mouse_instance, diff --git a/common/usbx_host_classes/src/ux_host_class_hid_periodic_report_start.c b/common/usbx_host_classes/src/ux_host_class_hid_periodic_report_start.c index 8b5465d..2d32299 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_periodic_report_start.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_periodic_report_start.c @@ -142,7 +142,7 @@ UX_TRANSFER *transfer_request; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_periodic_report_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -173,7 +173,7 @@ UX_TRANSFER *transfer_request; /* */ /* 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_class_hid_periodic_report_start(UX_HOST_CLASS_HID *hid) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_periodic_report_stop.c b/common/usbx_host_classes/src/ux_host_class_hid_periodic_report_stop.c index ebfa979..170b9ca 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_periodic_report_stop.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_periodic_report_stop.c @@ -121,7 +121,7 @@ UINT _ux_host_class_hid_periodic_report_stop(UX_HOST_CLASS_HID *hid) /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_periodic_report_stop PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -152,7 +152,7 @@ UINT _ux_host_class_hid_periodic_report_stop(UX_HOST_CLASS_HID *hid) /* */ /* 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_class_hid_periodic_report_stop(UX_HOST_CLASS_HID *hid) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_remote_control_deactivate.c b/common/usbx_host_classes/src/ux_host_class_hid_remote_control_deactivate.c index d2083ba..123d80d 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_remote_control_deactivate.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_remote_control_deactivate.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hid_remote_control_deactivate PORTABLE C */ -/* 6.1 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,6 +70,9 @@ /* 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 Chaoqiong Xiao Modified comment(s), */ +/* improved unload sequence, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_hid_remote_control_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command) @@ -93,15 +96,9 @@ UINT status; /* Get the remote control local instance. */ remote_control_instance = (UX_HOST_CLASS_HID_REMOTE_CONTROL *) hid_client -> ux_host_class_hid_client_local_instance; - /* Unload all the memory used by the remote control client. */ - _ux_utility_memory_free(remote_control_instance -> ux_host_class_hid_remote_control_usage_array); - /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_DEACTIVATE, hid, remote_control_instance, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0) - /* Now free the instance memory. */ - _ux_utility_memory_free(hid_client -> ux_host_class_hid_client_local_instance); - /* We may need to inform the application if a function has been programmed in the system structure. */ if (_ux_system_host -> ux_system_host_change_function != UX_NULL) @@ -111,6 +108,12 @@ UINT status; _ux_system_host -> ux_system_host_change_function(UX_HID_CLIENT_REMOVAL, hid -> ux_host_class_hid_class, (VOID *) hid_client); } + /* Unload all the memory used by the remote control client. */ + _ux_utility_memory_free(remote_control_instance -> ux_host_class_hid_remote_control_usage_array); + + /* Now free the instance memory. */ + _ux_utility_memory_free(hid_client -> ux_host_class_hid_client_local_instance); + /* Return completion status. */ return(status); } diff --git a/common/usbx_host_classes/src/ux_host_class_hid_remote_control_usage_get.c b/common/usbx_host_classes/src/ux_host_class_hid_remote_control_usage_get.c index bc05f2a..1e274ba 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_remote_control_usage_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_remote_control_usage_get.c @@ -130,7 +130,7 @@ UX_HOST_CLASS_HID *hid; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_remote_control_usage_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -162,7 +162,7 @@ UX_HOST_CLASS_HID *hid; /* */ /* 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_class_hid_remote_control_usage_get( diff --git a/common/usbx_host_classes/src/ux_host_class_hid_report_add.c b/common/usbx_host_classes/src/ux_host_class_hid_report_add.c index f97ccc7..2b9b684 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_report_add.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_report_add.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hid_report_add PORTABLE C */ -/* 6.1.8 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -78,6 +78,10 @@ /* 08-02-2021 Wen Wang Modified comment(s), */ /* fixed spelling error, */ /* resulting in version 6.1.8 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* fixed field managing issue, */ +/* improved usage handling, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_hid_report_add(UX_HOST_CLASS_HID *hid, UCHAR *descriptor, UX_HOST_CLASS_HID_ITEM *item) @@ -193,13 +197,9 @@ ULONG current_field_address; /* Take care of the bit padding if necessary. */ if (new_hid_report -> ux_host_class_hid_report_bit_length & 7) new_hid_report -> ux_host_class_hid_report_byte_length++; - - /* Get the number of field usage for this report, this value depends on the report type. If this is - an array, we use the number of usages; if this a variable, we use the report count. */ - if (hid_field_value & UX_HOST_CLASS_HID_ITEM_VARIABLE) - hid_field_count = hid_parser -> ux_host_class_hid_parser_global.ux_host_class_hid_global_item_report_count; - else - hid_field_count = hid_parser -> ux_host_class_hid_parser_local.ux_host_class_hid_local_item_number_usage; + + /* Get the number of fields for this report. */ + hid_field_count = hid_parser -> ux_host_class_hid_parser_global.ux_host_class_hid_global_item_report_count; /* If the field count is null, this is only padding and there is no field to be allocated to the report. */ if (hid_field_count == 0) @@ -210,27 +210,6 @@ ULONG current_field_address; if (new_hid_field == UX_NULL) return(UX_MEMORY_INSUFFICIENT); - /* Attach the new field to the report. The report may already contain a field, if so parse the chain - until we reach the end of the chain. */ - new_hid_report -> ux_host_class_hid_report_number_item += hid_field_count; - if (new_hid_report -> ux_host_class_hid_report_field == UX_NULL) - { - - /* This is the first field for the report. */ - new_hid_report -> ux_host_class_hid_report_field = new_hid_field; - } - else - { - - /* We have previous HID fields, so search for the end of the chain. */ - hid_field = new_hid_report -> ux_host_class_hid_report_field; - while(hid_field -> ux_host_class_hid_field_next_field != UX_NULL) - hid_field = hid_field -> ux_host_class_hid_field_next_field; - - /* Attach the new field to the end of the chain. */ - hid_field -> ux_host_class_hid_field_next_field = new_hid_field; - } - /* From the parser structure, update the new field values. Start with logical values. */ new_hid_field -> ux_host_class_hid_field_logical_min = hid_parser -> ux_host_class_hid_parser_global.ux_host_class_hid_global_item_logical_min; new_hid_field -> ux_host_class_hid_field_logical_max = hid_parser -> ux_host_class_hid_parser_global.ux_host_class_hid_global_item_logical_max; @@ -269,14 +248,15 @@ ULONG current_field_address; _ux_utility_memory_free(new_hid_field); return(UX_MEMORY_INSUFFICIENT); } - + /* We need some memory for the usages, but only for variable items; usage values for array items can be calculated. */ - if (hid_field_value & UX_HOST_CLASS_HID_ITEM_VARIABLE) + if ((hid_field_value & UX_HOST_CLASS_HID_ITEM_VARIABLE) && + (hid_parser -> ux_host_class_hid_parser_local.ux_host_class_hid_local_item_number_usage > 0)) { /* Allocate memory for the usages. */ - new_hid_field -> ux_host_class_hid_field_usages = _ux_utility_memory_allocate_mulc_safe(UX_NO_ALIGN, UX_REGULAR_MEMORY, hid_field_count, 4); + new_hid_field -> ux_host_class_hid_field_usages = _ux_utility_memory_allocate_mulc_safe(UX_NO_ALIGN, UX_REGULAR_MEMORY, hid_parser -> ux_host_class_hid_parser_local.ux_host_class_hid_local_item_number_usage, 4); if (new_hid_field -> ux_host_class_hid_field_usages == UX_NULL) { @@ -286,11 +266,32 @@ ULONG current_field_address; } /* Copy the current usages in the field structure. */ - _ux_utility_memory_copy(new_hid_field -> ux_host_class_hid_field_usages, hid_parser -> ux_host_class_hid_parser_local.ux_host_class_hid_local_item_usages, hid_field_count*4); /* Use case of memcpy is verified. */ + _ux_utility_memory_copy(new_hid_field -> ux_host_class_hid_field_usages, hid_parser -> ux_host_class_hid_parser_local.ux_host_class_hid_local_item_usages, hid_parser -> ux_host_class_hid_parser_local.ux_host_class_hid_local_item_number_usage * 4); /* Use case of memcpy is verified. */ } /* Save the number of usages. */ - new_hid_field -> ux_host_class_hid_field_number_usage = hid_field_count; + new_hid_field -> ux_host_class_hid_field_number_usage = hid_parser -> ux_host_class_hid_parser_local.ux_host_class_hid_local_item_number_usage; + + /* Attach the new field to the report. The report may already contain a field, if so parse the chain + until we reach the end of the chain. */ + new_hid_report -> ux_host_class_hid_report_number_item += hid_field_count; + if (new_hid_report -> ux_host_class_hid_report_field == UX_NULL) + { + + /* This is the first field for the report. */ + new_hid_report -> ux_host_class_hid_report_field = new_hid_field; + } + else + { + + /* We have previous HID fields, so search for the end of the chain. */ + hid_field = new_hid_report -> ux_host_class_hid_report_field; + while(hid_field -> ux_host_class_hid_field_next_field != UX_NULL) + hid_field = hid_field -> ux_host_class_hid_field_next_field; + + /* Attach the new field to the end of the chain. */ + hid_field -> ux_host_class_hid_field_next_field = new_hid_field; + } /* Return successful completion. */ return(UX_SUCCESS); diff --git a/common/usbx_host_classes/src/ux_host_class_hid_report_callback_register.c b/common/usbx_host_classes/src/ux_host_class_hid_report_callback_register.c index 82283e9..61b2bca 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_report_callback_register.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_report_callback_register.c @@ -153,7 +153,7 @@ UX_HOST_CLASS_HID_REPORT *hid_report; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_report_callback_register PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -185,7 +185,7 @@ UX_HOST_CLASS_HID_REPORT *hid_report; /* */ /* 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_class_hid_report_callback_register(UX_HOST_CLASS_HID *hid, UX_HOST_CLASS_HID_REPORT_CALLBACK *call_back) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_report_get.c b/common/usbx_host_classes/src/ux_host_class_hid_report_get.c index c4ae1dd..1b0f932 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_report_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_report_get.c @@ -277,7 +277,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_report_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -307,7 +307,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_class_hid_report_get(UX_HOST_CLASS_HID *hid, UX_HOST_CLASS_HID_CLIENT_REPORT *client_report) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_report_id_get.c b/common/usbx_host_classes/src/ux_host_class_hid_report_id_get.c index 9ce374a..78d3af4 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_report_id_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_report_id_get.c @@ -186,7 +186,7 @@ UX_HOST_CLASS_HID_REPORT *next_hid_report; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_report_id_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -216,7 +216,7 @@ UX_HOST_CLASS_HID_REPORT *next_hid_report; /* */ /* 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_class_hid_report_id_get(UX_HOST_CLASS_HID *hid, UX_HOST_CLASS_HID_REPORT_GET_ID *report_id) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_report_set.c b/common/usbx_host_classes/src/ux_host_class_hid_report_set.c index 05376ad..35feafe 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_report_set.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_report_set.c @@ -320,7 +320,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_report_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -350,7 +350,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_class_hid_report_set(UX_HOST_CLASS_HID *hid, UX_HOST_CLASS_HID_CLIENT_REPORT *client_report) diff --git a/common/usbx_host_classes/src/ux_host_class_hid_report_set_run.c b/common/usbx_host_classes/src/ux_host_class_hid_report_set_run.c index 8add05c..d8e004e 100644 --- a/common/usbx_host_classes/src/ux_host_class_hid_report_set_run.c +++ b/common/usbx_host_classes/src/ux_host_class_hid_report_set_run.c @@ -252,7 +252,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_hid_report_set_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -282,7 +282,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_class_hid_report_set_run(UX_HOST_CLASS_HID *hid, UX_HOST_CLASS_HID_CLIENT_REPORT *client_report) diff --git a/common/usbx_host_classes/src/ux_host_class_hub_deactivate.c b/common/usbx_host_classes/src/ux_host_class_hub_deactivate.c index c64859a..b113206 100644 --- a/common/usbx_host_classes/src/ux_host_class_hub_deactivate.c +++ b/common/usbx_host_classes/src/ux_host_class_hub_deactivate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hub_deactivate PORTABLE C */ -/* 6.1.12 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,6 +84,9 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.12 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved deactivate flow, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_hub_deactivate(UX_HOST_CLASS_COMMAND *command) @@ -91,7 +94,7 @@ UINT _ux_host_class_hub_deactivate(UX_HOST_CLASS_COMMAND *command) UX_HOST_CLASS_HUB *hub; UX_HCD *hcd; -UX_TRANSFER *transfer_request; +UX_TRANSFER *transfer_request = UX_NULL; UINT port_index; @@ -105,7 +108,16 @@ UINT port_index; hub -> ux_host_class_hub_state = UX_HOST_CLASS_INSTANCE_SHUTDOWN; /* We need to abort transactions on the interrupt pipe. */ - _ux_host_stack_endpoint_transfer_abort(hub -> ux_host_class_hub_interrupt_endpoint); +#if defined(UX_HOST_STANDALONE) + if (hub -> ux_host_class_hub_interrupt_endpoint) +#endif + { + _ux_host_stack_endpoint_transfer_abort(hub -> ux_host_class_hub_interrupt_endpoint); + + /* If the Hub class instance has a interrupt pipe with a data payload associated with it + it must be freed. First get the transfer request. */ + transfer_request = &hub -> ux_host_class_hub_interrupt_endpoint -> ux_endpoint_transfer_request; + } /* Each device which is downstream on the HUB ports must be removed. */ for (port_index = 1; port_index <= hub -> ux_host_class_hub_descriptor.bNbPorts; port_index++) @@ -120,20 +132,22 @@ UINT port_index; } } - /* If the Hub class instance has a interrupt pipe with a data payload associated with it - it must be freed. First get the transfer request. */ - transfer_request = &hub -> ux_host_class_hub_interrupt_endpoint -> ux_endpoint_transfer_request; /* The enumeration thread needs to sleep a while to allow the application or the class that may be using endpoints to exit properly. */ _ux_host_thread_schedule_other(UX_THREAD_PRIORITY_ENUM); /* Then de allocate the memory. */ +#if defined(UX_HOST_STANDALONE) + if (transfer_request) +#endif _ux_utility_memory_free(transfer_request -> ux_transfer_request_data_pointer); #if defined(UX_HOST_STANDALONE) if (hub -> ux_host_class_hub_allocated) + { _ux_utility_memory_free(hub -> ux_host_class_hub_allocated); + } #endif /* Destroy the instance. */ @@ -154,10 +168,15 @@ UINT port_index; /* If trace is enabled, register this object. */ UX_TRACE_OBJECT_UNREGISTER(hub); +#if defined(UX_HOST_STANDALONE) + + /* Unlink from device class instance. */ + hub -> ux_host_class_hub_device -> ux_device_class_instance = (VOID *) hub; +#endif + /* Free the memory block used by the class. */ _ux_utility_memory_free(hub); /* Return successful completion. */ return(UX_SUCCESS); } - diff --git a/common/usbx_host_classes/src/ux_host_class_hub_descriptor_get.c b/common/usbx_host_classes/src/ux_host_class_hub_descriptor_get.c index 041f26b..5ff8393 100644 --- a/common/usbx_host_classes/src/ux_host_class_hub_descriptor_get.c +++ b/common/usbx_host_classes/src/ux_host_class_hub_descriptor_get.c @@ -129,7 +129,7 @@ ULONG port_index; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hub_descriptor_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -174,9 +174,9 @@ ULONG port_index; /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* fixed compile warnings, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_hub_descriptor_get(UX_HOST_CLASS_HUB *hub) diff --git a/common/usbx_host_classes/src/ux_host_class_hub_entry.c b/common/usbx_host_classes/src/ux_host_class_hub_entry.c index e73c2e1..040b631 100644 --- a/common/usbx_host_classes/src/ux_host_class_hub_entry.c +++ b/common/usbx_host_classes/src/ux_host_class_hub_entry.c @@ -41,7 +41,7 @@ static inline UINT _ux_host_class_hub_activate_wait(UX_HOST_CLASS_COMMAND *comma /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hub_entry PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,9 +84,10 @@ static inline UINT _ux_host_class_hub_activate_wait(UX_HOST_CLASS_COMMAND *comma /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* fixed power on delay calc, */ /* resulting in version 6.2.0 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* fixed fail code sequence, */ /* fixed compile warnings, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_hub_entry(UX_HOST_CLASS_COMMAND *command) @@ -410,17 +411,14 @@ ULONG current_ms, elapsed_ms; /* Unlink from device. */ device -> ux_device_class_instance = UX_NULL; - /* Free hub. */ - _ux_utility_memory_free(hub); - /* Error trap. */ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, hub -> ux_host_class_hub_run_status); /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, hub -> ux_host_class_hub_run_status, hub, 0, 0, UX_TRACE_ERRORS, 0, 0) - /* To error state. */ - hub -> ux_host_class_hub_enum_state = UX_STATE_ERROR; + /* Free hub. */ + _ux_utility_memory_free(hub); return(UX_STATE_ERROR); } diff --git a/common/usbx_host_classes/src/ux_host_class_pima_command.c b/common/usbx_host_classes/src/ux_host_class_pima_command.c index d643f63..cce067e 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_command.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_command.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_command PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,8 +79,8 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* refined macros names, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_command(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_COMMAND *command, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_deactivate.c b/common/usbx_host_classes/src/ux_host_class_pima_deactivate.c index 917ec9f..18af625 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_deactivate.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_deactivate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_deactivate PORTABLE C */ -/* 6.1.10 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -59,8 +59,6 @@ /* _ux_host_stack_class_instance_destroy Destroy the class instance */ /* _ux_host_stack_endpoint_transfer_abort Abort endpoint transfer */ /* _ux_utility_memory_free Free memory block */ -/* _ux_host_semaphore_get Get protection semaphore */ -/* _ux_host_semaphore_delete Delete protection semaphore */ /* */ /* CALLED BY */ /* */ @@ -76,6 +74,10 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* refined macros names, */ /* resulting in version 6.1.10 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved INT EP support, */ +/* removed unused semaphore, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_deactivate(UX_HOST_CLASS_COMMAND *command) @@ -84,8 +86,7 @@ UINT _ux_host_class_pima_deactivate(UX_HOST_CLASS_COMMAND *command) UX_HOST_CLASS_PIMA *pima; UX_HOST_CLASS_PIMA_SESSION *pima_session; UX_TRANSFER *transfer_request; -UINT status; - + /* Get the instance for this class. */ pima = (UX_HOST_CLASS_PIMA *) command -> ux_host_class_command_instance; @@ -93,13 +94,6 @@ UINT status; /* The pima is being shut down. */ pima -> ux_host_class_pima_state = UX_HOST_CLASS_INSTANCE_SHUTDOWN; - /* Protect thread reentry to this instance. */ - status = _ux_host_semaphore_get(&pima -> ux_host_class_pima_semaphore, UX_WAIT_FOREVER); - if (status != UX_SUCCESS) - - /* Return error. */ - return(status); - /* We come to this point when the device has been extracted. So there may have been a transaction being scheduled. We make sure the transaction has been completed by the controller driver. When the device is extracted, the controller tries multiple times the transaction and retires it @@ -122,12 +116,18 @@ UINT status; /* Then interrupt endpoint. */ - transfer_request = &pima -> ux_host_class_pima_interrupt_endpoint -> ux_endpoint_transfer_request; - if (transfer_request -> ux_transfer_request_completion_code == UX_TRANSFER_STATUS_PENDING) - - /* We need to abort transactions on the Interrupt pipe. */ - _ux_host_stack_endpoint_transfer_abort(pima -> ux_host_class_pima_interrupt_endpoint); - + if (pima -> ux_host_class_pima_interrupt_endpoint != UX_NULL) + { + transfer_request = &pima -> ux_host_class_pima_interrupt_endpoint -> ux_endpoint_transfer_request; + if (transfer_request -> ux_transfer_request_completion_code == UX_TRANSFER_STATUS_PENDING) + + /* We need to abort transactions on the Interrupt pipe. */ + _ux_host_stack_endpoint_transfer_abort(pima -> ux_host_class_pima_interrupt_endpoint); + + /* Free the interrupt transfer buffer. */ + _ux_utility_memory_free(transfer_request -> ux_transfer_request_data_pointer); + } + /* The enumeration thread needs to sleep a while to allow the application or the class that may be using endpoints to exit properly. */ _ux_host_thread_schedule_other(UX_THREAD_PRIORITY_ENUM); @@ -164,9 +164,6 @@ UINT status; /* Destroy the instance. */ _ux_host_stack_class_instance_destroy(pima -> ux_host_class_pima_class, (VOID *) pima); - /* Destroy the semaphore. */ - _ux_host_semaphore_delete(&pima -> ux_host_class_pima_semaphore); - /* Before we free the device resources, we need to inform the application that the device is removed. */ if (_ux_system_host -> ux_system_host_change_function != UX_NULL) diff --git a/common/usbx_host_classes/src/ux_host_class_pima_device_info_get.c b/common/usbx_host_classes/src/ux_host_class_pima_device_info_get.c index 5d5ca49..448c565 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_device_info_get.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_device_info_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_device_info_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,9 +79,9 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* fixed DeviceInfo extract, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* fixed compile warnings, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_device_info_get(UX_HOST_CLASS_PIMA *pima, @@ -369,7 +369,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_device_info_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -399,7 +399,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_device_info_get(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_num_objects_get.c b/common/usbx_host_classes/src/ux_host_class_pima_num_objects_get.c index e64d2a2..4453670 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_num_objects_get.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_num_objects_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_num_objects_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,8 +70,8 @@ /* 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 Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima, @@ -129,7 +129,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_num_objects_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -162,7 +162,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_close.c b/common/usbx_host_classes/src/ux_host_class_pima_object_close.c index 10564b9..9a97079 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_close.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_close.c @@ -228,7 +228,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_close PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -260,7 +260,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_close(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_delete.c b/common/usbx_host_classes/src/ux_host_class_pima_object_delete.c index e746e48..cc75bf0 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_delete.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_delete.c @@ -121,7 +121,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_delete PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -152,7 +152,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_delete(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_get.c b/common/usbx_host_classes/src/ux_host_class_pima_object_get.c index 20d73a5..f0859a4 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_get.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_get.c @@ -423,7 +423,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -459,7 +459,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_get(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_handles_get.c b/common/usbx_host_classes/src/ux_host_class_pima_object_handles_get.c index ec51d77..85c6a2c 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_handles_get.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_handles_get.c @@ -184,7 +184,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_handles_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -223,7 +223,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_handles_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_info_get.c b/common/usbx_host_classes/src/ux_host_class_pima_object_info_get.c index 970446f..4189496 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_info_get.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_info_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_object_info_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -76,10 +76,10 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ /* fixed allocated buffer */ /* pointer checking issue, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_object_info_get(UX_HOST_CLASS_PIMA *pima, @@ -245,7 +245,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_info_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -277,7 +277,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_info_get(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_info_send.c b/common/usbx_host_classes/src/ux_host_class_pima_object_info_send.c index 1f9f8e6..03e7f6f 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_info_send.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_info_send.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_object_info_send PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -78,10 +78,10 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ /* fixed allocated buffer */ /* pointer checking issue, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_object_info_send(UX_HOST_CLASS_PIMA *pima, @@ -263,7 +263,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_info_send PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -296,7 +296,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_info_send(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_open.c b/common/usbx_host_classes/src/ux_host_class_pima_object_open.c index 39c38af..cca73fe 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_open.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_open.c @@ -109,7 +109,7 @@ UINT _ux_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima, /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_open PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -141,7 +141,7 @@ UINT _ux_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima, /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_send.c b/common/usbx_host_classes/src/ux_host_class_pima_object_send.c index 9bb5318..4a144a5 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_send.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_send.c @@ -387,7 +387,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_send PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -423,7 +423,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_send(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_object_transfer_abort.c b/common/usbx_host_classes/src/ux_host_class_pima_object_transfer_abort.c index e1285c2..7acca5c 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_object_transfer_abort.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_object_transfer_abort.c @@ -113,7 +113,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_object_transfer_abort PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -146,7 +146,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_object_transfer_abort(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_session_close.c b/common/usbx_host_classes/src/ux_host_class_pima_session_close.c index 530a29d..ee18ec9 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_session_close.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_session_close.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_session_close PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -68,8 +68,8 @@ /* 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 Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_session_close(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session) @@ -131,7 +131,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_session_close PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -161,7 +161,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_session_close(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session) diff --git a/common/usbx_host_classes/src/ux_host_class_pima_session_open.c b/common/usbx_host_classes/src/ux_host_class_pima_session_open.c index 20b2163..e54a1b5 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_session_open.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_session_open.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_session_open PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,8 +70,8 @@ /* 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 Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_session_open(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session) @@ -136,7 +136,7 @@ ULONG status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_session_open PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -166,7 +166,7 @@ ULONG status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_session_open(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session) diff --git a/common/usbx_host_classes/src/ux_host_class_pima_storage_ids_get.c b/common/usbx_host_classes/src/ux_host_class_pima_storage_ids_get.c index 0c63b4f..5d6230a 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_storage_ids_get.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_storage_ids_get.c @@ -168,7 +168,7 @@ ULONG nb_storage_ids; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_storage_ids_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -202,7 +202,7 @@ ULONG nb_storage_ids; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_storage_ids_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_storage_info_get.c b/common/usbx_host_classes/src/ux_host_class_pima_storage_info_get.c index 53cefa3..1815f9b 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_storage_info_get.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_storage_info_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_pima_storage_info_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -76,8 +76,8 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_storage_info_get(UX_HOST_CLASS_PIMA *pima, @@ -167,7 +167,7 @@ ULONG unicode_string_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_storage_info_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -200,7 +200,7 @@ ULONG unicode_string_length; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_storage_info_get(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_pima_thumb_get.c b/common/usbx_host_classes/src/ux_host_class_pima_thumb_get.c index 3a53b20..5fe6395 100644 --- a/common/usbx_host_classes/src/ux_host_class_pima_thumb_get.c +++ b/common/usbx_host_classes/src/ux_host_class_pima_thumb_get.c @@ -383,7 +383,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_pima_thumb_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -419,7 +419,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_pima_thumb_get(UX_HOST_CLASS_PIMA *pima, diff --git a/common/usbx_host_classes/src/ux_host_class_printer_device_id_get.c b/common/usbx_host_classes/src/ux_host_class_printer_device_id_get.c index 9963117..e654751 100644 --- a/common/usbx_host_classes/src/ux_host_class_printer_device_id_get.c +++ b/common/usbx_host_classes/src/ux_host_class_printer_device_id_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_printer_device_id_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -83,9 +83,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), */ /* fixed compile warnings, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_printer_device_id_get(UX_HOST_CLASS_PRINTER *printer, UCHAR *descriptor_buffer, ULONG length) @@ -169,7 +169,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_printer_device_id_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -203,7 +203,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_printer_device_id_get(UX_HOST_CLASS_PRINTER *printer, UCHAR *descriptor_buffer, ULONG length) diff --git a/common/usbx_host_classes/src/ux_host_class_printer_name_get.c b/common/usbx_host_classes/src/ux_host_class_printer_name_get.c index a008656..84c8479 100644 --- a/common/usbx_host_classes/src/ux_host_class_printer_name_get.c +++ b/common/usbx_host_classes/src/ux_host_class_printer_name_get.c @@ -125,7 +125,7 @@ UINT printer_name_length; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_printer_name_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -176,9 +176,9 @@ UINT printer_name_length; /* 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), */ /* fixed compile warnings, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_printer_name_get(UX_HOST_CLASS_PRINTER *printer) @@ -247,7 +247,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_printer_name_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -276,7 +276,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_printer_name_get(UX_HOST_CLASS_PRINTER *printer) diff --git a/common/usbx_host_classes/src/ux_host_class_printer_read.c b/common/usbx_host_classes/src/ux_host_class_printer_read.c index c6fe27c..ba996f7 100644 --- a/common/usbx_host_classes/src/ux_host_class_printer_read.c +++ b/common/usbx_host_classes/src/ux_host_class_printer_read.c @@ -276,7 +276,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_printer_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -308,7 +308,7 @@ ULONG transfer_request_length; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_printer_read (UX_HOST_CLASS_PRINTER *printer, UCHAR *data_pointer, diff --git a/common/usbx_host_classes/src/ux_host_class_printer_soft_reset.c b/common/usbx_host_classes/src/ux_host_class_printer_soft_reset.c index c7122a6..b5b668d 100644 --- a/common/usbx_host_classes/src/ux_host_class_printer_soft_reset.c +++ b/common/usbx_host_classes/src/ux_host_class_printer_soft_reset.c @@ -177,7 +177,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_printer_soft_reset PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -206,7 +206,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_printer_soft_reset(UX_HOST_CLASS_PRINTER *printer) diff --git a/common/usbx_host_classes/src/ux_host_class_printer_status_get.c b/common/usbx_host_classes/src/ux_host_class_printer_status_get.c index d545a31..646da05 100644 --- a/common/usbx_host_classes/src/ux_host_class_printer_status_get.c +++ b/common/usbx_host_classes/src/ux_host_class_printer_status_get.c @@ -215,7 +215,7 @@ UCHAR * printer_status_buffer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_printer_status_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -245,7 +245,7 @@ UCHAR * printer_status_buffer; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_printer_status_get(UX_HOST_CLASS_PRINTER *printer, ULONG *printer_status) diff --git a/common/usbx_host_classes/src/ux_host_class_printer_write.c b/common/usbx_host_classes/src/ux_host_class_printer_write.c index 6599b42..0338478 100644 --- a/common/usbx_host_classes/src/ux_host_class_printer_write.c +++ b/common/usbx_host_classes/src/ux_host_class_printer_write.c @@ -259,7 +259,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_printer_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -291,7 +291,7 @@ ULONG transfer_request_length; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * data_pointer, diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_command.c b/common/usbx_host_classes/src/ux_host_class_prolific_command.c index 88747a9..adb600a 100644 --- a/common/usbx_host_classes/src/ux_host_class_prolific_command.c +++ b/common/usbx_host_classes/src/ux_host_class_prolific_command.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_prolific_command PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -82,8 +82,8 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* refined macros names, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_prolific_command(UX_HOST_CLASS_PROLIFIC *prolific, ULONG command, @@ -130,7 +130,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_prolific_command PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -164,7 +164,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_class_prolific_command(UX_HOST_CLASS_PROLIFIC *prolific, ULONG command, diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_configure.c b/common/usbx_host_classes/src/ux_host_class_prolific_configure.c index cdb7909..33e905a 100644 --- a/common/usbx_host_classes/src/ux_host_class_prolific_configure.c +++ b/common/usbx_host_classes/src/ux_host_class_prolific_configure.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_prolific_configure PORTABLE C */ -/* 6.1 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -74,6 +74,9 @@ /* optimized based on compile */ /* definitions, */ /* resulting in version 6.1 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* removed interface link, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_prolific_configure(UX_HOST_CLASS_PROLIFIC *prolific) @@ -141,20 +144,6 @@ UX_DEVICE *parent_device; the interrupt endpoint is hooked to it. */ status = _ux_host_stack_configuration_interface_get(configuration, 0, 0, &prolific -> ux_host_class_prolific_interface); - /* Check status for error. */ - if (status == UX_SUCCESS) - { - - /* Store the instance in the interface container, this is for the USB stack - when it needs to invoke the class. */ - prolific -> ux_host_class_prolific_interface -> ux_interface_class_instance = (VOID *) prolific; - - /* Store the class container in the interface. The device has the correct class, duplicate it to the - interface. */ - prolific -> ux_host_class_prolific_interface -> ux_interface_class = prolific -> ux_host_class_prolific_device -> ux_device_class ; - - } - /* Return completion status. */ return(status); } diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c b/common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c index 9b57a4a..ada5249 100644 --- a/common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c +++ b/common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_prolific_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -80,8 +80,8 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_prolific_ioctl(UX_HOST_CLASS_PROLIFIC *prolific, ULONG ioctl_function, @@ -342,7 +342,7 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_prolific_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -373,7 +373,7 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P /* */ /* 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_class_prolific_ioctl(UX_HOST_CLASS_PROLIFIC *prolific, ULONG ioctl_function, diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_read.c b/common/usbx_host_classes/src/ux_host_class_prolific_read.c index adca0cb..6d1c74e 100644 --- a/common/usbx_host_classes/src/ux_host_class_prolific_read.c +++ b/common/usbx_host_classes/src/ux_host_class_prolific_read.c @@ -201,7 +201,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_prolific_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -233,7 +233,7 @@ ULONG transfer_request_length; /* */ /* 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_class_prolific_read (UX_HOST_CLASS_PROLIFIC *prolific, UCHAR *data_pointer, diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_reception_start.c b/common/usbx_host_classes/src/ux_host_class_prolific_reception_start.c index 1ade3ac..757bc89 100644 --- a/common/usbx_host_classes/src/ux_host_class_prolific_reception_start.c +++ b/common/usbx_host_classes/src/ux_host_class_prolific_reception_start.c @@ -134,7 +134,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_prolific_reception_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -165,7 +165,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_class_prolific_reception_start (UX_HOST_CLASS_PROLIFIC *prolific, diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_reception_stop.c b/common/usbx_host_classes/src/ux_host_class_prolific_reception_stop.c index 4a9b6af..5332186 100644 --- a/common/usbx_host_classes/src/ux_host_class_prolific_reception_stop.c +++ b/common/usbx_host_classes/src/ux_host_class_prolific_reception_stop.c @@ -115,7 +115,7 @@ UINT _ux_host_class_prolific_reception_stop (UX_HOST_CLASS_PROLIFIC *prolific, /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_prolific_reception_stop PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -146,7 +146,7 @@ UINT _ux_host_class_prolific_reception_stop (UX_HOST_CLASS_PROLIFIC *prolific, /* */ /* 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_class_prolific_reception_stop (UX_HOST_CLASS_PROLIFIC *prolific, diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_write.c b/common/usbx_host_classes/src/ux_host_class_prolific_write.c index b670562..ac49eed 100644 --- a/common/usbx_host_classes/src/ux_host_class_prolific_write.c +++ b/common/usbx_host_classes/src/ux_host_class_prolific_write.c @@ -200,7 +200,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_prolific_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -232,7 +232,7 @@ ULONG transfer_request_length; /* */ /* 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_class_prolific_write(UX_HOST_CLASS_PROLIFIC *prolific, UCHAR *data_pointer, diff --git a/common/usbx_host_classes/src/ux_host_class_storage_activate.c b/common/usbx_host_classes/src/ux_host_class_storage_activate.c index f8ff0a1..19aaa99 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_activate.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_activate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_activate PORTABLE C */ -/* 6.1.12 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -55,6 +55,9 @@ /* CALLS */ /* */ /* _ux_host_class_storage_configure Configure storage device */ +/* _ux_host_class_storage_device_support_check */ +/* Check protocol support */ +/* _ux_host_class_storage_endpoints_get Get all endpoints */ /* _ux_host_class_storage_device_initialize */ /* Initialize storage device */ /* _ux_host_stack_class_instance_create Create class instance */ @@ -81,6 +84,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* moved class/sub/protocol */ +/* check and endpoints get */ +/* into _activate function, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_activate(UX_HOST_CLASS_COMMAND *command) @@ -110,14 +118,6 @@ UINT status; /* Store the device container into the storage class instance. */ storage -> ux_host_class_storage_device = interface_ptr -> ux_interface_configuration -> ux_configuration_device; - /* Create this class instance. */ - _ux_host_stack_class_instance_create(command -> ux_host_class_command_class_ptr, (VOID *) storage); - - /* This instance of the device must also be stored in the interface container. */ - interface_ptr -> ux_interface_class_instance = (VOID *) storage; - -#if defined(UX_HOST_STANDALONE) - /* Check class,sub class, protocol. */ status = _ux_host_class_storage_device_support_check(storage); if (status != UX_SUCCESS) @@ -135,6 +135,14 @@ UINT status; return(status); } + /* Create this class instance. */ + _ux_host_stack_class_instance_create(command -> ux_host_class_command_class_ptr, (VOID *) storage); + + /* This instance of the device must also be stored in the interface container. */ + interface_ptr -> ux_interface_class_instance = (VOID *) storage; + +#if defined(UX_HOST_STANDALONE) + /* Activate storage class task function. */ storage -> ux_host_class_storage_class -> ux_host_class_task_function = _ux_host_class_storage_tasks_run; diff --git a/common/usbx_host_classes/src/ux_host_class_storage_device_initialize.c b/common/usbx_host_classes/src/ux_host_class_storage_device_initialize.c index 595fef2..a397486 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_device_initialize.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_device_initialize.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_device_initialize PORTABLE C */ -/* 6.1.10 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -58,9 +58,6 @@ /* CALLS */ /* */ /* _ux_host_class_storage_device_reset Reset device */ -/* _ux_host_class_storage_device_support_check */ -/* Check protocol support */ -/* _ux_host_class_storage_endpoints_get Get all endpoints */ /* _ux_host_class_storage_max_lun_get Get maximum number of LUNs */ /* _ux_host_class_storage_media_characteristics_get */ /* Get media characteristics */ @@ -90,6 +87,11 @@ /* improved media insert/eject */ /* management without FX, */ /* resulting in version 6.1.10 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* moved class/sub/protocol */ +/* check and endpoints get */ +/* into _activate function, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_device_initialize(UX_HOST_CLASS_STORAGE *storage) @@ -104,23 +106,12 @@ UINT inst_index; #endif - /* Check the device protocol support and initialize the transport layer. */ - status = _ux_host_class_storage_device_support_check(storage); - if (status != UX_SUCCESS) - return(status); - /* Get the maximum number of LUN (Bulk Only device only, other device will set the LUN number to 0). */ status = _ux_host_class_storage_max_lun_get(storage); if (status != UX_SUCCESS) return(status); - /* Search all the endpoints for the storage interface (Bulk Out, Bulk in, - and optional Interrupt endpoint). */ - status = _ux_host_class_storage_endpoints_get(storage); - if (status != UX_SUCCESS) - return(status); - /* We need to wait for some device to settle. The INTUIX Flash disk is an example of these device who fail the first Inquiry command if sent too quickly. The timing does not have to be precise so we use the thread sleep function. diff --git a/common/usbx_host_classes/src/ux_host_class_storage_endpoints_get.c b/common/usbx_host_classes/src/ux_host_class_storage_endpoints_get.c index fe48761..fcc3edf 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_endpoints_get.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_endpoints_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_endpoints_get PORTABLE C */ -/* 6.1.10 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -76,6 +76,9 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* initial the timeout value, */ /* resulting in version 6.1.10 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* checked endpoint get status,*/ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_endpoints_get(UX_HOST_CLASS_STORAGE *storage) @@ -83,6 +86,7 @@ UINT _ux_host_class_storage_endpoints_get(UX_HOST_CLASS_STORAGE *storage) UINT endpoint_index; UX_ENDPOINT *endpoint; +UINT status; /* Search for the bulk OUT endpoint. It is attached to the interface container. */ @@ -91,7 +95,11 @@ UX_ENDPOINT *endpoint; { /* Get an endpoint. */ - _ux_host_stack_interface_endpoint_get(storage -> ux_host_class_storage_interface, endpoint_index, &endpoint); + status = _ux_host_stack_interface_endpoint_get(storage -> ux_host_class_storage_interface, endpoint_index, &endpoint); + + /* Check status. */ + if (status != UX_SUCCESS) + continue; /* We have an endpoint. Check if endpoint is bulk and OUT. */ if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_OUT) && @@ -127,7 +135,11 @@ UX_ENDPOINT *endpoint; { /* Get an endpoint. */ - _ux_host_stack_interface_endpoint_get(storage -> ux_host_class_storage_interface, endpoint_index, &endpoint); + status = _ux_host_stack_interface_endpoint_get(storage -> ux_host_class_storage_interface, endpoint_index, &endpoint); + + /* Check status. */ + if (status != UX_SUCCESS) + continue; /* We have an endpoint. Check if endpoint is bulk and IN. */ if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_IN) && @@ -177,7 +189,11 @@ UX_ENDPOINT *endpoint; { /* Get an endpoint. */ - _ux_host_stack_interface_endpoint_get(storage -> ux_host_class_storage_interface, endpoint_index, &endpoint); + status = _ux_host_stack_interface_endpoint_get(storage -> ux_host_class_storage_interface, endpoint_index, &endpoint); + + /* Check status. */ + if (status != UX_SUCCESS) + continue; /* Check if endpoint is Interrupt and IN. */ if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_IN) && 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 b43a66a..9a31186 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 @@ -165,7 +165,7 @@ UX_DEVICE *device; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_storage_lock PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -195,7 +195,7 @@ UX_DEVICE *device; /* */ /* 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_class_storage_lock(UX_HOST_CLASS_STORAGE *storage, ULONG wait) diff --git a/common/usbx_host_classes/src/ux_host_class_storage_media_check.c b/common/usbx_host_classes/src/ux_host_class_storage_media_check.c index eb91a6d..44b19cc 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_media_check.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_media_check.c @@ -90,7 +90,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_storage_media_check PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -119,7 +119,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_class_storage_media_check(UX_HOST_CLASS_STORAGE *storage) diff --git a/common/usbx_host_classes/src/ux_host_class_storage_media_get.c b/common/usbx_host_classes/src/ux_host_class_storage_media_get.c index f9ba628..22d52be 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_media_get.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_media_get.c @@ -141,7 +141,7 @@ UINT scan_index; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_storage_media_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -172,7 +172,7 @@ UINT scan_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_class_storage_media_get(UX_HOST_CLASS_STORAGE *storage, diff --git a/common/usbx_host_classes/src/ux_host_class_storage_media_lock.c b/common/usbx_host_classes/src/ux_host_class_storage_media_lock.c index de12a0e..1e59354 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_media_lock.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_media_lock.c @@ -110,7 +110,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_storage_media_lock PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -141,7 +141,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_class_storage_media_lock(UX_HOST_CLASS_STORAGE_MEDIA *storage_media, 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 64f7fc3..eeaacc1 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 @@ -200,7 +200,7 @@ UINT media_retry; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_media_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -232,7 +232,7 @@ UINT media_retry; /* */ /* 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_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 5186661..69a33e0 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 @@ -177,7 +177,7 @@ UINT media_retry; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_media_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -209,7 +209,7 @@ UINT media_retry; /* */ /* 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_class_storage_media_write(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start, diff --git a/common/usbx_host_classes/src/ux_host_class_swar_configure.c b/common/usbx_host_classes/src/ux_host_class_swar_configure.c index 7474a23..b03f06c 100644 --- a/common/usbx_host_classes/src/ux_host_class_swar_configure.c +++ b/common/usbx_host_classes/src/ux_host_class_swar_configure.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_swar_configure PORTABLE C */ -/* 6.1 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -73,6 +73,9 @@ /* optimized based on compile */ /* definitions, */ /* resulting in version 6.1 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* removed interface link, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_swar_configure(UX_HOST_CLASS_SWAR *swar) @@ -138,19 +141,7 @@ UX_DEVICE *parent_device; /* If the operation went well, the swar default alternate setting for the swar interface is active. We have to memorize the data interface since the bulk in/out endpoints are hooked to it. */ status = _ux_host_stack_configuration_interface_get(configuration, UX_HOST_CLASS_SWAR_DATA_INTERFACE, 0, &swar -> ux_host_class_swar_interface); - if (status == UX_SUCCESS) - { - - /* Store the instance in the interface container, this is for the USB stack - when it needs to invoke the class. */ - swar -> ux_host_class_swar_interface -> ux_interface_class_instance = (VOID *) swar; - - /* Store the class container in the interface. The device has the correct class, duplicate it to the - interface. */ - swar -> ux_host_class_swar_interface -> ux_interface_class = swar -> ux_host_class_swar_device -> ux_device_class ; - } /* Return completion status. */ return(status); } - diff --git a/common/usbx_host_classes/src/ux_host_class_swar_ioctl.c b/common/usbx_host_classes/src/ux_host_class_swar_ioctl.c index 11d093e..e9839a7 100644 --- a/common/usbx_host_classes/src/ux_host_class_swar_ioctl.c +++ b/common/usbx_host_classes/src/ux_host_class_swar_ioctl.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_swar_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,8 +72,8 @@ /* 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 Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_swar_ioctl(UX_HOST_CLASS_SWAR *swar, ULONG ioctl_function, @@ -135,7 +135,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_swar_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -166,7 +166,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_class_swar_ioctl(UX_HOST_CLASS_SWAR *swar, ULONG ioctl_function, diff --git a/common/usbx_host_classes/src/ux_host_class_swar_read.c b/common/usbx_host_classes/src/ux_host_class_swar_read.c index b0aef07..b7f5f30 100644 --- a/common/usbx_host_classes/src/ux_host_class_swar_read.c +++ b/common/usbx_host_classes/src/ux_host_class_swar_read.c @@ -218,7 +218,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_swar_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -250,7 +250,7 @@ ULONG transfer_request_length; /* */ /* 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_class_swar_read (UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer, diff --git a/common/usbx_host_classes/src/ux_host_class_swar_reception_start.c b/common/usbx_host_classes/src/ux_host_class_swar_reception_start.c index 4866a86..e1162a0 100644 --- a/common/usbx_host_classes/src/ux_host_class_swar_reception_start.c +++ b/common/usbx_host_classes/src/ux_host_class_swar_reception_start.c @@ -135,7 +135,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_swar_reception_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -166,7 +166,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_class_swar_reception_start (UX_HOST_CLASS_SWAR *swar, diff --git a/common/usbx_host_classes/src/ux_host_class_swar_reception_stop.c b/common/usbx_host_classes/src/ux_host_class_swar_reception_stop.c index f80a501..f140a71 100644 --- a/common/usbx_host_classes/src/ux_host_class_swar_reception_stop.c +++ b/common/usbx_host_classes/src/ux_host_class_swar_reception_stop.c @@ -116,7 +116,7 @@ UINT _ux_host_class_swar_reception_stop (UX_HOST_CLASS_SWAR *swar, /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_swar_reception_stop PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -146,7 +146,7 @@ UINT _ux_host_class_swar_reception_stop (UX_HOST_CLASS_SWAR *swar, /* */ /* 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_class_swar_reception_stop (UX_HOST_CLASS_SWAR *swar, diff --git a/common/usbx_host_classes/src/ux_host_class_swar_write.c b/common/usbx_host_classes/src/ux_host_class_swar_write.c index 6f9b9da..2fb244c 100644 --- a/common/usbx_host_classes/src/ux_host_class_swar_write.c +++ b/common/usbx_host_classes/src/ux_host_class_swar_write.c @@ -219,7 +219,7 @@ ULONG transfer_request_length; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_swar_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -251,7 +251,7 @@ ULONG transfer_request_length; /* */ /* 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_class_swar_write(UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer, diff --git a/common/usbx_host_classes/src/ux_host_class_video_control_get.c b/common/usbx_host_classes/src/ux_host_class_video_control_get.c index d2cd486..36ac261 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_control_get.c +++ b/common/usbx_host_classes/src/ux_host_class_video_control_get.c @@ -223,7 +223,7 @@ UCHAR * control_buffer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_control_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -254,7 +254,7 @@ UCHAR * control_buffer; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_control_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control) diff --git a/common/usbx_host_classes/src/ux_host_class_video_control_request.c b/common/usbx_host_classes/src/ux_host_class_video_control_request.c index 0084e88..63c7536 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_control_request.c +++ b/common/usbx_host_classes/src/ux_host_class_video_control_request.c @@ -212,7 +212,7 @@ UCHAR interface_number; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_control_request PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -251,7 +251,7 @@ UCHAR interface_number; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_control_request(UX_HOST_CLASS_VIDEO *video, diff --git a/common/usbx_host_classes/src/ux_host_class_video_control_value_get.c b/common/usbx_host_classes/src/ux_host_class_video_control_value_get.c index 3b74599..19edace 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_control_value_get.c +++ b/common/usbx_host_classes/src/ux_host_class_video_control_value_get.c @@ -183,7 +183,7 @@ UCHAR * control_buffer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_control_value_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -216,7 +216,7 @@ UCHAR * control_buffer; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_control_value_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control) diff --git a/common/usbx_host_classes/src/ux_host_class_video_control_value_set.c b/common/usbx_host_classes/src/ux_host_class_video_control_value_set.c index a6e49cb..10d9738 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_control_value_set.c +++ b/common/usbx_host_classes/src/ux_host_class_video_control_value_set.c @@ -179,7 +179,7 @@ UCHAR * control_buffer; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_control_value_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -212,7 +212,7 @@ UCHAR * control_buffer; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_control_value_set(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control) diff --git a/common/usbx_host_classes/src/ux_host_class_video_entities_parse.c b/common/usbx_host_classes/src/ux_host_class_video_entities_parse.c index a7dbd97..0a73397 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_entities_parse.c +++ b/common/usbx_host_classes/src/ux_host_class_video_entities_parse.c @@ -194,7 +194,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_entities_parse PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -227,7 +227,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_entities_parse(UX_HOST_CLASS_VIDEO *video, diff --git a/common/usbx_host_classes/src/ux_host_class_video_format_data_get.c b/common/usbx_host_classes/src/ux_host_class_video_format_data_get.c index 3a8afd8..d813fda 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_format_data_get.c +++ b/common/usbx_host_classes/src/ux_host_class_video_format_data_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Video Class */ /** */ @@ -30,44 +30,47 @@ #include "ux_host_stack.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_host_class_video_format_data_get PORTABLE C */ -/* 6.1 */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_host_class_video_format_data_get PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function finds the format data within the input terminal. */ -/* */ -/* INPUT */ -/* */ -/* video Pointer to video class */ -/* format_parameter Format Parameter structure */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ +/* */ +/* This function finds the format data within the input terminal. */ +/* */ +/* INPUT */ +/* */ +/* video Pointer to video class */ +/* format_parameter Format Parameter structure */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ /* _ux_system_error_handler Log system error */ -/* */ -/* CALLED BY */ -/* */ -/* Video Class */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* Video Class */ +/* */ +/* 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 Chaoqiong Xiao Modified comment(s), */ +/* improved extracted data, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_video_format_data_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA *format_parameter) @@ -78,12 +81,13 @@ ULONG total_descriptor_length; ULONG descriptor_length; ULONG descriptor_type; ULONG descriptor_subtype; - +UCHAR *guid; + /* Get the descriptor to the selected format. */ descriptor = video -> ux_host_class_video_format_address; total_descriptor_length = video -> ux_host_class_video_length_formats; - + /* Descriptors are arranged in order. First FORMAT then FRAME. */ while (total_descriptor_length) { @@ -101,53 +105,79 @@ ULONG descriptor_subtype; _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_DESCRIPTOR_CORRUPTED); /* If trace is enabled, insert this event into the trace buffer. */ - //UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0) + UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0) return(UX_DESCRIPTOR_CORRUPTED); } - + /* Must be CS_INTERFACE. */ if (descriptor_type == UX_HOST_CLASS_VIDEO_CS_INTERFACE) { /* Process relative to descriptor type. */ + guid = UX_NULL; switch (descriptor_subtype) { - - case UX_HOST_CLASS_VIDEO_VS_FORMAT_UNCOMPRESSED : - case UX_HOST_CLASS_VIDEO_VS_FORMAT_MJPEG : - case UX_HOST_CLASS_VIDEO_VS_FORMAT_MPEG2TS : - case UX_HOST_CLASS_VIDEO_VS_FORMAT_DV : - case UX_HOST_CLASS_VIDEO_VS_FORMAT_FRAME_BASED : - case UX_HOST_CLASS_VIDEO_VS_FORMAT_STREAM_BASED : - - + + case UX_HOST_CLASS_VIDEO_VS_FORMAT_UNCOMPRESSED : /* guidFormat @ 5 */ + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_FRAME_BASED : /* guidFormat @ 5 */ + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_STREAM_BASED : /* guidFormat @ 4, no frame */ + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_MPEG2TS : /* guidStrideFormat @ 7, no frame */ + if (descriptor_subtype == UX_HOST_CLASS_VIDEO_VS_FORMAT_STREAM_BASED) + guid = (descriptor + 4); + else if (descriptor_subtype == UX_HOST_CLASS_VIDEO_VS_FORMAT_MPEG2TS) + guid = (descriptor + 7); + else + guid = (descriptor + 5); + + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_MJPEG : /* no GUID */ + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_H264 : /* no GUID */ + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_H264_SIMULCAST : + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_VP8 : /* no GUID */ + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_VP8_SIMULCAST : + /* Fall through. */ + case UX_HOST_CLASS_VIDEO_VS_FORMAT_DV : /* no GUID, no frame */ + /* We found a Format descriptor. Is it the right one ? */ if (format_parameter -> ux_host_class_video_parameter_format_requested == *(descriptor + 3)) { - + /* Save the subtype for this format. */ format_parameter -> ux_host_class_video_parameter_format_subtype = descriptor_subtype; - + /* Save the number of frame descriptors associated with this format. */ - format_parameter -> ux_host_class_video_parameter_number_frame_descriptors = *(descriptor + 4); - + if (descriptor_subtype != UX_HOST_CLASS_VIDEO_VS_FORMAT_STREAM_BASED && + descriptor_subtype != UX_HOST_CLASS_VIDEO_VS_FORMAT_DV && + descriptor_subtype != UX_HOST_CLASS_VIDEO_VS_FORMAT_MPEG2TS) + format_parameter -> ux_host_class_video_parameter_number_frame_descriptors = *(descriptor + 4); + else + format_parameter -> ux_host_class_video_parameter_number_frame_descriptors = 0; + + /* Save the GUID of frame descriptor. */ + format_parameter -> ux_host_class_video_parameter_format_guid = guid; + /* Save the address of this format. */ video -> ux_host_class_video_current_format_address = descriptor; - + /* And the current format index. */ video -> ux_host_class_video_current_format = format_parameter -> ux_host_class_video_parameter_format_requested; - + /* We are done here. */ return(UX_SUCCESS); - + } - break; - - } + } } - + /* Verify if the descriptor is still valid. */ if (descriptor_length > total_descriptor_length) { @@ -156,10 +186,10 @@ ULONG descriptor_subtype; _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_DESCRIPTOR_CORRUPTED); /* If trace is enabled, insert this event into the trace buffer. */ - //UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0) + UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0) return(UX_DESCRIPTOR_CORRUPTED); - } + } /* Jump to the next descriptor if we have not reached the end. */ descriptor += descriptor_length; @@ -175,4 +205,3 @@ ULONG descriptor_subtype; not find the right video device. */ return(UX_HOST_CLASS_VIDEO_WRONG_TYPE); } - diff --git a/common/usbx_host_classes/src/ux_host_class_video_frame_data_get.c b/common/usbx_host_classes/src/ux_host_class_video_frame_data_get.c index 3baf531..8e33eee 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_frame_data_get.c +++ b/common/usbx_host_classes/src/ux_host_class_video_frame_data_get.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Video Class */ /** */ @@ -29,63 +29,85 @@ #include "ux_host_class_video.h" #include "ux_host_stack.h" +/* + VS_FRAME_UNCOMPRESSED : wWidth @ 5, wHeight @ 7, dwDefaultFrameInterval @ 21, bFrameIntervalType @ 25, intervals @ 26 + VS_FRAME_MJPEG : wWidth @ 5, wHeight @ 7, dwDefaultFrameInterval @ 21, bFrameIntervalType @ 25, intervals @ 26 + VS_FRAME_FRAME_BASED : wWidth @ 5, wHeight @ 7, dwDefaultFrameInterval @ 17, bFrameIntervalType @ 21, intervals @ 26 + VS_FRAME_H264 : wWidth @ 4, wHeight @ 6, dwDefaultFrameInterval @ 39, bNumFrameIntervals @ 43, intervals @ 44 + VS_FRAME_VP8 : wWidth @ 4, wHeight @ 6, dwDefaultFrameInterval @ 26, bNumFrameIntervals @ 30, intervals @ 31 +*/ +static const UCHAR _ux_host_class_video_frame_descriptor_offsets[][5] = +{ + { 5, 7, 21, 25, 26 }, + { 5, 7, 17, 21, 26 }, + { 4, 6, 39, 43, 44 }, + { 4, 6, 26, 30, 31 }, +}; +#define _OFFSETS_UNCOMPRESSED_MJPEG 0 +#define _OFFSETS_FRAME_BASED 1 +#define _OFFSETS_H264 2 +#define _OFFSETS_VP8 3 + -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_host_class_video_frame_data_get PORTABLE C */ -/* 6.1 */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_host_class_video_frame_data_get PORTABLE C */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ -/* This function finds the frame data within the input terminal. */ -/* */ -/* INPUT */ -/* */ -/* video Pointer to video class */ -/* frame_data Frame request structure */ -/* */ -/* OUTPUT */ -/* */ -/* Completion Status */ -/* */ -/* CALLS */ -/* */ +/* */ +/* This function finds the frame data within the input terminal. */ +/* */ +/* INPUT */ +/* */ +/* video Pointer to video class */ +/* frame_data Frame request structure */ +/* */ +/* OUTPUT */ +/* */ +/* Completion Status */ +/* */ +/* CALLS */ +/* */ /* _ux_system_error_handler Log system error */ -/* _ux_utility_descriptor_parse Parse descriptor */ -/* */ -/* CALLED BY */ -/* */ -/* Video Class */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* _ux_utility_descriptor_parse Parse descriptor */ +/* */ +/* CALLED BY */ +/* */ +/* Video Class */ +/* */ +/* 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 Chaoqiong Xiao Modified comment(s), */ +/* improved extracted data, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_video_frame_data_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA *frame_parameter) { UCHAR *descriptor; -UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR frame_descriptor; ULONG total_descriptor_length; ULONG descriptor_length; ULONG descriptor_type; ULONG descriptor_subtype; - +UCHAR *field_offsets; + /* Get the descriptor to the selected format. */ descriptor = video -> ux_host_class_video_current_format_address; total_descriptor_length = video -> ux_host_class_video_length_formats; - + /* Descriptors are arranged in order. First FORMAT then FRAME. */ while (total_descriptor_length) { @@ -103,7 +125,7 @@ ULONG descriptor_subtype; _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_DESCRIPTOR_CORRUPTED); /* If trace is enabled, insert this event into the trace buffer. */ - //UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0) + UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0) return(UX_DESCRIPTOR_CORRUPTED); } @@ -115,37 +137,45 @@ ULONG descriptor_subtype; /* Process relative to descriptor type. */ switch (descriptor_subtype) { - - case UX_HOST_CLASS_VIDEO_VS_FRAME_UNCOMPRESSED : - case UX_HOST_CLASS_VIDEO_VS_FRAME_MJPEG : - case UX_HOST_CLASS_VIDEO_VS_FRAME_FRAME_BASED : - - /* We found a Frame descriptor. Is it the right one ? */ - if (frame_parameter -> ux_host_class_video_parameter_frame_requested == *(descriptor + 3)) - { - - /* Make the descriptor machine independent. */ - _ux_utility_descriptor_parse(descriptor, _ux_system_class_video_frame_descriptor_structure, - UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR_ENTRIES, (UCHAR *) &frame_descriptor); - - - /* Save the frame subtype. */ - frame_parameter -> ux_host_class_video_parameter_frame_subtype = descriptor_type; - - /* Save useful frame parameters. */ - frame_parameter -> ux_host_class_video_parameter_frame_width = frame_descriptor.wWidth; - frame_parameter -> ux_host_class_video_parameter_frame_height = frame_descriptor.wHeight; - frame_parameter -> ux_host_class_video_parameter_default_frame_interval = frame_descriptor.dwDefaultFrameInterval; - frame_parameter -> ux_host_class_video_parameter_frame_interval_type = frame_descriptor.bFrameIntervalType; - video -> ux_host_class_video_current_frame_address = descriptor; - video -> ux_host_class_video_current_frame_interval = frame_descriptor.dwDefaultFrameInterval; - /* We are done here. */ - return(UX_SUCCESS); - } - - break; - - } + + case UX_HOST_CLASS_VIDEO_VS_FRAME_UNCOMPRESSED : /* wWidth @ 5, wHeight @ 7, dwDefaultFrameInterval @ 21, bFrameIntervalType @ 25, intervals @ 26 */ + case UX_HOST_CLASS_VIDEO_VS_FRAME_MJPEG : /* wWidth @ 5, wHeight @ 7, dwDefaultFrameInterval @ 21, bFrameIntervalType @ 25, intervals @ 26 */ + case UX_HOST_CLASS_VIDEO_VS_FRAME_FRAME_BASED : /* wWidth @ 5, wHeight @ 7, dwDefaultFrameInterval @ 17, bFrameIntervalType @ 21, intervals @ 26 */ + case UX_HOST_CLASS_VIDEO_VS_FRAME_H264 : /* wWidth @ 4, wHeight @ 6, dwDefaultFrameInterval @ 39, bNumFrameIntervals @ 43, intervals @ 44 */ + case UX_HOST_CLASS_VIDEO_VS_FRAME_VP8 : /* wWidth @ 4, wHeight @ 6, dwDefaultFrameInterval @ 26, bNumFrameIntervals @ 30, intervals @ 31 */ + + /* We found a Frame descriptor. Is it the right one ? */ + if (frame_parameter -> ux_host_class_video_parameter_frame_requested == *(descriptor + 3)) + { + + /* Get key offsets. */ + if (descriptor_subtype == UX_HOST_CLASS_VIDEO_VS_FRAME_FRAME_BASED) + field_offsets = (UCHAR*)_ux_host_class_video_frame_descriptor_offsets[_OFFSETS_FRAME_BASED]; + else if (descriptor_subtype == UX_HOST_CLASS_VIDEO_VS_FRAME_H264) + field_offsets = (UCHAR*)_ux_host_class_video_frame_descriptor_offsets[_OFFSETS_H264]; + else if (descriptor_subtype == UX_HOST_CLASS_VIDEO_VS_FRAME_VP8) + field_offsets = (UCHAR*)_ux_host_class_video_frame_descriptor_offsets[_OFFSETS_VP8]; + else + field_offsets = (UCHAR*)_ux_host_class_video_frame_descriptor_offsets[_OFFSETS_UNCOMPRESSED_MJPEG]; + + /* Save the frame subtype. */ + frame_parameter -> ux_host_class_video_parameter_frame_subtype = descriptor_type; + + /* Save useful frame parameters. */ + frame_parameter -> ux_host_class_video_parameter_frame_width = _ux_utility_short_get(descriptor + field_offsets[0]); + frame_parameter -> ux_host_class_video_parameter_frame_height = _ux_utility_short_get(descriptor + field_offsets[1]); + frame_parameter -> ux_host_class_video_parameter_default_frame_interval = _ux_utility_long_get(descriptor + field_offsets[2]); + frame_parameter -> ux_host_class_video_parameter_frame_interval_type = *(descriptor + field_offsets[3]); + frame_parameter -> ux_host_class_video_parameter_frame_intervals = (descriptor + field_offsets[4]); + + video -> ux_host_class_video_current_frame_address = descriptor; + video -> ux_host_class_video_current_frame_interval = frame_parameter -> ux_host_class_video_parameter_default_frame_interval; + + /* We are done here. */ + return(UX_SUCCESS); + } + break; + } } /* Verify if the descriptor is still valid. */ @@ -156,10 +186,10 @@ ULONG descriptor_subtype; _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_DESCRIPTOR_CORRUPTED); /* If trace is enabled, insert this event into the trace buffer. */ - // UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0) + UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0) return(UX_DESCRIPTOR_CORRUPTED); - } + } /* Jump to the next descriptor if we have not reached the end. */ descriptor += descriptor_length; @@ -175,4 +205,3 @@ ULONG descriptor_subtype; not find the right video device. */ return(UX_HOST_CLASS_VIDEO_WRONG_TYPE); } - diff --git a/common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c b/common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c index 6215d67..dcd759b 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c +++ b/common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_video_frame_parameters_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -89,8 +89,9 @@ /* internal clean up, */ /* fixed standalone compile, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia, CQ Xiao Modified comment(s), */ +/* improved interval checking, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_video_frame_parameters_set(UX_HOST_CLASS_VIDEO *video, ULONG frame_format, ULONG width, ULONG height, ULONG frame_interval) @@ -98,7 +99,6 @@ UINT _ux_host_class_video_frame_parameters_set(UX_HOST_CLASS_VIDEO *video, ULON UX_HOST_CLASS_VIDEO_PARAMETER_FORMAT_DATA format_parameter; UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_DATA frame_parameter; -UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR frame_descriptor; ULONG format_index; ULONG frame_index; UINT status; @@ -174,22 +174,17 @@ ULONG max_payload_size; return(UX_HOST_CLASS_VIDEO_PARAMETER_ERROR); } - /* Make the descriptor machine independent. */ - _ux_utility_descriptor_parse(video -> ux_host_class_video_current_frame_address, - _ux_system_class_video_frame_descriptor_structure, - UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR_ENTRIES, (UCHAR *) &frame_descriptor); - /* Initial status for frame interval checking. */ status = UX_HOST_CLASS_VIDEO_PARAMETER_ERROR; /* Check the frame interval type. */ - if (frame_descriptor.bFrameIntervalType == 0) + if (frame_parameter.ux_host_class_video_parameter_frame_interval_type == 0) { /* Frame interval type is continuous. */ - min_frame_interval = _ux_utility_long_get(video -> ux_host_class_video_current_frame_address + 26); - max_frame_interval = _ux_utility_long_get(video -> ux_host_class_video_current_frame_address + 30); - frame_interval_step = _ux_utility_long_get(video -> ux_host_class_video_current_frame_address + 34); + min_frame_interval = _ux_utility_long_get(frame_parameter.ux_host_class_video_parameter_frame_intervals); + max_frame_interval = _ux_utility_long_get(frame_parameter.ux_host_class_video_parameter_frame_intervals + 4); + frame_interval_step = _ux_utility_long_get(frame_parameter.ux_host_class_video_parameter_frame_intervals + 8); /* Check if the frame interval is valid. */ if (frame_interval >= min_frame_interval && frame_interval <= max_frame_interval && @@ -206,11 +201,11 @@ ULONG max_payload_size; { /* Frame interval type is discrete. */ - for(i = 0; i < frame_descriptor.bFrameIntervalType; i++) + for(i = 0; i < frame_parameter.ux_host_class_video_parameter_frame_interval_type; i++) { /* Check if the requested frame interval is valid. */ - if (frame_interval == _ux_utility_long_get(video -> ux_host_class_video_current_frame_address + 26 + i * sizeof(ULONG))) + if (frame_interval == _ux_utility_long_get(frame_parameter.ux_host_class_video_parameter_frame_intervals + i * sizeof(ULONG))) { /* Save the frame interval. */ @@ -327,7 +322,7 @@ ULONG max_payload_size; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_frame_parameters_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -362,7 +357,7 @@ ULONG max_payload_size; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_frame_parameters_set(UX_HOST_CLASS_VIDEO *video, ULONG frame_format, ULONG width, ULONG height, ULONG frame_interval) diff --git a/common/usbx_host_classes/src/ux_host_class_video_ioctl.c b/common/usbx_host_classes/src/ux_host_class_video_ioctl.c index dfef16d..8ed0eff 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_ioctl.c +++ b/common/usbx_host_classes/src/ux_host_class_video_ioctl.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_video_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -83,8 +83,8 @@ /* reset indexes of requests */ /* ring when it is aborted, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_video_ioctl(UX_HOST_CLASS_VIDEO *video, ULONG ioctl_function, @@ -231,7 +231,7 @@ UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -262,7 +262,7 @@ UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_ioctl(UX_HOST_CLASS_VIDEO *video, ULONG ioctl_function, diff --git a/common/usbx_host_classes/src/ux_host_class_video_max_payload_get.c b/common/usbx_host_classes/src/ux_host_class_video_max_payload_get.c index 881b46d..6cd6d3b 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_max_payload_get.c +++ b/common/usbx_host_classes/src/ux_host_class_video_max_payload_get.c @@ -82,7 +82,7 @@ ULONG _ux_host_class_video_max_payload_get(UX_HOST_CLASS_VIDEO *video) /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_max_payload_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -111,7 +111,7 @@ ULONG _ux_host_class_video_max_payload_get(UX_HOST_CLASS_VIDEO *video) /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ ULONG _uxe_host_class_video_max_payload_get(UX_HOST_CLASS_VIDEO *video) diff --git a/common/usbx_host_classes/src/ux_host_class_video_read.c b/common/usbx_host_classes/src/ux_host_class_video_read.c index 26bb5d1..c392e4d 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_read.c +++ b/common/usbx_host_classes/src/ux_host_class_video_read.c @@ -150,7 +150,7 @@ UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *transfer_list; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -181,7 +181,7 @@ UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *transfer_list; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_read(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *video_transfer_request) diff --git a/common/usbx_host_classes/src/ux_host_class_video_start.c b/common/usbx_host_classes/src/ux_host_class_video_start.c index 6eb7e1d..a50f44c 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_start.c +++ b/common/usbx_host_classes/src/ux_host_class_video_start.c @@ -98,7 +98,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -127,7 +127,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_start(UX_HOST_CLASS_VIDEO *video) diff --git a/common/usbx_host_classes/src/ux_host_class_video_stop.c b/common/usbx_host_classes/src/ux_host_class_video_stop.c index cb79857..26c72c9 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_stop.c +++ b/common/usbx_host_classes/src/ux_host_class_video_stop.c @@ -159,7 +159,7 @@ UINT streaming_interface; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_stop PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -188,7 +188,7 @@ UINT streaming_interface; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_stop(UX_HOST_CLASS_VIDEO *video) diff --git a/common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c b/common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c index e34870d..e2b7833 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c +++ b/common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_video_transfer_buffer_add PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -88,8 +88,8 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* set pending on endpoint, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_video_transfer_buffer_add(UX_HOST_CLASS_VIDEO *video, UCHAR* buffer) @@ -189,7 +189,7 @@ ULONG packet_size; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_transfer_buffer_add PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -221,7 +221,7 @@ ULONG packet_size; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_transfer_buffer_add(UX_HOST_CLASS_VIDEO *video, UCHAR* buffer) diff --git a/common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c b/common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c index 316e31c..1f1c23b 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c +++ b/common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_video_transfer_buffers_add PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -97,8 +97,8 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* set pending on endpoint, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_host_class_video_transfer_buffers_add(UX_HOST_CLASS_VIDEO *video, UCHAR** buffers, ULONG num_buffers) @@ -236,7 +236,7 @@ UINT i; /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_transfer_buffers_add PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -270,7 +270,7 @@ UINT i; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_host_class_video_transfer_buffers_add(UX_HOST_CLASS_VIDEO *video, UCHAR** buffers, ULONG num_buffers) diff --git a/common/usbx_host_classes/src/ux_host_class_video_transfer_callback_set.c b/common/usbx_host_classes/src/ux_host_class_video_transfer_callback_set.c index 83f342b..c54750f 100644 --- a/common/usbx_host_classes/src/ux_host_class_video_transfer_callback_set.c +++ b/common/usbx_host_classes/src/ux_host_class_video_transfer_callback_set.c @@ -83,7 +83,7 @@ VOID _ux_host_class_video_transfer_callback_set(UX_HOST_CLASS_VIDEO *video, VOI /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_video_transfer_callback_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -115,7 +115,7 @@ VOID _ux_host_class_video_transfer_callback_set(UX_HOST_CLASS_VIDEO *video, VOI /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ VOID _uxe_host_class_video_transfer_callback_set(UX_HOST_CLASS_VIDEO *video, VOID (*callback_function)(UX_TRANSFER*)) |
