Skip to content

Commit 3d96faa

Browse files
feat(ble): add sm count reserve cnt setting on ESP32-C5
1 parent e4238a4 commit 3d96faa

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

components/bt/controller/esp32c5/Kconfig.in

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,3 +812,34 @@ config BT_LE_CTRL_FAST_CONN_DATA_TX_EN
812812
help
813813
If this option is enabled, The Controller will continue to
814814
Send an empty PDU after sending valid connection data within an interval.
815+
816+
menu "Reserved Memory Config"
817+
config BT_LE_EXT_ADV_RESERVED_MEMORY_COUNT
818+
int "The value of reserved EXT ADV memory count at initialization"
819+
range 0 4
820+
default 2
821+
help
822+
This value sets the number the Controller will allocate for extended advertisement
823+
instances at initialization process. If more extended advertisement instances are
824+
enabled, those memory will be dynamically allocated.
825+
Using reduced amount of reserved memory will save heap size at the cost of extra
826+
time consumption at advertising start process and possible advertising start failure
827+
due to memory shortage.
828+
The actual reserved memory count will be the minimum value between the maximum
829+
extended advertisement instances and the BT_LE_EXT_ADV_RESERVED_MEMORY_COUNT.
830+
831+
832+
config BT_LE_CONN_RESERVED_MEMORY_COUNT
833+
int "The value of reserved CONN memory count at initialization"
834+
range 0 70
835+
default 2
836+
help
837+
This value sets the number the Controller will allocate for connection instances
838+
at the initialization process. If more connection instances are enabled, those
839+
memory will be dynamically allocated.
840+
Using reduced amount of reserved memory will save heap size at the cost of extra
841+
time consumption at connection establishment process and possible connection
842+
establishment failure due to memory shortage.
843+
The actual reserved memory count will be the minimum value between the maximum
844+
connection instances and the BT_LE_CONN_RESERVED_MEMORY_COUNT.
845+
endmenu

components/bt/controller/esp32c5/esp_bt_cfg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ extern "C" {
280280

281281
#define BLE_LL_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF)
282282

283+
#define BLE_LL_ADV_SM_RESERVE_CNT_N MIN(DEFAULT_BT_LE_MAX_EXT_ADV_INSTANCES, CONFIG_BT_LE_EXT_ADV_RESERVED_MEMORY_COUNT)
284+
#define BLE_LL_CONN_SM_RESERVE_CNT_N MIN(DEFAULT_BT_LE_MAX_CONNECTIONS, CONFIG_BT_LE_CONN_RESERVED_MEMORY_COUNT)
285+
283286
#define RUN_BQB_TEST (0)
284287
#define RUN_QA_TEST (0)
285288
#define NIMBLE_DISABLE_SCAN_BACKOFF (0)

components/bt/include/esp32c5/include/esp_bt.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type
159159
*/
160160
esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
161161

162-
#define CONFIG_VERSION 0x20250526
162+
#define CONFIG_VERSION 0x20250606
163163
#define CONFIG_MAGIC 0x5A5AA5A5
164164

165165
/**
@@ -232,6 +232,8 @@ typedef struct {
232232
- 0 - Disable
233233
- 1 - Enable (default) */
234234
int8_t ch39_txpwr; /*!< BLE transmit power (in dBm) used for BLE advertising on channel 39. */
235+
uint8_t adv_rsv_cnt; /*!< BLE adv state machine reserve count number */
236+
uint8_t conn_rsv_cnt; /*!< BLE conn state machine reserve count number */
235237
uint32_t config_magic; /*!< Magic number for configuration validation */
236238
} esp_bt_controller_config_t;
237239

@@ -291,6 +293,8 @@ typedef struct {
291293
.skip_unnecessary_checks_en = 0, \
292294
.fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \
293295
.ch39_txpwr = BLE_LL_TX_PWR_DBM_N, \
296+
.adv_rsv_cnt = BLE_LL_ADV_SM_RESERVE_CNT_N, \
297+
.conn_rsv_cnt = BLE_LL_CONN_SM_RESERVE_CNT_N, \
294298
.config_magic = CONFIG_MAGIC, \
295299
}
296300

0 commit comments

Comments
 (0)