From 8a138cbd221980cad0da1db0dbef2ec6876d2596 Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Mon, 19 May 2025 12:04:26 +0800 Subject: [PATCH 1/8] change(ble): [AUTO_MR] Update lib_esp32h2 to 1304a9d0 (cherry picked from commit 29f89efea67872dd3596bed546f881e941259c41) Co-authored-by: zwl --- components/bt/controller/lib_esp32h2/esp32h2-bt-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib index efd8a69553..bd09406c74 160000 --- a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib +++ b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib @@ -1 +1 @@ -Subproject commit efd8a6955349938bff782c00d2880195ca99854a +Subproject commit bd09406c74d135d1d4e68c5e578540a8bcffbcac From f5748f3d9b03a0005edce95ef17cf49d281cb1f2 Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Mon, 19 May 2025 12:04:28 +0800 Subject: [PATCH 2/8] change(ble): [AUTO_MR] Update lib_esp32c5 to 1304a9d0 (cherry picked from commit 27220c1b4c69c86eb1571169d7a1ba5e5c702ab9) Co-authored-by: zwl --- components/bt/controller/lib_esp32c5/esp32c5-bt-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32c5/esp32c5-bt-lib b/components/bt/controller/lib_esp32c5/esp32c5-bt-lib index 48ff59a739..19bce59850 160000 --- a/components/bt/controller/lib_esp32c5/esp32c5-bt-lib +++ b/components/bt/controller/lib_esp32c5/esp32c5-bt-lib @@ -1 +1 @@ -Subproject commit 48ff59a7398c26e0616e15d84b88bacac99b910e +Subproject commit 19bce59850e593a1e0231a1f051e24a1532c38d6 From 2e02c26b81e0bd327bea85b938c1bcbcfbc56d4e Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Mon, 19 May 2025 12:04:31 +0800 Subject: [PATCH 3/8] change(ble): [AUTO_MR] Update lib_esp32c6 to 1304a9d0 (cherry picked from commit 69158d50643c1368760bdc9bf28ebdfc0d871cac) Co-authored-by: zwl --- components/bt/controller/lib_esp32c6/esp32c6-bt-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib index 233738dc87..841466ff3c 160000 --- a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib +++ b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib @@ -1 +1 @@ -Subproject commit 233738dc87a81c1ea3156422f8428721f4c2e41b +Subproject commit 841466ff3cf6635bf061c18e836807ee7f99ce78 From e1aee3ff2b1f24cfef5ee67da5a112e2a5b3301f Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Mon, 19 May 2025 12:04:33 +0800 Subject: [PATCH 4/8] change(ble): [AUTO_MR] Update lib_esp32c2 to 664e4255 (cherry picked from commit 3cfd4d0166c8502d04ea239bf1d72b610bc94002) Co-authored-by: zwl --- components/bt/controller/lib_esp32c2/esp32c2-bt-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib index d6c94459f3..06c5ef1481 160000 --- a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib +++ b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib @@ -1 +1 @@ -Subproject commit d6c94459f3851953252123f684a6be63a074a5f7 +Subproject commit 06c5ef1481e6e5ff9308d6abe9c1e576d60c946f From f056662cd56037704846fa5f1da1dbaf540dde56 Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Mon, 19 May 2025 12:04:36 +0800 Subject: [PATCH 5/8] fix(ble): fixed occasional assert issue in scan and connection scenarios on ESP32-C6 (cherry picked from commit cd6038b6cfd70cde610ee95e24761971cbf9993e) Co-authored-by: zwl --- components/bt/controller/esp32c6/Kconfig.in | 7 ++++ components/bt/controller/esp32c6/bt.c | 39 ++++++++++++++++--- components/bt/controller/esp32c6/esp_bt_cfg.h | 6 +++ .../bt/include/esp32c6/include/esp_bt.h | 13 ++++++- 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/components/bt/controller/esp32c6/Kconfig.in b/components/bt/controller/esp32c6/Kconfig.in index c48db83e79..4501db3cb8 100644 --- a/components/bt/controller/esp32c6/Kconfig.in +++ b/components/bt/controller/esp32c6/Kconfig.in @@ -839,3 +839,10 @@ config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX config BT_LE_RXBUF_OPT_ENABLED bool "Enable rxbuf optimization feature" default y + +config BT_LE_CTRL_FAST_CONN_DATA_TX_EN + bool "Enable fast sending of connection data" + default y + help + If this option is enabled, The Controller will continue to + Send an empty PDU after sending valid connection data within an interval. diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 3c56967553..8c31fa860e 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -58,6 +58,7 @@ #include "hal/efuse_hal.h" #include "soc/rtc.h" +#include "modem/modem_syscon_struct.h" #if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED #include "ble_log/ble_log_spi_out.h" @@ -70,7 +71,7 @@ #define OSI_COEX_VERSION 0x00010006 #define OSI_COEX_MAGIC_VALUE 0xFADEBEAD -#define EXT_FUNC_VERSION 0x20240422 +#define EXT_FUNC_VERSION 0x20250415 #define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5 #define BT_ASSERT_PRINT ets_printf @@ -101,7 +102,9 @@ struct ext_funcs_t { int (* _ecc_gen_key_pair)(uint8_t *public, uint8_t *priv); int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y, const uint8_t *local_priv_key, uint8_t *dhkey); - void (* _esp_reset_rpa_moudle)(void); +#if CONFIG_IDF_TARGET_ESP32C6 + void (* _esp_reset_modem)(uint8_t mdl_opts, uint8_t start); +#endif // CONFIG_IDF_TARGET_ESP32C6 uint32_t magic; }; @@ -112,6 +115,11 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t le /* External functions or variables ************************************************************************ */ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE +extern void coex_hw_timer_set(uint8_t idx,uint8_t src, uint8_t pti,uint32_t latency, uint32_t perioidc); +extern void coex_hw_timer_enable(uint8_t idx); +extern void coex_hw_timer_disable(uint8_t idx); +#endif // CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs); extern int r_ble_controller_init(esp_bt_controller_config_t *cfg); extern void esp_ble_controller_info_capture(uint32_t cycle_times); @@ -185,7 +193,9 @@ static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, static int esp_intr_free_wrapper(void **ret_handle); static void osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2); static uint32_t osi_random_wrapper(void); -static void esp_reset_rpa_moudle(void); +#if CONFIG_IDF_TARGET_ESP32C6 +static void esp_reset_modem(uint8_t mdl_opts,uint8_t start); +#endif // CONFIG_IDF_TARGET_ESP32C6 static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv); static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y, const uint8_t *our_priv_key, uint8_t *out_dhkey); @@ -463,15 +473,34 @@ struct ext_funcs_t ext_funcs_ro = { ._os_random = osi_random_wrapper, ._ecc_gen_key_pair = esp_ecc_gen_key_pair, ._ecc_gen_dh_key = esp_ecc_gen_dh_key, - ._esp_reset_rpa_moudle = esp_reset_rpa_moudle, +#if CONFIG_IDF_TARGET_ESP32C6 + ._esp_reset_modem = esp_reset_modem, +#endif // CONFIG_IDF_TARGET_ESP32C6 .magic = EXT_FUNC_MAGIC_VALUE, }; -static void IRAM_ATTR esp_reset_rpa_moudle(void) +#if CONFIG_IDF_TARGET_ESP32C6 +static void IRAM_ATTR esp_reset_modem(uint8_t mdl_opts,uint8_t start) { + if (mdl_opts == 0x05) { + if (start) { +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + coex_hw_timer_set(0x04, 0x02, 15, 0, 5000); + coex_hw_timer_enable(0x04); +#endif // CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + MODEM_SYSCON.modem_rst_conf.val |= (BIT(16) | BIT(18)); + MODEM_SYSCON.modem_rst_conf.val &= ~(BIT(16) | BIT(18)); + } else { +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + coex_hw_timer_disable(0x04); +#endif // CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + } + } } +#endif // CONFIG_IDF_TARGET_ESP32C6 + static void IRAM_ATTR osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2) { diff --git a/components/bt/controller/esp32c6/esp_bt_cfg.h b/components/bt/controller/esp32c6/esp_bt_cfg.h index 27b12ca3fd..f22c4c75be 100644 --- a/components/bt/controller/esp32c6/esp_bt_cfg.h +++ b/components/bt/controller/esp32c6/esp_bt_cfg.h @@ -195,6 +195,12 @@ extern "C" { #define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (0) #endif +#if defined(CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN) +#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN) +#else +#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (0) +#endif + #ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART #define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART #else diff --git a/components/bt/include/esp32c6/include/esp_bt.h b/components/bt/include/esp32c6/include/esp_bt.h index bce1cb9c55..e91a7f1c2e 100644 --- a/components/bt/include/esp32c6/include/esp_bt.h +++ b/components/bt/include/esp32c6/include/esp_bt.h @@ -156,7 +156,7 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type */ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle); -#define CONFIG_VERSION 0x20250310 +#define CONFIG_VERSION 0x20250513 #define CONFIG_MAGIC 0x5A5AA5A5 /** @@ -226,6 +226,11 @@ typedef struct { - 1 - Enable */ uint8_t vhci_enabled; /*!< VHCI mode is enabled */ uint8_t ptr_check_enabled; /*!< Enable boundary check for internal memory. */ + uint8_t ble_adv_tx_options; /*!< The options for Extended advertising sending. */ + uint8_t skip_unnecessary_checks_en; /*!< The option to skip non-fatal state checks and perform extra handling for fatal checks. */ + uint8_t fast_conn_data_tx_en; /*!< The option for fast transmission of connection data + - 0 - Disable + - 1 - Enable (default) */ uint32_t config_magic; /*!< Magic number for configuration validation */ } esp_bt_controller_config_t; @@ -284,6 +289,9 @@ typedef struct { .ble_data_lenth_zero_aux = DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .ptr_check_enabled = DEFAULT_BT_LE_PTR_CHECK_ENABLED, \ + .ble_adv_tx_options = 0, \ + .skip_unnecessary_checks_en = 0, \ + .fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \ .config_magic = CONFIG_MAGIC, \ } #elif CONFIG_IDF_TARGET_ESP32C61 @@ -339,6 +347,9 @@ typedef struct { .ble_data_lenth_zero_aux = DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .ptr_check_enabled = DEFAULT_BT_LE_PTR_CHECK_ENABLED, \ + .ble_adv_tx_options = 0, \ + .skip_unnecessary_checks_en = 0, \ + .fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \ .config_magic = CONFIG_MAGIC, \ } #endif From f9597a06f4a12e72f38211a823e878c52165694b Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Mon, 19 May 2025 12:04:38 +0800 Subject: [PATCH 6/8] feat(ble): support creating connections during scanning process on ESP32-H2 (cherry picked from commit 207d85a5f7c312efc421986a6ab766c55aa10fa4) Co-authored-by: zwl --- components/bt/controller/esp32h2/Kconfig.in | 7 +++++++ components/bt/controller/esp32h2/bt.c | 10 +--------- components/bt/controller/esp32h2/esp_bt_cfg.h | 6 ++++++ components/bt/include/esp32h2/include/esp_bt.h | 12 ++++++++++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/components/bt/controller/esp32h2/Kconfig.in b/components/bt/controller/esp32h2/Kconfig.in index d549d0bdb5..e7d935cd97 100644 --- a/components/bt/controller/esp32h2/Kconfig.in +++ b/components/bt/controller/esp32h2/Kconfig.in @@ -843,3 +843,10 @@ config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX config BT_LE_RXBUF_OPT_ENABLED bool "Enable rxbuf optimization feature" default y + +config BT_LE_CTRL_FAST_CONN_DATA_TX_EN + bool "Enable fast sending of connection data" + default y + help + If this option is enabled, The Controller will continue to + Send an empty PDU after sending valid connection data within an interval. diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index 792cf64ded..86e8637cb7 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -66,7 +66,7 @@ #define OSI_COEX_VERSION 0x00010006 #define OSI_COEX_MAGIC_VALUE 0xFADEBEAD -#define EXT_FUNC_VERSION 0x20240422 +#define EXT_FUNC_VERSION 0x20250415 #define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5 #define BT_ASSERT_PRINT ets_printf @@ -97,7 +97,6 @@ struct ext_funcs_t { int (* _ecc_gen_key_pair)(uint8_t *public, uint8_t *priv); int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y, const uint8_t *local_priv_key, uint8_t *dhkey); - void (* _esp_reset_rpa_moudle)(void); uint32_t magic; }; @@ -183,7 +182,6 @@ static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, static int esp_intr_free_wrapper(void **ret_handle); static void osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2); static uint32_t osi_random_wrapper(void); -static void esp_reset_rpa_moudle(void); static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv); static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y, const uint8_t *our_priv_key, uint8_t *out_dhkey); @@ -460,15 +458,9 @@ struct ext_funcs_t ext_funcs_ro = { ._os_random = osi_random_wrapper, ._ecc_gen_key_pair = esp_ecc_gen_key_pair, ._ecc_gen_dh_key = esp_ecc_gen_dh_key, - ._esp_reset_rpa_moudle = esp_reset_rpa_moudle, .magic = EXT_FUNC_MAGIC_VALUE, }; -static void IRAM_ATTR esp_reset_rpa_moudle(void) -{ - -} - static void IRAM_ATTR osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2) { diff --git a/components/bt/controller/esp32h2/esp_bt_cfg.h b/components/bt/controller/esp32h2/esp_bt_cfg.h index 6621c28cb4..48a845a3fa 100644 --- a/components/bt/controller/esp32h2/esp_bt_cfg.h +++ b/components/bt/controller/esp32h2/esp_bt_cfg.h @@ -192,6 +192,12 @@ extern "C" { #define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (0) #endif +#if defined(CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN) +#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN) +#else +#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (0) +#endif + #ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART #define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART #else diff --git a/components/bt/include/esp32h2/include/esp_bt.h b/components/bt/include/esp32h2/include/esp_bt.h index 6c0634033d..bf9370eba1 100644 --- a/components/bt/include/esp32h2/include/esp_bt.h +++ b/components/bt/include/esp32h2/include/esp_bt.h @@ -161,7 +161,7 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type */ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle); -#define CONFIG_VERSION 0x20250310 +#define CONFIG_VERSION 0x20250513 #define CONFIG_MAGIC 0x5A5AA5A5 /** @@ -226,8 +226,13 @@ typedef struct { uint8_t ble_data_lenth_zero_aux; /*!< Enable / disable auxiliary packets when the extended ADV data length is zero. Configurable in menuconfig. - 0 - Disable (default) - 1 - Enable */ - uint8_t vhci_enabled; /*!< VHCI is enabled */ + uint8_t vhci_enabled; /*!< VHCI is enabled */ uint8_t ptr_check_enabled; /*!< Enable boundary check for internal memory. */ + uint8_t ble_adv_tx_options; /*!< The options for Extended advertising sending. */ + uint8_t skip_unnecessary_checks_en; /*!< The option to skip non-fatal state checks and perform extra handling for fatal checks. */ + uint8_t fast_conn_data_tx_en; /*!< The option for fast transmission of connection data + - 0 - Disable + - 1 - Enable (default) */ uint32_t config_magic; /*!< Configuration magic value */ } esp_bt_controller_config_t; @@ -284,6 +289,9 @@ typedef struct { .ble_data_lenth_zero_aux = DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .ptr_check_enabled = DEFAULT_BT_LE_PTR_CHECK_ENABLED, \ + .ble_adv_tx_options = 0, \ + .skip_unnecessary_checks_en = 0, \ + .fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \ .config_magic = CONFIG_MAGIC, \ } From 6ba1a3a42758b7fa03251ffba0eb423912aab38a Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Mon, 19 May 2025 12:04:41 +0800 Subject: [PATCH 7/8] feat(ble): support creating connections during scanning process on ESP32-C5 (cherry picked from commit 9d687daf36c011c0c1b7753075d5e02492b6fa05) Co-authored-by: zwl --- components/bt/controller/esp32c5/Kconfig.in | 7 +++++++ components/bt/controller/esp32c5/bt.c | 11 +---------- components/bt/controller/esp32c5/esp_bt_cfg.h | 6 ++++++ components/bt/include/esp32c5/include/esp_bt.h | 10 +++++++++- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/components/bt/controller/esp32c5/Kconfig.in b/components/bt/controller/esp32c5/Kconfig.in index be28c7e376..989bb52df9 100644 --- a/components/bt/controller/esp32c5/Kconfig.in +++ b/components/bt/controller/esp32c5/Kconfig.in @@ -805,3 +805,10 @@ config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX config BT_LE_RXBUF_OPT_ENABLED bool "Enable rxbuf optimization feature" default y + +config BT_LE_CTRL_FAST_CONN_DATA_TX_EN + bool "Enable fast sending of connection data" + default y + help + If this option is enabled, The Controller will continue to + Send an empty PDU after sending valid connection data within an interval. diff --git a/components/bt/controller/esp32c5/bt.c b/components/bt/controller/esp32c5/bt.c index da65ecd10e..37c2fa6601 100644 --- a/components/bt/controller/esp32c5/bt.c +++ b/components/bt/controller/esp32c5/bt.c @@ -67,7 +67,7 @@ #define OSI_COEX_VERSION 0x00010006 #define OSI_COEX_MAGIC_VALUE 0xFADEBEAD -#define EXT_FUNC_VERSION 0x20240422 +#define EXT_FUNC_VERSION 0x20250415 #define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5 #define BT_ASSERT_PRINT ets_printf @@ -98,14 +98,12 @@ struct ext_funcs_t { int (* _ecc_gen_key_pair)(uint8_t *public, uint8_t *priv); int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y, const uint8_t *local_priv_key, uint8_t *dhkey); - void (* _esp_reset_rpa_moudle)(void); uint32_t magic; }; #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag); #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED - /* External functions or variables ************************************************************************ */ @@ -182,7 +180,6 @@ static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, static int esp_intr_free_wrapper(void **ret_handle); static void osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2); static uint32_t osi_random_wrapper(void); -static void esp_reset_rpa_moudle(void); static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv); static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y, const uint8_t *our_priv_key, uint8_t *out_dhkey); @@ -459,15 +456,9 @@ struct ext_funcs_t ext_funcs_ro = { ._os_random = osi_random_wrapper, ._ecc_gen_key_pair = esp_ecc_gen_key_pair, ._ecc_gen_dh_key = esp_ecc_gen_dh_key, - ._esp_reset_rpa_moudle = esp_reset_rpa_moudle, .magic = EXT_FUNC_MAGIC_VALUE, }; -static void IRAM_ATTR esp_reset_rpa_moudle(void) -{ - -} - static void IRAM_ATTR osi_assert_wrapper(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2) { diff --git a/components/bt/controller/esp32c5/esp_bt_cfg.h b/components/bt/controller/esp32c5/esp_bt_cfg.h index 6621c28cb4..48a845a3fa 100644 --- a/components/bt/controller/esp32c5/esp_bt_cfg.h +++ b/components/bt/controller/esp32c5/esp_bt_cfg.h @@ -192,6 +192,12 @@ extern "C" { #define DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX (0) #endif +#if defined(CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN) +#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN) +#else +#define DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN (0) +#endif + #ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART #define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART #else diff --git a/components/bt/include/esp32c5/include/esp_bt.h b/components/bt/include/esp32c5/include/esp_bt.h index 3333adee4b..35dd2c21a1 100644 --- a/components/bt/include/esp32c5/include/esp_bt.h +++ b/components/bt/include/esp32c5/include/esp_bt.h @@ -159,7 +159,7 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type */ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle); -#define CONFIG_VERSION 0x20250310 +#define CONFIG_VERSION 0x20250513 #define CONFIG_MAGIC 0x5A5AA5A5 /** @@ -226,6 +226,11 @@ typedef struct { - 1 - Enable */ uint8_t vhci_enabled; /*!< VHCI mode is enabled */ uint8_t ptr_check_enabled; /*!< Enable boundary check for internal memory. */ + uint8_t ble_adv_tx_options; /*!< The options for Extended advertising sending. */ + uint8_t skip_unnecessary_checks_en; /*!< The option to skip non-fatal state checks and perform extra handling for fatal checks. */ + uint8_t fast_conn_data_tx_en; /*!< The option for fast transmission of connection data + - 0 - Disable + - 1 - Enable (default) */ uint32_t config_magic; /*!< Magic number for configuration validation */ } esp_bt_controller_config_t; @@ -281,6 +286,9 @@ typedef struct { .ble_data_lenth_zero_aux = DEFAULT_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX, \ .vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \ .ptr_check_enabled = DEFAULT_BT_LE_PTR_CHECK_ENABLED, \ + .ble_adv_tx_options = 0, \ + .skip_unnecessary_checks_en = 0, \ + .fast_conn_data_tx_en = DEFAULT_BT_LE_CTRL_FAST_CONN_DATA_TX_EN, \ .config_magic = CONFIG_MAGIC, \ } From eb0cf524c02e7474ca06f988c18e5b2c1eb248eb Mon Sep 17 00:00:00 2001 From: Zhao Wei Liang Date: Mon, 19 May 2025 12:04:43 +0800 Subject: [PATCH 8/8] fix(ble): added missed printf for ll log interface (cherry picked from commit d12e072b3597113fdbad3ca64beac6dea8ca09d9) Co-authored-by: Zhou Xiao --- components/bt/controller/esp32c2/bt.c | 19 +++++++++++++------ components/bt/controller/esp32c5/bt.c | 19 +++++++++++++------ components/bt/controller/esp32c6/bt.c | 19 +++++++++++++------ components/bt/controller/esp32h2/bt.c | 19 +++++++++++++------ 4 files changed, 52 insertions(+), 24 deletions(-) diff --git a/components/bt/controller/esp32c2/bt.c b/components/bt/controller/esp32c2/bt.c index c24bb67fc6..a329881eeb 100644 --- a/components/bt/controller/esp32c2/bt.c +++ b/components/bt/controller/esp32c2/bt.c @@ -119,6 +119,11 @@ struct ext_funcs_t { #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag); + +enum { + BLE_LOG_INTERFACE_FLAG_CONTINUE = 0, + BLE_LOG_INTERFACE_FLAG_END, +}; #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED /* External functions or variables @@ -411,20 +416,22 @@ void esp_bt_read_ctrl_log_from_flash(bool output) #if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag) { - bool end = flag ? true : false; + bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END)); #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE esp_bt_controller_log_storage(len, addr, end); #else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; portENTER_CRITICAL_SAFE(&spinlock); esp_panic_handler_feed_wdts(); - for (int i = 0; i < len; i++) { - esp_rom_printf("%02x ", addr[i]); - } - if (end) { - esp_rom_printf("\n"); + if (len && addr) { + for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); } } + if (len_append && addr_append) { + for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); } + } + if (end) { esp_rom_printf("\n"); } + portEXIT_CRITICAL_SAFE(&spinlock); #endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE } diff --git a/components/bt/controller/esp32c5/bt.c b/components/bt/controller/esp32c5/bt.c index 37c2fa6601..7d332a06fb 100644 --- a/components/bt/controller/esp32c5/bt.c +++ b/components/bt/controller/esp32c5/bt.c @@ -103,6 +103,11 @@ struct ext_funcs_t { #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag); + +enum { + BLE_LOG_INTERFACE_FLAG_CONTINUE = 0, + BLE_LOG_INTERFACE_FLAG_END, +}; #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED /* External functions or variables ************************************************************************ @@ -1410,20 +1415,22 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po #if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag) { - bool end = flag ? true : false; + bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END)); #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE esp_bt_controller_log_storage(len, addr, end); #else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; portENTER_CRITICAL_SAFE(&spinlock); esp_panic_handler_feed_wdts(); - for (int i = 0; i < len; i++) { - esp_rom_printf("%02x ", addr[i]); - } - if (end) { - esp_rom_printf("\n"); + if (len && addr) { + for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); } } + if (len_append && addr_append) { + for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); } + } + if (end) { esp_rom_printf("\n"); } + portEXIT_CRITICAL_SAFE(&spinlock); #endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE } diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 8c31fa860e..74e1d58555 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -110,6 +110,11 @@ struct ext_funcs_t { #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag); + +enum { + BLE_LOG_INTERFACE_FLAG_CONTINUE = 0, + BLE_LOG_INTERFACE_FLAG_END, +}; #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED /* External functions or variables @@ -1481,20 +1486,22 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po #if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag) { - bool end = flag ? true : false; + bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END)); #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE esp_bt_controller_log_storage(len, addr, end); #else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; portENTER_CRITICAL_SAFE(&spinlock); esp_panic_handler_feed_wdts(); - for (int i = 0; i < len; i++) { - esp_rom_printf("%02x ", addr[i]); - } - if (end) { - esp_rom_printf("\n"); + if (len && addr) { + for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); } } + if (len_append && addr_append) { + for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); } + } + if (end) { esp_rom_printf("\n"); } + portEXIT_CRITICAL_SAFE(&spinlock); #endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE } diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index 86e8637cb7..22b1aaa3eb 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -102,6 +102,11 @@ struct ext_funcs_t { #if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag); + +enum { + BLE_LOG_INTERFACE_FLAG_CONTINUE = 0, + BLE_LOG_INTERFACE_FLAG_END, +}; #endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED /* External functions or variables ************************************************************************ @@ -1404,20 +1409,22 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po #if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag) { - bool end = flag ? true : false; + bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END)); #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE esp_bt_controller_log_storage(len, addr, end); #else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; portENTER_CRITICAL_SAFE(&spinlock); esp_panic_handler_feed_wdts(); - for (int i = 0; i < len; i++) { - esp_rom_printf("%02x ", addr[i]); - } - if (end) { - esp_rom_printf("\n"); + if (len && addr) { + for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); } } + if (len_append && addr_append) { + for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); } + } + if (end) { esp_rom_printf("\n"); } + portEXIT_CRITICAL_SAFE(&spinlock); #endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE }