diff --git a/components/bt/CMakeLists.txt b/components/bt/CMakeLists.txt index ca63f58d00..9ef563dbdf 100644 --- a/components/bt/CMakeLists.txt +++ b/components/bt/CMakeLists.txt @@ -614,7 +614,7 @@ if(CONFIG_BT_ENABLED) ) endif() - if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32C3 OR CONFIG_IDF_TARGET_ESP32S3 OR TRUE) + if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32C3 OR CONFIG_IDF_TARGET_ESP32S3) list(APPEND srcs "host/nimble/esp-hci/src/esp_nimble_hci.c" ) diff --git a/components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h b/components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h index d096c57161..8006dbba7c 100644 --- a/components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h +++ b/components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h @@ -33,46 +33,6 @@ extern "C" { */ esp_err_t esp_nimble_hci_init(void); -/** - * @brief Initialize ESP Bluetooth controller(link layer) and VHCI transport - * layer between NimBLE Host and ESP Bluetooth controller - * - * This function initializes ESP controller in BLE only mode and the - * transport buffers to be exchanged between NimBLE host and ESP controller. - * It also registers required host callbacks with the controller. - * - * Below is the sequence of APIs to be called to init/enable NimBLE host and ESP controller: - * - * @code{c} - * void ble_host_task(void *param) - * { - * nimble_port_run(); //This function will return only when nimble_port_stop() is executed. - * nimble_port_freertos_deinit(); - * } - * - * int ret = esp_nimble_hci_and_controller_init(); - * if (ret != ESP_OK) { - ESP_LOGE(TAG, "esp_nimble_hci_and_controller_init() failed with error: %d", ret); - * return; - * } - * - * nimble_port_init(); - * - * //Initialize the NimBLE Host configuration - * - * nimble_port_freertos_init(ble_host_task); - * @endcode - * - * nimble_port_freertos_init() is an optional call that creates a new task in which the NimBLE - * host will run. The task function should have a call to nimble_port_run(). If a separate task - * is not required, calling nimble_port_run() will run the NimBLE host in the current task. - * - * @return - * - ESP_OK if the initialization is successful - * - Appropriate error code from esp_err_t in case of an error - */ -esp_err_t esp_nimble_hci_and_controller_init(void); - /** * @brief Deinitialize VHCI transport layer between NimBLE Host and * ESP Bluetooth controller @@ -85,37 +45,6 @@ esp_err_t esp_nimble_hci_and_controller_init(void); */ esp_err_t esp_nimble_hci_deinit(void); -/** - * @brief Deinitialize VHCI transport layer between NimBLE Host and - * ESP Bluetooth controller and disable and deinitialize the controller - * - * @note This function should not be executed in the context of Bluetooth host task. - * - * @note This function should be called after the NimBLE host is deinitialized. - * - * Below is the sequence of APIs to be called to disable/deinit NimBLE host and ESP controller: - * - * @code{c} - * int ret = nimble_port_stop(); - * if (ret == 0) { - * nimble_port_deinit(); - * - * ret = esp_nimble_hci_and_controller_deinit(); - * if (ret != ESP_OK) { - ESP_LOGE(TAG, "esp_nimble_hci_and_controller_deinit() failed with error: %d", ret); - * } - * } - * @endcode - * - * If nimble_port_freertos_init() is used during initialization, then - * nimble_port_freertos_deinit() should be called in the host task after nimble_port_run(). - * - * @return - * - ESP_OK if the deinitialization is successful - * - Appropriate error codes from esp_err_t in case of an error - */ -esp_err_t esp_nimble_hci_and_controller_deinit(void); - #ifdef __cplusplus } #endif diff --git a/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c b/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c index 36b11d4729..9225deba6b 100644 --- a/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c +++ b/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c @@ -20,20 +20,6 @@ #include "esp_compiler.h" #include "soc/soc_caps.h" -#if SOC_ESP_NIMBLE_CONTROLLER - -/* For Chips not using VHCI, these functions return success */ -esp_err_t esp_nimble_hci_and_controller_init(void) -{ - return ESP_OK; -} - -esp_err_t esp_nimble_hci_and_controller_deinit(void) -{ - return ESP_OK; -} -#else - #define NIMBLE_VHCI_TIMEOUT_MS 2000 #define BLE_HCI_EVENT_HDR_LEN (2) #define BLE_HCI_CMD_HDR_LEN (3) @@ -461,24 +447,6 @@ err: } -esp_err_t esp_nimble_hci_and_controller_init(void) -{ - esp_err_t ret; - - esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT); - - esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); - - if ((ret = esp_bt_controller_init(&bt_cfg)) != ESP_OK) { - return ret; - } - - if ((ret = esp_bt_controller_enable(ESP_BT_MODE_BLE)) != ESP_OK) { - return ret; - } - return esp_nimble_hci_init(); -} - static esp_err_t ble_hci_transport_deinit(void) { int ret = 0; @@ -516,25 +484,3 @@ esp_err_t esp_nimble_hci_deinit(void) return ESP_OK; } - -esp_err_t esp_nimble_hci_and_controller_deinit(void) -{ - int ret; - ret = esp_nimble_hci_deinit(); - if (ret != ESP_OK) { - return ret; - } - - ret = esp_bt_controller_disable(); - if (ret != ESP_OK) { - return ret; - } - - ret = esp_bt_controller_deinit(); - if (ret != ESP_OK) { - return ret; - } - - return ESP_OK; -} -#endif // #if SOC_ESP_NIMBLE_CONTROLLER