From 38c5f239bedee585b6d8d0e0d4550036b7a36ce1 Mon Sep 17 00:00:00 2001 From: zwl Date: Thu, 5 Jan 2023 10:38:34 +0800 Subject: [PATCH] Enabled PCL feature on ESP32C6 BT Controller --- components/bt/controller/esp32c6/Kconfig.in | 7 +++++++ components/bt/controller/lib_esp32c6/esp32c6-bt-lib | 2 +- components/bt/host/nimble/port/include/esp_nimble_cfg.h | 4 ++++ components/bt/include/esp32c6/include/esp_bt.h | 4 +++- components/bt/include/esp32c6/include/esp_bt_cfg.h | 9 ++++++--- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/components/bt/controller/esp32c6/Kconfig.in b/components/bt/controller/esp32c6/Kconfig.in index 4c2ac499a9..13c46c1421 100644 --- a/components/bt/controller/esp32c6/Kconfig.in +++ b/components/bt/controller/esp32c6/Kconfig.in @@ -175,6 +175,13 @@ config BT_LE_MAX_PERIODIC_ADVERTISER_LIST help Set this option to set the upper limit for number of periodic advertiser list. +config BT_LE_POWER_CONTROL_ENABLED + bool "Enable controller support for BLE Power Control" + depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED && IDF_TARGET_ESP32C6 + default n + help + Set this option to enable the Power Control feature on controller + menu "Memory Settings" depends on !BT_NIMBLE_ENABLED diff --git a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib index 5b6a490d2b..0319817007 160000 --- a/components/bt/controller/lib_esp32c6/esp32c6-bt-lib +++ b/components/bt/controller/lib_esp32c6/esp32c6-bt-lib @@ -1 +1 @@ -Subproject commit 5b6a490d2b2fa54f3603079000b833f749289283 +Subproject commit 0319817007d1c65b3e3a951b68aaeee05171a966 diff --git a/components/bt/host/nimble/port/include/esp_nimble_cfg.h b/components/bt/host/nimble/port/include/esp_nimble_cfg.h index 8ff2c26c26..5b0c1793b4 100644 --- a/components/bt/host/nimble/port/include/esp_nimble_cfg.h +++ b/components/bt/host/nimble/port/include/esp_nimble_cfg.h @@ -1596,7 +1596,11 @@ #endif #ifndef MYNEWT_VAL_BLE_POWER_CONTROL +#ifdef CONFIG_BT_NIMBLE_BLE_POWER_CONTROL #define MYNEWT_VAL_BLE_POWER_CONTROL CONFIG_BT_NIMBLE_BLE_POWER_CONTROL +#else +#define MYNEWT_VAL_BLE_POWER_CONTROL (0) +#endif #endif #endif diff --git a/components/bt/include/esp32c6/include/esp_bt.h b/components/bt/include/esp32c6/include/esp_bt.h index acb94895e9..4b44099fed 100644 --- a/components/bt/include/esp32c6/include/esp_bt.h +++ b/components/bt/include/esp32c6/include/esp_bt.h @@ -145,7 +145,7 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type */ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle); -#define CONFIG_VERSION 0x20221220 +#define CONFIG_VERSION 0x20230113 #define CONFIG_MAGIC 0x5A5AA5A5 /** @@ -206,6 +206,7 @@ typedef struct { uint8_t version_num; uint8_t cpu_freq_mhz; uint8_t ignore_wl_for_direct_adv; + uint8_t enable_pcl; uint32_t config_magic; } esp_bt_controller_config_t; @@ -260,6 +261,7 @@ typedef struct { .version_num = 0, \ .cpu_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, \ .ignore_wl_for_direct_adv = 0, \ + .enable_pcl = DEFAULT_BT_LE_POWER_CONTROL_ENABLED, \ .config_magic = CONFIG_MAGIC, \ } diff --git a/components/bt/include/esp32c6/include/esp_bt_cfg.h b/components/bt/include/esp32c6/include/esp_bt_cfg.h index 36b5ae0336..cdb52cfdf5 100644 --- a/components/bt/include/esp32c6/include/esp_bt_cfg.h +++ b/components/bt/include/esp32c6/include/esp_bt_cfg.h @@ -28,7 +28,6 @@ extern "C" { #else #define BLE_LL_SCAN_PHY_NUMBER_N (1) #endif - #define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST MYNEWT_VAL(BLE_MAX_PERIODIC_ADVERTISER_LIST) #define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS) #define DEFAULT_BT_LE_MAX_CONNECTIONS MYNEWT_VAL(BLE_MAX_CONNECTIONS) @@ -41,7 +40,7 @@ extern "C" { #define DEFAULT_BT_LE_HCI_EVT_HI_BUF_COUNT MYNEWT_VAL(BLE_HCI_EVT_HI_BUF_COUNT) #define DEFAULT_BT_LE_HCI_EVT_LO_BUF_COUNT MYNEWT_VAL(BLE_HCI_EVT_LO_BUF_COUNT) #define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM_EFF - + #define DEFAULT_BT_LE_POWER_CONTROL_ENABLED MYNEWT_VAL(BLE_POWER_CONTROL) #else #if CONFIG_BT_LE_LL_CFG_FEAT_LE_CODED_PHY @@ -118,6 +117,11 @@ extern "C" { #define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF + #if defined(CONFIG_BT_LE_POWER_CONTROL_ENABLED) + #define DEFAULT_BT_LE_POWER_CONTROL_ENABLED (CONFIG_BT_LE_POWER_CONTROL_ENABLED) + #else + #define DEFAULT_BT_LE_POWER_CONTROL_ENABLED (0) + #endif #endif @@ -201,7 +205,6 @@ extern "C" { #define RUN_QA_TEST (0) #define NIMBLE_DISABLE_SCAN_BACKOFF (0) - #ifdef __cplusplus } #endif