From bb0298bc715a2444a6822f4e04e9c188085bf862 Mon Sep 17 00:00:00 2001 From: XiaXiaotian Date: Mon, 20 Feb 2017 23:53:25 +0800 Subject: [PATCH] coexist: enable coexist when wifi&bt are enabled, disable coexist when one of wifi&bt is disabled. --- components/esp32/cpu_start.c | 6 ------ components/esp32/include/esp_coexist.h | 5 +++++ components/esp32/include/esp_wifi.h | 1 + components/esp32/lib | 2 +- components/esp32/phy_init.c | 9 +++++++++ 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index bc7ed6a71c..cf20083508 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -211,12 +211,6 @@ void start_cpu0_default(void) esp_core_dump_init(); #endif -#if CONFIG_SW_COEXIST_ENABLE - if (coex_init() == ESP_OK) { - coexist_set_enable(true); - } -#endif - xTaskCreatePinnedToCore(&main_task, "main", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL, 0); diff --git a/components/esp32/include/esp_coexist.h b/components/esp32/include/esp_coexist.h index f58d2ef949..872b5e5ab7 100644 --- a/components/esp32/include/esp_coexist.h +++ b/components/esp32/include/esp_coexist.h @@ -25,6 +25,11 @@ extern "C" { */ esp_err_t coex_init(void); +/** + * @brief De-init software coexist + */ +void coex_deinit(void); + /** * @brief Get software coexist enable or not * diff --git a/components/esp32/include/esp_wifi.h b/components/esp32/include/esp_wifi.h index 8d4fa17bb7..0f7e2996e8 100755 --- a/components/esp32/include/esp_wifi.h +++ b/components/esp32/include/esp_wifi.h @@ -130,6 +130,7 @@ esp_err_t esp_wifi_init(wifi_init_config_t *config); * Free all resource allocated in esp_wifi_init and stop WiFi task * * @attention 1. This API should be called if you want to remove WiFi driver from the system + * @attention 2. This API can not be called yet and will be done in the future. * * @return ESP_OK: succeed */ diff --git a/components/esp32/lib b/components/esp32/lib index bc16e8c074..ed85cf9156 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit bc16e8c0749adefcd5bf44c9024849a504b8e839 +Subproject commit ed85cf9156f2ef358c29d07fb849a73c5758eecb diff --git a/components/esp32/phy_init.c b/components/esp32/phy_init.c index 8ec518bac0..34e1a9f00e 100644 --- a/components/esp32/phy_init.c +++ b/components/esp32/phy_init.c @@ -35,6 +35,7 @@ #include "phy.h" #include "phy_init_data.h" #include "rtc.h" +#include "esp_coexist.h" static const char* TAG = "phy_init"; @@ -65,6 +66,10 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, phy_set_wifi_mode_only(0); register_chipv7_phy(init_data, calibration_data, mode); coex_bt_high_prio(); + } else { +#if CONFIG_SW_COEXIST_ENABLE + coex_init(); +#endif } s_phy_rf_init_count++; _lock_release(&s_phy_rf_init_lock); @@ -81,6 +86,10 @@ esp_err_t esp_phy_rf_deinit(void) pm_close_rf(); // Disable WiFi peripheral clock CLEAR_PERI_REG_MASK(DPORT_WIFI_CLK_EN_REG, 0x87cf); + } else { +#if CONFIG_SW_COEXIST_ENABLE + coex_deinit(); +#endif } s_phy_rf_init_count--; _lock_release(&s_phy_rf_init_lock); -- 2.40.0