Skip to content

Commit 6eb25bc

Browse files
committed
chore: clean up and adapt STM32Cube_FW sources for STM32duino
Signed-off-by: Frederic Pillon <[email protected]> Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent ab9e2f9 commit 6eb25bc

13 files changed

+94
-924
lines changed

src/utility/STM32Cube_FW/app_conf_default.h

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

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
*/

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

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
******************************************************************************/
@@ -263,8 +222,8 @@ static void HW_IPCC_BLE_AclDataEvtHandler( void )
263222
return;
264223
}
265224

266-
__weak void HW_IPCC_BLE_AclDataAckNot( void ){};
267-
__weak void HW_IPCC_BLE_RxEvtNot( void ){};
225+
__WEAK void HW_IPCC_BLE_AclDataAckNot( void ){};
226+
__WEAK void HW_IPCC_BLE_RxEvtNot( void ){};
268227

269228
/******************************************************************************
270229
* SYSTEM
@@ -302,56 +261,8 @@ static void HW_IPCC_SYS_EvtHandler( void )
302261
return;
303262
}
304263

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

356267
/******************************************************************************
357268
* THREAD
@@ -423,9 +334,9 @@ static void HW_IPCC_THREAD_CliNotEvtHandler( void )
423334
return;
424335
}
425336

426-
__weak void HW_IPCC_OT_CmdEvtNot( void ){};
427-
__weak void HW_IPCC_CLI_CmdEvtNot( void ){};
428-
__weak void HW_IPCC_THREAD_EvtNot( void ){};
337+
__WEAK void HW_IPCC_OT_CmdEvtNot( void ){};
338+
__WEAK void HW_IPCC_CLI_CmdEvtNot( void ){};
339+
__WEAK void HW_IPCC_THREAD_EvtNot( void ){};
429340

430341
#endif /* THREAD_WB */
431342

@@ -547,74 +458,6 @@ void HW_IPCC_LLD_BLE_SendRspAck( void )
547458

548459
#endif /* LLD_BLE_WB */
549460

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

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

0 commit comments

Comments
 (0)