Skip to content

Commit e2e8e7d

Browse files
author
Zhou Xiao
committed
fix(ble): add feed wdts during ble log dump for ESP32-C2
1 parent d7222cc commit e2e8e7d

File tree

1 file changed

+8
-3
lines changed
  • components/bt/controller/esp32c2

1 file changed

+8
-3
lines changed

components/bt/controller/esp32c2/bt.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,11 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
393393
portENTER_CRITICAL_SAFE(&spinlock);
394394
esp_panic_handler_feed_wdts();
395395
ble_log_async_output_dump_all(true);
396-
stop_write = true;
397396
esp_bt_ontroller_log_deinit();
398-
portEXIT_CRITICAL_SAFE(&spinlock);
397+
stop_write = true;
399398

400399
buffer = (const uint8_t *)mapped_ptr;
400+
esp_panic_handler_feed_wdts();
401401
if (is_filled) {
402402
read_index = next_erase_index;
403403
} else {
@@ -409,14 +409,15 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
409409
while (read_index != write_index) {
410410
esp_rom_printf("%02x ", buffer[read_index]);
411411
if (print_len > max_print_len) {
412-
vTaskDelay(2);
412+
esp_panic_handler_feed_wdts();
413413
print_len = 0;
414414
}
415415

416416
print_len++;
417417
read_index = (read_index + 1) % MAX_STORAGE_SIZE;
418418
}
419419
esp_rom_printf(":DUMP_END]\r\n");
420+
portEXIT_CRITICAL_SAFE(&spinlock);
420421
esp_partition_munmap(mmap_handle);
421422
err = esp_bt_controller_log_init(log_output_mode);
422423
assert(err == ESP_OK);
@@ -430,13 +431,17 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
430431
esp_bt_controller_log_storage(len, addr, end);
431432
#endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
432433
} else {
434+
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
435+
portENTER_CRITICAL_SAFE(&spinlock);
436+
esp_panic_handler_feed_wdts();
433437
for (int i = 0; i < len; i++) {
434438
esp_rom_printf("%02x ", addr[i]);
435439
}
436440

437441
if (end) {
438442
esp_rom_printf("\n");
439443
}
444+
portEXIT_CRITICAL_SAFE(&spinlock);
440445
}
441446
}
442447

0 commit comments

Comments
 (0)