summaryrefslogtreecommitdiff
path: root/common/core/src/ux_system_initialize.c
diff options
context:
space:
mode:
authorChaoqiong Xiao <[email protected]>2023-05-12 07:01:07 +0000
committerChaoqiong Xiao <[email protected]>2023-05-12 07:01:07 +0000
commitef2fa7717be8ab751fdfb5d3f91e24fbbaea8dd6 (patch)
treee252f4e5e52617043c6d6ed59a6891a173d07781 /common/core/src/ux_system_initialize.c
parent3af3626c9b4b5fefbe4016582b896ad79287df62 (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/core/src/ux_system_initialize.c')
-rw-r--r--common/core/src/ux_system_initialize.c19
1 files changed, 18 insertions, 1 deletions
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);