Skip to content

Commit 4a9f4ae

Browse files
committed
chore: clean up and adapt STM32Cube_FW sources for STM32duino
Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent 2cc9f0f commit 4a9f4ae

13 files changed

+91
-933
lines changed

Diff for: src/utility/STM32Cube_FW/app_conf_default.h

+18-410
Large diffs are not rendered by default.

Diff for: src/utility/STM32Cube_FW/ble_bufsize.h

+10-3
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,24 @@
7575
((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \
7676
BLE_MBLOCKS_SECURE_CONNECTIONS))
7777

78+
/*
79+
* BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count
80+
*/
81+
#define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \
82+
BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \
83+
BLE_DEFAULT_MAX_ATT_MTU, n_link)
84+
7885
/*
7986
* BLE_FIXED_BUFFER_SIZE_BYTES:
80-
* A part of the RAM, is dinamically allocated by initilizing all the pointers
87+
* A part of the RAM, is dynamically allocated by initializing all the pointers
8188
* defined in a global context variable "mem_alloc_ctx_p".
8289
* This initialization is made in the Dynamic_allocator functions, which
83-
* assing a portion of RAM given by the external application to the above
90+
* assign a portion of RAM given by the external application to the above
8491
* mentioned "global pointers".
8592
*
8693
* The size of this Dynamic RAM is made of 2 main components:
8794
* - a part that is parameters-dependent (num of links, GATT buffers, ...),
88-
* and which value is explicited by the following macro;
95+
* and which value is defined by the following macro;
8996
* - a part, that may be considered "fixed", i.e. independent from the above
9097
* mentioned parameters.
9198
*/

Diff for: src/utility/STM32Cube_FW/hw.h

+9-19
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,21 @@ extern "C" {
2626
#endif
2727

2828
/* Includes ------------------------------------------------------------------*/
29+
#include "stm32_def.h"
30+
#include "stm32wbxx_ll_bus.h"
31+
#include "stm32wbxx_ll_exti.h"
32+
#include "stm32wbxx_ll_system.h"
33+
#include "stm32wbxx_ll_rcc.h"
34+
#include "stm32wbxx_ll_ipcc.h"
35+
#include "stm32wbxx_ll_cortex.h"
36+
#include "stm32wbxx_ll_utils.h"
37+
#include "stm32wbxx_ll_pwr.h"
2938

3039
/******************************************************************************
3140
* HW IPCC
3241
******************************************************************************/
3342
void HW_IPCC_Enable( void );
3443
void HW_IPCC_Init( void );
35-
void HW_IPCC_Rx_Handler( void );
36-
void HW_IPCC_Tx_Handler( void );
3744

3845
void HW_IPCC_BLE_Init( void );
3946
void HW_IPCC_BLE_SendCmd( void );
@@ -80,23 +87,6 @@ extern "C" {
8087
void HW_IPCC_TRACES_Init( void );
8188
void HW_IPCC_TRACES_EvtNot( void );
8289

83-
void HW_IPCC_MAC_802_15_4_Init( void );
84-
void HW_IPCC_MAC_802_15_4_SendCmd( void );
85-
void HW_IPCC_MAC_802_15_4_SendAck( void );
86-
void HW_IPCC_MAC_802_15_4_CmdEvtNot( void );
87-
void HW_IPCC_MAC_802_15_4_EvtNot( void );
88-
89-
void HW_IPCC_ZIGBEE_Init( void );
90-
91-
void HW_IPCC_ZIGBEE_SendM4RequestToM0(void); /* M4 Request to M0 */
92-
void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void); /* Request ACK from M0 */
93-
94-
void HW_IPCC_ZIGBEE_RecvM0NotifyToM4(void); /* M0 Notify to M4 */
95-
void HW_IPCC_ZIGBEE_SendM4AckToM0Notify(void); /* Notify ACK from M4 */
96-
void HW_IPCC_ZIGBEE_RecvM0RequestToM4(void); /* M0 Request to M4 */
97-
void HW_IPCC_ZIGBEE_SendM4AckToM0Request(void); /* Request ACK from M4 */
98-
99-
10090
#ifdef __cplusplus
10191
}
10292
#endif

Diff for: src/utility/STM32Cube_FW/hw_ipcc.c

+14-170
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
*/
1919
/* USER CODE END Header */
2020

21+
#if defined(STM32WBxx)
2122
/* Includes ------------------------------------------------------------------*/
22-
#include "app_common.h"
23+
#include "hw.h"
2324
#include "mbox_def.h"
2425

