fix(bt): Update bt lib for ESP32(dc1cd581)

- Remove unused functions in the controller
- Add an SDK config for the minimum size of encryption key
This commit is contained in:
chenjianhua
2025-03-11 20:53:26 +08:00
parent 8685219916
commit b1f85271ff
4 changed files with 49 additions and 14 deletions

View File

@ -23,6 +23,14 @@ config BTDM_CTRL_BLE_MAX_CONN
BLE maximum connections of bluetooth controller.
Each connection uses 1KB static DRAM whenever the BT controller is enabled.
config BTDM_CTRL_BR_EDR_MIN_ENC_KEY_SZ_DFT
int "BR/EDR default minimum size of encryption key"
depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
default 7
range 7 16
help
BR/EDR default minimum size of encryption key when start encryption.
config BTDM_CTRL_BR_EDR_MAX_ACL_CONN
int "BR/EDR ACL Max Connections"
depends on BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
@ -139,6 +147,11 @@ config BTDM_CTRL_BLE_MAX_CONN_EFF
default BTDM_CTRL_BLE_MAX_CONN if BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM
default 0
config BTDM_CTRL_BR_EDR_MIN_ENC_KEY_SZ_DFT_EFF
int
default BTDM_CTRL_BR_EDR_MIN_ENC_KEY_SZ_DFT if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
default 0
config BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF
int
default BTDM_CTRL_BR_EDR_MAX_ACL_CONN if BTDM_CTRL_MODE_BR_EDR_ONLY || BTDM_CTRL_MODE_BTDM
@ -483,13 +496,6 @@ config BTDM_BLE_PING_EN
If this option is disabled, The Controller will not start the LE authenticated payload timer.
This option is used for some compatibility problems related to LE ping procedure.
config BTDM_BLE_VS_QA_SUPPORT
bool "BLE vendor HCI QA support"
depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
default n
help
This enables BLE vendor HCI command and event for QA.
config BTDM_CTRL_CONTROLLER_DEBUG_MODE_1
visible if 0
bool "Enable Bluetooth controller debugging mode 1 (for internal use only)"

View File

@ -252,7 +252,16 @@ extern uint32_t _bt_controller_data_end;
extern void config_bt_funcs_reset(void);
extern void config_ble_funcs_reset(void);
extern void config_btdm_funcs_reset(void);
extern void config_ble_vs_qa_funcs_reset(void);
#ifdef CONFIG_BT_BLUEDROID_ENABLED
extern void bt_stack_enableSecCtrlVsCmd(bool en);
#endif // CONFIG_BT_BLUEDROID_ENABLED
#if defined(CONFIG_BT_NIMBLE_ENABLED) || defined(CONFIG_BT_BLUEDROID_ENABLED)
extern void bt_stack_enableCoexVsCmd(bool en);
extern void scan_stack_enableAdvFlowCtrlVsCmd(bool en);
extern void adv_stack_enableClearLegacyAdvVsCmd(bool en);
extern void advFilter_stack_enableDupExcListVsCmd(bool en);
#endif // (CONFIG_BT_NIMBLE_ENABLED) || (CONFIG_BT_BLUEDROID_ENABLED)
/* Local Function Declare
*********************************************************************
@ -1703,6 +1712,16 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
goto error;
}
#ifdef CONFIG_BT_BLUEDROID_ENABLED
bt_stack_enableSecCtrlVsCmd(true);
#endif // CONFIG_BT_BLUEDROID_ENABLED
#if defined(CONFIG_BT_NIMBLE_ENABLED) || defined(CONFIG_BT_BLUEDROID_ENABLED)
bt_stack_enableCoexVsCmd(true);
scan_stack_enableAdvFlowCtrlVsCmd(true);
adv_stack_enableClearLegacyAdvVsCmd(true);
advFilter_stack_enableDupExcListVsCmd(true);
#endif // (CONFIG_BT_NIMBLE_ENABLED) || (CONFIG_BT_BLUEDROID_ENABLED)
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
return ESP_OK;
@ -1728,6 +1747,16 @@ esp_err_t esp_bt_controller_deinit(void)
bt_controller_deinit_internal();
#ifdef CONFIG_BT_BLUEDROID_ENABLED
bt_stack_enableSecCtrlVsCmd(false);
#endif // CONFIG_BT_BLUEDROID_ENABLED
#if defined(CONFIG_BT_NIMBLE_ENABLED) || defined(CONFIG_BT_BLUEDROID_ENABLED)
bt_stack_enableCoexVsCmd(false);
scan_stack_enableAdvFlowCtrlVsCmd(false);
adv_stack_enableClearLegacyAdvVsCmd(false);
advFilter_stack_enableDupExcListVsCmd(false);
#endif // (CONFIG_BT_NIMBLE_ENABLED) || (CONFIG_BT_BLUEDROID_ENABLED)
return ESP_OK;
}
@ -1812,10 +1841,6 @@ static void patch_apply(void)
#ifndef CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY
config_ble_funcs_reset();
#endif
#ifdef CONFIG_BTDM_BLE_VS_QA_SUPPORT
config_ble_vs_qa_funcs_reset();
#endif
}
esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)

View File

@ -55,7 +55,7 @@ extern "C" {
*
* @note Please do not modify this value.
*/
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20241024
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20250318
/**
* @brief Bluetooth Controller mode
@ -247,6 +247,7 @@ the adv packet will be discarded until the memory is restored. */
.pcm_polar = CONFIG_BTDM_CTRL_PCM_POLAR_EFF, \
.pcm_fsyncshp = 0, \
.hli = BTDM_CTRL_HLI, \
.enc_key_sz_min = CONFIG_BTDM_CTRL_BR_EDR_MIN_ENC_KEY_SZ_DFT_EFF, \
.dup_list_refresh_period = SCAN_DUPL_CACHE_REFRESH_PERIOD, \
.ble_scan_backoff = BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
.ble_llcp_disc_flag = BTDM_BLE_LLCP_DISC_FLAG, \
@ -326,6 +327,9 @@ typedef struct {
- 1 - Mono Mode 1
- 2 - Mono Mode 2 */
bool hli; /*!< True if using high-level (level 4) interrupt (default); false otherwise. Configurable in menuconfig */
uint8_t enc_key_sz_min; /*!< Minimum size of the encryption key
- Range: 7 - 16
- Default: 7 */
uint16_t dup_list_refresh_period; /*!< Scan duplicate filtering list refresh period in seconds. Configurable in menuconfig
- Range: 0 - 100 seconds
- Default: 0 second */