Skip to content

Commit

Permalink
chore: adapt STM32Cube_FW sources
Browse files Browse the repository at this point in the history
Compare to previous patch, do the minimum changes required
to ease further update.

Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Apr 5, 2023
1 parent a903124 commit d758a66
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 23 deletions.
47 changes: 35 additions & 12 deletions src/utility/STM32Cube_FW/app_conf_default.h
Original file line number Diff line number Diff line change
@@ -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
*
Expand All @@ -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
*/
Expand Down Expand Up @@ -104,7 +124,7 @@
#define CFG_FW_SUBVERSION (1)
#define CFG_FW_BRANCH (0)
#define CFG_FW_BUILD (0)

#endif
/******************************************************************************
* BLE Stack
******************************************************************************/
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -323,6 +345,7 @@

#define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3)

#if 0
/******************************************************************************
* Transport Layer
******************************************************************************/
Expand Down Expand Up @@ -657,5 +680,5 @@ typedef enum
#define CFG_OTP_BASE_ADDRESS OTP_AREA_BASE

#define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR

#endif /*APP_CONF_H */
#endif
#endif /*APP_CONF_DEFAULT_H */
11 changes: 9 additions & 2 deletions src/utility/STM32Cube_FW/ble_bufsize.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,22 @@
((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
* defined in a global context variable "mem_alloc_ctx_p".
* This initialization is made in the Dynamic_allocator functions, which
* This initialization is made in the Dynamic_allocator functions, which
* 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:
* 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 made explicit by the following macro;
* - a part, that may be considered "fixed", i.e. independent from the above
Expand Down
15 changes: 12 additions & 3 deletions src/utility/STM32Cube_FW/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -76,7 +85,7 @@ extern "C" {
void HW_IPCC_BLE_LLD_ReceiveRsp( void );
void HW_IPCC_BLE_LLD_SendRspAck( void );


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

Expand Down
4 changes: 3 additions & 1 deletion src/utility/STM32Cube_FW/hw_ipcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
*/
/* USER CODE END Header */

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

/* Global variables ---------------------------------------------------------*/
Expand Down Expand Up @@ -667,3 +668,4 @@ static void HW_IPCC_TRACES_EvtHandler( void )
}

__weak void HW_IPCC_TRACES_EvtNot( void ){};
#endif /* STM32WBxx */
3 changes: 2 additions & 1 deletion src/utility/STM32Cube_FW/shci.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
******************************************************************************
*/


#if defined(STM32WBxx)
/* Includes ------------------------------------------------------------------*/
#include "stm32_wpan_common.h"

Expand Down Expand Up @@ -739,3 +739,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )

return (SHCI_Success);
}
#endif /* STM32WBxx */
18 changes: 17 additions & 1 deletion src/utility/STM32Cube_FW/shci_tl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -251,3 +266,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag)

return;
}
#endif /* STM32WBxx */
7 changes: 5 additions & 2 deletions src/utility/STM32Cube_FW/stm_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -204,3 +206,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node)

__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
}
#endif /* STM32WBxx */
8 changes: 7 additions & 1 deletion src/utility/STM32Cube_FW/tl_mbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
******************************************************************************
*/

#if defined(STM32WBxx)
/* Includes ------------------------------------------------------------------*/
#include "stm32_wpan_common.h"
#include "hw.h"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -97,8 +99,11 @@ 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;
Expand Down Expand Up @@ -846,3 +851,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)

return;
}
#endif /* STM32WBxx */

0 comments on commit d758a66

Please sign in to comment.