1- From 542e007fa5a1b53664d2efb5f01d67767123a357 Mon Sep 17 00:00:00 2001
1+ From 140bed91f2c757239584d7b5caacef951b547141 Mon Sep 17 00:00:00 2001
22From: Frederic Pillon <frederic.pillon@st.com>
3- Date: Thu, 13 Jul 2023 17:08:05 +0200
3+ Date: Wed, 10 Jan 2024 18:16:01 +0100
44Subject: [PATCH 1/4] chore: adapt STM32_WPAN sources
55
66Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
77---
8- src/utility/STM32_WPAN/app_conf_default.h | 46 ++++++++++++++++-----
9- src/utility/STM32_WPAN/ble_bufsize.h | 7 ++++
8+ src/utility/STM32_WPAN/app_conf_default.h | 49 +++++++++++++++++++----
109 src/utility/STM32_WPAN/hw.h | 13 +++++-
11- src/utility/STM32_WPAN/hw_ipcc.c | 5 + +-
12- src/utility/STM32_WPAN/shci.c | 3 +-
13- src/utility/STM32_WPAN/shci_tl.c | 18 +++++++-
14- src/utility/STM32_WPAN/stm_list.c | 7 + ++-
15- src/utility/STM32_WPAN/tl_mbox.c | 7 +++-
16- 8 files changed, 86 insertions(+), 20 deletions(-)
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(-)
1716
1817diff --git a/src/utility/STM32_WPAN/app_conf_default.h b/src/utility/STM32_WPAN/app_conf_default.h
19- index 51bd33a..1c6dd91 100644
18+ index 846be3c..6c9beb3 100644
2019--- a/src/utility/STM32_WPAN/app_conf_default.h
2120+++ b/src/utility/STM32_WPAN/app_conf_default.h
2221@@ -1,9 +1,9 @@
@@ -31,22 +30,22 @@ index 51bd33a..1c6dd91 100644
3130 ******************************************************************************
3231 * @attention
3332 *
34- @@ -19,18 +19,38 @@
33+ @@ -19,18 +19,40 @@
3534 /* USER CODE END Header */
3635
3736 /* Define to prevent recursive inclusion -------------------------------------*/
3837- #ifndef APP_CONF_H
3938- #define APP_CONF_H
40- -
4139+ #ifndef APP_CONF_DEFAULT_H
4240+ #define APP_CONF_DEFAULT_H
41+
4342+ #if 0
4443 #include "hw.h"
4544 #include "hw_conf.h"
4645 #include "hw_if.h"
4746 #include "ble_bufsize.h"
48- -
4947+ #endif
48+
5049 /******************************************************************************
5150 * Application Config
5251 ******************************************************************************/
@@ -74,75 +73,64 @@ index 51bd33a..1c6dd91 100644
7473 /**
7574 * Define Secure Connections Support
7675 */
77- @@ -104,7 +124 ,7 @@
76+ @@ -104,6 +126 ,7 @@
7877 #define CFG_FW_SUBVERSION (1)
7978 #define CFG_FW_BRANCH (0)
8079 #define CFG_FW_BUILD (0)
81- -
8280+ #endif
81+
8382 /******************************************************************************
8483 * BLE Stack
85- ******************************************************************************/
86- @@ -152,13 +172,15 @@
87- * Prepare Write List size in terms of number of packet
88- * This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
89- */
90- - #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
91- + // #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
92- + #define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
93-
94- /**
95- * Number of allocated memory blocks
96- * 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
97- */
98- - #define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK))
99- + //#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK))
100- + #define CFG_BLE_MBLOCK_COUNT (0x79)
101-
102- /**
103- * Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
104- @@ -250,7 +272,7 @@
84+ @@ -250,7 +273,7 @@
10585 * 0: LE Power Class 2-3
10686 * other bits: complete with Options_extension flag
10787 */
10888- #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)
109- + #define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY)
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 )
11090
11191 /**
11292 * BLE stack Options_extension flags to be configured with:
113- @@ -323,6 +345,7 @@
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+ */
11496
115- #define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3)
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)
116122
117123+ #if 0
118124 /******************************************************************************
119125 * Transport Layer
120126 ******************************************************************************/
121- @@ -658 ,4 +681 ,5 @@ typedef enum
127+ @@ -659 ,4 +691 ,5 @@ typedef enum
122128
123129 #define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR
124130
125131- #endif /*APP_CONF_H */
126132+ #endif
127133+ #endif /*APP_CONF_DEFAULT_H */
128- diff --git a/src/utility/STM32_WPAN/ble_bufsize.h b/src/utility/STM32_WPAN/ble_bufsize.h
129- index b9935c0..d4d2890 100644
130- --- a/src/utility/STM32_WPAN/ble_bufsize.h
131- +++ b/src/utility/STM32_WPAN/ble_bufsize.h
132- @@ -75,6 +75,13 @@
133- ((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \
134- BLE_MBLOCKS_SECURE_CONNECTIONS))
135-
136- + /*
137- + * BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count
138- + */
139- + #define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \
140- + BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \
141- + BLE_DEFAULT_MAX_ATT_MTU, n_link)
142- +
143- /*
144- * BLE_FIXED_BUFFER_SIZE_BYTES:
145- * A part of the RAM, is dynamically allocated by initializing all the pointers
146134diff --git a/src/utility/STM32_WPAN/hw.h b/src/utility/STM32_WPAN/hw.h
147135index 651e1f1..1472a5e 100644
148136--- a/src/utility/STM32_WPAN/hw.h
@@ -174,53 +162,50 @@ index 651e1f1..1472a5e 100644
174162 void HW_IPCC_BLE_Init( void );
175163 void HW_IPCC_BLE_SendCmd( void );
176164diff --git a/src/utility/STM32_WPAN/hw_ipcc.c b/src/utility/STM32_WPAN/hw_ipcc.c
177- index fd620b8..c730482 100644
165+ index fd620b8..3461cbe 100644
178166--- a/src/utility/STM32_WPAN/hw_ipcc.c
179167+++ b/src/utility/STM32_WPAN/hw_ipcc.c
180- @@ -17,9 +17,9 @@
181- ******************************************************************************
168+ @@ -18,8 +18,9 @@
182169 */
183170 /* USER CODE END Header */
184- -
171+
185172+ #if defined(STM32WBxx)
186173 /* Includes ------------------------------------------------------------------*/
187174- #include "app_common.h"
188175+ #include "hw.h"
189176 #include "mbox_def.h"
190177
191178 /* Global variables ---------------------------------------------------------*/
192- @@ -667,3 +667 ,4 @@ static void HW_IPCC_TRACES_EvtHandler( void )
179+ @@ -667,3 +668 ,4 @@ static void HW_IPCC_TRACES_EvtHandler( void )
193180 }
194181
195182 __weak void HW_IPCC_TRACES_EvtNot( void ){};
196183+ #endif /* STM32WBxx */
197184diff --git a/src/utility/STM32_WPAN/shci.c b/src/utility/STM32_WPAN/shci.c
198- index eaa35d7..4525656 100644
185+ index 5c32555..40110f4 100644
199186--- a/src/utility/STM32_WPAN/shci.c
200187+++ b/src/utility/STM32_WPAN/shci.c
201- @@ -16,7 +16,7 @@
202- ******************************************************************************
188+ @@ -17,6 +17,7 @@
203189 */
204190
205- -
191+
206192+ #if defined(STM32WBxx)
207193 /* Includes ------------------------------------------------------------------*/
208194 #include "stm32_wpan_common.h"
209195
210- @@ -739 ,3 +739 ,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )
196+ @@ -759 ,3 +760 ,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )
211197
212198 return (SHCI_Success);
213199 }
214200+ #endif /* STM32WBxx */
215201diff --git a/src/utility/STM32_WPAN/shci_tl.c b/src/utility/STM32_WPAN/shci_tl.c
216- index 0f60430..e343809 100644
202+ index 0f60430..daa988c 100644
217203--- a/src/utility/STM32_WPAN/shci_tl.c
218204+++ b/src/utility/STM32_WPAN/shci_tl.c
219- @@ -16,12 +16,13 @@
220- ******************************************************************************
205+ @@ -17,11 +17,13 @@
221206 */
222207
223- -
208+
224209+ #if defined(STM32WBxx)
225210 /* Includes ------------------------------------------------------------------*/
226211 #include "stm32_wpan_common.h"
@@ -231,7 +216,7 @@ index 0f60430..e343809 100644
231216
232217 /* Private typedef -----------------------------------------------------------*/
233218 typedef enum
234- @@ -168,6 +169 ,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl
219+ @@ -168,6 +170 ,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl
235220 return;
236221 }
237222
@@ -252,20 +237,19 @@ index 0f60430..e343809 100644
252237 /* Private functions ---------------------------------------------------------*/
253238 static void TlInit( TL_CmdPacket_t * p_cmdbuffer )
254239 {
255- @@ -250,3 +265 ,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag)
240+ @@ -250,3 +266 ,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag)
256241
257242 return;
258243 }
259244+ #endif /* STM32WBxx */
260245diff --git a/src/utility/STM32_WPAN/stm_list.c b/src/utility/STM32_WPAN/stm_list.c
261- index 4c92864..4e8c364 100644
246+ index 4c92864..df6c215 100644
262247--- a/src/utility/STM32_WPAN/stm_list.c
263248+++ b/src/utility/STM32_WPAN/stm_list.c
264- @@ -16,11 +16,13 @@
265- ******************************************************************************
249+ @@ -17,10 +17,13 @@
266250 */
267251
268- -
252+
269253+ #if defined(STM32WBxx)
270254 /******************************************************************************
271255 * Include Files
@@ -277,13 +261,13 @@ index 4c92864..4e8c364 100644
277261
278262 #include "stm_list.h"
279263
280- @@ -204,3 +206 ,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node)
264+ @@ -204,3 +207 ,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node)
281265
282266 __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
283267 }
284268+ #endif /* STM32WBxx */
285269diff --git a/src/utility/STM32_WPAN/tl_mbox.c b/src/utility/STM32_WPAN/tl_mbox.c
286- index 27a998a..1139316 100644
270+ index 27a998a..40c9679 100644
287271--- a/src/utility/STM32_WPAN/tl_mbox.c
288272+++ b/src/utility/STM32_WPAN/tl_mbox.c
289273@@ -16,6 +16,7 @@
@@ -294,19 +278,18 @@ index 27a998a..1139316 100644
294278 /* Includes ------------------------------------------------------------------*/
295279 #include "stm32_wpan_common.h"
296280 #include "hw.h"
297- @@ -51,9 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable;
281+ @@ -51,8 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable;
298282 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable;
299283 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable;
300284 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable;
301285+ #if 0
302286 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table;
303287 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table;
304- -
305288+ #endif
289+
306290 /**< tables */
307291 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue;
308- PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue;
309- @@ -97,8 +99,10 @@ void TL_Init( void )
292+ @@ -97,8 +100,10 @@ void TL_Init( void )
310293 TL_RefTable.p_sys_table = &TL_SysTable;
311294 TL_RefTable.p_mem_manager_table = &TL_MemManagerTable;
312295 TL_RefTable.p_traces_table = &TL_TracesTable;
@@ -317,11 +300,11 @@ index 27a998a..1139316 100644
317300 HW_IPCC_Init();
318301
319302 return;
320- @@ -846,3 +850 ,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)
303+ @@ -846,3 +851 ,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)
321304
322305 return;
323306 }
324307+ #endif /* STM32WBxx */
325308- -
326- 2.38.0.windows .1
309+ 2.34 .1
327310
0 commit comments