Merge branch 'feat/ble_log_spi_out_dev_phase_3_v5.5' into 'release/v5.5'

Feat/ble log spi out dev phase 3 (v5.5)

See merge request espressif/esp-idf!39356
This commit is contained in:
Island
2025-06-11 13:17:23 +08:00
4 changed files with 667 additions and 365 deletions

View File

@ -48,7 +48,7 @@ config BT_BLE_LOG_SPI_OUT_LL_TASK_BUF_SIZE
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
default 1024 default 1024
help help
SPI transaction buffer size for upper layer task logs. SPI transaction buffer size for lower layer task logs.
There will be 2 SPI DMA buffers with the same size. There will be 2 SPI DMA buffers with the same size.
config BT_BLE_LOG_SPI_OUT_LL_ISR_BUF_SIZE config BT_BLE_LOG_SPI_OUT_LL_ISR_BUF_SIZE
@ -56,9 +56,17 @@ config BT_BLE_LOG_SPI_OUT_LL_ISR_BUF_SIZE
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
default 512 default 512
help help
SPI transaction buffer size for upper layer ISR logs. SPI transaction buffer size for lower layer ISR logs.
There will be 2 SPI DMA buffers with the same size. There will be 2 SPI DMA buffers with the same size.
config BT_BLE_LOG_SPI_OUT_LL_HCI_BUF_SIZE
int "SPI transaction buffer size for lower layer HCI logs"
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
default 512
help
SPI transaction buffer size for upper layer HCI logs.
There will be 2 SPI DMA buffers with the same size
config BT_BLE_LOG_SPI_OUT_MOSI_IO_NUM config BT_BLE_LOG_SPI_OUT_MOSI_IO_NUM
int "GPIO number of SPI MOSI" int "GPIO number of SPI MOSI"
depends on BT_BLE_LOG_SPI_OUT_ENABLED depends on BT_BLE_LOG_SPI_OUT_ENABLED
@ -94,6 +102,13 @@ config BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM
help help
GPIO number of SYNC IO 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 n
help
Enable ble log & logic analyzer log time sync sleep support
config BT_BLE_LOG_SPI_OUT_FLUSH_TIMER_ENABLED config BT_BLE_LOG_SPI_OUT_FLUSH_TIMER_ENABLED
bool "Enable periodic buffer flush out" bool "Enable periodic buffer flush out"
depends on BT_BLE_LOG_SPI_OUT_ENABLED depends on BT_BLE_LOG_SPI_OUT_ENABLED
@ -108,3 +123,18 @@ config BT_BLE_LOG_SPI_OUT_FLUSH_TIMEOUT
default 1000 default 1000
help help
Buffer flush out period in unit of ms Buffer flush out period in unit of ms
config BT_BLE_LOG_SPI_OUT_LE_AUDIO_ENABLED
bool "Enable LE Audio log output to SPI"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
default n
help
Enable LE Audio log output to SPI
config BT_BLE_LOG_SPI_OUT_LE_AUDIO_BUF_SIZE
int "SPI transaction buffer size for LE Audio logs"
depends on BT_BLE_LOG_SPI_OUT_LE_AUDIO_ENABLED
default 1024
help
SPI transaction buffer size for LE Audio logs.
There will be 2 SPI DMA buffers with the same size.

File diff suppressed because it is too large Load Diff

View File

