mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 18:40:59 +02:00
feat(ble): supported ble log v2 for ESP32-H2
This commit is contained in:
@@ -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