Skip to content

Commit fe24a1c

Browse files
committed
Merge branch 'feat/add_config_for_ble_vs_qa_cmd_v5.4' into 'release/v5.4'
fixed interrupt WDT when shutdown bt controller on ESP32(ba6739f) (v5.4) See merge request espressif/esp-idf!36176
2 parents 73d1c13 + ecf663c commit fe24a1c

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
@@ -505,6 +505,29 @@ menu "BLE disconnects when Instant Passed (0x28) occurs"
505505
when Instant Passed (0x28) error occurs in channel map update procedure.
506506
endmenu
507507

508+
config BTDM_BLE_CHAN_ASS_EN
509+
bool "Enable channel assessment"
510+
depends on (BTDM_CTRL_MODE_BLE_ONLY || BTDM_CTRL_MODE_BTDM)
511+
default y
512+
help
513+
If this option is enabled, The Controller will records the communication quality
514+
for each channel and then start a timer to check and update the channel map every 4 seconds.
515+
516+
config BTDM_BLE_PING_EN
517+
bool "Enable LE Ping procedure"
518+
depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
519+
default y
520+
help
521+
If this option is disabled, The Controller will not start the LE authenticated payload timer.
522+
This option is used for some compatibility problems related to LE ping procedure.
523+
524+
config BTDM_BLE_VS_QA_SUPPORT
525+
bool "BLE vendor HCI QA support"
526+
depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
527+
default n
528+
help
529+
This enables BLE vendor HCI command and event for QA.
530+
508531
config BTDM_RESERVE_DRAM
509532
hex
510533
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
@@ -248,6 +248,7 @@ extern uint32_t _bt_controller_data_end;
248248
extern void config_bt_funcs_reset(void);
249249
extern void config_ble_funcs_reset(void);
250250
extern void config_btdm_funcs_reset(void);
251+
extern void config_ble_vs_qa_funcs_reset(void);
251252

252253
/* Local Function Declare
253254
*********************************************************************
@@ -1553,6 +1554,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
15531554
btdm_controller_mem_init();
15541555

15551556
periph_module_enable(PERIPH_BT_MODULE);
1557+
periph_module_reset(PERIPH_BT_MODULE);
15561558

15571559
#ifdef CONFIG_PM_ENABLE
15581560
s_btdm_allow_light_sleep = false;
@@ -1746,6 +1748,10 @@ static void patch_apply(void)
17461748
#ifndef CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY
17471749
config_ble_funcs_reset();
17481750
#endif
1751+
1752+
#ifdef CONFIG_BTDM_BLE_VS_QA_SUPPORT
1753+
config_ble_vs_qa_funcs_reset();
1754+
#endif
17491755
}
17501756

17511757
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 advertising 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 advertising 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)