Skip to content

Commit 542e007

Browse files
committed
chore: adapt STM32Cube_FW sources
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 61b8a3b commit 542e007

File tree

8 files changed

+86
-20
lines changed

8 files changed

+86
-20
lines changed

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

+35-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* USER CODE BEGIN Header */
22
/**
33
******************************************************************************
4-
* @file app_conf.h
4+
* @file app_conf_default.h
55
* @author MCD Application Team
6-
* @brief Application configuration file for STM32WPAN Middleware.
6+
* @brief Default application configuration file for STM32WPAN Middleware.
77
******************************************************************************
88
* @attention
99
*
@@ -19,18 +19,38 @@
1919
/* USER CODE END Header */
2020

2121
/* Define to prevent recursive inclusion -------------------------------------*/
22-
#ifndef APP_CONF_H
23-
#define APP_CONF_H
24-
22+
#ifndef APP_CONF_DEFAULT_H
23+
#define APP_CONF_DEFAULT_H
24+
#if 0
2525
#include "hw.h"
2626
#include "hw_conf.h"
2727
#include "hw_if.h"
2828
#include "ble_bufsize.h"
29-
29+
#endif
3030
/******************************************************************************
3131
* Application Config
3232
******************************************************************************/
3333

34+
/**< generic parameters ******************************************************/
35+
/* HCI related defines */
36+
37+
#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F
38+
#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C
39+
#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D
40+
#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251)
41+
#define HCI_RESET 0x0C03
42+
43+
#ifndef BLE_SHARED_MEM_BYTE_ORDER
44+
#define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST
45+
#endif
46+
#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128
47+
48+
/**
49+
* Define Tx Power
50+
*/
51+
#define CFG_TX_POWER (0x18) /* -0.15dBm */
52+
53+
#if 0
3454
/**
3555
* Define Secure Connections Support
3656
*/
@@ -104,7 +124,7 @@
104124
#define CFG_FW_SUBVERSION (1)
105125
#define CFG_FW_BRANCH (0)
106126
#define CFG_FW_BUILD (0)
107-
127+
#endif
108128
/******************************************************************************
109129
* BLE Stack
110130
******************************************************************************/
@@ -152,13 +172,15 @@
152172
* Prepare Write List size in terms of number of packet
153173
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
154174
*/
155-
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
175+
// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
176+
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
156177

157178
/**
158179
* Number of allocated memory blocks
159180
* 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
160181
*/
161-
#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK))
182+
//#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK))
183+
#define CFG_BLE_MBLOCK_COUNT (0x79)
162184

163185
/**
164186
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
@@ -250,7 +272,7 @@
250272
* 0: LE Power Class 2-3
251273
* other bits: complete with Options_extension flag
252274
*/
253-
#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)
275+
#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY)
254276

255277
/**
256278
* BLE stack Options_extension flags to be configured with:
@@ -323,6 +345,7 @@
323345

324346
#define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3)
325347

348+
#if 0
326349
/******************************************************************************
327350
* Transport Layer
328351
******************************************************************************/
@@ -658,4 +681,5 @@ typedef enum
658681

659682
#define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR
660683

661-
#endif /*APP_CONF_H */
684+
#endif
685+
#endif /*APP_CONF_DEFAULT_H */

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

+7
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@
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:
8087
* A part of the RAM, is dynamically allocated by initializing all the pointers

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

+11-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,23 @@ 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 );
44+
#define HW_IPCC_Rx_Handler IPCC_C1_RX_IRQHandler
45+
#define HW_IPCC_Tx_Handler IPCC_C1_TX_IRQHandler
3746

3847
void HW_IPCC_BLE_Init( void );
3948
void HW_IPCC_BLE_SendCmd( void );

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
******************************************************************************
1818
*/
1919
/* USER CODE END Header */
20-
20+
#if defined(STM32WBxx)
2121
/* Includes ------------------------------------------------------------------*/
22-
#include "app_common.h"
22+
#include "hw.h"
2323
#include "mbox_def.h"
2424

