feat(ble/controller): Deleted useless functions for ESP32-C2

This commit is contained in:
Shen Wei Long
2025-03-11 20:54:07 +08:00
committed by Shen Weilong
parent 6d9c2b9c0f
commit da1372d691
9 changed files with 100 additions and 12 deletions

View File

@ -86,6 +86,7 @@ if(CONFIG_BT_ENABLED)
elseif(CONFIG_IDF_TARGET_ESP32S3)
list(APPEND ldscripts "linker_rw_bt_controller.lf")
elseif(CONFIG_IDF_TARGET_ESP32C2)
list(APPEND srcs "controller/esp32c2/ble.c")
if(CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY)
list(APPEND srcs "controller/esp32c2/dummy.c")
endif()

View File

@ -0,0 +1,58 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include "sdkconfig.h"
#include "esp_bt_cfg.h"
/* External functions or variables
************************************************************************
*/
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
void adv_stack_enableClearLegacyAdvVsCmd(bool en);
void scan_stack_enableAdvFlowCtrlVsCmd(bool en);
void chanSel_stack_enableSetCsaVsCmd(bool en);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
/* Local functions definition
***************************************************************************
*/
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
void ble_stack_enableVsCmds(bool en)
{
#if DEFAULT_BT_LE_ROLE_BROADCASTER
adv_stack_enableClearLegacyAdvVsCmd(en);
#endif // DEFAULT_BT_LE_ROLE_BROADCASTER
#if DEFAULT_BT_LE_ROLE_OBSERVER
scan_stack_enableAdvFlowCtrlVsCmd(en);
#endif // DEFAULT_BT_LE_ROLE_OBSERVER
chanSel_stack_enableSetCsaVsCmd(en);
}
void ble_stack_enableVsEvents(bool en)
{
}
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
int ble_stack_enable(void)
{
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
ble_stack_enableVsCmds(true);
ble_stack_enableVsEvents(true);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
return 0;
}
void ble_stack_disable(void)
{
#if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
ble_stack_enableVsEvents(false);
ble_stack_enableVsCmds(false);
#endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED)
}

View File

@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _BLE_PRIV_H_
#define _BLE_PRIV_H_
int ble_stack_enable(void);
void ble_stack_disable(void);
#endif // _BLE_PRIV_H_

View File

