From 56984e4eac00f30ee10a574a6675451fd14cd444 Mon Sep 17 00:00:00 2001 From: zwl Date: Tue, 23 Jul 2024 17:29:26 +0800 Subject: [PATCH] fix(ble): fixed wdt issue when print key controller info on ESP32-C6 and ESP32-H2 --- components/bt/controller/esp32c6/bt.c | 4 ++++ components/bt/controller/esp32h2/bt.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index c29f22bc02..e6168af6c5 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -1279,6 +1279,9 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b esp_bt_controller_log_storage(len, addr, end); #endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE } else { + portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; + portENTER_CRITICAL_SAFE(&spinlock); + esp_panic_handler_reconfigure_wdts(1000); for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); } @@ -1286,6 +1289,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b if (end) { esp_rom_printf("\n"); } + portEXIT_CRITICAL_SAFE(&spinlock); } } diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index 3311b4eb53..f921fa910a 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -1247,6 +1247,9 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b esp_bt_controller_log_storage(len, addr, end); #endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE } else { + portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; + portENTER_CRITICAL_SAFE(&spinlock); + esp_panic_handler_reconfigure_wdts(1000); for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); } @@ -1254,6 +1257,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b if (end) { esp_rom_printf("\n"); } + portEXIT_CRITICAL_SAFE(&spinlock); } }