diff --git a/components/bt/controller/esp32c3/Kconfig.in b/components/bt/controller/esp32c3/Kconfig.in index 100d66a722..2bea3782d9 100644 --- a/components/bt/controller/esp32c3/Kconfig.in +++ b/components/bt/controller/esp32c3/Kconfig.in @@ -83,13 +83,16 @@ choice BT_BLE_CCA_MODE default BT_BLE_CCA_MODE_NONE help Define BT BLE CCA mode + Note that if CCA feature is enabled, the hardware may not transmit packets due to channel busy. + Therefore, it may potentially lead to an increase in the time taken for scanning advertising packet + and establishing connections, or a decrease in the throughput rate of the connection. config BT_BLE_CCA_MODE_NONE bool "NONE" config BT_BLE_CCA_MODE_HW bool "Hardware" config BT_BLE_CCA_MODE_SW - bool "Software" + bool "Software (experimental)" endchoice config BT_BLE_CCA_MODE @@ -556,3 +559,71 @@ config BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS Enabling this option will add stricter verification of the Access Address in the CONNECT_IND PDU. This improves security by ensuring that only connection requests with valid Access Addresses are accepted. If disabled, only basic checks are applied, improving compatibility. + +menu "Controller debug log Options (Experimental)" + config BT_CTRL_LE_LOG_EN + depends on BT_CTRL_RUN_IN_FLASH_ONLY + bool "Enable BLE debug log" + default n + + config BT_CTRL_LE_HCI_LOG_EN + depends on BT_CTRL_LE_LOG_EN + bool "Enable BLE HCI log" + 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 + default n + help + Output ble controller logs to SPI bus + + config BT_CTRL_LE_LOG_MODE_EN + depends on BT_CTRL_LE_LOG_EN + int "Enable log for specified BLE mode" + range 0 4095 + default 4093 + + config BT_CTRL_LE_LOG_LEVEL + depends on BT_CTRL_LE_LOG_EN + int "The level of BLE log" + range 0 5 + default 2 + + config BT_CTRL_LE_LOG_BUF1_SIZE + depends on BT_CTRL_LE_LOG_EN + int "The size of BLE log buffer1" + default 1024 + + config BT_CTRL_LE_LOG_HCI_BUF_SIZE + depends on BT_CTRL_LE_LOG_EN + int "The size of BLE log HCI buffer" + default 1024 + + config BT_CTRL_LE_LOG_BUF2_SIZE + depends on BT_CTRL_LE_LOG_EN + int "The size of BLE log buffer2" + default 1024 +endmenu diff --git a/components/bt/controller/esp32c3/bt.c b/components/bt/controller/esp32c3/bt.c index fff2a6fca2..87ac7a1714 100644 --- a/components/bt/controller/esp32c3/bt.c +++ b/components/bt/controller/esp32c3/bt.c @@ -52,6 +52,10 @@ #if CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED #include "ble_log/ble_log_spi_out.h" #endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED +#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +#include "esp_partition.h" +#include "hal/wdt_hal.h" +#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN #if CONFIG_BT_ENABLED /* Macro definition @@ -118,12 +122,20 @@ do{\ } while(0) #define OSI_FUNCS_TIME_BLOCKING 0xffffffff -#define OSI_VERSION 0x00010009 +#define OSI_VERSION 0x0001000A #define OSI_MAGIC_VALUE 0xFADEBEAD #define BLE_PWR_HDL_INVL 0xFFFF #define BLE_CONTROLLER_MALLOC_CAPS (MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA) + +#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +#define MAX_STORAGE_SIZE (CONFIG_BT_CTRL_LE_LOG_PARTITION_SIZE) +#define BLOCK_SIZE (4096) +#define THRESHOLD (3072) +#define PARTITION_NAME "bt_ctrl_log" +#endif + /* Types definition ************************************************************************ */ @@ -219,8 +231,13 @@ struct osi_funcs_t { void (* _btdm_rom_table_ready)(void); bool (* _coex_bt_wakeup_request)(void); void (* _coex_bt_wakeup_request_end)(void); + int64_t (*_get_time_us)(void); + void (* _assert)(void); }; +#if CONFIG_BT_CTRL_LE_LOG_EN +typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end); +#endif // CONFIG_BT_CTRL_LE_LOG_EN /* External functions or values ************************************************************************ @@ -287,6 +304,15 @@ extern void advFilter_stack_enableDupExcListVsCmd(bool en); extern void chanSel_stack_enableSetCsaVsCmd(bool en); #endif // (CONFIG_BT_BLUEDROID_ENABLED || CONFIG_BT_NIMBLE_ENABLED) +/* BLE Log module */ +#if CONFIG_BT_CTRL_LE_LOG_EN +extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size); +extern int r_ble_log_deinit_async(void); +extern void r_ble_log_async_select_dump_buffers(uint8_t buffers); +extern void r_ble_log_async_output_dump_all(bool output); +extern void esp_panic_handler_feed_wdts(void); +#endif // CONFIG_BT_CTRL_LE_LOG_EN + extern uint32_t _bt_bss_start; extern uint32_t _bt_bss_end; extern uint32_t _bt_controller_bss_start; @@ -348,6 +374,8 @@ static void btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uint32 static void btdm_funcs_table_ready_wrapper(void); static bool coex_bt_wakeup_request(void); static void coex_bt_wakeup_request_end(void); +static int64_t get_time_us_wrapper(void); +static void assert_wrapper(void); static void btdm_slp_tmr_callback(void *arg); @@ -355,6 +383,15 @@ static esp_err_t try_heap_caps_add_region(intptr_t start, intptr_t end); static void bt_controller_deinit_internal(void); +#if CONFIG_BT_CTRL_LE_LOG_EN +static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end); +#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +void esp_bt_read_ctrl_log_from_flash(bool output); +static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end); +static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void); +#endif // #if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +#endif // CONFIG_BT_CTRL_LE_LOG_EN + /* Local variable definition *************************************************************************** */ @@ -420,6 +457,8 @@ static const struct osi_funcs_t osi_funcs_ro = { ._btdm_rom_table_ready = btdm_funcs_table_ready_wrapper, ._coex_bt_wakeup_request = coex_bt_wakeup_request, ._coex_bt_wakeup_request_end = coex_bt_wakeup_request_end, + ._get_time_us = get_time_us_wrapper, + ._assert = assert_wrapper, }; static DRAM_ATTR struct osi_funcs_t *osi_funcs_p; @@ -448,6 +487,255 @@ static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock; static DRAM_ATTR esp_pm_lock_handle_t s_light_sleep_pm_lock; #endif +#if CONFIG_BT_CTRL_LE_LOG_EN +enum log_out_mode { + LOG_DUMP_MEMORY, + LOG_ASYNC_OUT, + LOG_STORAGE_TO_FLASH, + LOG_SPI_OUT, +}; + +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; +#if CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY +uint8_t log_output_mode = LOG_DUMP_MEMORY; +#else +#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +uint8_t log_output_mode = LOG_STORAGE_TO_FLASH; +#elif CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN +uint8_t log_output_mode = LOG_SPI_OUT; +#else +uint8_t log_output_mode = LOG_ASYNC_OUT; +#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +#endif // CONFIG_BT_CTRL_LE_LOG_DUMP_ONLY +#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +static const esp_partition_t *log_partition; +static uint32_t write_index = 0; +static uint32_t next_erase_index = BLOCK_SIZE; +static bool block_erased = false; +static bool stop_write = false; +static bool is_filled = false; +#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN + +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 CONFIG_BT_CTRL_LE_LOG_STORAGE_EN + esp_bt_controller_log_storage(len, addr, end); +#endif //CONFIG_BT_CTRL_LE_LOG_STORAGE_EN + } else { + portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; + portENTER_CRITICAL_SAFE(&spinlock); + esp_panic_handler_feed_wdts(); + for (int i = 0; i < len; i++) { + esp_rom_printf("%02x ", addr[i]); + } + + if (end) { + esp_rom_printf("\n"); + } + portEXIT_CRITICAL_SAFE(&spinlock); + } +} + +#if CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN +static IRAM_ATTR void esp_bt_controller_spi_log_interface(uint32_t len, const uint8_t *addr, bool end) +{ + return ble_log_spi_out_write(BLE_LOG_SPI_OUT_SOURCE_ESP_LEGACY, addr, len); +} +#endif // CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN + +void esp_ble_controller_log_dump_all(bool output) +{ + if (log_output_mode == LOG_STORAGE_TO_FLASH) { +#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN + esp_bt_read_ctrl_log_from_flash(output); +#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN + } else { + portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; + portENTER_CRITICAL_SAFE(&spinlock); + esp_panic_handler_feed_wdts(); + esp_rom_printf("\r\n[DUMP_START:"); + r_ble_log_async_output_dump_all(output); + esp_rom_printf(":DUMP_END]\r\n"); + portEXIT_CRITICAL_SAFE(&spinlock); + } +} + +void esp_bt_log_output_mode_set(uint8_t output_mode) +{ + log_output_mode = output_mode; +} + +uint8_t esp_bt_log_output_mode_get(void) +{ + return log_output_mode; +} + +esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode) +{ + esp_err_t ret = ESP_OK; + interface_func_t bt_controller_log_interface; + bt_controller_log_interface = esp_bt_controller_log_interface; + bool task_create; + uint8_t buffers = 0; + + if (log_is_inited) { + return ret; + } + +#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 + + switch (log_output_mode) { + case LOG_DUMP_MEMORY: + task_create = false; + break; + case LOG_ASYNC_OUT: + case LOG_STORAGE_TO_FLASH: + task_create = true; +#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN + if (log_output_mode == LOG_STORAGE_TO_FLASH) { + esp_bt_ctrl_log_partition_get_and_erase_first_block(); + } +#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN + break; + case LOG_SPI_OUT: + task_create = true; +#if CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN + bt_controller_log_interface = esp_bt_controller_spi_log_interface; +#endif // CONFIG_BT_CTRL_LE_LOG_SPI_OUT_EN + break; + default: + assert(0); + } + + ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size); + if (ret == ESP_OK) { + log_is_inited = true; + } + + return ret; +} + +void esp_bt_ontroller_log_deinit(void) +{ + r_ble_log_deinit_async(); + log_is_inited = false; +} + +#if CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void) +{ + log_partition = NULL; + assert(MAX_STORAGE_SIZE % BLOCK_SIZE == 0); + // Find the partition map in the partition table + log_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, PARTITION_NAME); + assert(log_partition != NULL); + // Prepare data to be read later using the mapped address + ESP_ERROR_CHECK(esp_partition_erase_range(log_partition, 0, BLOCK_SIZE)); + write_index = 0; + next_erase_index = BLOCK_SIZE; + block_erased = false; + is_filled = false; + stop_write = false; +} + +static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end) +{ + if (len > MAX_STORAGE_SIZE) { + return -1; + } + + if (stop_write) { + return 0; + } + + if (((write_index) % BLOCK_SIZE) >= THRESHOLD && !block_erased) { + // esp_rom_printf("Ers nxt: %d,%d\n", next_erase_index, write_index); + esp_partition_erase_range(log_partition, next_erase_index, BLOCK_SIZE); + next_erase_index = (next_erase_index + BLOCK_SIZE) % MAX_STORAGE_SIZE; + block_erased = true; + } + + if (((write_index + len) / BLOCK_SIZE) > (write_index / BLOCK_SIZE)) { + block_erased = false; + } + + if (write_index + len <= MAX_STORAGE_SIZE) { + esp_partition_write(log_partition, write_index, addr, len); + write_index = (write_index + len) % MAX_STORAGE_SIZE; + } else { + uint32_t first_part_len = MAX_STORAGE_SIZE - write_index; + esp_partition_write(log_partition, write_index, addr, first_part_len); + esp_partition_write(log_partition, 0, addr + first_part_len, len - first_part_len); + write_index = len - first_part_len; + is_filled = true; + // esp_rom_printf("old idx: %d,%d\n",next_erase_index, write_index); + } + + return 0; +} + +void esp_bt_read_ctrl_log_from_flash(bool output) +{ + esp_partition_mmap_handle_t mmap_handle; + uint32_t read_index; + const void *mapped_ptr; + const uint8_t *buffer; + uint32_t print_len; + uint32_t max_print_len; + esp_err_t err; + + print_len = 0; + max_print_len = 4096; + err = esp_partition_mmap(log_partition, 0, MAX_STORAGE_SIZE, ESP_PARTITION_MMAP_DATA, &mapped_ptr, &mmap_handle); + if (err != ESP_OK) { + ESP_LOGE("FLASH", "Mmap failed: %s", esp_err_to_name(err)); + return; + } + + portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; + portENTER_CRITICAL_SAFE(&spinlock); + esp_panic_handler_feed_wdts(); + r_ble_log_async_output_dump_all(true); + esp_bt_ontroller_log_deinit(); + stop_write = true; + + buffer = (const uint8_t *)mapped_ptr; + esp_panic_handler_feed_wdts(); + if (is_filled) { + read_index = next_erase_index; + } else { + read_index = 0; + } + + esp_rom_printf("\r\nREAD_CHECK:%ld,%ld,%d\r\n",read_index, write_index, is_filled); + esp_rom_printf("\r\n[DUMP_START:"); + while (read_index != write_index) { + esp_rom_printf("%02x ", buffer[read_index]); + if (print_len > max_print_len) { + esp_panic_handler_feed_wdts(); + print_len = 0; + } + + print_len++; + read_index = (read_index + 1) % MAX_STORAGE_SIZE; + } + + esp_rom_printf(":DUMP_END]\r\n"); + portEXIT_CRITICAL_SAFE(&spinlock); + esp_partition_munmap(mmap_handle); + err = esp_bt_controller_log_init(log_output_mode); + assert(err == ESP_OK); +} +#endif // CONFIG_BT_CTRL_LE_LOG_STORAGE_EN +#endif // CONFIG_BT_CTRL_LE_LOG_EN + void IRAM_ATTR btdm_hw_mac_power_down_wrapper(void) { #if CONFIG_MAC_BB_PD @@ -1001,6 +1289,18 @@ static void coex_bt_wakeup_request_end(void) return; } +static IRAM_ATTR int64_t get_time_us_wrapper(void) +{ + return esp_timer_get_time(); +} + +static IRAM_ATTR void assert_wrapper(void) +{ +#if CONFIG_BT_CTRL_LE_LOG_EN + esp_ble_controller_log_dump_all(true); +#endif // CONFIG_BT_CTRL_LE_LOG_EN +} + bool esp_vhci_host_check_send_available(void) { if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) { @@ -1463,6 +1763,14 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg) periph_module_enable(PERIPH_BT_MODULE); periph_module_reset(PERIPH_BT_MODULE); +#if CONFIG_BT_CTRL_LE_LOG_EN + err = esp_bt_controller_log_init(log_output_mode); + if (err != ESP_OK) { + ESP_LOGW(BT_LOG_TAG, "ble_controller_log_init failed %d", err); + goto error; + } +#endif // CONFIG_BT_CTRL_LE_LOG_EN + err = btdm_controller_init(cfg); if (err != 0) { @@ -1584,6 +1892,10 @@ static void bt_controller_deinit_internal(void) #endif esp_phy_modem_deinit(); +#if CONFIG_BT_CTRL_LE_LOG_EN + esp_bt_ontroller_log_deinit(); +#endif // CONFIG_BT_CTRL_LE_LOG_EN + if (osi_funcs_p != NULL) { free(osi_funcs_p); osi_funcs_p = NULL; diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index aaf54a5f7e..2fd7ad255f 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit aaf54a5f7e122db70b4a7ff02d2617858d43f649 +Subproject commit 2fd7ad255fceabdfba56882ce4523efdba2fc255 diff --git a/components/bt/include/esp32c3/include/esp_bt.h b/components/bt/include/esp32c3/include/esp_bt.h index 820dc62312..e2f4f286e3 100644 --- a/components/bt/include/esp32c3/include/esp_bt.h +++ b/components/bt/include/esp32c3/include/esp_bt.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -30,7 +30,7 @@ extern "C" { * * @note Please do not modify this value */ -#define ESP_BT_CTRL_CONFIG_VERSION 0x02410230 +#define ESP_BT_CTRL_CONFIG_VERSION 0x02502230 /** * @brief Internal use only @@ -323,6 +323,24 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status); #define BLE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED 0 #endif +#if defined(CONFIG_BT_CTRL_LE_LOG_EN) +#define BT_BLE_LOG_EN CONFIG_BT_CTRL_LE_LOG_EN +#else +#define BT_BLE_LOG_EN (0) +#endif + +#if defined(CONFIG_BT_CTRL_LE_LOG_MODE_EN) +#define BLE_LOG_MODE_EN CONFIG_BT_CTRL_LE_LOG_MODE_EN +#else +#define BLE_LOG_MODE_EN (0) +#endif + +#if defined(CONFIG_BT_CTRL_LE_LOG_LEVEL) +#define BLE_LOG_LEVEL CONFIG_BT_CTRL_LE_LOG_LEVEL +#else +#define BLE_LOG_LEVEL (0) +#endif + #define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \ .magic = ESP_BT_CTRL_CONFIG_MAGIC_VAL, \ .version = ESP_BT_CTRL_CONFIG_VERSION, \ @@ -369,6 +387,8 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status); .master_en = BT_CTRL_BLE_MASTER, \ .scan_en = BT_CTRL_BLE_SCAN, \ .ble_aa_check = BLE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED, \ + .ble_log_mode_en = BLE_LOG_MODE_EN, \ + .ble_log_level = BLE_LOG_LEVEL, \ } #else @@ -473,8 +493,8 @@ typedef struct { uint8_t ble_cca_mode; /*!< BLE CCA mode. Configurable in menuconfig - 0 - Disable (default) - 1 - Hardware-triggered CCA - - 2 - Software-based CCA */ - uint8_t ble_data_lenth_zero_aux; /*!< Enable / disable AUX packets when the extended ADV data length is zero. Configurable in menuconfig. + - 2 - Software-based CCA (experimental) */ + uint8_t ble_data_lenth_zero_aux; /*!< Enable / disable auxiliary packets when the extended ADV data length is zero. Configurable in menuconfig. - 0 - Disable (default) - 1 - Enable */ uint8_t ble_chan_ass_en; /*!< Enable / disable BLE channel assessment. Configurable in menuconfig. @@ -492,6 +512,8 @@ typedef struct { bool master_en; /*!< In the flash mode, True if the master feature is enabled (default); false otherwise. Configurable in menuconfig.*/ bool scan_en; /*!< In the flash mode, True if the scan feature is enabled (default); false otherwise. Configurable in menuconfig.*/ bool ble_aa_check; /*!< True if adds a verification step for the Access Address within the CONNECT_IND PDU; false otherwise. Configurable in menuconfig */ + uint32_t ble_log_mode_en; /*!< BLE log mode enable */ + uint8_t ble_log_level; /*!< BLE log level */ } esp_bt_controller_config_t; /** @@ -902,6 +924,16 @@ void esp_vhci_host_send_packet(uint8_t *data, uint16_t len); */ esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback); +/** + * @brief Select buffers +*/ +typedef enum { + ESP_BLE_LOG_BUF_HCI = 0x02, + ESP_BLE_LOG_BUF_CONTROLLER = 0x05, +} esp_ble_log_buf_t; + +void esp_ble_controller_log_dump_all(bool output); + #ifdef __cplusplus } #endif diff --git a/components/bt/include/esp32c3/include/esp_bt_vs.h b/components/bt/include/esp32c3/include/esp_bt_vs.h index 88e5ef2b33..78d926eb09 100644 --- a/components/bt/include/esp32c3/include/esp_bt_vs.h +++ b/components/bt/include/esp32c3/include/esp_bt_vs.h @@ -158,6 +158,8 @@ struct bt_hci_vs_le_adv_lost_evt { #define ESP_BT_VS_CFG_TEST_GET_CTRL_COMPILE_VER_SUBCMD (0X24) #define ESP_BT_VS_CFG_TEST_SET_AUX_ADV_OFFSET_SUBCMD (0X25) #define ESP_BT_VS_CFG_TEST_SET_AUX_OFFSET_THRESHOLD_SUBCMD (0X2b) + #define ESP_BT_VS_CFG_TEST_SET_RX_SENS_THRESH_SUBCMD (0X31) + #define ESP_BT_VS_CFG_TEST_SET_AGC_MAX_GAIN_SUBCMD (0X39) #define ESP_BT_VS_CFG_TEST_RELATED_SUBCMD_MAX (0Xff) // diff --git a/components/esp_rom/esp32c3/ld/esp32c3.rom.bt_funcs.ld b/components/esp_rom/esp32c3/ld/esp32c3.rom.bt_funcs.ld index 3604d3235f..580217eb5b 100644 --- a/components/esp_rom/esp32c3/ld/esp32c3.rom.bt_funcs.ld +++ b/components/esp_rom/esp32c3/ld/esp32c3.rom.bt_funcs.ld @@ -421,7 +421,7 @@ r_llc_ll_reject_ind_pdu_send = 0x40000f3c; r_llc_ll_start_enc_rsp_ack_handler = 0x40000f40; r_llc_ll_terminate_ind_ack = 0x40000f44; r_llc_ll_unknown_ind_handler = 0x40000f48; -r_llc_llcp_send = 0x40000f4c; +/* r_llc_llcp_send = 0x40000f4c; */ r_llc_llcp_state_set = 0x40000f50; r_llc_llcp_trans_timer_set = 0x40000f54; r_llc_llcp_tx_check = 0x40000f58; @@ -506,7 +506,7 @@ r_lld_con_data_len_update = 0x400010a0; r_lld_con_data_tx = 0x400010a4; r_lld_con_enc_key_load = 0x400010a8; r_lld_con_event_counter_get = 0x400010ac; -r_lld_con_evt_canceled_cbk = 0x400010b0; +/* r_lld_con_evt_canceled_cbk = 0x400010b0; */ r_lld_con_evt_duration_min_get = 0x400010b4; r_lld_con_evt_max_eff_time_cal = 0x400010b8; r_lld_con_evt_sd_evt_time_get = 0x400010bc; diff --git a/components/esp_rom/esp32s3/ld/esp32s3.rom.bt_funcs.ld b/components/esp_rom/esp32s3/ld/esp32s3.rom.bt_funcs.ld index 4db94d9779..946f9c2088 100644 --- a/components/esp_rom/esp32s3/ld/esp32s3.rom.bt_funcs.ld +++ b/components/esp_rom/esp32s3/ld/esp32s3.rom.bt_funcs.ld @@ -421,7 +421,7 @@ r_llc_ll_reject_ind_pdu_send = 0x40003d98; r_llc_ll_start_enc_rsp_ack_handler = 0x40003da4; r_llc_ll_terminate_ind_ack = 0x40003db0; r_llc_ll_unknown_ind_handler = 0x40003dbc; -r_llc_llcp_send = 0x40003dc8; +/* r_llc_llcp_send = 0x40003dc8; */ r_llc_llcp_state_set = 0x40003dd4; r_llc_llcp_trans_timer_set = 0x40003de0; r_llc_llcp_tx_check = 0x40003dec; @@ -507,7 +507,7 @@ r_lld_con_data_len_update = 0x400041c4; r_lld_con_data_tx = 0x400041d0; r_lld_con_enc_key_load = 0x400041dc; r_lld_con_event_counter_get = 0x400041e8; -r_lld_con_evt_canceled_cbk = 0x400041f4; +/* r_lld_con_evt_canceled_cbk = 0x400041f4; */ r_lld_con_evt_duration_min_get = 0x40004200; r_lld_con_evt_max_eff_time_cal = 0x4000420c; r_lld_con_evt_sd_evt_time_get = 0x40004218;