Skip to content

Commit 20b8a4c

Browse files
committed
chore: adapt STM32_WPAN sources
Signed-off-by: Frederic Pillon <[email protected]>
1 parent f7ca0a2 commit 20b8a4c

File tree

7 files changed

+85
-12
lines changed

7 files changed

+85
-12
lines changed

src/utility/STM32_WPAN/app_conf_default.h

+41-8
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,40 @@
1919
/* USER CODE END Header */
2020

2121
/* Define to prevent recursive inclusion -------------------------------------*/
22-
#ifndef APP_CONF_H
23-
#define APP_CONF_H
22+
#ifndef APP_CONF_DEFAULT_H
23+
#define APP_CONF_DEFAULT_H
2424

25+
#if 0
2526
#include "hw.h"
2627
#include "hw_conf.h"
2728
#include "hw_if.h"
2829
#include "ble_bufsize.h"
30+
#endif
2931

3032
/******************************************************************************
3133
* Application Config
3234
******************************************************************************/
3335

36+
/**< generic parameters ******************************************************/
37+
/* HCI related defines */
38+
39+
#define ACI_HAL_SET_TX_POWER_LEVEL 0xFC0F
40+
#define ACI_WRITE_CONFIG_DATA_OPCODE 0xFC0C
41+
#define ACI_READ_CONFIG_DATA_OPCODE 0xFC0D
42+
#define MAX_HCI_ACL_PACKET_SIZE (sizeof(TL_PacketHeader_t) + 5 + 251)
43+
#define HCI_RESET 0x0C03
44+
45+
#ifndef BLE_SHARED_MEM_BYTE_ORDER
46+
#define BLE_SHARED_MEM_BYTE_ORDER MSBFIRST
47+
#endif
48+
#define BLE_MODULE_SHARED_MEM_BUFFER_SIZE 128
49+
50+
/**
51+
* Define Tx Power
52+
*/
53+
#define CFG_TX_POWER (0x18) /* -0.15dBm */
54+
55+
#if 0
3456
/**
3557
* Define Secure Connections Support
3658
*/
@@ -104,6 +126,7 @@
104126
#define CFG_FW_SUBVERSION (1)
105127
#define CFG_FW_BRANCH (0)
106128
#define CFG_FW_BUILD (0)
129+
#endif
107130

108131
/******************************************************************************
109132
* BLE Stack
@@ -250,7 +273,7 @@
250273
* 0: LE Power Class 2-3
251274
* other bits: complete with Options_extension flag
252275
*/
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)
276+
#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY | 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)
254277

255278
/**
256279
* BLE stack Options_extension flags to be configured with:
@@ -292,7 +315,11 @@
292315
* This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set
293316
*/
294317

295-
#define CFG_BLE_MAX_ADV_SET_NBR (8)
318+
#if defined(STM32WB15xx)
319+
#define CFG_BLE_MAX_ADV_SET_NBR (3)
320+
#else
321+
#define CFG_BLE_MAX_ADV_SET_NBR (8)
322+
#endif
296323

297324
/* Maximum advertising data length (in bytes)
298325
* Range: 31 .. 1650 with limitation:
@@ -301,7 +328,11 @@
301328
* This parameter is considered by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV flag set
302329
*/
303330

304-
#define CFG_BLE_MAX_ADV_DATA_LEN (207)
331+
#if defined(STM32WB15xx)
332+
#define CFG_BLE_MAX_ADV_DATA_LEN (414)
333+
#else
334+
#define CFG_BLE_MAX_ADV_DATA_LEN (207)
335+
#endif
305336

306337
/* RF TX Path Compensation Value (16-bit signed integer). Units: 0.1 dB.
307338
* Range: -1280 .. 1280
@@ -324,6 +355,7 @@
324355

325356
#define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_4)
326357

358+
#if 0
327359
/******************************************************************************
328360
* Transport Layer
329361
******************************************************************************/
@@ -660,4 +692,5 @@ typedef enum
660692

661693
#define CFG_OTP_END_ADRESS OTP_AREA_END_ADDR
662694

663-
#endif /*APP_CONF_H */
695+
#endif
696+
#endif /*APP_CONF_DEFAULT_H */

src/utility/STM32_WPAN/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 );

src/utility/STM32_WPAN/hw_ipcc.c

+3-1
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
#include "utilities_conf.h"
2526

@@ -745,3 +746,4 @@ static void HW_IPCC_TRACES_EvtHandler( void )
745746
}
746747

747748
__weak void HW_IPCC_TRACES_EvtNot( void ){};
749+
#endif /* STM32WBxx */

src/utility/STM32_WPAN/shci.c

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919

20+
#if defined(STM32WBxx)
2021
/* Includes ------------------------------------------------------------------*/
2122
#include "stm32_wpan_common.h"
2223

@@ -759,3 +760,4 @@ SHCI_CmdStatus_t SHCI_GetWirelessFwInfo( WirelessFwInfo_t* pWirelessInfo )
759760

760761
return (SHCI_Success);
761762
}
763+
#endif /* STM32WBxx */

src/utility/STM32_WPAN/shci_tl.c

+17
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
*/
1818

1919

20+
#if defined(STM32WBxx)
2021
/* Includes ------------------------------------------------------------------*/
2122
#include "stm32_wpan_common.h"
2223

2324
#include "stm_list.h"
2425
#include "shci_tl.h"
26+
#include "stm32_def.h"
2527

2628
/* Private typedef -----------------------------------------------------------*/
2729
typedef enum
@@ -168,6 +170,20 @@ void shci_send( uint16_t cmd_code, uint8_t len_cmd_payload, uint8_t * p_cmd_payl
168170
return;
169171
}
170172

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

251267
return;
252268
}
269+
#endif /* STM32WBxx */

src/utility/STM32_WPAN/stm_list.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
*/
1818

1919

20+
#if defined(STM32WBxx)
2021
/******************************************************************************
2122
* Include Files
2223
******************************************************************************/
23-
#include "utilities_common.h"
24+
#include "stdint.h"
25+
#include "cmsis_gcc.h"
26+
#include "stm32_wpan_common.h"
2427

2528
#include "stm_list.h"
2629

@@ -204,3 +207,4 @@ void LST_get_prev_node (tListNode * ref_node, tListNode ** node)
204207

205208
__set_PRIMASK(primask_bit); /**< Restore PRIMASK bit*/
206209
}
210+
#endif /* STM32WBxx */

src/utility/STM32_WPAN/tl_mbox.c

+6
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,8 +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;
58+
#endif
5659

5760
/**< tables */
5861
PLACE_IN_SECTION("MB_MEM1") ALIGN(4) static tListNode FreeBufQueue;
@@ -97,8 +100,10 @@ void TL_Init( void )
97100
TL_RefTable.p_sys_table = &TL_SysTable;
98101
TL_RefTable.p_mem_manager_table = &TL_MemManagerTable;
99102
TL_RefTable.p_traces_table = &TL_TracesTable;
103+
#if 0
100104
TL_RefTable.p_mac_802_15_4_table = &TL_Mac_802_15_4_Table;
101105
TL_RefTable.p_zigbee_table = &TL_Zigbee_Table;
106+
#endif
102107
HW_IPCC_Init();
103108

104109
return;
@@ -847,3 +852,4 @@ static void OutputDbgTrace(TL_MB_PacketType_t packet_type, uint8_t* buffer)
847852

848853
return;
849854
}
855+
#endif /* STM32WBxx */

0 commit comments

Comments
 (0)