2525
/* Global variables ---------------------------------------------------------*/
@@ -667,3 +667,4 @@ static void HW_IPCC_TRACES_EvtHandler( void )
667667
}
668668

669669
__weak void HW_IPCC_TRACES_EvtNot( void ){};
670+
#endif /* STM32WBxx */

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
******************************************************************************
1717
*/
1818

19-
19+
#if defined(STM32WBxx)
2020
/* Includes ------------------------------------------------------------------*/
2121
#include "stm32_wpan_common.h"
2222

@@ -739,3 +739,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )
739739

740740
return (SHCI_Success);
741741
}
742+
#endif /* STM32WBxx */

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

+17-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
******************************************************************************
1717
*/
1818

19-
19+
#if defined(STM32WBxx)
2020
/* Includes ------------------------------------------------------------------*/
2121
#include "stm32_wpan_common.h"
2222

2323
#include "stm_list.h"
2424
#include "shci_tl.h"
25+
#include "stm32_def.h"
2526

2627
/* Private typedef -----------------------------------------------------------*/
2728
typedef enum
@@ -168,6 +169,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl
168169
return;
169170
}
170171

172+
void shci_notify_asynch_evt(void *pdata)
173+
{
174+
UNUSED(pdata);
175+
/* Need to parse data in future version */
176+
shci_user_evt_proc();
177+
}
178+
179+
void shci_register_io_bus(tSHciIO *fops)
180+
{
181+
/* Register IO bus services */
182+
fops->Init = TL_SYS_Init;
183+
fops->Send = TL_SYS_SendCmd;
184+
}
185+
171186
/* Private functions ---------------------------------------------------------*/
172187
static void TlInit( TL_CmdPacket_t * p_cmdbuffer )
173188
{
@@ -250,3 +265,4 @@ __WEAK void shci_cmd_resp_release(uint32_t flag)
250265

251266
return;
252267
}
268+
#endif /* STM32WBxx */

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
******************************************************************************
1717
*/
1818

19-
19+
#if defined(STM32WBxx)
2020
/******************************************************************************
2121
* Include Files
2222
******************************************************************************/
23-
#include "utilities_common.h"
23+
#include "stdint.h"
24+
#include "cmsis_gcc.h"
25+
#include "stm32_wpan_common.h"
2426

2527
#include "stm_list.h"
2628

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

205207
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
206208
}
209+
#endif /* STM32WBxx */

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
******************************************************************************
1717
*/
1818

19+
#if defined(STM32WBxx)
1920
/* Includes ------------------------------------------------------------------*/
2021
#include "stm32_wpan_common.h"
2122
#include "hw.h"
@@ -51,9 +52,10 @@ PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_BleLldTable_t TL_BleLldTable;
5152
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_SysTable_t TL_SysTable;
5253
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_MemManagerTable_t TL_MemManagerTable;
5354
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_TracesTable_t TL_TracesTable;
55+
#if 0
5456
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_Mac_802_15_4_t TL_Mac_802_15_4_Table;
5557
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static MB_ZigbeeTable_t TL_Zigbee_Table;
56-
58+
#endif
5759
/**< tables */
5860
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue;
5961
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode TracesEvtQueue;
@@ -97,8 +99,10 @@ void TL_Init( void )
9799
TL_RefTable.p_sys_table = &TL_SysTable;
98100
TL_RefTable.p_mem_manager_table = &TL_MemManagerTable;
99101
TL_RefTable.p_traces_table = &TL_TracesTable;
102+
#if 0
100103
TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table;
101104
TL_RefTable.p_zigbee_table = &TL_Zigbee_Table;
105+
#endif
102106
HW_IPCC_Init();
103107

104108
return;
@@ -846,3 +850,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)
846850

847851
return;
848852
}
853+
#endif /* STM32WBxx */

0 commit comments

Comments
 (0)