mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
feat(ble): support ble log simple output via SPI interface
This commit is contained in:
@ -9,9 +9,18 @@ config BT_ALARM_MAX_NUM
|
|||||||
config BT_BLE_LOG_SPI_OUT_ENABLED
|
config BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
bool "Output ble logs to SPI bus (Experimental)"
|
bool "Output ble logs to SPI bus (Experimental)"
|
||||||
default n
|
default n
|
||||||
|
select SPI_MASTER_IN_IRAM
|
||||||
help
|
help
|
||||||
Output ble logs to SPI bus
|
Output ble logs to SPI bus
|
||||||
|
|
||||||
|
config BT_BLE_LOG_SPI_OUT_UL_TASK_BUF_SIZE
|
||||||
|
int "SPI transaction buffer size for upper layer task logs"
|
||||||
|
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
default 512
|
||||||
|
help
|
||||||
|
SPI transaction buffer size for upper layer task logs.
|
||||||
|
There will be 2 SPI DMA buffers with the same size.
|
||||||
|
|
||||||
config BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
config BT_BLE_LOG_SPI_OUT_HCI_ENABLED
|
||||||
bool "Enable HCI log output to SPI"
|
bool "Enable HCI log output to SPI"
|
||||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
@ -27,51 +36,61 @@ config BT_BLE_LOG_SPI_OUT_HOST_ENABLED
|
|||||||
This configuration applies to the logs of both Bluedroid Host and NimBLE Host.
|
This configuration applies to the logs of both Bluedroid Host and NimBLE Host.
|
||||||
When BLE SPI log output is enabled, this option allows host logs to be transmitted via SPI.
|
When BLE SPI log output is enabled, this option allows host logs to be transmitted via SPI.
|
||||||
|
|
||||||
config BT_BLE_LOG_SPI_OUT_QUEUE_SIZE
|
config BT_BLE_LOG_SPI_OUT_LL_ENABLED
|
||||||
int "Number of ble log async SPI output queues"
|
bool "Enable Controller log output to SPI"
|
||||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
default 4
|
depends on BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
|
default n
|
||||||
help
|
help
|
||||||
The number of ble log async SPI output queues
|
Enable controller log output to SPI bus.
|
||||||
|
|
||||||
config BT_BLE_LOG_SPI_OUT_TRANS_BUF_SIZE
|
config BT_BLE_LOG_SPI_OUT_LL_TASK_BUF_SIZE
|
||||||
int "Size of ble log async SPI output transaction buffer size"
|
int "SPI transaction buffer size for lower layer task logs"
|
||||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
|
||||||
default 2048
|
default 1024
|
||||||
help
|
help
|
||||||
The size of ble log async SPI output transaction buffer size
|
SPI transaction buffer size for upper layer task logs.
|
||||||
|
There will be 2 SPI DMA buffers with the same size.
|
||||||
|
|
||||||
|
config BT_BLE_LOG_SPI_OUT_LL_ISR_BUF_SIZE
|
||||||
|
int "SPI transaction buffer size for lower layer ISR logs"
|
||||||
|
depends on BT_BLE_LOG_SPI_OUT_LL_ENABLED
|
||||||
|
default 512
|
||||||
|
help
|
||||||
|
SPI transaction buffer size for upper layer ISR 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
|
||||||
default 0
|
default 0
|
||||||
help
|
help
|
||||||
GPIO number of SPI MOSI
|
GPIO number of SPI MOSI
|
||||||
|
|
||||||
config BT_BLE_LOG_SPI_OUT_SCLK_IO_NUM
|
config BT_BLE_LOG_SPI_OUT_SCLK_IO_NUM
|
||||||
int "GPIO number of SPI SCLK"
|
int "GPIO number of SPI SCLK"
|
||||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
default 1
|
default 1
|
||||||
help
|
help
|
||||||
GPIO number of SPI SCLK
|
GPIO number of SPI SCLK
|
||||||
|
|
||||||
config BT_BLE_LOG_SPI_OUT_CS_IO_NUM
|
config BT_BLE_LOG_SPI_OUT_CS_IO_NUM
|
||||||
int "GPIO number of SPI CS"
|
int "GPIO number of SPI CS"
|
||||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
default 2
|
default 2
|
||||||
help
|
help
|
||||||
GPIO number of SPI CS
|
GPIO number of SPI CS
|
||||||
|
|
||||||
config BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
config BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||||
bool "Enable ble log & logic analyzer log time sync"
|
bool "Enable ble log & logic analyzer log time sync"
|
||||||
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
depends on BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable ble log & logic analyzer log time sync
|
Enable ble log & logic analyzer log time sync
|
||||||
|
|
||||||
config BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM
|
config BT_BLE_LOG_SPI_OUT_SYNC_IO_NUM
|
||||||
int "GPIO number of SYNC IO"
|
int "GPIO number of SYNC IO"
|
||||||
depends on BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
depends on BT_BLE_LOG_SPI_OUT_TS_SYNC_ENABLED
|
||||||
default 3
|
default 3
|
||||||
help
|
help
|
||||||
GPIO number of SYNC IO
|
GPIO number of SYNC IO
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@
|
|||||||
#include "driver/spi_master.h"
|
#include "driver/spi_master.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "esp_timer.h"
|
#include "esp_timer.h"
|
||||||
|
#include "esp_log.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
|
|
||||||
// Public typedefs
|
// Public typedefs
|
||||||
@ -20,6 +21,8 @@
|
|||||||
#define BLE_LOG_SPI_OUT_SOURCE_NIMBLE 3
|
#define BLE_LOG_SPI_OUT_SOURCE_NIMBLE 3
|
||||||
#define BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM 4
|
#define BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM 4
|
||||||
#define BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM 5
|
#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_USER 0x10
|
||||||
#define BLE_LOG_SPI_OUT_SOURCE_SYNC 0xFE
|
#define BLE_LOG_SPI_OUT_SOURCE_SYNC 0xFE
|
||||||
#define BLE_LOG_SPI_OUT_SOURCE_LOSS 0xFF
|
#define BLE_LOG_SPI_OUT_SOURCE_LOSS 0xFF
|
||||||
@ -34,14 +37,18 @@
|
|||||||
#define BLE_LOG_SPI_OUT_LEVEL_MAX 6 /*!< Number of SPI log levels supported */
|
#define BLE_LOG_SPI_OUT_LEVEL_MAX 6 /*!< Number of SPI log levels supported */
|
||||||
|
|
||||||
// Public functions
|
// Public functions
|
||||||
void ble_log_spi_out_init(void);
|
int ble_log_spi_out_init(void);
|
||||||
void ble_log_spi_out_deinit(void);
|
void ble_log_spi_out_deinit(void);
|
||||||
void ble_log_spi_out_write(uint8_t source, const uint8_t *addr, uint16_t len);
|
void ble_log_spi_out_timer_control(bool enable);
|
||||||
void ble_log_spi_out_write_esp(uint32_t len, const uint8_t *addr, bool end);
|
int ble_log_spi_out_write(uint8_t source, const uint8_t *addr, uint16_t len);
|
||||||
|
void ble_log_spi_out_ll_write(uint32_t len, const uint8_t *addr, uint32_t len_append,\
|
||||||
|
const uint8_t *addr_append, uint32_t flag);
|
||||||
|
void ble_log_spi_out_ll_log_ev_proc(void);
|
||||||
void ble_log_spi_out_ts_sync_start(void);
|
void ble_log_spi_out_ts_sync_start(void);
|
||||||
void ble_log_spi_out_ts_sync_stop(void);
|
void ble_log_spi_out_ts_sync_stop(void);
|
||||||
int ble_log_spi_out_printf(uint8_t source, const char *format, ...);
|
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, ...);
|
||||||
void 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);
|
||||||
|
|
||||||
#endif // __BT_SPI_OUT_H__
|
#endif // __BT_SPI_OUT_H__
|
||||||
|
Reference in New Issue
Block a user