Skip to content

Commit 180e67b

Browse files
zhaoweiliang2021ChrysalisChenJ
authored andcommitted
feat(ble): implement ble capture info user handler on ESP32-C6 and ESP32-H2
1 parent c244960 commit 180e67b

File tree

4 files changed

+64
-4
lines changed

4 files changed

+64
-4
lines changed

components/bt/controller/esp32c6/Kconfig.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ menu "Controller debug features"
424424
config BT_LE_ERROR_SIM_ENABLED
425425
bool "Enable controller features for internal testing"
426426
default n
427+
428+
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
429+
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
430+
default n
427431
endmenu
428432

429433
config BT_LE_LL_RESOLV_LIST_SIZE
@@ -782,14 +786,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
782786
The value of upperlimitmax needs to be a power of 2.
783787

784788
config BT_LE_CTRL_CHAN_ASS_EN
785-
bool "Enable channel assessment"
789+
bool "Enable channel assessment(Experimental)"
786790
default n
787791
help
788792
If this option is enabled, The Controller will records the communication quality
789793
for each channel and then start a timer to check and update the channel map every 4 seconds.
790794

791795
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
792-
bool "Enable aux packet when ext adv data length is zero"
796+
bool "Enable aux packet when ext adv data length is zero(Experimental)"
793797
default y
794798
help
795799
When this option is enabled, auxiliary packets will be present in the events of

components/bt/controller/esp32c6/bt.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
115115
*/
116116
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
117117
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
118+
extern void esp_ble_controller_info_capture(uint32_t cycle_times);
118119
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
119120
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
120121
extern int r_ble_log_deinit_async(void);
@@ -1659,3 +1660,28 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
16591660

16601661
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
16611662
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
1663+
1664+
int IRAM_ATTR
1665+
ble_capture_info_user_handler(uint8_t type, uint32_t reason)
1666+
{
1667+
int i;
1668+
1669+
switch(type) {
1670+
case 0:
1671+
for (i = 0; i < 2; i++) {
1672+
esp_ble_controller_info_capture(0x010101);
1673+
}
1674+
1675+
break;
1676+
#if CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
1677+
case 1:
1678+
if ((reason == 0x08) || (reason == 0x3d) || (reason == 0x28)) {
1679+
osi_assert_wrapper(__LINE__,__func__, typereason);
1680+
}
1681+
break;
1682+
#endif // CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
1683+
default:
1684+
break;
1685+
}
1686+
return 0;
1687+
}

components/bt/controller/esp32h2/Kconfig.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@ menu "Controller debug features"
415415
config BT_LE_ERROR_SIM_ENABLED
416416
bool "Enable controller features for internal testing"
417417
default n
418+
419+
config BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED
420+
bool "When ACL disconnects abnormally, assertion processing is performed(Experimental)"
421+
default n
418422
endmenu
419423

420424
config BT_LE_LL_RESOLV_LIST_SIZE
@@ -783,14 +787,14 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
783787
The value of upperlimitmax needs to be a power of 2.
784788

785789
config BT_LE_CTRL_CHAN_ASS_EN
786-
bool "Enable channel assessment"
790+
bool "Enable channel assessment(Experimental)"
787791
default n
788792
help
789793
If this option is enabled, The Controller will records the communication quality
790794
for each channel and then start a timer to check and update the channel map every 4 seconds.
791795

792796
config BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX
793-
bool "Enable aux packet when ext adv data length is zero"
797+
bool "Enable aux packet when ext adv data length is zero(Experimental)"
794798
default y
795799
help
796800
When this option is enabled, auxiliary packets will be present in the events of

components/bt/controller/esp32h2/bt.c

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

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

0 commit comments

Comments
 (0)