Skip to content

Commit

Permalink
chore: clean up and adapt STM32Cube_FW sources for STM32duino
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
  • Loading branch information
fpistm committed Dec 2, 2021
1 parent 370b06d commit ac3469e
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 894 deletions.
390 changes: 19 additions & 371 deletions src/utility/STM32Cube_FW/app_conf.h

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/utility/STM32Cube_FW/ble_bufsize.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@

/*
* BLE_FIXED_BUFFER_SIZE_BYTES:
* A part of the RAM, is dinamically allocated by initilizing all the pointers
* A part of the RAM, is dynamically allocated by initializing all the pointers
* defined in a global context variable "mem_alloc_ctx_p".
* This initialization is made in the Dynamic_allocator functions, which
* assing a portion of RAM given by the external application to the above
* assign a portion of RAM given by the external application to the above
* mentioned "global pointers".
*
* The size of this Dynamic RAM is made of 2 main components:
* - a part that is parameters-dependent (num of links, GATT buffers, ...),
* and which value is explicited by the following macro;
* and which value is defined by the following macro;
* - a part, that may be considered "fixed", i.e. independent from the above
* mentioned parameters.
*/
Expand Down
28 changes: 9 additions & 19 deletions src/utility/STM32Cube_FW/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,21 @@ 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 );

void HW_IPCC_BLE_Init( void );
void HW_IPCC_BLE_SendCmd( void );
Expand Down Expand Up @@ -80,23 +87,6 @@ extern "C" {

void HW_IPCC_TRACES_Init( void );
void HW_IPCC_TRACES_EvtNot( void );

void HW_IPCC_MAC_802_15_4_Init( void );
void HW_IPCC_MAC_802_15_4_SendCmd( void );
void HW_IPCC_MAC_802_15_4_SendAck( void );
void HW_IPCC_MAC_802_15_4_CmdEvtNot( void );
void HW_IPCC_MAC_802_15_4_EvtNot( void );

void HW_IPCC_ZIGBEE_Init( void );

void HW_IPCC_ZIGBEE_SendM4RequestToM0(void); /* M4 Request to M0 */
void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void); /* Request ACK from M0 */

void HW_IPCC_ZIGBEE_RecvM0NotifyToM4(void); /* M0 Notify to M4 */
void HW_IPCC_ZIGBEE_SendM4AckToM0Notify(void); /* Notify ACK from M4 */
void HW_IPCC_ZIGBEE_RecvM0RequestToM4(void); /* M0 Request to M4 */
void HW_IPCC_ZIGBEE_SendM4AckToM0Request(void); /* Request ACK from M4 */


#ifdef __cplusplus
}
Expand Down
187 changes: 14 additions & 173 deletions src/utility/STM32Cube_FW/hw_ipcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*
******************************************************************************
*/

#if defined(STM32WBxx)
/* Includes ------------------------------------------------------------------*/
#include "app_common.h"
#include "hw.h"
#include "mbox_def.h"

/* Global variables ---------------------------------------------------------*/
Expand All @@ -45,35 +45,17 @@ static void HW_IPCC_THREAD_NotEvtHandler( void );
static void HW_IPCC_THREAD_CliNotEvtHandler( void );
#endif

#ifdef MAC_802_15_4_WB
static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void );
static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void );
#endif

#ifdef ZIGBEE_WB
static void HW_IPCC_ZIGBEE_CmdEvtHandler( void );
static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void );
static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void );

#endif

/* Public function definition -----------------------------------------------*/

