Skip to content

Commit 370b06d

Browse files
committed
chore: include STM32Cube_FW to support the BLE of the stm32wb55
Orignal file from the v1.8.0: https://github.com/STMicroelectronics/STM32CubeWB/releases/tag/v1.8.0 Signed-off-by: Frederic Pillon <[email protected]>
1 parent ce7cb45 commit 370b06d

14 files changed

+5085
-0
lines changed

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

+510
Large diffs are not rendered by default.

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

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
/*****************************************************************************
2+
* @file ble_bufsize.h
3+
* @author MCD Application Team
4+
* @brief Definition of BLE stack buffers size
5+
*****************************************************************************
6+
* @attention
7+
*
8+
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
9+
* All rights reserved.</center></h2>
10+
*
11+
* This software component is licensed by ST under Ultimate Liberty license
12+
* SLA0044, the "License"; You may not use this file except in compliance with
13+
* the License. You may obtain a copy of the License at:
14+
* www.st.com/SLA0044
15+
*
16+
*****************************************************************************
17+
*/
18+
19+
#ifndef BLE_BUFSIZE_H__
20+
#define BLE_BUFSIZE_H__
21+
22+
23+
/*
24+
* BLE_DEFAULT_ATT_MTU: minimum MTU value that GATT must support.
25+
*/
26+
#define BLE_DEFAULT_ATT_MTU 23
27+
28+
/*
29+
* BLE_DEFAULT_MAX_ATT_MTU: maximum supported ATT MTU size.
30+
*/
31+
#define BLE_DEFAULT_MAX_ATT_MTU 158
32+
33+
/*
34+
* BLE_DEFAULT_MAX_ATT_SIZE: maximum attribute size.
35+
*/
36+
#define BLE_DEFAULT_MAX_ATT_SIZE 512
37+
38+
/*
39+
* BLE_PREP_WRITE_X_ATT: compute how many Prepare Write Request are needed to
40+
* write a characteristic with size 'max_att' when the used ATT_MTU value is
41+
* equal to BLE_DEFAULT_ATT_MTU (23).
42+
*/
43+
#define BLE_PREP_WRITE_X_ATT(max_att) \
44+
(DIVC(max_att, BLE_DEFAULT_ATT_MTU - 5) * 2)
45+
46+
/*
47+
* BLE_DEFAULT_PREP_WRITE_LIST_SIZE: default minimum Prepare Write List size.
48+
*/
49+
#define BLE_DEFAULT_PREP_WRITE_LIST_SIZE \
50+
BLE_PREP_WRITE_X_ATT(BLE_DEFAULT_MAX_ATT_SIZE)
51+
52+
/*
53+
* BLE_MEM_BLOCK_X_MTU: compute how many memory blocks are needed to compose
54+
* an ATT packet with ATT_MTU=mtu.
55+
*/
56+
#define BLE_MEM_BLOCK_SIZE 32
57+
58+
#define BLE_MEM_BLOCK_X_TX(mtu) \
59+
(DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 1U)
60+
61+
#define BLE_MEM_BLOCK_X_RX(mtu, n_link) \
62+
((DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 2U) * (n_link) + 1)
63+
64+
#define BLE_MEM_BLOCK_X_MTU(mtu, n_link) \
65+
(BLE_MEM_BLOCK_X_TX(mtu) + BLE_MEM_BLOCK_X_RX(mtu, n_link))
66+
67+
/*
68+
* BLE_MBLOCKS_SECURE_CONNECTIONS: minimum number of blocks required for
69+
* secure connections
70+
*/
71+
#define BLE_MBLOCKS_SECURE_CONNECTIONS 4
72+
73+
/*
74+
* BLE_MBLOCKS_CALC: minimum number of buffers needed by the stack.
75+
* This is the minimum racomanded value and depends on:
76+
* - pw: size of Prepare Write List
77+
* - mtu: ATT_MTU size
78+
* - n_link: maximum number of simultaneous connections
79+
*/
80+
#define BLE_MBLOCKS_CALC(pw, mtu, n_link) \
81+
((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \
82+
BLE_MBLOCKS_SECURE_CONNECTIONS))
83+
84+
/*
85+
* BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count
86+
*/
87+
#define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \
88+
BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \
89+
BLE_DEFAULT_MAX_ATT_MTU, n_link)
90+
91+
/*
92+
* BLE_FIXED_BUFFER_SIZE_BYTES:
93+
* A part of the RAM, is dinamically allocated by initilizing all the pointers
94+
* defined in a global context variable "mem_alloc_ctx_p".
95+
* This initialization is made in the Dynamic_allocator functions, which
96+
* assing a portion of RAM given by the external application to the above
97+
* mentioned "global pointers".
98+
*
99+
* The size of this Dynamic RAM is made of 2 main components:
100+
* - a part that is parameters-dependent (num of links, GATT buffers, ...),
101+
* and which value is explicited by the following macro;
102+
* - a part, that may be considered "fixed", i.e. independent from the above
103+
* mentioned parameters.
104+
*/
105+
#if (SLAVE_ONLY == 0) && (LL_ONLY == 0)
106+
#define BLE_FIXED_BUFFER_SIZE_BYTES 6960 /* Full stack */
107+
#elif SLAVE_ONLY == 0
108+
#define BLE_FIXED_BUFFER_SIZE_BYTES 6256 /* LL only */
109+
#else
110+
#define BLE_FIXED_BUFFER_SIZE_BYTES 6696 /* Slave only */
111+
#endif
112+
113+
/*
114+
* BLE_PER_LINK_SIZE_BYTES: additional memory size used per link
115+
*/
116+
#if (SLAVE_ONLY == 0) && (LL_ONLY == 0)
117+
#define BLE_PER_LINK_SIZE_BYTES 380 /* Full stack */
118+
#elif SLAVE_ONLY == 0
119+
#define BLE_PER_LINK_SIZE_BYTES 196 /* LL only */
120+
#else
121+
#define BLE_PER_LINK_SIZE_BYTES 332 /* Slave only */
122+
#endif
123+
124+
/*
125+
* BLE_TOTAL_BUFFER_SIZE: this macro returns the amount of memory, in bytes,
126+
* needed for the storage of data structures (except GATT database elements)
127+
* whose size depends on the number of supported connections.
128+
*
129+
* @param num_links: Maximum number of simultaneous connections that the device
130+
* will support. Valid values are from 1 to 8.
131+
*
132+
* @param mblocks_count: Number of memory blocks allocated for packets.
133+
*/
134+
#define BLE_TOTAL_BUFFER_SIZE(n_link, mblocks_count) \
135+
(BLE_FIXED_BUFFER_SIZE_BYTES + \
136+
(BLE_PER_LINK_SIZE_BYTES * (n_link)) + \
137+
((BLE_MEM_BLOCK_SIZE + 12) * (mblocks_count)))
138+
139+
/*
140+
* BLE_TOTAL_BUFFER_SIZE_GATT: this macro returns the amount of memory,
141+
* in bytes, needed for the storage of GATT database elements.
142+
*
143+
* @param num_gatt_attributes: Maximum number of Attributes (i.e. the number
144+
* of characteristic + the number of characteristic values + the number of
145+
* descriptors, excluding the services) that can be stored in the GATT
146+
* database. Note that certain characteristics and relative descriptors are
147+
* added automatically during device initialization so this parameters should
148+
* be 9 plus the number of user Attributes
149+
*
150+
* @param num_gatt_services: Maximum number of Services that can be stored in
151+
* the GATT database. Note that the GAP and GATT services are automatically
152+
* added so this parameter should be 2 plus the number of user services
153+
*
154+
* @param att_value_array_size: Size of the storage area for Attribute values.
155+
*/
156+
#define BLE_TOTAL_BUFFER_SIZE_GATT(num_gatt_attributes, num_gatt_services, att_value_array_size) \
157+
(((((att_value_array_size) - 1) | 3) + 1) + \
158+
(40 * (num_gatt_attributes)) + (48 * (num_gatt_services)))
159+
160+
161+
#endif /* ! BLE_BUFSIZE_H__ */

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

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
******************************************************************************
3+
* @file hw.h
4+
* @author MCD Application Team
5+
* @brief Hardware
6+
******************************************************************************
7+
* @attention
8+
*
9+
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10+
* All rights reserved.</center></h2>
11+
*
12+
* This software component is licensed by ST under BSD 3-Clause license,
13+
* the "License"; You may not use this file except in compliance with the
14+
* License. You may obtain a copy of the License at:
15+
* opensource.org/licenses/BSD-3-Clause
16+
*
17+
******************************************************************************
18+
*/
19+
20+
21+
/* Define to prevent recursive inclusion -------------------------------------*/
22+
#ifndef __HW_H
23+
#define __HW_H
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/* Includes ------------------------------------------------------------------*/
30+
31+
/******************************************************************************
32+
* HW IPCC
33+
******************************************************************************/
34+
void HW_IPCC_Enable( void );
35+
void HW_IPCC_Init( void );
36+
void HW_IPCC_Rx_Handler( void );
37+
void HW_IPCC_Tx_Handler( void );
38+
39+
void HW_IPCC_BLE_Init( void );
40+
void HW_IPCC_BLE_SendCmd( void );
41+
void HW_IPCC_MM_SendFreeBuf( void (*cb)( void ) );
42+
void HW_IPCC_BLE_RxEvtNot( void );
43+
void HW_IPCC_BLE_SendAclData( void );
44+
void HW_IPCC_BLE_AclDataAckNot( void );
45+
46+
void HW_IPCC_SYS_Init( void );
47+
void HW_IPCC_SYS_SendCmd( void );
48+
void HW_IPCC_SYS_CmdEvtNot( void );
49+
void HW_IPCC_SYS_EvtNot( void );
50+
51+
void HW_IPCC_THREAD_Init( void );
52+
void HW_IPCC_OT_SendCmd( void );
53+
void HW_IPCC_CLI_SendCmd( void );
54+
void HW_IPCC_THREAD_SendAck( void );
55+
void HW_IPCC_OT_CmdEvtNot( void );
56+
void HW_IPCC_CLI_CmdEvtNot( void );
57+
void HW_IPCC_THREAD_EvtNot( void );
58+
void HW_IPCC_THREAD_CliSendAck( void );
59+
void HW_IPCC_THREAD_CliEvtNot( void );
60+
61+
62+
void HW_IPCC_LLDTESTS_Init( void );
63+
void HW_IPCC_LLDTESTS_SendCliCmd( void );
64+
void HW_IPCC_LLDTESTS_ReceiveCliRsp( void );
65+
void HW_IPCC_LLDTESTS_SendCliRspAck( void );
66+
void HW_IPCC_LLDTESTS_ReceiveM0Cmd( void );
67+
void HW_IPCC_LLDTESTS_SendM0CmdAck( void );
68+
69+
70+
void HW_IPCC_LLD_BLE_Init( void );
71+
void HW_IPCC_LLD_BLE_SendCliCmd( void );
72+
void HW_IPCC_LLD_BLE_ReceiveCliRsp( void );
73+
void HW_IPCC_LLD_BLE_SendCliRspAck( void );
74+
void HW_IPCC_LLD_BLE_ReceiveM0Cmd( void );
75+
void HW_IPCC_LLD_BLE_SendM0CmdAck( void );
76+
void HW_IPCC_LLD_BLE_SendCmd( void );
77+
void HW_IPCC_LLD_BLE_ReceiveRsp( void );
78+
void HW_IPCC_LLD_BLE_SendRspAck( void );
79+
80+
81+
void HW_IPCC_TRACES_Init( void );
82+
void HW_IPCC_TRACES_EvtNot( void );
83+
84+
void HW_IPCC_MAC_802_15_4_Init( void );
85+
void HW_IPCC_MAC_802_15_4_SendCmd( void );
86+
void HW_IPCC_MAC_802_15_4_SendAck( void );
87+
void HW_IPCC_MAC_802_15_4_CmdEvtNot( void );
88+
void HW_IPCC_MAC_802_15_4_EvtNot( void );
89+
90+
void HW_IPCC_ZIGBEE_Init( void );
91+
92+
void HW_IPCC_ZIGBEE_SendM4RequestToM0(void); /* M4 Request to M0 */
93+
void HW_IPCC_ZIGBEE_RecvAppliAckFromM0(void); /* Request ACK from M0 */
94+
95+
void HW_IPCC_ZIGBEE_RecvM0NotifyToM4(void); /* M0 Notify to M4 */
96+
void HW_IPCC_ZIGBEE_SendM4AckToM0Notify(void); /* Notify ACK from M4 */
97+
void HW_IPCC_ZIGBEE_RecvM0RequestToM4(void); /* M0 Request to M4 */
98+
void HW_IPCC_ZIGBEE_SendM4AckToM0Request(void); /* Request ACK from M4 */
99+
100+
101+
#ifdef __cplusplus
102+
}
103+
#endif
104+
105+
#endif /*__HW_H */
106+
107+
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)