@ -35,6 +35,7 @@
#include "os/endian.h"
#include "esp_bt.h"
#include "ble_priv.h"
#include "esp_intr_alloc.h"
#include "esp_sleep.h"
#include "esp_pm.h"
@ -999,6 +1000,12 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
#if CONFIG_SW_COEXIST_ENABLE
coex_enable();
#endif
if (ble_stack_enable() != 0) {
ret = ESP_FAIL;
goto error;
}
if (ble_controller_enable(mode) != 0) {
ret = ESP_FAIL;
goto error;
@ -1008,6 +1015,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
return ESP_OK;
error:
ble_stack_disable();
#if CONFIG_SW_COEXIST_ENABLE
coex_disable();
#endif
@ -1030,7 +1038,7 @@ esp_err_t esp_bt_controller_disable(void)
if (ble_controller_disable() != 0) {
return ESP_FAIL;
}
ble_stack_disable();
if (s_ble_active) {
esp_phy_disable(PHY_MODEM_BT);
#if CONFIG_PM_ENABLE

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -232,6 +232,12 @@ extern "C" {
#define HCI_UART_EN 0 // hci ram mode
#endif
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
#define DEFAULT_BT_LE_VHCI_ENABLED (CONFIG_BT_LE_HCI_INTERFACE_USE_RAM)
#else
#define DEFAULT_BT_LE_VHCI_ENABLED (0)
#endif
#ifdef CONFIG_BT_LE_SLEEP_ENABLE
#define NIMBLE_SLEEP_ENABLE CONFIG_BT_LE_SLEEP_ENABLE
#else

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -167,7 +167,7 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
*/
uint8_t esp_ble_get_chip_rev_version(void);
#define CONFIG_VERSION 0x20241121
#define CONFIG_VERSION 0x20250310
#define CONFIG_MAGIC 0x5A5AA5A5
/**
@ -227,7 +227,8 @@ typedef struct {
uint8_t version_num; /*!< Version number */
uint8_t ignore_wl_for_direct_adv; /*!< Ignore the white list for directed advertising */
uint8_t csa2_select; /*!< Select CSA#2 */
uint8_t ble_aa_check; /*!< True if adds a verification step for the Access Address within the CONNECT_IND PDU; false otherwise. Configurable in menuconfig */
uint8_t ble_aa_check; /*!< True if adds a verification step for the Access Address within the CONNECT_IND PDU; false otherwise. Configurable in menuconfig */
uint8_t vhci_enabled; /*!< VHCI mode is enabled */
uint32_t config_magic; /*!< Configuration magic value */
} esp_bt_controller_config_t;
@ -275,6 +276,7 @@ typedef struct {
.ignore_wl_for_direct_adv = 0, \
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
.ble_aa_check = DEFAULT_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS, \
.vhci_enabled = DEFAULT_BT_LE_VHCI_ENABLED, \
.config_magic = CONFIG_MAGIC, \
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -400,7 +400,7 @@ r_ble_ll_hci_set_adv_data = 0x40001088;
r_ble_ll_hci_set_le_event_mask = 0x4000108c;
r_ble_ll_hci_set_scan_rsp_data = 0x40001090;
r_ble_ll_hci_status_params_cmd_proc = 0x40001094;
r_ble_ll_hci_vs_cmd_proc = 0x40001098;
//r_ble_ll_hci_vs_cmd_proc = 0x40001098;
r_ble_ll_hci_vs_rd_static_addr = 0x4000109c;
r_ble_ll_hw_err_timer_cb = 0x400010a0;
r_ble_ll_hw_error = 0x400010a4;
@ -937,7 +937,7 @@ r_ble_phy_xcvr_state_get = 0x400018ec;
r_ble_plf_set_log_level = 0x400018f0;
r_ble_rtc_wake_up_cpu_init = 0x400018f4;
r_ble_rtc_wake_up_state_clr = 0x400018f8;
r_ble_vendor_hci_register = 0x400018fc;
//r_ble_vendor_hci_register = 0x400018fc;
r_bt_rf_coex_cfg_set = 0x40001900;
r_bt_rf_coex_coded_txrx_time_upper_lim = 0x40001904;
r_bt_rf_coex_dft_pti_set = 0x40001908;
@ -1173,7 +1173,7 @@ r_ble_ll_get_npl_element_info = 0x40002f48;
r_ble_rtc_wake_up_cpu_clr = 0x40002f4c;
r_ble_ll_scan_hci_set_adv_report_flow_ctrl = 0x40002f50;
r_ble_ll_scan_hci_update_adv_report_flow_ctrl = 0x40002f54;
r_ble_ll_scan_send_adv_lost_report = 0x40002f58;
//r_ble_ll_scan_send_adv_lost_report = 0x40002f58;
r_ble_ll_scan_adv_report_cth_flow_is_enabled = 0x40002f5c;
r_ble_ll_scan_adv_report_cth_flow_alloc_credit = 0x40002f60;
r_ble_ll_scan_adv_report_cth_flow_free_credit = 0x40002f64;

View File

@ -320,7 +320,7 @@ r_ble_ll_hci_set_adv_data = 0x40001088;
r_ble_ll_hci_set_le_event_mask = 0x4000108c;
r_ble_ll_hci_set_scan_rsp_data = 0x40001090;
r_ble_ll_hci_status_params_cmd_proc = 0x40001094;
r_ble_ll_hci_vs_cmd_proc = 0x40001098;
//r_ble_ll_hci_vs_cmd_proc = 0x40001098;
r_ble_ll_hci_vs_rd_static_addr = 0x4000109c;
r_ble_ll_hw_err_timer_cb = 0x400010a0;
r_ble_ll_hw_error = 0x400010a4;
@ -739,7 +739,7 @@ r_ble_phy_xcvr_state_get = 0x400018ec;
r_ble_plf_set_log_level = 0x400018f0;
r_ble_rtc_wake_up_cpu_init = 0x400018f4;
r_ble_rtc_wake_up_state_clr = 0x400018f8;
r_ble_vendor_hci_register = 0x400018fc;
//r_ble_vendor_hci_register = 0x400018fc;
r_bt_rf_coex_cfg_set = 0x40001900;
r_bt_rf_coex_coded_txrx_time_upper_lim = 0x40001904;
r_bt_rf_coex_dft_pti_set = 0x40001908;