mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
Update bt lib for ESP32-C3 and ESP32-S3(ff6efe7)
- fix(bt/controller): Fixed PHY enable and disable - feat(bt/controller): Support DAA and LBT mode for BLE CCA
This commit is contained in:
@@ -78,15 +78,29 @@ config BT_CTRL_ADV_DUP_FILT_MAX
|
|||||||
help
|
help
|
||||||
The maxinum number of suplicate scan filter
|
The maxinum number of suplicate scan filter
|
||||||
|
|
||||||
config BT_CTRL_HW_CCA
|
choice BT_BLE_CCA_MODE
|
||||||
bool "HW CCA check enable"
|
prompt "BLE CCA mode"
|
||||||
default n
|
default BT_BLE_CCA_MODE_NONE
|
||||||
help
|
help
|
||||||
It enables HW CCA feature in controller
|
Define BT BLE CCA mode
|
||||||
|
|
||||||
|
config BT_BLE_CCA_MODE_NONE
|
||||||
|
bool "NONE"
|
||||||
|
config BT_BLE_CCA_MODE_HW
|
||||||
|
bool "Hardware"
|
||||||
|
config BT_BLE_CCA_MODE_SW
|
||||||
|
bool "Software"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config BT_BLE_CCA_MODE
|
||||||
|
int
|
||||||
|
default 0 if BT_BLE_CCA_MODE_NONE
|
||||||
|
default 1 if BT_BLE_CCA_MODE_HW
|
||||||
|
default 2 if BT_BLE_CCA_MODE_SW
|
||||||
|
|
||||||
config BT_CTRL_HW_CCA_VAL
|
config BT_CTRL_HW_CCA_VAL
|
||||||
int "CCA threshold value"
|
int "CCA threshold value"
|
||||||
range 20 60
|
range 20 100
|
||||||
default 20
|
default 20
|
||||||
help
|
help
|
||||||
It is the threshold value of HW CCA, if the value is 30, it means CCA threshold is -30 dBm.
|
It is the threshold value of HW CCA, if the value is 30, it means CCA threshold is -30 dBm.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +112,7 @@ do{\
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
|
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
|
||||||
#define OSI_VERSION 0x00010006
|
#define OSI_VERSION 0x00010007
|
||||||
#define OSI_MAGIC_VALUE 0xFADEBEAD
|
#define OSI_MAGIC_VALUE 0xFADEBEAD
|
||||||
|
|
||||||
/* Types definition
|
/* Types definition
|
||||||
@@ -193,6 +193,8 @@ struct osi_funcs_t {
|
|||||||
void (* _esp_hw_power_down)(void);
|
void (* _esp_hw_power_down)(void);
|
||||||
void (* _esp_hw_power_up)(void);
|
void (* _esp_hw_power_up)(void);
|
||||||
void (* _ets_backup_dma_copy)(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_rem);
|
void (* _ets_backup_dma_copy)(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_rem);
|
||||||
|
void (* _ets_delay_us)(uint32_t us);
|
||||||
|
void (* _btdm_rom_table_ready)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -251,6 +253,8 @@ extern void esp_mac_bb_power_up(void);
|
|||||||
extern void ets_backup_dma_copy(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_mem);
|
extern void ets_backup_dma_copy(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_mem);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void btdm_cca_feature_enable(void);
|
||||||
|
|
||||||
extern uint32_t _bt_bss_start;
|
extern uint32_t _bt_bss_start;
|
||||||
extern uint32_t _bt_bss_end;
|
extern uint32_t _bt_bss_end;
|
||||||
extern uint32_t _btdm_bss_start;
|
extern uint32_t _btdm_bss_start;
|
||||||
@@ -310,6 +314,7 @@ static void interrupt_off_wrapper(int intr_num);
|
|||||||
static void btdm_hw_mac_power_up_wrapper(void);
|
static void btdm_hw_mac_power_up_wrapper(void);
|
||||||
static void btdm_hw_mac_power_down_wrapper(void);
|
static void btdm_hw_mac_power_down_wrapper(void);
|
||||||
static void btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_mem);
|
static void btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_mem);
|
||||||
|
static void btdm_funcs_table_ready_wrapper(void);
|
||||||
|
|
||||||
static void btdm_slp_tmr_callback(void *arg);
|
static void btdm_slp_tmr_callback(void *arg);
|
||||||
|
|
||||||
@@ -374,6 +379,8 @@ static const struct osi_funcs_t osi_funcs_ro = {
|
|||||||
._esp_hw_power_down = btdm_hw_mac_power_down_wrapper,
|
._esp_hw_power_down = btdm_hw_mac_power_down_wrapper,
|
||||||
._esp_hw_power_up = btdm_hw_mac_power_up_wrapper,
|
._esp_hw_power_up = btdm_hw_mac_power_up_wrapper,
|
||||||
._ets_backup_dma_copy = btdm_backup_dma_copy_wrapper,
|
._ets_backup_dma_copy = btdm_backup_dma_copy_wrapper,
|
||||||
|
._ets_delay_us = esp_rom_delay_us,
|
||||||
|
._btdm_rom_table_ready = btdm_funcs_table_ready_wrapper,
|
||||||
};
|
};
|
||||||
|
|
||||||
static DRAM_ATTR struct osi_funcs_t *osi_funcs_p;
|
static DRAM_ATTR struct osi_funcs_t *osi_funcs_p;
|
||||||
@@ -871,6 +878,13 @@ static void async_wakeup_request_end(int event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void btdm_funcs_table_ready_wrapper(void)
|
||||||
|
{
|
||||||
|
#if BT_BLE_CCA_MODE == 2
|
||||||
|
btdm_cca_feature_enable();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void coex_schm_status_bit_set_wrapper(uint32_t type, uint32_t status)
|
static void coex_schm_status_bit_set_wrapper(uint32_t type, uint32_t status)
|
||||||
{
|
{
|
||||||
#if CONFIG_SW_COEXIST_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE
|
||||||
@@ -1299,14 +1313,10 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
periph_module_enable(PERIPH_BT_MODULE);
|
periph_module_enable(PERIPH_BT_MODULE);
|
||||||
periph_module_reset(PERIPH_BT_MODULE);
|
periph_module_reset(PERIPH_BT_MODULE);
|
||||||
|
|
||||||
esp_phy_enable();
|
|
||||||
s_lp_stat.phy_enabled = 1;
|
|
||||||
|
|
||||||
if (btdm_controller_init(cfg) != 0) {
|
if (btdm_controller_init(cfg) != 0) {
|
||||||
err = ESP_ERR_NO_MEM;
|
err = ESP_ERR_NO_MEM;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
coex_pti_v2();
|
|
||||||
|
|
||||||
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
||||||
|
|
||||||
@@ -1336,11 +1346,6 @@ static void bt_controller_deinit_internal(void)
|
|||||||
{
|
{
|
||||||
periph_module_disable(PERIPH_BT_MODULE);
|
periph_module_disable(PERIPH_BT_MODULE);
|
||||||
|
|
||||||
if (s_lp_stat.phy_enabled) {
|
|
||||||
esp_phy_disable();
|
|
||||||
s_lp_stat.phy_enabled = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// deinit low power control resources
|
// deinit low power control resources
|
||||||
do {
|
do {
|
||||||
|
|
||||||
@@ -1434,6 +1439,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
|||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Enable PHY when enabling controller to reduce power dissipation after controller init
|
||||||
|
* Notice the init order: esp_phy_enable() -> bt_bb_v2_init_cmplx() -> coex_pti_v2()
|
||||||
|
*/
|
||||||
|
esp_phy_enable();
|
||||||
|
s_lp_stat.phy_enabled = 1;
|
||||||
|
|
||||||
#if CONFIG_SW_COEXIST_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE
|
||||||
coex_enable();
|
coex_enable();
|
||||||
#endif
|
#endif
|
||||||
@@ -1458,6 +1469,8 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
coex_pti_v2();
|
||||||
|
|
||||||
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_ENABLED;
|
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_ENABLED;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -1480,6 +1493,10 @@ error:
|
|||||||
#if CONFIG_SW_COEXIST_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE
|
||||||
coex_disable();
|
coex_disable();
|
||||||
#endif
|
#endif
|
||||||
|
if (s_lp_stat.phy_enabled) {
|
||||||
|
esp_phy_disable();
|
||||||
|
s_lp_stat.phy_enabled = 0;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1498,6 +1515,10 @@ esp_err_t esp_bt_controller_disable(void)
|
|||||||
#if CONFIG_SW_COEXIST_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE
|
||||||
coex_disable();
|
coex_disable();
|
||||||
#endif
|
#endif
|
||||||
|
if (s_lp_stat.phy_enabled) {
|
||||||
|
esp_phy_disable();
|
||||||
|
s_lp_stat.phy_enabled = 0;
|
||||||
|
}
|
||||||
|
|
||||||
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
||||||
|
|
||||||
|
Submodule components/bt/controller/lib_esp32c3_family updated: b438f60a29...040cd0eafd
@@ -19,7 +19,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ESP_BT_CTRL_CONFIG_MAGIC_VAL 0x5A5AA5A5
|
#define ESP_BT_CTRL_CONFIG_MAGIC_VAL 0x5A5AA5A5
|
||||||
#define ESP_BT_CTRL_CONFIG_VERSION 0x02302140
|
#define ESP_BT_CTRL_CONFIG_VERSION 0x02307120
|
||||||
|
|
||||||
#define ESP_BT_HCI_TL_MAGIC_VALUE 0xfadebead
|
#define ESP_BT_HCI_TL_MAGIC_VALUE 0xfadebead
|
||||||
#define ESP_BT_HCI_TL_VERSION 0x00010000
|
#define ESP_BT_HCI_TL_VERSION 0x00010000
|
||||||
@@ -169,6 +169,12 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
|
|||||||
#endif // (CONFIG_BT_BLUEDROID_ENABLED) || (CONFIG_BT_NIMBLE_ENABLED)
|
#endif // (CONFIG_BT_BLUEDROID_ENABLED) || (CONFIG_BT_NIMBLE_ENABLED)
|
||||||
#endif // (CONFIG_BT_BLE_50_FEATURES_SUPPORTED) || (CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT)
|
#endif // (CONFIG_BT_BLE_50_FEATURES_SUPPORTED) || (CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT)
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_BLE_CCA_MODE)
|
||||||
|
#define BT_BLE_CCA_MODE (CONFIG_BT_BLE_CCA_MODE)
|
||||||
|
#else
|
||||||
|
#define BT_BLE_CCA_MODE (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define AGC_RECORRECT_EN ((BT_CTRL_AGC_RECORRECT_EN << 0) | (BT_CTRL_CODED_AGC_RECORRECT <<1))
|
#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_BIT_SCAN_DUPLICATE_OPTION (1<<0)
|
||||||
@@ -214,6 +220,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
|
|||||||
.scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
|
.scan_backoff_upperlimitmax = BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX, \
|
||||||
.dup_list_refresh_period = DUPL_SCAN_CACHE_REFRESH_PERIOD, \
|
.dup_list_refresh_period = DUPL_SCAN_CACHE_REFRESH_PERIOD, \
|
||||||
.ble_50_feat_supp = BT_CTRL_50_FEATURE_SUPPORT, \
|
.ble_50_feat_supp = BT_CTRL_50_FEATURE_SUPPORT, \
|
||||||
|
.ble_cca_mode = BT_BLE_CCA_MODE, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -284,6 +291,7 @@ typedef struct {
|
|||||||
uint16_t scan_backoff_upperlimitmax; /*!< scan backoff upperlimitmax value */
|
uint16_t scan_backoff_upperlimitmax; /*!< scan backoff upperlimitmax value */
|
||||||
uint16_t dup_list_refresh_period; /*!< duplicate scan list refresh time */
|
uint16_t dup_list_refresh_period; /*!< duplicate scan list refresh time */
|
||||||
bool ble_50_feat_supp; /*!< BLE 5.0 feature support */
|
bool ble_50_feat_supp; /*!< BLE 5.0 feature support */
|
||||||
|
uint8_t ble_cca_mode; /*!< BLE CCA mode */
|
||||||
} esp_bt_controller_config_t;
|
} esp_bt_controller_config_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user