/******************************************************************************
* INTERRUPT HANDLER
******************************************************************************/
void HW_IPCC_Rx_Handler( void )
void IPCC_C1_RX_IRQHandler(void)
{
if (HW_IPCC_RX_PENDING( HW_IPCC_SYSTEM_EVENT_CHANNEL ))
{
HW_IPCC_SYS_EvtHandler();
}
#ifdef MAC_802_15_4_WB
else if (HW_IPCC_RX_PENDING( HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL ))
{
HW_IPCC_MAC_802_15_4_NotEvtHandler();
}
#endif /* MAC_802_15_4_WB */
#ifdef THREAD_WB
else if (HW_IPCC_RX_PENDING( HW_IPCC_THREAD_NOTIFICATION_ACK_CHANNEL ))
{
Expand All @@ -84,16 +66,6 @@ void HW_IPCC_Rx_Handler( void )
HW_IPCC_THREAD_CliNotEvtHandler();
}
#endif /* THREAD_WB */
#ifdef ZIGBEE_WB
else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL ))
{
HW_IPCC_ZIGBEE_StackNotifEvtHandler();
}
else if (HW_IPCC_RX_PENDING( HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL ))
{
HW_IPCC_ZIGBEE_StackM0RequestHandler();
}
#endif /* ZIGBEE_WB */
else if (HW_IPCC_RX_PENDING( HW_IPCC_BLE_EVENT_CHANNEL ))
{
HW_IPCC_BLE_EvtHandler();
Expand All @@ -102,34 +74,20 @@ void HW_IPCC_Rx_Handler( void )
{
HW_IPCC_TRACES_EvtHandler();
}

return;
}

void HW_IPCC_Tx_Handler( void )
void IPCC_C1_TX_IRQHandler(void)
{
if (HW_IPCC_TX_PENDING( HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ))
{
HW_IPCC_SYS_CmdEvtHandler();
}
#ifdef MAC_802_15_4_WB
else if (HW_IPCC_TX_PENDING( HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL ))
{
HW_IPCC_MAC_802_15_4_CmdEvtHandler();
}
#endif /* MAC_802_15_4_WB */
#ifdef THREAD_WB
else if (HW_IPCC_TX_PENDING( HW_IPCC_THREAD_OT_CMD_RSP_CHANNEL ))
{
HW_IPCC_OT_CmdEvtHandler();
}
#endif /* THREAD_WB */
#ifdef ZIGBEE_WB
if (HW_IPCC_TX_PENDING( HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL ))
{
HW_IPCC_ZIGBEE_CmdEvtHandler();
}
#endif /* ZIGBEE_WB */
else if (HW_IPCC_TX_PENDING( HW_IPCC_SYSTEM_CMD_RSP_CHANNEL ))
{
HW_IPCC_SYS_CmdEvtHandler();
Expand All @@ -142,9 +100,8 @@ void HW_IPCC_Tx_Handler( void )
{
HW_IPCC_BLE_AclDataEvtHandler();
}

return;
}

/******************************************************************************
* GENERAL
******************************************************************************/
Expand Down Expand Up @@ -228,8 +185,8 @@ static void HW_IPCC_BLE_AclDataEvtHandler( void )
return;
}

__weak void HW_IPCC_BLE_AclDataAckNot( void ){};
__weak void HW_IPCC_BLE_RxEvtNot( void ){};
__WEAK void HW_IPCC_BLE_AclDataAckNot( void ){};
__WEAK void HW_IPCC_BLE_RxEvtNot( void ){};

/******************************************************************************
* SYSTEM
Expand Down Expand Up @@ -267,56 +224,8 @@ static void HW_IPCC_SYS_EvtHandler( void )
return;
}

__weak void HW_IPCC_SYS_CmdEvtNot( void ){};
__weak void HW_IPCC_SYS_EvtNot( void ){};

/******************************************************************************
* MAC 802.15.4
******************************************************************************/
#ifdef MAC_802_15_4_WB
void HW_IPCC_MAC_802_15_4_Init( void )
{
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );

return;
}

void HW_IPCC_MAC_802_15_4_SendCmd( void )
{
LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );
LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );

return;
}

void HW_IPCC_MAC_802_15_4_SendAck( void )
{
LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );

return;
}