2526
/* Global variables ---------------------------------------------------------*/
@@ -56,34 +57,17 @@ static void HW_IPCC_LLD_BLE_ReceiveRspHandler( void );
5657
static void HW_IPCC_LLD_BLE_ReceiveM0CmdHandler( void );
5758
#endif
5859

59-
#ifdef MAC_802_15_4_WB
60-
static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void );
61-
static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void );
62-
#endif
63-
64-
#ifdef ZIGBEE_WB
65-
static void HW_IPCC_ZIGBEE_CmdEvtHandler( void );
66-
static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void );
67-
static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void );
68-
#endif
69-
7060
/* Public function definition -----------------------------------------------*/
7161

7262
/******************************************************************************
7363
* INTERRUPT HANDLER
7464
******************************************************************************/
75-
void HW_IPCC_Rx_Handler( void )
65+
void IPCC_C1_RX_IRQHandler(void)
7666
{
7767
if (HW_IPCC_RX_PENDING( HW_IPCC_SYSTEM_EVENT_CHANNEL ))
7868
{
7969
HW_IPCC_SYS_EvtHandler();
8070
}
81-
#ifdef MAC_802_15_4_WB
82-
else if (HW_IPCC_RX_PENDING( HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ))
83-
{
84-
HW_IPCC_MAC_802_15_4_NotEvtHandler();
85-
}
86-
#endif /* MAC_802_15_4_WB */
8771
#ifdef THREAD_WB
8872
else if (HW_IPCC_RX_PENDING( HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL ))
8973
{
@@ -114,16 +98,6 @@ void HW_IPCC_Rx_Handler( void )
11498
HW_IPCC_LLD_BLE_ReceiveM0CmdHandler();
11599
}
116100
#endif /* LLD_TESTS_WB */
117-
#ifdef ZIGBEE_WB
118-
else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ))
119-
{
120-
HW_IPCC_ZIGBEE_StackNotifEvtHandler();
121-
}
122-
else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ))
123-
{
124-
HW_IPCC_ZIGBEE_StackM0RequestHandler();
125-
}
126-
#endif /* ZIGBEE_WB */
127101
else if (HW_IPCC_RX_PENDING( HW_IPCC_BLE_EVENT_CHANNEL ))
128102
{
129103
HW_IPCC_BLE_EvtHandler();
@@ -132,22 +106,14 @@ void HW_IPCC_Rx_Handler( void )
132106
{
133107
HW_IPCC_TRACES_EvtHandler();
134108
}
135-
136-
return;
137109
}
138110

139-
void HW_IPCC_Tx_Handler( void )
111+
void IPCC_C1_TX_IRQHandler(void)
140112
{
141113
if (HW_IPCC_TX_PENDING( HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ))
142114
{
143115
HW_IPCC_SYS_CmdEvtHandler();
144116
}
145-
#ifdef MAC_802_15_4_WB
146-
else if (HW_IPCC_TX_PENDING( HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ))
147-
{
148-
HW_IPCC_MAC_802_15_4_CmdEvtHandler();
149-
}
150-
#endif /* MAC_802_15_4_WB */
151117
#ifdef THREAD_WB
152118
else if (HW_IPCC_TX_PENDING( HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL ))
153119
{
@@ -157,12 +123,6 @@ void HW_IPCC_Tx_Handler( void )
157123
#ifdef LLD_TESTS_WB
158124
// No TX handler for LLD tests
159125
#endif /* LLD_TESTS_WB */
160-
#ifdef ZIGBEE_WB
161-
if (HW_IPCC_TX_PENDING( HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ))
162-
{
163-
HW_IPCC_ZIGBEE_CmdEvtHandler();
164-
}
165-
#endif /* ZIGBEE_WB */
166126
else if (HW_IPCC_TX_PENDING( HW_IPCC_MM_RELEASE_BUFFER_CHANNEL ))
167127
{
168128
HW_IPCC_MM_FreeBufHandler();
@@ -171,9 +131,8 @@ void HW_IPCC_Tx_Handler( void )
171131
{
172132
HW_IPCC_BLE_AclDataEvtHandler();
173133
}
174-
175-
return;
176134
}
135+
177136
/******************************************************************************
178137
* GENERAL
179138
******************************************************************************/
@@ -264,8 +223,8 @@ static void HW_IPCC_BLE_AclDataEvtHandler( void )
264223
return;
265224
}
266225

267-
__weak void HW_IPCC_BLE_AclDataAckNot( void ){};
268-
__weak void HW_IPCC_BLE_RxEvtNot( void ){};
226+
__WEAK void HW_IPCC_BLE_AclDataAckNot( void ){};
227+
__WEAK void HW_IPCC_BLE_RxEvtNot( void ){};
269228

270229
/******************************************************************************
271230
* SYSTEM
@@ -303,56 +262,8 @@ static void HW_IPCC_SYS_EvtHandler( void )
303262
return;
304263
}
305264

306-
__weak void HW_IPCC_SYS_CmdEvtNot( void ){};
307-
__weak void HW_IPCC_SYS_EvtNot( void ){};
308-
309-
/******************************************************************************
310-
* MAC 802.15.4
311-
******************************************************************************/
312-
#ifdef MAC_802_15_4_WB
313-
void HW_IPCC_MAC_802_15_4_Init( void )
314-
{
315-
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
316-
317-
return;
318-
}
319-
320-
void HW_IPCC_MAC_802_15_4_SendCmd( void )
321-
{
322-
LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );
323-
LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );
324-
325-
return;
326-
}
327-
328-
void HW_IPCC_MAC_802_15_4_SendAck( void )
329-
{
330-
LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
331-
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
332-
333-
return;
334-
}
335-
336-
static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void )
337-
{
338-
LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );
339-
340-
HW_IPCC_MAC_802_15_4_CmdEvtNot();
341-
342-
return;
343-
}
344-
345-
static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void )
346-
{
347-
LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
348-
349-
HW_IPCC_MAC_802_15_4_EvtNot();
350-
351-
return;
352-
}
353-
__weak void HW_IPCC_MAC_802_15_4_CmdEvtNot( void ){};
354-
__weak void HW_IPCC_MAC_802_15_4_EvtNot( void ){};
355-
#endif
265+
__WEAK void HW_IPCC_SYS_CmdEvtNot( void ){};
266+
__WEAK void HW_IPCC_SYS_EvtNot( void ){};
356267

