feat(ble): implement ble capture info user handler on ESP32-C6 and ESP32-H2

This commit is contained in:
zwl 2025-02-18 11:46:07 +08:00 committed by BLE BOT
parent f4a8aaffcb
commit 1195ce2e59
4 changed files with 64 additions and 4 deletions

View File

@ -424,6 +424,10 @@ menu "Controller debug features"
config BT_LE_ERROR_SIM_ENABLED
bool "Enable controller features for internal testing"
default n
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
endmenu
config BT_LE_LL_RESOLV_LIST_SIZE
@ -782,14 +786,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
The value of upperlimitmax needs to be a power of 2.
config BT_LE_CTRL_CHAN_ASS_EN
bool "Enable channel assessment"
bool "Enable channel assessment(Experimental)"
default n
help
If this option is enabled, The Controller will records the communication quality
for each channel and then start a timer to check and update the channel map every 4 seconds.
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
bool "Enable aux packet when ext adv data length is zero"
bool "Enable aux packet when ext adv data length is zero(Experimental)"
default y
help
When this option is enabled, auxiliary packets will be present in the events of

View File

@ -116,6 +116,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
*/
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
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);
@ -1652,3 +1653,28 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
int IRAM_ATTR
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
{
int i;
switch(type) {
case 0:
for (i = 0; i < 2; i++) {
esp_ble_controller_info_capture(0x010101);
}
break;
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
case 1:
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
osi_assert_wrapper(__LINE__,__func__, type, reason);
}
break;
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
default:
break;
}
return 0;
}

View File

@ -415,6 +415,10 @@ menu "Controller debug features"
config BT_LE_ERROR_SIM_ENABLED
bool "Enable controller features for internal testing"
default n
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
endmenu
config BT_LE_LL_RESOLV_LIST_SIZE
@ -783,14 +787,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
The value of upperlimitmax needs to be a power of 2.
config BT_LE_CTRL_CHAN_ASS_EN
bool "Enable channel assessment"
bool "Enable channel assessment(Experimental)"
default n
help
If this option is enabled, The Controller will records the communication quality
for each channel and then start a timer to check and update the channel map every 4 seconds.
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
bool "Enable aux packet when ext adv data length is zero"
bool "Enable aux packet when ext adv data length is zero(Experimental)"
default y
help
When this option is enabled, auxiliary packets will be present in the events of

View File

@ -110,6 +110,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
*/
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
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);
@ -1632,3 +1633,28 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
int IRAM_ATTR
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
{
int i;
switch(type) {
case 0:
for (i = 0; i < 2; i++) {
esp_ble_controller_info_capture(0x010101);
}
break;
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
case 1:
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
osi_assert_wrapper(__LINE__,__func__, type, reason);
}
break;
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
default:
break;
}
return 0;
}