static void HW_IPCC_MAC_802_15_4_CmdEvtHandler( void )
{
LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_MAC_802_15_4_CMD_RSP_CHANNEL );

HW_IPCC_MAC_802_15_4_CmdEvtNot();

return;
}

static void HW_IPCC_MAC_802_15_4_NotEvtHandler( void )
{
LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_MAC_802_15_4_NOTIFICATION_ACK_CHANNEL );

HW_IPCC_MAC_802_15_4_EvtNot();

return;
}
__weak void HW_IPCC_MAC_802_15_4_CmdEvtNot( void ){};
__weak void HW_IPCC_MAC_802_15_4_EvtNot( void ){};
#endif
__WEAK void HW_IPCC_SYS_CmdEvtNot( void ){};
__WEAK void HW_IPCC_SYS_EvtNot( void ){};

/******************************************************************************
* THREAD
Expand Down Expand Up @@ -388,80 +297,12 @@ static void HW_IPCC_THREAD_CliNotEvtHandler( void )
return;
}

__weak void HW_IPCC_OT_CmdEvtNot( void ){};
__weak void HW_IPCC_CLI_CmdEvtNot( void ){};
__weak void HW_IPCC_THREAD_EvtNot( void ){};
__WEAK void HW_IPCC_OT_CmdEvtNot( void ){};
__WEAK void HW_IPCC_CLI_CmdEvtNot( void ){};
__WEAK void HW_IPCC_THREAD_EvtNot( void ){};

#endif /* THREAD_WB */

/******************************************************************************
* ZIGBEE
******************************************************************************/
#ifdef ZIGBEE_WB
void HW_IPCC_ZIGBEE_Init( void )
{
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );

return;
}

void HW_IPCC_ZIGBEE_SendM4RequestToM0( void )
{
LL_C1_IPCC_SetFlag_CHx( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );
LL_C1_IPCC_EnableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );

return;
}

void HW_IPCC_ZIGBEE_SendM4AckToM0Notify( void )
{
LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );

return;
}

static void HW_IPCC_ZIGBEE_CmdEvtHandler( void )
{
LL_C1_IPCC_DisableTransmitChannel( IPCC, HW_IPCC_ZIGBEE_CMD_APPLI_CHANNEL );

HW_IPCC_ZIGBEE_RecvAppliAckFromM0();

return;
}

static void HW_IPCC_ZIGBEE_StackNotifEvtHandler( void )
{
LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_APPLI_NOTIF_ACK_CHANNEL );

HW_IPCC_ZIGBEE_RecvM0NotifyToM4();

return;
}

static void HW_IPCC_ZIGBEE_StackM0RequestHandler( void )
{
LL_C1_IPCC_DisableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );

HW_IPCC_ZIGBEE_RecvM0RequestToM4();

return;
}

void HW_IPCC_ZIGBEE_SendM4AckToM0Request( void )
{
LL_C1_IPCC_ClearFlag_CHx( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );
LL_C1_IPCC_EnableReceiveChannel( IPCC, HW_IPCC_ZIGBEE_M0_REQUEST_CHANNEL );

return;
}

__weak void HW_IPCC_ZIGBEE_RecvAppliAckFromM0( void ){};
__weak void HW_IPCC_ZIGBEE_RecvM0NotifyToM4( void ){};
__weak void HW_IPCC_ZIGBEE_RecvM0RequestToM4( void ){};
#endif /* ZIGBEE_WB */

/******************************************************************************
* MEMORY MANAGER
******************************************************************************/
Expand Down Expand Up @@ -512,6 +353,6 @@ static void HW_IPCC_TRACES_EvtHandler( void )
return;
}

__weak void HW_IPCC_TRACES_EvtNot( void ){};

__WEAK void HW_IPCC_TRACES_EvtNot( void ){};
#endif /* STM32WBxx */
/******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/
Loading

0 comments on commit ac3469e

Please sign in to comment.