Просмотр исходного кода

coexist: enable coexist when wifi&bt are enabled, disable coexist when one of wifi&bt is disabled.

XiaXiaotian 9 лет назад
Родитель
Сommit
bb0298bc71

+ 0 - 6
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);

+ 5 - 0
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
  *

+ 1 - 0
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
   */

+ 1 - 1
components/esp32/lib

@@ -1 +1 @@
-Subproject commit bc16e8c0749adefcd5bf44c9024849a504b8e839
+Subproject commit ed85cf9156f2ef358c29d07fb849a73c5758eecb

+ 9 - 0
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);