1- From 542e007fa5a1b53664d2efb5f01d67767123a357 Mon Sep 17 00:00:00 2001
1+ From 89f654aa16086d9f73e885f8e8977b53469a4895 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 | 50 +++++++++++++++++++----
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, 86 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..3b5f882 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,41 @@
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 ******************************************************************************/
@@ -64,6 +63,7 @@ index 51bd33a..1c6dd91 100644
6463+ #define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST
6564+ #endif
6665+ #define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128
66+ + #endif
6767+
6868+ /**
6969+ * Define Tx Power
@@ -74,75 +74,64 @@ index 51bd33a..1c6dd91 100644
7474 /**
7575 * Define Secure Connections Support
7676 */
77- @@ -104,7 +124 ,7 @@
77+ @@ -104,6 +127 ,7 @@
7878 #define CFG_FW_SUBVERSION (1)
7979 #define CFG_FW_BRANCH (0)
8080 #define CFG_FW_BUILD (0)
81- -
8281+ #endif
82+
8383 /******************************************************************************
8484 * 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 @@
85+ @@ -250,7 +274,7 @@
10586 * 0: LE Power Class 2-3
10687 * other bits: complete with Options_extension flag
10788 */
10889- #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)
90+ + #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 )
11091
11192 /**
11293 * BLE stack Options_extension flags to be configured with:
113- @@ -323,6 +345,7 @@
94+ @@ -292,7 +316,11 @@
95+ * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set
96+ */
97+
98+ - #define CFG_BLE_MAX_ADV_SET_NBR (8)
99+ + #if defined(STM32WB15xx)
100+ + #define CFG_BLE_MAX_ADV_SET_NBR (3)
101+ + #else
102+ + #define CFG_BLE_MAX_ADV_SET_NBR (8)
103+ + #endif
104+
105+ /* Maximum advertising data length (in bytes)
106+ * Range: 31 .. 1650 with limitation:
107+ @@ -301,7 +329,11 @@
108+ * This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set
109+ */
110+
111+ - #define CFG_BLE_MAX_ADV_DATA_LEN (207)
112+ + #if defined(STM32WB15xx)
113+ + #define CFG_BLE_MAX_ADV_DATA_LEN (414)
114+ + #else
115+ + #define CFG_BLE_MAX_ADV_DATA_LEN (207)
116+ + #endif
117+
118+ /* RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB.
119+ * Range: -1280 .. 1280
120+ @@ -324,6 +356,7 @@
114121
115- #define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3 )
122+ #define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_4 )
116123
117124+ #if 0
118125 /******************************************************************************
119126 * Transport Layer
120127 ******************************************************************************/
121- @@ -658 ,4 +681 ,5 @@ typedef enum
128+ @@ -659 ,4 +692 ,5 @@ typedef enum
122129
123130 #define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR
124131
125132- #endif /*APP_CONF_H */
126133+ #endif
127134+ #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
146135diff --git a/src/utility/STM32_WPAN/hw.h b/src/utility/STM32_WPAN/hw.h
147136index 651e1f1..1472a5e 100644
148137--- a/src/utility/STM32_WPAN/hw.h
@@ -174,53 +163,50 @@ index 651e1f1..1472a5e 100644
174163 void HW_IPCC_BLE_Init( void );
175164 void HW_IPCC_BLE_SendCmd( void );
176165diff --git a/src/utility/STM32_WPAN/hw_ipcc.c b/src/utility/STM32_WPAN/hw_ipcc.c
177- index fd620b8..c730482 100644
166+ index fd620b8..3461cbe 100644
178167--- a/src/utility/STM32_WPAN/hw_ipcc.c
179168+++ b/src/utility/STM32_WPAN/hw_ipcc.c
180- @@ -17,9 +17,9 @@
181- ******************************************************************************
169+ @@ -18,8 +18,9 @@
182170 */
183171 /* USER CODE END Header */
184- -
172+
185173+ #if defined(STM32WBxx)
186174 /* Includes ------------------------------------------------------------------*/
187175- #include "app_common.h"
188176+ #include "hw.h"
189177 #include "mbox_def.h"
190178
191179 /* Global variables ---------------------------------------------------------*/
192- @@ -667,3 +667 ,4 @@ static void HW_IPCC_TRACES_EvtHandler( void )
180+ @@ -667,3 +668 ,4 @@ static void HW_IPCC_TRACES_EvtHandler( void )
193181 }
194182
195183 __weak void HW_IPCC_TRACES_EvtNot( void ){};
196184+ #endif /* STM32WBxx */
197185diff --git a/src/utility/STM32_WPAN/shci.c b/src/utility/STM32_WPAN/shci.c
198- index eaa35d7..4525656 100644
186+ index 5c32555..40110f4 100644
199187--- a/src/utility/STM32_WPAN/shci.c
200188+++ b/src/utility/STM32_WPAN/shci.c
201- @@ -16,7 +16,7 @@
202- ******************************************************************************
189+ @@ -17,6 +17,7 @@
203190 */
204191
205- -
192+
206193+ #if defined(STM32WBxx)
207194 /* Includes ------------------------------------------------------------------*/
208195 #include "stm32_wpan_common.h"
209196
210- @@ -739 ,3 +739 ,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )
197+ @@ -759 ,3 +760 ,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )
211198
212199 return (SHCI_Success);
213200 }
214201+ #endif /* STM32WBxx */
215202diff --git a/src/utility/STM32_WPAN/shci_tl.c b/src/utility/STM32_WPAN/shci_tl.c
216- index 0f60430..e343809 100644
203+ index 0f60430..daa988c 100644
217204--- a/src/utility/STM32_WPAN/shci_tl.c
218205+++ b/src/utility/STM32_WPAN/shci_tl.c
219- @@ -16,12 +16,13 @@
220- ******************************************************************************
206+ @@ -17,11 +17,13 @@
221207 */
222208
223- -
209+
224210+ #if defined(STM32WBxx)
225211 /* Includes ------------------------------------------------------------------*/
226212 #include "stm32_wpan_common.h"
@@ -231,7 +217,7 @@ index 0f60430..e343809 100644
231217
232218 /* Private typedef -----------------------------------------------------------*/
233219 typedef enum
234- @@ -168,6 +169 ,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl
220+ @@ -168,6 +170 ,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl
235221 return;
236222 }
237223
@@ -252,20 +238,19 @@ index 0f60430..e343809 100644
252238 /* Private functions ---------------------------------------------------------*/
253239 static void TlInit( TL_CmdPacket_t * p_cmdbuffer )
254240 {
255- @@ -250,3 +265 ,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag)
241+ @@ -250,3 +266 ,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag)
256242
257243 return;
258244 }
259245+ #endif /* STM32WBxx */
260246diff --git a/src/utility/STM32_WPAN/stm_list.c b/src/utility/STM32_WPAN/stm_list.c
261- index 4c92864..4e8c364 100644
247+ index 4c92864..df6c215 100644
262248--- a/src/utility/STM32_WPAN/stm_list.c
263249+++ b/src/utility/STM32_WPAN/stm_list.c
264- @@ -16,11 +16,13 @@
265- ******************************************************************************
250+ @@ -17,10 +17,13 @@
266251 */
267252
268- -
253+
269254+ #if defined(STM32WBxx)
270255 /******************************************************************************
271256 * Include Files
@@ -277,13 +262,13 @@ index 4c92864..4e8c364 100644
277262
278263 #include "stm_list.h"
279264
280- @@ -204,3 +206 ,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node)
265+ @@ -204,3 +207 ,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node)
281266
282267 __set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
283268 }
284269+ #endif /* STM32WBxx */
285270diff --git a/src/utility/STM32_WPAN/tl_mbox.c b/src/utility/STM32_WPAN/tl_mbox.c
286- index 27a998a..1139316 100644
271+ index 27a998a..40c9679 100644
287272--- a/src/utility/STM32_WPAN/tl_mbox.c
288273+++ b/src/utility/STM32_WPAN/tl_mbox.c
289274@@ -16,6 +16,7 @@
@@ -294,19 +279,18 @@ index 27a998a..1139316 100644
294279 /* Includes ------------------------------------------------------------------*/
295280 #include "stm32_wpan_common.h"
296281 #include "hw.h"
297- @@ -51,9 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable;
282+ @@ -51,8 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable;
298283 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable;
299284 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable;
300285 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable;
301286+ #if 0
302287 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table;
303288 PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table;
304- -
305289+ #endif
290+
306291 /**< tables */
307292 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 )
293+ @@ -97,8 +100,10 @@ void TL_Init( void )
310294 TL_RefTable.p_sys_table = &TL_SysTable;
311295 TL_RefTable.p_mem_manager_table = &TL_MemManagerTable;
312296 TL_RefTable.p_traces_table = &TL_TracesTable;
@@ -317,11 +301,11 @@ index 27a998a..1139316 100644
317301 HW_IPCC_Init();
318302
319303 return;
320- @@ -846,3 +850 ,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)
304+ @@ -846,3 +851 ,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)
321305
322306 return;
323307 }
324308+ #endif /* STM32WBxx */
325309- -
326- 2.38.0.windows .1
310+ 2.34 .1
327311
0 commit comments