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
default 1024
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.
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
default 512
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.
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
int "GPIO number of SPI MOSI"
depends on BT_BLE_LOG_SPI_OUT_ENABLED
@ -94,6 +102,13 @@ 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 n
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
@ -108,3 +123,18 @@ config BT_BLE_LOG_SPI_OUT_FLUSH_TIMEOUT
default 1000
help
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 "freertos/semphr.h"
// Public typedefs
#define BLE_LOG_SPI_OUT_SOURCE_ESP 0
#define BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY 1
#define BLE_LOG_SPI_OUT_SOURCE_BLUEDROID 2
#define BLE_LOG_SPI_OUT_SOURCE_NIMBLE 3
#define BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM 4
#define BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM 5
#define BLE_LOG_SPI_OUT_SOURCE_ESP_ISR 6
#define BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY_ISR 7
#define BLE_LOG_SPI_OUT_SOURCE_USER 0x10
#define BLE_LOG_SPI_OUT_SOURCE_SYNC 0xFE
#define BLE_LOG_SPI_OUT_SOURCE_LOSS 0xFF
// Public enums
enum {
BLE_LOG_SPI_OUT_SOURCE_ESP = 0,
BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY,
BLE_LOG_SPI_OUT_SOURCE_BLUEDROID,
BLE_LOG_SPI_OUT_SOURCE_NIMBLE,
BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM,
BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM,
BLE_LOG_SPI_OUT_SOURCE_ESP_ISR,
BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY_ISR,
BLE_LOG_SPI_OUT_SOURCE_LL_HCI,
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
#define BLE_LOG_SPI_OUT_LEVEL_NONE 0 /*!< No log output */
#define BLE_LOG_SPI_OUT_LEVEL_ERROR 1 /*!< Critical errors that SPI driver cannot recover from */
#define BLE_LOG_SPI_OUT_LEVEL_WARN 2 /*!< Recoverable error conditions in SPI communication */
#define BLE_LOG_SPI_OUT_LEVEL_INFO 3 /*!< Informational messages about SPI transactions */
#define BLE_LOG_SPI_OUT_LEVEL_DEBUG 4 /*!< Detailed debug information, such as SPI register values */
#define BLE_LOG_SPI_OUT_LEVEL_VERBOSE 5 /*!< Very detailed debugging logs, potentially flooding output */
#define BLE_LOG_SPI_OUT_LEVEL_MAX 6 /*!< Number of SPI log levels supported */
enum {
BLE_LOG_SPI_OUT_LEVEL_NONE = 0,
BLE_LOG_SPI_OUT_LEVEL_ERROR,
BLE_LOG_SPI_OUT_LEVEL_WARN,
BLE_LOG_SPI_OUT_LEVEL_INFO,
BLE_LOG_SPI_OUT_LEVEL_DEBUG,
BLE_LOG_SPI_OUT_LEVEL_VERBOSE,
BLE_LOG_SPI_OUT_LEVEL_MAX,
};
// Public functions
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_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_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__

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 (ble_log_spi_out_init() != 0) {
ESP_LOGE(BTDM_LOG_TAG, "BLE Log SPI output init failed");
err = ESP_ERR_NO_MEM;
goto error;
}
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED