|
| 1 | +From 7f99c89e8a6f834daf4a76bf98307e9ebcd01c91 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Frederic Pillon <frederic.pillon@st.com> |
| 3 | +Date: Wed, 10 Jan 2024 18:16:01 +0100 |
| 4 | +Subject: [PATCH 1/4] chore: adapt STM32_WPAN sources |
| 5 | + |
| 6 | +Signed-off-by: Frederic Pillon <frederic.pillon@st.com> |
| 7 | +--- |
| 8 | + src/utility/STM32_WPAN/app_conf_default.h | 49 +++++++++++++++++++---- |
| 9 | + src/utility/STM32_WPAN/hw.h | 13 +++++- |
| 10 | + src/utility/STM32_WPAN/hw_ipcc.c | 4 +- |
| 11 | + src/utility/STM32_WPAN/shci.c | 2 + |
| 12 | + src/utility/STM32_WPAN/shci_tl.c | 17 ++++++++ |
| 13 | + src/utility/STM32_WPAN/stm_list.c | 6 ++- |
| 14 | + src/utility/STM32_WPAN/tl_mbox.c | 6 +++ |
| 15 | + 7 files changed, 85 insertions(+), 12 deletions(-) |
| 16 | + |
| 17 | +diff --git a/src/utility/STM32_WPAN/app_conf_default.h b/src/utility/STM32_WPAN/app_conf_default.h |
| 18 | +index 71fc107..bf2274a 100644 |
| 19 | +--- a/src/utility/STM32_WPAN/app_conf_default.h |
| 20 | ++++ b/src/utility/STM32_WPAN/app_conf_default.h |
| 21 | +@@ -1,9 +1,9 @@ |
| 22 | + /* USER CODE BEGIN Header */ |
| 23 | + /** |
| 24 | + ****************************************************************************** |
| 25 | +- * @file app_conf.h |
| 26 | ++ * @file app_conf_default.h |
| 27 | + * @author MCD Application Team |
| 28 | +- * @brief Application configuration file for STM32WPAN Middleware. |
| 29 | ++ * @brief Default application configuration file for STM32WPAN Middleware. |
| 30 | + ****************************************************************************** |
| 31 | + * @attention |
| 32 | + * |
| 33 | +@@ -19,18 +19,40 @@ |
| 34 | + /* USER CODE END Header */ |
| 35 | + |
| 36 | + /* Define to prevent recursive inclusion -------------------------------------*/ |
| 37 | +-#ifndef APP_CONF_H |
| 38 | +-#define APP_CONF_H |
| 39 | ++#ifndef APP_CONF_DEFAULT_H |
| 40 | ++#define APP_CONF_DEFAULT_H |
| 41 | + |
| 42 | ++#if 0 |
| 43 | + #include "hw.h" |
| 44 | + #include "hw_conf.h" |
| 45 | + #include "hw_if.h" |
| 46 | + #include "ble_bufsize.h" |
| 47 | ++#endif |
| 48 | + |
| 49 | + /****************************************************************************** |
| 50 | + * Application Config |
| 51 | + ******************************************************************************/ |
| 52 | + |
| 53 | ++/**< generic parameters ******************************************************/ |
| 54 | ++/* HCI related defines */ |
| 55 | ++ |
| 56 | ++#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F |
| 57 | ++#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C |
| 58 | ++#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D |
| 59 | ++#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251) |
| 60 | ++#define HCI_RESET 0x0C03 |
| 61 | ++ |
| 62 | ++#ifndef BLE_SHARED_MEM_BYTE_ORDER |
| 63 | ++ #define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST |
| 64 | ++#endif |
| 65 | ++#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128 |
| 66 | ++ |
| 67 | ++/** |
| 68 | ++ * Define Tx Power |
| 69 | ++ */ |
| 70 | ++#define CFG_TX_POWER (0x18) /* -0.15dBm */ |
| 71 | ++ |
| 72 | ++#if 0 |
| 73 | + /** |
| 74 | + * Define Secure Connections Support |
| 75 | + */ |
| 76 | +@@ -104,6 +126,7 @@ |
| 77 | + #define CFG_FW_SUBVERSION (1) |
| 78 | + #define CFG_FW_BRANCH (0) |
| 79 | + #define CFG_FW_BUILD (0) |
| 80 | ++#endif |
| 81 | + |
| 82 | + /****************************************************************************** |
| 83 | + * BLE Stack |
| 84 | +@@ -250,7 +273,7 @@ |
| 85 | + * 0: LE Power Class 2-3 |
| 86 | + * other bits: complete with Options_extension flag |
| 87 | + */ |
| 88 | +-#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) |
| 89 | ++#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY | 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) |
| 90 | + |
| 91 | + /** |
| 92 | + * BLE stack Options_extension flags to be configured with: |
| 93 | +@@ -292,7 +315,11 @@ |
| 94 | + * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set |
| 95 | + */ |
| 96 | + |
| 97 | +-#define CFG_BLE_MAX_ADV_SET_NBR (8) |
| 98 | ++#if defined(STM32WB15xx) |
| 99 | ++ #define CFG_BLE_MAX_ADV_SET_NBR (3) |
| 100 | ++#else |
| 101 | ++ #define CFG_BLE_MAX_ADV_SET_NBR (8) |
| 102 | ++#endif |
| 103 | + |
| 104 | + /* Maximum advertising data length (in bytes) |
| 105 | + * Range: 31 .. 1650 with limitation: |
| 106 | +@@ -301,7 +328,11 @@ |
| 107 | + * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set |
| 108 | + */ |
| 109 | + |
| 110 | +-#define CFG_BLE_MAX_ADV_DATA_LEN (207) |
| 111 | ++#if defined(STM32WB15xx) |
| 112 | ++ #define CFG_BLE_MAX_ADV_DATA_LEN (414) |
| 113 | ++#else |
| 114 | ++ #define CFG_BLE_MAX_ADV_DATA_LEN (207) |
| 115 | ++#endif |
| 116 | + |
| 117 | + /* RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB. |
| 118 | + * Range: -1280 .. 1280 |
| 119 | +@@ -324,6 +355,7 @@ |
| 120 | + |
| 121 | + #define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_4) |
| 122 | + |
| 123 | ++#if 0 |
| 124 | + /****************************************************************************** |
| 125 | + * Transport Layer |
| 126 | + ******************************************************************************/ |
| 127 | +@@ -660,4 +692,5 @@ typedef enum |
| 128 | + |
| 129 | + #define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR |
| 130 | + |
| 131 | +-#endif /*APP_CONF_H */ |
| 132 | ++#endif |
| 133 | ++#endif /*APP_CONF_DEFAULT_H */ |
| 134 | +diff --git a/src/utility/STM32_WPAN/hw.h b/src/utility/STM32_WPAN/hw.h |
| 135 | +index 651e1f1..1472a5e 100644 |
| 136 | +--- a/src/utility/STM32_WPAN/hw.h |
| 137 | ++++ b/src/utility/STM32_WPAN/hw.h |
| 138 | +@@ -26,14 +26,23 @@ extern "C" { |
| 139 | + #endif |
| 140 | + |
| 141 | + /* Includes ------------------------------------------------------------------*/ |
| 142 | ++#include "stm32_def.h" |
| 143 | ++#include "stm32wbxx_ll_bus.h" |
| 144 | ++#include "stm32wbxx_ll_exti.h" |
| 145 | ++#include "stm32wbxx_ll_system.h" |
| 146 | ++#include "stm32wbxx_ll_rcc.h" |
| 147 | ++#include "stm32wbxx_ll_ipcc.h" |
| 148 | ++#include "stm32wbxx_ll_cortex.h" |
| 149 | ++#include "stm32wbxx_ll_utils.h" |
| 150 | ++#include "stm32wbxx_ll_pwr.h" |
| 151 | + |
| 152 | + /****************************************************************************** |
| 153 | + * HW IPCC |
| 154 | + ******************************************************************************/ |
| 155 | + void HW_IPCC_Enable( void ); |
| 156 | + void HW_IPCC_Init( void ); |
| 157 | +- void HW_IPCC_Rx_Handler( void ); |
| 158 | +- void HW_IPCC_Tx_Handler( void ); |
| 159 | ++#define HW_IPCC_Rx_Handler IPCC_C1_RX_IRQHandler |
| 160 | ++#define HW_IPCC_Tx_Handler IPCC_C1_TX_IRQHandler |
| 161 | + |
| 162 | + void HW_IPCC_BLE_Init( void ); |
| 163 | + void HW_IPCC_BLE_SendCmd( void ); |
| 164 | +diff --git a/src/utility/STM32_WPAN/hw_ipcc.c b/src/utility/STM32_WPAN/hw_ipcc.c |
| 165 | +index 6a311b1..ad3c9d4 100644 |
| 166 | +--- a/src/utility/STM32_WPAN/hw_ipcc.c |
| 167 | ++++ b/src/utility/STM32_WPAN/hw_ipcc.c |
| 168 | +@@ -18,8 +18,9 @@ |
| 169 | + */ |
| 170 | + /* USER CODE END Header */ |
| 171 | + |
| 172 | ++#if defined(STM32WBxx) |
| 173 | + /* Includes ------------------------------------------------------------------*/ |
| 174 | +-#include "app_common.h" |
| 175 | ++#include "hw.h" |
| 176 | + #include "mbox_def.h" |
| 177 | + #include "utilities_conf.h" |
| 178 | + |
| 179 | +@@ -745,3 +746,4 @@ static void HW_IPCC_TRACES_EvtHandler( void ) |
| 180 | + } |
| 181 | + |
| 182 | + __weak void HW_IPCC_TRACES_EvtNot( void ){}; |
| 183 | ++#endif /* STM32WBxx */ |
| 184 | +diff --git a/src/utility/STM32_WPAN/shci.c b/src/utility/STM32_WPAN/shci.c |
| 185 | +index 5c32555..40110f4 100644 |
| 186 | +--- a/src/utility/STM32_WPAN/shci.c |
| 187 | ++++ b/src/utility/STM32_WPAN/shci.c |
| 188 | +@@ -17,6 +17,7 @@ |
| 189 | + */ |
| 190 | + |
| 191 | + |
| 192 | ++#if defined(STM32WBxx) |
| 193 | + /* Includes ------------------------------------------------------------------*/ |
| 194 | + #include "stm32_wpan_common.h" |
| 195 | + |
| 196 | +@@ -759,3 +760,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo ) |
| 197 | + |
| 198 | + return (SHCI_Success); |
| 199 | + } |
| 200 | ++#endif /* STM32WBxx */ |
| 201 | +diff --git a/src/utility/STM32_WPAN/shci_tl.c b/src/utility/STM32_WPAN/shci_tl.c |
| 202 | +index 0f60430..daa988c 100644 |
| 203 | +--- a/src/utility/STM32_WPAN/shci_tl.c |
| 204 | ++++ b/src/utility/STM32_WPAN/shci_tl.c |
| 205 | +@@ -17,11 +17,13 @@ |
| 206 | + */ |
| 207 | + |
| 208 | + |
| 209 | ++#if defined(STM32WBxx) |
| 210 | + /* Includes ------------------------------------------------------------------*/ |
| 211 | + #include "stm32_wpan_common.h" |
| 212 | + |
| 213 | + #include "stm_list.h" |
| 214 | + #include "shci_tl.h" |
| 215 | ++#include "stm32_def.h" |
| 216 | + |
| 217 | + /* Private typedef -----------------------------------------------------------*/ |
| 218 | + typedef enum |
| 219 | +@@ -168,6 +170,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl |
| 220 | + return; |
| 221 | + } |
| 222 | + |
| 223 | ++void shci_notify_asynch_evt(void *pdata) |
| 224 | ++{ |
| 225 | ++ UNUSED(pdata); |
| 226 | ++ /* Need to parse data in future version */ |
| 227 | ++ shci_user_evt_proc(); |
| 228 | ++} |
| 229 | ++ |
| 230 | ++void shci_register_io_bus(tSHciIO *fops) |
| 231 | ++{ |
| 232 | ++ /* Register IO bus services */ |
| 233 | ++ fops->Init = TL_SYS_Init; |
| 234 | ++ fops->Send = TL_SYS_SendCmd; |
| 235 | ++} |
| 236 | ++ |
| 237 | + /* Private functions ---------------------------------------------------------*/ |
| 238 | + static void TlInit( TL_CmdPacket_t * p_cmdbuffer ) |
| 239 | + { |
| 240 | +@@ -250,3 +266,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag) |
| 241 | + |
| 242 | + return; |
| 243 | + } |
| 244 | ++#endif /* STM32WBxx */ |
| 245 | +diff --git a/src/utility/STM32_WPAN/stm_list.c b/src/utility/STM32_WPAN/stm_list.c |
| 246 | +index 4c92864..df6c215 100644 |
| 247 | +--- a/src/utility/STM32_WPAN/stm_list.c |
| 248 | ++++ b/src/utility/STM32_WPAN/stm_list.c |
| 249 | +@@ -17,10 +17,13 @@ |
| 250 | + */ |
| 251 | + |
| 252 | + |
| 253 | ++#if defined(STM32WBxx) |
| 254 | + /****************************************************************************** |
| 255 | + * Include Files |
| 256 | + ******************************************************************************/ |
| 257 | +-#include "utilities_common.h" |
| 258 | ++#include "stdint.h" |
| 259 | ++#include "cmsis_gcc.h" |
| 260 | ++#include "stm32_wpan_common.h" |
| 261 | + |
| 262 | + #include "stm_list.h" |
| 263 | + |
| 264 | +@@ -204,3 +207,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node) |
| 265 | + |
| 266 | + __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/ |
| 267 | + } |
| 268 | ++#endif /* STM32WBxx */ |
| 269 | +diff --git a/src/utility/STM32_WPAN/tl_mbox.c b/src/utility/STM32_WPAN/tl_mbox.c |
| 270 | +index df07a19..9a2a297 100644 |
| 271 | +--- a/src/utility/STM32_WPAN/tl_mbox.c |
| 272 | ++++ b/src/utility/STM32_WPAN/tl_mbox.c |
| 273 | +@@ -16,6 +16,7 @@ |
| 274 | + ****************************************************************************** |
| 275 | + */ |
| 276 | + |
| 277 | ++#if defined(STM32WBxx) |
| 278 | + /* Includes ------------------------------------------------------------------*/ |
| 279 | + #include "stm32_wpan_common.h" |
| 280 | + #include "hw.h" |
| 281 | +@@ -51,8 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable; |
| 282 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable; |
| 283 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable; |
| 284 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable; |
| 285 | ++#if 0 |
| 286 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table; |
| 287 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table; |
| 288 | ++#endif |
| 289 | + |
| 290 | + /**< tables */ |
| 291 | + PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue; |
| 292 | +@@ -97,8 +100,10 @@ void TL_Init( void ) |
| 293 | + TL_RefTable.p_sys_table = &TL_SysTable; |
| 294 | + TL_RefTable.p_mem_manager_table = &TL_MemManagerTable; |
| 295 | + TL_RefTable.p_traces_table = &TL_TracesTable; |
| 296 | ++#if 0 |
| 297 | + TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table; |
| 298 | + TL_RefTable.p_zigbee_table = &TL_Zigbee_Table; |
| 299 | ++#endif |
| 300 | + HW_IPCC_Init(); |
| 301 | + |
| 302 | + return; |
| 303 | +@@ -847,3 +852,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer) |
| 304 | + |
| 305 | + return; |
| 306 | + } |
| 307 | ++#endif /* STM32WBxx */ |
| 308 | +-- |
| 309 | +2.34.1 |
| 310 | + |
0 commit comments