357268
/******************************************************************************
358269
* THREAD
@@ -424,9 +335,9 @@ static void HW_IPCC_THREAD_CliNotEvtHandler( void )
424335
return;
425336
}
426337

427-
__weak void HW_IPCC_OT_CmdEvtNot( void ){};
428-
__weak void HW_IPCC_CLI_CmdEvtNot( void ){};
429-
__weak void HW_IPCC_THREAD_EvtNot( void ){};
338+
__WEAK void HW_IPCC_OT_CmdEvtNot( void ){};
339+
__WEAK void HW_IPCC_CLI_CmdEvtNot( void ){};
340+
__WEAK void HW_IPCC_THREAD_EvtNot( void ){};
430341

431342
#endif /* THREAD_WB */
432343

@@ -548,74 +459,6 @@ void HW_IPCC_LLD_BLE_SendRspAck( void )
548459

549460
#endif /* LLD_BLE_WB */
550461

551-
/******************************************************************************
552-
* ZIGBEE
553-
******************************************************************************/
554-
#ifdef ZIGBEE_WB
555-
void HW_IPCC_ZIGBEE_Init( void )
556-
{
557-
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
558-
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
559-
560-
return;
561-
}
562-
563-
void HW_IPCC_ZIGBEE_SendM4RequestToM0( void )
564-
{
565-
LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );
566-
LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );
567-
568-
return;
569-
}
570-
571-
void HW_IPCC_ZIGBEE_SendM4AckToM0Notify( void )
572-
{
573-
LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
574-
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
575-
576-
return;
577-
}
578-
579-
static void HW_IPCC_ZIGBEE_CmdEvtHandler( void )
580-
{
581-
LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );
582-
583-
HW_IPCC_ZIGBEE_RecvAppliAckFromM0();
584-
585-
return;
586-
}
587-
588-
static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void )
589-
{
590-
LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
591-
592-
HW_IPCC_ZIGBEE_RecvM0NotifyToM4();
593-
594-
return;
595-
}
596-
597-
static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void )
598-
{
599-
LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
600-
601-
HW_IPCC_ZIGBEE_RecvM0RequestToM4();
602-
603-
return;
604-
}
605-
606-
void HW_IPCC_ZIGBEE_SendM4AckToM0Request( void )
607-
{
608-
LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
609-
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
610-
611-
return;
612-
}
613-
614-
__weak void HW_IPCC_ZIGBEE_RecvAppliAckFromM0( void ){};
615-
__weak void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void ){};
616-
__weak void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void ){};
617-
#endif /* ZIGBEE_WB */
618-
619462
/******************************************************************************
620463
* MEMORY MANAGER
621464
******************************************************************************/
@@ -666,4 +509,5 @@ static void HW_IPCC_TRACES_EvtHandler( void )
666509
return;
667510
}
668511

669-
__weak void HW_IPCC_TRACES_EvtNot( void ){};
512+
__WEAK void HW_IPCC_TRACES_EvtNot( void ){};
513+
#endif /* STM32WBxx */

0 commit comments

Comments
 (0)