mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/ble_issues_bugfix_v5.1' into 'release/v5.1'
ble: bugfix for esp32c6 and esp32h2 See merge request espressif/esp-idf!24952
This commit is contained in:
commit
79b1379662
@ -260,6 +260,19 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_LL_RESOLV_LIST_SIZE
|
||||
int "BLE LL Resolving list size"
|
||||
range 1 5
|
||||
|
@ -110,12 +110,20 @@ struct ext_funcs_t {
|
||||
uint32_t magic;
|
||||
};
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create);
|
||||
extern int ble_log_deinit_async(void);
|
||||
extern void ble_log_async_output_dump_all(bool output);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_controller_deinit(void);
|
||||
extern int ble_controller_enable(uint8_t mode);
|
||||
extern int ble_controller_disable(void);
|
||||
@ -179,6 +187,9 @@ static void esp_reset_rpa_moudle(void);
|
||||
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,
|
||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@ -371,6 +382,23 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (!end) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x,", addr[i]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x,", addr[i]);
|
||||
}
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no)
|
||||
{
|
||||
@ -807,6 +835,20 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
ret = ble_log_init_async(bt_controller_log_interface, false);
|
||||
#else
|
||||
ret = ble_log_init_async(bt_controller_log_interface, true);
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
ret = controller_sleep_init();
|
||||
@ -826,6 +868,9 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
|
||||
free_controller:
|
||||
controller_sleep_deinit();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
esp_btbb_disable();
|
||||
esp_phy_disable();
|
||||
@ -864,6 +909,9 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
@ -1143,6 +1191,13 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
return (esp_power_level_t)tx_level;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
ble_log_async_output_dump_all(output);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
|
||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED == true)
|
||||
#define BLE_SM_KEY_ERR 0x17
|
||||
|
@ -260,6 +260,19 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_LL_RESOLV_LIST_SIZE
|
||||
int "BLE LL Resolving list size"
|
||||
range 1 5
|
||||
|
@ -107,12 +107,19 @@ struct ext_funcs_t {
|
||||
uint32_t magic;
|
||||
};
|
||||
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create);
|
||||
extern int ble_log_deinit_async(void);
|
||||
extern void ble_log_async_output_dump_all(bool output);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_controller_deinit(void);
|
||||
extern int ble_controller_enable(uint8_t mode);
|
||||
extern int ble_controller_disable(void);
|
||||
@ -176,6 +183,9 @@ static void esp_reset_rpa_moudle(void);
|
||||
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,
|
||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@ -364,6 +374,23 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (!end) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x,", addr[i]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x,", addr[i]);
|
||||
}
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no)
|
||||
{
|
||||
@ -788,6 +815,20 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
ret = ble_log_init_async(bt_controller_log_interface, false);
|
||||
#else
|
||||
ret = ble_log_init_async(bt_controller_log_interface, true);
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
ret = controller_sleep_init();
|
||||
@ -808,6 +849,9 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
|
||||
free_controller:
|
||||
controller_sleep_deinit();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
esp_btbb_disable();
|
||||
esp_phy_disable();
|
||||
@ -844,6 +888,9 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
@ -1123,6 +1170,13 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
return (esp_power_level_t)tx_level;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
ble_log_async_output_dump_all(output);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
|
||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED == true)
|
||||
#define BLE_SM_KEY_ERR 0x17
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit ddd61e9a276926496437665dd217cba2850db6b9
|
||||
Subproject commit d785de0a7c46d9badcd73bc83c2e5cb78f7054b2
|
@ -1 +1 @@
|
||||
Subproject commit b207a7da7a9758dbccea0dba1023fd36c47b3e65
|
||||
Subproject commit 35bd3cd7352014d303a96c46d8ea8446ea0a9a54
|
@ -76,9 +76,6 @@ typedef enum {
|
||||
* @brief Bluetooth TX power level(index), it's just a index corresponding to power(dbm).
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_PWR_LVL_N24 = 0, /*!< Corresponding to -24dbm */
|
||||
ESP_PWR_LVL_N21 = 1, /*!< Corresponding to -21dbm */
|
||||
ESP_PWR_LVL_N18 = 2, /*!< Corresponding to -18dbm */
|
||||
ESP_PWR_LVL_N15 = 3, /*!< Corresponding to -15dbm */
|
||||
ESP_PWR_LVL_N12 = 4, /*!< Corresponding to -12dbm */
|
||||
ESP_PWR_LVL_N9 = 5, /*!< Corresponding to -9dbm */
|
||||
@ -91,7 +88,7 @@ typedef enum {
|
||||
ESP_PWR_LVL_P12 = 12, /*!< Corresponding to +12dbm */
|
||||
ESP_PWR_LVL_P15 = 13, /*!< Corresponding to +15dbm */
|
||||
ESP_PWR_LVL_P18 = 14, /*!< Corresponding to +18dbm */
|
||||
ESP_PWR_LVL_P21 = 15, /*!< Corresponding to +21dbm */
|
||||
ESP_PWR_LVL_P20 = 15, /*!< Corresponding to +20dbm */
|
||||
ESP_PWR_LVL_INVALID = 0xFF, /*!< Indicates an invalid value */
|
||||
} esp_power_level_t;
|
||||
|
||||
@ -367,6 +364,14 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode);
|
||||
/* Returns random static address or -1 if not present */
|
||||
extern int esp_ble_hw_get_static_addr(esp_ble_addr_t *addr);
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/** @brief esp_ble_controller_log_dump_all
|
||||
* dump all controller log information cached in buffer
|
||||
* @param output : true for log dump, false will be no effect
|
||||
*/
|
||||
void esp_ble_controller_log_dump_all(bool output);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -368,6 +368,14 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode);
|
||||
/* Returns random static address or -1 if not present */
|
||||
extern int esp_ble_hw_get_static_addr(esp_ble_addr_t *addr);
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/** @brief esp_ble_controller_log_dump_all
|
||||
* dump all controller log information cached in buffer
|
||||
* @param output : true for log dump, false will be no effect
|
||||
*/
|
||||
void esp_ble_controller_log_dump_all(bool output);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user