Skip to content

Commit 18ce40a

Browse files
feat(ble): implement ble capture info user handler on ESP32-C5
1 parent aeff03b commit 18ce40a

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
@@ -105,6 +105,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
105105
*/
106106
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
107107
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
108+
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
108109
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
109110
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
110111
extern int r_ble_log_deinit_async(void);
@@ -1618,3 +1619,28 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
16181619

16191620
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
16201621
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
1622+
1623+
int IRAM_ATTR
1624+
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
1625+
{
1626+
int i;
1627+
1628+
switch(type) {
1629+
case 0:
1630+
for (i = 0; i < 2; i++) {
1631+
esp_ble_controller_info_capture(0x010101);
1632+
}
1633+
1634+
break;
1635+
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
1636+
case 1:
1637+
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
1638+
osi_assert_wrapper(__LINE__,__func__, type, reason);
1639+
}
1640+
break;
1641+
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
1642+
default:
1643+
break;
1644+
}
1645+
return 0;
1646+
}

0 commit comments

Comments
 (0)