mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 18:10:57 +02:00
Merge branch 'feat/ble_log_v2_esp_target_support_v5.5' into 'release/v5.5'
Feat/ble log v2 esp target support (v5.5) See merge request espressif/esp-idf!41921
This commit is contained in:
@@ -33,12 +33,32 @@ if BLE_LOG_ENABLED
|
|||||||
try to use the LBM with spin lock protection. So the more LBMs with atomic
|
try to use the LBM with spin lock protection. So the more LBMs with atomic
|
||||||
lock protection are created, the more ISRs can nest.
|
lock protection are created, the more ISRs can nest.
|
||||||
|
|
||||||
|
config BLE_LOG_IS_ESP_CONTROLLER
|
||||||
|
bool "Current BLE Controller is ESP BLE Controller"
|
||||||
|
depends on BT_CONTROLLER_ENABLED
|
||||||
|
depends on SOC_ESP_NIMBLE_CONTROLLER
|
||||||
|
default y
|
||||||
|
select BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
select BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
select BLE_LOG_LL_ENABLED
|
||||||
|
help
|
||||||
|
Current BLE Controller is ESP BLE Controller
|
||||||
|
|
||||||
|
config BLE_LOG_IS_ESP_LEGACY_CONTROLLER
|
||||||
|
bool "Current BLE Controller is ESP BLE Legacy Controller"
|
||||||
|
depends on BT_CONTROLLER_ENABLED
|
||||||
|
depends on !SOC_ESP_NIMBLE_CONTROLLER
|
||||||
|
depends on BT_CTRL_RUN_IN_FLASH_ONLY
|
||||||
|
default y
|
||||||
|
select BT_CTRL_LE_LOG_EN
|
||||||
|
select BLE_LOG_LL_ENABLED
|
||||||
|
help
|
||||||
|
Current BLE Controller is ESP BLE Legacy Controller
|
||||||
|
|
||||||
config BLE_LOG_LL_ENABLED
|
config BLE_LOG_LL_ENABLED
|
||||||
bool "Enable BLE Log for Link Layer"
|
bool "Enable BLE Log for Link Layer"
|
||||||
depends on BT_CONTROLLER_ENABLED
|
depends on BT_CONTROLLER_ENABLED
|
||||||
default y
|
default n
|
||||||
select BT_LE_CONTROLLER_LOG_ENABLED
|
|
||||||
select BT_LE_CONTROLLER_LOG_MODE_BLE_LOG
|
|
||||||
help
|
help
|
||||||
Enable BLE Log for Link Layer
|
Enable BLE Log for Link Layer
|
||||||
|
|
||||||
@@ -96,11 +116,13 @@ if BLE_LOG_ENABLED
|
|||||||
|
|
||||||
config BLE_LOG_PRPH_SPI_MASTER_DMA
|
config BLE_LOG_PRPH_SPI_MASTER_DMA
|
||||||
bool "Utilize SPI master DMA driver as transport"
|
bool "Utilize SPI master DMA driver as transport"
|
||||||
|
depends on SOC_GPSPI_SUPPORTED
|
||||||
help
|
help
|
||||||
Utilize SPI master DMA driver as transport
|
Utilize SPI master DMA driver as transport
|
||||||
|
|
||||||
config BLE_LOG_PRPH_UART_DMA
|
config BLE_LOG_PRPH_UART_DMA
|
||||||
bool "Utilize UART DMA driver as transport"
|
bool "Utilize UART DMA driver as transport"
|
||||||
|
depends on SOC_UHCI_SUPPORTED
|
||||||
help
|
help
|
||||||
Utilize UART DMA driver as transport
|
Utilize UART DMA driver as transport
|
||||||
endchoice
|
endchoice
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "freertos/portmacro.h"
|
|
||||||
|
|
||||||
/* ------------------------- */
|
/* ------------------------- */
|
||||||
/* Log Frame Defines */
|
/* Log Frame Defines */
|
||||||
|
@@ -17,11 +17,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "esp_bit_defs.h"
|
#include "esp_bit_defs.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
#ifndef UNIT_TEST
|
#ifndef UNIT_TEST
|
||||||
#include "freertos/portmacro.h"
|
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "esp_rom_serial_output.h"
|
#include "esp_rom_uart.h"
|
||||||
#endif /* !UNIT_TEST */
|
#endif /* !UNIT_TEST */
|
||||||
|
|
||||||
/* MACRO */
|
/* MACRO */
|
||||||
@@ -47,18 +47,9 @@
|
|||||||
#define BLE_LOG_MEMSET(ptr, value, len) memset(ptr, value, len)
|
#define BLE_LOG_MEMSET(ptr, value, len) memset(ptr, value, len)
|
||||||
|
|
||||||
/* Critical section wrapper */
|
/* Critical section wrapper */
|
||||||
#ifndef CONFIG_BLE_LOG_LL_ENABLED
|
|
||||||
extern portMUX_TYPE ble_log_spin_lock;
|
extern portMUX_TYPE ble_log_spin_lock;
|
||||||
#define BLE_LOG_ENTER_CRITICAL() portENTER_CRITICAL_SAFE(&ble_log_spin_lock);
|
#define BLE_LOG_ENTER_CRITICAL() portENTER_CRITICAL_SAFE(&ble_log_spin_lock);
|
||||||
#define BLE_LOG_EXIT_CRITICAL() portEXIT_CRITICAL_SAFE(&ble_log_spin_lock);
|
#define BLE_LOG_EXIT_CRITICAL() portEXIT_CRITICAL_SAFE(&ble_log_spin_lock);
|
||||||
#else /* CONFIG_BLE_LOG_LL_ENABLED */
|
|
||||||
/* Note
|
|
||||||
* It's mandatory to use the same spin lock with Link Layer in multi-core system */
|
|
||||||
extern uint32_t npl_freertos_hw_enter_critical(void);
|
|
||||||
extern void npl_freertos_hw_exit_critical(uint32_t ctx);
|
|
||||||
#define BLE_LOG_ENTER_CRITICAL() npl_freertos_hw_enter_critical()
|
|
||||||
#define BLE_LOG_EXIT_CRITICAL() npl_freertos_hw_exit_critical(0)
|
|
||||||
#endif /* !CONFIG_BLE_LOG_LL_ENABLED */
|
|
||||||
|
|
||||||
#define BLE_LOG_ACQUIRE_SPIN_LOCK(spin_lock) portENTER_CRITICAL_SAFE(spin_lock)
|
#define BLE_LOG_ACQUIRE_SPIN_LOCK(spin_lock) portENTER_CRITICAL_SAFE(spin_lock)
|
||||||
#define BLE_LOG_RELEASE_SPIN_LOCK(spin_lock) portEXIT_CRITICAL_SAFE(spin_lock)
|
#define BLE_LOG_RELEASE_SPIN_LOCK(spin_lock) portEXIT_CRITICAL_SAFE(spin_lock)
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/* MACRO */
|
/* MACRO */
|
||||||
#define BLE_LOG_UART_MAX_TRANSFER_SIZE (10240)
|
#define BLE_LOG_UART_MAX_TRANSFER_SIZE (10240)
|
||||||
#define BLE_LOG_UART_RX_BUF_SIZE (32)
|
#define BLE_LOG_UART_RX_BUF_SIZE (256)
|
||||||
#define BLE_LOG_UART_DMA_BURST_SIZE (32)
|
#define BLE_LOG_UART_DMA_BURST_SIZE (32)
|
||||||
#if BLE_LOG_PRPH_UART_DMA_REDIR
|
#if BLE_LOG_PRPH_UART_DMA_REDIR
|
||||||
#define BLE_LOG_UART_REDIR_BUF_SIZE (512)
|
#define BLE_LOG_UART_REDIR_BUF_SIZE (512)
|
||||||
@@ -95,8 +95,6 @@ bool ble_log_prph_init(size_t trans_cnt)
|
|||||||
.data_bits = UART_DATA_8_BITS,
|
.data_bits = UART_DATA_8_BITS,
|
||||||
.parity = UART_PARITY_DISABLE,
|
.parity = UART_PARITY_DISABLE,
|
||||||
.stop_bits = UART_STOP_BITS_1,
|
.stop_bits = UART_STOP_BITS_1,
|
||||||
.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS,
|
|
||||||
.rx_flow_ctrl_thresh = 122,
|
|
||||||
};
|
};
|
||||||
if ((uart_param_config(CONFIG_BLE_LOG_PRPH_UART_DMA_PORT, &uart_config) != ESP_OK) ||
|
if ((uart_param_config(CONFIG_BLE_LOG_PRPH_UART_DMA_PORT, &uart_config) != ESP_OK) ||
|
||||||
(uart_set_pin(CONFIG_BLE_LOG_PRPH_UART_DMA_PORT,
|
(uart_set_pin(CONFIG_BLE_LOG_PRPH_UART_DMA_PORT,
|
||||||
|
@@ -48,9 +48,13 @@
|
|||||||
#include "esp_rom_sys.h"
|
#include "esp_rom_sys.h"
|
||||||
#include "hli_api.h"
|
#include "hli_api.h"
|
||||||
|
|
||||||
|
#if CONFIG_BLE_LOG_ENABLED
|
||||||
|
#include "ble_log.h"
|
||||||
|
#else /* !CONFIG_BLE_LOG_ENABLED */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_spi_out.h"
|
#include "ble_log/ble_log_spi_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BLE_LOG_ENABLED */
|
||||||
|
|
||||||
#if CONFIG_BT_ENABLED
|
#if CONFIG_BT_ENABLED
|
||||||
|
|
||||||
@@ -1702,6 +1706,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
coex_init();
|
coex_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_BLE_LOG_ENABLED
|
||||||
|
if (!ble_log_init()) {
|
||||||
|
ESP_LOGE(BTDM_LOG_TAG, "BLE Log v2 init failed");
|
||||||
|
err = ESP_ERR_NO_MEM;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BLE_LOG_ENABLED */
|
||||||
#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");
|
||||||
@@ -1709,6 +1720,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BLE_LOG_ENABLED */
|
||||||
|
|
||||||
btdm_cfg_mask = btdm_config_mask_load();
|
btdm_cfg_mask = btdm_config_mask_load();
|
||||||
|
|
||||||
@@ -1737,9 +1749,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
|
#if CONFIG_BLE_LOG_ENABLED
|
||||||
|
ble_log_deinit();
|
||||||
|
#else /* !CONFIG_BLE_LOG_ENABLED */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
ble_log_spi_out_deinit();
|
ble_log_spi_out_deinit();
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BLE_LOG_ENABLED */
|
||||||
|
|
||||||
bt_controller_deinit_internal();
|
bt_controller_deinit_internal();
|
||||||
|
|
||||||
@@ -1752,9 +1768,13 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
return ESP_ERR_INVALID_STATE;
|
return ESP_ERR_INVALID_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BLE_LOG_ENABLED
|
||||||
|
ble_log_deinit();
|
||||||
|
#else /* !CONFIG_BLE_LOG_ENABLED */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
ble_log_spi_out_deinit();
|
ble_log_spi_out_deinit();
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BLE_LOG_ENABLED */
|
||||||
|
|
||||||
btdm_controller_deinit();
|
btdm_controller_deinit();
|
||||||
|
|
||||||
|
@@ -288,74 +288,83 @@ menu "Controller debug features"
|
|||||||
help
|
help
|
||||||
Enable controller log
|
Enable controller log
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
config BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
bool "enable controller log module"
|
bool "Utilize BLE Log v2 for controller log"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BLE_LOG_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable controller log module
|
Utilize BLE Log v2 for controller log
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
if !BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
bool "enable HCI log module"
|
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
bool "enable controller log module"
|
||||||
default y
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
help
|
default y
|
||||||
Enable hci log module
|
help
|
||||||
|
Enable controller log module
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||||
bool "Controller log dump mode only"
|
bool "enable HCI log module"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Only operate in dump mode
|
Enable hci log module
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
bool "Controller log dump mode only"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
default y
|
||||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
help
|
||||||
default n
|
Only operate in dump mode
|
||||||
help
|
|
||||||
Output ble controller logs to SPI bus
|
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
bool "Store ble controller logs to flash(Experimental)"
|
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
default n
|
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
help
|
default n
|
||||||
Store ble controller logs to flash memory.
|
help
|
||||||
|
Output ble controller logs to SPI bus
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
int "size of ble controller log partition(Multiples of 4K)"
|
bool "Store ble controller logs to flash(Experimental)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
default 65536
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
help
|
default n
|
||||||
The size of ble controller log partition shall be a multiples of 4K.
|
help
|
||||||
The name of log partition shall be "bt_ctrl_log".
|
Store ble controller logs to flash memory.
|
||||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
|
||||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
|
||||||
|
|
||||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||||
int "size of the first BLE controller LOG buffer"
|
int "size of ble controller log partition(Multiples of 4K)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
default 4096
|
default 65536
|
||||||
help
|
help
|
||||||
Configure the size of the first BLE controller LOG buffer.
|
The size of ble controller log partition shall be a multiples of 4K.
|
||||||
|
The name of log partition shall be "bt_ctrl_log".
|
||||||
|
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||||
|
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||||
|
|
||||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||||
int "size of the second BLE controller LOG buffer"
|
int "size of the first BLE controller LOG buffer"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default 1024
|
default 4096
|
||||||
help
|
help
|
||||||
Configure the size of the second BLE controller LOG buffer.
|
Configure the size of the first BLE controller LOG buffer.
|
||||||
|
|
||||||
config BT_LE_LOG_HCI_BUF_SIZE
|
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||||
int "size of the BLE HCI LOG buffer"
|
int "size of the second BLE controller LOG buffer"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default 4096
|
default 1024
|
||||||
help
|
help
|
||||||
Configure the size of the BLE HCI LOG buffer.
|
Configure the size of the second BLE controller LOG buffer.
|
||||||
|
|
||||||
|
config BT_LE_LOG_HCI_BUF_SIZE
|
||||||
|
int "size of the BLE HCI LOG buffer"
|
||||||
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
default 4096
|
||||||
|
help
|
||||||
|
Configure the size of the BLE HCI LOG buffer.
|
||||||
|
endif
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||||
bool "Enable wrap panic handler"
|
bool "Enable wrap panic handler"
|
||||||
|
@@ -66,9 +66,13 @@
|
|||||||
#include "hal/efuse_ll.h"
|
#include "hal/efuse_ll.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
#include "ble_log.h"
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_spi_out.h"
|
#include "ble_log/ble_log_spi_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
/* Macro definition
|
/* Macro definition
|
||||||
************************************************************************
|
************************************************************************
|
||||||
@@ -207,12 +211,14 @@ static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
|||||||
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
||||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
|
||||||
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
|
#endif /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
/* Local variable definition
|
/* Local variable definition
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
@@ -224,9 +230,43 @@ void *g_ble_lll_rfmgmt_env_p;
|
|||||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
|
||||||
static bool log_is_inited = false;
|
static bool log_is_inited = false;
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
/* TODO: Remove event handler dependency in lib */
|
||||||
|
static void void_handler(void) {}
|
||||||
|
|
||||||
|
/* TODO: Declare public interfaces in a public header */
|
||||||
|
void esp_bt_controller_log_deinit(void)
|
||||||
|
{
|
||||||
|
log_is_inited = false;
|
||||||
|
ble_log_deinit_simple();
|
||||||
|
ble_log_deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_bt_controller_log_init(void)
|
||||||
|
{
|
||||||
|
if (log_is_inited) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ble_log_init()) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ble_log_init_simple(ble_log_write_hex_ll, void_handler) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_is_inited = true;
|
||||||
|
return ESP_OK;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
esp_bt_controller_log_deinit();
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
||||||
esp_err_t esp_bt_controller_log_init(void)
|
esp_err_t esp_bt_controller_log_init(void)
|
||||||
{
|
{
|
||||||
if (log_is_inited) {
|
if (log_is_inited) {
|
||||||
@@ -289,6 +329,7 @@ void esp_bt_controller_log_deinit(void)
|
|||||||
|
|
||||||
log_is_inited = false;
|
log_is_inited = false;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
#include "esp_partition.h"
|
#include "esp_partition.h"
|
||||||
@@ -413,6 +454,12 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
|||||||
}
|
}
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
void esp_ble_controller_log_dump_all(bool output)
|
||||||
|
{
|
||||||
|
ble_log_dump_to_console();
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
|
||||||
{
|
{
|
||||||
@@ -455,6 +502,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
|||||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
|
||||||
void esp_task_wdt_isr_user_handler(void)
|
void esp_task_wdt_isr_user_handler(void)
|
||||||
|
@@ -569,41 +569,51 @@ menu "Controller debug log Options (Experimental)"
|
|||||||
bool "Enable BLE debug log"
|
bool "Enable BLE debug log"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config BT_CTRL_LE_LOG_MODE_BLE_LOG_V2
|
||||||
|
bool "Utilize BLE Log v2 for controller log"
|
||||||
|
depends on BT_CTRL_LE_LOG_EN
|
||||||
|
depends on BLE_LOG_ENABLED
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Utilize BLE Log v2 for controller log
|
||||||
|
|
||||||
|
if !BT_CTRL_LE_LOG_MODE_BLE_LOG_V2
|
||||||
|
config BT_CTRL_LE_LOG_DUMP_ONLY
|
||||||
|
depends on BT_CTRL_LE_LOG_EN
|
||||||
|
bool "Enable BLE log dump only"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BT_CTRL_LE_LOG_STORAGE_EN
|
||||||
|
depends on BT_CTRL_LE_LOG_EN
|
||||||
|
bool "Enable BLE log storage to flash"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BT_CTRL_LE_LOG_PARTITION_SIZE
|
||||||
|
int "The size of ble controller log partition(Multiples of 4K)"
|
||||||
|
depends on BT_CTRL_LE_LOG_STORAGE_EN
|
||||||
|
default 65536
|
||||||
|
help
|
||||||
|
The size of ble controller log partition shall be a multiples of 4K.
|
||||||
|
The name of log partition shall be "bt_ctrl_log".
|
||||||
|
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||||
|
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||||
|
|
||||||
|
config BT_CTRL_LE_LOG_SPI_OUT_EN
|
||||||
|
bool "Output ble controller logs to SPI bus"
|
||||||
|
depends on BT_CTRL_LE_LOG_EN
|
||||||
|
depends on !BT_CTRL_LE_LOG_DUMP_ONLY
|
||||||
|
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
select BT_BLE_LOG_SPI_OUT_LL_ENABLED
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Output ble controller logs to SPI bus
|
||||||
|
endif
|
||||||
|
|
||||||
config BT_CTRL_LE_HCI_LOG_EN
|
config BT_CTRL_LE_HCI_LOG_EN
|
||||||
depends on BT_CTRL_LE_LOG_EN
|
depends on BT_CTRL_LE_LOG_EN
|
||||||
bool "Enable BLE HCI log"
|
bool "Enable BLE HCI log"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BT_CTRL_LE_LOG_DUMP_ONLY
|
|
||||||
depends on BT_CTRL_LE_LOG_EN
|
|
||||||
bool "Enable BLE log dump only"
|
|
||||||
default n
|
|
||||||
|
|
||||||
config BT_CTRL_LE_LOG_STORAGE_EN
|
|
||||||
depends on BT_CTRL_LE_LOG_EN
|
|
||||||
bool "Enable BLE log storage to flash"
|
|
||||||
default n
|
|
||||||
|
|
||||||
config BT_CTRL_LE_LOG_PARTITION_SIZE
|
|
||||||
int "The size of ble controller log partition(Multiples of 4K)"
|
|
||||||
depends on BT_CTRL_LE_LOG_STORAGE_EN
|
|
||||||
default 65536
|
|
||||||
help
|
|
||||||
The size of ble controller log partition shall be a multiples of 4K.
|
|
||||||
The name of log partition shall be "bt_ctrl_log".
|
|
||||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
|
||||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
|
||||||
|
|
||||||
config BT_CTRL_LE_LOG_SPI_OUT_EN
|
|
||||||
bool "Output ble controller logs to SPI bus"
|
|
||||||
depends on BT_CTRL_LE_LOG_EN
|
|
||||||
depends on !BT_CTRL_LE_LOG_DUMP_ONLY
|
|
||||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
|
||||||
select BT_BLE_LOG_SPI_OUT_LL_ENABLED
|
|
||||||
default n
|
|
||||||
help
|
|
||||||
Output ble controller logs to SPI bus
|
|
||||||
|
|
||||||
config BT_CTRL_LE_LOG_MODE_EN
|
config BT_CTRL_LE_LOG_MODE_EN
|
||||||
depends on BT_CTRL_LE_LOG_EN
|
depends on BT_CTRL_LE_LOG_EN
|
||||||
int "Enable log for specified BLE mode"
|
int "Enable log for specified BLE mode"
|
||||||
|
@@ -49,9 +49,13 @@
|
|||||||
#else //CONFIG_IDF_TARGET_ESP32S3
|
#else //CONFIG_IDF_TARGET_ESP32S3
|
||||||
#include "esp32s3/rom/rom_layout.h"
|
#include "esp32s3/rom/rom_layout.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if CONFIG_BLE_LOG_ENABLED
|
||||||
|
#include "ble_log.h"
|
||||||
|
#else /* !CONFIG_BLE_LOG_ENABLED */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_spi_out.h"
|
#include "ble_log/ble_log_spi_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BLE_LOG_ENABLED */
|
||||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||||
#include "esp_partition.h"
|
#include "esp_partition.h"
|
||||||
#include "hal/wdt_hal.h"
|
#include "hal/wdt_hal.h"
|
||||||
@@ -503,10 +507,14 @@ enum log_out_mode {
|
|||||||
LOG_ASYNC_OUT,
|
LOG_ASYNC_OUT,
|
||||||
LOG_STORAGE_TO_FLASH,
|
LOG_STORAGE_TO_FLASH,
|
||||||
LOG_SPI_OUT,
|
LOG_SPI_OUT,
|
||||||
|
LOG_BLE_LOG_V2,
|
||||||
};
|
};
|
||||||
|
|
||||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_CTRL_LE_LOG_BUF1_SIZE, CONFIG_BT_CTRL_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_CTRL_LE_LOG_BUF2_SIZE};
|
const static uint32_t log_bufs_size[] = {CONFIG_BT_CTRL_LE_LOG_BUF1_SIZE, CONFIG_BT_CTRL_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_CTRL_LE_LOG_BUF2_SIZE};
|
||||||
bool log_is_inited = false;
|
bool log_is_inited = false;
|
||||||
|
#if CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2
|
||||||
|
uint8_t log_output_mode = LOG_BLE_LOG_V2;
|
||||||
|
#else /* !CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY
|
#if CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY
|
||||||
uint8_t log_output_mode = LOG_DUMP_MEMORY;
|
uint8_t log_output_mode = LOG_DUMP_MEMORY;
|
||||||
#else
|
#else
|
||||||
@@ -518,6 +526,7 @@ uint8_t log_output_mode = LOG_SPI_OUT;
|
|||||||
uint8_t log_output_mode = LOG_ASYNC_OUT;
|
uint8_t log_output_mode = LOG_ASYNC_OUT;
|
||||||
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||||
#endif // CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY
|
#endif // CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY
|
||||||
|
#endif /* CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||||
static const esp_partition_t *log_partition;
|
static const esp_partition_t *log_partition;
|
||||||
static uint32_t write_index = 0;
|
static uint32_t write_index = 0;
|
||||||
@@ -527,6 +536,17 @@ static bool stop_write = false;
|
|||||||
static bool is_filled = false;
|
static bool is_filled = false;
|
||||||
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN
|
||||||
|
|
||||||
|
#if CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2
|
||||||
|
static IRAM_ATTR void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||||
|
{
|
||||||
|
ble_log_write_hex_ll(len, addr, 0, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void esp_ble_controller_log_dump_all(bool output)
|
||||||
|
{
|
||||||
|
ble_log_dump_to_console();
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2 */
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||||
{
|
{
|
||||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||||
@@ -571,6 +591,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
|||||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
void esp_bt_log_output_mode_set(uint8_t output_mode)
|
void esp_bt_log_output_mode_set(uint8_t output_mode)
|
||||||
{
|
{
|
||||||
@@ -582,6 +603,31 @@ uint8_t esp_bt_log_output_mode_get(void)
|
|||||||
return log_output_mode;
|
return log_output_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2
|
||||||
|
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
|
||||||
|
{
|
||||||
|
if (log_is_inited) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t ret = ESP_OK;
|
||||||
|
uint8_t buffers = 0;
|
||||||
|
|
||||||
|
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||||
|
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||||
|
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||||
|
#if CONFIG_BT_CTRL_LE_HCI_LOG_EN
|
||||||
|
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||||
|
#endif // CONFIG_BT_CTRL_LE_HCI_LOG_EN
|
||||||
|
|
||||||
|
ret = r_ble_log_init_async(esp_bt_controller_log_interface, true, buffers, (uint32_t *)log_bufs_size);
|
||||||
|
if (ret == ESP_OK) {
|
||||||
|
log_is_inited = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2 */
|
||||||
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
|
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
|
||||||
{
|
{
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
@@ -631,8 +677,9 @@ esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_CTRL_LE_LOG_MODE_BLE_LOG_V2*/
|
||||||
|
|
||||||
void esp_bt_ontroller_log_deinit(void)
|
void esp_bt_controller_log_deinit(void)
|
||||||
{
|
{
|
||||||
r_ble_log_deinit_async();
|
r_ble_log_deinit_async();
|
||||||
log_is_inited = false;
|
log_is_inited = false;
|
||||||
@@ -713,7 +760,7 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
|
|||||||
portENTER_CRITICAL_SAFE(&spinlock);
|
portENTER_CRITICAL_SAFE(&spinlock);
|
||||||
esp_panic_handler_feed_wdts();
|
esp_panic_handler_feed_wdts();
|
||||||
r_ble_log_async_output_dump_all(true);
|
r_ble_log_async_output_dump_all(true);
|
||||||
esp_bt_ontroller_log_deinit();
|
esp_bt_controller_log_deinit();
|
||||||
stop_write = true;
|
stop_write = true;
|
||||||
|
|
||||||
buffer = (const uint8_t *)mapped_ptr;
|
buffer = (const uint8_t *)mapped_ptr;
|
||||||
@@ -1806,6 +1853,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
coex_init();
|
coex_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_BLE_LOG_ENABLED
|
||||||
|
if (!ble_log_init()) {
|
||||||
|
ESP_LOGE(BT_LOG_TAG, "BLE Log v2 init failed");
|
||||||
|
err = ESP_ERR_NO_MEM;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BLE_LOG_ENABLED */
|
||||||
#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(BT_LOG_TAG, "BLE Log SPI output init failed");
|
ESP_LOGE(BT_LOG_TAG, "BLE Log SPI output init failed");
|
||||||
@@ -1813,6 +1867,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BLE_LOG_ENABLED */
|
||||||
|
|
||||||
periph_module_enable(PERIPH_BT_MODULE);
|
periph_module_enable(PERIPH_BT_MODULE);
|
||||||
periph_module_reset(PERIPH_BT_MODULE);
|
periph_module_reset(PERIPH_BT_MODULE);
|
||||||
@@ -1846,9 +1901,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
|
#if CONFIG_BLE_LOG_ENABLED
|
||||||
|
ble_log_deinit();
|
||||||
|
#else /* !CONFIG_BLE_LOG_ENABLED */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
ble_log_spi_out_deinit();
|
ble_log_spi_out_deinit();
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BLE_LOG_ENABLED */
|
||||||
|
|
||||||
bt_controller_deinit_internal();
|
bt_controller_deinit_internal();
|
||||||
|
|
||||||
@@ -1861,9 +1920,13 @@ esp_err_t esp_bt_controller_deinit(void)
|
|||||||
return ESP_ERR_INVALID_STATE;
|
return ESP_ERR_INVALID_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BLE_LOG_ENABLED
|
||||||
|
ble_log_deinit();
|
||||||
|
#else /* !CONFIG_BLE_LOG_ENABLED */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
ble_log_spi_out_deinit();
|
ble_log_spi_out_deinit();
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BLE_LOG_ENABLED */
|
||||||
|
|
||||||
#if (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED)
|
#if (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED)
|
||||||
scan_stack_enableAdvFlowCtrlVsCmd(false);
|
scan_stack_enableAdvFlowCtrlVsCmd(false);
|
||||||
@@ -1951,7 +2014,7 @@ static void bt_controller_deinit_internal(void)
|
|||||||
esp_phy_modem_deinit();
|
esp_phy_modem_deinit();
|
||||||
|
|
||||||
#if CONFIG_BT_CTRL_LE_LOG_EN
|
#if CONFIG_BT_CTRL_LE_LOG_EN
|
||||||
esp_bt_ontroller_log_deinit();
|
esp_bt_controller_log_deinit();
|
||||||
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
#endif // CONFIG_BT_CTRL_LE_LOG_EN
|
||||||
|
|
||||||
if (osi_funcs_p != NULL) {
|
if (osi_funcs_p != NULL) {
|
||||||
|
@@ -297,84 +297,93 @@ menu "Controller debug features"
|
|||||||
help
|
help
|
||||||
Enable controller log
|
Enable controller log
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
config BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
bool "enable controller log module"
|
bool "Utilize BLE Log v2 for controller log"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BLE_LOG_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable controller log module
|
Utilize BLE Log v2 for controller log
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
if !BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
bool "enable HCI log module"
|
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
bool "enable controller log module"
|
||||||
default y
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
help
|
default y
|
||||||
Enable hci log module
|
help
|
||||||
|
Enable controller log module
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||||
bool "Controller log dump mode only"
|
bool "enable HCI log module"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Only operate in dump mode
|
Enable hci log module
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
bool "Controller log dump mode only"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
default y
|
||||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
help
|
||||||
default n
|
Only operate in dump mode
|
||||||
help
|
|
||||||
Output ble controller logs to SPI bus
|
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
bool "Output ble controller logs via UART DMA (Experimental)"
|
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
depends on !BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
select BT_BLE_LOG_UHCI_OUT_ENABLED
|
default n
|
||||||
default y
|
help
|
||||||
help
|
Output ble controller logs to SPI bus
|
||||||
Output ble controller logs via UART DMA
|
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
config BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
bool "Store ble controller logs to flash(Experimental)"
|
bool "Output ble controller logs via UART DMA (Experimental)"
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
default n
|
depends on !BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
help
|
select BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
Store ble controller logs to flash memory.
|
default y
|
||||||
|
help
|
||||||
|
Output ble controller logs via UART DMA
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
int "size of ble controller log partition(Multiples of 4K)"
|
bool "Store ble controller logs to flash(Experimental)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
default 65536
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
help
|
default n
|
||||||
The size of ble controller log partition shall be a multiples of 4K.
|
help
|
||||||
The name of log partition shall be "bt_ctrl_log".
|
Store ble controller logs to flash memory.
|
||||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
|
||||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
|
||||||
|
|
||||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||||
int "size of the first BLE controller LOG buffer"
|
int "size of ble controller log partition(Multiples of 4K)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
default 4096
|
default 65536
|
||||||
help
|
help
|
||||||
Configure the size of the first BLE controller LOG buffer.
|
The size of ble controller log partition shall be a multiples of 4K.
|
||||||
|
The name of log partition shall be "bt_ctrl_log".
|
||||||
|
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||||
|
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||||
|
|
||||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||||
int "size of the second BLE controller LOG buffer"
|
int "size of the first BLE controller LOG buffer"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default 1024
|
default 4096
|
||||||
help
|
help
|
||||||
Configure the size of the second BLE controller LOG buffer.
|
Configure the size of the first BLE controller LOG buffer.
|
||||||
|
|
||||||
config BT_LE_LOG_HCI_BUF_SIZE
|
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||||
int "size of the BLE HCI LOG buffer"
|
int "size of the second BLE controller LOG buffer"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default 4096
|
default 1024
|
||||||
help
|
help
|
||||||
Configure the size of the BLE HCI LOG buffer.
|
Configure the size of the second BLE controller LOG buffer.
|
||||||
|
|
||||||
|
config BT_LE_LOG_HCI_BUF_SIZE
|
||||||
|
int "size of the BLE HCI LOG buffer"
|
||||||
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
default 4096
|
||||||
|
help
|
||||||
|
Configure the size of the BLE HCI LOG buffer.
|
||||||
|
endif
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||||
bool "Enable wrap panic handler"
|
bool "Enable wrap panic handler"
|
||||||
|
@@ -56,6 +56,9 @@
|
|||||||
#include "hal/efuse_hal.h"
|
#include "hal/efuse_hal.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
#include "ble_log.h"
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_spi_out.h"
|
#include "ble_log/ble_log_spi_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
@@ -63,6 +66,7 @@
|
|||||||
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_uhci_out.h"
|
#include "ble_log/ble_log_uhci_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
/* Macro definition
|
/* Macro definition
|
||||||
************************************************************************
|
************************************************************************
|
||||||
@@ -192,12 +196,14 @@ static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
|||||||
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
||||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
|
||||||
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
|
#endif /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
/* Local variable definition
|
/* Local variable definition
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
@@ -206,9 +212,47 @@ static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
|||||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
|
||||||
static bool log_is_inited = false;
|
static bool log_is_inited = false;
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
/* TODO: Remove event handler dependency in lib */
|
||||||
|
static void void_handler(void) {}
|
||||||
|
|
||||||
|
/* TODO: Declare public interfaces in a public header */
|
||||||
|
void esp_bt_controller_log_deinit(void)
|
||||||
|
{
|
||||||
|
log_is_inited = false;
|
||||||
|
r_ble_log_deinit_simple();
|
||||||
|
ble_log_deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_bt_controller_log_init(void)
|
||||||
|
{
|
||||||
|
if (log_is_inited) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ble_log_init()) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_ble_log_init_simple(ble_log_write_hex_ll, void_handler) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_ble_log_ctrl_level_and_mod(CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL,
|
||||||
|
CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH) != ESP_OK) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
log_is_inited = true;
|
||||||
|
return ESP_OK;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
esp_bt_controller_log_deinit();
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
||||||
esp_err_t esp_bt_controller_log_init(void)
|
esp_err_t esp_bt_controller_log_init(void)
|
||||||
{
|
{
|
||||||
if (log_is_inited) {
|
if (log_is_inited) {
|
||||||
@@ -302,6 +346,7 @@ void esp_bt_controller_log_deinit(void)
|
|||||||
|
|
||||||
log_is_inited = false;
|
log_is_inited = false;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
#include "esp_partition.h"
|
#include "esp_partition.h"
|
||||||
@@ -1448,6 +1493,12 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
void esp_ble_controller_log_dump_all(bool output)
|
||||||
|
{
|
||||||
|
ble_log_dump_to_console();
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
|
||||||
{
|
{
|
||||||
@@ -1494,6 +1545,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
|||||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
|
||||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
||||||
|
@@ -338,84 +338,93 @@ menu "Controller debug features"
|
|||||||
help
|
help
|
||||||
Enable controller log
|
Enable controller log
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
config BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
bool "enable controller log module"
|
bool "Utilize BLE Log v2 for controller log"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BLE_LOG_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable controller log module
|
Utilize BLE Log v2 for controller log
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
if !BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
bool "enable HCI log module"
|
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
bool "enable controller log module"
|
||||||
default y
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
help
|
default y
|
||||||
Enable hci log module
|
help
|
||||||
|
Enable controller log module
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||||
bool "Controller log dump mode only"
|
bool "enable HCI log module"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Only operate in dump mode
|
Enable hci log module
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
bool "Controller log dump mode only"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
default y
|
||||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
help
|
||||||
default n
|
Only operate in dump mode
|
||||||
help
|
|
||||||
Output ble controller logs to SPI bus
|
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
bool "Output ble controller logs via UART DMA (Experimental)"
|
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
depends on !BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
select BT_BLE_LOG_UHCI_OUT_ENABLED
|
default n
|
||||||
default y
|
help
|
||||||
help
|
Output ble controller logs to SPI bus
|
||||||
Output ble controller logs via UART DMA
|
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
config BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
bool "Store ble controller logs to flash(Experimental)"
|
bool "Output ble controller logs via UART DMA (Experimental)"
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
default n
|
depends on !BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
help
|
select BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
Store ble controller logs to flash memory.
|
default y
|
||||||
|
help
|
||||||
|
Output ble controller logs via UART DMA
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
int "size of ble controller log partition(Multiples of 4K)"
|
bool "Store ble controller logs to flash(Experimental)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
default 65536
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
help
|
default n
|
||||||
The size of ble controller log partition shall be a multiples of 4K.
|
help
|
||||||
The name of log partition shall be "bt_ctrl_log".
|
Store ble controller logs to flash memory.
|
||||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
|
||||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
|
||||||
|
|
||||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||||
int "size of the first BLE controller LOG buffer"
|
int "size of ble controller log partition(Multiples of 4K)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
default 4096
|
default 65536
|
||||||
help
|
help
|
||||||
Configure the size of the first BLE controller LOG buffer.
|
The size of ble controller log partition shall be a multiples of 4K.
|
||||||
|
The name of log partition shall be "bt_ctrl_log".
|
||||||
|
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||||
|
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||||
|
|
||||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||||
int "size of the second BLE controller LOG buffer"
|
int "size of the first BLE controller LOG buffer"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default 1024
|
default 4096
|
||||||
help
|
help
|
||||||
Configure the size of the second BLE controller LOG buffer.
|
Configure the size of the first BLE controller LOG buffer.
|
||||||
|
|
||||||
config BT_LE_LOG_HCI_BUF_SIZE
|
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||||
int "size of the BLE HCI LOG buffer"
|
int "size of the second BLE controller LOG buffer"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default 4096
|
default 1024
|
||||||
help
|
help
|
||||||
Configure the size of the BLE HCI LOG buffer.
|
Configure the size of the second BLE controller LOG buffer.
|
||||||
|
|
||||||
|
config BT_LE_LOG_HCI_BUF_SIZE
|
||||||
|
int "size of the BLE HCI LOG buffer"
|
||||||
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
default 4096
|
||||||
|
help
|
||||||
|
Configure the size of the BLE HCI LOG buffer.
|
||||||
|
endif
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||||
bool "Enable wrap panic handler"
|
bool "Enable wrap panic handler"
|
||||||
|
@@ -60,6 +60,9 @@
|
|||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "modem/modem_syscon_struct.h"
|
#include "modem/modem_syscon_struct.h"
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
#include "ble_log.h"
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_spi_out.h"
|
#include "ble_log/ble_log_spi_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
@@ -67,6 +70,7 @@
|
|||||||
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_uhci_out.h"
|
#include "ble_log/ble_log_uhci_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
/* Macro definition
|
/* Macro definition
|
||||||
************************************************************************
|
************************************************************************
|
||||||
@@ -208,12 +212,14 @@ static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
|||||||
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
||||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
|
||||||
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
|
#endif /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
/* Local variable definition
|
/* Local variable definition
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
@@ -222,9 +228,47 @@ static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
|||||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
|
||||||
static bool log_is_inited = false;
|
static bool log_is_inited = false;
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
/* TODO: Remove event handler dependency in lib */
|
||||||
|
static void void_handler(void) {}
|
||||||
|
|
||||||
|
/* TODO: Declare public interfaces in a public header */
|
||||||
|
void esp_bt_controller_log_deinit(void)
|
||||||
|
{
|
||||||
|
log_is_inited = false;
|
||||||
|
r_ble_log_deinit_simple();
|
||||||
|
ble_log_deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_bt_controller_log_init(void)
|
||||||
|
{
|
||||||
|
if (log_is_inited) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ble_log_init()) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_ble_log_init_simple(ble_log_write_hex_ll, void_handler) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_ble_log_ctrl_level_and_mod(CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL,
|
||||||
|
CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH) != ESP_OK) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
log_is_inited = true;
|
||||||
|
return ESP_OK;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
esp_bt_controller_log_deinit();
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
||||||
esp_err_t esp_bt_controller_log_init(void)
|
esp_err_t esp_bt_controller_log_init(void)
|
||||||
{
|
{
|
||||||
if (log_is_inited) {
|
if (log_is_inited) {
|
||||||
@@ -318,6 +362,7 @@ void esp_bt_controller_log_deinit(void)
|
|||||||
|
|
||||||
log_is_inited = false;
|
log_is_inited = false;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
#include "esp_partition.h"
|
#include "esp_partition.h"
|
||||||
@@ -1519,6 +1564,12 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
void esp_ble_controller_log_dump_all(bool output)
|
||||||
|
{
|
||||||
|
ble_log_dump_to_console();
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
|
||||||
{
|
{
|
||||||
@@ -1565,6 +1616,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
|||||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
|
||||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
||||||
|
@@ -332,84 +332,93 @@ menu "Controller debug features"
|
|||||||
help
|
help
|
||||||
Enable controller log
|
Enable controller log
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
config BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
bool "enable controller log module"
|
bool "Utilize BLE Log v2 for controller log"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BLE_LOG_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable controller log module
|
Utilize BLE Log v2 for controller log
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
if !BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
bool "enable HCI log module"
|
config BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
bool "enable controller log module"
|
||||||
default y
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
help
|
default y
|
||||||
Enable hci log module
|
help
|
||||||
|
Enable controller log module
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
config BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||||
bool "Controller log dump mode only"
|
bool "enable HCI log module"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Only operate in dump mode
|
Enable hci log module
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
bool "Output ble controller logs to SPI bus (Experimental)"
|
bool "Controller log dump mode only"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
default y
|
||||||
select BT_BLE_LOG_SPI_OUT_ENABLED
|
help
|
||||||
default n
|
Only operate in dump mode
|
||||||
help
|
|
||||||
Output ble controller logs to SPI bus
|
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
config BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
bool "Output ble controller logs via UART DMA (Experimental)"
|
bool "Output ble controller logs to SPI bus (Experimental)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
depends on !BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
select BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
select BT_BLE_LOG_UHCI_OUT_ENABLED
|
default n
|
||||||
default y
|
help
|
||||||
help
|
Output ble controller logs to SPI bus
|
||||||
Output ble controller logs via UART DMA
|
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
config BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
bool "Store ble controller logs to flash(Experimental)"
|
bool "Output ble controller logs via UART DMA (Experimental)"
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
default n
|
depends on !BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
help
|
select BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
Store ble controller logs to flash memory.
|
default y
|
||||||
|
help
|
||||||
|
Output ble controller logs via UART DMA
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
int "size of ble controller log partition(Multiples of 4K)"
|
bool "Store ble controller logs to flash(Experimental)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
default 65536
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
help
|
default n
|
||||||
The size of ble controller log partition shall be a multiples of 4K.
|
help
|
||||||
The name of log partition shall be "bt_ctrl_log".
|
Store ble controller logs to flash memory.
|
||||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
|
||||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
|
||||||
|
|
||||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||||
int "size of the first BLE controller LOG buffer"
|
int "size of ble controller log partition(Multiples of 4K)"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
default 4096
|
default 65536
|
||||||
help
|
help
|
||||||
Configure the size of the first BLE controller LOG buffer.
|
The size of ble controller log partition shall be a multiples of 4K.
|
||||||
|
The name of log partition shall be "bt_ctrl_log".
|
||||||
|
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||||
|
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||||
|
|
||||||
config BT_LE_LOG_CTRL_BUF2_SIZE
|
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||||
int "size of the second BLE controller LOG buffer"
|
int "size of the first BLE controller LOG buffer"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default 1024
|
default 4096
|
||||||
help
|
help
|
||||||
Configure the size of the second BLE controller LOG buffer.
|
Configure the size of the first BLE controller LOG buffer.
|
||||||
|
|
||||||
config BT_LE_LOG_HCI_BUF_SIZE
|
config BT_LE_LOG_CTRL_BUF2_SIZE
|
||||||
int "size of the BLE HCI LOG buffer"
|
int "size of the second BLE controller LOG buffer"
|
||||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
default 4096
|
default 1024
|
||||||
help
|
help
|
||||||
Configure the size of the BLE HCI LOG buffer.
|
Configure the size of the second BLE controller LOG buffer.
|
||||||
|
|
||||||
|
config BT_LE_LOG_HCI_BUF_SIZE
|
||||||
|
int "size of the BLE HCI LOG buffer"
|
||||||
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
default 4096
|
||||||
|
help
|
||||||
|
Configure the size of the BLE HCI LOG buffer.
|
||||||
|
endif
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
config BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
|
||||||
bool "Enable wrap panic handler"
|
bool "Enable wrap panic handler"
|
||||||
|
@@ -55,6 +55,9 @@
|
|||||||
#include "esp_sleep.h"
|
#include "esp_sleep.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
#include "ble_log.h"
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_spi_out.h"
|
#include "ble_log/ble_log_spi_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
@@ -62,6 +65,7 @@
|
|||||||
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
#include "ble_log/ble_log_uhci_out.h"
|
#include "ble_log/ble_log_uhci_out.h"
|
||||||
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
/* Macro definition
|
/* Macro definition
|
||||||
************************************************************************
|
************************************************************************
|
||||||
@@ -194,12 +198,14 @@ static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
|||||||
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
||||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
|
||||||
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
|
#endif /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
/* Local variable definition
|
/* Local variable definition
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
@@ -208,9 +214,47 @@ static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
|||||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
|
||||||
static bool log_is_inited = false;
|
static bool log_is_inited = false;
|
||||||
|
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
/* TODO: Remove event handler dependency in lib */
|
||||||
|
static void void_handler(void) {}
|
||||||
|
|
||||||
|
/* TODO: Declare public interfaces in a public header */
|
||||||
|
void esp_bt_controller_log_deinit(void)
|
||||||
|
{
|
||||||
|
log_is_inited = false;
|
||||||
|
r_ble_log_deinit_simple();
|
||||||
|
ble_log_deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_bt_controller_log_init(void)
|
||||||
|
{
|
||||||
|
if (log_is_inited) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ble_log_init()) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_ble_log_init_simple(ble_log_write_hex_ll, void_handler) != 0) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_ble_log_ctrl_level_and_mod(CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL,
|
||||||
|
CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH) != ESP_OK) {
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
log_is_inited = true;
|
||||||
|
return ESP_OK;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
esp_bt_controller_log_deinit();
|
||||||
|
return ESP_FAIL;
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
||||||
esp_err_t esp_bt_controller_log_init(void)
|
esp_err_t esp_bt_controller_log_init(void)
|
||||||
{
|
{
|
||||||
if (log_is_inited) {
|
if (log_is_inited) {
|
||||||
@@ -304,6 +348,7 @@ void esp_bt_controller_log_deinit(void)
|
|||||||
|
|
||||||
log_is_inited = false;
|
log_is_inited = false;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
#include "esp_partition.h"
|
#include "esp_partition.h"
|
||||||
@@ -1442,6 +1487,12 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
#if CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2
|
||||||
|
void esp_ble_controller_log_dump_all(bool output)
|
||||||
|
{
|
||||||
|
ble_log_dump_to_console();
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
|
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
|
||||||
{
|
{
|
||||||
@@ -1488,6 +1539,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
|||||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 */
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
|
||||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
||||||
|
Reference in New Issue
Block a user