From 97188e80682928c40ced09afd22d3007c6b91f9e Mon Sep 17 00:00:00 2001 From: zwj Date: Tue, 15 Jun 2021 21:10:23 +0800 Subject: [PATCH] support hw recorrect --- components/bt/controller/esp32c3/Kconfig.in | 13 +++++++++++++ components/bt/controller/esp32s3/Kconfig.in | 13 +++++++++++++ components/bt/controller/lib_esp32c3_family | 2 +- .../bt/include/esp32c3/include/esp_bt.h | 19 ++++++++++++++++++- .../bt/include/esp32s3/include/esp_bt.h | 16 ++++++++++++++++ 5 files changed, 61 insertions(+), 2 deletions(-) diff --git a/components/bt/controller/esp32c3/Kconfig.in b/components/bt/controller/esp32c3/Kconfig.in index 195d66ce7a..6f8fee6cd3 100644 --- a/components/bt/controller/esp32c3/Kconfig.in +++ b/components/bt/controller/esp32c3/Kconfig.in @@ -383,3 +383,16 @@ config BT_CTRL_HCI_TL_EFF default 0 if BT_CTRL_HCI_MODE_UART_H4 default 1 if BT_CTRL_HCI_M0DE_VHCI default 1 + +config BT_CTRL_AGC_RECORRECT_EN + bool "Enable HW AGC recorrect" + default n + help + Enable uncoded phy AGC recorrect + +config BT_CTRL_CODED_AGC_RECORRECT_EN + bool "Enable coded phy AGC recorrect" + depends on BT_CTRL_AGC_RECORRECT_EN + default n + help + Enable coded phy AGC recorrect diff --git a/components/bt/controller/esp32s3/Kconfig.in b/components/bt/controller/esp32s3/Kconfig.in index 5c35acc9c0..53ca7b0616 100644 --- a/components/bt/controller/esp32s3/Kconfig.in +++ b/components/bt/controller/esp32s3/Kconfig.in @@ -400,3 +400,16 @@ config BT_CTRL_HCI_TL_EFF default 0 if BT_CTRL_HCI_MODE_UART_H4 default 1 if BT_CTRL_HCI_M0DE_VHCI default 1 + +config BT_CTRL_AGC_RECORRECT_EN + bool "Enable HW AGC recorrect" + default n + help + Enable uncoded phy AGC recorrect + +config BT_CTRL_CODED_AGC_RECORRECT_EN + bool "Enable coded phy AGC recorrect" + depends on BT_CTRL_AGC_RECORRECT_EN + default n + help + Enable coded phy AGC recorrect diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index 4b93865b52..b223604efd 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit 4b93865b52ab92f0b7777ed415b6598b96ac1d6d +Subproject commit b223604efd557d0a5314afb3b751229df424d244 diff --git a/components/bt/include/esp32c3/include/esp_bt.h b/components/bt/include/esp32c3/include/esp_bt.h index fa5ef7d4f3..78f6691740 100644 --- a/components/bt/include/esp32c3/include/esp_bt.h +++ b/components/bt/include/esp32c3/include/esp_bt.h @@ -26,7 +26,7 @@ extern "C" { #endif #define ESP_BT_CTRL_CONFIG_MAGIC_VAL 0x5A5AA5A5 -#define ESP_BT_CTRL_CONFIG_VERSION 0x02103310 +#define ESP_BT_CTRL_CONFIG_VERSION 0x02104270 #define ESP_BT_HCI_TL_MAGIC_VALUE 0xfadebead #define ESP_BT_HCI_TL_VERSION 0x00010000 @@ -137,6 +137,21 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status); #define MESH_DUPLICATE_SCAN_CACHE_SIZE 0 #endif +#ifdef CONFIG_BT_CTRL_AGC_RECORRECT_EN +#define BT_CTRL_AGC_RECORRECT_EN CONFIG_BT_CTRL_AGC_RECORRECT_EN +#else +#define BT_CTRL_AGC_RECORRECT_EN 0 +#endif + +#ifdef CONFIG_BT_CTRL_CODED_AGC_RECORRECT_EN +#define BT_CTRL_CODED_AGC_RECORRECT CONFIG_BT_CTRL_CODED_AGC_RECORRECT_EN +#else +#define BT_CTRL_CODED_AGC_RECORRECT 0 +#endif + +#define AGC_RECORRECT_EN ((BT_CTRL_AGC_RECORRECT_EN << 0) | (BT_CTRL_CODED_AGC_RECORRECT <<1)) + + #define CFG_MASK_BIT_SCAN_DUPLICATE_OPTION (1<<0) #define CFG_NASK CFG_MASK_BIT_SCAN_DUPLICATE_OPTION @@ -170,6 +185,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status); .coex_phy_coded_tx_rx_time_limit = CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF, \ .hw_target_code = BLE_HW_TARGET_CODE_ESP32C3_CHIP_ECO0, \ .slave_ce_len_min = SLAVE_CE_LEN_MIN_DEFAULT, \ + .hw_recorrect_en = AGC_RECORRECT_EN, \ }; #else @@ -235,6 +251,7 @@ typedef struct { uint8_t coex_phy_coded_tx_rx_time_limit; /*!< limit on max tx/rx time in case of connection using CODED-PHY with Wi-Fi coexistence */ uint32_t hw_target_code; /*!< hardware target */ uint8_t slave_ce_len_min; + uint8_t hw_recorrect_en; } esp_bt_controller_config_t; /** diff --git a/components/bt/include/esp32s3/include/esp_bt.h b/components/bt/include/esp32s3/include/esp_bt.h index 0d1b4380c0..1492c449ad 100644 --- a/components/bt/include/esp32s3/include/esp_bt.h +++ b/components/bt/include/esp32s3/include/esp_bt.h @@ -137,6 +137,20 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status); #define MESH_DUPLICATE_SCAN_CACHE_SIZE 0 #endif +#ifdef CONFIG_BT_CTRL_AGC_RECORRECT_EN +#define BT_CTRL_AGC_RECORRECT_EN CONFIG_BT_CTRL_AGC_RECORRECT_EN +#else +#define BT_CTRL_AGC_RECORRECT_EN 0 +#endif + +#ifdef CONFIG_BT_CTRL_CODED_AGC_RECORRECT_EN +#define BT_CTRL_CODED_AGC_RECORRECT CONFIG_BT_CTRL_CODED_AGC_RECORRECT_EN +#else +#define BT_CTRL_CODED_AGC_RECORRECT 0 +#endif + +#define AGC_RECORRECT_EN ((BT_CTRL_AGC_RECORRECT_EN << 0) | (BT_CTRL_CODED_AGC_RECORRECT <<1)) + #define CFG_MASK_BIT_SCAN_DUPLICATE_OPTION (1<<0) #define CFG_MASK CFG_MASK_BIT_SCAN_DUPLICATE_OPTION @@ -170,6 +184,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status); .coex_phy_coded_tx_rx_time_limit = CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF, \ .hw_target_code = BLE_HW_TARGET_CODE_ESP32S3_CHIP_ECO0, \ .slave_ce_len_min = SLAVE_CE_LEN_MIN_DEFAULT, \ + .hw_recorrect_en = AGC_RECORRECT_EN, \ }; #else @@ -235,6 +250,7 @@ typedef struct { uint8_t coex_phy_coded_tx_rx_time_limit; /*!< limit on max tx/rx time in case of connection using CODED-PHY with Wi-Fi coexistence */ uint32_t hw_target_code; /*!< hardware target */ uint8_t slave_ce_len_min; /*!< slave minimum ce length*/ + uint8_t hw_recorrect_en; } esp_bt_controller_config_t; /**