mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 13:14:32 +02:00
feat(ble): support ble log uart dma out for ESP32-C5
This commit is contained in:
@@ -320,6 +320,16 @@ menu "Controller debug features"
|
|||||||
help
|
help
|
||||||
Output ble controller logs to SPI bus
|
Output ble controller logs to SPI bus
|
||||||
|
|
||||||
|
config BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
|
bool "Output ble controller logs via UART DMA (Experimental)"
|
||||||
|
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||||
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
|
depends on !BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
|
select BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Output ble controller logs via UART DMA
|
||||||
|
|
||||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
bool "Store ble controller logs to flash(Experimental)"
|
bool "Store ble controller logs to flash(Experimental)"
|
||||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
|
@@ -60,6 +60,10 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
#include "ble_log/ble_log_uhci_out.h"
|
||||||
|
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
|
||||||
/* Macro definition
|
/* Macro definition
|
||||||
************************************************************************
|
************************************************************************
|
||||||
*/
|
*/
|
||||||
@@ -189,9 +193,9 @@ 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_SPI_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
|
#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
|
||||||
@@ -218,25 +222,35 @@ esp_err_t esp_bt_controller_log_init(void)
|
|||||||
}
|
}
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
|
||||||
|
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
if (ble_log_uhci_out_init() != 0) {
|
||||||
|
goto uhci_out_init_failed;
|
||||||
|
}
|
||||||
|
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
if (r_ble_log_init_simple(ble_log_spi_out_ll_write, ble_log_spi_out_ll_log_ev_proc) != 0) {
|
if (r_ble_log_init_simple(ble_log_spi_out_ll_write, ble_log_spi_out_ll_log_ev_proc) != 0) {
|
||||||
goto log_init_failed;
|
goto log_init_failed;
|
||||||
}
|
}
|
||||||
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#elif CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
|
if (r_ble_log_init_simple(ble_log_uhci_out_ll_write, ble_log_uhci_out_ll_log_ev_proc) != 0) {
|
||||||
|
goto log_init_failed;
|
||||||
|
}
|
||||||
|
#else
|
||||||
uint8_t buffers = 0;
|
uint8_t buffers = 0;
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||||
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||||
buffers |= ESP_BLE_LOG_BUF_HCI;
|
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
#endif
|
||||||
|
|
||||||
bool task_create = true;
|
bool task_create = true;
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||||
task_create = false;
|
task_create = false;
|
||||||
#elif CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#elif CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
esp_bt_ctrl_log_partition_get_and_erase_first_block();
|
esp_bt_ctrl_log_partition_get_and_erase_first_block();
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#endif
|
||||||
|
|
||||||
if (r_ble_log_init_async(esp_bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size) != 0) {
|
if (r_ble_log_init_async(esp_bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size) != 0) {
|
||||||
goto log_init_failed;
|
goto log_init_failed;
|
||||||
@@ -252,14 +266,20 @@ esp_err_t esp_bt_controller_log_init(void)
|
|||||||
ctrl_level_init_failed:
|
ctrl_level_init_failed:
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
r_ble_log_deinit_simple();
|
r_ble_log_deinit_simple();
|
||||||
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#elif CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
|
r_ble_log_deinit_simple();
|
||||||
|
#else
|
||||||
r_ble_log_deinit_async();
|
r_ble_log_deinit_async();
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#endif
|
||||||
log_init_failed:
|
log_init_failed:
|
||||||
#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();
|
||||||
spi_out_init_failed:
|
spi_out_init_failed:
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
ble_log_uhci_out_deinit();
|
||||||
|
uhci_out_init_failed:
|
||||||
|
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,11 +289,17 @@ void esp_bt_controller_log_deinit(void)
|
|||||||
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
|
||||||
|
|
||||||
|
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
ble_log_uhci_out_deinit();
|
||||||
|
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#if CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
||||||
r_ble_log_deinit_simple();
|
r_ble_log_deinit_simple();
|
||||||
#else // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#elif CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
|
r_ble_log_deinit_simple();
|
||||||
|
#else
|
||||||
r_ble_log_deinit_async();
|
r_ble_log_deinit_async();
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#endif
|
||||||
|
|
||||||
log_is_inited = false;
|
log_is_inited = false;
|
||||||
}
|
}
|
||||||
@@ -1412,7 +1438,7 @@ 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_SPI_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)
|
||||||
{
|
{
|
||||||
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
|
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
|
||||||
@@ -1434,7 +1460,7 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, u
|
|||||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
}
|
}
|
||||||
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#endif // !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
|
|
||||||
void esp_ble_controller_log_dump_all(bool output)
|
void esp_ble_controller_log_dump_all(bool output)
|
||||||
{
|
{
|
||||||
@@ -1442,9 +1468,13 @@ void esp_ble_controller_log_dump_all(bool output)
|
|||||||
ble_log_spi_out_dump_all();
|
ble_log_spi_out_dump_all();
|
||||||
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
|
||||||
|
|
||||||
|
#if CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
ble_log_uhci_out_dump_all();
|
||||||
|
#endif // CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED
|
||||||
|
|
||||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||||
esp_bt_read_ctrl_log_from_flash(output);
|
esp_bt_read_ctrl_log_from_flash(output);
|
||||||
#elif !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
|
#elif !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED && !CONFIG_BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED
|
||||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||||
portENTER_CRITICAL_SAFE(&spinlock);
|
portENTER_CRITICAL_SAFE(&spinlock);
|
||||||
esp_panic_handler_feed_wdts();
|
esp_panic_handler_feed_wdts();
|
||||||
|
Reference in New Issue
Block a user