mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-04 04:19:39 +00:00
feat(ble/controller): Deleted useless functions for ESP32-C2
This commit is contained in:

committed by
Shen Weilong

parent
6d9c2b9c0f
commit
da1372d691
58
components/bt/controller/esp32c2/ble.c
Normal file
58
components/bt/controller/esp32c2/ble.c
Normal 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)
|
||||
}
|
13
components/bt/controller/esp32c2/ble_priv.h
Normal file
13
components/bt/controller/esp32c2/ble_priv.h
Normal 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_
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user