@ -14,27 +14,33 @@
#include "esp_log.h" #include "esp_log.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
// Public typedefs // Public enums
#define BLE_LOG_SPI_OUT_SOURCE_ESP 0 enum {
#define BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY 1 BLE_LOG_SPI_OUT_SOURCE_ESP = 0,
#define BLE_LOG_SPI_OUT_SOURCE_BLUEDROID 2 BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY,
#define BLE_LOG_SPI_OUT_SOURCE_NIMBLE 3 BLE_LOG_SPI_OUT_SOURCE_BLUEDROID,
#define BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM 4 BLE_LOG_SPI_OUT_SOURCE_NIMBLE,
#define BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM 5 BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM,
#define BLE_LOG_SPI_OUT_SOURCE_ESP_ISR 6 BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM,
#define BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY_ISR 7 BLE_LOG_SPI_OUT_SOURCE_ESP_ISR,
#define BLE_LOG_SPI_OUT_SOURCE_USER 0x10 BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY_ISR,
#define BLE_LOG_SPI_OUT_SOURCE_SYNC 0xFE BLE_LOG_SPI_OUT_SOURCE_LL_HCI,
#define BLE_LOG_SPI_OUT_SOURCE_LOSS 0xFF BLE_LOG_SPI_OUT_SOURCE_LE_AUDIO,
BLE_LOG_SPI_OUT_SOURCE_USER = 0x10,
BLE_LOG_SPI_OUT_SOURCE_SSC = 0xFD,
BLE_LOG_SPI_OUT_SOURCE_SYNC,
BLE_LOG_SPI_OUT_SOURCE_LOSS,
};
// SPI Log Level Definitions enum {
#define BLE_LOG_SPI_OUT_LEVEL_NONE 0 /*!< No log output */ BLE_LOG_SPI_OUT_LEVEL_NONE = 0,
#define BLE_LOG_SPI_OUT_LEVEL_ERROR 1 /*!< Critical errors that SPI driver cannot recover from */ BLE_LOG_SPI_OUT_LEVEL_ERROR,
#define BLE_LOG_SPI_OUT_LEVEL_WARN 2 /*!< Recoverable error conditions in SPI communication */ BLE_LOG_SPI_OUT_LEVEL_WARN,
#define BLE_LOG_SPI_OUT_LEVEL_INFO 3 /*!< Informational messages about SPI transactions */ BLE_LOG_SPI_OUT_LEVEL_INFO,
#define BLE_LOG_SPI_OUT_LEVEL_DEBUG 4 /*!< Detailed debug information, such as SPI register values */ BLE_LOG_SPI_OUT_LEVEL_DEBUG,
#define BLE_LOG_SPI_OUT_LEVEL_VERBOSE 5 /*!< Very detailed debugging logs, potentially flooding output */ BLE_LOG_SPI_OUT_LEVEL_VERBOSE,
#define BLE_LOG_SPI_OUT_LEVEL_MAX 6 /*!< Number of SPI log levels supported */ BLE_LOG_SPI_OUT_LEVEL_MAX,
};
// Public functions // Public functions
int ble_log_spi_out_init(void); int ble_log_spi_out_init(void);
@ -50,5 +56,8 @@ int ble_log_spi_out_printf(uint8_t source, const char *format, ...);
int ble_log_spi_out_printf_enh(uint8_t source, uint8_t level, const char *tag, const char *format, ...); int ble_log_spi_out_printf_enh(uint8_t source, uint8_t level, const char *tag, const char *format, ...);
int ble_log_spi_out_write_with_ts(uint8_t source, const uint8_t *addr, uint16_t len); int ble_log_spi_out_write_with_ts(uint8_t source, const uint8_t *addr, uint16_t len);
void ble_log_spi_out_dump_all(void); void ble_log_spi_out_dump_all(void);
void ble_log_spi_out_enable(bool enable);
void ble_log_spi_out_flush(void);
void ble_log_spi_out_le_audio_write(const uint8_t *addr, uint16_t len);
#endif // __BT_SPI_OUT_H__ #endif // __BT_SPI_OUT_H__

View File

@ -1701,6 +1701,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED #if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
if (ble_log_spi_out_init() != 0) { if (ble_log_spi_out_init() != 0) {
ESP_LOGE(BTDM_LOG_TAG, "BLE Log SPI output init failed"); ESP_LOGE(BTDM_LOG_TAG, "BLE Log SPI output init failed");
err = ESP_ERR_NO_MEM;
goto error; goto error;
} }
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED #endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED