Skip to content

Commit e44f137

Browse files
feat(ble): add sm count reserve cnt setting on ESP32-H2
1 parent ab92fef commit e44f137

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

components/bt/controller/esp32h2/Kconfig.in

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

components/bt/controller/esp32h2/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/esp32h2/include/esp_bt.h

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

164-
#define CONFIG_VERSION 0x20250526
164+
#define CONFIG_VERSION 0x20250606
165165
#define CONFIG_MAGIC 0x5A5AA5A5
166166

167167
/**
@@ -234,6 +234,8 @@ typedef struct {
234234
- 0 - Disable
235235
- 1 - Enable (default) */
236236
int8_t ch39_txpwr; /*!< BLE transmit power (in dBm) used for BLE advertising on channel 39. */
237+
uint8_t adv_rsv_cnt; /*!< BLE adv state machine reserve count number */
238+
uint8_t conn_rsv_cnt; /*!< BLE conn state machine reserve count number */
237239
uint32_t config_magic; /*!< Configuration magic value */
238240
} esp_bt_controller_config_t;
239241

@@ -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

0 commit comments

Comments
 (0)