Skip to content

Commit

Permalink
Merge branch 'feat/add_config_for_ble_vs_qa_cmd_v5.1' into 'release/v…
Browse files Browse the repository at this point in the history
…5.1'

fixed interrupt WDT when shutdown bt controller on ESP32(ba6739f) (v5.1)

See merge request espressif/esp-idf!36173
  • Loading branch information
Jiang Jiang Jian committed Jan 8, 2025
2 parents 4a83e6b + 6c0819e commit e77ee13
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
23 changes: 23 additions & 0 deletions components/bt/controller/esp32/Kconfig.in
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,29 @@ menu "BLE disconnect when instant passed"
when instant passed in channel map update procedure.
endmenu

config BTDM_BLE_CHAN_ASS_EN
bool "Enable channel assessment"
depends on (BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM)
default y
help
If this option is enabled, The Controller will records the communication quality
for each channel and then start a timer to check and update the channel map every 4 seconds.

config BTDM_BLE_PING_EN
bool "Enable LE Ping procedure"
depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
default y
help
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_RESERVE_DRAM
hex
default 0xdb5c if BT_ENABLED
Expand Down
6 changes: 6 additions & 0 deletions components/bt/controller/esp32/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ 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);

/* Local Function Declare
*********************************************************************
Expand Down Expand Up @@ -1549,6 +1550,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
btdm_controller_mem_init();

periph_module_enable(PERIPH_BT_MODULE);
periph_module_reset(PERIPH_BT_MODULE);

#ifdef CONFIG_PM_ENABLE
s_btdm_allow_light_sleep = false;
Expand Down Expand Up @@ -1742,6 +1744,10 @@ 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)
Expand Down
2 changes: 1 addition & 1 deletion components/bt/controller/lib_esp32
18 changes: 17 additions & 1 deletion components/bt/include/esp32/include/esp_bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extern "C" {
*
* @note Please do not modify this value.
*/
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20241015
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20241024

/**
* @brief Bluetooth Controller mode
Expand Down Expand Up @@ -199,6 +199,18 @@ the adv packet will be discarded until the memory is restored. */
#define BTDM_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED 0
#endif

#if defined(CONFIG_BTDM_BLE_CHAN_ASS_EN)
#define BTDM_BLE_CHAN_ASS_EN (CONFIG_BTDM_BLE_CHAN_ASS_EN)
#else
#define BTDM_BLE_CHAN_ASS_EN (0)
#endif

#if defined(CONFIG_BTDM_BLE_PING_EN)
#define BTDM_BLE_PING_EN (CONFIG_BTDM_BLE_PING_EN)
#else
#define BTDM_BLE_PING_EN (0)
#endif

/**
* @brief Default Bluetooth Controller configuration
*/
Expand Down Expand Up @@ -229,6 +241,8 @@ the adv packet will be discarded until the memory is restored. */
.ble_scan_backoff = BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
.ble_llcp_disc_flag = BTDM_BLE_LLCP_DISC_FLAG, \
.ble_aa_check = BTDM_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED, \
.ble_chan_ass_en = BTDM_BLE_CHAN_ASS_EN, \
.ble_ping_en = BTDM_BLE_PING_EN, \
.magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \
}

Expand Down Expand Up @@ -309,6 +323,8 @@ typedef struct {
uint8_t ble_llcp_disc_flag; /*!< Flag indicating whether the Controller disconnects after Instant Passed (0x28) error occurs. Configurable in menuconfig.
- The Controller does not disconnect after Instant Passed (0x28) by default. */
bool ble_aa_check; /*!< True if adds a verification step for the Access Address within the `CONNECT_IND` PDU; false otherwise (default). Configurable in menuconfig */
uint8_t ble_chan_ass_en; /*!< True if BLE channel assessment is enabled (default), false otherwise. Configurable in menuconfig */
uint8_t ble_ping_en; /*!< True if BLE ping procedure is enabled (default), false otherwise. Configurable in menuconfig */
uint32_t magic; /*!< Magic number */
} esp_bt_controller_config_t;

Expand Down
2 changes: 2 additions & 0 deletions components/hal/esp32/include/hal/clk_gate_ll.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ static inline uint32_t periph_ll_get_rst_en_mask(periph_module_t periph, bool en
return DPORT_LEDC_RST;
case PERIPH_WIFI_MODULE:
return DPORT_WIFIMAC_RST;
case PERIPH_BT_MODULE:
return (DPORT_BTBB_RST | DPORT_BTMAC_RST | DPORT_RW_BTMAC_RST | DPORT_RW_BTLP_RST);
case PERIPH_UART0_MODULE:
return DPORT_UART_RST;
case PERIPH_UART1_MODULE:
Expand Down

0 comments on commit e77ee13

Please sign in to comment.