From ee48ef2167a2a060022a0d052f8bd79a2b347345 Mon Sep 17 00:00:00 2001 From: Zhou Xiao Date: Mon, 28 Jul 2025 14:09:17 +0800 Subject: [PATCH 1/9] change(ble): [AUTO_MR] Update lib_esp32h2 to 499c41fb --- 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 b83a28f797..98192fac64 160000 --- a/components/bt/controller/lib_esp32h2/esp32h2-bt-lib +++ b/components/bt/controller/lib_esp32h2/esp32h2-bt-lib @@ -1 +1 @@ -Subproject commit b83a28f7978625d20147f8999aac53a08420bf7a +Subproject commit 98192fac643e31b1c039bac663bbcc5deb82314b From 7b921c71b3dd656fa47f9dd6eb5960f37ef58ddf Mon Sep 17 00:00:00 2001 From: Zhou Xiao Date: Mon, 28 Jul 2025 14:09:17 +0800 Subject: [PATCH 2/9] change(ble): [AUTO_MR] Update lib_esp32c5 to 499c41fb --- 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 22c25e99a8..0850d4f6c7 160000 --- a/components/bt/controller/lib_esp32c5/esp32c5-bt-lib +++ b/components/bt/controller/lib_esp32c5/esp32c5-bt-lib @@ -1 +1 @@ -Subproject commit 22c25e99a8fa61b5fc1ed19df9bbb60e10bb154d +Subproject commit 0850d4f6c7f60b1c9123c54d47b98d40849cfd5b From f2741f193285594495c4afac18ad5eafc8925598 Mon Sep 17 00:00:00 2001 From: Zhou Xiao Date: Mon, 28 Jul 2025 14:09:18 +0800 Subject: [PATCH 3/9] change(ble): [AUTO_MR] Update lib_esp32c6 to 499c41fb --- 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 f68cbf2768..f912ebc985 160000 --- a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib +++ b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib @@ -1 +1 @@ -Subproject commit f68cbf2768b4177794e9938e51221b2744c336b3 +Subproject commit f912ebc985b1e1f3155432fc2a74a0adfa0bdade From 0a7660d0f3e9e8df2b2f639bb3674a9e5e894a5e Mon Sep 17 00:00:00 2001 From: Zhou Xiao Date: Mon, 28 Jul 2025 14:09:18 +0800 Subject: [PATCH 4/9] change(ble): [AUTO_MR] Update lib_esp32c2 to 4556045f --- 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 68d2b55c99..d5486911e7 160000 --- a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib +++ b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib @@ -1 +1 @@ -Subproject commit 68d2b55c99c5fad51dcc6c269464a6adb59d0206 +Subproject commit d5486911e736aa829b834321f0587d75ab292b05 From ac6acf36293b8a3ef192477fd51e535f6171e32c Mon Sep 17 00:00:00 2001 From: Zhou Xiao Date: Mon, 28 Jul 2025 14:09:21 +0800 Subject: [PATCH 5/9] change(ble): [AUTO_MR] updated rom linker script for ESP32-C2 --- .../esp32c2/ld/esp32c2.rom.ble-eco4.ld | 60 +++++++++---------- .../esp_rom/esp32c2/ld/esp32c2.rom.ble.ld | 50 ++++++++-------- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld index 52b67bf7a4..bdd9c234a3 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld @@ -32,9 +32,9 @@ r_ble_controller_get_rom_compile_version = 0x40000ac4; //r_ble_hci_ram_hs_cmd_tx = 0x40000acc; //r_ble_hci_ram_ll_acl_tx = 0x40000ad0; //r_ble_hci_ram_ll_evt_tx = 0x40000ad4; -r_ble_hci_ram_reset = 0x40000ad8; -r_ble_hci_ram_set_acl_free_cb = 0x40000adc; -r_ble_hci_trans_acl_buf_alloc = 0x40000ae0; +//r_ble_hci_ram_reset = 0x40000ad8; +//r_ble_hci_ram_set_acl_free_cb = 0x40000adc; +//r_ble_hci_trans_acl_buf_alloc = 0x40000ae0; r_ble_hci_trans_buf_alloc = 0x40000ae4; r_ble_hci_trans_buf_free = 0x40000ae8; r_ble_hci_trans_cfg_hs = 0x40000aec; @@ -42,30 +42,30 @@ r_ble_hci_trans_cfg_ll = 0x40000af0; r_ble_hci_trans_deinit = 0x40000af4; //r_ble_hci_trans_env_init = 0x40000af8; //r_ble_hci_trans_init = 0x40000afc; -r_ble_hci_uart_acl_tx = 0x40000b00; -r_ble_hci_uart_cmdevt_tx = 0x40000b04; -r_ble_hci_uart_config = 0x40000b08; -r_ble_hci_uart_free_pkt = 0x40000b0c; -r_ble_hci_uart_hs_acl_tx = 0x40000b10; -r_ble_hci_uart_hs_cmd_tx = 0x40000b14; -r_ble_hci_uart_ll_acl_tx = 0x40000b18; -r_ble_hci_uart_ll_evt_tx = 0x40000b1c; -r_ble_hci_uart_rx_acl = 0x40000b20; -r_ble_hci_uart_rx_char = 0x40000b24; -r_ble_hci_uart_rx_cmd = 0x40000b28; -r_ble_hci_uart_rx_evt = 0x40000b2c; -r_ble_hci_uart_rx_evt_cb = 0x40000b30; -r_ble_hci_uart_rx_le_evt = 0x40000b34; -r_ble_hci_uart_rx_pkt_type = 0x40000b38; -r_ble_hci_uart_rx_skip_acl = 0x40000b3c; -r_ble_hci_uart_rx_skip_cmd = 0x40000b40; -r_ble_hci_uart_rx_skip_evt = 0x40000b44; -r_ble_hci_uart_rx_sync_loss = 0x40000b48; -r_ble_hci_uart_set_acl_free_cb = 0x40000b4c; -r_ble_hci_uart_sync_lost = 0x40000b50; -r_ble_hci_uart_trans_reset = 0x40000b54; -r_ble_hci_uart_tx_char = 0x40000b58; -r_ble_hci_uart_tx_pkt_type = 0x40000b5c; +//r_ble_hci_uart_acl_tx = 0x40000b00; +//r_ble_hci_uart_cmdevt_tx = 0x40000b04; +//r_ble_hci_uart_config = 0x40000b08; +//r_ble_hci_uart_free_pkt = 0x40000b0c; +//r_ble_hci_uart_hs_acl_tx = 0x40000b10; +//r_ble_hci_uart_hs_cmd_tx = 0x40000b14; +//r_ble_hci_uart_ll_acl_tx = 0x40000b18; +//r_ble_hci_uart_ll_evt_tx = 0x40000b1c; +//r_ble_hci_uart_rx_acl = 0x40000b20; +//r_ble_hci_uart_rx_char = 0x40000b24; +//r_ble_hci_uart_rx_cmd = 0x40000b28; +//r_ble_hci_uart_rx_evt = 0x40000b2c; +//r_ble_hci_uart_rx_evt_cb = 0x40000b30; +//r_ble_hci_uart_rx_le_evt = 0x40000b34; +//r_ble_hci_uart_rx_pkt_type = 0x40000b38; +//r_ble_hci_uart_rx_skip_acl = 0x40000b3c; +//r_ble_hci_uart_rx_skip_cmd = 0x40000b40; +//r_ble_hci_uart_rx_skip_evt = 0x40000b44; +//r_ble_hci_uart_rx_sync_loss = 0x40000b48; +//r_ble_hci_uart_set_acl_free_cb = 0x40000b4c; +//r_ble_hci_uart_sync_lost = 0x40000b50; +//r_ble_hci_uart_trans_reset = 0x40000b54; +//r_ble_hci_uart_tx_char = 0x40000b58; +//r_ble_hci_uart_tx_pkt_type = 0x40000b5c; r_ble_hw_driver_deinit = 0x40000b60; //r_ble_hw_driver_env_init = 0x40000b64; r_ble_hw_encrypt_block = 0x40000b68; @@ -983,8 +983,8 @@ r_mem_pullup_obj = 0x400019b8; r_mem_split_frag = 0x400019bc; r_os_cputime_get32 = 0x400019c0; r_os_cputime_ticks_to_usecs = 0x400019c4; -r_os_cputime_timer_init = 0x400019c8; -r_os_cputime_timer_relative = 0x400019cc; +//r_os_cputime_timer_init = 0x400019c8; +//r_os_cputime_timer_relative = 0x400019cc; r_os_cputime_timer_start = 0x400019d0; r_os_cputime_timer_stop = 0x400019d4; r_os_cputime_usecs_to_ticks = 0x400019d8; @@ -1153,7 +1153,7 @@ r_ble_ll_scan_env_deinit = 0x40002f0c; r_ble_ll_sync_env_deinit = 0x40002f10; r_ble_lll_rfmgmt_env_deinit = 0x40002f14; r_hal_timer_env_deinit = 0x40002f18; -r_ble_ll_env_deinit = 0x40002f1c; +//r_ble_ll_env_deinit = 0x40002f1c; r_ble_ll_generic_data_deinit = 0x40002f20; //r_ble_hci_trans_env_deinit = 0x40002f24; //r_ble_ll_conn_callout_env_init = 0x40002f28; diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld index 9673a3aa29..99e23119b4 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld @@ -27,34 +27,34 @@ bt_rf_coex_dft_pti_get_default = 0x40000ab4; bt_rf_coex_hooks_p_set = 0x40000ab8; r__os_mbuf_copypkthdr = 0x40000abc; r_ble_controller_get_rom_compile_version = 0x40000ac4; -r_ble_hci_ram_reset = 0x40000ad8; -r_ble_hci_ram_set_acl_free_cb = 0x40000adc; -r_ble_hci_trans_acl_buf_alloc = 0x40000ae0; +//r_ble_hci_ram_reset = 0x40000ad8; +//r_ble_hci_ram_set_acl_free_cb = 0x40000adc; +//r_ble_hci_trans_acl_buf_alloc = 0x40000ae0; r_ble_hci_trans_buf_alloc = 0x40000ae4; r_ble_hci_trans_buf_free = 0x40000ae8; r_ble_hci_trans_cfg_hs = 0x40000aec; r_ble_hci_trans_cfg_ll = 0x40000af0; //r_ble_hci_trans_init = 0x40000afc; -r_ble_hci_uart_acl_tx = 0x40000b00; -r_ble_hci_uart_cmdevt_tx = 0x40000b04; -r_ble_hci_uart_config = 0x40000b08; -r_ble_hci_uart_free_pkt = 0x40000b0c; -r_ble_hci_uart_rx_acl = 0x40000b20; -r_ble_hci_uart_rx_char = 0x40000b24; -r_ble_hci_uart_rx_cmd = 0x40000b28; -r_ble_hci_uart_rx_evt = 0x40000b2c; -r_ble_hci_uart_rx_evt_cb = 0x40000b30; -r_ble_hci_uart_rx_le_evt = 0x40000b34; -r_ble_hci_uart_rx_pkt_type = 0x40000b38; -r_ble_hci_uart_rx_skip_acl = 0x40000b3c; -r_ble_hci_uart_rx_skip_cmd = 0x40000b40; -r_ble_hci_uart_rx_skip_evt = 0x40000b44; -r_ble_hci_uart_rx_sync_loss = 0x40000b48; -r_ble_hci_uart_set_acl_free_cb = 0x40000b4c; -r_ble_hci_uart_sync_lost = 0x40000b50; -r_ble_hci_uart_trans_reset = 0x40000b54; -r_ble_hci_uart_tx_char = 0x40000b58; -r_ble_hci_uart_tx_pkt_type = 0x40000b5c; +//r_ble_hci_uart_acl_tx = 0x40000b00; +//r_ble_hci_uart_cmdevt_tx = 0x40000b04; +//r_ble_hci_uart_config = 0x40000b08; +//r_ble_hci_uart_free_pkt = 0x40000b0c; +//r_ble_hci_uart_rx_acl = 0x40000b20; +//r_ble_hci_uart_rx_char = 0x40000b24; +//r_ble_hci_uart_rx_cmd = 0x40000b28; +//r_ble_hci_uart_rx_evt = 0x40000b2c; +//r_ble_hci_uart_rx_evt_cb = 0x40000b30; +//r_ble_hci_uart_rx_le_evt = 0x40000b34; +//r_ble_hci_uart_rx_pkt_type = 0x40000b38; +//r_ble_hci_uart_rx_skip_acl = 0x40000b3c; +//r_ble_hci_uart_rx_skip_cmd = 0x40000b40; +//r_ble_hci_uart_rx_skip_evt = 0x40000b44; +//r_ble_hci_uart_rx_sync_loss = 0x40000b48; +//r_ble_hci_uart_set_acl_free_cb = 0x40000b4c; +//r_ble_hci_uart_sync_lost = 0x40000b50; +//r_ble_hci_uart_trans_reset = 0x40000b54; +//r_ble_hci_uart_tx_char = 0x40000b58; +//r_ble_hci_uart_tx_pkt_type = 0x40000b5c; r_ble_hw_encrypt_block = 0x40000b68; r_ble_hw_get_public_addr = 0x40000b6c; r_ble_hw_get_static_addr = 0x40000b70; @@ -779,8 +779,8 @@ r_mem_malloc_mempool_gen = 0x400019b4; r_mem_pullup_obj = 0x400019b8; r_os_cputime_get32 = 0x400019c0; r_os_cputime_ticks_to_usecs = 0x400019c4; -r_os_cputime_timer_init = 0x400019c8; -r_os_cputime_timer_relative = 0x400019cc; +//r_os_cputime_timer_init = 0x400019c8; +//r_os_cputime_timer_relative = 0x400019cc; r_os_cputime_timer_start = 0x400019d0; r_os_cputime_timer_stop = 0x400019d4; r_os_cputime_usecs_to_ticks = 0x400019d8; From dc65875e5749586b4ca7c5581fa710e2e22e7048 Mon Sep 17 00:00:00 2001 From: zwl Date: Fri, 18 Jul 2025 20:37:26 +0800 Subject: [PATCH 6/9] feat(ble): add flash only param config api on ESP32-C6 --- components/bt/controller/esp32c6/bt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 40adeeef0d..5feac93941 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -160,8 +160,7 @@ extern void r_ble_rtc_wake_up_state_clr(void); extern int os_msys_init(void); extern void os_msys_deinit(void); #if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY -extern void r_ble_ll_scan_start_time_init_compensation(uint32_t init_compensation); -extern void r_priv_sdk_config_insert_proc_time_set(uint16_t insert_proc_time); +extern void esp_ble_controller_flash_only_param_config(void); #endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY #if CONFIG_FREERTOS_USE_TICKLESS_IDLE extern sleep_retention_entries_config_t *r_esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra); @@ -1208,8 +1207,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode) #endif // CONFIG_SW_COEXIST_ENABLE #if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY - r_ble_ll_scan_start_time_init_compensation(500); - r_priv_sdk_config_insert_proc_time_set(500); + esp_ble_controller_flash_only_param_config(); #endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY if (ble_stack_enable() != 0) { From 4c8258ca38c3cdafddb75d78dea11a75b91890bb Mon Sep 17 00:00:00 2001 From: zwl Date: Fri, 18 Jul 2025 20:39:30 +0800 Subject: [PATCH 7/9] feat(ble): add flash only param config api on ESP32-H2 --- components/bt/controller/esp32h2/bt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index e4f34c5935..86d3e6253d 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -146,8 +146,7 @@ extern void r_ble_rtc_wake_up_state_clr(void); extern int os_msys_init(void); extern void os_msys_deinit(void); #if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY -extern void r_ble_ll_scan_start_time_init_compensation(uint32_t init_compensation); -extern void r_priv_sdk_config_insert_proc_time_set(uint16_t insert_proc_time); +extern void esp_ble_controller_flash_only_param_config(void); #endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY #if CONFIG_FREERTOS_USE_TICKLESS_IDLE extern sleep_retention_entries_config_t *r_esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra); @@ -1132,8 +1131,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode) #endif // CONFIG_SW_COEXIST_ENABLE #if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY - r_ble_ll_scan_start_time_init_compensation(500); - r_priv_sdk_config_insert_proc_time_set(500); + esp_ble_controller_flash_only_param_config(); #endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY if (ble_stack_enable() != 0) { From 312de57214e08ea7139e0e33aebb0ec1a63a2de7 Mon Sep 17 00:00:00 2001 From: zwl Date: Fri, 18 Jul 2025 20:40:33 +0800 Subject: [PATCH 8/9] feat(ble): add flash only param config api on ESP32-C5 --- components/bt/controller/esp32c5/bt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/bt/controller/esp32c5/bt.c b/components/bt/controller/esp32c5/bt.c index e928a3656b..5bb7b0bf62 100644 --- a/components/bt/controller/esp32c5/bt.c +++ b/components/bt/controller/esp32c5/bt.c @@ -147,8 +147,7 @@ extern void r_ble_rtc_wake_up_state_clr(void); extern int os_msys_init(void); extern void os_msys_deinit(void); #if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY -extern void r_ble_ll_scan_start_time_init_compensation(uint32_t init_compensation); -extern void r_priv_sdk_config_insert_proc_time_set(uint16_t insert_proc_time); +extern void esp_ble_controller_flash_only_param_config(void); #endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY #if CONFIG_FREERTOS_USE_TICKLESS_IDLE extern sleep_retention_entries_config_t *r_esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra); @@ -1137,8 +1136,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode) #endif // CONFIG_SW_COEXIST_ENABLE #if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY - r_ble_ll_scan_start_time_init_compensation(500); - r_priv_sdk_config_insert_proc_time_set(500); + esp_ble_controller_flash_only_param_config(); #endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY if (ble_stack_enable() != 0) { From f99389e00da1c12971e654037ed009bb172331c9 Mon Sep 17 00:00:00 2001 From: Zhou Xiao Date: Tue, 22 Jul 2025 18:21:20 +0800 Subject: [PATCH 9/9] feat(ble): ble log spi out dev phase 5 * supported ts sync for light sleep * removed controller event queue dependency * supported get lc ts for ESP32-C3/S3 * optimized ble log spi out code size --- components/bt/common/Kconfig.in | 7 - .../bt/common/ble_log/ble_log_spi_out.c | 289 +++++++----------- .../ble_log/include/ble_log/ble_log_spi_out.h | 1 + 3 files changed, 109 insertions(+), 188 deletions(-) diff --git a/components/bt/common/Kconfig.in b/components/bt/common/Kconfig.in index 5b1de7fdda..d4beedb0c2 100644 --- a/components/bt/common/Kconfig.in +++ b/components/bt/common/Kconfig.in @@ -132,13 +132,6 @@ config BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM help GPIO number of SYNC IO -config BT_BLE_LOG_SPI_OUT_TS_SYNC_SLEEP_SUPPORT - bool "Enable ble log & logic analyzer log time sync sleep support" - depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED - default y - help - Enable ble log & logic analyzer log time sync sleep support - config BT_BLE_LOG_SPI_OUT_FLUSH_TIMER_ENABLED bool "Enable periodic buffer flush out" depends on BT_BLE_LOG_SPI_OUT_ENABLED diff --git a/components/bt/common/ble_log/ble_log_spi_out.c b/components/bt/common/ble_log/ble_log_spi_out.c index e1c6a278cb..60247f4953 100644 --- a/components/bt/common/ble_log/ble_log_spi_out.c +++ b/components/bt/common/ble_log/ble_log_spi_out.c @@ -7,9 +7,6 @@ #if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED -// Private includes -#include "esp_bt.h" - // sdkconfig defines #define SPI_OUT_UL_TASK_BUF_SIZE CONFIG_BT_BLE_LOG_SPI_OUT_UL_TASK_BUF_SIZE #define SPI_OUT_LL_ENABLED CONFIG_BT_BLE_LOG_SPI_OUT_LL_ENABLED @@ -21,7 +18,6 @@ #define SPI_OUT_CS_IO_NUM CONFIG_BT_BLE_LOG_SPI_OUT_CS_IO_NUM #define SPI_OUT_TS_SYNC_ENABLED CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED #define SPI_OUT_SYNC_IO_NUM CONFIG_BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM -#define SPI_OUT_TS_SYNC_SLEEP_SUPPORT CONFIG_BT_BLE_LOG_SPI_OUT_TS_SYNC_SLEEP_SUPPORT #define SPI_OUT_FLUSH_TIMER_ENABLED CONFIG_BT_BLE_LOG_SPI_OUT_FLUSH_TIMER_ENABLED #define SPI_OUT_FLUSH_TIMEOUT_US (CONFIG_BT_BLE_LOG_SPI_OUT_FLUSH_TIMEOUT * 1000) #define SPI_OUT_LE_AUDIO_ENABLED CONFIG_BT_BLE_LOG_SPI_OUT_LE_AUDIO_ENABLED @@ -44,6 +40,8 @@ #define SPI_OUT_TRANS_ITVL_MIN_US (30) #define SPI_OUT_LOG_STR_BUF_SIZE (100) #define SPI_OUT_MALLOC(size) heap_caps_malloc(size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) +#define SPI_OUT_TASK_PRIORITY (ESP_TASK_PRIO_MAX - 1) +#define SPI_OUT_TASK_STACK_SIZE (1024) #if SPI_OUT_TS_SYNC_ENABLED #define SPI_OUT_TS_SYNC_TIMEOUT_MS (1000) @@ -167,11 +165,11 @@ enum { }; // Private variables +static TaskHandle_t spi_out_task_handle = NULL; static bool spi_out_inited = false; static bool spi_out_enabled = false; static spi_device_handle_t spi_handle = NULL; static uint32_t last_tx_done_ts = 0; -static uint32_t last_tx_done_os_ts = 0; #if SPI_OUT_LL_ENABLED static bool ll_log_inited = false; @@ -185,10 +183,6 @@ static uint32_t ll_ev_flags = 0; static bool ts_sync_inited = false; static bool ts_sync_enabled = false; static ts_sync_data_t ts_sync_data = {0}; - -#if !SPI_OUT_TS_SYNC_SLEEP_SUPPORT -static esp_timer_handle_t ts_sync_timer = NULL; -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT #endif // SPI_OUT_TS_SYNC_ENABLED #if SPI_OUT_FLUSH_TIMER_ENABLED @@ -214,29 +208,25 @@ static bool spi_out_log_cb_write(spi_out_log_cb_t *log_cb, const uint8_t *addr, bool with_checksum); static void spi_out_log_cb_write_loss(spi_out_log_cb_t *log_cb); static void spi_out_log_cb_dump(spi_out_log_cb_t *log_cb); + +#if SPI_OUT_HOST_ENABLED || SPI_OUT_MESH_ENABLED || SPI_OUT_HCI_ENABLED || SPI_OUT_LE_AUDIO_ENABLED static bool spi_out_get_task_mapping(task_map_t *map, size_t num, spi_out_log_cb_t **log_cb, uint8_t **str_buf); +#endif // SPI_OUT_HOST_ENABLED || SPI_OUT_MESH_ENABLED || SPI_OUT_HCI_ENABLED || SPI_OUT_LE_AUDIO_ENABLED + static void spi_out_log_flush(void); static void spi_out_write_hex(spi_out_log_cb_t *log_cb, uint8_t source, const uint8_t *addr, uint16_t len, bool with_ts); + +#if SPI_OUT_HOST_ENABLED || SPI_OUT_MESH_ENABLED static int spi_out_write_str(uint8_t *str_buf, const char *format, va_list args, int offset); +#endif // SPI_OUT_HOST_ENABLED || SPI_OUT_MESH_ENABLED #if SPI_OUT_LL_ENABLED static int spi_out_ll_log_init(void); static void spi_out_ll_log_deinit(void); static void spi_out_ll_log_flush(void); - -#if defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32C5) ||\ - defined(CONFIG_IDF_TARGET_ESP32C61) || defined(CONFIG_IDF_TARGET_ESP32H21) -extern void r_ble_log_simple_put_ev(void); -#define SPI_OUT_LL_PUT_EV r_ble_log_simple_put_ev() -#elif defined(CONFIG_IDF_TARGET_ESP32C2) -extern void ble_log_simple_put_ev(void); -#define SPI_OUT_LL_PUT_EV ble_log_simple_put_ev() -#else -#define SPI_OUT_LL_PUT_EV -#endif #endif // SPI_OUT_LL_ENABLED #if SPI_OUT_TS_SYNC_ENABLED @@ -252,13 +242,13 @@ extern uint32_t r_ble_lll_timer_current_tick_get(void); #elif defined(CONFIG_IDF_TARGET_ESP32C2) extern uint32_t r_os_cputime_get32(void); #define SPI_OUT_GET_LC_TIME r_os_cputime_get32() +#elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) +extern uint32_t lld_read_clock_us(void); +#define SPI_OUT_GET_LC_TIME lld_read_clock_us() #else #define SPI_OUT_GET_LC_TIME esp_timer_get_time() #endif -#if !SPI_OUT_TS_SYNC_SLEEP_SUPPORT -static void esp_timer_cb_ts_sync(void); -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT #endif // SPI_OUT_TS_SYNC_ENABLED // Private templates @@ -279,11 +269,9 @@ static void esp_timer_cb_ts_sync(void); #define LOG_MODULE_DUMP(ID) \ do { \ if (LOG_MODULE_INIT_FLAG(ID)) { \ - esp_rom_printf("[DUMP_START:\n"); \ for (int i = 0; i < LOG_MODULE_CB_CNT(ID); i++) { \ spi_out_log_cb_dump(LOG_MODULE_CB(ID, i)); \ } \ - esp_rom_printf("\n:DUMP_END]\n"); \ } \ } while (0) @@ -406,6 +394,20 @@ DECLARE_LOG_MODULE(mesh, LOG_CB_TYPE_MESH, SPI_OUT_MESH_BUF_SIZE, #define SPI_OUT_FRAME_TAIL_LEN (sizeof(uint32_t)) #define SPI_OUT_FRAME_OVERHEAD (SPI_OUT_FRAME_HEAD_LEN + SPI_OUT_FRAME_TAIL_LEN) #define SPI_OUT_GET_FRAME_SN(VAR) __atomic_fetch_add(VAR, 1, __ATOMIC_RELAXED) +#define SPI_OUT_TASK_NOTIFY_FROM_ISR \ + do { \ + if (spi_out_task_handle) { \ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; \ + vTaskNotifyGiveFromISR(spi_out_task_handle, &xHigherPriorityTaskWoken); \ + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); \ + } \ + } while (0) +#define SPI_OUT_TASK_NOTIFY_FROM_TASK \ + do { \ + if (spi_out_task_handle) { \ + xTaskNotifyGive(spi_out_task_handle); \ + } \ + } while (0) // Private functions static int spi_out_init_trans(spi_out_trans_cb_t **trans_cb, uint16_t buf_size) @@ -449,7 +451,6 @@ static void spi_out_deinit_trans(spi_out_trans_cb_t **trans_cb) IRAM_ATTR static void spi_out_tx_done_cb(spi_transaction_t *ret_trans) { last_tx_done_ts = esp_timer_get_time(); - last_tx_done_os_ts = pdTICKS_TO_MS(xTaskGetTickCountFromISR()); spi_out_trans_cb_t *trans_cb = (spi_out_trans_cb_t *)ret_trans->user; trans_cb->length = 0; trans_cb->flag = TRANS_CB_FLAG_AVAILABLE; @@ -479,6 +480,7 @@ IRAM_ATTR static inline void spi_out_append_trans(spi_out_trans_cb_t *trans_cb) if (spi_device_queue_trans(spi_handle, &(trans_cb->trans), 0) != ESP_OK) { goto recycle; } + SPI_OUT_TASK_NOTIFY_FROM_ISR; return; recycle: @@ -660,6 +662,7 @@ static void spi_out_update_task_mapping(int idx, void *ptr) entry->task_handle = NULL; } +#if SPI_OUT_HOST_ENABLED || SPI_OUT_MESH_ENABLED || SPI_OUT_HCI_ENABLED || SPI_OUT_LE_AUDIO_ENABLED static bool spi_out_get_task_mapping(task_map_t *map, size_t num, spi_out_log_cb_t **log_cb, uint8_t **str_buf) { @@ -707,16 +710,15 @@ static bool spi_out_get_task_mapping(task_map_t *map, size_t num, portEXIT_CRITICAL_SAFE(&spinlock); return ret; } +#endif // SPI_OUT_HOST_ENABLED || SPI_OUT_MESH_ENABLED || SPI_OUT_HCI_ENABLED || SPI_OUT_LE_AUDIO_ENABLED static void spi_out_log_flush(void) { LOG_MODULE_FLUSH(ul)(); #if SPI_OUT_LL_ENABLED - if (esp_bt_controller_get_status() >= ESP_BT_CONTROLLER_STATUS_INITED) { - ll_ev_flags |= BIT(LL_EV_FLAG_FLUSH_LOG); - SPI_OUT_LL_PUT_EV; - } + ll_ev_flags |= BIT(LL_EV_FLAG_FLUSH_LOG); + SPI_OUT_TASK_NOTIFY_FROM_TASK; #endif // SPI_OUT_LL_ENABLED #if SPI_OUT_LE_AUDIO_ENABLED @@ -765,6 +767,7 @@ static void spi_out_write_hex(spi_out_log_cb_t *log_cb, uint8_t source, spi_out_log_cb_write_loss(log_cb); } +#if SPI_OUT_HOST_ENABLED || SPI_OUT_MESH_ENABLED static int spi_out_write_str(uint8_t *str_buf, const char *format, va_list args, int offset) { int len = vsnprintf((char *)(str_buf + offset), SPI_OUT_LOG_STR_BUF_SIZE - offset, format, args); @@ -779,6 +782,7 @@ static int spi_out_write_str(uint8_t *str_buf, const char *format, va_list args, } return len; } +#endif // SPI_OUT_HOST_ENABLED || SPI_OUT_MESH_ENABLED #if SPI_OUT_LL_ENABLED static int spi_out_ll_log_init(void) @@ -825,24 +829,19 @@ static void spi_out_ll_log_deinit(void) return; } -// Context: LL task static void spi_out_ll_log_flush(void) { if (!ll_log_inited) { return; } - // Flush task log and hci log buffer - spi_out_log_cb_flush_trans(ll_task_log_cb); - spi_out_log_cb_flush_trans(ll_hci_log_cb); - - // Race condition for isr log buffer portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; portENTER_CRITICAL_SAFE(&spinlock); + spi_out_log_cb_flush_trans(ll_task_log_cb); + spi_out_log_cb_flush_trans(ll_hci_log_cb); spi_out_log_cb_flush_trans(ll_isr_log_cb); portEXIT_CRITICAL_SAFE(&spinlock); - // Note: Save SPI transfer start time spi_out_log_cb_append_trans(ll_task_log_cb); spi_out_log_cb_append_trans(ll_hci_log_cb); spi_out_log_cb_append_trans(ll_isr_log_cb); @@ -856,17 +855,6 @@ static int spi_out_ts_sync_init(void) return 0; } -#if !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - // Initialize sync timer - esp_timer_create_args_t timer_args = { - .callback = (esp_timer_cb_t)esp_timer_cb_ts_sync, - .dispatch_method = ESP_TIMER_TASK - }; - if (esp_timer_create(&timer_args, &ts_sync_timer) != ESP_OK) { - goto timer_init_failed; - } -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - // Initialize sync IO gpio_config_t io_conf = { .intr_type = GPIO_INTR_DISABLE, @@ -876,72 +864,34 @@ static int spi_out_ts_sync_init(void) .pull_up_en = 0 }; if (gpio_config(&io_conf) != ESP_OK) { - goto gpio_init_failed; + goto failed; } // Initialization done ts_sync_inited = true; return 0; -gpio_init_failed: -#if !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - esp_timer_delete(ts_sync_timer); - ts_sync_timer = NULL; -timer_init_failed: -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT +failed: return -1; } static void spi_out_ts_sync_deinit(void) { - if (!ts_sync_inited) { - return; - } + ts_sync_inited = false; -#if !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - // Deinitialize timestamp synchronizer - esp_timer_stop(ts_sync_timer); - esp_timer_delete(ts_sync_timer); - ts_sync_timer = NULL; -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - - // Deinitialize sync IO spi_out_ts_sync_enable(false); gpio_reset_pin(SPI_OUT_SYNC_IO_NUM); - - // Deinitialization done - ts_sync_inited = false; - return; } static void spi_out_ts_sync_enable(bool enable) { // Update ts sync status ts_sync_enabled = enable; - if (enable) { -#if !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - // Start timestamp sync timer - if (ts_sync_timer) { - if (!esp_timer_is_active(ts_sync_timer)) { - esp_timer_start_periodic(ts_sync_timer, SPI_OUT_TS_SYNC_TIMEOUT_US); - } - } -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - } else { -#if !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - // Stop timestamp sync timer - if (ts_sync_timer) { - if (esp_timer_is_active(ts_sync_timer)) { - esp_timer_stop(ts_sync_timer); - } - } -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT - if (!ts_sync_data.io_level) { - gpio_set_level(SPI_OUT_SYNC_IO_NUM, 1); - } + if (!enable && !ts_sync_data.io_level) { + gpio_set_level(SPI_OUT_SYNC_IO_NUM, 1); } ts_sync_data.io_level = 0; - gpio_set_level(SPI_OUT_SYNC_IO_NUM, (uint32_t)ts_sync_data.io_level); + gpio_set_level(SPI_OUT_SYNC_IO_NUM, 0); } static void spi_out_ts_sync_toggle(void) @@ -964,20 +914,29 @@ static void spi_out_ts_sync_toggle(void) portEXIT_CRITICAL(&spinlock); // Exit critical } - -#if !SPI_OUT_TS_SYNC_SLEEP_SUPPORT -// CRITICAL: This function is called in ESP Timer task -static void esp_timer_cb_ts_sync(void) -{ - spi_out_ts_sync_toggle(); - ble_log_spi_out_write(BLE_LOG_SPI_OUT_SOURCE_SYNC, (const uint8_t *)&ts_sync_data, - sizeof(ts_sync_data_t)); -} -#else - -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT #endif // SPI_OUT_TS_SYNC_ENABLED +static void spi_out_task(void *pvParameters) +{ + while (1) { + if (ulTaskNotifyTake(pdTRUE, portMAX_DELAY)) { +#if SPI_OUT_LL_ENABLED + ble_log_spi_out_ll_log_ev_proc(); +#endif // SPI_OUT_LL_ENABLED +#if SPI_OUT_TS_SYNC_ENABLED + if (ts_sync_inited && ts_sync_enabled) { + uint32_t curr_os_ts = pdTICKS_TO_MS(xTaskGetTickCount()); + if ((curr_os_ts - ts_sync_data.os_ts) > SPI_OUT_TS_SYNC_TIMEOUT_MS) { + spi_out_ts_sync_toggle(); + ble_log_spi_out_write(BLE_LOG_SPI_OUT_SOURCE_SYNC, + (const uint8_t *)&ts_sync_data, sizeof(ts_sync_data_t)); + } + } +#endif // SPI_OUT_TS_SYNC_ENABLED + } + } +} + // Public functions int ble_log_spi_out_init(void) { @@ -1008,49 +967,49 @@ int ble_log_spi_out_init(void) .flags = SPI_DEVICE_NO_RETURN_RESULT }; if (spi_bus_initialize(SPI_OUT_BUS, &bus_config, SPI_DMA_CH_AUTO) != ESP_OK) { - goto spi_bus_init_failed; + goto failed; } if (spi_bus_add_device(SPI_OUT_BUS, &dev_config, &spi_handle) != ESP_OK) { - goto spi_device_add_failed; + goto failed; } if (LOG_MODULE_INIT(ul)() != 0) { - goto ul_log_init_failed; + goto failed; } #if SPI_OUT_LL_ENABLED if (spi_out_ll_log_init() != 0) { - goto ll_log_init_failed; + goto failed; } #endif // SPI_OUT_LL_ENABLED #if SPI_OUT_TS_SYNC_ENABLED if (spi_out_ts_sync_init() != 0) { - goto ts_sync_init_failed; + goto failed; } #endif // SPI_OUT_TS_SYNC_ENABLED #if SPI_OUT_LE_AUDIO_ENABLED if (LOG_MODULE_INIT(le_audio)() != 0) { - goto le_audio_init_failed; + goto failed; } #endif // SPI_OUT_LE_AUDIO_ENABLED #if SPI_OUT_HOST_ENABLED if (LOG_MODULE_INIT(host)() != 0) { - goto host_init_failed; + goto failed; } #endif // SPI_OUT_HOST_ENABLED #if SPI_OUT_HCI_ENABLED if (LOG_MODULE_INIT(hci)() != 0) { - goto hci_init_failed; + goto failed; } #endif // SPI_OUT_HCI_ENABLED #if SPI_OUT_MESH_ENABLED if (LOG_MODULE_INIT(mesh)() != 0) { - goto mesh_init_failed; + goto failed; } #endif // SPI_OUT_MESH_ENABLED @@ -1060,10 +1019,17 @@ int ble_log_spi_out_init(void) .dispatch_method = ESP_TIMER_TASK }; if (esp_timer_create(&timer_args, &flush_timer) != ESP_OK) { - goto timer_init_failed; + goto failed; } #endif // SPI_OUT_FLUSH_TIMER_ENABLED + BaseType_t ret = xTaskCreate(spi_out_task, "BLELogSPIOut", + SPI_OUT_TASK_STACK_SIZE, NULL, + SPI_OUT_TASK_PRIORITY, &spi_out_task_handle); + if (ret == pdFALSE) { + goto failed; + } + // Initialization done spi_out_inited = true; spi_out_enabled = true; @@ -1073,68 +1039,39 @@ int ble_log_spi_out_init(void) #endif // SPI_OUT_FLUSH_TIMER_ENABLED return 0; -#if SPI_OUT_FLUSH_TIMER_ENABLED -timer_init_failed: -#endif // SPI_OUT_FLUSH_TIMER_ENABLED -#if SPI_OUT_MESH_ENABLED - LOG_MODULE_DEINIT(mesh)(); -mesh_init_failed: -#endif // SPI_OUT_MESH_ENABLED -#if SPI_OUT_HCI_ENABLED - LOG_MODULE_DEINIT(hci)(); -hci_init_failed: -#endif // SPI_OUT_HCI_ENABLED -#if SPI_OUT_HOST_ENABLED - LOG_MODULE_DEINIT(host)(); -host_init_failed: -#endif // SPI_OUT_HOST_ENABLED -#if SPI_OUT_LE_AUDIO_ENABLED - LOG_MODULE_DEINIT(le_audio)(); -le_audio_init_failed: -#endif // SPI_OUT_LE_AUDIO_ENABLED -#if SPI_OUT_TS_SYNC_ENABLED - spi_out_ts_sync_deinit(); -ts_sync_init_failed: -#endif // SPI_OUT_TS_SYNC_ENABLED -#if SPI_OUT_LL_ENABLED - spi_out_ll_log_deinit(); -ll_log_init_failed: -#endif // SPI_OUT_LL_ENABLED - LOG_MODULE_DEINIT(ul)(); -ul_log_init_failed: - spi_bus_remove_device(spi_handle); - spi_handle = NULL; -spi_device_add_failed: - spi_bus_free(SPI_OUT_BUS); -spi_bus_init_failed: +failed: + ble_log_spi_out_deinit(); return -1; } void ble_log_spi_out_deinit(void) { - // Avoid double deinit - if (!spi_out_inited) { - return; - } - - // Reset init flag spi_out_inited = false; spi_out_enabled = false; + if (spi_out_task_handle) { + vTaskDelete(spi_out_task_handle); + spi_out_task_handle = NULL; + } + #if SPI_OUT_FLUSH_TIMER_ENABLED - esp_timer_stop(flush_timer); - esp_timer_delete(flush_timer); - flush_timer = NULL; + if (flush_timer) { + esp_timer_stop(flush_timer); + esp_timer_delete(flush_timer); + flush_timer = NULL; + } #endif // SPI_OUT_FLUSH_TIMER_ENABLED - // Drain all queued transactions - assert(spi_device_acquire_bus(spi_handle, portMAX_DELAY) == ESP_OK); - spi_device_release_bus(spi_handle); + if (spi_handle) { + // Drain all queued transactions + assert(spi_device_acquire_bus(spi_handle, portMAX_DELAY) == ESP_OK); + spi_device_release_bus(spi_handle); - // Remove SPI master - spi_bus_remove_device(spi_handle); - spi_handle = NULL; - spi_bus_free(SPI_OUT_BUS); + // Remove SPI master + spi_bus_remove_device(spi_handle); + spi_handle = NULL; + spi_bus_free(SPI_OUT_BUS); + } #if SPI_OUT_TS_SYNC_ENABLED spi_out_ts_sync_deinit(); @@ -1229,21 +1166,9 @@ IRAM_ATTR void ble_log_spi_out_ll_write(uint32_t len, const uint8_t *addr, uint3 if (need_append) { if (in_isr) { ll_ev_flags |= BIT(LL_EV_FLAG_ISR_APPEND); - SPI_OUT_LL_PUT_EV; + SPI_OUT_TASK_NOTIFY_FROM_ISR; } else { spi_out_log_cb_append_trans(log_cb); - -#if SPI_OUT_TS_SYNC_SLEEP_SUPPORT - if (ts_sync_inited && ts_sync_enabled) { - if (last_tx_done_os_ts >= (SPI_OUT_TS_SYNC_TIMEOUT_MS + ts_sync_data.os_ts)) { - if (spi_out_log_cb_check_trans(ll_task_log_cb, sizeof(ts_sync_data_t), &need_append)) { - spi_out_ts_sync_toggle(); - spi_out_log_cb_write(ll_task_log_cb, (const uint8_t *)&ts_sync_data, - sizeof(ts_sync_data_t), NULL, 0, BLE_LOG_SPI_OUT_SOURCE_SYNC, true); - } - } - } -#endif // !SPI_OUT_TS_SYNC_SLEEP_SUPPORT } } spi_out_log_cb_write_loss(log_cb); @@ -1290,13 +1215,13 @@ void ble_log_spi_out_dump_all(void) portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; portENTER_CRITICAL_SAFE(&spinlock); + esp_rom_printf("[SPI_LOG_DUMP_START:\n"); + #if SPI_OUT_LL_ENABLED if (ll_log_inited) { - esp_rom_printf("[DUMP_START:\n"); spi_out_log_cb_dump(ll_isr_log_cb); spi_out_log_cb_dump(ll_task_log_cb); spi_out_log_cb_dump(ll_hci_log_cb); - esp_rom_printf("\n:DUMP_END]\n\n"); } #endif // SPI_OUT_LL_ENABLED @@ -1318,6 +1243,8 @@ void ble_log_spi_out_dump_all(void) LOG_MODULE_DUMP(mesh); #endif // SPI_OUT_MESH_ENABLED + esp_rom_printf("\n:SPI_LOG_DUMP_END]\n\n"); + portEXIT_CRITICAL_SAFE(&spinlock); } @@ -1345,7 +1272,7 @@ void ble_log_spi_out_flush(void) spi_out_log_flush(); } -#if CONFIG_BT_BLE_LOG_SPI_OUT_LE_AUDIO_ENABLED +#if SPI_OUT_LE_AUDIO_ENABLED IRAM_ATTR void ble_log_spi_out_le_audio_write(const uint8_t *addr, uint16_t len) { if (!LOG_MODULE_INIT_FLAG(le_audio)) { @@ -1369,7 +1296,7 @@ IRAM_ATTR void ble_log_spi_out_le_audio_write(const uint8_t *addr, uint16_t len) spi_out_log_cb_write_loss(log_cb); return; } -#endif // CONFIG_BT_BLE_LOG_SPI_OUT_LE_AUDIO_ENABLED +#endif // SPI_OUT_LE_AUDIO_ENABLED #if SPI_OUT_HOST_ENABLED int ble_log_spi_out_host_write(uint8_t source, const char *prefix, const char *format, ...) diff --git a/components/bt/common/ble_log/include/ble_log/ble_log_spi_out.h b/components/bt/common/ble_log/include/ble_log/ble_log_spi_out.h index e0d9213dce..bcf80398bb 100644 --- a/components/bt/common/ble_log/include/ble_log/ble_log_spi_out.h +++ b/components/bt/common/ble_log/include/ble_log/ble_log_spi_out.h @@ -13,6 +13,7 @@ #include "esp_timer.h" #include "freertos/semphr.h" #include "esp_heap_caps.h" +#include "esp_task.h" // Public enums enum {