From 459b3195ac21de55418e18ac0582d9f3bb0f5680 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 21 Nov 2019 13:44:00 +1100 Subject: [PATCH] esp_wifi: Move esp32 DPORT access wrappers into esp_wifi component --- components/esp32/dport_access.c | 9 --------- components/esp_wifi/CMakeLists.txt | 9 ++++++++- components/esp_wifi/esp32/esp_adapter.c | 19 +++++++++++++------ 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/components/esp32/dport_access.c b/components/esp32/dport_access.c index ca89028014..aa5b4913ff 100644 --- a/components/esp32/dport_access.c +++ b/components/esp32/dport_access.c @@ -144,15 +144,6 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_end(void) #endif /* CONFIG_FREERTOS_UNICORE */ } -void IRAM_ATTR esp_dport_access_stall_other_cpu_start_wrap(void) -{ - DPORT_STALL_OTHER_CPU_START(); -} - -void IRAM_ATTR esp_dport_access_stall_other_cpu_end_wrap(void) -{ - DPORT_STALL_OTHER_CPU_END(); -} #ifndef CONFIG_FREERTOS_UNICORE static void dport_access_init_core(void *arg) diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 17fe54ed29..dc855d93a9 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -8,6 +8,13 @@ else() set(ldfragments "linker.lf") endif() +if(IDF_TARGET_ESP32) + # dport workaround headers are in esp32 component + set(extra_priv_requires esp32) +else() + set(extra_priv_requires) +endif() + idf_component_register(SRCS "src/coexist.c" "src/lib_printf.c" "src/mesh_event.c" @@ -20,7 +27,7 @@ idf_component_register(SRCS "src/coexist.c" "${idf_target}/esp_adapter.c" INCLUDE_DIRS "include" "${idf_target}/include" REQUIRES esp_event - PRIV_REQUIRES wpa_supplicant nvs_flash esp_netif + PRIV_REQUIRES wpa_supplicant nvs_flash esp_netif ${extra_priv_requires} LDFRAGMENTS "${ldfragments}") idf_build_get_property(build_dir BUILD_DIR) diff --git a/components/esp_wifi/esp32/esp_adapter.c b/components/esp_wifi/esp32/esp_adapter.c index 410a73025b..99ccd14345 100644 --- a/components/esp_wifi/esp32/esp_adapter.c +++ b/components/esp_wifi/esp32/esp_adapter.c @@ -44,13 +44,20 @@ #include "esp_smartconfig.h" #include "esp_coexist_internal.h" #include "esp_coexist_adapter.h" - - -extern void esp_dport_access_stall_other_cpu_start_wrap(void); -extern void esp_dport_access_stall_other_cpu_end_wrap(void); +#include "esp32/dport_access.h" #define TAG "esp_adapter" +static void IRAM_ATTR s_esp_dport_access_stall_other_cpu_start(void) +{ + DPORT_STALL_OTHER_CPU_START(); +} + +static void IRAM_ATTR s_esp_dport_access_stall_other_cpu_end(void) +{ + DPORT_STALL_OTHER_CPU_END(); +} + /* If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly. If failed, try to allocate it in internal memory then. @@ -557,8 +564,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._event_post = esp_event_post_wrapper, ._get_free_heap_size = esp_get_free_heap_size, ._rand = esp_random, - ._dport_access_stall_other_cpu_start_wrap = esp_dport_access_stall_other_cpu_start_wrap, - ._dport_access_stall_other_cpu_end_wrap = esp_dport_access_stall_other_cpu_end_wrap, + ._dport_access_stall_other_cpu_start_wrap = s_esp_dport_access_stall_other_cpu_start, + ._dport_access_stall_other_cpu_end_wrap = s_esp_dport_access_stall_other_cpu_end, ._phy_rf_deinit = esp_phy_rf_deinit, ._phy_load_cal_and_init = esp_phy_load_cal_and_init, ._phy_common_clock_enable = esp_phy_common_clock_enable,