Skip to content

Commit 01f9245

Browse files
zhaoweiliang2021ChrysalisChenJ
authored andcommitted
feat(ble): implement ble capture info user handler on ESP32-C5
1 parent 180e67b commit 01f9245

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

components/bt/controller/esp32c5/Kconfig.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@ menu "Controller debug features"
392392
config BT_LE_ERROR_SIM_ENABLED
393393
bool "Enable controller features for internal testing"
394394
default n
395+
396+
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
397+
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
398+
default n
395399
endmenu
396400

397401
config BT_LE_LL_RESOLV_LIST_SIZE
@@ -757,14 +761,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
757761
The value of upperlimitmax needs to be a power of 2.
758762

759763
config BT_LE_CTRL_CHAN_ASS_EN
760-
bool "Enable channel assessment"
764+
bool "Enable channel assessment(Experimental)"
761765
default n
762766
help
763767
If this option is enabled, The Controller will records the communication quality
764768
for each channel and then start a timer to check and update the channel map every 4 seconds.
765769

766770
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
767-
bool "Enable aux packet when ext adv data length is zero"
771+
bool "Enable aux packet when ext adv data length is zero(Experimental)"
768772
default y
769773
help
770774
When this option is enabled, auxiliary packets will be present in the events of

components/bt/controller/esp32c5/bt.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
112112
*/
113113
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
114114
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
115+
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
115116
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
116117
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
117118
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)
16381639

16391640
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
16401641
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
1642+
1643+
int IRAM_ATTR
1644+
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
1645+
{
1646+
int i;
1647+
1648+
switch(type) {
1649+
case 0:
1650+
for (i = 0; i < 2; i++) {
1651+
esp_ble_controller_info_capture(0x010101);
1652+
}
1653+
1654+
break;
1655+
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
1656+
case 1:
1657+
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
1658+
osi_assert_wrapper(__LINE__,__func__, typereason);
1659+
}
1660+
break;
1661+
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
1662+
default:
1663+
break;
1664+
}
1665+
return 0;
1666+
}

0 commit comments

Comments
 (0)