diff --git a/components/bt/controller/esp32c5/Kconfig.in b/components/bt/controller/esp32c5/Kconfig.in index 78e6b88812..8d6daf7247 100644 --- a/components/bt/controller/esp32c5/Kconfig.in +++ b/components/bt/controller/esp32c5/Kconfig.in @@ -196,6 +196,13 @@ config BT_LE_POWER_CONTROL_ENABLED help Set this option to enable the Power Control feature on controller +config BT_LE_PERIODIC_ADV_WITH_RESPONSE_ENABLED + bool "Enable BLE periodic advertising with response" + depends on BT_LE_50_FEATURE_SUPPORT + default n + help + This enables BLE periodic advertising with response feature + menu "Memory Settings" depends on !BT_NIMBLE_ENABLED diff --git a/components/bt/controller/esp32c5/ble.c b/components/bt/controller/esp32c5/ble.c index 27add99a59..0b6fc1e7d0 100644 --- a/components/bt/controller/esp32c5/ble.c +++ b/components/bt/controller/esp32c5/ble.c @@ -39,6 +39,25 @@ int dtm_stack_enable(void); void dtm_stack_disable(void); #endif // CONFIG_BT_LE_DTM_ENABLED +#if DEFAULT_BT_LE_PAWR_SUPPORTED || CONFIG_BT_LE_ERROR_SIM_ENABLED +int ble_single_env_init(void); +void ble_single_env_deinit(void); +int ble_single_init(void); +void ble_single_deinit(void); +#endif // DEFAULT_BT_LE_PAWR_SUPPORTED || CONFIG_BT_LE_ERROR_SIM_ENABLED + +#if DEFAULT_BT_LE_PAWR_SUPPORTED +int pawrBcast_stack_initEnv(void); +void pawrBcast_stack_deinitEnv(void); +int pawrBcast_stack_enable(void); +void pawrBcast_stack_disable(void); + +int pawrSync_stack_initEnv(void); +void pawrSync_stack_deinitEnv(void); +int pawrSync_stack_enable(void); +void pawrSync_stack_disable(void); +#endif // DEFAULT_BT_LE_PAWR_SUPPORTED + int conn_stack_initEnv(void); void conn_stack_deinitEnv(void); int conn_stack_enable(void); @@ -128,6 +147,7 @@ int ble_stack_initEnv(void) return rc; } #endif // CONFIG_BT_LE_DTM_ENABLED + #if DEFAULT_BT_LE_MAX_CONNECTIONS rc = conn_stack_initEnv(); if (rc) { @@ -140,11 +160,45 @@ int ble_stack_initEnv(void) } #endif // CONFIG_BT_LE_ERROR_SIM_ENABLED #endif // DEFAULT_BT_LE_MAX_CONNECTIONS + +#if DEFAULT_BT_LE_PAWR_SUPPORTED || CONFIG_BT_LE_ERROR_SIM_ENABLED + rc = ble_single_env_init(); + if (rc) { + return rc; + } + + rc = ble_single_init(); + if (rc) { + return rc; + } +#endif // DEFAULT_BT_LE_PAWR_SUPPORTED || CONFIG_BT_LE_ERROR_SIM_ENABLED + +#if DEFAULT_BT_LE_PAWR_SUPPORTED + rc = pawrBcast_stack_initEnv(); + if (rc) { + return rc; + } + + rc = pawrSync_stack_initEnv(); + if (rc) { + return rc; + } +#endif // DEFAULT_BT_LE_PAWR_SUPPORTED + return 0; } void ble_stack_deinitEnv(void) { +#if DEFAULT_BT_LE_PAWR_SUPPORTED + pawrSync_stack_deinitEnv(); + pawrBcast_stack_deinitEnv(); +#endif // DEFAULT_BT_LE_PAWR_SUPPORTED +#if DEFAULT_BT_LE_PAWR_SUPPORTED || CONFIG_BT_LE_ERROR_SIM_ENABLED + ble_single_deinit(); + ble_single_env_deinit(); +#endif // DEFAULT_BT_LE_PAWR_SUPPORTED || CONFIG_BT_LE_ERROR_SIM_ENABLED + #if DEFAULT_BT_LE_MAX_CONNECTIONS #if CONFIG_BT_LE_ERROR_SIM_ENABLED conn_errorSim_deinitEnv(); @@ -154,6 +208,7 @@ void ble_stack_deinitEnv(void) #if CONFIG_BT_LE_DTM_ENABLED dtm_stack_deinitEnv(); #endif // CONFIG_BT_LE_DTM_ENABLED + sync_stack_deinitEnv(); extAdv_stack_deinitEnv(); adv_stack_deinitEnv(); @@ -203,6 +258,17 @@ int ble_stack_enable(void) } #endif // CONFIG_BT_LE_ERROR_SIM_ENABLED #endif // DEFAULT_BT_LE_MAX_CONNECTIONS +#if DEFAULT_BT_LE_PAWR_SUPPORTED + rc = pawrBcast_stack_enable(); + if (rc) { + return rc; + } + + rc = pawrSync_stack_enable(); + if (rc) { + return rc; + } +#endif // DEFAULT_BT_LE_PAWR_SUPPORTED #if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED) ble_stack_enableVsCmds(true); @@ -212,20 +278,7 @@ int ble_stack_enable(void) #if CONFIG_BT_LE_RXBUF_OPT_ENABLED mmgmt_enableRxbufOptFeature(); #endif // CONFIG_BT_LE_RXBUF_OPT_ENABLED - rc = adv_stack_enable(); - if (rc) { - return rc; - } - rc = extAdv_stack_enable(); - if (rc) { - return rc; - } - - rc = sync_stack_enable(); - if (rc) { - return rc; - } return 0; } @@ -235,7 +288,10 @@ void ble_stack_disable(void) ble_stack_enableVsEvents(false); ble_stack_enableVsCmds(false); #endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED) - +#if DEFAULT_BT_LE_PAWR_SUPPORTED + pawrSync_stack_disable(); + pawrBcast_stack_disable(); +#endif // DEFAULT_BT_LE_PAWR_SUPPORTED #if DEFAULT_BT_LE_MAX_CONNECTIONS #if CONFIG_BT_LE_ERROR_SIM_ENABLED conn_errorSim_disable(); diff --git a/components/bt/controller/esp32c5/esp_bt_cfg.h b/components/bt/controller/esp32c5/esp_bt_cfg.h index 01f9dc6182..4734737c5a 100644 --- a/components/bt/controller/esp32c5/esp_bt_cfg.h +++ b/components/bt/controller/esp32c5/esp_bt_cfg.h @@ -45,6 +45,11 @@ extern "C" { #else #define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0) #endif + #if CONFIG_BT_NIMBLE_PERIODIC_ADV_WITH_RESPONSES + #define DEFAULT_BT_LE_PAWR_SUPPORTED (1) + #else + #define DEFAULT_BT_LE_PAWR_SUPPORTED (0) + #endif // CONFIG_BT_NIMBLE_PERIODIC_ADV_WITH_RESPONSES #else #if CONFIG_BT_LE_LL_CFG_FEAT_LE_CODED_PHY @@ -71,6 +76,12 @@ extern "C" { #define DEFAULT_BT_LE_MAX_CONNECTIONS (2) #endif + #if defined(CONFIG_BT_LE_PERIODIC_ADV_WITH_RESPONSE_ENABLED) + #define DEFAULT_BT_LE_PAWR_SUPPORTED (CONFIG_BT_LE_PERIODIC_ADV_WITH_RESPONSE_ENABLED) + #else + #define DEFAULT_BT_LE_PAWR_SUPPORTED (0) + #endif + #if defined(CONFIG_BT_LE_ACL_BUF_SIZE) #define DEFAULT_BT_LE_ACL_BUF_SIZE (CONFIG_BT_LE_ACL_BUF_SIZE) #else