Skip to content

Commit ab92fef

Browse files
feat(ble): add sm count reserve cnt setting on ESP32-C6 and ESP32-C61
1 parent 3d96faa commit ab92fef

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

components/bt/controller/esp32c6/Kconfig.in

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,3 +846,34 @@ config BT_LE_CTRL_FAST_CONN_DATA_TX_EN
846846
help
847847
If this option is enabled, The Controller will continue to
848848
Send an empty PDU after sending valid connection data within an interval.
849+
850+
menu "Reserved Memory Config"
851+
config BT_LE_EXT_ADV_RESERVED_MEMORY_COUNT
852+
int "The value of reserved EXT ADV memory count at initialization"
853+
range 0 4
854+
default 2
855+
help
856+
This value sets the number the Controller will allocate for extended advertisement
857+
instances at initialization process. If more extended advertisement instances are
858+
enabled, those memory will be dynamically allocated.
859+
Using reduced amount of reserved memory will save heap size at the cost of extra
860+
time consumption at advertising start process and possible advertising start failure
861+
due to memory shortage.
862+
The actual reserved memory count will be the minimum value between the maximum
863+
extended advertisement instances and the BT_LE_EXT_ADV_RESERVED_MEMORY_COUNT.
864+
865+
866+
config BT_LE_CONN_RESERVED_MEMORY_COUNT
867+
int "The value of reserved CONN memory count at initialization"
868+
range 0 70
869+
default 2
870+
help
871+
This value sets the number the Controller will allocate for connection instances
872+
at the initialization process. If more connection instances are enabled, those
873+
memory will be dynamically allocated.
874+
Using reduced amount of reserved memory will save heap size at the cost of extra
875+
time consumption at connection establishment process and possible connection
876+
establishment failure due to memory shortage.
877+
The actual reserved memory count will be the minimum value between the maximum
878+
connection instances and the BT_LE_CONN_RESERVED_MEMORY_COUNT.
879+
endmenu

components/bt/controller/esp32c6/esp_bt_cfg.h

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

284284
#define BLE_LL_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF)
285285

286+
#define BLE_LL_ADV_SM_RESERVE_CNT_N MIN(DEFAULT_BT_LE_MAX_EXT_ADV_INSTANCES, CONFIG_BT_LE_EXT_ADV_RESERVED_MEMORY_COUNT)
287+
#define BLE_LL_CONN_SM_RESERVE_CNT_N MIN(DEFAULT_BT_LE_MAX_CONNECTIONS, CONFIG_BT_LE_CONN_RESERVED_MEMORY_COUNT)
288+
286289
#define RUN_BQB_TEST (0)
287290
#define RUN_QA_TEST (0)
288291
#define NIMBLE_DISABLE_SCAN_BACKOFF (0)

components/bt/include/esp32c6/include/esp_bt.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type
156156
*/
157157
esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
158158

159-
#define CONFIG_VERSION 0x20250526
159+
#define CONFIG_VERSION 0x20250606
160160
#define CONFIG_MAGIC 0x5A5AA5A5
161161

162162
/**
@@ -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

@@ -294,6 +296,8 @@ typedef struct {
294296
.skip_unnecessary_checks_en = 0, \
295297
.fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \
296298
.ch39_txpwr = BLE_LL_TX_PWR_DBM_N, \
299+
.adv_rsv_cnt = BLE_LL_ADV_SM_RESERVE_CNT_N, \
300+
.conn_rsv_cnt = BLE_LL_CONN_SM_RESERVE_CNT_N, \
297301
.config_magic = CONFIG_MAGIC, \
298302
}
299303
#elif CONFIG_IDF_TARGET_ESP32C61
@@ -353,6 +357,8 @@ typedef struct {
353357
.skip_unnecessary_checks_en = 0, \
354358
.fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \
355359
.ch39_txpwr = BLE_LL_TX_PWR_DBM_N, \
360+
.adv_rsv_cnt = BLE_LL_ADV_SM_RESERVE_CNT_N, \
361+
.conn_rsv_cnt = BLE_LL_CONN_SM_RESERVE_CNT_N, \
356362
.config_magic = CONFIG_MAGIC, \
357363
}
358364
#endif

0 commit comments

Comments
 (0)