forked from stm32duino/STM32duinoBLE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0001-chore-adapt-STM32Cube_FW-sources.patch
More file actions
327 lines (294 loc) · 11.6 KB
/
0001-chore-adapt-STM32Cube_FW-sources.patch
File metadata and controls
327 lines (294 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
From 542e007fa5a1b53664d2efb5f01d67767123a357 Mon Sep 17 00:00:00 2001
From: Frederic Pillon <frederic.pillon@st.com>
Date: Thu, 13 Jul 2023 17:08:05 +0200
Subject: [PATCH 1/4] chore: adapt STM32Cube_FW sources
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
---
src/utility/STM32Cube_FW/app_conf_default.h | 46 ++++++++++++++++-----
src/utility/STM32Cube_FW/ble_bufsize.h | 7 ++++
src/utility/STM32Cube_FW/hw.h | 13 +++++-
src/utility/STM32Cube_FW/hw_ipcc.c | 5 ++-
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 | 7 +++-
8 files changed, 86 insertions(+), 20 deletions(-)
diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h
index 51bd33a..1c6dd91 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
******************************************************************************/
@@ -658,4 +681,5 @@ typedef enum
#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 b9935c0..d4d2890 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 651e1f1..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 );
diff --git a/src/utility/STM32Cube_FW/hw_ipcc.c b/src/utility/STM32Cube_FW/hw_ipcc.c
index fd620b8..c730482 100644
--- a/src/utility/STM32Cube_FW/hw_ipcc.c
+++ b/src/utility/STM32Cube_FW/hw_ipcc.c
@@ -17,9 +17,9 @@
******************************************************************************
*/
/* USER CODE END Header */
-
+#if defined(STM32WBxx)
/* Includes ------------------------------------------------------------------*/
-#include "app_common.h"
+#include "hw.h"
#include "mbox_def.h"
/* Global variables ---------------------------------------------------------*/
@@ -667,3 +667,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 eaa35d7..4525656 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 0f60430..e343809 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 )
{
@@ -250,3 +265,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..1139316 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,10 @@ 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 +850,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)
return;
}
+#endif /* STM32WBxx */
--
2.38.0.windows.1