Skip to content

Commit d5cd3b7

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'feat/add_config_for_ble_vs_qa_cmd_v5.2' into 'release/v5.2'
fixed interrupt WDT when shutdown bt controller on ESP32(ba6739f) (v5.2) See merge request espressif/esp-idf!36174
2 parents 5800136 + 02056c7 commit d5cd3b7

File tree

5 files changed

+49
-2
lines changed

5 files changed

+49
-2
lines changed

components/bt/controller/esp32/Kconfig.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,29 @@ menu "BLE disconnect when instant passed"
467467
when instant passed in channel map update procedure.
468468
endmenu
469469

470+
config BTDM_BLE_CHAN_ASS_EN
471+
bool "Enable channel assessment"
472+
depends on (BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM)
473+
default y
474+
help
475+
If this option is enabled, The Controller will records the communication quality
476+
for each channel and then start a timer to check and update the channel map every 4 seconds.
477+
478+
config BTDM_BLE_PING_EN
479+
bool "Enable LE Ping procedure"
480+
depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
481+
default y
482+
help
483+
If this option is disabled, The Controller will not start the LE authenticated payload timer.
484+
This option is used for some compatibility problems related to LE ping procedure.
485+
486+
config BTDM_BLE_VS_QA_SUPPORT
487+
bool "BLE vendor HCI QA support"
488+
depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
489+
default n
490+
help
491+
This enables BLE vendor HCI command and event for QA.
492+
470493
config BTDM_RESERVE_DRAM
471494
hex
472495
default 0xdb5c if BT_ENABLED

components/bt/controller/esp32/bt.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ extern uint32_t _bt_controller_data_end;
244244
extern void config_bt_funcs_reset(void);
245245
extern void config_ble_funcs_reset(void);
246246
extern void config_btdm_funcs_reset(void);
247+
extern void config_ble_vs_qa_funcs_reset(void);
247248

248249
/* Local Function Declare
249250
*********************************************************************
@@ -1549,6 +1550,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
15491550
btdm_controller_mem_init();
15501551

15511552
periph_module_enable(PERIPH_BT_MODULE);
1553+
periph_module_reset(PERIPH_BT_MODULE);
15521554

15531555
#ifdef CONFIG_PM_ENABLE
15541556
s_btdm_allow_light_sleep = false;
@@ -1742,6 +1744,10 @@ static void patch_apply(void)
17421744
#ifndef CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY
17431745
config_ble_funcs_reset();
17441746
#endif
1747+
1748+
#ifdef CONFIG_BTDM_BLE_VS_QA_SUPPORT
1749+
config_ble_vs_qa_funcs_reset();
1750+
#endif
17451751
}
17461752

17471753
esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)

components/bt/include/esp32/include/esp_bt.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extern "C" {
5555
*
5656
* @note Please do not modify this value.
5757
*/
58-
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20241015
58+
#define ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL 0x20241024
5959

6060
/**
6161
* @brief Bluetooth Controller mode
@@ -199,6 +199,18 @@ the adv packet will be discarded until the memory is restored. */
199199
#define BTDM_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED 0
200200
#endif
201201

202+
#if defined(CONFIG_BTDM_BLE_CHAN_ASS_EN)
203+
#define BTDM_BLE_CHAN_ASS_EN (CONFIG_BTDM_BLE_CHAN_ASS_EN)
204+
#else
205+
#define BTDM_BLE_CHAN_ASS_EN (0)
206+
#endif
207+
208+
#if defined(CONFIG_BTDM_BLE_PING_EN)
209+
#define BTDM_BLE_PING_EN (CONFIG_BTDM_BLE_PING_EN)
210+
#else
211+
#define BTDM_BLE_PING_EN (0)
212+
#endif
213+
202214
/**
203215
* @brief Default Bluetooth Controller configuration
204216
*/
@@ -229,6 +241,8 @@ the adv packet will be discarded until the memory is restored. */
229241
.ble_scan_backoff = BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
230242
.ble_llcp_disc_flag = BTDM_BLE_LLCP_DISC_FLAG, \
231243
.ble_aa_check = BTDM_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED, \
244+
.ble_chan_ass_en = BTDM_BLE_CHAN_ASS_EN, \
245+
.ble_ping_en = BTDM_BLE_PING_EN, \
232246
.magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \
233247
}
234248

@@ -309,6 +323,8 @@ typedef struct {
309323
uint8_t ble_llcp_disc_flag; /*!< Flag indicating whether the Controller disconnects after Instant Passed (0x28) error occurs. Configurable in menuconfig.
310324
- The Controller does not disconnect after Instant Passed (0x28) by default. */
311325
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 */
326+
uint8_t ble_chan_ass_en; /*!< True if BLE channel assessment is enabled (default), false otherwise. Configurable in menuconfig */
327+
uint8_t ble_ping_en; /*!< True if BLE ping procedure is enabled (default), false otherwise. Configurable in menuconfig */
312328
uint32_t magic; /*!< Magic number */
313329
} esp_bt_controller_config_t;
314330

components/hal/esp32/include/hal/clk_gate_ll.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ static inline uint32_t periph_ll_get_rst_en_mask(periph_module_t periph, bool en
9999
return DPORT_LEDC_RST;
100100
case PERIPH_WIFI_MODULE:
101101
return DPORT_WIFIMAC_RST;
102+
case PERIPH_BT_MODULE:
103+
return (DPORT_BTBB_RST | DPORT_BTMAC_RST | DPORT_RW_BTMAC_RST | DPORT_RW_BTLP_RST);
102104
case PERIPH_UART0_MODULE:
103105
return DPORT_UART_RST;
104106
case PERIPH_UART1_MODULE:

0 commit comments

Comments
 (0)