feat(ble): implement ble capture info user handler on ESP32-C5

This commit is contained in:
zwl 2025-02-18 11:47:03 +08:00 committed by cjin
parent 180e67b547
commit 01f9245da1
2 changed files with 32 additions and 2 deletions

View File

@ -392,6 +392,10 @@ menu "Controller debug features"
config BT_LE_ERROR_SIM_ENABLED config BT_LE_ERROR_SIM_ENABLED
bool "Enable controller features for internal testing" bool "Enable controller features for internal testing"
default n default n
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
default n
endmenu endmenu
config BT_LE_LL_RESOLV_LIST_SIZE config BT_LE_LL_RESOLV_LIST_SIZE
@ -757,14 +761,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
The value of upperlimitmax needs to be a power of 2. The value of upperlimitmax needs to be a power of 2.
config BT_LE_CTRL_CHAN_ASS_EN config BT_LE_CTRL_CHAN_ASS_EN
bool "Enable channel assessment" bool "Enable channel assessment(Experimental)"
default n default n
help help
If this option is enabled, The Controller will records the communication quality 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. 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 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 default y
help help
When this option is enabled, auxiliary packets will be present in the events of When this option is enabled, auxiliary packets will be present in the events of

View File

@ -112,6 +112,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 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 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 #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_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 int r_ble_log_deinit_async(void);
@ -1638,3 +1639,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_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED) #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;
}