From df966713d625f9f2c16ba126e3075f63d72985d2 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 5 Apr 2023 14:32:40 +0200 Subject: [PATCH 1/8] fix: regenerate STM32Cube_FW patches Prepare update to version 1.16.0 Signed-off-by: Frederic Pillon --- ...001-chore-adapt-STM32Cube_FW-sources.patch | 351 +++ ...nd-adapt-STM32Cube_FW-sources-for-ST.patch | 2330 ----------------- ...imeout-when-waiting-for-the-cmd_resp.patch | 15 +- ...ort-for-customize-app_conf_default.h.patch | 38 +- ...004-fix-warning-outside-array-bounds.patch | 304 +++ 5 files changed, 681 insertions(+), 2357 deletions(-) create mode 100644 extras/STM32Cube_FW/0001-chore-adapt-STM32Cube_FW-sources.patch delete mode 100644 extras/STM32Cube_FW/0001-chore-clean-up-and-adapt-STM32Cube_FW-sources-for-ST.patch create mode 100644 extras/STM32Cube_FW/0004-fix-warning-outside-array-bounds.patch diff --git a/extras/STM32Cube_FW/0001-chore-adapt-STM32Cube_FW-sources.patch b/extras/STM32Cube_FW/0001-chore-adapt-STM32Cube_FW-sources.patch new file mode 100644 index 00000000..246a1257 --- /dev/null +++ b/extras/STM32Cube_FW/0001-chore-adapt-STM32Cube_FW-sources.patch @@ -0,0 +1,351 @@ +From ef2495f6fa746df9f86f0db39fa00244d22feb3b Mon Sep 17 00:00:00 2001 +From: Frederic Pillon +Date: Wed, 5 Apr 2023 10:18:52 +0200 +Subject: [PATCH 1/4] chore: adapt STM32Cube_FW sources + +Compare to previous patch, do the minimum changes required +to ease further update. + +Signed-off-by: Frederic Pillon +--- + src/utility/STM32Cube_FW/app_conf_default.h | 47 +++++++++++++++------ + src/utility/STM32Cube_FW/ble_bufsize.h | 11 ++++- + src/utility/STM32Cube_FW/hw.h | 15 +++++-- + src/utility/STM32Cube_FW/hw_ipcc.c | 4 +- + src/utility/STM32Cube_FW/shci.c | 3 +- + src/utility/STM32Cube_FW/shci_tl.c | 18 +++++++- + src/utility/STM32Cube_FW/stm_list.c | 7 ++- + src/utility/STM32Cube_FW/tl_mbox.c | 8 +++- + 8 files changed, 90 insertions(+), 23 deletions(-) + +diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h +index 51bd33a..e89df14 100644 +--- a/src/utility/STM32Cube_FW/app_conf_default.h ++++ b/src/utility/STM32Cube_FW/app_conf_default.h +@@ -1,9 +1,9 @@ + /* USER CODE BEGIN Header */ + /** + ****************************************************************************** +- * @file app_conf.h ++ * @file app_conf_default.h + * @author MCD Application Team +- * @brief Application configuration file for STM32WPAN Middleware. ++ * @brief Default application configuration file for STM32WPAN Middleware. + ****************************************************************************** + * @attention + * +@@ -19,18 +19,38 @@ + /* USER CODE END Header */ + + /* Define to prevent recursive inclusion -------------------------------------*/ +-#ifndef APP_CONF_H +-#define APP_CONF_H +- ++#ifndef APP_CONF_DEFAULT_H ++#define APP_CONF_DEFAULT_H ++#if 0 + #include "hw.h" + #include "hw_conf.h" + #include "hw_if.h" + #include "ble_bufsize.h" +- ++#endif + /****************************************************************************** + * Application Config + ******************************************************************************/ + ++/**< generic parameters ******************************************************/ ++/* HCI related defines */ ++ ++#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F ++#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C ++#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D ++#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251) ++#define HCI_RESET 0x0C03 ++ ++#ifndef BLE_SHARED_MEM_BYTE_ORDER ++ #define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST ++#endif ++#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128 ++ ++/** ++ * Define Tx Power ++ */ ++#define CFG_TX_POWER (0x18) /* -0.15dBm */ ++ ++#if 0 + /** + * Define Secure Connections Support + */ +@@ -104,7 +124,7 @@ + #define CFG_FW_SUBVERSION (1) + #define CFG_FW_BRANCH (0) + #define CFG_FW_BUILD (0) +- ++#endif + /****************************************************************************** + * BLE Stack + ******************************************************************************/ +@@ -152,13 +172,15 @@ + * Prepare Write List size in terms of number of packet + * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set + */ +-#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) ++// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) ++#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A) + + /** + * Number of allocated memory blocks + * This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set + */ +-#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) ++//#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) ++#define CFG_BLE_MBLOCK_COUNT (0x79) + + /** + * Enable or disable the Extended Packet length feature. Valid values are 0 or 1. +@@ -250,7 +272,7 @@ + * 0: LE Power Class 2-3 + * other bits: complete with Options_extension flag + */ +-#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_HOST | SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC | SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW | SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV | SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 | SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM | SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED | SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3) ++#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY) + + /** + * BLE stack Options_extension flags to be configured with: +@@ -323,6 +345,7 @@ + + #define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3) + ++#if 0 + /****************************************************************************** + * Transport Layer + ******************************************************************************/ +@@ -657,5 +680,5 @@ typedef enum + #define CFG_OTP_BASE_ADDRESS OTP_AREA_BASE + + #define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR +- +-#endif /*APP_CONF_H */ ++#endif ++#endif /*APP_CONF_DEFAULT_H */ +diff --git a/src/utility/STM32Cube_FW/ble_bufsize.h b/src/utility/STM32Cube_FW/ble_bufsize.h +index 7b7c170..53cf59a 100644 +--- a/src/utility/STM32Cube_FW/ble_bufsize.h ++++ b/src/utility/STM32Cube_FW/ble_bufsize.h +@@ -75,15 +75,22 @@ + ((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \ + BLE_MBLOCKS_SECURE_CONNECTIONS)) + ++/* ++ * BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count ++ */ ++#define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \ ++ BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \ ++ BLE_DEFAULT_MAX_ATT_MTU, n_link) ++ + /* + * BLE_FIXED_BUFFER_SIZE_BYTES: + * A part of the RAM, is dynamically allocated by initializing all the pointers + * defined in a global context variable "mem_alloc_ctx_p". +- * This initialization is made in the Dynamic_allocator functions, which ++ * This initialization is made in the Dynamic_allocator functions, which + * assign a portion of RAM given by the external application to the above + * mentioned "global pointers". + * +- * The size of this Dynamic RAM is made of 2 main components: ++ * The size of this Dynamic RAM is made of 2 main components: + * - a part that is parameters-dependent (num of links, GATT buffers, ...), + * and which value is made explicit by the following macro; + * - a part, that may be considered "fixed", i.e. independent from the above +diff --git a/src/utility/STM32Cube_FW/hw.h b/src/utility/STM32Cube_FW/hw.h +index 503fa2c..1472a5e 100644 +--- a/src/utility/STM32Cube_FW/hw.h ++++ b/src/utility/STM32Cube_FW/hw.h +@@ -26,14 +26,23 @@ extern "C" { + #endif + + /* Includes ------------------------------------------------------------------*/ ++#include "stm32_def.h" ++#include "stm32wbxx_ll_bus.h" ++#include "stm32wbxx_ll_exti.h" ++#include "stm32wbxx_ll_system.h" ++#include "stm32wbxx_ll_rcc.h" ++#include "stm32wbxx_ll_ipcc.h" ++#include "stm32wbxx_ll_cortex.h" ++#include "stm32wbxx_ll_utils.h" ++#include "stm32wbxx_ll_pwr.h" + + /****************************************************************************** + * HW IPCC + ******************************************************************************/ + void HW_IPCC_Enable( void ); + void HW_IPCC_Init( void ); +- void HW_IPCC_Rx_Handler( void ); +- void HW_IPCC_Tx_Handler( void ); ++#define HW_IPCC_Rx_Handler IPCC_C1_RX_IRQHandler ++#define HW_IPCC_Tx_Handler IPCC_C1_TX_IRQHandler + + void HW_IPCC_BLE_Init( void ); + void HW_IPCC_BLE_SendCmd( void ); +@@ -76,7 +85,7 @@ extern "C" { + void HW_IPCC_BLE_LLD_ReceiveRsp( void ); + void HW_IPCC_BLE_LLD_SendRspAck( void ); + +- ++ + void HW_IPCC_TRACES_Init( void ); + void HW_IPCC_TRACES_EvtNot( void ); + +diff --git a/src/utility/STM32Cube_FW/hw_ipcc.c b/src/utility/STM32Cube_FW/hw_ipcc.c +index fd620b8..3461cbe 100644 +--- a/src/utility/STM32Cube_FW/hw_ipcc.c ++++ b/src/utility/STM32Cube_FW/hw_ipcc.c +@@ -18,8 +18,9 @@ + */ + /* USER CODE END Header */ + ++#if defined(STM32WBxx) + /* Includes ------------------------------------------------------------------*/ +-#include "app_common.h" ++#include "hw.h" + #include "mbox_def.h" + + /* Global variables ---------------------------------------------------------*/ +@@ -667,3 +668,4 @@ static void HW_IPCC_TRACES_EvtHandler( void ) + } + + __weak void HW_IPCC_TRACES_EvtNot( void ){}; ++#endif /* STM32WBxx */ +diff --git a/src/utility/STM32Cube_FW/shci.c b/src/utility/STM32Cube_FW/shci.c +index 301db76..cb7d7bd 100644 +--- a/src/utility/STM32Cube_FW/shci.c ++++ b/src/utility/STM32Cube_FW/shci.c +@@ -16,7 +16,7 @@ + ****************************************************************************** + */ + +- ++#if defined(STM32WBxx) + /* Includes ------------------------------------------------------------------*/ + #include "stm32_wpan_common.h" + +@@ -739,3 +739,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo ) + + return (SHCI_Success); + } ++#endif /* STM32WBxx */ +diff --git a/src/utility/STM32Cube_FW/shci_tl.c b/src/utility/STM32Cube_FW/shci_tl.c +index 2b387b1..a336aa6 100644 +--- a/src/utility/STM32Cube_FW/shci_tl.c ++++ b/src/utility/STM32Cube_FW/shci_tl.c +@@ -16,12 +16,13 @@ + ****************************************************************************** + */ + +- ++#if defined(STM32WBxx) + /* Includes ------------------------------------------------------------------*/ + #include "stm32_wpan_common.h" + + #include "stm_list.h" + #include "shci_tl.h" ++#include "stm32_def.h" + + /* Private typedef -----------------------------------------------------------*/ + typedef enum +@@ -168,6 +169,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl + return; + } + ++void shci_notify_asynch_evt(void *pdata) ++{ ++ UNUSED(pdata); ++ /* Need to parse data in future version */ ++ shci_user_evt_proc(); ++} ++ ++void shci_register_io_bus(tSHciIO *fops) ++{ ++ /* Register IO bus services */ ++ fops->Init = TL_SYS_Init; ++ fops->Send = TL_SYS_SendCmd; ++} ++ + /* Private functions ---------------------------------------------------------*/ + static void TlInit( TL_CmdPacket_t * p_cmdbuffer ) + { +@@ -251,3 +266,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag) + + return; + } ++#endif /* STM32WBxx */ +diff --git a/src/utility/STM32Cube_FW/stm_list.c b/src/utility/STM32Cube_FW/stm_list.c +index 4c92864..4e8c364 100644 +--- a/src/utility/STM32Cube_FW/stm_list.c ++++ b/src/utility/STM32Cube_FW/stm_list.c +@@ -16,11 +16,13 @@ + ****************************************************************************** + */ + +- ++#if defined(STM32WBxx) + /****************************************************************************** + * Include Files + ******************************************************************************/ +-#include "utilities_common.h" ++#include "stdint.h" ++#include "cmsis_gcc.h" ++#include "stm32_wpan_common.h" + + #include "stm_list.h" + +@@ -204,3 +206,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node) + + __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/ + } ++#endif /* STM32WBxx */ +diff --git a/src/utility/STM32Cube_FW/tl_mbox.c b/src/utility/STM32Cube_FW/tl_mbox.c +index 27a998a..ff219b9 100644 +--- a/src/utility/STM32Cube_FW/tl_mbox.c ++++ b/src/utility/STM32Cube_FW/tl_mbox.c +@@ -16,6 +16,7 @@ + ****************************************************************************** + */ + ++#if defined(STM32WBxx) + /* Includes ------------------------------------------------------------------*/ + #include "stm32_wpan_common.h" + #include "hw.h" +@@ -51,9 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable; + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable; + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable; + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable; ++#if 0 + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table; + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table; +- ++#endif + /**< tables */ + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue; + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue; +@@ -97,8 +99,11 @@ void TL_Init( void ) + TL_RefTable.p_sys_table = &TL_SysTable; + TL_RefTable.p_mem_manager_table = &TL_MemManagerTable; + TL_RefTable.p_traces_table = &TL_TracesTable; ++ ++#if 0 + TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table; + TL_RefTable.p_zigbee_table = &TL_Zigbee_Table; ++#endif + HW_IPCC_Init(); + + return; +@@ -846,3 +851,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer) + + return; + } ++#endif /* STM32WBxx */ +-- +2.38.0.windows.1 + diff --git a/extras/STM32Cube_FW/0001-chore-clean-up-and-adapt-STM32Cube_FW-sources-for-ST.patch b/extras/STM32Cube_FW/0001-chore-clean-up-and-adapt-STM32Cube_FW-sources-for-ST.patch deleted file mode 100644 index 171554eb..00000000 --- a/extras/STM32Cube_FW/0001-chore-clean-up-and-adapt-STM32Cube_FW-sources-for-ST.patch +++ /dev/null @@ -1,2330 +0,0 @@ -From 70812b4e3a184585354f979472a75a648266f53f Mon Sep 17 00:00:00 2001 -From: Frederic Pillon -Date: Mon, 12 Dec 2022 17:15:26 +0100 -Subject: [PATCH 1/3] chore: clean up and adapt STM32Cube_FW sources for - STM32duino - -Signed-off-by: Frederic Pillon ---- - src/utility/STM32Cube_FW/app_conf_default.h | 914 ++++++------------- - src/utility/STM32Cube_FW/ble_bufsize.h | 7 + - src/utility/STM32Cube_FW/hw.h | 28 +- - src/utility/STM32Cube_FW/hw_ipcc.c | 218 +---- - src/utility/STM32Cube_FW/mbox_def.h | 34 - - src/utility/STM32Cube_FW/shci.c | 39 +- - src/utility/STM32Cube_FW/shci.h | 51 +- - src/utility/STM32Cube_FW/shci_tl.c | 37 +- - src/utility/STM32Cube_FW/stm32_wpan_common.h | 39 +- - src/utility/STM32Cube_FW/stm_list.c | 15 +- - src/utility/STM32Cube_FW/stm_list.h | 4 +- - src/utility/STM32Cube_FW/tl.h | 33 - - src/utility/STM32Cube_FW/tl_mbox.c | 143 +-- - 13 files changed, 323 insertions(+), 1239 deletions(-) - rewrite src/utility/STM32Cube_FW/app_conf_default.h (63%) - -diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h -dissimilarity index 63% -index 2606a05..cc8c3e8 100644 ---- a/src/utility/STM32Cube_FW/app_conf_default.h -+++ b/src/utility/STM32Cube_FW/app_conf_default.h -@@ -1,655 +1,259 @@ --/* USER CODE BEGIN Header */ --/** -- ****************************************************************************** -- * @file app_conf.h -- * @author MCD Application Team -- * @brief Application configuration file for STM32WPAN Middleware. -- ****************************************************************************** -- * @attention -- * -- * Copyright (c) 2020-2021 STMicroelectronics. -- * All rights reserved. -- * -- * This software is licensed under terms that can be found in the LICENSE file -- * in the root directory of this software component. -- * If no LICENSE file comes with this software, it is provided AS-IS. -- * -- ****************************************************************************** -- */ --/* USER CODE END Header */ -- --/* Define to prevent recursive inclusion -------------------------------------*/ --#ifndef APP_CONF_H --#define APP_CONF_H -- --#include "hw.h" --#include "hw_conf.h" --#include "hw_if.h" --#include "ble_bufsize.h" -- --/****************************************************************************** -- * Application Config -- ******************************************************************************/ -- --/** -- * Define Secure Connections Support -- */ --#define CFG_SECURE_NOT_SUPPORTED (0x00) --#define CFG_SECURE_OPTIONAL (0x01) --#define CFG_SECURE_MANDATORY (0x02) -- --#define CFG_SC_SUPPORT CFG_SECURE_OPTIONAL -- --/** -- * Define Keypress Notification Support -- */ --#define CFG_KEYPRESS_NOT_SUPPORTED (0x00) --#define CFG_KEYPRESS_SUPPORTED (0x01) -- --#define CFG_KEYPRESS_NOTIFICATION_SUPPORT CFG_KEYPRESS_NOT_SUPPORTED -- --/** -- * Numeric Comparison Answers -- */ --#define YES (0x01) --#define NO (0x00) -- --/** -- * Device name configuration for Generic Access Service -- */ --#define CFG_GAP_DEVICE_NAME "TEMPLATE" --#define CFG_GAP_DEVICE_NAME_LENGTH (8) -- --/** --* Identity root key used to derive LTK and CSRK --*/ --#define CFG_BLE_IRK {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0} -- --/** --* Encryption root key used to derive LTK and CSRK --*/ --#define CFG_BLE_ERK {0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21, 0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21} -- --/** -- * SMPS supply -- * SMPS not used when Set to 0 -- * SMPS used when Set to 1 -- */ --#define CFG_USE_SMPS 0 -- --/* USER CODE BEGIN Generic_Parameters */ --/* USER CODE END Generic_Parameters */ -- --/**< specific parameters */ --/*****************************************************/ -- --/* USER CODE BEGIN Specific_Parameters */ --#define PUSH_BUTTON_SW1_EXTI_IRQHandler EXTI4_IRQHandler -- --/* USER CODE END Specific_Parameters */ -- --/****************************************************************************** -- * Information Table -- * -- * Version -- * [0:3] = Build - 0: Untracked - 15:Released - x: Tracked version -- * [4:7] = branch - 0: Mass Market - x: ... -- * [8:15] = Subversion -- * [16:23] = Version minor -- * [24:31] = Version major -- * -- ******************************************************************************/ --#define CFG_FW_MAJOR_VERSION (0) --#define CFG_FW_MINOR_VERSION (0) --#define CFG_FW_SUBVERSION (1) --#define CFG_FW_BRANCH (0) --#define CFG_FW_BUILD (0) -- --/****************************************************************************** -- * BLE Stack -- ******************************************************************************/ --/** -- * Maximum number of simultaneous connections that the device will support. -- * Valid values are from 1 to 8 -- */ --#define CFG_BLE_NUM_LINK 8 -- --/** -- * Maximum number of Services that can be stored in the GATT database. -- * Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services -- */ --#define CFG_BLE_NUM_GATT_SERVICES 8 -- --/** -- * Maximum number of Attributes -- * (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the services) -- * that can be stored in the GATT database. -- * Note that certain characteristics and relative descriptors are added automatically during device initialization -- * so this parameters should be 9 plus the number of user Attributes -- */ --#define CFG_BLE_NUM_GATT_ATTRIBUTES 68 -- --/** -- * Maximum supported ATT_MTU size -- * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set -- */ --#define CFG_BLE_MAX_ATT_MTU (156) -- --/** -- * Size of the storage area for Attribute values -- * This value depends on the number of attributes used by application. In particular the sum of the following quantities (in octets) should be made for each attribute: -- * - attribute value length -- * - 5, if UUID is 16 bit; 19, if UUID is 128 bit -- * - 2, if server configuration descriptor is used -- * - 2*DTM_NUM_LINK, if client configuration descriptor is used -- * - 2, if extended properties is used -- * The total amount of memory needed is the sum of the above quantities for each attribute. -- * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set -- */ --#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344) -- --/** -- * Prepare Write List size in terms of number of packet -- * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set -- */ --#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) -- --/** -- * Number of allocated memory blocks -- * This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set -- */ --#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) -- --/** -- * Enable or disable the Extended Packet length feature. Valid values are 0 or 1. -- */ --#define CFG_BLE_DATA_LENGTH_EXTENSION 1 -- --/** -- * Sleep clock accuracy in Slave mode (ppm value) -- */ --#define CFG_BLE_SLAVE_SCA 500 -- --/** -- * Sleep clock accuracy in Master mode -- * 0 : 251 ppm to 500 ppm -- * 1 : 151 ppm to 250 ppm -- * 2 : 101 ppm to 150 ppm -- * 3 : 76 ppm to 100 ppm -- * 4 : 51 ppm to 75 ppm -- * 5 : 31 ppm to 50 ppm -- * 6 : 21 ppm to 30 ppm -- * 7 : 0 ppm to 20 ppm -- */ --#define CFG_BLE_MASTER_SCA 0 -- --/** -- * LsSource -- * Some information for Low speed clock mapped in bits field -- * - bit 0: 1: Calibration for the RF system wakeup clock source 0: No calibration for the RF system wakeup clock source -- * - bit 1: 1: STM32WB5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module -- * - bit 2: 1: HSE/1024 Clock config 0: LSE Clock config -- */ --#if defined(STM32WB5Mxx) -- #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) --#else -- #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) --#endif -- --/** -- * Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us) -- */ --#define CFG_BLE_HSE_STARTUP_TIME 0x148 -- --/** -- * Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us) -- */ --#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF) -- --/** -- * Viterbi Mode -- * 1 : enabled -- * 0 : disabled -- */ --#define CFG_BLE_VITERBI_MODE 1 -- --/** -- * BLE stack Options flags to be configured with: -- * - SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY -- * - SHCI_C2_BLE_INIT_OPTIONS_LL_HOST -- * - SHCI_C2_BLE_INIT_OPTIONS_NO_SVC_CHANGE_DESC -- * - SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC -- * - SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RO -- * - SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW -- * - SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV -- * - SHCI_C2_BLE_INIT_OPTIONS_NO_EXT_ADV -- * - SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 -- * - SHCI_C2_BLE_INIT_OPTIONS_NO_CS_ALGO2 -- * - SHCI_C2_BLE_INIT_OPTIONS_REDUC_GATTDB_NVM -- * - SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM -- * - SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_USED -- * - SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED -- * - SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_1 -- * - SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3 -- * - SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_WRITABLE -- * - SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY -- * - SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_SUPPORTED -- * - SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED -- * which are used to set following configuration bits: -- * (bit 0): 1: LL only -- * 0: LL + host -- * (bit 1): 1: no service change desc. -- * 0: with service change desc. -- * (bit 2): 1: device name Read-Only -- * 0: device name R/W -- * (bit 3): 1: extended advertizing supported -- * 0: extended advertizing not supported -- * (bit 4): 1: CS Algo #2 supported -- * 0: CS Algo #2 not supported -- * (bit 5): 1: Reduced GATT database in NVM -- * 0: Full GATT database in NVM -- * (bit 6): 1: GATT caching is used -- * 0: GATT caching is not used -- * (bit 7): 1: LE Power Class 1 -- * 0: LE Power Class 2-3 -- * (bit 8): 1: appearance Writable -- * 0: appearance Read-Only -- * (bit 9): 1: Enhanced ATT supported -- * 0: Enhanced ATT not supported -- * other bits: reserved (shall be set to 0) -- */ --#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_HOST | SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC | SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW | SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV | SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 | SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM | SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED | SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3 | SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY | SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED) -- --#define CFG_BLE_MAX_COC_INITIATOR_NBR (32) -- --#define CFG_BLE_MIN_TX_POWER (-40) -- --#define CFG_BLE_MAX_TX_POWER (6) -- --/** -- * BLE Rx model configuration flags to be configured with: -- * - SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY -- * - SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_BLOCKER -- * which are used to set following configuration bits: -- * (bit 0): 1: agc_rssi model improved vs RF blockers -- * 0: Legacy agc_rssi model -- * other bits: reserved (shall be set to 0) -- */ -- --#define CFG_BLE_RX_MODEL_CONFIG (SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY) -- --/* Maximum number of advertising sets. -- * Range: 1 .. 8 with limitation: -- * This parameter is linked to CFG_BLE_MAX_ADV_DATA_LEN such as both compliant with allocated Total memory computed with BLE_EXT_ADV_BUFFER_SIZE based -- * on Max Extended advertising configuration supported. -- * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set -- */ -- --#define CFG_BLE_MAX_ADV_SET_NBR (8) -- -- /* Maximum advertising data length (in bytes) -- * Range: 31 .. 1650 with limitation: -- * This parameter is linked to CFG_BLE_MAX_ADV_SET_NBR such as both compliant with allocated Total memory computed with BLE_EXT_ADV_BUFFER_SIZE based -- * on Max Extended advertising configuration supported. -- * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set -- */ -- --#define CFG_BLE_MAX_ADV_DATA_LEN (207) -- -- /* RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB. -- * Range: -1280 .. 1280 -- */ -- --#define CFG_BLE_TX_PATH_COMPENS (0) -- -- /* RF RX Path Compensation Value (16-bit signed integer). Units: 0.1 dB. -- * Range: -1280 .. 1280 -- */ -- --#define CFG_BLE_RX_PATH_COMPENS (0) -- -- /* BLE core version (16-bit signed integer). -- * - SHCI_C2_BLE_INIT_BLE_CORE_5_2 -- * - SHCI_C2_BLE_INIT_BLE_CORE_5_3 -- * which are used to set: 11(5.2), 12(5.3). -- */ -- --#define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3) -- --/****************************************************************************** -- * Transport Layer -- ******************************************************************************/ --/** -- * Queue length of BLE Event -- * This parameter defines the number of asynchronous events that can be stored in the HCI layer before -- * being reported to the application. When a command is sent to the BLE core coprocessor, the HCI layer -- * is waiting for the event with the Num_HCI_Command_Packets set to 1. The receive queue shall be large -- * enough to store all asynchronous events received in between. -- * When CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE is set to 27, this allow to store three 255 bytes long asynchronous events -- * between the HCI command and its event. -- * This parameter depends on the value given to CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE. When the queue size is to small, -- * the system may hang if the queue is full with asynchronous events and the HCI layer is still waiting -- * for a CC/CS event, In that case, the notification TL_BLE_HCI_ToNot() is called to indicate -- * to the application a HCI command did not receive its command event within 30s (Default HCI Timeout). -- */ --#define CFG_TLBLE_EVT_QUEUE_LENGTH 5 --/** -- * This parameter should be set to fit most events received by the HCI layer. It defines the buffer size of each element -- * allocated in the queue of received events and can be used to optimize the amount of RAM allocated by the Memory Manager. -- * It should not exceed 255 which is the maximum HCI packet payload size (a greater value is a lost of memory as it will -- * never be used) -- * It shall be at least 4 to receive the command status event in one frame. -- * The default value is set to 27 to allow receiving an event of MTU size in a single buffer. This value maybe reduced -- * further depending on the application. -- */ --#define CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE 255 /**< Set to 255 with the memory manager and the mailbox */ -- --#define TL_BLE_EVENT_FRAME_SIZE ( TL_EVT_HDR_SIZE + CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE ) --/****************************************************************************** -- * UART interfaces -- ******************************************************************************/ -- --/** -- * Select UART interfaces -- */ --#define CFG_UART_GUI hw_uart1 --#define CFG_DEBUG_TRACE_UART 0 --/****************************************************************************** -- * USB interface -- ******************************************************************************/ -- --/** -- * Enable/Disable USB interface -- */ --#define CFG_USB_INTERFACE_ENABLE 0 -- --/****************************************************************************** -- * IPCC interface -- ******************************************************************************/ -- --/** -- * The IPCC is dedicated to the communication between the CPU2 and the CPU1 -- * and shall not be modified by the application -- * The two following definitions shall not be modified -- */ --#define HAL_IPCC_TX_IRQHandler(...) HW_IPCC_Tx_Handler( ) --#define HAL_IPCC_RX_IRQHandler(...) HW_IPCC_Rx_Handler( ) -- --/****************************************************************************** -- * Low Power -- ******************************************************************************/ --/** -- * When set to 1, the low power mode is enable -- * When set to 0, the device stays in RUN mode -- */ --#define CFG_LPM_SUPPORTED 1 -- --/****************************************************************************** -- * RTC interface -- ******************************************************************************/ --#define HAL_RTCEx_WakeUpTimerIRQHandler(...) HW_TS_RTC_Wakeup_Handler( ) -- --/****************************************************************************** -- * Timer Server -- ******************************************************************************/ --/** -- * CFG_RTC_WUCKSEL_DIVIDER: This sets the RTCCLK divider to the wakeup timer. -- * The lower is the value, the better is the power consumption and the accuracy of the timerserver -- * The higher is the value, the finest is the granularity -- * -- * CFG_RTC_ASYNCH_PRESCALER: This sets the asynchronous prescaler of the RTC. It should as high as possible ( to output -- * clock as low as possible) but the output clock should be equal or higher frequency compare to the clock feeding -- * the wakeup timer. A lower clock speed would impact the accuracy of the timer server. -- * -- * CFG_RTC_SYNCH_PRESCALER: This sets the synchronous prescaler of the RTC. -- * When the 1Hz calendar clock is required, it shall be sets according to other settings -- * When the 1Hz calendar clock is not needed, CFG_RTC_SYNCH_PRESCALER should be set to 0x7FFF (MAX VALUE) -- * -- * CFG_RTCCLK_DIVIDER_CONF: -- * Shall be set to either 0,2,4,8,16 -- * When set to either 2,4,8,16, the 1Hhz calendar is supported -- * When set to 0, the user sets its own configuration -- * -- * The following settings are computed with LSI as input to the RTC -- */ -- --#define CFG_RTCCLK_DIVIDER_CONF 0 -- --#if (CFG_RTCCLK_DIVIDER_CONF == 0) --/** -- * Custom configuration -- * It does not support 1Hz calendar -- * It divides the RTC CLK by 16 -- */ -- --#define CFG_RTCCLK_DIV (16) --#define CFG_RTC_WUCKSEL_DIVIDER (0) --#define CFG_RTC_ASYNCH_PRESCALER (0x0F) --#define CFG_RTC_SYNCH_PRESCALER (0x7FFF) -- --#else -- --#if (CFG_RTCCLK_DIVIDER_CONF == 2) --/** -- * It divides the RTC CLK by 2 -- */ --#define CFG_RTC_WUCKSEL_DIVIDER (3) --#endif -- --#if (CFG_RTCCLK_DIVIDER_CONF == 4) --/** -- * It divides the RTC CLK by 4 -- */ --#define CFG_RTC_WUCKSEL_DIVIDER (2) --#endif -- --#if (CFG_RTCCLK_DIVIDER_CONF == 8) --/** -- * It divides the RTC CLK by 8 -- */ --#define CFG_RTC_WUCKSEL_DIVIDER (1) --#endif -- --#if (CFG_RTCCLK_DIVIDER_CONF == 16) --/** -- * It divides the RTC CLK by 16 -- */ --#define CFG_RTC_WUCKSEL_DIVIDER (0) --#endif -- --#define CFG_RTCCLK_DIV CFG_RTCCLK_DIVIDER_CONF --#define CFG_RTC_ASYNCH_PRESCALER (CFG_RTCCLK_DIV - 1) --#define CFG_RTC_SYNCH_PRESCALER (DIVR( LSE_VALUE, (CFG_RTC_ASYNCH_PRESCALER+1) ) - 1 ) -- --#endif -- --/** tick timer values */ --#define CFG_TS_TICK_VAL DIVR( (CFG_RTCCLK_DIV * 1000000), LSE_VALUE ) --#define CFG_TS_TICK_VAL_PS DIVR( ((uint64_t)CFG_RTCCLK_DIV * 1e12), (uint64_t)LSE_VALUE ) -- --typedef enum --{ -- CFG_TIM_PROC_ID_ISR, -- /* USER CODE BEGIN CFG_TimProcID_t */ -- -- /* USER CODE END CFG_TimProcID_t */ --} CFG_TimProcID_t; -- --/****************************************************************************** -- * Debug -- ******************************************************************************/ --/** -- * When set, this resets some hw resources to set the device in the same state than the power up -- * The FW resets only register that may prevent the FW to run properly -- * -- * This shall be set to 0 in a final product -- * -- */ --#define CFG_HW_RESET_BY_FW 1 -- --/** -- * keep debugger enabled while in any low power mode when set to 1 -- * should be set to 0 in production -- */ --#define CFG_DEBUGGER_SUPPORTED 0 -- --/** -- * When set to 1, the traces are enabled in the BLE services -- */ --#define CFG_DEBUG_BLE_TRACE 0 -- --/** -- * Enable or Disable traces in application -- */ --#define CFG_DEBUG_APP_TRACE 0 -- --#if (CFG_DEBUG_APP_TRACE != 0) --#define APP_DBG_MSG PRINT_MESG_DBG --#else --#define APP_DBG_MSG PRINT_NO_MESG --#endif -- --#if ( (CFG_DEBUG_BLE_TRACE != 0) || (CFG_DEBUG_APP_TRACE != 0) ) --#define CFG_DEBUG_TRACE 1 --#endif -- --#if (CFG_DEBUG_TRACE != 0) --#undef CFG_LPM_SUPPORTED --#undef CFG_DEBUGGER_SUPPORTED --#define CFG_LPM_SUPPORTED 0 --#define CFG_DEBUGGER_SUPPORTED 1 --#endif -- --/** -- * When CFG_DEBUG_TRACE_FULL is set to 1, the trace are output with the API name, the file name and the line number -- * When CFG_DEBUG_TRACE_LIGHT is set to 1, only the debug message is output -- * -- * When both are set to 0, no trace are output -- * When both are set to 1, CFG_DEBUG_TRACE_FULL is selected -- */ --#define CFG_DEBUG_TRACE_LIGHT 0 --#define CFG_DEBUG_TRACE_FULL 0 -- --#if (( CFG_DEBUG_TRACE != 0 ) && ( CFG_DEBUG_TRACE_LIGHT == 0 ) && (CFG_DEBUG_TRACE_FULL == 0)) --#undef CFG_DEBUG_TRACE_FULL --#undef CFG_DEBUG_TRACE_LIGHT --#define CFG_DEBUG_TRACE_FULL 0 --#define CFG_DEBUG_TRACE_LIGHT 1 --#endif -- --#if ( CFG_DEBUG_TRACE == 0 ) --#undef CFG_DEBUG_TRACE_FULL --#undef CFG_DEBUG_TRACE_LIGHT --#define CFG_DEBUG_TRACE_FULL 0 --#define CFG_DEBUG_TRACE_LIGHT 0 --#endif -- --/** -- * When not set, the traces is looping on sending the trace over UART -- */ --#define DBG_TRACE_USE_CIRCULAR_QUEUE 1 -- --/** -- * max buffer Size to queue data traces and max data trace allowed. -- * Only Used if DBG_TRACE_USE_CIRCULAR_QUEUE is defined -- */ --#define DBG_TRACE_MSG_QUEUE_SIZE 4096 --#define MAX_DBG_TRACE_MSG_SIZE 1024 -- --/* USER CODE BEGIN Defines */ --#define CFG_LED_SUPPORTED 1 --#define CFG_BUTTON_SUPPORTED 1 -- --#define PUSH_BUTTON_SW1_EXTI_IRQHandler EXTI4_IRQHandler --#define PUSH_BUTTON_SW2_EXTI_IRQHandler EXTI0_IRQHandler --#define PUSH_BUTTON_SW3_EXTI_IRQHandler EXTI1_IRQHandler --/* USER CODE END Defines */ -- --/****************************************************************************** -- * Scheduler -- ******************************************************************************/ -- --/** -- * These are the lists of task id registered to the scheduler -- * Each task id shall be in the range [0:31] -- * This mechanism allows to implement a generic code in the API TL_BLE_HCI_StatusNot() to comply with -- * the requirement that a HCI/ACI command shall never be sent if there is already one pending -- */ -- --/**< Add in that list all tasks that may send a ACI/HCI command */ --typedef enum --{ -- CFG_TASK_BLE_HCI_CMD_ID, -- CFG_TASK_SYS_HCI_CMD_ID, -- CFG_TASK_HCI_ACL_DATA_ID, -- CFG_TASK_SYS_LOCAL_CMD_ID, -- CFG_TASK_TX_TO_HOST_ID, -- /* USER CODE BEGIN CFG_Task_Id_With_HCI_Cmd_t */ -- CFG_TASK_SW1_BUTTON_PUSHED_ID, -- CFG_TASK_SW2_BUTTON_PUSHED_ID, -- CFG_TASK_SW3_BUTTON_PUSHED_ID, -- /* USER CODE END CFG_Task_Id_With_HCI_Cmd_t */ -- CFG_LAST_TASK_ID_WITH_HCICMD, /**< Shall be LAST in the list */ --} CFG_Task_Id_With_HCI_Cmd_t; -- --/**< Add in that list all tasks that never send a ACI/HCI command */ --typedef enum --{ -- CFG_FIRST_TASK_ID_WITH_NO_HCICMD = CFG_LAST_TASK_ID_WITH_HCICMD - 1, /**< Shall be FIRST in the list */ -- CFG_TASK_SYSTEM_HCI_ASYNCH_EVT_ID, -- /* USER CODE BEGIN CFG_Task_Id_With_NO_HCI_Cmd_t */ -- -- /* USER CODE END CFG_Task_Id_With_NO_HCI_Cmd_t */ -- CFG_LAST_TASK_ID_WITH_NO_HCICMD /**< Shall be LAST in the list */ --} CFG_Task_Id_With_NO_HCI_Cmd_t; -- --#define CFG_TASK_NBR CFG_LAST_TASK_ID_WITH_NO_HCICMD -- --/** -- * This is the list of priority required by the application -- * Each Id shall be in the range 0..31 -- */ --typedef enum --{ -- CFG_SCH_PRIO_0, -- /* USER CODE BEGIN CFG_SCH_Prio_Id_t */ -- -- /* USER CODE END CFG_SCH_Prio_Id_t */ --} CFG_SCH_Prio_Id_t; -- --/** -- * This is a bit mapping over 32bits listing all events id supported in the application -- */ --typedef enum --{ -- CFG_IDLEEVT_SYSTEM_HCI_CMD_EVT_RSP_ID, -- /* USER CODE BEGIN CFG_IdleEvt_Id_t */ -- -- /* USER CODE END CFG_IdleEvt_Id_t */ --} CFG_IdleEvt_Id_t; -- --/****************************************************************************** -- * LOW POWER -- ******************************************************************************/ --/** -- * Supported requester to the MCU Low Power Manager - can be increased up to 32 -- * It list a bit mapping of all user of the Low Power Manager -- */ --typedef enum --{ -- CFG_LPM_APP, -- CFG_LPM_APP_BLE, -- /* USER CODE BEGIN CFG_LPM_Id_t */ -- -- /* USER CODE END CFG_LPM_Id_t */ --} CFG_LPM_Id_t; -- --/****************************************************************************** -- * OTP manager -- ******************************************************************************/ --#define CFG_OTP_BASE_ADDRESS OTP_AREA_BASE -- --#define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR -- --#endif /*APP_CONF_H */ -- -+/** -+ ****************************************************************************** -+ * @file app_conf_default.h -+ * @author MCD Application Team -+ * @brief Default application configuration file for STM32WPAN Middleware. -+ ****************************************************************************** -+ * @attention -+ * -+ * Copyright (c) 2020-2021 STMicroelectronics. -+ * All rights reserved. -+ * -+ * This software is licensed under terms that can be found in the LICENSE file -+ * in the root directory of this software component. -+ * If no LICENSE file comes with this software, it is provided AS-IS. -+ * -+ ****************************************************************************** -+ */ -+ -+/* Define to prevent recursive inclusion -------------------------------------*/ -+#ifndef APP_CONF_DEFAULT_H -+#define APP_CONF_DEFAULT_H -+ -+/****************************************************************************** -+ * Application Config -+ ******************************************************************************/ -+ -+/**< generic parameters ******************************************************/ -+/* HCI related defines */ -+ -+#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F -+#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C -+#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D -+#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251) -+#define HCI_RESET 0x0C03 -+ -+#ifndef BLE_SHARED_MEM_BYTE_ORDER -+ #define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST -+#endif -+#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128 -+ -+/** -+ * Define Tx Power -+ */ -+#define CFG_TX_POWER (0x18) /* -0.15dBm */ -+ -+/****************************************************************************** -+ * BLE Stack -+ ******************************************************************************/ -+/** -+ * Maximum number of simultaneous connections that the device will support. -+ * Valid values are from 1 to 8 -+ */ -+#define CFG_BLE_NUM_LINK 8 -+ -+/** -+ * Maximum number of Services that can be stored in the GATT database. -+ * Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services -+ */ -+#define CFG_BLE_NUM_GATT_SERVICES 8 -+ -+/** -+ * Maximum number of Attributes -+ * (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the services) -+ * that can be stored in the GATT database. -+ * Note that certain characteristics and relative descriptors are added automatically during device initialization -+ * so this parameters should be 9 plus the number of user Attributes -+ */ -+#define CFG_BLE_NUM_GATT_ATTRIBUTES 68 -+ -+/** -+ * Maximum supported ATT_MTU size -+ * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set -+ */ -+#define CFG_BLE_MAX_ATT_MTU (156) -+ -+/** -+ * Size of the storage area for Attribute values -+ * This value depends on the number of attributes used by application. In particular the sum of the following quantities (in octets) should be made for each attribute: -+ * - attribute value length -+ * - 5, if UUID is 16 bit; 19, if UUID is 128 bit -+ * - 2, if server configuration descriptor is used -+ * - 2*DTM_NUM_LINK, if client configuration descriptor is used -+ * - 2, if extended properties is used -+ * The total amount of memory needed is the sum of the above quantities for each attribute. -+ * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set -+ */ -+#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344) -+ -+/** -+ * Prepare Write List size in terms of number of packet -+ * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set -+ */ -+// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) -+#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A) -+ -+/** -+ * Number of allocated memory blocks -+ * This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set -+ */ -+// #define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) -+#define CFG_BLE_MBLOCK_COUNT (0x79) -+ -+/** -+ * Enable or disable the Extended Packet length feature. Valid values are 0 or 1. -+ */ -+#define CFG_BLE_DATA_LENGTH_EXTENSION 1 -+ -+/** -+ * Sleep clock accuracy in Slave mode (ppm value) -+ */ -+#define CFG_BLE_SLAVE_SCA 500 -+ -+/** -+ * Sleep clock accuracy in Master mode -+ * 0 : 251 ppm to 500 ppm -+ * 1 : 151 ppm to 250 ppm -+ * 2 : 101 ppm to 150 ppm -+ * 3 : 76 ppm to 100 ppm -+ * 4 : 51 ppm to 75 ppm -+ * 5 : 31 ppm to 50 ppm -+ * 6 : 21 ppm to 30 ppm -+ * 7 : 0 ppm to 20 ppm -+ */ -+#define CFG_BLE_MASTER_SCA 0 -+ -+/** -+ * LsSource -+ * Some information for Low speed clock mapped in bits field -+ * - bit 0: 1: Calibration for the RF system wakeup clock source 0: No calibration for the RF system wakeup clock source -+ * - bit 1: 1: STM32WB5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module -+ * - bit 2: 1: HSE/1024 Clock config 0: LSE Clock config -+ */ -+#if defined(STM32WB5Mxx) -+ #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) -+#else -+ #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) -+#endif -+ -+/** -+ * Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us) -+ */ -+#define CFG_BLE_HSE_STARTUP_TIME 0x148 -+ -+/** -+ * Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us) -+ */ -+#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF) -+ -+/** -+ * Viterbi Mode -+ * 1 : enabled -+ * 0 : disabled -+ */ -+#define CFG_BLE_VITERBI_MODE 1 -+ -+/** -+ * BLE stack Options flags to be configured with: -+ * - SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY -+ * - SHCI_C2_BLE_INIT_OPTIONS_LL_HOST -+ * - SHCI_C2_BLE_INIT_OPTIONS_NO_SVC_CHANGE_DESC -+ * - SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC -+ * - SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RO -+ * - SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW -+ * - SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV -+ * - SHCI_C2_BLE_INIT_OPTIONS_NO_EXT_ADV -+ * - SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 -+ * - SHCI_C2_BLE_INIT_OPTIONS_NO_CS_ALGO2 -+ * - SHCI_C2_BLE_INIT_OPTIONS_REDUC_GATTDB_NVM -+ * - SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM -+ * - SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_USED -+ * - SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED -+ * - SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_1 -+ * - SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3 -+ * - SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_WRITABLE -+ * - SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY -+ * - SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_SUPPORTED -+ * - SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED -+ * which are used to set following configuration bits: -+ * (bit 0): 1: LL only -+ * 0: LL + host -+ * (bit 1): 1: no service change desc. -+ * 0: with service change desc. -+ * (bit 2): 1: device name Read-Only -+ * 0: device name R/W -+ * (bit 3): 1: extended advertizing supported -+ * 0: extended advertizing not supported -+ * (bit 4): 1: CS Algo #2 supported -+ * 0: CS Algo #2 not supported -+ * (bit 5): 1: Reduced GATT database in NVM -+ * 0: Full GATT database in NVM -+ * (bit 6): 1: GATT caching is used -+ * 0: GATT caching is not used -+ * (bit 7): 1: LE Power Class 1 -+ * 0: LE Power Class 2-3 -+ * (bit 8): 1: appearance Writable -+ * 0: appearance Read-Only -+ * (bit 9): 1: Enhanced ATT supported -+ * 0: Enhanced ATT not supported -+ * other bits: reserved (shall be set to 0) -+ */ -+#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY) -+ -+#define CFG_BLE_MAX_COC_INITIATOR_NBR (32) -+ -+#define CFG_BLE_MIN_TX_POWER (-40) -+ -+#define CFG_BLE_MAX_TX_POWER (6) -+ -+/** -+ * BLE Rx model configuration flags to be configured with: -+ * - SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY -+ * - SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_BLOCKER -+ * which are used to set following configuration bits: -+ * (bit 0): 1: agc_rssi model improved vs RF blockers -+ * 0: Legacy agc_rssi model -+ * other bits: reserved (shall be set to 0) -+ */ -+ -+#define CFG_BLE_RX_MODEL_CONFIG (SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY) -+ -+/* Maximum number of advertising sets. -+ * Range: 1 .. 8 with limitation: -+ * This parameter is linked to CFG_BLE_MAX_ADV_DATA_LEN such as both compliant with allocated Total memory computed with BLE_EXT_ADV_BUFFER_SIZE based -+ * on Max Extended advertising configuration supported. -+ * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set -+ */ -+ -+#define CFG_BLE_MAX_ADV_SET_NBR (8) -+ -+ /* Maximum advertising data length (in bytes) -+ * Range: 31 .. 1650 with limitation: -+ * This parameter is linked to CFG_BLE_MAX_ADV_SET_NBR such as both compliant with allocated Total memory computed with BLE_EXT_ADV_BUFFER_SIZE based -+ * on Max Extended advertising configuration supported. -+ * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set -+ */ -+ -+#define CFG_BLE_MAX_ADV_DATA_LEN (207) -+ -+ /* RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB. -+ * Range: -1280 .. 1280 -+ */ -+ -+#define CFG_BLE_TX_PATH_COMPENS (0) -+ -+ /* RF RX Path Compensation Value (16-bit signed integer). Units: 0.1 dB. -+ * Range: -1280 .. 1280 -+ */ -+ -+#define CFG_BLE_RX_PATH_COMPENS (0) -+ -+ /* BLE core version (16-bit signed integer). -+ * - SHCI_C2_BLE_INIT_BLE_CORE_5_2 -+ * - SHCI_C2_BLE_INIT_BLE_CORE_5_3 -+ * which are used to set: 11(5.2), 12(5.3). -+ */ -+ -+#define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3) -+ -+#endif /* APP_CONF_DEFAULT_H */ -diff --git a/src/utility/STM32Cube_FW/ble_bufsize.h b/src/utility/STM32Cube_FW/ble_bufsize.h -index 4269fa4..cea5da8 100644 ---- a/src/utility/STM32Cube_FW/ble_bufsize.h -+++ b/src/utility/STM32Cube_FW/ble_bufsize.h -@@ -75,6 +75,13 @@ - ((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \ - BLE_MBLOCKS_SECURE_CONNECTIONS)) - -+/* -+ * BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count -+ */ -+#define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \ -+ BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \ -+ BLE_DEFAULT_MAX_ATT_MTU, n_link) -+ - /* - * BLE_FIXED_BUFFER_SIZE_BYTES: - * A part of the RAM, is dynamically allocated by initializing all the pointers -diff --git a/src/utility/STM32Cube_FW/hw.h b/src/utility/STM32Cube_FW/hw.h -index 503fa2c..fcf0451 100644 ---- a/src/utility/STM32Cube_FW/hw.h -+++ b/src/utility/STM32Cube_FW/hw.h -@@ -26,14 +26,21 @@ extern "C" { - #endif - - /* Includes ------------------------------------------------------------------*/ -+#include "stm32_def.h" -+#include "stm32wbxx_ll_bus.h" -+#include "stm32wbxx_ll_exti.h" -+#include "stm32wbxx_ll_system.h" -+#include "stm32wbxx_ll_rcc.h" -+#include "stm32wbxx_ll_ipcc.h" -+#include "stm32wbxx_ll_cortex.h" -+#include "stm32wbxx_ll_utils.h" -+#include "stm32wbxx_ll_pwr.h" - - /****************************************************************************** - * HW IPCC - ******************************************************************************/ - void HW_IPCC_Enable( void ); - void HW_IPCC_Init( void ); -- void HW_IPCC_Rx_Handler( void ); -- void HW_IPCC_Tx_Handler( void ); - - void HW_IPCC_BLE_Init( void ); - void HW_IPCC_BLE_SendCmd( void ); -@@ -80,23 +87,6 @@ extern "C" { - void HW_IPCC_TRACES_Init( void ); - void HW_IPCC_TRACES_EvtNot( void ); - -- void HW_IPCC_MAC_802_15_4_Init( void ); -- void HW_IPCC_MAC_802_15_4_SendCmd( void ); -- void HW_IPCC_MAC_802_15_4_SendAck( void ); -- void HW_IPCC_MAC_802_15_4_CmdEvtNot( void ); -- void HW_IPCC_MAC_802_15_4_EvtNot( void ); -- -- void HW_IPCC_ZIGBEE_Init( void ); -- -- void HW_IPCC_ZIGBEE_SendM4RequestToM0(void); /* M4 Request to M0 */ -- void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void); /* Request ACK from M0 */ -- -- void HW_IPCC_ZIGBEE_RecvM0NotifyToM4(void); /* M0 Notify to M4 */ -- void HW_IPCC_ZIGBEE_SendM4AckToM0Notify(void); /* Notify ACK from M4 */ -- void HW_IPCC_ZIGBEE_RecvM0RequestToM4(void); /* M0 Request to M4 */ -- void HW_IPCC_ZIGBEE_SendM4AckToM0Request(void); /* Request ACK from M4 */ -- -- - #ifdef __cplusplus - } - #endif -diff --git a/src/utility/STM32Cube_FW/hw_ipcc.c b/src/utility/STM32Cube_FW/hw_ipcc.c -index fd620b8..0c1868f 100644 ---- a/src/utility/STM32Cube_FW/hw_ipcc.c -+++ b/src/utility/STM32Cube_FW/hw_ipcc.c -@@ -1,4 +1,3 @@ --/* USER CODE BEGIN Header */ - /** - ****************************************************************************** - * @file hw_ipcc.c -@@ -16,10 +15,10 @@ - * - ****************************************************************************** - */ --/* USER CODE END Header */ - -+#if defined(STM32WBxx) - /* Includes ------------------------------------------------------------------*/ --#include "app_common.h" -+#include "hw.h" - #include "mbox_def.h" - - /* Global variables ---------------------------------------------------------*/ -@@ -56,34 +55,17 @@ static void HW_IPCC_LLD_BLE_ReceiveRspHandler( void ); - static void HW_IPCC_LLD_BLE_ReceiveM0CmdHandler( void ); - #endif - --#ifdef MAC_802_15_4_WB --static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void ); --static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void ); --#endif -- --#ifdef ZIGBEE_WB --static void HW_IPCC_ZIGBEE_CmdEvtHandler( void ); --static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void ); --static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void ); --#endif -- - /* Public function definition -----------------------------------------------*/ - - /****************************************************************************** - * INTERRUPT HANDLER - ******************************************************************************/ --void HW_IPCC_Rx_Handler( void ) -+void IPCC_C1_RX_IRQHandler( void ) - { - if (HW_IPCC_RX_PENDING( HW_IPCC_SYSTEM_EVENT_CHANNEL )) - { - HW_IPCC_SYS_EvtHandler(); - } --#ifdef MAC_802_15_4_WB -- else if (HW_IPCC_RX_PENDING( HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL )) -- { -- HW_IPCC_MAC_802_15_4_NotEvtHandler(); -- } --#endif /* MAC_802_15_4_WB */ - #ifdef THREAD_WB - else if (HW_IPCC_RX_PENDING( HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL )) - { -@@ -114,16 +96,6 @@ void HW_IPCC_Rx_Handler( void ) - HW_IPCC_LLD_BLE_ReceiveM0CmdHandler(); - } - #endif /* LLD_TESTS_WB */ --#ifdef ZIGBEE_WB -- else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL )) -- { -- HW_IPCC_ZIGBEE_StackNotifEvtHandler(); -- } -- else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL )) -- { -- HW_IPCC_ZIGBEE_StackM0RequestHandler(); -- } --#endif /* ZIGBEE_WB */ - else if (HW_IPCC_RX_PENDING( HW_IPCC_BLE_EVENT_CHANNEL )) - { - HW_IPCC_BLE_EvtHandler(); -@@ -132,22 +104,14 @@ void HW_IPCC_Rx_Handler( void ) - { - HW_IPCC_TRACES_EvtHandler(); - } -- -- return; - } - --void HW_IPCC_Tx_Handler( void ) -+void IPCC_C1_TX_IRQHandler( void ) - { - if (HW_IPCC_TX_PENDING( HW_IPCC_SYSTEM_CMD_RSP_CHANNEL )) - { - HW_IPCC_SYS_CmdEvtHandler(); - } --#ifdef MAC_802_15_4_WB -- else if (HW_IPCC_TX_PENDING( HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL )) -- { -- HW_IPCC_MAC_802_15_4_CmdEvtHandler(); -- } --#endif /* MAC_802_15_4_WB */ - #ifdef THREAD_WB - else if (HW_IPCC_TX_PENDING( HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL )) - { -@@ -157,12 +121,6 @@ void HW_IPCC_Tx_Handler( void ) - #ifdef LLD_TESTS_WB - // No TX handler for LLD tests - #endif /* LLD_TESTS_WB */ --#ifdef ZIGBEE_WB -- if (HW_IPCC_TX_PENDING( HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL )) -- { -- HW_IPCC_ZIGBEE_CmdEvtHandler(); -- } --#endif /* ZIGBEE_WB */ - else if (HW_IPCC_TX_PENDING( HW_IPCC_MM_RELEASE_BUFFER_CHANNEL )) - { - HW_IPCC_MM_FreeBufHandler(); -@@ -171,8 +129,6 @@ void HW_IPCC_Tx_Handler( void ) - { - HW_IPCC_BLE_AclDataEvtHandler(); - } -- -- return; - } - /****************************************************************************** - * GENERAL -@@ -204,8 +160,6 @@ void HW_IPCC_Enable( void ) - __SEV( ); /* Set the internal event flag and send an event to the CPU2 */ - __WFE( ); /* Clear the internal event flag */ - LL_PWR_EnableBootC2( ); -- -- return; - } - - void HW_IPCC_Init( void ) -@@ -217,8 +171,6 @@ void HW_IPCC_Init( void ) - - HAL_NVIC_EnableIRQ(IPCC_C1_RX_IRQn); - HAL_NVIC_EnableIRQ(IPCC_C1_TX_IRQn); -- -- return; - } - - /****************************************************************************** -@@ -227,15 +179,11 @@ void HW_IPCC_Init( void ) - void HW_IPCC_BLE_Init( void ) - { - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_BLE_EVENT_CHANNEL ); -- -- return; - } - - void HW_IPCC_BLE_SendCmd( void ) - { - LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_BLE_CMD_CHANNEL ); -- -- return; - } - - static void HW_IPCC_BLE_EvtHandler( void ) -@@ -243,16 +191,12 @@ static void HW_IPCC_BLE_EvtHandler( void ) - HW_IPCC_BLE_RxEvtNot(); - - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_BLE_EVENT_CHANNEL ); -- -- return; - } - - void HW_IPCC_BLE_SendAclData( void ) - { - LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL ); - LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL ); -- -- return; - } - - static void HW_IPCC_BLE_AclDataEvtHandler( void ) -@@ -260,8 +204,6 @@ static void HW_IPCC_BLE_AclDataEvtHandler( void ) - LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL ); - - HW_IPCC_BLE_AclDataAckNot(); -- -- return; - } - - __weak void HW_IPCC_BLE_AclDataAckNot( void ){}; -@@ -273,16 +215,12 @@ __weak void HW_IPCC_BLE_RxEvtNot( void ){}; - void HW_IPCC_SYS_Init( void ) - { - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL ); -- -- return; - } - - void HW_IPCC_SYS_SendCmd( void ) - { - LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ); - LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ); -- -- return; - } - - static void HW_IPCC_SYS_CmdEvtHandler( void ) -@@ -290,8 +228,6 @@ static void HW_IPCC_SYS_CmdEvtHandler( void ) - LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ); - - HW_IPCC_SYS_CmdEvtNot(); -- -- return; - } - - static void HW_IPCC_SYS_EvtHandler( void ) -@@ -299,61 +235,11 @@ static void HW_IPCC_SYS_EvtHandler( void ) - HW_IPCC_SYS_EvtNot(); - - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL ); -- -- return; - } - - __weak void HW_IPCC_SYS_CmdEvtNot( void ){}; - __weak void HW_IPCC_SYS_EvtNot( void ){}; - --/****************************************************************************** -- * MAC 802.15.4 -- ******************************************************************************/ --#ifdef MAC_802_15_4_WB --void HW_IPCC_MAC_802_15_4_Init( void ) --{ -- LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ); -- -- return; --} -- --void HW_IPCC_MAC_802_15_4_SendCmd( void ) --{ -- LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ); -- LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ); -- -- return; --} -- --void HW_IPCC_MAC_802_15_4_SendAck( void ) --{ -- LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ); -- LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ); -- -- return; --} -- --static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void ) --{ -- LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ); -- -- HW_IPCC_MAC_802_15_4_CmdEvtNot(); -- -- return; --} -- --static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void ) --{ -- LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ); -- -- HW_IPCC_MAC_802_15_4_EvtNot(); -- -- return; --} --__weak void HW_IPCC_MAC_802_15_4_CmdEvtNot( void ){}; --__weak void HW_IPCC_MAC_802_15_4_EvtNot( void ){}; --#endif -- - /****************************************************************************** - * THREAD - ******************************************************************************/ -@@ -393,8 +279,6 @@ void HW_IPCC_THREAD_CliSendAck( void ) - { - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL ); - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL ); -- -- return; - } - - static void HW_IPCC_OT_CmdEvtHandler( void ) -@@ -402,8 +286,6 @@ static void HW_IPCC_OT_CmdEvtHandler( void ) - LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL ); - - HW_IPCC_OT_CmdEvtNot(); -- -- return; - } - - static void HW_IPCC_THREAD_NotEvtHandler( void ) -@@ -411,8 +293,6 @@ static void HW_IPCC_THREAD_NotEvtHandler( void ) - LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL ); - - HW_IPCC_THREAD_EvtNot(); -- -- return; - } - - static void HW_IPCC_THREAD_CliNotEvtHandler( void ) -@@ -420,8 +300,6 @@ static void HW_IPCC_THREAD_CliNotEvtHandler( void ) - LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL ); - - HW_IPCC_THREAD_CliEvtNot(); -- -- return; - } - - __weak void HW_IPCC_OT_CmdEvtNot( void ){}; -@@ -438,7 +316,6 @@ void HW_IPCC_LLDTESTS_Init( void ) - { - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ); - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ); -- return; - } - - void HW_IPCC_LLDTESTS_SendCliCmd( void ) -@@ -451,28 +328,24 @@ static void HW_IPCC_LLDTESTS_ReceiveCliRspHandler( void ) - { - LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ); - HW_IPCC_LLDTESTS_ReceiveCliRsp(); -- return; - } - - void HW_IPCC_LLDTESTS_SendCliRspAck( void ) - { - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ); - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ); -- return; - } - - static void HW_IPCC_LLDTESTS_ReceiveM0CmdHandler( void ) - { - LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ); - HW_IPCC_LLDTESTS_ReceiveM0Cmd(); -- return; - } - - void HW_IPCC_LLDTESTS_SendM0CmdAck( void ) - { - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ); - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ); -- return; - } - __weak void HW_IPCC_LLDTESTS_ReceiveCliRsp( void ){}; - __weak void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void ){}; -@@ -486,13 +359,11 @@ void HW_IPCC_LLD_BLE_Init( void ) - { - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL ); - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ); -- return; - } - - void HW_IPCC_LLD_BLE_SendCliCmd( void ) - { - LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CLI_CMD_CHANNEL ); -- return; - } - - /*static void HW_IPCC_LLD_BLE_ReceiveCliRspHandler( void ) -@@ -506,21 +377,18 @@ void HW_IPCC_LLD_BLE_SendCliRspAck( void ) - { - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CLI_RSP_CHANNEL ); - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_CLI_RSP_CHANNEL ); -- return; - } - - static void HW_IPCC_LLD_BLE_ReceiveM0CmdHandler( void ) - { - //LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ); - HW_IPCC_LLD_BLE_ReceiveM0Cmd(); -- return; - } - - void HW_IPCC_LLD_BLE_SendM0CmdAck( void ) - { - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ); - //LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ); -- return; - } - __weak void HW_IPCC_LLD_BLE_ReceiveCliRsp( void ){}; - __weak void HW_IPCC_LLD_BLE_ReceiveM0Cmd( void ){}; -@@ -529,93 +397,22 @@ __weak void HW_IPCC_LLD_BLE_ReceiveM0Cmd( void ){}; - void HW_IPCC_LLD_BLE_SendCmd( void ) - { - LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CMD_CHANNEL ); -- return; - } - - static void HW_IPCC_LLD_BLE_ReceiveRspHandler( void ) - { - LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL ); - HW_IPCC_LLD_BLE_ReceiveRsp(); -- return; - } - - void HW_IPCC_LLD_BLE_SendRspAck( void ) - { - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL ); - LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL ); -- return; - } - - #endif /* LLD_BLE_WB */ - --/****************************************************************************** -- * ZIGBEE -- ******************************************************************************/ --#ifdef ZIGBEE_WB --void HW_IPCC_ZIGBEE_Init( void ) --{ -- LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ); -- LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ); -- -- return; --} -- --void HW_IPCC_ZIGBEE_SendM4RequestToM0( void ) --{ -- LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ); -- LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ); -- -- return; --} -- --void HW_IPCC_ZIGBEE_SendM4AckToM0Notify( void ) --{ -- LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ); -- LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ); -- -- return; --} -- --static void HW_IPCC_ZIGBEE_CmdEvtHandler( void ) --{ -- LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ); -- -- HW_IPCC_ZIGBEE_RecvAppliAckFromM0(); -- -- return; --} -- --static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void ) --{ -- LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ); -- -- HW_IPCC_ZIGBEE_RecvM0NotifyToM4(); -- -- return; --} -- --static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void ) --{ -- LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ); -- -- HW_IPCC_ZIGBEE_RecvM0RequestToM4(); -- -- return; --} -- --void HW_IPCC_ZIGBEE_SendM4AckToM0Request( void ) --{ -- LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ); -- LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ); -- -- return; --} -- --__weak void HW_IPCC_ZIGBEE_RecvAppliAckFromM0( void ){}; --__weak void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void ){}; --__weak void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void ){}; --#endif /* ZIGBEE_WB */ -- - /****************************************************************************** - * MEMORY MANAGER - ******************************************************************************/ -@@ -632,8 +429,6 @@ void HW_IPCC_MM_SendFreeBuf( void (*cb)( void ) ) - - LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL ); - } -- -- return; - } - - static void HW_IPCC_MM_FreeBufHandler( void ) -@@ -643,8 +438,6 @@ static void HW_IPCC_MM_FreeBufHandler( void ) - FreeBufCb(); - - LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL ); -- -- return; - } - - /****************************************************************************** -@@ -662,8 +455,7 @@ static void HW_IPCC_TRACES_EvtHandler( void ) - HW_IPCC_TRACES_EvtNot(); - - LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_TRACES_CHANNEL ); -- -- return; - } - - __weak void HW_IPCC_TRACES_EvtNot( void ){}; -+#endif /* STM32WBxx */ -diff --git a/src/utility/STM32Cube_FW/mbox_def.h b/src/utility/STM32Cube_FW/mbox_def.h -index 68b71f9..0c974f8 100644 ---- a/src/utility/STM32Cube_FW/mbox_def.h -+++ b/src/utility/STM32Cube_FW/mbox_def.h -@@ -106,12 +106,6 @@ extern "C" { - uint8_t *m0cmd_buffer; - } MB_BleLldTable_t; - -- typedef struct -- { -- uint8_t *notifM0toM4_buffer; -- uint8_t *appliCmdM4toM0_buffer; -- uint8_t *requestM0toM4_buffer; -- } MB_ZigbeeTable_t; - /** - * msg - * [0:7] = cmd/evt -@@ -139,13 +133,6 @@ extern "C" { - uint8_t *traces_queue; - } MB_TracesTable_t; - -- typedef struct -- { -- uint8_t *p_cmdrsp_buffer; -- uint8_t *p_notack_buffer; -- uint8_t *evt_queue; -- } MB_Mac_802_15_4_t; -- - typedef struct - { - MB_DeviceInfoTable_t *p_device_info_table; -@@ -154,8 +141,6 @@ extern "C" { - MB_SysTable_t *p_sys_table; - MB_MemManagerTable_t *p_mem_manager_table; - MB_TracesTable_t *p_traces_table; -- MB_Mac_802_15_4_t *p_mac_802_15_4_table; -- MB_ZigbeeTable_t *p_zigbee_table; - MB_LldTestsTable_t *p_lld_tests_table; - MB_BleLldTable_t *p_ble_lld_table; - } MB_RefTable_t; -@@ -199,15 +184,6 @@ typedef struct - * | | - * |<---HW_IPCC_SYSTEM_EVENT_CHANNEL-----------------| - * | | -- * | (ZIGBEE) | -- * |----HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL------------>| -- * | | -- * |----HW_IPCC_ZIGBEE_CMD_CLI_CHANNEL-------------->| -- * | | -- * |<---HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL-------| -- * | | -- * |<---HW_IPCC_ZIGBEE_CLI_NOTIF_ACK_CHANNEL---------| -- * | | - * | (THREAD) | - * |----HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL----------->| - * | | -@@ -231,11 +207,6 @@ typedef struct - * | | - * |<---HW_IPCC_BLE_LLD_M0_CMD_CHANNEL---------------| - * | | -- * | (MAC) | -- * |----HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL-------->| -- * | | -- * |<---HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL| -- * | | - * | (BUFFER) | - * |----HW_IPCC_MM_RELEASE_BUFFER_CHANNE------------>| - * | | -@@ -253,8 +224,6 @@ typedef struct - #define HW_IPCC_BLE_CMD_CHANNEL LL_IPCC_CHANNEL_1 - #define HW_IPCC_SYSTEM_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_2 - #define HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_3 --#define HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL LL_IPCC_CHANNEL_3 --#define HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_3 - #define HW_IPCC_MM_RELEASE_BUFFER_CHANNEL LL_IPCC_CHANNEL_4 - #define HW_IPCC_THREAD_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5 - #define HW_IPCC_LLDTESTS_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5 -@@ -266,8 +235,6 @@ typedef struct - #define HW_IPCC_BLE_EVENT_CHANNEL LL_IPCC_CHANNEL_1 - #define HW_IPCC_SYSTEM_EVENT_CHANNEL LL_IPCC_CHANNEL_2 - #define HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_3 --#define HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL LL_IPCC_CHANNEL_3 --#define HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_3 - #define HW_IPCC_LLDTESTS_M0_CMD_CHANNEL LL_IPCC_CHANNEL_3 - #define HW_IPCC_BLE_LLD_M0_CMD_CHANNEL LL_IPCC_CHANNEL_3 - #define HW_IPCC_TRACES_CHANNEL LL_IPCC_CHANNEL_4 -@@ -275,6 +242,5 @@ typedef struct - #define HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL LL_IPCC_CHANNEL_5 - #define HW_IPCC_BLE_LLD_CLI_RSP_CHANNEL LL_IPCC_CHANNEL_5 - #define HW_IPCC_BLE_LLD_RSP_CHANNEL LL_IPCC_CHANNEL_5 --#define HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL LL_IPCC_CHANNEL_5 - #endif /*__MBOX_H */ - -diff --git a/src/utility/STM32Cube_FW/shci.c b/src/utility/STM32Cube_FW/shci.c -index 301db76..a847522 100644 ---- a/src/utility/STM32Cube_FW/shci.c -+++ b/src/utility/STM32Cube_FW/shci.c -@@ -16,7 +16,7 @@ - ****************************************************************************** - */ - -- -+#if defined(STM32WBxx) - /* Includes ------------------------------------------------------------------*/ - #include "stm32_wpan_common.h" - -@@ -352,24 +352,6 @@ SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param ) - return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]); - } - --SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void ) --{ -- /** -- * Buffer is large enough to hold command complete without payload -- */ -- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; -- TL_EvtPacket_t * p_rsp; -- -- p_rsp = (TL_EvtPacket_t *)local_buffer; -- -- shci_send( SHCI_OPCODE_C2_ZIGBEE_INIT, -- 0, -- 0, -- p_rsp ); -- -- return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]); --} -- - SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket ) - { - /** -@@ -527,24 +509,6 @@ SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t Fla - return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]); - } - --SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void ) --{ -- /** -- * Buffer is large enough to hold command complete without payload -- */ -- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; -- TL_EvtPacket_t * p_rsp; -- -- p_rsp = (TL_EvtPacket_t *)local_buffer; -- -- shci_send( SHCI_OPCODE_C2_MAC_802_15_4_INIT, -- 0, -- 0, -- p_rsp ); -- -- return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]); --} -- - SHCI_CmdStatus_t SHCI_C2_Reinit( void ) - { - /** -@@ -739,3 +703,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo ) - - return (SHCI_Success); - } -+#endif /* STM32WBxx */ -diff --git a/src/utility/STM32Cube_FW/shci.h b/src/utility/STM32Cube_FW/shci.h -index 7ca9021..a0f1e4d 100644 ---- a/src/utility/STM32Cube_FW/shci.h -+++ b/src/utility/STM32Cube_FW/shci.h -@@ -49,7 +49,6 @@ extern "C" { - ERR_BLE_INIT = 0, /* This event is currently not reported by the CPU2 */ - ERR_THREAD_LLD_FATAL_ERROR = 125, /* The LLD driver used on 802_15_4 detected a fatal error */ - ERR_THREAD_UNKNOWN_CMD = 126, /* The command send by the CPU1 to control the Thread stack is unknown */ -- ERR_ZIGBEE_UNKNOWN_CMD = 200, /* The command send by the CPU1 to control the Zigbee stack is unknown */ - } SCHI_SystemErrCode_t; - - #define SHCI_EVTCODE ( 0xFF ) -@@ -216,9 +215,7 @@ extern "C" { - SHCI_OCF_C2_FLASH_STORE_DATA, - SHCI_OCF_C2_FLASH_ERASE_DATA, - SHCI_OCF_C2_RADIO_ALLOW_LOW_POWER, -- SHCI_OCF_C2_MAC_802_15_4_INIT, - SHCI_OCF_C2_REINIT, -- SHCI_OCF_C2_ZIGBEE_INIT, - SHCI_OCF_C2_LLD_TESTS_INIT, - SHCI_OCF_C2_EXTPA_CONFIG, - SHCI_OCF_C2_SET_FLASH_ACTIVITY_CONTROL, -@@ -436,7 +433,7 @@ extern "C" { - * PrWriteListSize - * NOTE: This parameter is ignored by the CPU2 when the parameter "Options" is set to "LL_only" ( see Options description in that structure ) - * -- * Maximum number of supported “prepare write request” -+ * Maximum number of supported "prepare write request" - * - Min value: given by the macro DEFAULT_PREP_WRITE_LIST_SIZE - * - Max value: a value higher than the minimum required can be specified, but it is not recommended - */ -@@ -503,7 +500,7 @@ extern "C" { - * MaxConnEventLength - * This parameter determines the maximum duration of a slave connection event. When this duration is reached the slave closes - * the current connections event (whatever is the CE_length parameter specified by the master in HCI_CREATE_CONNECTION HCI command), -- * expressed in units of 625/256 µs (~2.44 µs) -+ * expressed in units of 625/256 µs (~2.44 µs) - * - Min value: 0 (if 0 is specified, the master and slave perform only a single TX-RX exchange per connection event) - * - Max value: 1638400 (4000 ms). A higher value can be specified (max 0xFFFFFFFF) but results in a maximum connection time - * of 4000 ms as specified. In this case the parameter is not applied, and the predicted CE length calculated on slave is not shortened -@@ -512,7 +509,7 @@ extern "C" { - - /** - * HsStartupTime -- * Startup time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 µs (~2.44 µs). -+ * Startup time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 µs (~2.44 µs). - * - Min value: 0 - * - Max value: 820 (~2 ms). A higher value can be specified, but the value that implemented in stack is forced to ~2 ms - */ -@@ -678,8 +675,6 @@ extern "C" { - { - uint8_t thread_config; - uint8_t ble_config; -- uint8_t mac_802_15_4_config; -- uint8_t zigbee_config; - } SHCI_C2_DEBUG_TracesConfig_t; - - typedef PACKED_STRUCT -@@ -743,8 +738,6 @@ extern "C" { - { - BLE_ENABLE, - THREAD_ENABLE, -- ZIGBEE_ENABLE, -- MAC_ENABLE, - } SHCI_C2_CONCURRENT_Mode_Param_t; - /** No response parameters*/ - -@@ -767,18 +760,13 @@ extern "C" { - { - BLE_IP, - THREAD_IP, -- ZIGBEE_IP, - } SHCI_C2_FLASH_Ip_t; - /** No response parameters*/ - - #define SHCI_OPCODE_C2_RADIO_ALLOW_LOW_POWER (( SHCI_OGF << 10) + SHCI_OCF_C2_RADIO_ALLOW_LOW_POWER) - --#define SHCI_OPCODE_C2_MAC_802_15_4_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_MAC_802_15_4_INIT) -- - #define SHCI_OPCODE_C2_REINIT (( SHCI_OGF << 10) + SHCI_OCF_C2_REINIT) - --#define SHCI_OPCODE_C2_ZIGBEE_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_ZIGBEE_INIT) -- - #define SHCI_OPCODE_C2_LLD_TESTS_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_LLD_TESTS_INIT) - - #define SHCI_OPCODE_C2_BLE_LLD_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_BLE_LLD_INIT) -@@ -893,7 +881,7 @@ extern "C" { - #define FUS_DEVICE_INFO_TABLE_VALIDITY_KEYWORD (0xA94656B9) - - /* -- * At startup, the informations relative to the wireless binary are stored in RAM trough a structure defined by -+ * At startup, the information relative to the wireless binary are stored in RAM through a structure defined by - * MB_WirelessFwInfoTable_t.This structure contains 4 fields (Version,MemorySize, Stack_info and a reserved part) - * each of those coded on 32 bits as shown on the table below: - * -@@ -949,9 +937,6 @@ extern "C" { - #define INFO_STACK_TYPE_BLE_HCI_EXT_ADV 0x07 - #define INFO_STACK_TYPE_THREAD_FTD 0x10 - #define INFO_STACK_TYPE_THREAD_MTD 0x11 --#define INFO_STACK_TYPE_ZIGBEE_FFD 0x30 --#define INFO_STACK_TYPE_ZIGBEE_RFD 0x31 --#define INFO_STACK_TYPE_MAC 0x40 - #define INFO_STACK_TYPE_BLE_THREAD_FTD_STATIC 0x50 - #define INFO_STACK_TYPE_BLE_THREAD_FTD_DYAMIC 0x51 - #define INFO_STACK_TYPE_802154_LLD_TESTS 0x60 -@@ -960,12 +945,7 @@ extern "C" { - #define INFO_STACK_TYPE_BLE_LLD_TESTS 0x63 - #define INFO_STACK_TYPE_BLE_RLV 0x64 - #define INFO_STACK_TYPE_802154_RLV 0x65 --#define INFO_STACK_TYPE_BLE_ZIGBEE_FFD_STATIC 0x70 --#define INFO_STACK_TYPE_BLE_ZIGBEE_RFD_STATIC 0x71 --#define INFO_STACK_TYPE_BLE_ZIGBEE_FFD_DYNAMIC 0x78 --#define INFO_STACK_TYPE_BLE_ZIGBEE_RFD_DYNAMIC 0x79 - #define INFO_STACK_TYPE_RLV 0x80 --#define INFO_STACK_TYPE_BLE_MAC_STATIC 0x90 - - typedef struct { - /** -@@ -1139,7 +1119,7 @@ typedef struct { - * @brief Starts the LLD tests CLI - * - * @param param_size : Nb of bytes -- * @param p_param : pointeur with data to give from M4 to M0 -+ * @param p_param : pointer with data to give from M4 to M0 - * @retval Status - */ - SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param ); -@@ -1149,20 +1129,11 @@ typedef struct { - * @brief Starts the LLD tests BLE - * - * @param param_size : Nb of bytes -- * @param p_param : pointeur with data to give from M4 to M0 -+ * @param p_param : pointer with data to give from M4 to M0 - * @retval Status - */ - SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param ); - -- /** -- * SHCI_C2_ZIGBEE_Init -- * @brief Starts the Zigbee Stack -- * -- * @param None -- * @retval Status -- */ -- SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void ); -- - /** - * SHCI_C2_DEBUG_Init - * @brief Starts the Traces -@@ -1237,16 +1208,6 @@ typedef struct { - */ - SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t FlagRadioLowPowerOn); - -- -- /** -- * SHCI_C2_MAC_802_15_4_Init -- * @brief Starts the MAC 802.15.4 on M0 -- * -- * @param None -- * @retval Status -- */ -- SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void ); -- - /** - * SHCI_GetWirelessFwInfo - * @brief This function read back the informations relative to the wireless binary loaded. -diff --git a/src/utility/STM32Cube_FW/shci_tl.c b/src/utility/STM32Cube_FW/shci_tl.c -index 449b8b1..b3cee00 100644 ---- a/src/utility/STM32Cube_FW/shci_tl.c -+++ b/src/utility/STM32Cube_FW/shci_tl.c -@@ -16,12 +16,13 @@ - ****************************************************************************** - */ - -- -+#if defined(STM32WBxx) - /* Includes ------------------------------------------------------------------*/ - #include "stm32_wpan_common.h" - - #include "stm_list.h" - #include "shci_tl.h" -+#include "stm32_def.h" - - /* Private typedef -----------------------------------------------------------*/ - typedef enum -@@ -70,8 +71,6 @@ void shci_init(void(* UserEvtRx)(void* pData), void* pConf) - shci_register_io_bus (&shciContext.io); - - TlInit((TL_CmdPacket_t *)(((SHCI_TL_HciInitConf_t *)pConf)->p_cmdbuffer)); -- -- return; - } - - void shci_user_evt_proc(void) -@@ -127,8 +126,6 @@ void shci_user_evt_proc(void) - shci_notify_asynch_evt((void*) &SHciAsynchEventQueue); - } - -- -- return; - } - - void shci_resume_flow( void ) -@@ -140,8 +137,6 @@ void shci_resume_flow( void ) - * be called - */ - shci_notify_asynch_evt((void*) &SHciAsynchEventQueue); -- -- return; - } - - void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payload, TL_EvtPacket_t * p_rsp ) -@@ -164,8 +159,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl - memcpy( &(p_rsp->evtserial), pCmdBuffer, ((TL_EvtSerial_t*)pCmdBuffer)->evt.plen + TL_EVT_HDR_SIZE ); - - Cmd_SetStatus(SHCI_TL_CmdAvailable); -+} -+ -+void shci_notify_asynch_evt(void *pdata) -+{ -+ UNUSED(pdata); -+ /* Need to parse data in future version */ -+ shci_user_evt_proc(); -+} - -- return; -+void shci_register_io_bus(tSHciIO *fops) -+{ -+ /* Register IO bus services */ -+ fops->Init = TL_SYS_Init; -+ fops->Send = TL_SYS_SendCmd; - } - - /* Private functions ---------------------------------------------------------*/ -@@ -190,8 +197,6 @@ static void TlInit( TL_CmdPacket_t * p_cmdbuffer ) - Conf.IoBusCallBackUserEvt = TlUserEvtReceived; - shciContext.io.Init(&Conf); - } -- -- return; - } - - static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus) -@@ -212,24 +217,18 @@ static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus) - StatusNotCallBackFunction( SHCI_TL_CmdAvailable ); - } - } -- -- return; - } - - static void TlCmdEvtReceived(TL_EvtPacket_t *shcievt) - { - (void)(shcievt); - shci_cmd_resp_release(0); /**< Notify the application the Cmd response has been received */ -- -- return; - } - - static void TlUserEvtReceived(TL_EvtPacket_t *shcievt) - { - LST_insert_tail(&SHciAsynchEventQueue, (tListNode *)shcievt); - shci_notify_asynch_evt((void*) &SHciAsynchEventQueue); /**< Notify the application a full HCI event has been received */ -- -- return; - } - - /* Weak implementation ----------------------------------------------------------------*/ -@@ -239,8 +238,6 @@ __WEAK void shci_cmd_resp_wait(uint32_t timeout) - - CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT; - while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE); -- -- return; - } - - __WEAK void shci_cmd_resp_release(uint32_t flag) -@@ -248,7 +245,5 @@ __WEAK void shci_cmd_resp_release(uint32_t flag) - (void)flag; - - CmdRspStatusFlag = SHCI_TL_CMD_RESP_RELEASE; -- -- return; - } -- -+#endif /* STM32WBxx */ -diff --git a/src/utility/STM32Cube_FW/stm32_wpan_common.h b/src/utility/STM32Cube_FW/stm32_wpan_common.h -index f407bb9..5a2b2a5 100644 ---- a/src/utility/STM32Cube_FW/stm32_wpan_common.h -+++ b/src/utility/STM32Cube_FW/stm32_wpan_common.h -@@ -25,19 +25,9 @@ - extern "C" { - #endif - --#if defined ( __CC_ARM )||defined (__ARMCC_VERSION) -- #define __ASM __asm /*!< asm keyword for ARM Compiler */ -- #define __INLINE __inline /*!< inline keyword for ARM Compiler */ -- #define __STATIC_INLINE static __inline --#elif defined ( __ICCARM__ ) -- #define __ASM __asm /*!< asm keyword for IAR Compiler */ -- #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ -- #define __STATIC_INLINE static inline --#elif defined ( __GNUC__ ) -- #define __ASM __asm /*!< asm keyword for GNU Compiler */ -- #define __INLINE inline /*!< inline keyword for GNU Compiler */ -- #define __STATIC_INLINE static inline --#endif -+#define __ASM __asm /*!< asm keyword for GNU Compiler */ -+#define __INLINE inline /*!< inline keyword for GNU Compiler */ -+#define __STATIC_INLINE static inline - - #include - #include -@@ -140,29 +130,8 @@ extern "C" { - /* ----------------------------------- * - * Packed usage (compiler dependent) * - * ----------------------------------- */ --#undef PACKED__ - #undef PACKED_STRUCT -- --#if defined ( __CC_ARM ) -- #if defined ( __GNUC__ ) -- /* GNU extension */ -- #define PACKED__ __attribute__((packed)) -- #define PACKED_STRUCT struct PACKED__ -- #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050U) -- #define PACKED__ __attribute__((packed)) -- #define PACKED_STRUCT struct PACKED__ -- #else -- #define PACKED__(TYPE) __packed TYPE -- #define PACKED_STRUCT PACKED__(struct) -- #endif --#elif defined ( __GNUC__ ) -- #define PACKED__ __attribute__((packed)) -- #define PACKED_STRUCT struct PACKED__ --#elif defined (__ICCARM__) -- #define PACKED_STRUCT __packed struct --#else -- #define PACKED_STRUCT __packed struct --#endif -+#define PACKED_STRUCT struct __packed - - #ifdef __cplusplus - } -diff --git a/src/utility/STM32Cube_FW/stm_list.c b/src/utility/STM32Cube_FW/stm_list.c -index 4c92864..9892441 100644 ---- a/src/utility/STM32Cube_FW/stm_list.c -+++ b/src/utility/STM32Cube_FW/stm_list.c -@@ -16,13 +16,13 @@ - ****************************************************************************** - */ - -- -+#if defined(STM32WBxx) - /****************************************************************************** - * Include Files - ******************************************************************************/ --#include "utilities_common.h" -- - #include "stm_list.h" -+#include "cmsis_gcc.h" -+#include "stm32_wpan_common.h" - - /****************************************************************************** - * Function Definitions -@@ -33,20 +33,20 @@ void LST_init_head (tListNode * listHead) - listHead->prev = listHead; - } - --uint8_t LST_is_empty (tListNode * listHead) -+bool LST_is_empty (tListNode * listHead) - { - uint32_t primask_bit; -- uint8_t return_value; -+ bool return_value; - - primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */ - __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/ - if(listHead->next == listHead) - { -- return_value = TRUE; -+ return_value = true; - } - else - { -- return_value = FALSE; -+ return_value = false; - } - __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/ - -@@ -204,3 +204,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node) - - __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/ - } -+#endif /* STM32WBxx */ -diff --git a/src/utility/STM32Cube_FW/stm_list.h b/src/utility/STM32Cube_FW/stm_list.h -index b7c3254..769c211 100644 ---- a/src/utility/STM32Cube_FW/stm_list.h -+++ b/src/utility/STM32Cube_FW/stm_list.h -@@ -21,6 +21,8 @@ - #define _STM_LIST_H_ - - /* Includes ------------------------------------------------------------------*/ -+#include "stdint.h" -+#include "stdbool.h" - #include "stm32_wpan_common.h" - - typedef PACKED_STRUCT _tListNode { -@@ -30,7 +32,7 @@ typedef PACKED_STRUCT _tListNode { - - void LST_init_head (tListNode * listHead); - --uint8_t LST_is_empty (tListNode * listHead); -+bool LST_is_empty (tListNode * listHead); - - void LST_insert_head (tListNode * listHead, tListNode * node); - -diff --git a/src/utility/STM32Cube_FW/tl.h b/src/utility/STM32Cube_FW/tl.h -index c199bb2..982bb58 100644 ---- a/src/utility/STM32Cube_FW/tl.h -+++ b/src/utility/STM32Cube_FW/tl.h -@@ -202,19 +202,6 @@ typedef struct - uint8_t *p_BleLldM0CmdBuffer; - } TL_BLE_LLD_Config_t; - --typedef struct --{ -- uint8_t *p_Mac_802_15_4_CmdRspBuffer; -- uint8_t *p_Mac_802_15_4_NotAckBuffer; --} TL_MAC_802_15_4_Config_t; -- --typedef struct --{ -- uint8_t *p_ZigbeeOtCmdRspBuffer; -- uint8_t *p_ZigbeeNotAckBuffer; -- uint8_t *p_ZigbeeNotifRequestBuffer; --} TL_ZIGBEE_Config_t; -- - /** - * @brief Contain the BLE HCI Init Configuration - * @{ -@@ -308,26 +295,6 @@ void TL_MM_EvtDone( TL_EvtPacket_t * hcievt ); - void TL_TRACES_Init( void ); - void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt ); - --/****************************************************************************** -- * MAC 802.15.4 -- ******************************************************************************/ --void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config ); --void TL_MAC_802_15_4_SendCmd( void ); --void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ); --void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer ); --void TL_MAC_802_15_4_SendAck ( void ); -- --/****************************************************************************** -- * ZIGBEE -- ******************************************************************************/ --void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config ); --void TL_ZIGBEE_SendM4RequestToM0( void ); --void TL_ZIGBEE_SendM4AckToM0Notify ( void ); --void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer ); --void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ); --void TL_ZIGBEE_M0RequestReceived(TL_EvtPacket_t * Otbuffer ); --void TL_ZIGBEE_SendM4AckToM0Request(void); -- - #ifdef __cplusplus - } /* extern "C" */ - #endif -diff --git a/src/utility/STM32Cube_FW/tl_mbox.c b/src/utility/STM32Cube_FW/tl_mbox.c -index fcd7766..a9abb18 100644 ---- a/src/utility/STM32Cube_FW/tl_mbox.c -+++ b/src/utility/STM32Cube_FW/tl_mbox.c -@@ -16,6 +16,7 @@ - ****************************************************************************** - */ - -+#if defined(STM32WBxx) - /* Includes ------------------------------------------------------------------*/ - #include "stm32_wpan_common.h" - #include "hw.h" -@@ -51,15 +52,13 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable; - PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable; - PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable; - PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable; --PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table; --PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table; - - /**< tables */ - PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue; - PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue; - PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint8_t CsBuffer[sizeof(TL_PacketHeader_t) + TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t)]; --PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode EvtQueue; --PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode SystemEvtQueue; -+PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static tListNode EvtQueue; -+PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static tListNode SystemEvtQueue; - - - static tListNode LocalFreeBufQueue; -@@ -97,8 +96,6 @@ void TL_Init( void ) - TL_RefTable.p_sys_table = &TL_SysTable; - TL_RefTable.p_mem_manager_table = &TL_MemManagerTable; - TL_RefTable.p_traces_table = &TL_TracesTable; -- TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table; -- TL_RefTable.p_zigbee_table = &TL_Zigbee_Table; - HW_IPCC_Init(); - - return; -@@ -452,139 +449,6 @@ void TL_BLE_LLD_SendRspAck( void ) - } - #endif /* BLE_LLD_WB */ - --#ifdef MAC_802_15_4_WB --/****************************************************************************** -- * MAC 802.15.4 -- ******************************************************************************/ --void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config ) --{ -- MB_Mac_802_15_4_t * p_mac_802_15_4_table; -- -- p_mac_802_15_4_table = TL_RefTable.p_mac_802_15_4_table; -- -- p_mac_802_15_4_table->p_cmdrsp_buffer = p_Config->p_Mac_802_15_4_CmdRspBuffer; -- p_mac_802_15_4_table->p_notack_buffer = p_Config->p_Mac_802_15_4_NotAckBuffer; -- -- HW_IPCC_MAC_802_15_4_Init(); -- -- return; --} -- --void TL_MAC_802_15_4_SendCmd( void ) --{ -- ((TL_CmdPacket_t *)(TL_RefTable.p_mac_802_15_4_table->p_cmdrsp_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE; -- -- HW_IPCC_MAC_802_15_4_SendCmd(); -- -- return; --} -- --void TL_MAC_802_15_4_SendAck ( void ) --{ -- ((TL_CmdPacket_t *)(TL_RefTable.p_mac_802_15_4_table->p_notack_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE; -- -- HW_IPCC_MAC_802_15_4_SendAck(); -- -- return; --} -- --void HW_IPCC_MAC_802_15_4_CmdEvtNot(void) --{ -- TL_MAC_802_15_4_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_mac_802_15_4_table->p_cmdrsp_buffer) ); -- -- return; --} -- --void HW_IPCC_MAC_802_15_4_EvtNot( void ) --{ -- TL_MAC_802_15_4_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_mac_802_15_4_table->p_notack_buffer) ); -- -- return; --} -- --__WEAK void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){}; --__WEAK void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer ){}; --#endif -- --#ifdef ZIGBEE_WB --/****************************************************************************** -- * ZIGBEE -- ******************************************************************************/ --void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config ) --{ -- MB_ZigbeeTable_t * p_zigbee_table; -- -- p_zigbee_table = TL_RefTable.p_zigbee_table; -- p_zigbee_table->appliCmdM4toM0_buffer = p_Config->p_ZigbeeOtCmdRspBuffer; -- p_zigbee_table->notifM0toM4_buffer = p_Config->p_ZigbeeNotAckBuffer; -- p_zigbee_table->requestM0toM4_buffer = p_Config->p_ZigbeeNotifRequestBuffer; -- -- HW_IPCC_ZIGBEE_Init(); -- -- return; --} -- --/* Zigbee M4 to M0 Request */ --void TL_ZIGBEE_SendM4RequestToM0( void ) --{ -- ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE; -- -- HW_IPCC_ZIGBEE_SendM4RequestToM0(); -- -- return; --} -- --/* Used to receive an ACK from the M0 */ --void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void) --{ -- TL_ZIGBEE_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer) ); -- -- return; --} -- --/* Zigbee notification from M0 to M4 */ --void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void ) --{ -- TL_ZIGBEE_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer) ); -- -- return; --} -- --/* Send an ACK to the M0 for a Notification */ --void TL_ZIGBEE_SendM4AckToM0Notify ( void ) --{ -- ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE; -- -- HW_IPCC_ZIGBEE_SendM4AckToM0Notify(); -- -- return; --} -- --/* Zigbee M0 to M4 Request */ --void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void ) --{ -- TL_ZIGBEE_M0RequestReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->requestM0toM4_buffer) ); -- -- return; --} -- --/* Send an ACK to the M0 for a Request */ --void TL_ZIGBEE_SendM4AckToM0Request(void) --{ -- ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->requestM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE; -- -- HW_IPCC_ZIGBEE_SendM4AckToM0Request(); -- -- return; --} -- -- --__WEAK void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){}; --__WEAK void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer ){}; --#endif -- -- -- - /****************************************************************************** - * MEMORY MANAGER - ******************************************************************************/ -@@ -846,3 +710,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer) - - return; - } -+#endif /* STM32WBxx */ --- -2.38.0.windows.1 - diff --git a/extras/STM32Cube_FW/0002-fix-include-a-timeout-when-waiting-for-the-cmd_resp.patch b/extras/STM32Cube_FW/0002-fix-include-a-timeout-when-waiting-for-the-cmd_resp.patch index 81ac67fd..feeef35a 100644 --- a/extras/STM32Cube_FW/0002-fix-include-a-timeout-when-waiting-for-the-cmd_resp.patch +++ b/extras/STM32Cube_FW/0002-fix-include-a-timeout-when-waiting-for-the-cmd_resp.patch @@ -1,15 +1,15 @@ -From a3c689a99506126587dfd7285c4b198db4a790e5 Mon Sep 17 00:00:00 2001 +From 12683bb7a3f0b0ad1e10400cba0e3694f9b9ee95 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 12 Dec 2022 17:17:48 +0100 -Subject: [PATCH 2/3] fix: include a timeout when waiting for the cmd_resp +Subject: [PATCH 2/4] fix: include a timeout when waiting for the cmd_resp Signed-off-by: Frederic Pillon --- - src/utility/STM32Cube_FW/shci_tl.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) + src/utility/STM32Cube_FW/shci_tl.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utility/STM32Cube_FW/shci_tl.c b/src/utility/STM32Cube_FW/shci_tl.c -index b3cee00..1abd1be 100644 +index a336aa6..d1d35f5 100644 --- a/src/utility/STM32Cube_FW/shci_tl.c +++ b/src/utility/STM32Cube_FW/shci_tl.c @@ -23,6 +23,7 @@ @@ -20,7 +20,7 @@ index b3cee00..1abd1be 100644 /* Private typedef -----------------------------------------------------------*/ typedef enum -@@ -234,10 +235,12 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt) +@@ -250,11 +251,12 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt) /* Weak implementation ----------------------------------------------------------------*/ __WEAK void shci_cmd_resp_wait(uint32_t timeout) { @@ -28,14 +28,15 @@ index b3cee00..1abd1be 100644 - CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT; - while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE); +- + for (unsigned long start = millis(); (millis() - start) < timeout;) { + if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) { + break; + } + } + return; } - __WEAK void shci_cmd_resp_release(uint32_t flag) -- 2.38.0.windows.1 diff --git a/extras/STM32Cube_FW/0003-chore-add-support-for-customize-app_conf_default.h.patch b/extras/STM32Cube_FW/0003-chore-add-support-for-customize-app_conf_default.h.patch index a10fa6e7..e2da2673 100644 --- a/extras/STM32Cube_FW/0003-chore-add-support-for-customize-app_conf_default.h.patch +++ b/extras/STM32Cube_FW/0003-chore-add-support-for-customize-app_conf_default.h.patch @@ -1,18 +1,18 @@ -From 81472cc135126cb46701a058647de2cf82160fb9 Mon Sep 17 00:00:00 2001 +From 8575588fedd55cf7238a1a810708100e700e57c0 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 12 Dec 2022 17:29:27 +0100 -Subject: [PATCH 3/3] chore: add support for customize app_conf_default.h +Subject: [PATCH 3/4] chore: add support for customize app_conf_default.h Signed-off-by: Frederic Pillon --- - src/utility/STM32Cube_FW/app_conf_default.h | 88 ++++++++++++++++----- - 1 file changed, 68 insertions(+), 20 deletions(-) + src/utility/STM32Cube_FW/app_conf_default.h | 86 ++++++++++++++++----- + 1 file changed, 68 insertions(+), 18 deletions(-) diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h -index cc8c3e8..35cad34 100644 +index e89df14..1f17900 100644 --- a/src/utility/STM32Cube_FW/app_conf_default.h +++ b/src/utility/STM32Cube_FW/app_conf_default.h -@@ -41,7 +41,9 @@ +@@ -48,7 +48,9 @@ /** * Define Tx Power */ @@ -21,9 +21,9 @@ index cc8c3e8..35cad34 100644 + #define CFG_TX_POWER (0x18) /* -0.15dBm */ +#endif - /****************************************************************************** - * BLE Stack -@@ -50,13 +52,25 @@ + #if 0 + /** +@@ -132,13 +134,25 @@ * Maximum number of simultaneous connections that the device will support. * Valid values are from 1 to 8 */ @@ -51,7 +51,7 @@ index cc8c3e8..35cad34 100644 /** * Maximum number of Attributes -@@ -65,13 +79,21 @@ +@@ -147,13 +161,21 @@ * Note that certain characteristics and relative descriptors are added automatically during device initialization * so this parameters should be 9 plus the number of user Attributes */ @@ -75,7 +75,7 @@ index cc8c3e8..35cad34 100644 /** * Size of the storage area for Attribute values -@@ -84,14 +106,22 @@ +@@ -166,14 +188,22 @@ * The total amount of memory needed is the sum of the above quantities for each attribute. * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ @@ -100,7 +100,7 @@ index cc8c3e8..35cad34 100644 /** * Number of allocated memory blocks -@@ -103,12 +133,16 @@ +@@ -185,12 +215,16 @@ /** * Enable or disable the Extended Packet length feature. Valid values are 0 or 1. */ @@ -119,7 +119,7 @@ index cc8c3e8..35cad34 100644 /** * Sleep clock accuracy in Master mode -@@ -121,7 +155,9 @@ +@@ -203,7 +237,9 @@ * 6 : 21 ppm to 30 ppm * 7 : 0 ppm to 20 ppm */ @@ -130,7 +130,7 @@ index cc8c3e8..35cad34 100644 /** * LsSource -@@ -130,21 +166,27 @@ +@@ -212,21 +248,27 @@ * - bit 1: 1: STM32WB5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module * - bit 2: 1: HSE/1024 Clock config 0: LSE Clock config */ @@ -164,11 +164,10 @@ index cc8c3e8..35cad34 100644 /** * Viterbi Mode -@@ -224,8 +266,11 @@ - * on Max Extended advertising configuration supported. +@@ -314,7 +356,11 @@ * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set */ -- + -#define CFG_BLE_MAX_ADV_SET_NBR (8) +#if defined(STM32WB15xx) + #define CFG_BLE_MAX_ADV_SET_NBR (3) @@ -178,11 +177,10 @@ index cc8c3e8..35cad34 100644 /* Maximum advertising data length (in bytes) * Range: 31 .. 1650 with limitation: -@@ -233,8 +278,11 @@ - * on Max Extended advertising configuration supported. +@@ -323,7 +369,11 @@ * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set */ -- + -#define CFG_BLE_MAX_ADV_DATA_LEN (207) +#if defined(STM32WB15xx) + #define CFG_BLE_MAX_ADV_DATA_LEN (414) diff --git a/extras/STM32Cube_FW/0004-fix-warning-outside-array-bounds.patch b/extras/STM32Cube_FW/0004-fix-warning-outside-array-bounds.patch new file mode 100644 index 00000000..ae4aed42 --- /dev/null +++ b/extras/STM32Cube_FW/0004-fix-warning-outside-array-bounds.patch @@ -0,0 +1,304 @@ +From 64caac5c39a47cac4ab840ba975bca065aa40efa Mon Sep 17 00:00:00 2001 +From: Frederic Pillon +Date: Wed, 8 Feb 2023 16:50:46 +0100 +Subject: [PATCH 4/4] fix: warning outside array bounds + +array subscript 'TL_CcEvt_t[0]' is partly outside array bounds + +Signed-off-by: Frederic Pillon +--- + src/utility/STM32Cube_FW/shci.c | 60 ++++++++++++++++----------------- + src/utility/STM32Cube_FW/tl.h | 3 ++ + 2 files changed, 33 insertions(+), 30 deletions(-) + +diff --git a/src/utility/STM32Cube_FW/shci.c b/src/utility/STM32Cube_FW/shci.c +index cb7d7bd..6348145 100644 +--- a/src/utility/STM32Cube_FW/shci.c ++++ b/src/utility/STM32Cube_FW/shci.c +@@ -42,7 +42,7 @@ uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_error_code ) + /** + * A command status event + payload has the same size than the expected command complete + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -66,7 +66,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_FwUpgrade( uint32_t fw_src_add, uint32_t fw_dest_a + * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + uint32_t *p_cmd; + uint8_t cmd_length; +@@ -101,7 +101,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_FwDelete( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -119,7 +119,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_UpdateAuthKey( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_ + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -137,7 +137,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LockAuthKey( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -155,7 +155,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_StoreUsrKey( SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t *p + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + uint8_t local_payload_len; + +@@ -189,7 +189,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LoadUsrKey( uint8_t key_index ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -209,7 +209,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_StartWs( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -227,7 +227,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LockUsrKey( uint8_t key_index ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -247,7 +247,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_UnloadUsrKey( uint8_t key_index ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -267,7 +267,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_ActivateAntiRollback( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -285,7 +285,7 @@ SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -303,7 +303,7 @@ SHCI_CmdStatus_t SHCI_C2_THREAD_Init( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -321,7 +321,7 @@ SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -339,7 +339,7 @@ SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -357,7 +357,7 @@ SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -375,7 +375,7 @@ SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -393,7 +393,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseActivity( SHCI_EraseActivity_t erase_activit + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -413,7 +413,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mod + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -433,7 +433,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_GetNextBleEvtTime( SHCI_C2_CONCURRENT_GetNex + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE+4]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -453,7 +453,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_EnableNext_802154_EvtNotification( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -471,7 +471,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -491,7 +491,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -511,7 +511,7 @@ SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t Fla + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -532,7 +532,7 @@ SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -550,7 +550,7 @@ SHCI_CmdStatus_t SHCI_C2_Reinit( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -569,7 +569,7 @@ SHCI_CmdStatus_t SHCI_C2_ExtpaConfig(uint32_t gpio_port, uint16_t gpio_pin_numbe + * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -593,7 +593,7 @@ SHCI_CmdStatus_t SHCI_C2_SetFlashActivityControl(SHCI_C2_SET_FLASH_ACTIVITY_CONT + * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 1 byte of command parameter + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -613,7 +613,7 @@ SHCI_CmdStatus_t SHCI_C2_Config(SHCI_C2_CONFIG_Cmd_Param_t *pCmdPacket) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +@@ -631,7 +631,7 @@ SHCI_CmdStatus_t SHCI_C2_802_15_4_DeInit( void ) + /** + * Buffer is large enough to hold command complete without payload + */ +- uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; ++ uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; +diff --git a/src/utility/STM32Cube_FW/tl.h b/src/utility/STM32Cube_FW/tl.h +index 6bfa265..63126b3 100644 +--- a/src/utility/STM32Cube_FW/tl.h ++++ b/src/utility/STM32Cube_FW/tl.h +@@ -61,6 +61,9 @@ extern "C" { + #define TL_BLEEVT_CS_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t)) + #define TL_BLEEVT_CS_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CS_PACKET_SIZE) + ++#define TL_BLEEVT_CC_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CcEvt_t)) ++#define TL_BLEEVT_CC_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CC_PACKET_SIZE) ++ + /* Exported types ------------------------------------------------------------*/ + /**< Packet header */ + typedef PACKED_STRUCT +-- +2.38.0.windows.1 + From a903124433f4caacb07997a4856cfc4fc71948f8 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 5 Apr 2023 14:37:41 +0200 Subject: [PATCH 2/8] chore: update STM32Cube_FW from Cube version v1.16.0 Signed-off-by: Frederic Pillon --- src/utility/STM32Cube_FW/README.md | 4 +- src/utility/STM32Cube_FW/app_conf_default.h | 544 +++++++++++++++---- src/utility/STM32Cube_FW/ble_bufsize.h | 15 +- src/utility/STM32Cube_FW/hw.h | 28 +- src/utility/STM32Cube_FW/hw_ipcc.c | 218 +++++++- src/utility/STM32Cube_FW/mbox_def.h | 34 ++ src/utility/STM32Cube_FW/shci.c | 95 +++- src/utility/STM32Cube_FW/shci.h | 76 ++- src/utility/STM32Cube_FW/shci_tl.c | 45 +- src/utility/STM32Cube_FW/stm32_wpan_common.h | 39 +- src/utility/STM32Cube_FW/stm_list.c | 15 +- src/utility/STM32Cube_FW/stm_list.h | 4 +- src/utility/STM32Cube_FW/tl.h | 73 ++- src/utility/STM32Cube_FW/tl_mbox.c | 145 ++++- 14 files changed, 1125 insertions(+), 210 deletions(-) diff --git a/src/utility/STM32Cube_FW/README.md b/src/utility/STM32Cube_FW/README.md index 69041d4c..780e2706 100644 --- a/src/utility/STM32Cube_FW/README.md +++ b/src/utility/STM32Cube_FW/README.md @@ -1,6 +1,6 @@ ## Source -[STMicroelectronics/STM32CubeWB Release vv1.15.0](https://github.com/STMicroelectronics/STM32CubeWB/releases/tag/vv1.15.0) -- Application: [BLE_TransparentMode](https://github.com/STMicroelectronics/STM32CubeWB/tree/vv1.15.0/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_TransparentMode) +[STMicroelectronics/STM32CubeWB Release vvv1.16.0](https://github.com/STMicroelectronics/STM32CubeWB/releases/tag/vvv1.16.0) +- Application: [BLE_TransparentMode](https://github.com/STMicroelectronics/STM32CubeWB/tree/vvv1.16.0/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_TransparentMode) diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h index 35cad34f..51bd33af 100644 --- a/src/utility/STM32Cube_FW/app_conf_default.h +++ b/src/utility/STM32Cube_FW/app_conf_default.h @@ -1,8 +1,9 @@ +/* USER CODE BEGIN Header */ /** ****************************************************************************** - * @file app_conf_default.h + * @file app_conf.h * @author MCD Application Team - * @brief Default application configuration file for STM32WPAN Middleware. + * @brief Application configuration file for STM32WPAN Middleware. ****************************************************************************** * @attention * @@ -15,35 +16,94 @@ * ****************************************************************************** */ +/* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef APP_CONF_DEFAULT_H -#define APP_CONF_DEFAULT_H +#ifndef APP_CONF_H +#define APP_CONF_H + +#include "hw.h" +#include "hw_conf.h" +#include "hw_if.h" +#include "ble_bufsize.h" /****************************************************************************** * Application Config ******************************************************************************/ -/**< generic parameters ******************************************************/ -/* HCI related defines */ +/** + * Define Secure Connections Support + */ +#define CFG_SECURE_NOT_SUPPORTED (0x00) +#define CFG_SECURE_OPTIONAL (0x01) +#define CFG_SECURE_MANDATORY (0x02) -#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F -#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C -#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D -#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251) -#define HCI_RESET 0x0C03 +#define CFG_SC_SUPPORT CFG_SECURE_OPTIONAL -#ifndef BLE_SHARED_MEM_BYTE_ORDER - #define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST -#endif -#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128 +/** + * Define Keypress Notification Support + */ +#define CFG_KEYPRESS_NOT_SUPPORTED (0x00) +#define CFG_KEYPRESS_SUPPORTED (0x01) + +#define CFG_KEYPRESS_NOTIFICATION_SUPPORT CFG_KEYPRESS_NOT_SUPPORTED /** - * Define Tx Power + * Numeric Comparison Answers */ -#ifndef CFG_TX_POWER - #define CFG_TX_POWER (0x18) /* -0.15dBm */ -#endif +#define YES (0x01) +#define NO (0x00) + +/** + * Device name configuration for Generic Access Service + */ +#define CFG_GAP_DEVICE_NAME "TEMPLATE" +#define CFG_GAP_DEVICE_NAME_LENGTH (8) + +/** +* Identity root key used to derive LTK and CSRK +*/ +#define CFG_BLE_IRK {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0} + +/** +* Encryption root key used to derive LTK and CSRK +*/ +#define CFG_BLE_ERK {0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21, 0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21} + +/** + * SMPS supply + * SMPS not used when Set to 0 + * SMPS used when Set to 1 + */ +#define CFG_USE_SMPS 0 + +/* USER CODE BEGIN Generic_Parameters */ +/* USER CODE END Generic_Parameters */ + +/**< specific parameters */ +/*****************************************************/ + +/* USER CODE BEGIN Specific_Parameters */ +#define PUSH_BUTTON_SW1_EXTI_IRQHandler EXTI4_IRQHandler + +/* USER CODE END Specific_Parameters */ + +/****************************************************************************** + * Information Table + * + * Version + * [0:3] = Build - 0: Untracked - 15:Released - x: Tracked version + * [4:7] = branch - 0: Mass Market - x: ... + * [8:15] = Subversion + * [16:23] = Version minor + * [24:31] = Version major + * + ******************************************************************************/ +#define CFG_FW_MAJOR_VERSION (0) +#define CFG_FW_MINOR_VERSION (0) +#define CFG_FW_SUBVERSION (1) +#define CFG_FW_BRANCH (0) +#define CFG_FW_BUILD (0) /****************************************************************************** * BLE Stack @@ -52,25 +112,13 @@ * Maximum number of simultaneous connections that the device will support. * Valid values are from 1 to 8 */ -#ifndef CFG_BLE_NUM_LINK -#ifdef STM32WB15xx - #define CFG_BLE_NUM_LINK 3 -#else - #define CFG_BLE_NUM_LINK 8 -#endif -#endif +#define CFG_BLE_NUM_LINK 8 /** * Maximum number of Services that can be stored in the GATT database. * Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services */ -#ifndef CFG_BLE_NUM_GATT_SERVICES -#ifdef STM32WB15xx - #define CFG_BLE_NUM_GATT_SERVICES 4 -#else - #define CFG_BLE_NUM_GATT_SERVICES 8 -#endif -#endif +#define CFG_BLE_NUM_GATT_SERVICES 8 /** * Maximum number of Attributes @@ -79,21 +127,13 @@ * Note that certain characteristics and relative descriptors are added automatically during device initialization * so this parameters should be 9 plus the number of user Attributes */ -#ifndef CFG_BLE_NUM_GATT_ATTRIBUTES -#ifdef STM32WB15xx - #define CFG_BLE_NUM_GATT_ATTRIBUTES 30 -#else - #define CFG_BLE_NUM_GATT_ATTRIBUTES 68 -#endif -#endif +#define CFG_BLE_NUM_GATT_ATTRIBUTES 68 /** * Maximum supported ATT_MTU size * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ -#ifndef CFG_BLE_MAX_ATT_MTU - #define CFG_BLE_MAX_ATT_MTU (156) -#endif +#define CFG_BLE_MAX_ATT_MTU (156) /** * Size of the storage area for Attribute values @@ -106,43 +146,29 @@ * The total amount of memory needed is the sum of the above quantities for each attribute. * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ -#ifndef CFG_BLE_ATT_VALUE_ARRAY_SIZE -#ifdef STM32WB15xx - #define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1290) -#else - #define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344) -#endif -#endif +#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344) /** * Prepare Write List size in terms of number of packet * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ -// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) -#ifndef CFG_BLE_PREPARE_WRITE_LIST_SIZE - #define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A) -#endif +#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) /** * Number of allocated memory blocks * This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ -// #define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) -#define CFG_BLE_MBLOCK_COUNT (0x79) +#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) /** * Enable or disable the Extended Packet length feature. Valid values are 0 or 1. */ -#ifndef CFG_BLE_DATA_LENGTH_EXTENSION - #define CFG_BLE_DATA_LENGTH_EXTENSION 1 -#endif +#define CFG_BLE_DATA_LENGTH_EXTENSION 1 /** * Sleep clock accuracy in Slave mode (ppm value) */ -#ifndef CFG_BLE_SLAVE_SCA - #define CFG_BLE_SLAVE_SCA 500 -#endif +#define CFG_BLE_SLAVE_SCA 500 /** * Sleep clock accuracy in Master mode @@ -155,9 +181,7 @@ * 6 : 21 ppm to 30 ppm * 7 : 0 ppm to 20 ppm */ -#ifndef CFG_BLE_MASTER_SCA - #define CFG_BLE_MASTER_SCA 0 -#endif +#define CFG_BLE_MASTER_SCA 0 /** * LsSource @@ -166,27 +190,21 @@ * - bit 1: 1: STM32WB5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module * - bit 2: 1: HSE/1024 Clock config 0: LSE Clock config */ -#ifndef CFG_BLE_LS_SOURCE - #if defined(STM32WB5Mxx) - #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) - #else - #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) - #endif +#if defined(STM32WB5Mxx) + #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) +#else + #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) #endif /** * Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us) */ -#ifndef CFG_BLE_HSE_STARTUP_TIME - #define CFG_BLE_HSE_STARTUP_TIME 0x148 -#endif +#define CFG_BLE_HSE_STARTUP_TIME 0x148 /** * Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us) */ -#ifndef CFG_BLE_MAX_CONN_EVENT_LENGTH - #define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF) -#endif +#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF) /** * Viterbi Mode @@ -213,10 +231,6 @@ * - SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED * - SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_1 * - SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3 - * - SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_WRITABLE - * - SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY - * - SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_SUPPORTED - * - SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED * which are used to set following configuration bits: * (bit 0): 1: LL only * 0: LL + host @@ -234,13 +248,24 @@ * 0: GATT caching is not used * (bit 7): 1: LE Power Class 1 * 0: LE Power Class 2-3 - * (bit 8): 1: appearance Writable + * other bits: complete with Options_extension flag + */ +#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_HOST | SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC | SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW | SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV | SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 | SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM | SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED | SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3) + +/** + * BLE stack Options_extension flags to be configured with: + * - SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_WRITABLE + * - SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY + * - SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_SUPPORTED + * - SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED + * which are used to set following configuration bits: + * (bit 0): 1: appearance Writable * 0: appearance Read-Only - * (bit 9): 1: Enhanced ATT supported + * (bit 1): 1: Enhanced ATT supported * 0: Enhanced ATT not supported * other bits: reserved (shall be set to 0) */ -#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY) +#define CFG_BLE_OPTIONS_EXT (SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY | SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED) #define CFG_BLE_MAX_COC_INITIATOR_NBR (32) @@ -266,11 +291,8 @@ * on Max Extended advertising configuration supported. * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set */ -#if defined(STM32WB15xx) - #define CFG_BLE_MAX_ADV_SET_NBR (3) -#else - #define CFG_BLE_MAX_ADV_SET_NBR (8) -#endif + +#define CFG_BLE_MAX_ADV_SET_NBR (8) /* Maximum advertising data length (in bytes) * Range: 31 .. 1650 with limitation: @@ -278,11 +300,8 @@ * on Max Extended advertising configuration supported. * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set */ -#if defined(STM32WB15xx) - #define CFG_BLE_MAX_ADV_DATA_LEN (414) -#else - #define CFG_BLE_MAX_ADV_DATA_LEN (207) -#endif + +#define CFG_BLE_MAX_ADV_DATA_LEN (207) /* RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB. * Range: -1280 .. 1280 @@ -304,4 +323,339 @@ #define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3) -#endif /* APP_CONF_DEFAULT_H */ +/****************************************************************************** + * Transport Layer + ******************************************************************************/ +/** + * Queue length of BLE Event + * This parameter defines the number of asynchronous events that can be stored in the HCI layer before + * being reported to the application. When a command is sent to the BLE core coprocessor, the HCI layer + * is waiting for the event with the Num_HCI_Command_Packets set to 1. The receive queue shall be large + * enough to store all asynchronous events received in between. + * When CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE is set to 27, this allow to store three 255 bytes long asynchronous events + * between the HCI command and its event. + * This parameter depends on the value given to CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE. When the queue size is to small, + * the system may hang if the queue is full with asynchronous events and the HCI layer is still waiting + * for a CC/CS event, In that case, the notification TL_BLE_HCI_ToNot() is called to indicate + * to the application a HCI command did not receive its command event within 30s (Default HCI Timeout). + */ +#define CFG_TLBLE_EVT_QUEUE_LENGTH 5 +/** + * This parameter should be set to fit most events received by the HCI layer. It defines the buffer size of each element + * allocated in the queue of received events and can be used to optimize the amount of RAM allocated by the Memory Manager. + * It should not exceed 255 which is the maximum HCI packet payload size (a greater value is a lost of memory as it will + * never be used) + * It shall be at least 4 to receive the command status event in one frame. + * The default value is set to 27 to allow receiving an event of MTU size in a single buffer. This value maybe reduced + * further depending on the application. + */ +#define CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE 255 /**< Set to 255 with the memory manager and the mailbox */ + +#define TL_BLE_EVENT_FRAME_SIZE ( TL_EVT_HDR_SIZE + CFG_TLBLE_MOST_EVENT_PAYLOAD_SIZE ) +/****************************************************************************** + * UART interfaces + ******************************************************************************/ + +/** + * Select UART interfaces + */ +#define CFG_UART_GUI hw_uart1 +#define CFG_DEBUG_TRACE_UART 0 +/****************************************************************************** + * USB interface + ******************************************************************************/ + +/** + * Enable/Disable USB interface + */ +#define CFG_USB_INTERFACE_ENABLE 0 + +/****************************************************************************** + * IPCC interface + ******************************************************************************/ + +/** + * The IPCC is dedicated to the communication between the CPU2 and the CPU1 + * and shall not be modified by the application + * The two following definitions shall not be modified + */ +#define HAL_IPCC_TX_IRQHandler(...) HW_IPCC_Tx_Handler( ) +#define HAL_IPCC_RX_IRQHandler(...) HW_IPCC_Rx_Handler( ) + +/****************************************************************************** + * Low Power + ******************************************************************************/ +/** + * When set to 1, the low power mode is enable + * When set to 0, the device stays in RUN mode + */ +#define CFG_LPM_SUPPORTED 1 + +/****************************************************************************** + * RTC interface + ******************************************************************************/ +#define HAL_RTCEx_WakeUpTimerIRQHandler(...) HW_TS_RTC_Wakeup_Handler( ) + +/****************************************************************************** + * Timer Server + ******************************************************************************/ +/** + * CFG_RTC_WUCKSEL_DIVIDER: This sets the RTCCLK divider to the wakeup timer. + * The lower is the value, the better is the power consumption and the accuracy of the timerserver + * The higher is the value, the finest is the granularity + * + * CFG_RTC_ASYNCH_PRESCALER: This sets the asynchronous prescaler of the RTC. It should as high as possible ( to output + * clock as low as possible) but the output clock should be equal or higher frequency compare to the clock feeding + * the wakeup timer. A lower clock speed would impact the accuracy of the timer server. + * + * CFG_RTC_SYNCH_PRESCALER: This sets the synchronous prescaler of the RTC. + * When the 1Hz calendar clock is required, it shall be sets according to other settings + * When the 1Hz calendar clock is not needed, CFG_RTC_SYNCH_PRESCALER should be set to 0x7FFF (MAX VALUE) + * + * CFG_RTCCLK_DIVIDER_CONF: + * Shall be set to either 0,2,4,8,16 + * When set to either 2,4,8,16, the 1Hhz calendar is supported + * When set to 0, the user sets its own configuration + * + * The following settings are computed with LSI as input to the RTC + */ + +#define CFG_RTCCLK_DIVIDER_CONF 0 + +#if (CFG_RTCCLK_DIVIDER_CONF == 0) +/** + * Custom configuration + * It does not support 1Hz calendar + * It divides the RTC CLK by 16 + */ + +#define CFG_RTCCLK_DIV (16) +#define CFG_RTC_WUCKSEL_DIVIDER (0) +#define CFG_RTC_ASYNCH_PRESCALER (0x0F) +#define CFG_RTC_SYNCH_PRESCALER (0x7FFF) + +#else + +#if (CFG_RTCCLK_DIVIDER_CONF == 2) +/** + * It divides the RTC CLK by 2 + */ +#define CFG_RTC_WUCKSEL_DIVIDER (3) +#endif + +#if (CFG_RTCCLK_DIVIDER_CONF == 4) +/** + * It divides the RTC CLK by 4 + */ +#define CFG_RTC_WUCKSEL_DIVIDER (2) +#endif + +#if (CFG_RTCCLK_DIVIDER_CONF == 8) +/** + * It divides the RTC CLK by 8 + */ +#define CFG_RTC_WUCKSEL_DIVIDER (1) +#endif + +#if (CFG_RTCCLK_DIVIDER_CONF == 16) +/** + * It divides the RTC CLK by 16 + */ +#define CFG_RTC_WUCKSEL_DIVIDER (0) +#endif + +#define CFG_RTCCLK_DIV CFG_RTCCLK_DIVIDER_CONF +#define CFG_RTC_ASYNCH_PRESCALER (CFG_RTCCLK_DIV - 1) +#define CFG_RTC_SYNCH_PRESCALER (DIVR( LSE_VALUE, (CFG_RTC_ASYNCH_PRESCALER+1) ) - 1 ) + +#endif + +/** tick timer values */ +#define CFG_TS_TICK_VAL DIVR( (CFG_RTCCLK_DIV * 1000000), LSE_VALUE ) +#define CFG_TS_TICK_VAL_PS DIVR( ((uint64_t)CFG_RTCCLK_DIV * 1e12), (uint64_t)LSE_VALUE ) + +typedef enum +{ + CFG_TIM_PROC_ID_ISR, + /* USER CODE BEGIN CFG_TimProcID_t */ + + /* USER CODE END CFG_TimProcID_t */ +} CFG_TimProcID_t; + +/****************************************************************************** + * Debug + ******************************************************************************/ +/** + * When set, this resets some hw resources to set the device in the same state than the power up + * The FW resets only register that may prevent the FW to run properly + * + * This shall be set to 0 in a final product + * + */ +#define CFG_HW_RESET_BY_FW 1 + +/** + * keep debugger enabled while in any low power mode when set to 1 + * should be set to 0 in production + */ +#define CFG_DEBUGGER_SUPPORTED 0 + +/** + * When set to 1, the traces are enabled in the BLE services + */ +#define CFG_DEBUG_BLE_TRACE 0 + +/** + * Enable or Disable traces in application + */ +#define CFG_DEBUG_APP_TRACE 0 + +#if (CFG_DEBUG_APP_TRACE != 0) +#define APP_DBG_MSG PRINT_MESG_DBG +#else +#define APP_DBG_MSG PRINT_NO_MESG +#endif + +#if ( (CFG_DEBUG_BLE_TRACE != 0) || (CFG_DEBUG_APP_TRACE != 0) ) +#define CFG_DEBUG_TRACE 1 +#endif + +#if (CFG_DEBUG_TRACE != 0) +#undef CFG_LPM_SUPPORTED +#undef CFG_DEBUGGER_SUPPORTED +#define CFG_LPM_SUPPORTED 0 +#define CFG_DEBUGGER_SUPPORTED 1 +#endif + +/** + * When CFG_DEBUG_TRACE_FULL is set to 1, the trace are output with the API name, the file name and the line number + * When CFG_DEBUG_TRACE_LIGHT is set to 1, only the debug message is output + * + * When both are set to 0, no trace are output + * When both are set to 1, CFG_DEBUG_TRACE_FULL is selected + */ +#define CFG_DEBUG_TRACE_LIGHT 0 +#define CFG_DEBUG_TRACE_FULL 0 + +#if (( CFG_DEBUG_TRACE != 0 ) && ( CFG_DEBUG_TRACE_LIGHT == 0 ) && (CFG_DEBUG_TRACE_FULL == 0)) +#undef CFG_DEBUG_TRACE_FULL +#undef CFG_DEBUG_TRACE_LIGHT +#define CFG_DEBUG_TRACE_FULL 0 +#define CFG_DEBUG_TRACE_LIGHT 1 +#endif + +#if ( CFG_DEBUG_TRACE == 0 ) +#undef CFG_DEBUG_TRACE_FULL +#undef CFG_DEBUG_TRACE_LIGHT +#define CFG_DEBUG_TRACE_FULL 0 +#define CFG_DEBUG_TRACE_LIGHT 0 +#endif + +/** + * When not set, the traces is looping on sending the trace over UART + */ +#define DBG_TRACE_USE_CIRCULAR_QUEUE 1 + +/** + * max buffer Size to queue data traces and max data trace allowed. + * Only Used if DBG_TRACE_USE_CIRCULAR_QUEUE is defined + */ +#define DBG_TRACE_MSG_QUEUE_SIZE 4096 +#define MAX_DBG_TRACE_MSG_SIZE 1024 + +/* USER CODE BEGIN Defines */ +#define CFG_LED_SUPPORTED 1 +#define CFG_BUTTON_SUPPORTED 1 + +#define PUSH_BUTTON_SW1_EXTI_IRQHandler EXTI4_IRQHandler +#define PUSH_BUTTON_SW2_EXTI_IRQHandler EXTI0_IRQHandler +#define PUSH_BUTTON_SW3_EXTI_IRQHandler EXTI1_IRQHandler +/* USER CODE END Defines */ + +/****************************************************************************** + * Scheduler + ******************************************************************************/ + +/** + * These are the lists of task id registered to the scheduler + * Each task id shall be in the range [0:31] + * This mechanism allows to implement a generic code in the API TL_BLE_HCI_StatusNot() to comply with + * the requirement that a HCI/ACI command shall never be sent if there is already one pending + */ + +/**< Add in that list all tasks that may send a ACI/HCI command */ +typedef enum +{ + CFG_TASK_BLE_HCI_CMD_ID, + CFG_TASK_SYS_HCI_CMD_ID, + CFG_TASK_HCI_ACL_DATA_ID, + CFG_TASK_SYS_LOCAL_CMD_ID, + CFG_TASK_TX_TO_HOST_ID, + /* USER CODE BEGIN CFG_Task_Id_With_HCI_Cmd_t */ + CFG_TASK_SW1_BUTTON_PUSHED_ID, + CFG_TASK_SW2_BUTTON_PUSHED_ID, + CFG_TASK_SW3_BUTTON_PUSHED_ID, + /* USER CODE END CFG_Task_Id_With_HCI_Cmd_t */ + CFG_LAST_TASK_ID_WITH_HCICMD, /**< Shall be LAST in the list */ +} CFG_Task_Id_With_HCI_Cmd_t; + +/**< Add in that list all tasks that never send a ACI/HCI command */ +typedef enum +{ + CFG_FIRST_TASK_ID_WITH_NO_HCICMD = CFG_LAST_TASK_ID_WITH_HCICMD - 1, /**< Shall be FIRST in the list */ + CFG_TASK_SYSTEM_HCI_ASYNCH_EVT_ID, + /* USER CODE BEGIN CFG_Task_Id_With_NO_HCI_Cmd_t */ + + /* USER CODE END CFG_Task_Id_With_NO_HCI_Cmd_t */ + CFG_LAST_TASK_ID_WITH_NO_HCICMD /**< Shall be LAST in the list */ +} CFG_Task_Id_With_NO_HCI_Cmd_t; + +#define CFG_TASK_NBR CFG_LAST_TASK_ID_WITH_NO_HCICMD + +/** + * This is the list of priority required by the application + * Each Id shall be in the range 0..31 + */ +typedef enum +{ + CFG_SCH_PRIO_0, + /* USER CODE BEGIN CFG_SCH_Prio_Id_t */ + + /* USER CODE END CFG_SCH_Prio_Id_t */ +} CFG_SCH_Prio_Id_t; + +/** + * This is a bit mapping over 32bits listing all events id supported in the application + */ +typedef enum +{ + CFG_IDLEEVT_SYSTEM_HCI_CMD_EVT_RSP_ID, + /* USER CODE BEGIN CFG_IdleEvt_Id_t */ + + /* USER CODE END CFG_IdleEvt_Id_t */ +} CFG_IdleEvt_Id_t; + +/****************************************************************************** + * LOW POWER + ******************************************************************************/ +/** + * Supported requester to the MCU Low Power Manager - can be increased up to 32 + * It list a bit mapping of all user of the Low Power Manager + */ +typedef enum +{ + CFG_LPM_APP, + CFG_LPM_APP_BLE, + /* USER CODE BEGIN CFG_LPM_Id_t */ + + /* USER CODE END CFG_LPM_Id_t */ +} CFG_LPM_Id_t; + +/****************************************************************************** + * OTP manager + ******************************************************************************/ +#define CFG_OTP_BASE_ADDRESS OTP_AREA_BASE + +#define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR + +#endif /*APP_CONF_H */ diff --git a/src/utility/STM32Cube_FW/ble_bufsize.h b/src/utility/STM32Cube_FW/ble_bufsize.h index cea5da84..7b7c170f 100644 --- a/src/utility/STM32Cube_FW/ble_bufsize.h +++ b/src/utility/STM32Cube_FW/ble_bufsize.h @@ -5,7 +5,7 @@ ***************************************************************************** * @attention * - * Copyright (c) 2018-2022 STMicroelectronics. + * Copyright (c) 2018-2023 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file @@ -75,13 +75,6 @@ ((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \ BLE_MBLOCKS_SECURE_CONNECTIONS)) -/* - * BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count - */ -#define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \ - BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \ - BLE_DEFAULT_MAX_ATT_MTU, n_link) - /* * BLE_FIXED_BUFFER_SIZE_BYTES: * A part of the RAM, is dynamically allocated by initializing all the pointers @@ -120,11 +113,11 @@ #elif (LL_ONLY != 0) #define BLE_PER_LINK_SIZE_BYTES 244 /* LL only Full */ #elif (SLAVE_ONLY != 0) -#define BLE_PER_LINK_SIZE_BYTES 336 /* Peripheral only */ +#define BLE_PER_LINK_SIZE_BYTES 344 /* Peripheral only */ #elif (BASIC_FEATURES != 0) -#define BLE_PER_LINK_SIZE_BYTES 412 /* Basic Features */ +#define BLE_PER_LINK_SIZE_BYTES 420 /* Basic Features */ #else -#define BLE_PER_LINK_SIZE_BYTES 424 /* Full stack */ +#define BLE_PER_LINK_SIZE_BYTES 432 /* Full stack */ #endif /* diff --git a/src/utility/STM32Cube_FW/hw.h b/src/utility/STM32Cube_FW/hw.h index fcf04517..503fa2ca 100644 --- a/src/utility/STM32Cube_FW/hw.h +++ b/src/utility/STM32Cube_FW/hw.h @@ -26,21 +26,14 @@ extern "C" { #endif /* Includes ------------------------------------------------------------------*/ -#include "stm32_def.h" -#include "stm32wbxx_ll_bus.h" -#include "stm32wbxx_ll_exti.h" -#include "stm32wbxx_ll_system.h" -#include "stm32wbxx_ll_rcc.h" -#include "stm32wbxx_ll_ipcc.h" -#include "stm32wbxx_ll_cortex.h" -#include "stm32wbxx_ll_utils.h" -#include "stm32wbxx_ll_pwr.h" /****************************************************************************** * HW IPCC ******************************************************************************/ void HW_IPCC_Enable( void ); void HW_IPCC_Init( void ); + void HW_IPCC_Rx_Handler( void ); + void HW_IPCC_Tx_Handler( void ); void HW_IPCC_BLE_Init( void ); void HW_IPCC_BLE_SendCmd( void ); @@ -87,6 +80,23 @@ extern "C" { void HW_IPCC_TRACES_Init( void ); void HW_IPCC_TRACES_EvtNot( void ); + void HW_IPCC_MAC_802_15_4_Init( void ); + void HW_IPCC_MAC_802_15_4_SendCmd( void ); + void HW_IPCC_MAC_802_15_4_SendAck( void ); + void HW_IPCC_MAC_802_15_4_CmdEvtNot( void ); + void HW_IPCC_MAC_802_15_4_EvtNot( void ); + + void HW_IPCC_ZIGBEE_Init( void ); + + void HW_IPCC_ZIGBEE_SendM4RequestToM0(void); /* M4 Request to M0 */ + void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void); /* Request ACK from M0 */ + + void HW_IPCC_ZIGBEE_RecvM0NotifyToM4(void); /* M0 Notify to M4 */ + void HW_IPCC_ZIGBEE_SendM4AckToM0Notify(void); /* Notify ACK from M4 */ + void HW_IPCC_ZIGBEE_RecvM0RequestToM4(void); /* M0 Request to M4 */ + void HW_IPCC_ZIGBEE_SendM4AckToM0Request(void); /* Request ACK from M4 */ + + #ifdef __cplusplus } #endif diff --git a/src/utility/STM32Cube_FW/hw_ipcc.c b/src/utility/STM32Cube_FW/hw_ipcc.c index 0c1868f6..fd620b85 100644 --- a/src/utility/STM32Cube_FW/hw_ipcc.c +++ b/src/utility/STM32Cube_FW/hw_ipcc.c @@ -1,3 +1,4 @@ +/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file hw_ipcc.c @@ -15,10 +16,10 @@ * ****************************************************************************** */ +/* USER CODE END Header */ -#if defined(STM32WBxx) /* Includes ------------------------------------------------------------------*/ -#include "hw.h" +#include "app_common.h" #include "mbox_def.h" /* Global variables ---------------------------------------------------------*/ @@ -55,17 +56,34 @@ static void HW_IPCC_LLD_BLE_ReceiveRspHandler( void ); static void HW_IPCC_LLD_BLE_ReceiveM0CmdHandler( void ); #endif +#ifdef MAC_802_15_4_WB +static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void ); +static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void ); +#endif + +#ifdef ZIGBEE_WB +static void HW_IPCC_ZIGBEE_CmdEvtHandler( void ); +static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void ); +static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void ); +#endif + /* Public function definition -----------------------------------------------*/ /****************************************************************************** * INTERRUPT HANDLER ******************************************************************************/ -void IPCC_C1_RX_IRQHandler( void ) +void HW_IPCC_Rx_Handler( void ) { if (HW_IPCC_RX_PENDING( HW_IPCC_SYSTEM_EVENT_CHANNEL )) { HW_IPCC_SYS_EvtHandler(); } +#ifdef MAC_802_15_4_WB + else if (HW_IPCC_RX_PENDING( HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL )) + { + HW_IPCC_MAC_802_15_4_NotEvtHandler(); + } +#endif /* MAC_802_15_4_WB */ #ifdef THREAD_WB else if (HW_IPCC_RX_PENDING( HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL )) { @@ -96,6 +114,16 @@ void IPCC_C1_RX_IRQHandler( void ) HW_IPCC_LLD_BLE_ReceiveM0CmdHandler(); } #endif /* LLD_TESTS_WB */ +#ifdef ZIGBEE_WB + else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL )) + { + HW_IPCC_ZIGBEE_StackNotifEvtHandler(); + } + else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL )) + { + HW_IPCC_ZIGBEE_StackM0RequestHandler(); + } +#endif /* ZIGBEE_WB */ else if (HW_IPCC_RX_PENDING( HW_IPCC_BLE_EVENT_CHANNEL )) { HW_IPCC_BLE_EvtHandler(); @@ -104,14 +132,22 @@ void IPCC_C1_RX_IRQHandler( void ) { HW_IPCC_TRACES_EvtHandler(); } + + return; } -void IPCC_C1_TX_IRQHandler( void ) +void HW_IPCC_Tx_Handler( void ) { if (HW_IPCC_TX_PENDING( HW_IPCC_SYSTEM_CMD_RSP_CHANNEL )) { HW_IPCC_SYS_CmdEvtHandler(); } +#ifdef MAC_802_15_4_WB + else if (HW_IPCC_TX_PENDING( HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL )) + { + HW_IPCC_MAC_802_15_4_CmdEvtHandler(); + } +#endif /* MAC_802_15_4_WB */ #ifdef THREAD_WB else if (HW_IPCC_TX_PENDING( HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL )) { @@ -121,6 +157,12 @@ void IPCC_C1_TX_IRQHandler( void ) #ifdef LLD_TESTS_WB // No TX handler for LLD tests #endif /* LLD_TESTS_WB */ +#ifdef ZIGBEE_WB + if (HW_IPCC_TX_PENDING( HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL )) + { + HW_IPCC_ZIGBEE_CmdEvtHandler(); + } +#endif /* ZIGBEE_WB */ else if (HW_IPCC_TX_PENDING( HW_IPCC_MM_RELEASE_BUFFER_CHANNEL )) { HW_IPCC_MM_FreeBufHandler(); @@ -129,6 +171,8 @@ void IPCC_C1_TX_IRQHandler( void ) { HW_IPCC_BLE_AclDataEvtHandler(); } + + return; } /****************************************************************************** * GENERAL @@ -160,6 +204,8 @@ void HW_IPCC_Enable( void ) __SEV( ); /* Set the internal event flag and send an event to the CPU2 */ __WFE( ); /* Clear the internal event flag */ LL_PWR_EnableBootC2( ); + + return; } void HW_IPCC_Init( void ) @@ -171,6 +217,8 @@ void HW_IPCC_Init( void ) HAL_NVIC_EnableIRQ(IPCC_C1_RX_IRQn); HAL_NVIC_EnableIRQ(IPCC_C1_TX_IRQn); + + return; } /****************************************************************************** @@ -179,11 +227,15 @@ void HW_IPCC_Init( void ) void HW_IPCC_BLE_Init( void ) { LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_BLE_EVENT_CHANNEL ); + + return; } void HW_IPCC_BLE_SendCmd( void ) { LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_BLE_CMD_CHANNEL ); + + return; } static void HW_IPCC_BLE_EvtHandler( void ) @@ -191,12 +243,16 @@ static void HW_IPCC_BLE_EvtHandler( void ) HW_IPCC_BLE_RxEvtNot(); LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_BLE_EVENT_CHANNEL ); + + return; } void HW_IPCC_BLE_SendAclData( void ) { LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL ); LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL ); + + return; } static void HW_IPCC_BLE_AclDataEvtHandler( void ) @@ -204,6 +260,8 @@ static void HW_IPCC_BLE_AclDataEvtHandler( void ) LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_HCI_ACL_DATA_CHANNEL ); HW_IPCC_BLE_AclDataAckNot(); + + return; } __weak void HW_IPCC_BLE_AclDataAckNot( void ){}; @@ -215,12 +273,16 @@ __weak void HW_IPCC_BLE_RxEvtNot( void ){}; void HW_IPCC_SYS_Init( void ) { LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL ); + + return; } void HW_IPCC_SYS_SendCmd( void ) { LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ); LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ); + + return; } static void HW_IPCC_SYS_CmdEvtHandler( void ) @@ -228,6 +290,8 @@ static void HW_IPCC_SYS_CmdEvtHandler( void ) LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ); HW_IPCC_SYS_CmdEvtNot(); + + return; } static void HW_IPCC_SYS_EvtHandler( void ) @@ -235,11 +299,61 @@ static void HW_IPCC_SYS_EvtHandler( void ) HW_IPCC_SYS_EvtNot(); LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL ); + + return; } __weak void HW_IPCC_SYS_CmdEvtNot( void ){}; __weak void HW_IPCC_SYS_EvtNot( void ){}; +/****************************************************************************** + * MAC 802.15.4 + ******************************************************************************/ +#ifdef MAC_802_15_4_WB +void HW_IPCC_MAC_802_15_4_Init( void ) +{ + LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ); + + return; +} + +void HW_IPCC_MAC_802_15_4_SendCmd( void ) +{ + LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ); + LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ); + + return; +} + +void HW_IPCC_MAC_802_15_4_SendAck( void ) +{ + LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ); + LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ); + + return; +} + +static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void ) +{ + LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ); + + HW_IPCC_MAC_802_15_4_CmdEvtNot(); + + return; +} + +static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void ) +{ + LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ); + + HW_IPCC_MAC_802_15_4_EvtNot(); + + return; +} +__weak void HW_IPCC_MAC_802_15_4_CmdEvtNot( void ){}; +__weak void HW_IPCC_MAC_802_15_4_EvtNot( void ){}; +#endif + /****************************************************************************** * THREAD ******************************************************************************/ @@ -279,6 +393,8 @@ void HW_IPCC_THREAD_CliSendAck( void ) { LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL ); LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL ); + + return; } static void HW_IPCC_OT_CmdEvtHandler( void ) @@ -286,6 +402,8 @@ static void HW_IPCC_OT_CmdEvtHandler( void ) LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL ); HW_IPCC_OT_CmdEvtNot(); + + return; } static void HW_IPCC_THREAD_NotEvtHandler( void ) @@ -293,6 +411,8 @@ static void HW_IPCC_THREAD_NotEvtHandler( void ) LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL ); HW_IPCC_THREAD_EvtNot(); + + return; } static void HW_IPCC_THREAD_CliNotEvtHandler( void ) @@ -300,6 +420,8 @@ static void HW_IPCC_THREAD_CliNotEvtHandler( void ) LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_THREAD_CLI_NOTIFICATION_ACK_CHANNEL ); HW_IPCC_THREAD_CliEvtNot(); + + return; } __weak void HW_IPCC_OT_CmdEvtNot( void ){}; @@ -316,6 +438,7 @@ void HW_IPCC_LLDTESTS_Init( void ) { LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ); LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ); + return; } void HW_IPCC_LLDTESTS_SendCliCmd( void ) @@ -328,24 +451,28 @@ static void HW_IPCC_LLDTESTS_ReceiveCliRspHandler( void ) { LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ); HW_IPCC_LLDTESTS_ReceiveCliRsp(); + return; } void HW_IPCC_LLDTESTS_SendCliRspAck( void ) { LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ); LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL ); + return; } static void HW_IPCC_LLDTESTS_ReceiveM0CmdHandler( void ) { LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ); HW_IPCC_LLDTESTS_ReceiveM0Cmd(); + return; } void HW_IPCC_LLDTESTS_SendM0CmdAck( void ) { LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ); LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLDTESTS_M0_CMD_CHANNEL ); + return; } __weak void HW_IPCC_LLDTESTS_ReceiveCliRsp( void ){}; __weak void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void ){}; @@ -359,11 +486,13 @@ void HW_IPCC_LLD_BLE_Init( void ) { LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL ); LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ); + return; } void HW_IPCC_LLD_BLE_SendCliCmd( void ) { LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CLI_CMD_CHANNEL ); + return; } /*static void HW_IPCC_LLD_BLE_ReceiveCliRspHandler( void ) @@ -377,18 +506,21 @@ void HW_IPCC_LLD_BLE_SendCliRspAck( void ) { LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CLI_RSP_CHANNEL ); LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_CLI_RSP_CHANNEL ); + return; } static void HW_IPCC_LLD_BLE_ReceiveM0CmdHandler( void ) { //LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ); HW_IPCC_LLD_BLE_ReceiveM0Cmd(); + return; } void HW_IPCC_LLD_BLE_SendM0CmdAck( void ) { LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ); //LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_M0_CMD_CHANNEL ); + return; } __weak void HW_IPCC_LLD_BLE_ReceiveCliRsp( void ){}; __weak void HW_IPCC_LLD_BLE_ReceiveM0Cmd( void ){}; @@ -397,22 +529,93 @@ __weak void HW_IPCC_LLD_BLE_ReceiveM0Cmd( void ){}; void HW_IPCC_LLD_BLE_SendCmd( void ) { LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_LLD_BLE_CMD_CHANNEL ); + return; } static void HW_IPCC_LLD_BLE_ReceiveRspHandler( void ) { LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL ); HW_IPCC_LLD_BLE_ReceiveRsp(); + return; } void HW_IPCC_LLD_BLE_SendRspAck( void ) { LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL ); LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_LLD_BLE_RSP_CHANNEL ); + return; } #endif /* LLD_BLE_WB */ +/****************************************************************************** + * ZIGBEE + ******************************************************************************/ +#ifdef ZIGBEE_WB +void HW_IPCC_ZIGBEE_Init( void ) +{ + LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ); + LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ); + + return; +} + +void HW_IPCC_ZIGBEE_SendM4RequestToM0( void ) +{ + LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ); + LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ); + + return; +} + +void HW_IPCC_ZIGBEE_SendM4AckToM0Notify( void ) +{ + LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ); + LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ); + + return; +} + +static void HW_IPCC_ZIGBEE_CmdEvtHandler( void ) +{ + LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ); + + HW_IPCC_ZIGBEE_RecvAppliAckFromM0(); + + return; +} + +static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void ) +{ + LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ); + + HW_IPCC_ZIGBEE_RecvM0NotifyToM4(); + + return; +} + +static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void ) +{ + LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ); + + HW_IPCC_ZIGBEE_RecvM0RequestToM4(); + + return; +} + +void HW_IPCC_ZIGBEE_SendM4AckToM0Request( void ) +{ + LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ); + LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ); + + return; +} + +__weak void HW_IPCC_ZIGBEE_RecvAppliAckFromM0( void ){}; +__weak void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void ){}; +__weak void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void ){}; +#endif /* ZIGBEE_WB */ + /****************************************************************************** * MEMORY MANAGER ******************************************************************************/ @@ -429,6 +632,8 @@ void HW_IPCC_MM_SendFreeBuf( void (*cb)( void ) ) LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL ); } + + return; } static void HW_IPCC_MM_FreeBufHandler( void ) @@ -438,6 +643,8 @@ static void HW_IPCC_MM_FreeBufHandler( void ) FreeBufCb(); LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL ); + + return; } /****************************************************************************** @@ -455,7 +662,8 @@ static void HW_IPCC_TRACES_EvtHandler( void ) HW_IPCC_TRACES_EvtNot(); LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_TRACES_CHANNEL ); + + return; } __weak void HW_IPCC_TRACES_EvtNot( void ){}; -#endif /* STM32WBxx */ diff --git a/src/utility/STM32Cube_FW/mbox_def.h b/src/utility/STM32Cube_FW/mbox_def.h index 0c974f8f..68b71f9c 100644 --- a/src/utility/STM32Cube_FW/mbox_def.h +++ b/src/utility/STM32Cube_FW/mbox_def.h @@ -106,6 +106,12 @@ extern "C" { uint8_t *m0cmd_buffer; } MB_BleLldTable_t; + typedef struct + { + uint8_t *notifM0toM4_buffer; + uint8_t *appliCmdM4toM0_buffer; + uint8_t *requestM0toM4_buffer; + } MB_ZigbeeTable_t; /** * msg * [0:7] = cmd/evt @@ -133,6 +139,13 @@ extern "C" { uint8_t *traces_queue; } MB_TracesTable_t; + typedef struct + { + uint8_t *p_cmdrsp_buffer; + uint8_t *p_notack_buffer; + uint8_t *evt_queue; + } MB_Mac_802_15_4_t; + typedef struct { MB_DeviceInfoTable_t *p_device_info_table; @@ -141,6 +154,8 @@ extern "C" { MB_SysTable_t *p_sys_table; MB_MemManagerTable_t *p_mem_manager_table; MB_TracesTable_t *p_traces_table; + MB_Mac_802_15_4_t *p_mac_802_15_4_table; + MB_ZigbeeTable_t *p_zigbee_table; MB_LldTestsTable_t *p_lld_tests_table; MB_BleLldTable_t *p_ble_lld_table; } MB_RefTable_t; @@ -184,6 +199,15 @@ typedef struct * | | * |<---HW_IPCC_SYSTEM_EVENT_CHANNEL-----------------| * | | + * | (ZIGBEE) | + * |----HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL------------>| + * | | + * |----HW_IPCC_ZIGBEE_CMD_CLI_CHANNEL-------------->| + * | | + * |<---HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL-------| + * | | + * |<---HW_IPCC_ZIGBEE_CLI_NOTIF_ACK_CHANNEL---------| + * | | * | (THREAD) | * |----HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL----------->| * | | @@ -207,6 +231,11 @@ typedef struct * | | * |<---HW_IPCC_BLE_LLD_M0_CMD_CHANNEL---------------| * | | + * | (MAC) | + * |----HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL-------->| + * | | + * |<---HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL| + * | | * | (BUFFER) | * |----HW_IPCC_MM_RELEASE_BUFFER_CHANNE------------>| * | | @@ -224,6 +253,8 @@ typedef struct #define HW_IPCC_BLE_CMD_CHANNEL LL_IPCC_CHANNEL_1 #define HW_IPCC_SYSTEM_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_2 #define HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_3 +#define HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL LL_IPCC_CHANNEL_3 +#define HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL LL_IPCC_CHANNEL_3 #define HW_IPCC_MM_RELEASE_BUFFER_CHANNEL LL_IPCC_CHANNEL_4 #define HW_IPCC_THREAD_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5 #define HW_IPCC_LLDTESTS_CLI_CMD_CHANNEL LL_IPCC_CHANNEL_5 @@ -235,6 +266,8 @@ typedef struct #define HW_IPCC_BLE_EVENT_CHANNEL LL_IPCC_CHANNEL_1 #define HW_IPCC_SYSTEM_EVENT_CHANNEL LL_IPCC_CHANNEL_2 #define HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_3 +#define HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL LL_IPCC_CHANNEL_3 +#define HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL LL_IPCC_CHANNEL_3 #define HW_IPCC_LLDTESTS_M0_CMD_CHANNEL LL_IPCC_CHANNEL_3 #define HW_IPCC_BLE_LLD_M0_CMD_CHANNEL LL_IPCC_CHANNEL_3 #define HW_IPCC_TRACES_CHANNEL LL_IPCC_CHANNEL_4 @@ -242,5 +275,6 @@ typedef struct #define HW_IPCC_LLDTESTS_CLI_RSP_CHANNEL LL_IPCC_CHANNEL_5 #define HW_IPCC_BLE_LLD_CLI_RSP_CHANNEL LL_IPCC_CHANNEL_5 #define HW_IPCC_BLE_LLD_RSP_CHANNEL LL_IPCC_CHANNEL_5 +#define HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL LL_IPCC_CHANNEL_5 #endif /*__MBOX_H */ diff --git a/src/utility/STM32Cube_FW/shci.c b/src/utility/STM32Cube_FW/shci.c index 8b241bbe..301db76d 100644 --- a/src/utility/STM32Cube_FW/shci.c +++ b/src/utility/STM32Cube_FW/shci.c @@ -16,7 +16,7 @@ ****************************************************************************** */ -#if defined(STM32WBxx) + /* Includes ------------------------------------------------------------------*/ #include "stm32_wpan_common.h" @@ -42,7 +42,7 @@ uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_error_code ) /** * A command status event + payload has the same size than the expected command complete */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -66,7 +66,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_FwUpgrade( uint32_t fw_src_add, uint32_t fw_dest_a * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; uint32_t *p_cmd; uint8_t cmd_length; @@ -101,7 +101,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_FwDelete( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -119,7 +119,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_UpdateAuthKey( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_ /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -137,7 +137,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LockAuthKey( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -155,7 +155,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_StoreUsrKey( SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t *p /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1]; TL_EvtPacket_t * p_rsp; uint8_t local_payload_len; @@ -189,7 +189,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LoadUsrKey( uint8_t key_index ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -209,7 +209,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_StartWs( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -227,7 +227,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LockUsrKey( uint8_t key_index ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -247,7 +247,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_UnloadUsrKey( uint8_t key_index ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -267,7 +267,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_ActivateAntiRollback( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -285,7 +285,7 @@ SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -303,7 +303,7 @@ SHCI_CmdStatus_t SHCI_C2_THREAD_Init( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -321,7 +321,7 @@ SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -339,7 +339,7 @@ SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -352,12 +352,30 @@ SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param ) return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]); } +SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void ) +{ + /** + * Buffer is large enough to hold command complete without payload + */ + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; + + shci_send( SHCI_OPCODE_C2_ZIGBEE_INIT, + 0, + 0, + p_rsp ); + + return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]); +} + SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket ) { /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -375,7 +393,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseActivity( SHCI_EraseActivity_t erase_activit /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -395,7 +413,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mod /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -415,7 +433,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_GetNextBleEvtTime( SHCI_C2_CONCURRENT_GetNex /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE+4]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -435,7 +453,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_EnableNext_802154_EvtNotification( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -453,7 +471,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -473,7 +491,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -493,7 +511,7 @@ SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t Fla /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -509,12 +527,30 @@ SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t Fla return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]); } +SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void ) +{ + /** + * Buffer is large enough to hold command complete without payload + */ + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + TL_EvtPacket_t * p_rsp; + + p_rsp = (TL_EvtPacket_t *)local_buffer; + + shci_send( SHCI_OPCODE_C2_MAC_802_15_4_INIT, + 0, + 0, + p_rsp ); + + return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]); +} + SHCI_CmdStatus_t SHCI_C2_Reinit( void ) { /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -533,7 +569,7 @@ SHCI_CmdStatus_t SHCI_C2_ExtpaConfig(uint32_t gpio_port, uint16_t gpio_pin_numbe * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -557,7 +593,7 @@ SHCI_CmdStatus_t SHCI_C2_SetFlashActivityControl(SHCI_C2_SET_FLASH_ACTIVITY_CONT * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 1 byte of command parameter * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -577,7 +613,7 @@ SHCI_CmdStatus_t SHCI_C2_Config(SHCI_C2_CONFIG_Cmd_Param_t *pCmdPacket) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -595,7 +631,7 @@ SHCI_CmdStatus_t SHCI_C2_802_15_4_DeInit( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -703,4 +739,3 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo ) return (SHCI_Success); } -#endif /* STM32WBxx */ diff --git a/src/utility/STM32Cube_FW/shci.h b/src/utility/STM32Cube_FW/shci.h index a0f1e4d2..d2aa0a58 100644 --- a/src/utility/STM32Cube_FW/shci.h +++ b/src/utility/STM32Cube_FW/shci.h @@ -49,6 +49,7 @@ extern "C" { ERR_BLE_INIT = 0, /* This event is currently not reported by the CPU2 */ ERR_THREAD_LLD_FATAL_ERROR = 125, /* The LLD driver used on 802_15_4 detected a fatal error */ ERR_THREAD_UNKNOWN_CMD = 126, /* The command send by the CPU1 to control the Thread stack is unknown */ + ERR_ZIGBEE_UNKNOWN_CMD = 200, /* The command send by the CPU1 to control the Zigbee stack is unknown */ } SCHI_SystemErrCode_t; #define SHCI_EVTCODE ( 0xFF ) @@ -215,7 +216,9 @@ extern "C" { SHCI_OCF_C2_FLASH_STORE_DATA, SHCI_OCF_C2_FLASH_ERASE_DATA, SHCI_OCF_C2_RADIO_ALLOW_LOW_POWER, + SHCI_OCF_C2_MAC_802_15_4_INIT, SHCI_OCF_C2_REINIT, + SHCI_OCF_C2_ZIGBEE_INIT, SHCI_OCF_C2_LLD_TESTS_INIT, SHCI_OCF_C2_EXTPA_CONFIG, SHCI_OCF_C2_SET_FLASH_ACTIVITY_CONTROL, @@ -433,7 +436,7 @@ extern "C" { * PrWriteListSize * NOTE: This parameter is ignored by the CPU2 when the parameter "Options" is set to "LL_only" ( see Options description in that structure ) * - * Maximum number of supported "prepare write request" + * Maximum number of supported “prepare write request” * - Min value: given by the macro DEFAULT_PREP_WRITE_LIST_SIZE * - Max value: a value higher than the minimum required can be specified, but it is not recommended */ @@ -500,7 +503,7 @@ extern "C" { * MaxConnEventLength * This parameter determines the maximum duration of a slave connection event. When this duration is reached the slave closes * the current connections event (whatever is the CE_length parameter specified by the master in HCI_CREATE_CONNECTION HCI command), - * expressed in units of 625/256 µs (~2.44 µs) + * expressed in units of 625/256 µs (~2.44 µs) * - Min value: 0 (if 0 is specified, the master and slave perform only a single TX-RX exchange per connection event) * - Max value: 1638400 (4000 ms). A higher value can be specified (max 0xFFFFFFFF) but results in a maximum connection time * of 4000 ms as specified. In this case the parameter is not applied, and the predicted CE length calculated on slave is not shortened @@ -509,7 +512,7 @@ extern "C" { /** * HsStartupTime - * Startup time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 µs (~2.44 µs). + * Startup time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 µs (~2.44 µs). * - Min value: 0 * - Max value: 820 (~2 ms). A higher value can be specified, but the value that implemented in stack is forced to ~2 ms */ @@ -533,9 +536,7 @@ extern "C" { * - bit 5: 1: Reduced GATT database in NVM 0: Full GATT database in NVM * - bit 6: 1: GATT caching is used 0: GATT caching is not used * - bit 7: 1: LE Power Class 1 0: LE Power Classe 2-3 - * - bit 8: 1: appearance Writable 0: appearance Read-Only - * - bit 9: 1: Enhanced ATT supported 0: Enhanced ATT not supported - * - other bits: reserved ( shall be set to 0) + * - other bits: complete with Options_extension flag */ uint8_t Options; @@ -601,6 +602,14 @@ extern "C" { */ uint8_t ble_core_version; + /** + * Options flags extension + * - bit 0: 1: appearance Writable 0: appearance Read-Only + * - bit 1: 1: Enhanced ATT supported 0: Enhanced ATT not supported + * - other bits: reserved ( shall be set to 0) + */ + uint8_t Options_extension; + } SHCI_C2_Ble_Init_Cmd_Param_t; typedef PACKED_STRUCT{ @@ -637,11 +646,16 @@ extern "C" { #define SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_1 (1<<7) #define SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3 (0<<7) -#define SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_WRITABLE (1<<8) -#define SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY (0<<8) + /** + * Options extension + * Each definition below may be added together to build the Options value + * WARNING : Only one definition per bit shall be added to build the Options value + */ +#define SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_WRITABLE (1<<0) +#define SHCI_C2_BLE_INIT_OPTIONS_APPEARANCE_READONLY (0<<0) -#define SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_SUPPORTED (1<<9) -#define SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED (0<<9) +#define SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_SUPPORTED (1<<1) +#define SHCI_C2_BLE_INIT_OPTIONS_ENHANCED_ATT_NOTSUPPORTED (0<<1) /** * RX models configuration @@ -675,6 +689,8 @@ extern "C" { { uint8_t thread_config; uint8_t ble_config; + uint8_t mac_802_15_4_config; + uint8_t zigbee_config; } SHCI_C2_DEBUG_TracesConfig_t; typedef PACKED_STRUCT @@ -738,6 +754,8 @@ extern "C" { { BLE_ENABLE, THREAD_ENABLE, + ZIGBEE_ENABLE, + MAC_ENABLE, } SHCI_C2_CONCURRENT_Mode_Param_t; /** No response parameters*/ @@ -760,13 +778,18 @@ extern "C" { { BLE_IP, THREAD_IP, + ZIGBEE_IP, } SHCI_C2_FLASH_Ip_t; /** No response parameters*/ #define SHCI_OPCODE_C2_RADIO_ALLOW_LOW_POWER (( SHCI_OGF << 10) + SHCI_OCF_C2_RADIO_ALLOW_LOW_POWER) +#define SHCI_OPCODE_C2_MAC_802_15_4_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_MAC_802_15_4_INIT) + #define SHCI_OPCODE_C2_REINIT (( SHCI_OGF << 10) + SHCI_OCF_C2_REINIT) +#define SHCI_OPCODE_C2_ZIGBEE_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_ZIGBEE_INIT) + #define SHCI_OPCODE_C2_LLD_TESTS_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_LLD_TESTS_INIT) #define SHCI_OPCODE_C2_BLE_LLD_INIT (( SHCI_OGF << 10) + SHCI_OCF_C2_BLE_LLD_INIT) @@ -881,7 +904,7 @@ extern "C" { #define FUS_DEVICE_INFO_TABLE_VALIDITY_KEYWORD (0xA94656B9) /* - * At startup, the information relative to the wireless binary are stored in RAM through a structure defined by + * At startup, the informations relative to the wireless binary are stored in RAM trough a structure defined by * MB_WirelessFwInfoTable_t.This structure contains 4 fields (Version,MemorySize, Stack_info and a reserved part) * each of those coded on 32 bits as shown on the table below: * @@ -937,6 +960,9 @@ extern "C" { #define INFO_STACK_TYPE_BLE_HCI_EXT_ADV 0x07 #define INFO_STACK_TYPE_THREAD_FTD 0x10 #define INFO_STACK_TYPE_THREAD_MTD 0x11 +#define INFO_STACK_TYPE_ZIGBEE_FFD 0x30 +#define INFO_STACK_TYPE_ZIGBEE_RFD 0x31 +#define INFO_STACK_TYPE_MAC 0x40 #define INFO_STACK_TYPE_BLE_THREAD_FTD_STATIC 0x50 #define INFO_STACK_TYPE_BLE_THREAD_FTD_DYAMIC 0x51 #define INFO_STACK_TYPE_802154_LLD_TESTS 0x60 @@ -945,7 +971,12 @@ extern "C" { #define INFO_STACK_TYPE_BLE_LLD_TESTS 0x63 #define INFO_STACK_TYPE_BLE_RLV 0x64 #define INFO_STACK_TYPE_802154_RLV 0x65 +#define INFO_STACK_TYPE_BLE_ZIGBEE_FFD_STATIC 0x70 +#define INFO_STACK_TYPE_BLE_ZIGBEE_RFD_STATIC 0x71 +#define INFO_STACK_TYPE_BLE_ZIGBEE_FFD_DYNAMIC 0x78 +#define INFO_STACK_TYPE_BLE_ZIGBEE_RFD_DYNAMIC 0x79 #define INFO_STACK_TYPE_RLV 0x80 +#define INFO_STACK_TYPE_BLE_MAC_STATIC 0x90 typedef struct { /** @@ -1119,7 +1150,7 @@ typedef struct { * @brief Starts the LLD tests CLI * * @param param_size : Nb of bytes - * @param p_param : pointer with data to give from M4 to M0 + * @param p_param : pointeur with data to give from M4 to M0 * @retval Status */ SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param ); @@ -1129,11 +1160,20 @@ typedef struct { * @brief Starts the LLD tests BLE * * @param param_size : Nb of bytes - * @param p_param : pointer with data to give from M4 to M0 + * @param p_param : pointeur with data to give from M4 to M0 * @retval Status */ SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param ); + /** + * SHCI_C2_ZIGBEE_Init + * @brief Starts the Zigbee Stack + * + * @param None + * @retval Status + */ + SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void ); + /** * SHCI_C2_DEBUG_Init * @brief Starts the Traces @@ -1208,6 +1248,16 @@ typedef struct { */ SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t FlagRadioLowPowerOn); + + /** + * SHCI_C2_MAC_802_15_4_Init + * @brief Starts the MAC 802.15.4 on M0 + * + * @param None + * @retval Status + */ + SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void ); + /** * SHCI_GetWirelessFwInfo * @brief This function read back the informations relative to the wireless binary loaded. diff --git a/src/utility/STM32Cube_FW/shci_tl.c b/src/utility/STM32Cube_FW/shci_tl.c index 1abd1be9..2b387b1b 100644 --- a/src/utility/STM32Cube_FW/shci_tl.c +++ b/src/utility/STM32Cube_FW/shci_tl.c @@ -16,14 +16,12 @@ ****************************************************************************** */ -#if defined(STM32WBxx) + /* Includes ------------------------------------------------------------------*/ #include "stm32_wpan_common.h" #include "stm_list.h" #include "shci_tl.h" -#include "stm32_def.h" -#include "wiring_time.h" /* Private typedef -----------------------------------------------------------*/ typedef enum @@ -72,6 +70,8 @@ void shci_init(void(* UserEvtRx)(void* pData), void* pConf) shci_register_io_bus (&shciContext.io); TlInit((TL_CmdPacket_t *)(((SHCI_TL_HciInitConf_t *)pConf)->p_cmdbuffer)); + + return; } void shci_user_evt_proc(void) @@ -127,6 +127,8 @@ void shci_user_evt_proc(void) shci_notify_asynch_evt((void*) &SHciAsynchEventQueue); } + + return; } void shci_resume_flow( void ) @@ -138,6 +140,8 @@ void shci_resume_flow( void ) * be called */ shci_notify_asynch_evt((void*) &SHciAsynchEventQueue); + + return; } void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payload, TL_EvtPacket_t * p_rsp ) @@ -160,20 +164,8 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl memcpy( &(p_rsp->evtserial), pCmdBuffer, ((TL_EvtSerial_t*)pCmdBuffer)->evt.plen + TL_EVT_HDR_SIZE ); Cmd_SetStatus(SHCI_TL_CmdAvailable); -} -void shci_notify_asynch_evt(void *pdata) -{ - UNUSED(pdata); - /* Need to parse data in future version */ - shci_user_evt_proc(); -} - -void shci_register_io_bus(tSHciIO *fops) -{ - /* Register IO bus services */ - fops->Init = TL_SYS_Init; - fops->Send = TL_SYS_SendCmd; + return; } /* Private functions ---------------------------------------------------------*/ @@ -198,6 +190,8 @@ static void TlInit( TL_CmdPacket_t * p_cmdbuffer ) Conf.IoBusCallBackUserEvt = TlUserEvtReceived; shciContext.io.Init(&Conf); } + + return; } static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus) @@ -218,29 +212,35 @@ static void Cmd_SetStatus(SHCI_TL_CmdStatus_t shcicmdstatus) StatusNotCallBackFunction( SHCI_TL_CmdAvailable ); } } + + return; } static void TlCmdEvtReceived(TL_EvtPacket_t *shcievt) { (void)(shcievt); shci_cmd_resp_release(0); /**< Notify the application the Cmd response has been received */ + + return; } static void TlUserEvtReceived(TL_EvtPacket_t *shcievt) { LST_insert_tail(&SHciAsynchEventQueue, (tListNode *)shcievt); shci_notify_asynch_evt((void*) &SHciAsynchEventQueue); /**< Notify the application a full HCI event has been received */ + + return; } /* Weak implementation ----------------------------------------------------------------*/ __WEAK void shci_cmd_resp_wait(uint32_t timeout) { + (void)timeout; + CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT; - for (unsigned long start = millis(); (millis() - start) < timeout;) { - if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) { - break; - } - } + while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE); + + return; } __WEAK void shci_cmd_resp_release(uint32_t flag) @@ -248,5 +248,6 @@ __WEAK void shci_cmd_resp_release(uint32_t flag) (void)flag; CmdRspStatusFlag = SHCI_TL_CMD_RESP_RELEASE; + + return; } -#endif /* STM32WBxx */ diff --git a/src/utility/STM32Cube_FW/stm32_wpan_common.h b/src/utility/STM32Cube_FW/stm32_wpan_common.h index 5a2b2a55..f407bb98 100644 --- a/src/utility/STM32Cube_FW/stm32_wpan_common.h +++ b/src/utility/STM32Cube_FW/stm32_wpan_common.h @@ -25,9 +25,19 @@ extern "C" { #endif -#define __ASM __asm /*!< asm keyword for GNU Compiler */ -#define __INLINE inline /*!< inline keyword for GNU Compiler */ -#define __STATIC_INLINE static inline +#if defined ( __CC_ARM )||defined (__ARMCC_VERSION) + #define __ASM __asm /*!< asm keyword for ARM Compiler */ + #define __INLINE __inline /*!< inline keyword for ARM Compiler */ + #define __STATIC_INLINE static __inline +#elif defined ( __ICCARM__ ) + #define __ASM __asm /*!< asm keyword for IAR Compiler */ + #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ + #define __STATIC_INLINE static inline +#elif defined ( __GNUC__ ) + #define __ASM __asm /*!< asm keyword for GNU Compiler */ + #define __INLINE inline /*!< inline keyword for GNU Compiler */ + #define __STATIC_INLINE static inline +#endif #include #include @@ -130,8 +140,29 @@ extern "C" { /* ----------------------------------- * * Packed usage (compiler dependent) * * ----------------------------------- */ +#undef PACKED__ #undef PACKED_STRUCT -#define PACKED_STRUCT struct __packed + +#if defined ( __CC_ARM ) + #if defined ( __GNUC__ ) + /* GNU extension */ + #define PACKED__ __attribute__((packed)) + #define PACKED_STRUCT struct PACKED__ + #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050U) + #define PACKED__ __attribute__((packed)) + #define PACKED_STRUCT struct PACKED__ + #else + #define PACKED__(TYPE) __packed TYPE + #define PACKED_STRUCT PACKED__(struct) + #endif +#elif defined ( __GNUC__ ) + #define PACKED__ __attribute__((packed)) + #define PACKED_STRUCT struct PACKED__ +#elif defined (__ICCARM__) + #define PACKED_STRUCT __packed struct +#else + #define PACKED_STRUCT __packed struct +#endif #ifdef __cplusplus } diff --git a/src/utility/STM32Cube_FW/stm_list.c b/src/utility/STM32Cube_FW/stm_list.c index 98924414..4c928647 100644 --- a/src/utility/STM32Cube_FW/stm_list.c +++ b/src/utility/STM32Cube_FW/stm_list.c @@ -16,13 +16,13 @@ ****************************************************************************** */ -#if defined(STM32WBxx) + /****************************************************************************** * Include Files ******************************************************************************/ +#include "utilities_common.h" + #include "stm_list.h" -#include "cmsis_gcc.h" -#include "stm32_wpan_common.h" /****************************************************************************** * Function Definitions @@ -33,20 +33,20 @@ void LST_init_head (tListNode * listHead) listHead->prev = listHead; } -bool LST_is_empty (tListNode * listHead) +uint8_t LST_is_empty (tListNode * listHead) { uint32_t primask_bit; - bool return_value; + uint8_t return_value; primask_bit = __get_PRIMASK(); /**< backup PRIMASK bit */ __disable_irq(); /**< Disable all interrupts by setting PRIMASK bit on Cortex*/ if(listHead->next == listHead) { - return_value = true; + return_value = TRUE; } else { - return_value = false; + return_value = FALSE; } __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/ @@ -204,4 +204,3 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node) __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/ } -#endif /* STM32WBxx */ diff --git a/src/utility/STM32Cube_FW/stm_list.h b/src/utility/STM32Cube_FW/stm_list.h index 769c2113..b7c3254c 100644 --- a/src/utility/STM32Cube_FW/stm_list.h +++ b/src/utility/STM32Cube_FW/stm_list.h @@ -21,8 +21,6 @@ #define _STM_LIST_H_ /* Includes ------------------------------------------------------------------*/ -#include "stdint.h" -#include "stdbool.h" #include "stm32_wpan_common.h" typedef PACKED_STRUCT _tListNode { @@ -32,7 +30,7 @@ typedef PACKED_STRUCT _tListNode { void LST_init_head (tListNode * listHead); -bool LST_is_empty (tListNode * listHead); +uint8_t LST_is_empty (tListNode * listHead); void LST_insert_head (tListNode * listHead, tListNode * node); diff --git a/src/utility/STM32Cube_FW/tl.h b/src/utility/STM32Cube_FW/tl.h index 354851ac..6bfa2655 100644 --- a/src/utility/STM32Cube_FW/tl.h +++ b/src/utility/STM32Cube_FW/tl.h @@ -61,9 +61,6 @@ extern "C" { #define TL_BLEEVT_CS_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t)) #define TL_BLEEVT_CS_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CS_PACKET_SIZE) -#define TL_BLEEVT_CC_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CcEvt_t)) -#define TL_BLEEVT_CC_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CC_PACKET_SIZE) - /* Exported types ------------------------------------------------------------*/ /**< Packet header */ typedef PACKED_STRUCT @@ -205,6 +202,19 @@ typedef struct uint8_t *p_BleLldM0CmdBuffer; } TL_BLE_LLD_Config_t; +typedef struct +{ + uint8_t *p_Mac_802_15_4_CmdRspBuffer; + uint8_t *p_Mac_802_15_4_NotAckBuffer; +} TL_MAC_802_15_4_Config_t; + +typedef struct +{ + uint8_t *p_ZigbeeOtCmdRspBuffer; + uint8_t *p_ZigbeeNotAckBuffer; + uint8_t *p_ZigbeeNotifRequestBuffer; +} TL_ZIGBEE_Config_t; + /** * @brief Contain the BLE HCI Init Configuration * @{ @@ -228,6 +238,43 @@ typedef struct uint8_t *p_cmdbuffer; } TL_SYS_InitConf_t; +/***************************************************************************************** + * Event type copied from ble_legacy.h + */ + +typedef PACKED_STRUCT +{ + uint8_t type; + uint8_t data[1]; +} hci_uart_pckt; + +typedef PACKED_STRUCT +{ + uint8_t evt; + uint8_t plen; + uint8_t data[1]; +} hci_event_pckt; + +typedef PACKED_STRUCT +{ + uint8_t subevent; + uint8_t data[1]; +} evt_le_meta_event; + +/** + * Vendor specific event for BLE core. + */ +typedef PACKED_STRUCT +{ + uint16_t ecode; /**< One of the BLE core event codes. */ + uint8_t data[1]; +} evt_blecore_aci; + +/* Bluetooth 48 bit address (in little-endian order). + */ +typedef uint8_t tBDAddr[6]; + + /* Exported constants --------------------------------------------------------*/ /* External variables --------------------------------------------------------*/ /* Exported macros -----------------------------------------------------------*/ @@ -298,6 +345,26 @@ void TL_MM_EvtDone( TL_EvtPacket_t * hcievt ); void TL_TRACES_Init( void ); void TL_TRACES_EvtReceived( TL_EvtPacket_t * hcievt ); +/****************************************************************************** + * MAC 802.15.4 + ******************************************************************************/ +void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config ); +void TL_MAC_802_15_4_SendCmd( void ); +void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ); +void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer ); +void TL_MAC_802_15_4_SendAck ( void ); + +/****************************************************************************** + * ZIGBEE + ******************************************************************************/ +void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config ); +void TL_ZIGBEE_SendM4RequestToM0( void ); +void TL_ZIGBEE_SendM4AckToM0Notify ( void ); +void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer ); +void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ); +void TL_ZIGBEE_M0RequestReceived(TL_EvtPacket_t * Otbuffer ); +void TL_ZIGBEE_SendM4AckToM0Request(void); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/utility/STM32Cube_FW/tl_mbox.c b/src/utility/STM32Cube_FW/tl_mbox.c index a9abb181..27a998a3 100644 --- a/src/utility/STM32Cube_FW/tl_mbox.c +++ b/src/utility/STM32Cube_FW/tl_mbox.c @@ -16,7 +16,6 @@ ****************************************************************************** */ -#if defined(STM32WBxx) /* Includes ------------------------------------------------------------------*/ #include "stm32_wpan_common.h" #include "hw.h" @@ -52,13 +51,15 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable; +PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table; +PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table; /**< tables */ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue; PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint8_t CsBuffer[sizeof(TL_PacketHeader_t) + TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t)]; -PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static tListNode EvtQueue; -PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static tListNode SystemEvtQueue; +PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode EvtQueue; +PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode SystemEvtQueue; static tListNode LocalFreeBufQueue; @@ -76,7 +77,7 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer); /* Public Functions Definition ------------------------------------------------------*/ /****************************************************************************** - * GENERAL + * GENERAL - refer to AN5289 for functions description. ******************************************************************************/ void TL_Enable( void ) { @@ -96,6 +97,8 @@ void TL_Init( void ) TL_RefTable.p_sys_table = &TL_SysTable; TL_RefTable.p_mem_manager_table = &TL_MemManagerTable; TL_RefTable.p_traces_table = &TL_TracesTable; + TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table; + TL_RefTable.p_zigbee_table = &TL_Zigbee_Table; HW_IPCC_Init(); return; @@ -449,6 +452,139 @@ void TL_BLE_LLD_SendRspAck( void ) } #endif /* BLE_LLD_WB */ +#ifdef MAC_802_15_4_WB +/****************************************************************************** + * MAC 802.15.4 + ******************************************************************************/ +void TL_MAC_802_15_4_Init( TL_MAC_802_15_4_Config_t *p_Config ) +{ + MB_Mac_802_15_4_t * p_mac_802_15_4_table; + + p_mac_802_15_4_table = TL_RefTable.p_mac_802_15_4_table; + + p_mac_802_15_4_table->p_cmdrsp_buffer = p_Config->p_Mac_802_15_4_CmdRspBuffer; + p_mac_802_15_4_table->p_notack_buffer = p_Config->p_Mac_802_15_4_NotAckBuffer; + + HW_IPCC_MAC_802_15_4_Init(); + + return; +} + +void TL_MAC_802_15_4_SendCmd( void ) +{ + ((TL_CmdPacket_t *)(TL_RefTable.p_mac_802_15_4_table->p_cmdrsp_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE; + + HW_IPCC_MAC_802_15_4_SendCmd(); + + return; +} + +void TL_MAC_802_15_4_SendAck ( void ) +{ + ((TL_CmdPacket_t *)(TL_RefTable.p_mac_802_15_4_table->p_notack_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE; + + HW_IPCC_MAC_802_15_4_SendAck(); + + return; +} + +void HW_IPCC_MAC_802_15_4_CmdEvtNot(void) +{ + TL_MAC_802_15_4_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_mac_802_15_4_table->p_cmdrsp_buffer) ); + + return; +} + +void HW_IPCC_MAC_802_15_4_EvtNot( void ) +{ + TL_MAC_802_15_4_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_mac_802_15_4_table->p_notack_buffer) ); + + return; +} + +__WEAK void TL_MAC_802_15_4_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){}; +__WEAK void TL_MAC_802_15_4_NotReceived( TL_EvtPacket_t * Notbuffer ){}; +#endif + +#ifdef ZIGBEE_WB +/****************************************************************************** + * ZIGBEE + ******************************************************************************/ +void TL_ZIGBEE_Init( TL_ZIGBEE_Config_t *p_Config ) +{ + MB_ZigbeeTable_t * p_zigbee_table; + + p_zigbee_table = TL_RefTable.p_zigbee_table; + p_zigbee_table->appliCmdM4toM0_buffer = p_Config->p_ZigbeeOtCmdRspBuffer; + p_zigbee_table->notifM0toM4_buffer = p_Config->p_ZigbeeNotAckBuffer; + p_zigbee_table->requestM0toM4_buffer = p_Config->p_ZigbeeNotifRequestBuffer; + + HW_IPCC_ZIGBEE_Init(); + + return; +} + +/* Zigbee M4 to M0 Request */ +void TL_ZIGBEE_SendM4RequestToM0( void ) +{ + ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer))->cmdserial.type = TL_OTCMD_PKT_TYPE; + + HW_IPCC_ZIGBEE_SendM4RequestToM0(); + + return; +} + +/* Used to receive an ACK from the M0 */ +void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void) +{ + TL_ZIGBEE_CmdEvtReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->appliCmdM4toM0_buffer) ); + + return; +} + +/* Zigbee notification from M0 to M4 */ +void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void ) +{ + TL_ZIGBEE_NotReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer) ); + + return; +} + +/* Send an ACK to the M0 for a Notification */ +void TL_ZIGBEE_SendM4AckToM0Notify ( void ) +{ + ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->notifM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE; + + HW_IPCC_ZIGBEE_SendM4AckToM0Notify(); + + return; +} + +/* Zigbee M0 to M4 Request */ +void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void ) +{ + TL_ZIGBEE_M0RequestReceived( (TL_EvtPacket_t*)(TL_RefTable.p_zigbee_table->requestM0toM4_buffer) ); + + return; +} + +/* Send an ACK to the M0 for a Request */ +void TL_ZIGBEE_SendM4AckToM0Request(void) +{ + ((TL_CmdPacket_t *)(TL_RefTable.p_zigbee_table->requestM0toM4_buffer))->cmdserial.type = TL_OTACK_PKT_TYPE; + + HW_IPCC_ZIGBEE_SendM4AckToM0Request(); + + return; +} + + +__WEAK void TL_ZIGBEE_CmdEvtReceived( TL_EvtPacket_t * Otbuffer ){}; +__WEAK void TL_ZIGBEE_NotReceived( TL_EvtPacket_t * Notbuffer ){}; +#endif + + + /****************************************************************************** * MEMORY MANAGER ******************************************************************************/ @@ -710,4 +846,3 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer) return; } -#endif /* STM32WBxx */ From d758a661f9f2c033209219a1d86fccad7a2a8ef3 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 5 Apr 2023 10:18:52 +0200 Subject: [PATCH 3/8] chore: adapt STM32Cube_FW sources Compare to previous patch, do the minimum changes required to ease further update. Signed-off-by: Frederic Pillon --- src/utility/STM32Cube_FW/app_conf_default.h | 47 +++++++++++++++------ src/utility/STM32Cube_FW/ble_bufsize.h | 11 ++++- src/utility/STM32Cube_FW/hw.h | 15 +++++-- src/utility/STM32Cube_FW/hw_ipcc.c | 4 +- src/utility/STM32Cube_FW/shci.c | 3 +- src/utility/STM32Cube_FW/shci_tl.c | 18 +++++++- src/utility/STM32Cube_FW/stm_list.c | 7 ++- src/utility/STM32Cube_FW/tl_mbox.c | 8 +++- 8 files changed, 90 insertions(+), 23 deletions(-) diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h index 51bd33af..e89df140 100644 --- a/src/utility/STM32Cube_FW/app_conf_default.h +++ b/src/utility/STM32Cube_FW/app_conf_default.h @@ -1,9 +1,9 @@ /* USER CODE BEGIN Header */ /** ****************************************************************************** - * @file app_conf.h + * @file app_conf_default.h * @author MCD Application Team - * @brief Application configuration file for STM32WPAN Middleware. + * @brief Default application configuration file for STM32WPAN Middleware. ****************************************************************************** * @attention * @@ -19,18 +19,38 @@ /* USER CODE END Header */ /* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef APP_CONF_H -#define APP_CONF_H - +#ifndef APP_CONF_DEFAULT_H +#define APP_CONF_DEFAULT_H +#if 0 #include "hw.h" #include "hw_conf.h" #include "hw_if.h" #include "ble_bufsize.h" - +#endif /****************************************************************************** * Application Config ******************************************************************************/ +/**< generic parameters ******************************************************/ +/* HCI related defines */ + +#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F +#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C +#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D +#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251) +#define HCI_RESET 0x0C03 + +#ifndef BLE_SHARED_MEM_BYTE_ORDER + #define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST +#endif +#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128 + +/** + * Define Tx Power + */ +#define CFG_TX_POWER (0x18) /* -0.15dBm */ + +#if 0 /** * Define Secure Connections Support */ @@ -104,7 +124,7 @@ #define CFG_FW_SUBVERSION (1) #define CFG_FW_BRANCH (0) #define CFG_FW_BUILD (0) - +#endif /****************************************************************************** * BLE Stack ******************************************************************************/ @@ -152,13 +172,15 @@ * Prepare Write List size in terms of number of packet * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ -#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) +// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) +#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A) /** * Number of allocated memory blocks * This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ -#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) +//#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK)) +#define CFG_BLE_MBLOCK_COUNT (0x79) /** * Enable or disable the Extended Packet length feature. Valid values are 0 or 1. @@ -250,7 +272,7 @@ * 0: LE Power Class 2-3 * other bits: complete with Options_extension flag */ -#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_HOST | SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC | SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW | SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV | SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 | SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM | SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED | SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3) +#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY) /** * BLE stack Options_extension flags to be configured with: @@ -323,6 +345,7 @@ #define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3) +#if 0 /****************************************************************************** * Transport Layer ******************************************************************************/ @@ -657,5 +680,5 @@ typedef enum #define CFG_OTP_BASE_ADDRESS OTP_AREA_BASE #define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR - -#endif /*APP_CONF_H */ +#endif +#endif /*APP_CONF_DEFAULT_H */ diff --git a/src/utility/STM32Cube_FW/ble_bufsize.h b/src/utility/STM32Cube_FW/ble_bufsize.h index 7b7c170f..53cf59a8 100644 --- a/src/utility/STM32Cube_FW/ble_bufsize.h +++ b/src/utility/STM32Cube_FW/ble_bufsize.h @@ -75,15 +75,22 @@ ((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \ BLE_MBLOCKS_SECURE_CONNECTIONS)) +/* + * BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count + */ +#define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \ + BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \ + BLE_DEFAULT_MAX_ATT_MTU, n_link) + /* * BLE_FIXED_BUFFER_SIZE_BYTES: * A part of the RAM, is dynamically allocated by initializing all the pointers * defined in a global context variable "mem_alloc_ctx_p". - * This initialization is made in the Dynamic_allocator functions, which + * This initialization is made in the Dynamic_allocator functions, which * assign a portion of RAM given by the external application to the above * mentioned "global pointers". * - * The size of this Dynamic RAM is made of 2 main components: + * The size of this Dynamic RAM is made of 2 main components: * - a part that is parameters-dependent (num of links, GATT buffers, ...), * and which value is made explicit by the following macro; * - a part, that may be considered "fixed", i.e. independent from the above diff --git a/src/utility/STM32Cube_FW/hw.h b/src/utility/STM32Cube_FW/hw.h index 503fa2ca..1472a5e8 100644 --- a/src/utility/STM32Cube_FW/hw.h +++ b/src/utility/STM32Cube_FW/hw.h @@ -26,14 +26,23 @@ extern "C" { #endif /* Includes ------------------------------------------------------------------*/ +#include "stm32_def.h" +#include "stm32wbxx_ll_bus.h" +#include "stm32wbxx_ll_exti.h" +#include "stm32wbxx_ll_system.h" +#include "stm32wbxx_ll_rcc.h" +#include "stm32wbxx_ll_ipcc.h" +#include "stm32wbxx_ll_cortex.h" +#include "stm32wbxx_ll_utils.h" +#include "stm32wbxx_ll_pwr.h" /****************************************************************************** * HW IPCC ******************************************************************************/ void HW_IPCC_Enable( void ); void HW_IPCC_Init( void ); - void HW_IPCC_Rx_Handler( void ); - void HW_IPCC_Tx_Handler( void ); +#define HW_IPCC_Rx_Handler IPCC_C1_RX_IRQHandler +#define HW_IPCC_Tx_Handler IPCC_C1_TX_IRQHandler void HW_IPCC_BLE_Init( void ); void HW_IPCC_BLE_SendCmd( void ); @@ -76,7 +85,7 @@ extern "C" { void HW_IPCC_BLE_LLD_ReceiveRsp( void ); void HW_IPCC_BLE_LLD_SendRspAck( void ); - + void HW_IPCC_TRACES_Init( void ); void HW_IPCC_TRACES_EvtNot( void ); diff --git a/src/utility/STM32Cube_FW/hw_ipcc.c b/src/utility/STM32Cube_FW/hw_ipcc.c index fd620b85..3461cbed 100644 --- a/src/utility/STM32Cube_FW/hw_ipcc.c +++ b/src/utility/STM32Cube_FW/hw_ipcc.c @@ -18,8 +18,9 @@ */ /* USER CODE END Header */ +#if defined(STM32WBxx) /* Includes ------------------------------------------------------------------*/ -#include "app_common.h" +#include "hw.h" #include "mbox_def.h" /* Global variables ---------------------------------------------------------*/ @@ -667,3 +668,4 @@ static void HW_IPCC_TRACES_EvtHandler( void ) } __weak void HW_IPCC_TRACES_EvtNot( void ){}; +#endif /* STM32WBxx */ diff --git a/src/utility/STM32Cube_FW/shci.c b/src/utility/STM32Cube_FW/shci.c index 301db76d..cb7d7bd2 100644 --- a/src/utility/STM32Cube_FW/shci.c +++ b/src/utility/STM32Cube_FW/shci.c @@ -16,7 +16,7 @@ ****************************************************************************** */ - +#if defined(STM32WBxx) /* Includes ------------------------------------------------------------------*/ #include "stm32_wpan_common.h" @@ -739,3 +739,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo ) return (SHCI_Success); } +#endif /* STM32WBxx */ diff --git a/src/utility/STM32Cube_FW/shci_tl.c b/src/utility/STM32Cube_FW/shci_tl.c index 2b387b1b..a336aa6e 100644 --- a/src/utility/STM32Cube_FW/shci_tl.c +++ b/src/utility/STM32Cube_FW/shci_tl.c @@ -16,12 +16,13 @@ ****************************************************************************** */ - +#if defined(STM32WBxx) /* Includes ------------------------------------------------------------------*/ #include "stm32_wpan_common.h" #include "stm_list.h" #include "shci_tl.h" +#include "stm32_def.h" /* Private typedef -----------------------------------------------------------*/ typedef enum @@ -168,6 +169,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl return; } +void shci_notify_asynch_evt(void *pdata) +{ + UNUSED(pdata); + /* Need to parse data in future version */ + shci_user_evt_proc(); +} + +void shci_register_io_bus(tSHciIO *fops) +{ + /* Register IO bus services */ + fops->Init = TL_SYS_Init; + fops->Send = TL_SYS_SendCmd; +} + /* Private functions ---------------------------------------------------------*/ static void TlInit( TL_CmdPacket_t * p_cmdbuffer ) { @@ -251,3 +266,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag) return; } +#endif /* STM32WBxx */ diff --git a/src/utility/STM32Cube_FW/stm_list.c b/src/utility/STM32Cube_FW/stm_list.c index 4c928647..4e8c3643 100644 --- a/src/utility/STM32Cube_FW/stm_list.c +++ b/src/utility/STM32Cube_FW/stm_list.c @@ -16,11 +16,13 @@ ****************************************************************************** */ - +#if defined(STM32WBxx) /****************************************************************************** * Include Files ******************************************************************************/ -#include "utilities_common.h" +#include "stdint.h" +#include "cmsis_gcc.h" +#include "stm32_wpan_common.h" #include "stm_list.h" @@ -204,3 +206,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node) __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/ } +#endif /* STM32WBxx */ diff --git a/src/utility/STM32Cube_FW/tl_mbox.c b/src/utility/STM32Cube_FW/tl_mbox.c index 27a998a3..ff219b97 100644 --- a/src/utility/STM32Cube_FW/tl_mbox.c +++ b/src/utility/STM32Cube_FW/tl_mbox.c @@ -16,6 +16,7 @@ ****************************************************************************** */ +#if defined(STM32WBxx) /* Includes ------------------------------------------------------------------*/ #include "stm32_wpan_common.h" #include "hw.h" @@ -51,9 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable; +#if 0 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table; - +#endif /**< tables */ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue; PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue; @@ -97,8 +99,11 @@ void TL_Init( void ) TL_RefTable.p_sys_table = &TL_SysTable; TL_RefTable.p_mem_manager_table = &TL_MemManagerTable; TL_RefTable.p_traces_table = &TL_TracesTable; + +#if 0 TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table; TL_RefTable.p_zigbee_table = &TL_Zigbee_Table; +#endif HW_IPCC_Init(); return; @@ -846,3 +851,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer) return; } +#endif /* STM32WBxx */ From 751295300e5fb7fc1f277410e8aa76f4e29f7302 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 12 Dec 2022 17:17:48 +0100 Subject: [PATCH 4/8] fix: include a timeout when waiting for the cmd_resp Signed-off-by: Frederic Pillon --- src/utility/STM32Cube_FW/shci_tl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utility/STM32Cube_FW/shci_tl.c b/src/utility/STM32Cube_FW/shci_tl.c index a336aa6e..d1d35f5b 100644 --- a/src/utility/STM32Cube_FW/shci_tl.c +++ b/src/utility/STM32Cube_FW/shci_tl.c @@ -23,6 +23,7 @@ #include "stm_list.h" #include "shci_tl.h" #include "stm32_def.h" +#include "wiring_time.h" /* Private typedef -----------------------------------------------------------*/ typedef enum @@ -250,11 +251,12 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt) /* Weak implementation ----------------------------------------------------------------*/ __WEAK void shci_cmd_resp_wait(uint32_t timeout) { - (void)timeout; - CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT; - while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE); - + for (unsigned long start = millis(); (millis() - start) < timeout;) { + if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) { + break; + } + } return; } From 9b421c27d620e27334f6b1cb2e55a6c75ef6055d Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 12 Dec 2022 17:29:27 +0100 Subject: [PATCH 5/8] chore: add support for customize app_conf_default.h Signed-off-by: Frederic Pillon --- src/utility/STM32Cube_FW/app_conf_default.h | 86 ++++++++++++++++----- 1 file changed, 68 insertions(+), 18 deletions(-) diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h index e89df140..1f17900d 100644 --- a/src/utility/STM32Cube_FW/app_conf_default.h +++ b/src/utility/STM32Cube_FW/app_conf_default.h @@ -48,7 +48,9 @@ /** * Define Tx Power */ -#define CFG_TX_POWER (0x18) /* -0.15dBm */ +#ifndef CFG_TX_POWER + #define CFG_TX_POWER (0x18) /* -0.15dBm */ +#endif #if 0 /** @@ -132,13 +134,25 @@ * Maximum number of simultaneous connections that the device will support. * Valid values are from 1 to 8 */ -#define CFG_BLE_NUM_LINK 8 +#ifndef CFG_BLE_NUM_LINK +#ifdef STM32WB15xx + #define CFG_BLE_NUM_LINK 3 +#else + #define CFG_BLE_NUM_LINK 8 +#endif +#endif /** * Maximum number of Services that can be stored in the GATT database. * Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services */ -#define CFG_BLE_NUM_GATT_SERVICES 8 +#ifndef CFG_BLE_NUM_GATT_SERVICES +#ifdef STM32WB15xx + #define CFG_BLE_NUM_GATT_SERVICES 4 +#else + #define CFG_BLE_NUM_GATT_SERVICES 8 +#endif +#endif /** * Maximum number of Attributes @@ -147,13 +161,21 @@ * Note that certain characteristics and relative descriptors are added automatically during device initialization * so this parameters should be 9 plus the number of user Attributes */ -#define CFG_BLE_NUM_GATT_ATTRIBUTES 68 +#ifndef CFG_BLE_NUM_GATT_ATTRIBUTES +#ifdef STM32WB15xx + #define CFG_BLE_NUM_GATT_ATTRIBUTES 30 +#else + #define CFG_BLE_NUM_GATT_ATTRIBUTES 68 +#endif +#endif /** * Maximum supported ATT_MTU size * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ -#define CFG_BLE_MAX_ATT_MTU (156) +#ifndef CFG_BLE_MAX_ATT_MTU + #define CFG_BLE_MAX_ATT_MTU (156) +#endif /** * Size of the storage area for Attribute values @@ -166,14 +188,22 @@ * The total amount of memory needed is the sum of the above quantities for each attribute. * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ -#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344) +#ifndef CFG_BLE_ATT_VALUE_ARRAY_SIZE +#ifdef STM32WB15xx + #define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1290) +#else + #define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344) +#endif +#endif /** * Prepare Write List size in terms of number of packet * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set */ // #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU) -#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A) +#ifndef CFG_BLE_PREPARE_WRITE_LIST_SIZE + #define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A) +#endif /** * Number of allocated memory blocks @@ -185,12 +215,16 @@ /** * Enable or disable the Extended Packet length feature. Valid values are 0 or 1. */ -#define CFG_BLE_DATA_LENGTH_EXTENSION 1 +#ifndef CFG_BLE_DATA_LENGTH_EXTENSION + #define CFG_BLE_DATA_LENGTH_EXTENSION 1 +#endif /** * Sleep clock accuracy in Slave mode (ppm value) */ -#define CFG_BLE_SLAVE_SCA 500 +#ifndef CFG_BLE_SLAVE_SCA + #define CFG_BLE_SLAVE_SCA 500 +#endif /** * Sleep clock accuracy in Master mode @@ -203,7 +237,9 @@ * 6 : 21 ppm to 30 ppm * 7 : 0 ppm to 20 ppm */ -#define CFG_BLE_MASTER_SCA 0 +#ifndef CFG_BLE_MASTER_SCA + #define CFG_BLE_MASTER_SCA 0 +#endif /** * LsSource @@ -212,21 +248,27 @@ * - bit 1: 1: STM32WB5M Module device 0: Other devices as STM32WBxx SOC, STM32WB1M module * - bit 2: 1: HSE/1024 Clock config 0: LSE Clock config */ -#if defined(STM32WB5Mxx) - #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) -#else - #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) +#ifndef CFG_BLE_LS_SOURCE + #if defined(STM32WB5Mxx) + #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_MOD5MM_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) + #else + #define CFG_BLE_LS_SOURCE (SHCI_C2_BLE_INIT_CFG_BLE_LS_NOCALIB | SHCI_C2_BLE_INIT_CFG_BLE_LS_OTHER_DEV | SHCI_C2_BLE_INIT_CFG_BLE_LS_CLK_LSE) + #endif #endif /** * Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us) */ -#define CFG_BLE_HSE_STARTUP_TIME 0x148 +#ifndef CFG_BLE_HSE_STARTUP_TIME + #define CFG_BLE_HSE_STARTUP_TIME 0x148 +#endif /** * Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us) */ -#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF) +#ifndef CFG_BLE_MAX_CONN_EVENT_LENGTH + #define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF) +#endif /** * Viterbi Mode @@ -314,7 +356,11 @@ * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set */ -#define CFG_BLE_MAX_ADV_SET_NBR (8) +#if defined(STM32WB15xx) + #define CFG_BLE_MAX_ADV_SET_NBR (3) +#else + #define CFG_BLE_MAX_ADV_SET_NBR (8) +#endif /* Maximum advertising data length (in bytes) * Range: 31 .. 1650 with limitation: @@ -323,7 +369,11 @@ * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set */ -#define CFG_BLE_MAX_ADV_DATA_LEN (207) +#if defined(STM32WB15xx) + #define CFG_BLE_MAX_ADV_DATA_LEN (414) +#else + #define CFG_BLE_MAX_ADV_DATA_LEN (207) +#endif /* RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB. * Range: -1280 .. 1280 From 1ec4563f20df1bc36ac489706a3123b0fd1ce653 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 8 Feb 2023 16:50:46 +0100 Subject: [PATCH 6/8] fix: warning outside array bounds array subscript 'TL_CcEvt_t[0]' is partly outside array bounds Signed-off-by: Frederic Pillon --- src/utility/STM32Cube_FW/shci.c | 60 ++++++++++++++++----------------- src/utility/STM32Cube_FW/tl.h | 3 ++ 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/utility/STM32Cube_FW/shci.c b/src/utility/STM32Cube_FW/shci.c index cb7d7bd2..6348145f 100644 --- a/src/utility/STM32Cube_FW/shci.c +++ b/src/utility/STM32Cube_FW/shci.c @@ -42,7 +42,7 @@ uint8_t SHCI_C2_FUS_GetState( SHCI_FUS_GetState_ErrorCode_t *p_error_code ) /** * A command status event + payload has the same size than the expected command complete */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -66,7 +66,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_FwUpgrade( uint32_t fw_src_add, uint32_t fw_dest_a * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; uint32_t *p_cmd; uint8_t cmd_length; @@ -101,7 +101,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_FwDelete( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -119,7 +119,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_UpdateAuthKey( SHCI_C2_FUS_UpdateAuthKey_Cmd_Param_ /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -137,7 +137,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LockAuthKey( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -155,7 +155,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_StoreUsrKey( SHCI_C2_FUS_StoreUsrKey_Cmd_Param_t *p /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE + 1]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; uint8_t local_payload_len; @@ -189,7 +189,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LoadUsrKey( uint8_t key_index ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -209,7 +209,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_StartWs( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -227,7 +227,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_LockUsrKey( uint8_t key_index ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -247,7 +247,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_UnloadUsrKey( uint8_t key_index ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -267,7 +267,7 @@ SHCI_CmdStatus_t SHCI_C2_FUS_ActivateAntiRollback( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -285,7 +285,7 @@ SHCI_CmdStatus_t SHCI_C2_BLE_Init( SHCI_C2_Ble_Init_Cmd_Packet_t *pCmdPacket ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -303,7 +303,7 @@ SHCI_CmdStatus_t SHCI_C2_THREAD_Init( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -321,7 +321,7 @@ SHCI_CmdStatus_t SHCI_C2_LLDTESTS_Init( uint8_t param_size, uint8_t * p_param ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -339,7 +339,7 @@ SHCI_CmdStatus_t SHCI_C2_BLE_LLD_Init( uint8_t param_size, uint8_t * p_param ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -357,7 +357,7 @@ SHCI_CmdStatus_t SHCI_C2_ZIGBEE_Init( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -375,7 +375,7 @@ SHCI_CmdStatus_t SHCI_C2_DEBUG_Init( SHCI_C2_DEBUG_Init_Cmd_Packet_t *pCmdPacket /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -393,7 +393,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseActivity( SHCI_EraseActivity_t erase_activit /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -413,7 +413,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_SetMode( SHCI_C2_CONCURRENT_Mode_Param_t Mod /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -433,7 +433,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_GetNextBleEvtTime( SHCI_C2_CONCURRENT_GetNex /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE+4]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -453,7 +453,7 @@ SHCI_CmdStatus_t SHCI_C2_CONCURRENT_EnableNext_802154_EvtNotification( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -471,7 +471,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_StoreData( SHCI_C2_FLASH_Ip_t Ip ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -491,7 +491,7 @@ SHCI_CmdStatus_t SHCI_C2_FLASH_EraseData( SHCI_C2_FLASH_Ip_t Ip ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -511,7 +511,7 @@ SHCI_CmdStatus_t SHCI_C2_RADIO_AllowLowPower( SHCI_C2_FLASH_Ip_t Ip,uint8_t Fla /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -532,7 +532,7 @@ SHCI_CmdStatus_t SHCI_C2_MAC_802_15_4_Init( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -550,7 +550,7 @@ SHCI_CmdStatus_t SHCI_C2_Reinit( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -569,7 +569,7 @@ SHCI_CmdStatus_t SHCI_C2_ExtpaConfig(uint32_t gpio_port, uint16_t gpio_pin_numbe * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 8 bytes of command parameters * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -593,7 +593,7 @@ SHCI_CmdStatus_t SHCI_C2_SetFlashActivityControl(SHCI_C2_SET_FLASH_ACTIVITY_CONT * TL_BLEEVT_CS_BUFFER_SIZE is 15 bytes so it is large enough to hold the 1 byte of command parameter * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -613,7 +613,7 @@ SHCI_CmdStatus_t SHCI_C2_Config(SHCI_C2_CONFIG_Cmd_Param_t *pCmdPacket) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; @@ -631,7 +631,7 @@ SHCI_CmdStatus_t SHCI_C2_802_15_4_DeInit( void ) /** * Buffer is large enough to hold command complete without payload */ - uint8_t local_buffer[TL_BLEEVT_CS_BUFFER_SIZE]; + uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE]; TL_EvtPacket_t * p_rsp; p_rsp = (TL_EvtPacket_t *)local_buffer; diff --git a/src/utility/STM32Cube_FW/tl.h b/src/utility/STM32Cube_FW/tl.h index 6bfa2655..63126b3d 100644 --- a/src/utility/STM32Cube_FW/tl.h +++ b/src/utility/STM32Cube_FW/tl.h @@ -61,6 +61,9 @@ extern "C" { #define TL_BLEEVT_CS_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CsEvt_t)) #define TL_BLEEVT_CS_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CS_PACKET_SIZE) +#define TL_BLEEVT_CC_PACKET_SIZE (TL_EVT_HDR_SIZE + sizeof(TL_CcEvt_t)) +#define TL_BLEEVT_CC_BUFFER_SIZE (sizeof(TL_PacketHeader_t) + TL_BLEEVT_CC_PACKET_SIZE) + /* Exported types ------------------------------------------------------------*/ /**< Packet header */ typedef PACKED_STRUCT From a9bef0cf0ed3b7ee6a2cabca2bfe82b783be0104 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 5 Apr 2023 11:40:47 +0200 Subject: [PATCH 7/8] chore: add new field initalizer for SHCI_C2_Ble_Init_Cmd_Packet_t Signed-off-by: Frederic Pillon --- src/utility/HCISharedMemTransport.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utility/HCISharedMemTransport.cpp b/src/utility/HCISharedMemTransport.cpp index e51b5fa6..0db95041 100644 --- a/src/utility/HCISharedMemTransport.cpp +++ b/src/utility/HCISharedMemTransport.cpp @@ -658,7 +658,8 @@ int HCISharedMemTransportClass::stm32wb_start_ble(void) CFG_BLE_MAX_ADV_DATA_LEN, CFG_BLE_TX_PATH_COMPENS, CFG_BLE_RX_PATH_COMPENS, - CFG_BLE_CORE_VERSION + CFG_BLE_CORE_VERSION, + CFG_BLE_OPTIONS_EXT }; /** * Starts the BLE Stack on CPU2 From bc085c13d09be0c565b2ac1dbb3afdca7e4a6b9c Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 13 Jul 2023 15:45:56 +0200 Subject: [PATCH 8/8] chore: bump library version to 1.2.5 Signed-off-by: Frederic Pillon --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index c8a3119d..35083868 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=STM32duinoBLE -version=1.2.4 +version=1.2.5 author=Arduino, SRA maintainer=stm32duino sentence=Fork of ArduinoBLE library to add the support of STM32WB, SPBTLE-RF, SPBTLE-1S, BLUENRG-M2SP and BLUENRG-M0 BLE modules.