diff options
| author | Chaoqiong Xiao <[email protected]> | 2023-05-12 07:01:07 +0000 |
|---|---|---|
| committer | Chaoqiong Xiao <[email protected]> | 2023-05-12 07:01:07 +0000 |
| commit | ef2fa7717be8ab751fdfb5d3f91e24fbbaea8dd6 (patch) | |
| tree | e252f4e5e52617043c6d6ed59a6891a173d07781 /common | |
| parent | 3af3626c9b4b5fefbe4016582b896ad79287df62 (diff) | |
Update on 12 May 2023. Expand to see details.
8b59a1d4 Add support for Get String requests with 0 wIndex
106c1b06 Update cfs usage
2d45d315 Optimize SRAM for extracted USB descriptors
cf97e6e9 Fixed allocated buffer pointer checking issue.
6468c588 Guard basic types.
60b3a232 Update CFS usage
Diffstat (limited to 'common')
28 files changed, 824 insertions, 539 deletions
diff --git a/common/core/inc/ux_api.h b/common/core/inc/ux_api.h index e8b54d6..51c98db 100644 --- a/common/core/inc/ux_api.h +++ b/common/core/inc/ux_api.h @@ -134,6 +134,7 @@ /* added a new error code, */ /* resulting in version 6.2.1 */ /* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* optimized USB descriptors, */ /* added error checks support, */ /* resulting in version 6.x */ /* */ @@ -1814,12 +1815,13 @@ typedef struct UX_TRANSFER_STRUCT typedef struct UX_ENDPOINT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bEndpointAddress; - ULONG bmAttributes; - ULONG wMaxPacketSize; - ULONG bInterval; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bEndpointAddress; + UCHAR bmAttributes; + USHORT wMaxPacketSize; + UCHAR bInterval; + UCHAR _align_size[1]; } UX_ENDPOINT_DESCRIPTOR; #define UX_ENDPOINT_DESCRIPTOR_ENTRIES 6 @@ -1852,39 +1854,42 @@ typedef struct UX_ENDPOINT_STRUCT typedef struct UX_DEVICE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bcdUSB; - ULONG bDeviceClass; - ULONG bDeviceSubClass; - ULONG bDeviceProtocol; - ULONG bMaxPacketSize0; - ULONG idVendor; - ULONG idProduct; - ULONG bcdDevice; - ULONG iManufacturer; - ULONG iProduct; - ULONG iSerialNumber; - ULONG bNumConfigurations; + UCHAR bLength; + UCHAR bDescriptorType; + USHORT bcdUSB; + UCHAR bDeviceClass; + UCHAR bDeviceSubClass; + UCHAR bDeviceProtocol; + UCHAR bMaxPacketSize0; + USHORT idVendor; + USHORT idProduct; + USHORT bcdDevice; + UCHAR iManufacturer; + UCHAR iProduct; + UCHAR iSerialNumber; + UCHAR bNumConfigurations; + UCHAR _align_size[2]; } UX_DEVICE_DESCRIPTOR; #define UX_DEVICE_DESCRIPTOR_ENTRIES 14 #define UX_DEVICE_DESCRIPTOR_LENGTH 18 + /* Define USBX Device Qualifier Descriptor structure. */ typedef struct UX_DEVICE_QUALIFIER_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bcdUSB; - ULONG bDeviceClass; - ULONG bDeviceSubClass; - ULONG bDeviceProtocol; - ULONG bMaxPacketSize0; - ULONG bNumConfigurations; - ULONG bReserved; + UCHAR bLength; + UCHAR bDescriptorType; + USHORT bcdUSB; + UCHAR bDeviceClass; + UCHAR bDeviceSubClass; + UCHAR bDeviceProtocol; + UCHAR bMaxPacketSize0; + UCHAR bNumConfigurations; + UCHAR bReserved; + UCHAR _align_size[2]; } UX_DEVICE_QUALIFIER_DESCRIPTOR; #define UX_DEVICE_QUALIFIER_DESCRIPTOR_ENTRIES 9 @@ -1896,47 +1901,50 @@ typedef struct UX_DEVICE_QUALIFIER_DESCRIPTOR_STRUCT typedef struct UX_OTHER_SPEED_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG wTotalLength; - ULONG bNumInterfaces; - ULONG bConfigurationValue; - ULONG iConfiguration; - ULONG bmAttributes; + UCHAR bLength; + UCHAR bDescriptorType; + USHORT wTotalLength; + UCHAR bNumInterfaces; + UCHAR bConfigurationValue; + UCHAR iConfiguration; + UCHAR bmAttributes; ULONG MaxPower; } UX_OTHER_SPEED_DESCRIPTOR; #define UX_OTHER_SPEED_DESCRIPTOR_ENTRIES 8 #define UX_OTHER_SPEED_DESCRIPTOR_LENGTH 9 + /* Define USBX OTG Descriptor structure. */ typedef struct UX_OTG_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bmAttributes; - ULONG bcdOTG; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bmAttributes; + UCHAR _align_bcdOTG[1]; + USHORT bcdOTG; + UCHAR _algin_size[2]; } UX_OTG_DESCRIPTOR; #define UX_OTG_DESCRIPTOR_ENTRIES 4 #define UX_OTG_DESCRIPTOR_LENGTH 5 + /* Define USBX Interface Association Descriptor structure. */ typedef struct UX_INTERFACE_ASSOCIATION_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bFirstInterface; - ULONG bInterfaceCount; - ULONG bFunctionClass; - ULONG bFunctionSubClass; - ULONG bFunctionProtocol; - ULONG iFunction; - + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bFirstInterface; + UCHAR bInterfaceCount; + UCHAR bFunctionClass; + UCHAR bFunctionSubClass; + UCHAR bFunctionProtocol; + UCHAR iFunction; } UX_INTERFACE_ASSOCIATION_DESCRIPTOR; #define UX_INTERFACE_ASSOCIATION_DESCRIPTOR_ENTRIES 8 @@ -2060,16 +2068,17 @@ typedef struct UX_DEVICE_STRUCT typedef struct UX_CONFIGURATION_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG wTotalLength; - ULONG bNumInterfaces; - ULONG bConfigurationValue; - ULONG iConfiguration; - ULONG bmAttributes; + UCHAR bLength; + UCHAR bDescriptorType; + USHORT wTotalLength; + UCHAR bNumInterfaces; + UCHAR bConfigurationValue; + UCHAR iConfiguration; + UCHAR bmAttributes; ULONG MaxPower; } UX_CONFIGURATION_DESCRIPTOR; + #define UX_CONFIGURATION_DESCRIPTOR_ENTRIES 8 #define UX_CONFIGURATION_DESCRIPTOR_LENGTH 9 @@ -2107,15 +2116,16 @@ typedef struct UX_CONFIGURATION_STRUCT typedef struct UX_INTERFACE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bInterfaceNumber; - ULONG bAlternateSetting; - ULONG bNumEndpoints; - ULONG bInterfaceClass; - ULONG bInterfaceSubClass; - ULONG bInterfaceProtocol; - ULONG iInterface; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bInterfaceNumber; + UCHAR bAlternateSetting; + UCHAR bNumEndpoints; + UCHAR bInterfaceClass; + UCHAR bInterfaceSubClass; + UCHAR bInterfaceProtocol; + UCHAR iInterface; + UCHAR _align_size[3]; } UX_INTERFACE_DESCRIPTOR; #define UX_INTERFACE_DESCRIPTOR_ENTRIES 9 @@ -2153,9 +2163,9 @@ typedef struct UX_INTERFACE_STRUCT typedef struct UX_STRING_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bString[1]; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bString[2]; } UX_STRING_DESCRIPTOR; #define UX_STRING_DESCRIPTOR_ENTRIES 3 @@ -2166,10 +2176,11 @@ typedef struct UX_STRING_DESCRIPTOR_STRUCT typedef struct UX_BOS_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG wTotalLength; - ULONG bNumDeviceCaps; + UCHAR bLength; + UCHAR bDescriptorType; + USHORT wTotalLength; + UCHAR bNumDeviceCaps; + UCHAR _align_size[3]; } UX_BOS_DESCRIPTOR; #define UX_BOS_DESCRIPTOR_ENTRIES 4 @@ -2180,9 +2191,10 @@ typedef struct UX_BOS_DESCRIPTOR_STRUCT typedef struct UX_USB_2_0_EXTENSION_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDevCapabilityType; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDevCapabilityType; + UCHAR _align_bmAttributes[1]; ULONG bmAttributes; } UX_USB_2_0_EXTENSION_DESCRIPTOR; @@ -2194,14 +2206,14 @@ typedef struct UX_USB_2_0_EXTENSION_DESCRIPTOR_STRUCT typedef struct UX_CONTAINER_ID_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDevCapabilityType; - ULONG bReserved; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDevCapabilityType; + UCHAR bReserved; ULONG ContainerID[4]; } UX_CONTAINER_ID_DESCRIPTOR; -#define UX_CONTAINER_ID_DESCRIPTOR_ENTRIES 5 +#define UX_CONTAINER_ID_DESCRIPTOR_ENTRIES 8 #define UX_CONTAINER_ID_DESCRIPTOR_LENGTH 20 @@ -2210,17 +2222,20 @@ typedef struct UX_CONTAINER_ID_DESCRIPTOR_STRUCT typedef struct UX_DFU_FUNCTIONAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bmAttributes; - ULONG wDetachTimeOut; - ULONG wTransferSize; - ULONG bcdDFUVersion; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bmAttributes; + UCHAR _align_wDetachTimeOut[1]; + USHORT wDetachTimeOut; + USHORT wTransferSize; + USHORT bcdDFUVersion; + UCHAR _align_size[2]; } UX_DFU_FUNCTIONAL_DESCRIPTOR; #define UX_DFU_FUNCTIONAL_DESCRIPTOR_ENTRIES 6 #define UX_DFU_FUNCTIONAL_DESCRIPTOR_LENGTH 9 + /* Define USBX Host Controller structure. */ typedef struct UX_HCD_STRUCT diff --git a/common/core/inc/ux_user_sample.h b/common/core/inc/ux_user_sample.h index f974505..216f3ec 100644 --- a/common/core/inc/ux_user_sample.h +++ b/common/core/inc/ux_user_sample.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* ux_user.h PORTABLE C */ -/* 6.2.1 */ +/* 6.x */ /* */ /* AUTHOR */ /* */ @@ -99,6 +99,10 @@ /* added option to enable */ /* basic USBX error checking, */ /* resulting in version 6.2.1 */ +/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* added option for get string */ +/* requests with zero wIndex, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -224,6 +228,10 @@ #define UX_SLAVE_REQUEST_DATA_MAX_LENGTH (1024 * 2) +/* Defined, this enables processing of Get String Descriptor requests with zero Language ID. + The first language ID in the language ID framwork will be used if the request has a zero + Language ID. */ +/* #define UX_DEVICE_ENABLE_GET_STRING_WITH_ZERO_LANGUAGE_ID */ /* Defined, this value includes code to handle storage Multi-Media Commands (MMC). E.g., DVD-ROM. */ diff --git a/common/core/inc/ux_utility.h b/common/core/inc/ux_utility.h index 39bd50d..8b42fae 100644 --- a/common/core/inc/ux_utility.h +++ b/common/core/inc/ux_utility.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_utility.h PORTABLE C */ -/* 6.1.12 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -57,6 +57,10 @@ /* added macros for RTOS calls,*/ /* fixed OHCI PRSC issue, */ /* resulting in version 6.1.12 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* added new function to check */ +/* parsed size of descriptor, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -70,6 +74,8 @@ VOID _ux_utility_descriptor_parse(UCHAR * raw_descriptor, UCHAR * de UINT descriptor_entries, UCHAR * descriptor); VOID _ux_utility_descriptor_pack(UCHAR * descriptor, UCHAR * descriptor_structure, UINT descriptor_entries, UCHAR * raw_descriptor); +ULONG _ux_utility_descriptor_parse_size(UCHAR * descriptor_structure, UINT descriptor_entries, UINT size_align_mask); + ULONG _ux_utility_long_get(UCHAR * address); VOID _ux_utility_long_put(UCHAR * address, ULONG value); VOID _ux_utility_long_put_big_endian(UCHAR * address, ULONG value); diff --git a/common/core/src/ux_device_stack_descriptor_send.c b/common/core/src/ux_device_stack_descriptor_send.c index f8dae5a..4ce10a8 100644 --- a/common/core/src/ux_device_stack_descriptor_send.c +++ b/common/core/src/ux_device_stack_descriptor_send.c @@ -91,6 +91,8 @@ /* resulting in version 6.1.11 */ /* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ /* moved compile option check, */ +/* added support for get string*/ +/* requests with zero wIndex, */ /* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -399,6 +401,16 @@ ULONG string_length; } else { +#ifdef UX_DEVICE_ENABLE_GET_STRING_WITH_ZERO_LANGUAGE_ID + + /* Check if the language ID is zero. */ + if (request_index == 0) + { + + /* Get the first language ID in the language ID framework. */ + request_index = _ux_utility_short_get(_ux_system_slave -> ux_system_slave_language_id_framework); + } +#endif /* The host wants a specific string index returned. Get the string framework pointer and length. */ diff --git a/common/core/src/ux_system_initialize.c b/common/core/src/ux_system_initialize.c index f6f7202..06fc65e 100644 --- a/common/core/src/ux_system_initialize.c +++ b/common/core/src/ux_system_initialize.c @@ -69,7 +69,7 @@ UCHAR _ux_system_container_id_descriptor_structure[] = {1,1 /* FUNCTION RELEASE */ /* */ /* _ux_system_initialize PORTABLE C */ -/* 6.1.10 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -115,6 +115,10 @@ UCHAR _ux_system_container_id_descriptor_structure[] = {1,1 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* added UX_ASSERT check for */ +/* STD descriptor parse size, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size, @@ -313,6 +317,19 @@ UINT _uxe_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memo VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size) { + /* Compiling option check of descriptors structs. */ + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_endpoint_descriptor_structure, UX_ENDPOINT_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_ENDPOINT_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_device_descriptor_structure, UX_DEVICE_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_DEVICE_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_configuration_descriptor_structure, UX_CONFIGURATION_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_CONFIGURATION_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_interface_descriptor_structure, UX_INTERFACE_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_INTERFACE_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_interface_association_descriptor_structure, UX_INTERFACE_ASSOCIATION_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_INTERFACE_ASSOCIATION_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_string_descriptor_structure, UX_STRING_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_STRING_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_dfu_functional_descriptor_structure, UX_DFU_FUNCTIONAL_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_DFU_FUNCTIONAL_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_bos_descriptor_structure, UX_BOS_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_BOS_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_usb_2_0_extension_descriptor_structure, UX_USB_2_0_EXTENSION_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_USB_2_0_EXTENSION_DESCRIPTOR)); + UX_ASSERT((_ux_utility_descriptor_parse_size(_ux_system_container_id_descriptor_structure, UX_CONTAINER_ID_DESCRIPTOR_ENTRIES, 0x3u)) == sizeof(UX_CONTAINER_ID_DESCRIPTOR)); + + /* Sanity check. */ if ((regular_memory_pool_start == UX_NULL) || (regular_memory_size == 0)) return(UX_INVALID_PARAMETER); diff --git a/common/core/src/ux_utility_descriptor_pack.c b/common/core/src/ux_utility_descriptor_pack.c index 574c56c..bc85c55 100644 --- a/common/core/src/ux_utility_descriptor_pack.c +++ b/common/core/src/ux_utility_descriptor_pack.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Utility */ /** */ @@ -28,50 +28,53 @@ #include "ux_api.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_utility_descriptor_pack PORTABLE C */ -/* 6.1 */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_utility_descriptor_pack PORTABLE C */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ +/* */ /* This function will pack an application structure into a USB */ -/* descriptor. */ -/* */ -/* INPUT */ -/* */ -/* descriptor Pointer to the unpacked */ +/* descriptor. */ +/* */ +/* INPUT */ +/* */ +/* descriptor Pointer to the unpacked */ /* descriptor */ /* descriptor_structure Components of the descriptor */ -/* descriptor_entries Number of entries in the */ +/* descriptor_entries Number of entries in the */ /* descriptor */ /* raw_descriptor Pointer to packed descriptor */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* _ux_utility_long_put Put 32-bit value */ /* _ux_utility_short_put Put 16-bit value */ -/* */ -/* CALLED BY */ -/* */ -/* USBX Components */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* USBX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* optimized USB descriptors, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ VOID _ux_utility_descriptor_pack(UCHAR * descriptor, UCHAR * descriptor_structure, @@ -90,27 +93,37 @@ VOID _ux_utility_descriptor_pack(UCHAR * descriptor, UCHAR * descriptor_structu insert it into the target descriptor. */ case 4: + /* Increase address so it's aligned. */ + while((ALIGN_TYPE)descriptor & 3u) + descriptor++; + + /* Put the DW. */ _ux_utility_long_put(raw_descriptor, *((ULONG *) descriptor)); raw_descriptor += 4; - break; + descriptor += 4; + break; case 2: - _ux_utility_short_put(raw_descriptor, (USHORT)*((ULONG *) descriptor)); + /* Increase address so it's aligned. */ + while((ALIGN_TYPE)descriptor & 1u) + descriptor++; + + /* Put the Word. */ + _ux_utility_short_put(raw_descriptor, (USHORT)*((USHORT *) descriptor)); raw_descriptor += 2; - break; + descriptor += 2; + break; default: - *raw_descriptor = (UCHAR) *((ULONG *) descriptor); + /* Put the byte. */ + *raw_descriptor = (UCHAR) *((UCHAR *) descriptor); raw_descriptor++; + descriptor++; } - - /* Add the size of the component to the destination. */ - descriptor += 4; } /* Return to caller. */ return; } - diff --git a/common/core/src/ux_utility_descriptor_parse.c b/common/core/src/ux_utility_descriptor_parse.c index ff23559..86bbd85 100644 --- a/common/core/src/ux_utility_descriptor_parse.c +++ b/common/core/src/ux_utility_descriptor_parse.c @@ -12,8 +12,8 @@ /**************************************************************************/ /**************************************************************************/ -/** */ -/** USBX Component */ +/** */ +/** USBX Component */ /** */ /** Utility */ /** */ @@ -28,50 +28,53 @@ #include "ux_api.h" -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* _ux_utility_descriptor_parse PORTABLE C */ -/* 6.1 */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_utility_descriptor_parse PORTABLE C */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ -/* */ +/* */ /* This function will unpack a USB descriptor from the bus into a */ -/* memory aligned structure. */ -/* */ -/* INPUT */ -/* */ +/* memory aligned structure. */ +/* */ +/* INPUT */ +/* */ /* raw_descriptor Pointer to packed descriptor */ /* descriptor_structure Components of the descriptor */ -/* descriptor_entries Number of entries in the */ +/* descriptor_entries Number of entries in the */ /* descriptor */ -/* descriptor Pointer to the unpacked */ +/* descriptor Pointer to the unpacked */ /* descriptor */ -/* */ -/* OUTPUT */ -/* */ +/* */ +/* OUTPUT */ +/* */ /* None */ -/* */ -/* CALLS */ -/* */ +/* */ +/* CALLS */ +/* */ /* _ux_utility_long_get Get 32-bit value */ /* _ux_utility_short_get Get 16-bit value */ -/* */ -/* CALLED BY */ -/* */ -/* USBX Components */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ +/* */ +/* CALLED BY */ +/* */ +/* USBX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* optimized USB descriptors, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ VOID _ux_utility_descriptor_parse(UCHAR * raw_descriptor, UCHAR * descriptor_structure, @@ -90,27 +93,126 @@ VOID _ux_utility_descriptor_parse(UCHAR * raw_descriptor, UCHAR * descriptor_st insert it into the target descriptor. */ case 4: + /* Padding zeros so address is aligned. */ + while((ALIGN_TYPE) descriptor & 3u) + *descriptor++ = 0; + + /* Save the DW. */ *((ULONG *) descriptor) = _ux_utility_long_get(raw_descriptor); raw_descriptor += 4; - break; + descriptor += 4; + break; case 2: - *((ULONG *) descriptor) = (ULONG) _ux_utility_short_get(raw_descriptor); + /* Padding zeros so address is aligned. */ + while((ALIGN_TYPE) descriptor & 1u) + *descriptor++ = 0; + + /* Save the word. */ + *((USHORT *) descriptor) = (USHORT) _ux_utility_short_get(raw_descriptor); raw_descriptor += 2; - break; + descriptor += 2; + break; default: - *((ULONG *) descriptor) = (ULONG) *raw_descriptor; + /* Save the byte. */ + *((UCHAR *) descriptor) = (UCHAR) *raw_descriptor; raw_descriptor++; + descriptor ++; } - - /* Add the size of the component to the destination. */ - descriptor += 4; } /* Return to caller. */ return; } +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _ux_utility_descriptor_parse_size PORTABLE C */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Chaoqiong Xiao, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function will calculate the size of a parsed USB descriptor. */ +/* */ +/* INPUT */ +/* */ +/* descriptor_structure Components of the descriptor */ +/* descriptor_entries Number of entries in the */ +/* descriptor */ +/* size_align_mask Size alignment mask */ +/* */ +/* OUTPUT */ +/* */ +/* size Size of the parsed descriptor */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* USBX Components */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* */ +/**************************************************************************/ +ULONG _ux_utility_descriptor_parse_size(UCHAR * descriptor_structure, UINT descriptor_entries, UINT size_align_mask) +{ + +ULONG size = 0; +ULONG entry_size; + + /* Loop on all the entries in this descriptor. */ + while(descriptor_entries--) + { + + /* Get entry size. */ + entry_size = (ULONG)*descriptor_structure ++; + + /* Check the size then build the component from the source and + insert it into the target descriptor. */ + switch(entry_size) + { + + case 4: /* Fall through. */ + case 2: + + /* Padding zeros so address is aligned. */ + while(size & (entry_size - 1)) + size++; + + /* Add to the size. */ + size += entry_size; + break; + + case 1: + + /* Add to the size. */ + size += 1; + break; + + default: + + /* Invalid entry size. */ + return(0); + } + } + + /* Align the size. */ + size = (size + size_align_mask) & (~size_align_mask); + + /* Return the size. */ + return(size); +} diff --git a/common/core/src/ux_utility_memory_allocate.c b/common/core/src/ux_utility_memory_allocate.c index 48d8620..547b03d 100644 --- a/common/core/src/ux_utility_memory_allocate.c +++ b/common/core/src/ux_utility_memory_allocate.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_utility_memory_allocate PORTABLE C */ -/* 6.1.11 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -77,6 +77,9 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* fixed issue in 64-bit env, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ VOID *_ux_utility_memory_allocate(ULONG memory_alignment, ULONG memory_cache_flag, @@ -306,7 +309,7 @@ ALIGN_TYPE int_memory_buffer; { /* Setup the leftover memory block. */ - leftover_memory_block = (UX_MEMORY_BLOCK *) (((ALIGN_TYPE) new_memory_block + sizeof(UX_MEMORY_BLOCK) + memory_size_requested) & 0xFFFFFFFFu); + leftover_memory_block = (UX_MEMORY_BLOCK *) (((ALIGN_TYPE) new_memory_block + sizeof(UX_MEMORY_BLOCK) + memory_size_requested)); leftover_memory_block -> ux_memory_block_next = new_memory_block -> ux_memory_block_next; leftover_memory_block -> ux_memory_block_previous = new_memory_block; leftover_memory_block -> ux_memory_block_size = leftover - (ULONG)sizeof(UX_MEMORY_BLOCK); diff --git a/common/usbx_device_classes/inc/ux_device_class_audio10.h b/common/usbx_device_classes/inc/ux_device_class_audio10.h index 355821d..f0080dd 100644 --- a/common/usbx_device_classes/inc/ux_device_class_audio10.h +++ b/common/usbx_device_classes/inc/ux_device_class_audio10.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_device_class_audio10.h PORTABLE C */ -/* 6.2.1 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -57,6 +57,9 @@ /* added error checks support, */ /* fixed a macro name, */ /* resulting in version 6.2.1 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* optimized USB descriptors, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -166,94 +169,105 @@ extern "C" { typedef struct UX_DEVICE_CLASS_AUDIO10_AC_HEADER1_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bcdADC; - ULONG wTotalLength; - ULONG bInCollection; - ULONG baInterfaceNr1; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR _align_bcdADC[1]; + USHORT bcdADC; + USHORT wTotalLength; + UCHAR bInCollection; + UCHAR baInterfaceNr1; + UCHAR _align_size[2]; } UX_DEVICE_CLASS_AUDIO10_AC_HEADER1_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO10_AC_HEADER2_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bcdADC; - ULONG wTotalLength; - ULONG bInCollection; - ULONG baInterfaceNr1; - ULONG baInterfaceNr2; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR _align_bcdADC[1]; + USHORT bcdADC; + USHORT wTotalLength; + UCHAR bInCollection; + UCHAR baInterfaceNr1; + UCHAR baInterfaceNr2; + UCHAR _align_size[1]; } UX_DEVICE_CLASS_AUDIO10_AC_HEADER2_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO10_AC_HEADER3_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bcdADC; - ULONG wTotalLength; - ULONG bInCollection; - ULONG baInterfaceNr1; - ULONG baInterfaceNr2; - ULONG baInterfaceNr3; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR _align_bcdADC[1]; + USHORT bcdADC; + USHORT wTotalLength; + UCHAR bInCollection; + UCHAR baInterfaceNr1; + UCHAR baInterfaceNr2; + UCHAR baInterfaceNr3; + UCHAR _align_size[2]; } UX_DEVICE_CLASS_AUDIO10_AC_HEADER3_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO10_AC_HEADER6_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bcdADC; - ULONG wTotalLength; - ULONG bInCollection; - ULONG baInterfaceNr1; - ULONG baInterfaceNr2; - ULONG baInterfaceNr3; - ULONG baInterfaceNr4; - ULONG baInterfaceNr5; - ULONG baInterfaceNr6; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR _align_bcdADC[1]; + USHORT bcdADC; + USHORT wTotalLength; + UCHAR bInCollection; + UCHAR baInterfaceNr1; + UCHAR baInterfaceNr2; + UCHAR baInterfaceNr3; + UCHAR baInterfaceNr4; + UCHAR baInterfaceNr5; + UCHAR baInterfaceNr6; + UCHAR _align_size[1]; } UX_DEVICE_CLASS_AUDIO10_AC_HEADER6_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO10_AC_HEADER7_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bcdADC; - ULONG wTotalLength; - ULONG bInCollection; - ULONG baInterfaceNr1; - ULONG baInterfaceNr2; - ULONG baInterfaceNr3; - ULONG baInterfaceNr4; - ULONG baInterfaceNr5; - ULONG baInterfaceNr6; - ULONG baInterfaceNr7; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR _align_bcdADC[1]; + USHORT bcdADC; + USHORT wTotalLength; + UCHAR bInCollection; + UCHAR baInterfaceNr1; + UCHAR baInterfaceNr2; + UCHAR baInterfaceNr3; + UCHAR baInterfaceNr4; + UCHAR baInterfaceNr5; + UCHAR baInterfaceNr6; + UCHAR baInterfaceNr7; } UX_DEVICE_CLASS_AUDIO10_AC_HEADER7_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO10_AC_HEADER8_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bcdADC; - ULONG wTotalLength; - ULONG bInCollection; - ULONG baInterfaceNr1; - ULONG baInterfaceNr2; - ULONG baInterfaceNr3; - ULONG baInterfaceNr4; - ULONG baInterfaceNr5; - ULONG baInterfaceNr6; - ULONG baInterfaceNr7; - ULONG baInterfaceNr8; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR _align_bcdADC[1]; + USHORT bcdADC; + USHORT wTotalLength; + UCHAR bInCollection; + UCHAR baInterfaceNr1; + UCHAR baInterfaceNr2; + UCHAR baInterfaceNr3; + UCHAR baInterfaceNr4; + UCHAR baInterfaceNr5; + UCHAR baInterfaceNr6; + UCHAR baInterfaceNr7; + UCHAR baInterfaceNr8; + UCHAR _align_size[3]; } UX_DEVICE_CLASS_AUDIO10_AC_HEADER8_DESCRIPTOR; @@ -262,16 +276,16 @@ typedef struct UX_DEVICE_CLASS_AUDIO10_AC_HEADER8_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO10_AC_INPUT_TERMINAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bTerminalID; - ULONG wTerminalType; - ULONG bAssocTerminal; - ULONG bNrChannels; - ULONG wChannelConfig; - ULONG iChannelNames; - ULONG iTerminal; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bTerminalID; + USHORT wTerminalType; + UCHAR bAssocTerminal; + UCHAR bNrChannels; + USHORT wChannelConfig; + UCHAR iChannelNames; + UCHAR iTerminal; } UX_DEVICE_CLASS_AUDIO10_AC_INPUT_TERMINAL_DESCRIPTOR; @@ -280,14 +294,15 @@ typedef struct UX_DEVICE_CLASS_AUDIO10_AC_INPUT_TERMINAL_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO10_AC_OUTPUT_TERMINAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bTerminalID; - ULONG wTerminalType; - ULONG bAssocTerminal; - ULONG bSourceID; - ULONG iTerminal; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bTerminalID; + USHORT wTerminalType; + UCHAR bAssocTerminal; + UCHAR bSourceID; + UCHAR iTerminal; + UCHAR _align_size[3]; } UX_DEVICE_CLASS_AUDIO10_AC_OUTPUT_TERMINAL_DESCRIPTOR; @@ -296,12 +311,13 @@ typedef struct UX_DEVICE_CLASS_AUDIO10_AC_OUTPUT_TERMINAL_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO10_AC_FEATURE_UNIT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; - ULONG bControlSize; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR bControlSize; + UCHAR _align_bmaControls[2]; ULONG bmaControls; } UX_DEVICE_CLASS_AUDIO10_AC_FEATURE_UNIT_DESCRIPTOR; @@ -311,12 +327,13 @@ typedef struct UX_DEVICE_CLASS_AUDIO10_AC_FEATURE_UNIT_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO10_AS_INTERFACE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bTerminalLink; - ULONG bDelay; - ULONG wFormatTag; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bTerminalLink; + UCHAR bDelay; + UCHAR _align_wFormatTag[1]; + USHORT wFormatTag; } UX_DEVICE_CLASS_AUDIO10_AS_INTERFACE_DESCRIPTOR; @@ -325,14 +342,14 @@ typedef struct UX_DEVICE_CLASS_AUDIO10_AS_INTERFACE_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO10_AS_TYPE_I_FORMAT_TYPE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bFormatType; - ULONG bNrChannels; - ULONG bSubframeSize; - ULONG bBitResolution; - ULONG bSamFreqType; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bFormatType; + UCHAR bNrChannels; + UCHAR bSubframeSize; + UCHAR bBitResolution; + UCHAR bSamFreqType; ULONG SamplingFrequency; } UX_DEVICE_CLASS_AUDIO10_AS_TYPE_I_FORMAT_TYPE_DESCRIPTOR; @@ -349,25 +366,27 @@ typedef struct UX_DEVICE_CLASS_AUDIO10_AS_TYPE_I_FORMAT_TYPE_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO10_AS_ENDPOINT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bmAttributes; - ULONG wMaxPacketSize; - ULONG bInterval; - ULONG bRefresh; - ULONG bSynchAddress; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bmAttributes; + USHORT wMaxPacketSize; + UCHAR bInterval; + UCHAR bRefresh; + UCHAR bSynchAddress; + UCHAR _align_size[3]; } UX_DEVICE_CLASS_AUDIO10_AS_ENDPOINT_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO10_AS_DATA_ENDPOINT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bmAttributes; - ULONG bLockDelayUnits; - ULONG wLockDelay; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bmAttributes; + UCHAR bLockDelayUnits; + UCHAR _align_wLockDelay[1]; + USHORT wLockDelay; } UX_DEVICE_CLASS_AUDIO10_AS_DATA_ENDPOINT_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO10_CONTROL_STRUCT diff --git a/common/usbx_device_classes/inc/ux_device_class_audio20.h b/common/usbx_device_classes/inc/ux_device_class_audio20.h index 7c2da21..1a1c075 100644 --- a/common/usbx_device_classes/inc/ux_device_class_audio20.h +++ b/common/usbx_device_classes/inc/ux_device_class_audio20.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_device_class_audio20.h PORTABLE C */ -/* 6.2.1 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -58,6 +58,9 @@ /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* added error checks support, */ /* resulting in version 6.2.1 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* optimized USB descriptors, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -210,12 +213,15 @@ extern "C" { typedef struct UX_DEVICE_CLASS_AUDIO20_AC_HEADER_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bcdADC; - ULONG bCategory; - ULONG wTotalLength; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR _align_bcdADC[1]; + USHORT bcdADC; + UCHAR bCategory; + UCHAR _align_wTotalLength[1]; + USHORT wTotalLength; + UCHAR _align_bmControls[2]; ULONG bmControls; } UX_DEVICE_CLASS_AUDIO20_AC_HEADER_DESCRIPTOR; @@ -225,14 +231,14 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_HEADER_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_CLOCK_SOURCE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bClockID; - ULONG bmAttributes; - ULONG bmControls; - ULONG bAssocTerminal; - ULONG iClockSource; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bClockID; + UCHAR bmAttributes; + UCHAR bmControls; + UCHAR bAssocTerminal; + UCHAR iClockSource; } UX_DEVICE_CLASS_AUDIO20_AC_CLOCK_SOURCE_DESCRIPTOR; @@ -241,18 +247,21 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_CLOCK_SOURCE_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_INPUT_TERMINAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bTerminalID; - ULONG wTerminalType; - ULONG bAssocTerminal; - ULONG bCSourceID; - ULONG bNrChannels; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bTerminalID; + USHORT wTerminalType; + UCHAR bAssocTerminal; + UCHAR bCSourceID; + UCHAR bNrChannels; + UCHAR _align_bmChannelConfig[3]; ULONG bmChannelConfig; - ULONG iChannelNames; - ULONG bmControls; - ULONG iTerminal; + UCHAR iChannelNames; + UCHAR _align_bmControls[1]; + USHORT bmControls; + UCHAR iTerminal; + UCHAR _align_size[3]; } UX_DEVICE_CLASS_AUDIO20_AC_INPUT_TERMINAL_DESCRIPTOR; @@ -261,16 +270,18 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_INPUT_TERMINAL_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_OUTPUT_TERMINAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bTerminalID; - ULONG wTerminalType; - ULONG bAssocTerminal; - ULONG bSourceID; - ULONG bCSourceID; - ULONG bmControls; - ULONG iTerminal; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bTerminalID; + USHORT wTerminalType; + UCHAR bAssocTerminal; + UCHAR bSourceID; + UCHAR bCSourceID; + UCHAR _align_bmControls[1]; + USHORT bmControls; + UCHAR iTerminal; + UCHAR _align_size[3]; } UX_DEVICE_CLASS_AUDIO20_AC_OUTPUT_TERMINAL_DESCRIPTOR; @@ -279,22 +290,24 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_OUTPUT_TERMINAL_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR _align_bmaControls[3]; ULONG bmaControls; } UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT1_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR _align_bmaControls[3]; ULONG bmaControls0; ULONG bmaControls1; } UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT1_DESCRIPTOR; @@ -302,11 +315,12 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT1_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT2_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR _align_bmaControls[3]; ULONG bmaControls0; ULONG bmaControls1; ULONG bmaControls2; @@ -315,11 +329,12 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT2_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT3_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR _align_bmaControls[3]; ULONG bmaControls0; ULONG bmaControls1; ULONG bmaControls2; @@ -329,11 +344,12 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT3_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT6_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR _align_bmaControls[3]; ULONG bmaControls0; ULONG bmaControls1; ULONG bmaControls2; @@ -346,11 +362,12 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT6_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT7_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR _align_bmaControls[3]; ULONG bmaControls0; ULONG bmaControls1; ULONG bmaControls2; @@ -364,11 +381,12 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT7_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT8_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR _align_bmaControls[3]; ULONG bmaControls0; ULONG bmaControls1; ULONG bmaControls2; @@ -386,16 +404,19 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AC_FEATURE_UNIT8_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AS_INTERFACE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bTerminalLink; - ULONG bmControls; - ULONG bFormatType; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bTerminalLink; + UCHAR bmControls; + UCHAR bFormatType; + UCHAR _align_bmFormats[2]; ULONG bmFormats; - ULONG bNrChannels; + UCHAR bNrChannels; + UCHAR _align_bmChannelConfig[3]; ULONG bmChannelConfig; - ULONG iChannelNames; + UCHAR iChannelNames; + UCHAR _align_size[3]; } UX_DEVICE_CLASS_AUDIO20_AS_INTERFACE_DESCRIPTOR; @@ -404,12 +425,13 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AS_INTERFACE_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AS_TYPE_I_FORMAT_TYPE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bFormatType; - ULONG bSubslotSize; - ULONG bBitResolution; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bFormatType; + UCHAR bSubslotSize; + UCHAR bBitResolution; + UCHAR _align_size[2]; } UX_DEVICE_CLASS_AUDIO20_AS_TYPE_I_FORMAT_TYPE_DESCRIPTOR; @@ -418,13 +440,13 @@ typedef struct UX_DEVICE_CLASS_AUDIO20_AS_TYPE_I_FORMAT_TYPE_DESCRIPTOR_STRUCT typedef struct UX_DEVICE_CLASS_AUDIO20_AS_DATA_ENDPOINT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bmAttributes; - ULONG bmControls; - ULONG bLockDelayUnits; - ULONG wLockDelay; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bmAttributes; + UCHAR bmControls; + UCHAR bLockDelayUnits; + USHORT wLockDelay; } UX_DEVICE_CLASS_AUDIO20_AS_DATA_ENDPOINT_DESCRIPTOR; typedef struct UX_DEVICE_CLASS_AUDIO20_CONTROL_STRUCT 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 c29b7c8..2405ab3 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.1.12 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -57,6 +57,9 @@ /* added feedback support, */ /* added Audio 2.0 support, */ /* resulting in version 6.1.12 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* optimized USB descriptors, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -308,14 +311,14 @@ extern "C" { typedef struct UX_HOST_CLASS_AUDIO_INTERFACE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bFormatType; - ULONG bNrChannels; - ULONG bSubframeSize; - ULONG bBitResolution; - ULONG bSamFreqType; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bFormatType; + UCHAR bNrChannels; + UCHAR bSubframeSize; + UCHAR bBitResolution; + UCHAR bSamFreqType; } UX_HOST_CLASS_AUDIO_INTERFACE_DESCRIPTOR; @@ -324,16 +327,16 @@ typedef struct UX_HOST_CLASS_AUDIO_INTERFACE_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_AUDIO_INPUT_TERMINAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bTerminalID; - ULONG wTerminalType; - ULONG bAssocTerminal; - ULONG bNrChannels; - ULONG wChannelConfig; - ULONG iChannelNames; - ULONG iTerminal; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bTerminalID; + USHORT wTerminalType; + UCHAR bAssocTerminal; + UCHAR bNrChannels; + USHORT wChannelConfig; + UCHAR iChannelNames; + UCHAR iTerminal; } UX_HOST_CLASS_AUDIO_INPUT_TERMINAL_DESCRIPTOR; @@ -342,14 +345,15 @@ typedef struct UX_HOST_CLASS_AUDIO_INPUT_TERMINAL_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_AUDIO_OUTPUT_TERMINAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bTerminalID; - ULONG wTerminalType; - ULONG bAssocTerminal; - ULONG bSourceID; - ULONG iTerminal; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bTerminalID; + USHORT wTerminalType; + UCHAR bAssocTerminal; + UCHAR bSourceID; + UCHAR iTerminal; + UCHAR _align_size[3]; } UX_HOST_CLASS_AUDIO_OUTPUT_TERMINAL_DESCRIPTOR; @@ -358,13 +362,14 @@ typedef struct UX_HOST_CLASS_AUDIO_OUTPUT_TERMINAL_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_AUDIO_FEATURE_UNIT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bUnitID; - ULONG bSourceID; - ULONG bControlSize; - ULONG bmaControls; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR bControlSize; + UCHAR bmaControls; + UCHAR _align_size[1]; } UX_HOST_CLASS_AUDIO_FEATURE_UNIT_DESCRIPTOR; @@ -373,12 +378,13 @@ typedef struct UX_HOST_CLASS_AUDIO_FEATURE_UNIT_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_AUDIO_STREAMING_INTERFACE_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bTerminalLink; - ULONG bDelay; - ULONG wFormatTag; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bTerminalLink; + UCHAR bDelay; + UCHAR _align_wFormatTag[1]; + USHORT wFormatTag; } UX_HOST_CLASS_AUDIO_STREAMING_INTERFACE_DESCRIPTOR; @@ -387,12 +393,13 @@ typedef struct UX_HOST_CLASS_AUDIO_STREAMING_INTERFACE_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_AUDIO_STREAMING_ENDPOINT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bmAttributes; - ULONG bLockDelayUnits; - ULONG wLockDelay; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bmAttributes; + UCHAR bLockDelayUnits; + UCHAR _align_wLockDelay[1]; + USHORT wLockDelay; } UX_HOST_CLASS_AUDIO_STREAMING_ENDPOINT_DESCRIPTOR; 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 9a8b388..f5332d0 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.2.0 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -60,6 +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), */ +/* optimized USB descriptors, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -311,14 +314,15 @@ typedef struct UX_HOST_CLASS_CDC_ECM_STRUCT typedef struct UX_HOST_CLASS_ECM_INTERFACE_DESCRIPTOR_STRUCT { - ULONG bFunctionLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG iMACAddress; + UCHAR bFunctionLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR iMACAddress; ULONG bmEthernetStatistics; - ULONG wMaxSegmentSize; - ULONG wNumberMCFilters; - ULONG bNumberPowerFilters; + USHORT wMaxSegmentSize; + USHORT wNumberMCFilters; + UCHAR bNumberPowerFilters; + UCHAR _align_size[3]; } UX_HOST_CLASS_ECM_INTERFACE_DESCRIPTOR; /* Define CDC ECM Class function prototypes. */ 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 5d0e76f..81074b4 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.1.10 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -55,6 +55,9 @@ /* added interrupt OUT support,*/ /* added standalone mode, */ /* resulting in version 6.1.10 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* optimized USB descriptors, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -789,13 +792,15 @@ extern "C" { typedef struct UX_HID_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bcdHID; - ULONG bCountryCode; - ULONG bNumDescriptor; - ULONG bReportDescriptorType; - ULONG wItemLength; + UCHAR bLength; + UCHAR bDescriptorType; + USHORT bcdHID; + UCHAR bCountryCode; + UCHAR bNumDescriptor; + UCHAR bReportDescriptorType; + UCHAR _align_wItemLength[1]; + USHORT wItemLength; + UCHAR _align_size[2]; } UX_HID_DESCRIPTOR; 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 20f3b9f..d008672 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.1.12 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -50,6 +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), */ +/* optimized USB descriptors, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ @@ -188,14 +191,16 @@ extern "C" { typedef struct UX_HUB_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bNbPorts; - ULONG wHubCharacteristics; - ULONG bPwrOn2PwrGood; - ULONG bHubContrCurrent; - ULONG bDeviceRemovable; - ULONG bPortPwrCtrlMask; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bNbPorts; + UCHAR _align_wHubCharacteristics[1]; + USHORT wHubCharacteristics; + UCHAR bPwrOn2PwrGood; + UCHAR bHubContrCurrent; + UCHAR bDeviceRemovable; + UCHAR bPortPwrCtrlMask; + UCHAR _align_size[2]; } UX_HUB_DESCRIPTOR; 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 d63f152..60164e7 100644 --- a/common/usbx_host_classes/inc/ux_host_class_video.h +++ b/common/usbx_host_classes/inc/ux_host_class_video.h @@ -56,7 +56,8 @@ /* according to UVC 1.5 Class */ /* specification, */ /* resulting in version 6.1.8 */ -/* xx-xx-xxxx Yajun xia Modified comment(s), */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* optimized USB descriptors, */ /* added error checks support, */ /* resulting in version 6.x */ /* */ @@ -389,14 +390,15 @@ extern UCHAR _ux_system_host_class_video_name[]; typedef struct UX_HOST_CLASS_VIDEO_INTERFACE_HEADER_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bcdUVC; - ULONG wTotalLength; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR _align_bcdUVC[1]; + USHORT bcdUVC; + USHORT wTotalLength; ULONG dwClockFrequency; - ULONG bInCollection; - ULONG baInterfaceNr; + UCHAR bInCollection; + UCHAR baInterfaceNr; } UX_HOST_CLASS_VIDEO_INTERFACE_HEADER_DESCRIPTOR; /* Define Video Class specific input header interface descriptor. */ @@ -404,13 +406,13 @@ typedef struct UX_HOST_CLASS_VIDEO_INTERFACE_HEADER_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_VIDEO_INPUT_TERMINAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bTerminalID; - ULONG wTerminalType; - ULONG bAssocTerminal; - ULONG iTerminal; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bTerminalID; + USHORT wTerminalType; + UCHAR bAssocTerminal; + UCHAR iTerminal; } UX_HOST_CLASS_VIDEO_INPUT_TERMINAL_DESCRIPTOR; /* Define Video Class specific input header interface descriptor. */ @@ -418,19 +420,19 @@ typedef struct UX_HOST_CLASS_VIDEO_INPUT_TERMINAL_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_VIDEO_INPUT_HEADER_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubType; - ULONG bNumFormats; - ULONG wTotalLength; - ULONG bEndpointAddress; - ULONG bmInfo; - ULONG bTerminalLink; - ULONG bStillCaptureMethod; - ULONG bTriggerSupport; - ULONG bTriggerUsage; - ULONG bControlSize; - ULONG bmaControls; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubType; + UCHAR bNumFormats; + USHORT wTotalLength; + UCHAR bEndpointAddress; + UCHAR bmInfo; + UCHAR bTerminalLink; + UCHAR bStillCaptureMethod; + UCHAR bTriggerSupport; + UCHAR bTriggerUsage; + UCHAR bControlSize; + UCHAR bmaControls; } UX_HOST_CLASS_VIDEO_INPUT_HEADER_DESCRIPTOR; /* Define Video Class Selector descriptor. */ @@ -438,12 +440,12 @@ typedef struct UX_HOST_CLASS_VIDEO_INPUT_HEADER_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_VIDEO_SELECTOR_UNIT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bUnitID; - ULONG bNrInPins; - ULONG baSourceID; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bUnitID; + UCHAR bNrInPins; + UCHAR baSourceID; } UX_HOST_CLASS_VIDEO_SELECTOR_UNIT_DESCRIPTOR; /* Define Video Class Camera Terminal descriptor. */ @@ -451,17 +453,18 @@ typedef struct UX_HOST_CLASS_VIDEO_SELECTOR_UNIT_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_VIDEO_CAMERA_TERMINAL_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bTerminalID; - ULONG wTerminalType; - ULONG bAssocTerminal; - ULONG iTerminal; - ULONG wObjectiveFocalLengthMin; - ULONG wObjectiveFocalLengthMax; - ULONG wOcularFocalLength; - ULONG bControlSize; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bTerminalID; + USHORT wTerminalType; + UCHAR bAssocTerminal; + UCHAR iTerminal; + USHORT wObjectiveFocalLengthMin; + USHORT wObjectiveFocalLengthMax; + USHORT wOcularFocalLength; + UCHAR bControlSize; + UCHAR _align_bmControls[1]; ULONG bmControls; } UX_HOST_CLASS_VIDEO_CAMERA_TERMINAL_DESCRIPTOR; @@ -470,18 +473,21 @@ typedef struct UX_HOST_CLASS_VIDEO_CAMERA_TERMINAL_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bFrameIndex; - ULONG bmCapabilities; - ULONG wWidth; - ULONG wHeight; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bFrameIndex; + UCHAR bmCapabilities; + UCHAR _align_wWidth[1]; + USHORT wWidth; + USHORT wHeight; + UCHAR _align_dwMinBitRate[2]; ULONG dwMinBitRate; ULONG dwMaxBitRate; ULONG dwMaxVideoFrameBufferSize; ULONG dwDefaultFrameInterval; - ULONG bFrameIntervalType; + UCHAR bFrameIntervalType; + UCHAR _align_size[3]; } UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR; @@ -491,16 +497,17 @@ typedef struct UX_HOST_CLASS_VIDEO_FRAME_DESCRIPTOR_STRUCT typedef struct UX_HOST_CLASS_VIDEO_PROCESSING_UNIT_DESCRIPTOR_STRUCT { - ULONG bLength; - ULONG bDescriptorType; - ULONG bDescriptorSubtype; - ULONG bUnitID; - ULONG bSourceID; - ULONG wMaxMultiplier; - ULONG bControlSize; - ULONG bmControls; - ULONG iProcessing; - ULONG bmVideoStandards; + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR _align_wMaxMultiplier[1]; + USHORT wMaxMultiplier; + UCHAR bControlSize; + UCHAR bmControls; + UCHAR iProcessing; + UCHAR bmVideoStandards; } UX_HOST_CLASS_VIDEO_PROCESSING_UNIT_DESCRIPTOR; 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 13f2967..8054e95 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.2.0 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -81,6 +81,10 @@ /* supported NX packet chain, */ /* fixed empty queue handling, */ /* resulting in version 6.2.0 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* fixed compile warnings, */ +/* improved 64-bit support, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ VOID _ux_host_class_asix_transmission_callback (UX_TRANSFER *transfer_request) @@ -158,7 +162,7 @@ ULONG copied; if (next_packet -> nx_packet_next) { - next_packet -> nx_packet_length += sizeof(USHORT) * 2; + next_packet -> nx_packet_length += (ULONG)sizeof(USHORT) * 2; next_packet -> nx_packet_prepend_ptr -= sizeof(USHORT) * 2; nx_packet_data_extract_offset(next_packet, 0, asix -> ux_host_class_asix_xmit_buffer, next_packet -> nx_packet_length, &copied); @@ -167,7 +171,7 @@ ULONG copied; transfer_request -> ux_transfer_request_data_pointer = asix -> ux_host_class_asix_xmit_buffer; /* Restore packet status. */ - next_packet -> nx_packet_length -= sizeof(USHORT) * 2; + next_packet -> nx_packet_length -= (ULONG)sizeof(USHORT) * 2; next_packet -> nx_packet_prepend_ptr += sizeof(USHORT) * 2; } else 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 175e9b6..5ca7a60 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.2.0 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -82,6 +82,10 @@ /* added queue modify protect, */ /* improved error check, */ /* resulting in version 6.2.0 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* fixed compile warnings, */ +/* improved 64-bit support, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_asix_write(VOID *asix_class, NX_PACKET *packet) @@ -174,7 +178,7 @@ ULONG copied; UX_RESTORE return(UX_MATH_OVERFLOW); } - adjusted_length = packet -> nx_packet_length + sizeof(USHORT) * 2; + adjusted_length = packet -> nx_packet_length + (ULONG)sizeof(USHORT) * 2; if (adjusted_length > UX_HOST_CLASS_ASIX_TRANSMIT_BUFFER_SIZE) { @@ -233,7 +237,7 @@ ULONG copied; transfer_request -> ux_transfer_request_data_pointer = asix -> ux_host_class_asix_xmit_buffer; /* Restore packet status. */ - packet -> nx_packet_length -= sizeof(USHORT) * 2; + packet -> nx_packet_length -= (ULONG)sizeof(USHORT) * 2; packet -> nx_packet_prepend_ptr += sizeof(USHORT) * 2; } else diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_mac_address_get.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_mac_address_get.c index ea9f968..d19555b 100644 --- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_mac_address_get.c +++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_mac_address_get.c @@ -103,7 +103,7 @@ UCHAR element_hexa_lower; /* We now need to retrieve the MAC address of the node which is embedded in the ECM descriptor. We will parse the entire configuration descriptor of the device and look for the ECM Ethernet Networking Functional Descriptor. */ - configuration_index = cdc_ecm -> ux_host_class_cdc_ecm_interface_data -> ux_interface_configuration -> ux_configuration_descriptor.bConfigurationValue -1; + configuration_index = (ULONG)cdc_ecm -> ux_host_class_cdc_ecm_interface_data -> ux_interface_configuration -> ux_configuration_descriptor.bConfigurationValue -1; /* We need to get the default control endpoint transfer request pointer. */ control_endpoint = &cdc_ecm -> ux_host_class_cdc_ecm_device -> ux_device_control_endpoint; 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 d158454..041f26b 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 @@ -49,7 +49,7 @@ ULONG port_index; (UCHAR *) &hub -> ux_host_class_hub_descriptor); /* Check the protocol used by the HUB. This will indicate if the HUB supports multiple TTs in high speed mode. */ - tt_protocols = (hub -> ux_host_class_hub_device -> ux_device_descriptor.bDeviceProtocol << 8) | + tt_protocols = ((ULONG)hub -> ux_host_class_hub_device -> ux_device_descriptor.bDeviceProtocol << 8) | hub -> ux_host_class_hub_interface -> ux_interface_descriptor.bInterfaceProtocol; switch(tt_protocols) { @@ -129,7 +129,7 @@ ULONG port_index; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_hub_descriptor_get PORTABLE C */ -/* 6.1.12 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -174,6 +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), */ +/* fixed compile warnings, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ 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 9a968d8..e73c2e1 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.2.0 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,6 +84,9 @@ 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), */ +/* fixed compile warnings, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_hub_entry(UX_HOST_CLASS_COMMAND *command) @@ -359,7 +362,7 @@ ULONG current_ms, elapsed_ms; /* Delay a while (as described by hub descriptor). */ hub -> ux_host_class_hub_wait_start = _ux_utility_time_get(); - hub -> ux_host_class_hub_wait_ms = UX_MS_TO_TICK_NON_ZERO(hub -> ux_host_class_hub_descriptor.bPwrOn2PwrGood << 1); + hub -> ux_host_class_hub_wait_ms = UX_MS_TO_TICK_NON_ZERO((ULONG)hub -> ux_host_class_hub_descriptor.bPwrOn2PwrGood << 1); hub -> ux_host_class_hub_enum_state = UX_HOST_CLASS_HUB_ENUM_TRANS_WAIT; hub -> ux_host_class_hub_next_state = UX_HOST_CLASS_HUB_ENUM_PORT_POWER_ON; 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 ae432d7..5d5ca49 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.1.12 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,6 +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), */ +/* fixed compile warnings, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_device_info_get(UX_HOST_CLASS_PIMA *pima, @@ -169,7 +172,7 @@ UINT status; else { array_length <<= 1; - array_length += sizeof(ULONG); + array_length += (ULONG)sizeof(ULONG); } } @@ -190,7 +193,7 @@ UINT status; else { array_length <<= 1; - array_length += sizeof(ULONG); + array_length += (ULONG)sizeof(ULONG); } } @@ -211,7 +214,7 @@ UINT status; else { array_length <<= 1; - array_length += sizeof(ULONG); + array_length += (ULONG)sizeof(ULONG); } } @@ -232,7 +235,7 @@ UINT status; else { array_length <<= 1; - array_length += sizeof(ULONG); + array_length += (ULONG)sizeof(ULONG); } } @@ -253,7 +256,7 @@ UINT status; else { array_length <<= 1; - array_length += sizeof(ULONG); + array_length += (ULONG)sizeof(ULONG); } } 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 a95015f..970446f 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.1 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -76,6 +76,10 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ +/* xx-xx-xxxx Yajun Xia Modified comment(s), */ +/* fixed allocated buffer */ +/* pointer checking issue, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_object_info_get(UX_HOST_CLASS_PIMA *pima, @@ -117,7 +121,7 @@ UINT status; /* Allocate some DMA safe memory for receiving the object info block. */ object_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, UX_HOST_CLASS_PIMA_OBJECT_MAX_LENGTH); - if (object == UX_NULL) + if (object_buffer == UX_NULL) return(UX_MEMORY_INSUFFICIENT); /* Issue the command. */ 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 f5f569f..1f9f8e6 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.1 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -78,6 +78,10 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ +/* xx-xx-xxxx Yajun Xia Modified comment(s), */ +/* fixed allocated buffer */ +/* pointer checking issue, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_pima_object_info_send(UX_HOST_CLASS_PIMA *pima, @@ -125,7 +129,7 @@ UINT status; /* Allocate some DMA safe memory for sending the object info block. */ object_buffer = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, UX_HOST_CLASS_PIMA_OBJECT_MAX_LENGTH); - if (object == UX_NULL) + if (object_buffer == UX_NULL) return(UX_MEMORY_INSUFFICIENT); /* Get the end of the object buffer. */ 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 ee0cc5a..9963117 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.1.12 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -83,6 +83,9 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* fixed compile warnings, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_printer_device_id_get(UX_HOST_CLASS_PRINTER *printer, UCHAR *descriptor_buffer, ULONG length) @@ -142,7 +145,7 @@ UINT status; transfer_request -> ux_transfer_request_function = UX_HOST_CLASS_PRINTER_GET_DEVICE_ID; transfer_request -> ux_transfer_request_type = UX_REQUEST_IN | UX_REQUEST_TYPE_CLASS | UX_REQUEST_TARGET_INTERFACE; transfer_request -> ux_transfer_request_value = 0; /* Do not support multiple configuration for now. */ - transfer_request -> ux_transfer_request_index = (interface_ptr -> ux_interface_descriptor.bInterfaceNumber << 8) | + transfer_request -> ux_transfer_request_index = ((UINT)interface_ptr -> ux_interface_descriptor.bInterfaceNumber << 8) | (interface_ptr -> ux_interface_descriptor.bAlternateSetting ); #if defined(UX_HOST_STANDALONE) 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 3640aad..a008656 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.1.12 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -176,6 +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), */ +/* fixed compile warnings, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_printer_name_get(UX_HOST_CLASS_PRINTER *printer) @@ -210,7 +213,7 @@ UINT status; transfer_request -> ux_transfer_request_function = UX_HOST_CLASS_PRINTER_GET_DEVICE_ID; transfer_request -> ux_transfer_request_type = UX_REQUEST_IN | UX_REQUEST_TYPE_CLASS | UX_REQUEST_TARGET_INTERFACE; transfer_request -> ux_transfer_request_value = 0; /* Do not support multiple configuration for now. */ - transfer_request -> ux_transfer_request_index = (interface_ptr -> ux_interface_descriptor.bInterfaceNumber << 8) | + transfer_request -> ux_transfer_request_index = ((UINT)interface_ptr -> ux_interface_descriptor.bInterfaceNumber << 8) | (interface_ptr -> ux_interface_descriptor.bAlternateSetting ); #if defined(UX_HOST_STANDALONE) diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_asynchronous_endpoint_create.c b/common/usbx_host_controllers/src/ux_hcd_ehci_asynchronous_endpoint_create.c index 0d03bbd..7aa4cfa 100644 --- a/common/usbx_host_controllers/src/ux_hcd_ehci_asynchronous_endpoint_create.c +++ b/common/usbx_host_controllers/src/ux_hcd_ehci_asynchronous_endpoint_create.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_hcd_ehci_asynchronous_endpoint_create PORTABLE C */ -/* 6.1.2 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -75,6 +75,9 @@ /* 11-09-2020 Chaoqiong Xiao Modified comment(s), */ /* fixed compile warnings, */ /* resulting in version 6.1.2 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* fixed compile warnings, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_hcd_ehci_asynchronous_endpoint_create(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint) @@ -102,7 +105,7 @@ UX_EHCI_LINK_POINTER queue_head; ed -> REF_AS.INTR.ux_ehci_ed_endpoint = endpoint; /* Set the default MPS Capability info in the ED. */ - ed -> ux_ehci_ed_cap0 = endpoint -> ux_endpoint_descriptor.wMaxPacketSize << UX_EHCI_QH_MPS_LOC; + ed -> ux_ehci_ed_cap0 = (ULONG)endpoint -> ux_endpoint_descriptor.wMaxPacketSize << UX_EHCI_QH_MPS_LOC; /* Set the default NAK reload count. */ ed -> ux_ehci_ed_cap0 |= UX_EHCI_QH_NCR; diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c b/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c index ef068a0..c5b4a67 100644 --- a/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c +++ b/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_hcd_ehci_isochronous_endpoint_create PORTABLE C */ -/* 6.1.11 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -87,6 +87,9 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* fixed standalone compile, */ /* resulting in version 6.1.11 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* fixed compile warnings, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_hcd_ehci_isochronous_endpoint_create(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint) @@ -171,7 +174,7 @@ UINT status; endpoint -> ux_endpoint_transfer_request.ux_transfer_request_maximum_length = max_trans_size; /* Get the Endpt, Device Address, I/O, Maximum Packet Size, Mult. */ - endpt = (endpoint -> ux_endpoint_descriptor.bEndpointAddress << UX_EHCI_HSISO_ENDPT_SHIFT) & UX_EHCI_HSISO_ENDPT_MASK; + endpt = ((ULONG)endpoint -> ux_endpoint_descriptor.bEndpointAddress << UX_EHCI_HSISO_ENDPT_SHIFT) & UX_EHCI_HSISO_ENDPT_MASK; device_address = device -> ux_device_address & UX_EHCI_HSISO_DEVICE_ADDRESS_MASK; io = (endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) ? UX_EHCI_HSISO_DIRECTION_IN : UX_EHCI_HSISO_DIRECTION_OUT; diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_request_control_transfer.c b/common/usbx_host_controllers/src/ux_hcd_ehci_request_control_transfer.c index 8277267..278715d 100644 --- a/common/usbx_host_controllers/src/ux_hcd_ehci_request_control_transfer.c +++ b/common/usbx_host_controllers/src/ux_hcd_ehci_request_control_transfer.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_hcd_ehci_request_control_transfer PORTABLE C */ -/* 6.1.10 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -86,6 +86,9 @@ /* refined macros names, */ /* fixed compile warnings, */ /* resulting in version 6.1.2 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* fixed compile warnings, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_hcd_ehci_request_control_transfer(UX_HCD_EHCI *hcd_ehci, UX_TRANSFER *transfer_request) @@ -131,7 +134,7 @@ UINT pid; /* Set the default MPS Capability info in the ED. */ ed -> ux_ehci_ed_cap0 &= ~UX_EHCI_QH_MPS_MASK; - ed -> ux_ehci_ed_cap0 |= endpoint -> ux_endpoint_descriptor.wMaxPacketSize << UX_EHCI_QH_MPS_LOC; + ed -> ux_ehci_ed_cap0 |= (ULONG)endpoint -> ux_endpoint_descriptor.wMaxPacketSize << UX_EHCI_QH_MPS_LOC; /* On Control transfers, the toggle is set in the TD, not the QH. */ ed -> ux_ehci_ed_cap0 |= UX_EHCI_QH_DTC; |
