diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index e836f60e10..843c156be1 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -80,6 +80,7 @@ /components/efuse/ @esp-idf-codeowners/system /components/esp_adc/ @esp-idf-codeowners/peripherals /components/esp_app_format/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities +/components/esp_coex/ @esp-idf-codeowners/wifi @esp-idf-codeowners/bluetooth @esp-idf-codeowners/ieee802154 /components/esp_common/ @esp-idf-codeowners/system /components/esp_eth/ @esp-idf-codeowners/network /components/esp_event/ @esp-idf-codeowners/system diff --git a/.gitlab/ci/pre_check.yml b/.gitlab/ci/pre_check.yml index 1df0ed62d0..df697a8699 100644 --- a/.gitlab/ci/pre_check.yml +++ b/.gitlab/ci/pre_check.yml @@ -77,13 +77,18 @@ test_check_kconfigs: check_blobs: extends: .pre_check_template variables: - SUBMODULES_TO_FETCH: "components/esp_wifi/lib;components/esp_phy/lib" + SUBMODULES_TO_FETCH: "components/esp_wifi/lib;components/esp_phy/lib;components/esp_coex/lib" script: # Check if Wi-Fi library header files match between IDF and the version used when compiling the libraries - IDF_TARGET=esp32 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh - IDF_TARGET=esp32s2 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh - IDF_TARGET=esp32s3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh - IDF_TARGET=esp32c3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh + # Check if Coexistence library header files match between IDF and the version used when compiling the libraries + - IDF_TARGET=esp32 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh + - IDF_TARGET=esp32s2 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh + - IDF_TARGET=esp32s3 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh + - IDF_TARGET=esp32c3 $IDF_PATH/components/esp_coex/test_md5/test_md5.sh # Check if Wi-Fi, PHY, BT blobs contain references to specific symbols - bash $IDF_PATH/tools/ci/check_blobs.sh diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index 6c115428af..05276471aa 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -86,6 +86,7 @@ .patterns-target_test-i154: &patterns-target_test-i154 - "components/esp_phy/**/*" - "components/ieee802154/**/*" + - "components/esp_coex/**/*" .patterns-example_test-i154: &patterns-example_test-i154 - "components/esp_netif/**/*" @@ -100,6 +101,7 @@ - "components/esp_wifi/**/*" - "components/esp_phy/**/*" - "components/wpa_supplicant/**/*" + - "components/esp_coex/**/*" .patterns-integration_test-ble: &patterns-integration_test-ble - "tools/ci/python_packages/gitlab_api.py" @@ -109,6 +111,7 @@ - "components/bt/controller/lib_esp32h2/esp32h2-bt-lib" - "components/bt/host/nimble/nimble" - "components/esp_phy/lib" + - "components/esp_coex/**/*" .patterns-integration_test-wifi: &patterns-integration_test-wifi - "tools/ci/python_packages/gitlab_api.py" @@ -183,6 +186,7 @@ - "components/cmock/CMock" - "components/esp_phy/lib" - "components/esp_wifi/lib" + - "components/esp_coex/lib" - "components/ieee802154/lib" - "components/json/cJSON" - "components/lwip/lwip" diff --git a/.gitmodules b/.gitmodules index d162ff483e..b3b9edd1be 100644 --- a/.gitmodules +++ b/.gitmodules @@ -86,3 +86,7 @@ [submodule "components/heap/tlsf"] path = components/heap/tlsf url = ../../espressif/tlsf.git + +[submodule "components/esp_coex/lib"] + path = components/esp_coex/lib + url = ../../espressif/esp-coex-lib.git diff --git a/components/bt/CMakeLists.txt b/components/bt/CMakeLists.txt index a51b78b951..66bccab31a 100644 --- a/components/bt/CMakeLists.txt +++ b/components/bt/CMakeLists.txt @@ -692,7 +692,7 @@ idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}" REQUIRES esp_timer esp_wifi - PRIV_REQUIRES nvs_flash soc esp_pm esp_phy mbedtls driver vfs + PRIV_REQUIRES nvs_flash soc esp_pm esp_phy esp_coex mbedtls driver vfs LDFRAGMENTS "linker.lf") if(CONFIG_BT_ENABLED) diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c index 046f733b52..8e3420dedb 100644 --- a/components/bt/controller/esp32/bt.c +++ b/components/bt/controller/esp32/bt.c @@ -89,7 +89,7 @@ do{\ } while(0) #define OSI_FUNCS_TIME_BLOCKING 0xffffffff -#define OSI_VERSION 0x00010003 +#define OSI_VERSION 0x00010004 #define OSI_MAGIC_VALUE 0xFADEBEAD /* Types definition @@ -176,6 +176,7 @@ struct osi_funcs_t { void (*_interrupt_l3_disable)(void); void (*_interrupt_l3_restore)(void); void *(* _customer_queue_create)(uint32_t queue_len, uint32_t item_size); + int (* _coex_version_get)(unsigned int *major, unsigned int *minor, unsigned int *patch); uint32_t _magic; }; @@ -218,20 +219,6 @@ extern int bredr_txpwr_set(int min_power_level, int max_power_level); extern int bredr_txpwr_get(int *min_power_level, int *max_power_level); extern void bredr_sco_datapath_set(uint8_t data_path); extern void btdm_controller_scan_duplicate_list_clear(void); -/* Coexistence */ -extern int coex_bt_request(uint32_t event, uint32_t latency, uint32_t duration); -extern int coex_bt_release(uint32_t event); -extern int coex_register_bt_cb(coex_func_cb_t cb); -extern uint32_t coex_bb_reset_lock(void); -extern void coex_bb_reset_unlock(uint32_t restore); -extern int coex_schm_register_btdm_callback(void *callback); -extern void coex_schm_status_bit_clear(uint32_t type, uint32_t status); -extern void coex_schm_status_bit_set(uint32_t type, uint32_t status); -extern uint32_t coex_schm_interval_get(void); -extern uint8_t coex_schm_curr_period_get(void); -extern void * coex_schm_curr_phase_get(void); -extern int coex_wifi_channel_get(uint8_t *primary, uint8_t *secondary); -extern int coex_register_wifi_channel_change_callback(void *cb); /* Shutdown */ extern void esp_bt_controller_shutdown(void); @@ -320,6 +307,7 @@ static uint8_t coex_schm_curr_period_get_wrapper(void); static void * coex_schm_curr_phase_get_wrapper(void); static int coex_wifi_channel_get_wrapper(uint8_t *primary, uint8_t *secondary); static int coex_register_wifi_channel_change_callback_wrapper(void *cb); +static int coex_version_get_wrapper(unsigned int *major, unsigned int *minor, unsigned int *patch); #if CONFIG_BTDM_CTRL_HLI static void *customer_queue_create_hlevel_wrapper(uint32_t queue_len, uint32_t item_size); #endif /* CONFIG_BTDM_CTRL_HLI */ @@ -412,6 +400,7 @@ static const struct osi_funcs_t osi_funcs_ro = { #else ._customer_queue_create = NULL, #endif /* CONFIG_BTDM_CTRL_HLI */ + ._coex_version_get = coex_version_get_wrapper, ._magic = OSI_MAGIC_VALUE, }; @@ -1165,7 +1154,7 @@ static void IRAM_ATTR coex_bb_reset_unlock_wrapper(uint32_t restore) static int coex_schm_register_btdm_callback_wrapper(void *callback) { #if CONFIG_SW_COEXIST_ENABLE - return coex_schm_register_btdm_callback(callback); + return coex_schm_register_callback(COEX_SCHM_CALLBACK_TYPE_BT, callback); #else return 0; #endif @@ -1230,6 +1219,30 @@ static int coex_register_wifi_channel_change_callback_wrapper(void *cb) #endif } +static int coex_version_get_wrapper(unsigned int *major, unsigned int *minor, unsigned int *patch) +{ +#if CONFIG_SW_COEXIST_ENABLE + const char *ver_str = esp_coex_version_get(); + if (ver_str != NULL) { + unsigned int _major = 0, _minor = 0, _patch = 0; + if (sscanf(ver_str, "%u.%u.%u", &_major, &_minor, &_patch) != 3) { + return -1; + } + if (major != NULL) { + *major = _major; + } + if (minor != NULL) { + *minor = _minor; + } + if (patch != NULL) { + *patch = _patch; + } + return 0; + } +#endif + return -1; +} + bool esp_vhci_host_check_send_available(void) { return API_vhci_host_check_send_available(); diff --git a/components/bt/controller/esp32c2/bt.c b/components/bt/controller/esp32c2/bt.c index add3a9cf20..1ed40d5140 100644 --- a/components/bt/controller/esp32c2/bt.c +++ b/components/bt/controller/esp32c2/bt.c @@ -114,7 +114,6 @@ struct ext_funcs_t { */ extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs); -extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high); extern int ble_controller_init(esp_bt_controller_config_t *cfg); extern int ble_controller_deinit(void); extern int ble_controller_enable(uint8_t mode); diff --git a/components/bt/controller/esp32c3/bt.c b/components/bt/controller/esp32c3/bt.c index 06acad6b17..9414a18aef 100644 --- a/components/bt/controller/esp32c3/bt.c +++ b/components/bt/controller/esp32c3/bt.c @@ -235,7 +235,6 @@ extern int ble_txpwr_set(int power_type, int power_level); extern int ble_txpwr_get(int power_type); extern uint16_t l2c_ble_link_get_tx_buf_num(void); -extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high); extern void coex_pti_v2(void); extern bool btdm_deep_sleep_mem_init(void); @@ -365,7 +364,7 @@ static const struct osi_funcs_t osi_funcs_ro = { ._btdm_sleep_exit_phase2 = NULL, ._btdm_sleep_exit_phase3 = btdm_sleep_exit_phase3_wrapper, ._coex_wifi_sleep_set = coex_wifi_sleep_set_hook, - ._coex_core_ble_conn_dyn_prio_get = coex_core_ble_conn_dyn_prio_get, + ._coex_core_ble_conn_dyn_prio_get = NULL, ._coex_schm_status_bit_set = coex_schm_status_bit_set_wrapper, ._coex_schm_status_bit_clear = coex_schm_status_bit_clear_wrapper, ._interrupt_on = interrupt_on_wrapper, diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 254c478f4b..2a858c169b 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -110,7 +110,6 @@ struct ext_funcs_t { ************************************************************************ */ extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs); -extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high); extern int ble_controller_init(esp_bt_controller_config_t *cfg); extern int ble_controller_deinit(void); extern int ble_controller_enable(uint8_t mode); diff --git a/components/bt/controller/esp32h4/bt.c b/components/bt/controller/esp32h4/bt.c index ca5343b2f8..665968fb28 100644 --- a/components/bt/controller/esp32h4/bt.c +++ b/components/bt/controller/esp32h4/bt.c @@ -113,7 +113,6 @@ struct ext_funcs_t { extern int ble_plf_set_log_level(int level); extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs); -extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high); extern int ble_controller_init(esp_bt_controller_config_t *cfg); extern int ble_controller_deinit(void); extern int ble_controller_enable(uint8_t mode); diff --git a/components/bt/controller/esp32s3/bt.c b/components/bt/controller/esp32s3/bt.c index ab4c187bb6..04f193e696 100644 --- a/components/bt/controller/esp32s3/bt.c +++ b/components/bt/controller/esp32s3/bt.c @@ -240,7 +240,6 @@ extern int ble_txpwr_set(int power_type, int power_level); extern int ble_txpwr_get(int power_type); extern uint16_t l2c_ble_link_get_tx_buf_num(void); -extern int coex_core_ble_conn_dyn_prio_get(bool *low, bool *high); extern void coex_pti_v2(void); extern bool btdm_deep_sleep_mem_init(void); @@ -369,7 +368,7 @@ static const struct osi_funcs_t osi_funcs_ro = { ._btdm_sleep_exit_phase2 = NULL, ._btdm_sleep_exit_phase3 = btdm_sleep_exit_phase3_wrapper, ._coex_wifi_sleep_set = coex_wifi_sleep_set_hook, - ._coex_core_ble_conn_dyn_prio_get = coex_core_ble_conn_dyn_prio_get, + ._coex_core_ble_conn_dyn_prio_get = NULL, ._coex_schm_status_bit_set = coex_schm_status_bit_set_wrapper, ._coex_schm_status_bit_clear = coex_schm_status_bit_clear_wrapper, ._interrupt_on = interrupt_on_wrapper, diff --git a/components/bt/controller/lib_esp32 b/components/bt/controller/lib_esp32 index f18eabd48c..b867411caf 160000 --- a/components/bt/controller/lib_esp32 +++ b/components/bt/controller/lib_esp32 @@ -1 +1 @@ -Subproject commit f18eabd48cb91d779e56e985512bf210741aa700 +Subproject commit b867411caf88b485b2fa8b6d272692b6535a267a diff --git a/components/esp_coex/CMakeLists.txt b/components/esp_coex/CMakeLists.txt new file mode 100644 index 0000000000..37f496a632 --- /dev/null +++ b/components/esp_coex/CMakeLists.txt @@ -0,0 +1,41 @@ +idf_build_get_property(idf_target IDF_TARGET) + +if(CONFIG_ESP_COEX_SW_COEXIST_ENABLE OR CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE) + if(CONFIG_APP_NO_BLOBS) + set(link_binary_libs 0) + set(ldfragments) + else() + set(link_binary_libs 1) + set(ldfragments "linker.lf") + endif() + + set(srcs + "src/coexist.c" + "${idf_target}/esp_coex_adapter.c") +endif() + +if(CONFIG_ESP_WIFI_ENABLED) + list(APPEND srcs "${idf_target}/esp_coex_adapter.c") +endif() + +idf_component_register(SRCS "${srcs}" + INCLUDE_DIRS "include" + PRIV_REQUIRES esp_timer driver esp_event + LDFRAGMENTS "${ldfragments}") + +if(CONFIG_ESP_COEX_SW_COEXIST_ENABLE OR CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE) + idf_build_get_property(build_dir BUILD_DIR) + + set(target_name "${idf_target}") + target_link_directories(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}") + + if(link_binary_libs) + set(blob coexist) + + add_prebuilt_library(${blob} "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}/lib${blob}.a" + REQUIRES ${COMPONENT_NAME}) + target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob}) + endif() + + target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") +endif() diff --git a/components/esp_coex/Kconfig b/components/esp_coex/Kconfig new file mode 100644 index 0000000000..909aef0c89 --- /dev/null +++ b/components/esp_coex/Kconfig @@ -0,0 +1,28 @@ + +menu "Wireless Coexistence" + config ESP_COEX_SW_COEXIST_ENABLE + bool "Software controls WiFi/Bluetooth coexistence" + depends on (ESP_WIFI_ENABLED && BT_ENABLED) || \ + (ESP_WIFI_ENABLED && IEEE802154_ENABLED) + default y + select ESP_WIFI_STA_DISCONNECTED_PM_ENABLE + help + If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware. + Recommended for heavy traffic scenarios. Both coexistence configuration options are + automatically managed, no user intervention is required. + If only Bluetooth is used, it is recommended to disable this option to reduce binary file + size. + + config ESP_COEX_EXTERNAL_COEXIST_ENABLE + bool "External Coexistence" + default n + depends on (!(BT_ENABLED||NIMBLE_ENABLED)&&(!IDF_TARGET_ESP32)) + help + If enabled, HW External coexistence arbitration is managed by GPIO pins. + It can support three types of wired combinations so far which are 1-wired/2-wired/3-wired. + User can select GPIO pins in application code with configure interfaces. + + This function depends on BT-off + because currently we do not support external coex and internal coex simultaneously. + +endmenu # Wi-Fi diff --git a/components/esp_coex/esp32/esp_coex_adapter.c b/components/esp_coex/esp32/esp_coex_adapter.c new file mode 100644 index 0000000000..a120e11d53 --- /dev/null +++ b/components/esp_coex/esp32/esp_coex_adapter.c @@ -0,0 +1,231 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/portmacro.h" +#include "esp_heap_caps.h" +#include "esp_timer.h" +#include "esp_coexist_adapter.h" +#include "esp32/rom/ets_sys.h" + +#define TAG "esp_coex_adapter" + +#define OSI_FUNCS_TIME_BLOCKING 0xffffffff + +typedef struct { + QueueHandle_t handle; /**< FreeRTOS queue handler */ + void *storage; /**< storage for FreeRTOS queue */ +} modem_static_queue_t; + +bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void) +{ +#ifdef CONFIG_IDF_ENV_FPGA + return false; +#else + return true; +#endif +} + +void * esp_coex_common_spin_lock_create_wrapper(void) +{ + portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; + void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + + if (mux) { + memcpy(mux,&tmp,sizeof(portMUX_TYPE)); + return mux; + } + return NULL; +} + +uint32_t IRAM_ATTR esp_coex_common_int_disable_wrapper(void *wifi_int_mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(wifi_int_mux); + } else { + portENTER_CRITICAL(wifi_int_mux); + } + + return 0; +} + +void IRAM_ATTR esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(wifi_int_mux); + } else { + portEXIT_CRITICAL(wifi_int_mux); + } +} + +void IRAM_ATTR esp_coex_common_task_yield_from_isr_wrapper(void) +{ + portYIELD_FROM_ISR(); +} + +void * esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + return (void *)xSemaphoreCreateCounting(max, init); +} + +void esp_coex_common_semphr_delete_wrapper(void *semphr) +{ + vSemaphoreDelete(semphr); +} + +int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(semphr, block_time_tick); + } +} + +int32_t esp_coex_common_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(semphr); +} + +void IRAM_ATTR esp_coex_common_timer_disarm_wrapper(void *timer) +{ + ets_timer_disarm(timer); +} + +void esp_coex_common_timer_done_wrapper(void *ptimer) +{ + ets_timer_done(ptimer); +} + +void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) +{ + ets_timer_setfn(ptimer, pfunction, parg); +} + +void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) +{ + ets_timer_arm_us(ptimer, us, repeat); +} + +void * IRAM_ATTR esp_coex_common_malloc_internal_wrapper(size_t size) +{ + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); +} + +/* static wrapper */ + +static int IRAM_ATTR esp_coex_is_in_isr_wrapper(void) +{ + return !xPortCanYield(); +} + +static void *esp_coex_internal_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + modem_static_queue_t *semphr = heap_caps_calloc(1, sizeof(modem_static_queue_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + if (!semphr) { + return NULL; + } + +#ifdef CONFIG_SPIRAM_USE_MALLOC + semphr->storage = heap_caps_calloc(1, sizeof(StaticSemaphore_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + if (!semphr->storage) { + goto _error; + } + + semphr->handle = xSemaphoreCreateCountingStatic(max, init, semphr->storage); + if (!semphr->handle) { + goto _error; + } + return (void *)semphr; + +_error: + if (semphr) { + if (semphr->storage) { + free(semphr->storage); + } + + free(semphr); + } + return NULL; +#else + semphr->handle = xSemaphoreCreateCounting(max, init); + return (void *)semphr; +#endif +} + +static void esp_coex_internal_semphr_delete_wrapper(void *semphr) +{ + modem_static_queue_t *semphr_item = (modem_static_queue_t *)semphr; + if (semphr_item) { + if (semphr_item->handle) { + vSemaphoreDelete(semphr_item->handle); + } +#ifdef CONFIG_SPIRAM_USE_MALLOC + if (semphr_item->storage) { + free(semphr_item->storage); + } +#endif + free(semphr_item); + } +} + +static int32_t IRAM_ATTR esp_coex_internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreTakeFromISR(((modem_static_queue_t *)semphr)->handle, hptw); +} + +static int32_t IRAM_ATTR esp_coex_internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreGiveFromISR(((modem_static_queue_t *)semphr)->handle, hptw); +} + +static int32_t esp_coex_internal_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, block_time_tick); + } +} + +static int32_t esp_coex_internal_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle); +} + +coex_adapter_funcs_t g_coex_adapter_funcs = { + ._version = COEX_ADAPTER_VERSION, + ._spin_lock_create = esp_coex_common_spin_lock_create_wrapper, + ._spin_lock_delete = free, + ._int_disable = esp_coex_common_int_disable_wrapper, + ._int_enable = esp_coex_common_int_restore_wrapper, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_internal_semphr_create_wrapper, + ._semphr_delete = esp_coex_internal_semphr_delete_wrapper, + ._semphr_take_from_isr = esp_coex_internal_semphr_take_from_isr_wrapper, + ._semphr_give_from_isr = esp_coex_internal_semphr_give_from_isr_wrapper, + ._semphr_take = esp_coex_internal_semphr_take_wrapper, + ._semphr_give = esp_coex_internal_semphr_give_wrapper, + ._is_in_isr = esp_coex_is_in_isr_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, + ._free = free, + ._esp_timer_get_time = esp_timer_get_time, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, + ._magic = COEX_ADAPTER_MAGIC, +}; diff --git a/components/esp_coex/esp32c2/esp_coex_adapter.c b/components/esp_coex/esp32c2/esp_coex_adapter.c new file mode 100644 index 0000000000..84adc6f088 --- /dev/null +++ b/components/esp_coex/esp32c2/esp_coex_adapter.c @@ -0,0 +1,165 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/portmacro.h" +#include "esp_heap_caps.h" +#include "esp_timer.h" +#include "soc/rtc.h" +#include "esp_private/esp_clk.h" +#include "esp_coexist_adapter.h" +#include "esp32c2/rom/ets_sys.h" + +#define TAG "esp_coex_adapter" + +#define OSI_FUNCS_TIME_BLOCKING 0xffffffff + +bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void) +{ +#ifdef CONFIG_IDF_ENV_FPGA + return false; +#else + return true; +#endif +} + +void * esp_coex_common_spin_lock_create_wrapper(void) +{ + portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; + void *mux = malloc(sizeof(portMUX_TYPE)); + + if (mux) { + memcpy(mux,&tmp,sizeof(portMUX_TYPE)); + return mux; + } + return NULL; +} + +uint32_t IRAM_ATTR esp_coex_common_int_disable_wrapper(void *wifi_int_mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(wifi_int_mux); + } else { + portENTER_CRITICAL(wifi_int_mux); + } + + return 0; +} + +void IRAM_ATTR esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(wifi_int_mux); + } else { + portEXIT_CRITICAL(wifi_int_mux); + } +} + +void IRAM_ATTR esp_coex_common_task_yield_from_isr_wrapper(void) +{ + portYIELD_FROM_ISR(); +} + +void * esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + return (void *)xSemaphoreCreateCounting(max, init); +} + +void esp_coex_common_semphr_delete_wrapper(void *semphr) +{ + vSemaphoreDelete(semphr); +} + +int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(semphr, block_time_tick); + } +} + +int32_t esp_coex_common_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(semphr); +} + +void IRAM_ATTR esp_coex_common_timer_disarm_wrapper(void *timer) +{ + ets_timer_disarm(timer); +} + +void esp_coex_common_timer_done_wrapper(void *ptimer) +{ + ets_timer_done(ptimer); +} + +void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) +{ + ets_timer_setfn(ptimer, pfunction, parg); +} + +void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) +{ + ets_timer_arm_us(ptimer, us, repeat); +} + +void * IRAM_ATTR esp_coex_common_malloc_internal_wrapper(size_t size) +{ + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); +} + +uint32_t esp_coex_common_clk_slowclk_cal_get_wrapper(void) +{ + /* The bit width of WiFi light sleep clock calibration is 12 while the one of + * system is 19. It should shift 19 - 12 = 7. + */ + return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); +} + +/* static wrapper */ + +static int32_t IRAM_ATTR esp_coex_semphr_take_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreTakeFromISR(semphr, hptw); +} + +static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreGiveFromISR(semphr, hptw); +} + +coex_adapter_funcs_t g_coex_adapter_funcs = { + ._version = COEX_ADAPTER_VERSION, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take_from_isr = esp_coex_semphr_take_from_isr_wrapper, + ._semphr_give_from_isr = esp_coex_semphr_give_from_isr_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, + ._is_in_isr = xPortInIsrContext, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, + ._free = free, + ._esp_timer_get_time = esp_timer_get_time, + ._env_is_chip = esp_coex_common_env_is_chip_wrapper, + ._slowclk_cal_get = esp_coex_common_clk_slowclk_cal_get_wrapper, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, + ._magic = COEX_ADAPTER_MAGIC, +}; diff --git a/components/esp_coex/esp32c3/esp_coex_adapter.c b/components/esp_coex/esp32c3/esp_coex_adapter.c new file mode 100644 index 0000000000..005b858f4b --- /dev/null +++ b/components/esp_coex/esp32c3/esp_coex_adapter.c @@ -0,0 +1,169 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/portmacro.h" +#include "esp_heap_caps.h" +#include "esp_timer.h" +#include "soc/rtc.h" +#include "esp_private/esp_clk.h" +#include "esp_coexist_adapter.h" +#include "esp32c3/rom/ets_sys.h" +#include "soc/system_reg.h" + +#define TAG "esp_coex_adapter" + +#define OSI_FUNCS_TIME_BLOCKING 0xffffffff + +bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void) +{ +#ifdef CONFIG_IDF_ENV_FPGA + return false; +#else + return true; +#endif +} + +void * esp_coex_common_spin_lock_create_wrapper(void) +{ + portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; + void *mux = malloc(sizeof(portMUX_TYPE)); + + if (mux) { + memcpy(mux,&tmp,sizeof(portMUX_TYPE)); + return mux; + } + return NULL; +} + +uint32_t IRAM_ATTR esp_coex_common_int_disable_wrapper(void *wifi_int_mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(wifi_int_mux); + } else { + portENTER_CRITICAL(wifi_int_mux); + } + + return 0; +} + +void IRAM_ATTR esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(wifi_int_mux); + } else { + portEXIT_CRITICAL(wifi_int_mux); + } +} + +void IRAM_ATTR esp_coex_common_task_yield_from_isr_wrapper(void) +{ + portYIELD_FROM_ISR(); +} + +void * esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + return (void *)xSemaphoreCreateCounting(max, init); +} + +void esp_coex_common_semphr_delete_wrapper(void *semphr) +{ + vSemaphoreDelete(semphr); +} + +int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(semphr, block_time_tick); + } +} + +int32_t esp_coex_common_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(semphr); +} + +void IRAM_ATTR esp_coex_common_timer_disarm_wrapper(void *timer) +{ + ets_timer_disarm(timer); +} + +void esp_coex_common_timer_done_wrapper(void *ptimer) +{ + ets_timer_done(ptimer); +} + +void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) +{ + ets_timer_setfn(ptimer, pfunction, parg); +} + +void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) +{ + ets_timer_arm_us(ptimer, us, repeat); +} + +void * IRAM_ATTR esp_coex_common_malloc_internal_wrapper(size_t size) +{ + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); +} + +uint32_t esp_coex_common_clk_slowclk_cal_get_wrapper(void) +{ + /* The bit width of WiFi light sleep clock calibration is 12 while the one of + * system is 19. It should shift 19 - 12 = 7. + */ + if (GET_PERI_REG_MASK(SYSTEM_BT_LPCK_DIV_FRAC_REG, SYSTEM_LPCLK_SEL_XTAL)) { + uint64_t time_per_us = 1000000ULL; + return (((time_per_us << RTC_CLK_CAL_FRACT) / (MHZ)) >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); + } else { + return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); + } +} + +/* static wrapper */ + +static int32_t IRAM_ATTR esp_coex_semphr_take_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreTakeFromISR(semphr, hptw); +} + +static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreGiveFromISR(semphr, hptw); +} + +coex_adapter_funcs_t g_coex_adapter_funcs = { + ._version = COEX_ADAPTER_VERSION, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take_from_isr = esp_coex_semphr_take_from_isr_wrapper, + ._semphr_give_from_isr = esp_coex_semphr_give_from_isr_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, + ._is_in_isr = xPortInIsrContext, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, + ._free = free, + ._esp_timer_get_time = esp_timer_get_time, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, + ._magic = COEX_ADAPTER_MAGIC, +}; diff --git a/components/esp_coex/esp32c6/esp_coex_adapter.c b/components/esp_coex/esp32c6/esp_coex_adapter.c new file mode 100644 index 0000000000..51417fc912 --- /dev/null +++ b/components/esp_coex/esp32c6/esp_coex_adapter.c @@ -0,0 +1,165 @@ +/* + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/portmacro.h" +#include "esp_heap_caps.h" +#include "esp_timer.h" +#include "soc/rtc.h" +#include "esp_private/esp_clk.h" +#include "esp_coexist_adapter.h" +#include "esp32c6/rom/ets_sys.h" + +#define TAG "esp_coex_adapter" + +#define OSI_FUNCS_TIME_BLOCKING 0xffffffff + +bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void) +{ +#ifdef CONFIG_IDF_ENV_FPGA + return false; +#else + return true; +#endif +} + +void *esp_coex_common_spin_lock_create_wrapper(void) +{ + portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; + void *mux = malloc(sizeof(portMUX_TYPE)); + + if (mux) { + memcpy(mux, &tmp, sizeof(portMUX_TYPE)); + return mux; + } + return NULL; +} + +uint32_t IRAM_ATTR esp_coex_common_int_disable_wrapper(void *wifi_int_mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(wifi_int_mux); + } else { + portENTER_CRITICAL(wifi_int_mux); + } + + return 0; +} + +void IRAM_ATTR esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(wifi_int_mux); + } else { + portEXIT_CRITICAL(wifi_int_mux); + } +} + +void IRAM_ATTR esp_coex_common_task_yield_from_isr_wrapper(void) +{ + portYIELD_FROM_ISR(); +} + +void *esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + return (void *)xSemaphoreCreateCounting(max, init); +} + +void esp_coex_common_semphr_delete_wrapper(void *semphr) +{ + vSemaphoreDelete(semphr); +} + +int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(semphr, block_time_tick); + } +} + +int32_t esp_coex_common_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(semphr); +} + +void IRAM_ATTR esp_coex_common_timer_disarm_wrapper(void *timer) +{ + ets_timer_disarm(timer); +} + +void esp_coex_common_timer_done_wrapper(void *ptimer) +{ + ets_timer_done(ptimer); +} + +void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) +{ + ets_timer_setfn(ptimer, pfunction, parg); +} + +void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) +{ + ets_timer_arm_us(ptimer, us, repeat); +} + +uint32_t esp_coex_common_clk_slowclk_cal_get_wrapper(void) +{ + /* The bit width of WiFi light sleep clock calibration is 12 while the one of + * system is 19. It should shift 19 - 12 = 7. + */ + return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); +} + +void *IRAM_ATTR esp_coex_common_malloc_internal_wrapper(size_t size) +{ + return heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL); +} + +/* static wrapper */ + +static int32_t IRAM_ATTR esp_coex_semphr_take_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreTakeFromISR(semphr, hptw); +} + +static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreGiveFromISR(semphr, hptw); +} + +coex_adapter_funcs_t g_coex_adapter_funcs = { + ._version = COEX_ADAPTER_VERSION, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take_from_isr = esp_coex_semphr_take_from_isr_wrapper, + ._semphr_give_from_isr = esp_coex_semphr_give_from_isr_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, + ._is_in_isr = xPortInIsrContext, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, + ._free = free, + ._esp_timer_get_time = esp_timer_get_time, + ._env_is_chip = esp_coex_common_env_is_chip_wrapper, + ._slowclk_cal_get = esp_coex_common_clk_slowclk_cal_get_wrapper, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, + ._magic = COEX_ADAPTER_MAGIC, +}; diff --git a/components/esp_coex/esp32s2/esp_coex_adapter.c b/components/esp_coex/esp32s2/esp_coex_adapter.c new file mode 100644 index 0000000000..9100bfabe0 --- /dev/null +++ b/components/esp_coex/esp32s2/esp_coex_adapter.c @@ -0,0 +1,237 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/portmacro.h" +#include "esp_heap_caps.h" +#include "esp_timer.h" +#include "soc/rtc.h" +#include "esp_private/esp_clk.h" +#include "esp_coexist_adapter.h" +#include "esp32s2/rom/ets_sys.h" + +#define TAG "esp_coex_adapter" + +#define OSI_FUNCS_TIME_BLOCKING 0xffffffff + +typedef struct { + QueueHandle_t handle; /**< FreeRTOS queue handler */ + void *storage; /**< storage for FreeRTOS queue */ +} modem_static_queue_t; + +bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void) +{ +#ifdef CONFIG_IDF_ENV_FPGA + return false; +#else + return true; +#endif +} + +void * esp_coex_common_spin_lock_create_wrapper(void) +{ + portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; + void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + + if (mux) { + memcpy(mux,&tmp,sizeof(portMUX_TYPE)); + return mux; + } + return NULL; +} + +uint32_t IRAM_ATTR esp_coex_common_int_disable_wrapper(void *wifi_int_mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(wifi_int_mux); + } else { + portENTER_CRITICAL(wifi_int_mux); + } + + return 0; +} + +void IRAM_ATTR esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(wifi_int_mux); + } else { + portEXIT_CRITICAL(wifi_int_mux); + } +} + +void IRAM_ATTR esp_coex_common_task_yield_from_isr_wrapper(void) +{ + portYIELD_FROM_ISR(); +} + +void * esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + return (void *)xSemaphoreCreateCounting(max, init); +} + +void esp_coex_common_semphr_delete_wrapper(void *semphr) +{ + vSemaphoreDelete(semphr); +} + +int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(semphr, block_time_tick); + } +} + +int32_t esp_coex_common_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(semphr); +} + +void IRAM_ATTR esp_coex_common_timer_disarm_wrapper(void *timer) +{ + ets_timer_disarm(timer); +} + +void esp_coex_common_timer_done_wrapper(void *ptimer) +{ + ets_timer_done(ptimer); +} + +void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) +{ + ets_timer_setfn(ptimer, pfunction, parg); +} + +void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) +{ + ets_timer_arm_us(ptimer, us, repeat); +} + +void * IRAM_ATTR esp_coex_common_malloc_internal_wrapper(size_t size) +{ + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); +} + +uint32_t esp_coex_common_clk_slowclk_cal_get_wrapper(void) +{ + /* The bit width of WiFi light sleep clock calibration is 12 while the one of + * system is 19. It should shift 19 - 12 = 7. + */ + return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); +} + +/* static wrapper */ + +static int IRAM_ATTR esp_coex_is_in_isr_wrapper(void) +{ + return !xPortCanYield(); +} + +static void *esp_coex_internal_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + modem_static_queue_t *semphr = heap_caps_calloc(1, sizeof(modem_static_queue_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + if (!semphr) { + return NULL; + } + +#ifdef CONFIG_SPIRAM_USE_MALLOC + semphr->storage = heap_caps_calloc(1, sizeof(StaticSemaphore_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + if (!semphr->storage) { + goto _error; + } + + semphr->handle = xSemaphoreCreateCountingStatic(max, init, semphr->storage); + if (!semphr->handle) { + goto _error; + } + return (void *)semphr; + +_error: + if (semphr) { + if (semphr->storage) { + free(semphr->storage); + } + + free(semphr); + } + return NULL; +#else + semphr->handle = xSemaphoreCreateCounting(max, init); + return (void *)semphr; +#endif +} + +static void esp_coex_internal_semphr_delete_wrapper(void *semphr) +{ + modem_static_queue_t *semphr_item = (modem_static_queue_t *)semphr; + if (semphr_item) { + if (semphr_item->handle) { + vSemaphoreDelete(semphr_item->handle); + } +#ifdef CONFIG_SPIRAM_USE_MALLOC + if (semphr_item->storage) { + free(semphr_item->storage); + } +#endif + free(semphr_item); + } +} + +static int32_t IRAM_ATTR esp_coex_internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreTakeFromISR(((modem_static_queue_t *)semphr)->handle, hptw); +} + +static int32_t IRAM_ATTR esp_coex_internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreGiveFromISR(((modem_static_queue_t *)semphr)->handle, hptw); +} + +static int32_t esp_coex_internal_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, block_time_tick); + } +} + +static int32_t esp_coex_internal_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle); +} + +coex_adapter_funcs_t g_coex_adapter_funcs = { + ._version = COEX_ADAPTER_VERSION, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_internal_semphr_create_wrapper, + ._semphr_delete = esp_coex_internal_semphr_delete_wrapper, + ._semphr_take_from_isr = esp_coex_internal_semphr_take_from_isr_wrapper, + ._semphr_give_from_isr = esp_coex_internal_semphr_give_from_isr_wrapper, + ._semphr_take = esp_coex_internal_semphr_take_wrapper, + ._semphr_give = esp_coex_internal_semphr_give_wrapper, + ._is_in_isr = esp_coex_is_in_isr_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, + ._free = free, + ._esp_timer_get_time = esp_timer_get_time, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, + ._magic = COEX_ADAPTER_MAGIC, +}; diff --git a/components/esp_coex/esp32s3/esp_coex_adapter.c b/components/esp_coex/esp32s3/esp_coex_adapter.c new file mode 100644 index 0000000000..bf277eb789 --- /dev/null +++ b/components/esp_coex/esp32s3/esp_coex_adapter.c @@ -0,0 +1,243 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/portmacro.h" +#include "esp_heap_caps.h" +#include "esp_timer.h" +#include "soc/rtc.h" +#include "esp_private/esp_clk.h" +#include "esp_coexist_adapter.h" +#include "esp32s3/rom/ets_sys.h" +#include "soc/system_reg.h" + +#define TAG "esp_coex_adapter" + +#define OSI_FUNCS_TIME_BLOCKING 0xffffffff + +typedef struct { + QueueHandle_t handle; /**< FreeRTOS queue handler */ + void *storage; /**< storage for FreeRTOS queue */ +} modem_static_queue_t; + +bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void) +{ +#ifdef CONFIG_IDF_ENV_FPGA + return false; +#else + return true; +#endif +} + +void * esp_coex_common_spin_lock_create_wrapper(void) +{ + portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; + void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + + if (mux) { + memcpy(mux,&tmp,sizeof(portMUX_TYPE)); + return mux; + } + return NULL; +} + +uint32_t IRAM_ATTR esp_coex_common_int_disable_wrapper(void *wifi_int_mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(wifi_int_mux); + } else { + portENTER_CRITICAL(wifi_int_mux); + } + + return 0; +} + +void IRAM_ATTR esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(wifi_int_mux); + } else { + portEXIT_CRITICAL(wifi_int_mux); + } +} + +void IRAM_ATTR esp_coex_common_task_yield_from_isr_wrapper(void) +{ + portYIELD_FROM_ISR(); +} + +void * esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + return (void *)xSemaphoreCreateCounting(max, init); +} + +void esp_coex_common_semphr_delete_wrapper(void *semphr) +{ + vSemaphoreDelete(semphr); +} + +int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(semphr, block_time_tick); + } +} + +int32_t esp_coex_common_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(semphr); +} + +void IRAM_ATTR esp_coex_common_timer_disarm_wrapper(void *timer) +{ + ets_timer_disarm(timer); +} + +void esp_coex_common_timer_done_wrapper(void *ptimer) +{ + ets_timer_done(ptimer); +} + +void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) +{ + ets_timer_setfn(ptimer, pfunction, parg); +} + +void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) +{ + ets_timer_arm_us(ptimer, us, repeat); +} + +void * IRAM_ATTR esp_coex_common_malloc_internal_wrapper(size_t size) +{ + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); +} + +uint32_t esp_coex_common_clk_slowclk_cal_get_wrapper(void) +{ + /* The bit width of WiFi light sleep clock calibration is 12 while the one of + * system is 19. It should shift 19 - 12 = 7. + */ + if (GET_PERI_REG_MASK(SYSTEM_BT_LPCK_DIV_FRAC_REG, SYSTEM_LPCLK_SEL_XTAL)) { + uint64_t time_per_us = 1000000ULL; + return (((time_per_us << RTC_CLK_CAL_FRACT) / (MHZ)) >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); + } else { + return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); + } +} + +/* static wrapper */ + +static int IRAM_ATTR esp_coex_is_in_isr_wrapper(void) +{ + return !xPortCanYield(); +} + +static void *esp_coex_internal_semphr_create_wrapper(uint32_t max, uint32_t init) +{ + modem_static_queue_t *semphr = heap_caps_calloc(1, sizeof(modem_static_queue_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + if (!semphr) { + return NULL; + } + +#ifdef CONFIG_SPIRAM_USE_MALLOC + semphr->storage = heap_caps_calloc(1, sizeof(StaticSemaphore_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); + if (!semphr->storage) { + goto _error; + } + + semphr->handle = xSemaphoreCreateCountingStatic(max, init, semphr->storage); + if (!semphr->handle) { + goto _error; + } + return (void *)semphr; + +_error: + if (semphr) { + if (semphr->storage) { + free(semphr->storage); + } + + free(semphr); + } + return NULL; +#else + semphr->handle = xSemaphoreCreateCounting(max, init); + return (void *)semphr; +#endif +} + +static void esp_coex_internal_semphr_delete_wrapper(void *semphr) +{ + modem_static_queue_t *semphr_item = (modem_static_queue_t *)semphr; + if (semphr_item) { + if (semphr_item->handle) { + vSemaphoreDelete(semphr_item->handle); + } +#ifdef CONFIG_SPIRAM_USE_MALLOC + if (semphr_item->storage) { + free(semphr_item->storage); + } +#endif + free(semphr_item); + } +} + +static int32_t IRAM_ATTR esp_coex_internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreTakeFromISR(((modem_static_queue_t *)semphr)->handle, hptw); +} + +static int32_t IRAM_ATTR esp_coex_internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreGiveFromISR(((modem_static_queue_t *)semphr)->handle, hptw); +} + +static int32_t esp_coex_internal_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, block_time_tick); + } +} + +static int32_t esp_coex_internal_semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle); +} + +coex_adapter_funcs_t g_coex_adapter_funcs = { + ._version = COEX_ADAPTER_VERSION, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_internal_semphr_create_wrapper, + ._semphr_delete = esp_coex_internal_semphr_delete_wrapper, + ._semphr_take_from_isr = esp_coex_internal_semphr_take_from_isr_wrapper, + ._semphr_give_from_isr = esp_coex_internal_semphr_give_from_isr_wrapper, + ._semphr_take = esp_coex_internal_semphr_take_wrapper, + ._semphr_give = esp_coex_internal_semphr_give_wrapper, + ._is_in_isr = esp_coex_is_in_isr_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, + ._free = free, + ._esp_timer_get_time = esp_timer_get_time, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, + ._magic = COEX_ADAPTER_MAGIC, +}; diff --git a/components/esp_coex/include/esp_coex_i154.h b/components/esp_coex/include/esp_coex_i154.h new file mode 100644 index 0000000000..9385a10c60 --- /dev/null +++ b/components/esp_coex/include/esp_coex_i154.h @@ -0,0 +1,23 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef __COEXIST_I154_H__ +#define __COEXIST_I154_H__ + +#ifdef CONFIG_SOC_IEEE802154_SUPPORTED +typedef enum { + IEEE802154_RISK_TX = 1, + IEEE802154_TX_AT, + IEEE802154_RX_AT, + IEEE802154_ACK, + IEEE802154_NORMAL, + IEEE802154_IDLE_RX, + IEEE802154_EVENT_MAX, +} ieee802154_coex_event_t; + +void esp_coex_ieee802154_pti_set(ieee802154_coex_event_t event); +#endif + +#endif diff --git a/components/esp_wifi/include/esp_coexist.h b/components/esp_coex/include/esp_coexist.h similarity index 100% rename from components/esp_wifi/include/esp_coexist.h rename to components/esp_coex/include/esp_coexist.h diff --git a/components/esp_wifi/include/esp_coexist_adapter.h b/components/esp_coex/include/esp_coexist_adapter.h similarity index 97% rename from components/esp_wifi/include/esp_coexist_adapter.h rename to components/esp_coex/include/esp_coexist_adapter.h index d36a45ec87..11bf54d9b5 100644 --- a/components/esp_wifi/include/esp_coexist_adapter.h +++ b/components/esp_coex/include/esp_coexist_adapter.h @@ -36,15 +36,13 @@ typedef struct { int (* _is_in_isr)(void); void * (* _malloc_internal)(size_t size); void (* _free)(void *p); -#if CONFIG_IDF_TARGET_ESP32 + int64_t (* _esp_timer_get_time)(void); + bool (* _env_is_chip)(void); + uint32_t (* _slowclk_cal_get)(void); void (* _timer_disarm)(void *timer); void (* _timer_done)(void *ptimer); void (* _timer_setfn)(void *ptimer, void *pfunction, void *parg); void (* _timer_arm_us)(void *ptimer, uint32_t us, bool repeat); -#endif - int64_t (* _esp_timer_get_time)(void); - bool (* _env_is_chip)(void); - uint32_t (* _slowclk_cal_get)(void); int32_t _magic; } coex_adapter_funcs_t; diff --git a/components/esp_wifi/include/esp_coexist_internal.h b/components/esp_coex/include/esp_coexist_internal.h similarity index 71% rename from components/esp_wifi/include/esp_coexist_internal.h rename to components/esp_coex/include/esp_coexist_internal.h index c9fbd2a15a..7fc02dffed 100644 --- a/components/esp_wifi/include/esp_coexist_internal.h +++ b/components/esp_coex/include/esp_coexist_internal.h @@ -22,8 +22,15 @@ typedef enum { COEX_PREFER_NUM, } coex_prefer_t; +typedef enum { + COEX_SCHM_CALLBACK_TYPE_WIFI = 0, + COEX_SCHM_CALLBACK_TYPE_BT, + COEX_SCHM_CALLBACK_TYPE_I154, +} coex_schm_callback_type_t; + typedef void (* coex_func_cb_t)(uint32_t event, int sched_cnt); typedef esp_err_t (* coex_set_lpclk_source_callback_t)(void); +typedef void (* coex_wifi_channel_change_cb_t)(uint8_t primary, uint8_t secondary); /** * @brief Pre-Init software coexist @@ -116,6 +123,15 @@ int coex_wifi_release(uint32_t event); */ int coex_wifi_channel_set(uint8_t primary, uint8_t secondary); +/** + * @brief Get WiFi channel from coexistence module. + * + * @param primary : pointer to value of WiFi primary channel + * @param secondary : pointer to value of WiFi secondary channel + * @return : 0 - success, other - failed + */ +int coex_wifi_channel_get(uint8_t *primary, uint8_t *secondary); + /** * @brief Register application callback function to Wi-Fi update low power clock module. * @@ -123,6 +139,60 @@ int coex_wifi_channel_set(uint8_t primary, uint8_t secondary); */ void coex_wifi_register_update_lpclk_callback(coex_set_lpclk_source_callback_t callback); +/** + * @brief Bluetooth requests coexistence + * + * @param event : Bluetooth event + * @param latency : Bluetooth will request coexistence after latency + * @param duration : duration for Bluetooth to request coexistence + * @return : 0 - success, other - failed + */ +int coex_bt_request(uint32_t event, uint32_t latency, uint32_t duration); + +/** + * @brief Bluetooth release coexistence. + * + * @param event : Bluetooth event + * @return : 0 - success, other - failed + */ +int coex_bt_release(uint32_t event); + +#if CONFIG_IDF_TARGET_ESP32 +/** + * @brief Bluetooth registers callback function to coexistence module + * This function is only used on ESP32. + * + * @param callback: callback function registered to coexistence module + * @return : 0 - success, other - failed + */ +int coex_register_bt_cb(coex_func_cb_t callback); + +/** + * @brief To acquire the spin-lock used in resetting Bluetooth baseband. + * This function is only used to workaround ESP32 hardware issue. + * + * @param callback: callback function registered to coexistence module + * @return : value of the spinlock to be restored + */ +uint32_t coex_bb_reset_lock(void); + +/** + * @brief To release the spin-lock used in resetting Bluetooth baseband. + * This function is only used to workaround ESP32 hardware issue. + * + * @param restore: value of the spinlock returned from previous call of coex_bb_rest_lock + */ +void coex_bb_reset_unlock(uint32_t restore); +#endif /* CONFIG_IDF_TARGET_ESP32 */ + +/** + * @brief Bluetooth registers callback function to receive notification when Wi-Fi channel changes + * + * @param callback: callback function registered to coexistence module + * @return : 0 - success, other - failed + */ +int coex_register_wifi_channel_change_callback(coex_wifi_channel_change_cb_t callback); + /** * @brief Update low power clock interval */ @@ -216,6 +286,22 @@ int coex_schm_curr_phase_idx_get(void); */ int coex_register_start_cb(int (* cb)(void)); +/** + * @brief Restart current coexistence scheme. + * + * @return : 0 - success, other - failed + */ +int coex_schm_process_restart(void); + +/** + * @brief Register callback for coexistence scheme. + * + * @param type : callback type + * @param callback : callback + * @return : 0 - success, other - failed + */ +int coex_schm_register_callback(coex_schm_callback_type_t type, void *callback); + /** * @brief Register coexistence adapter functions. * diff --git a/components/esp_coex/include/esp_modem_wrapper.h b/components/esp_coex/include/esp_modem_wrapper.h new file mode 100644 index 0000000000..8ce7a3a433 --- /dev/null +++ b/components/esp_coex/include/esp_modem_wrapper.h @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __ESP_MODEM_WRAPPER_INTERNAL_H__ +#define __ESP_MODEM_WRAPPER_INTERNAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +bool esp_coex_common_env_is_chip_wrapper(void); + +void * esp_coex_common_spin_lock_create_wrapper(void); + +uint32_t esp_coex_common_int_disable_wrapper(void *wifi_int_mux); + +void esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp); + +void esp_coex_common_task_yield_from_isr_wrapper(void); + +void * esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init); + +void esp_coex_common_semphr_delete_wrapper(void *semphr); + +int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick); + +int32_t esp_coex_common_semphr_give_wrapper(void *semphr); + +void esp_coex_common_timer_disarm_wrapper(void *timer); + +void esp_coex_common_timer_done_wrapper(void *ptimer); + +void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg); + +void esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat); + +void * esp_coex_common_malloc_internal_wrapper(size_t size); + +#ifndef CONFIG_IDF_TARGET_ESP32 +uint32_t esp_coex_common_clk_slowclk_cal_get_wrapper(void); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/esp_coex/lib b/components/esp_coex/lib new file mode 160000 index 0000000000..cc8eae05ca --- /dev/null +++ b/components/esp_coex/lib @@ -0,0 +1 @@ +Subproject commit cc8eae05caf9b67ddbde40b057e32748c197b95b diff --git a/components/esp_coex/linker.lf b/components/esp_coex/linker.lf new file mode 100644 index 0000000000..89f1fd620d --- /dev/null +++ b/components/esp_coex/linker.lf @@ -0,0 +1,5 @@ +[mapping:coexist] +archive: libcoexist.a +entries: + if ESP_WIFI_SLP_IRAM_OPT = y: + * (wifi_slp_iram) diff --git a/components/esp_coex/sdkconfig.rename b/components/esp_coex/sdkconfig.rename new file mode 100644 index 0000000000..26d54404c6 --- /dev/null +++ b/components/esp_coex/sdkconfig.rename @@ -0,0 +1,9 @@ +# sdkconfig replacement configurations for deprecated options formatted as +# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION + +CONFIG_SW_COEXIST_ENABLE CONFIG_ESP_COEX_SW_COEXIST_ENABLE +CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE CONFIG_ESP_COEX_SW_COEXIST_ENABLE +CONFIG_ESP_WIFI_SW_COEXIST_ENABLE CONFIG_ESP_COEX_SW_COEXIST_ENABLE + +CONFIG_EXTERNAL_COEX_ENABLE CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE +CONFIG_ESP_WIFI_EXTERNAL_COEXIST_ENABLE CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE diff --git a/components/esp_wifi/src/coexist.c b/components/esp_coex/src/coexist.c similarity index 100% rename from components/esp_wifi/src/coexist.c rename to components/esp_coex/src/coexist.c diff --git a/components/esp_coex/test_md5/test_md5.sh b/components/esp_coex/test_md5/test_md5.sh new file mode 100755 index 0000000000..f60c878345 --- /dev/null +++ b/components/esp_coex/test_md5/test_md5.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if [ -z "${IDF_PATH:-}" ]; then + echo "IDF_PATH must be set before running this script" + exit 1 +fi + +if [ -z "${IDF_TARGET:-}" ]; then + echo "IDF_TARGET must be set before running this script" + exit 1 +fi + +case $IDF_TARGET in + esp32) + PREFIX=xtensa-esp32-elf- + ;; + esp32s2) + PREFIX=xtensa-esp32s2-elf- + ;; + esp32s3) + PREFIX=xtensa-esp32s3-elf- + ;; + esp32c2|esp32c3|esp32c6) + PREFIX=riscv32-esp-elf- + ;; + *) + echo "Invalid IDF_TARGET value: \"${IDF_TARGET}\"" + exit 1 + ;; +esac +LIB_DIR=${IDF_TARGET} + +ELF_FILE=test.elf + +FAILURES=0 + +function check_md5() +{ + FILENAME=$1 + SYMBOL=$2 + + ${PREFIX}ld --unresolved-symbols=ignore-all --entry 0 -o ${ELF_FILE} \ + -u ${SYMBOL} \ + ${IDF_PATH}/components/esp_coex/lib/${LIB_DIR}/*.a + GDB_COMMAND="printf \"%s\\n\", (const char*) ${SYMBOL}" + MD5_FROM_LIB=$(${PREFIX}gdb -n -batch ${ELF_FILE} -ex "${GDB_COMMAND}") + MD5_FROM_HEADER=$(md5sum ${FILENAME} | cut -c 1-7) + + echo "Checking ${FILENAME}:" + echo " ${MD5_FROM_HEADER} - from header file" + echo " ${MD5_FROM_LIB} - from library" + if [ "${MD5_FROM_LIB}" != "${MD5_FROM_HEADER}" ]; then + echo " error: MD5 mismatch!" + FAILURES=$(($FAILURES+1)) + fi +} + +echo "Checking libraries for target ${IDF_TARGET}..." +check_md5 ${IDF_PATH}/components/esp_coex/include/esp_coexist_adapter.h g_coex_adapter_funcs_md5 + +if [ "${IDF_TARGET}" == "esp32c6" ]; then + check_md5 ${IDF_PATH}/components/esp_coex/include/esp_coex_i154.h g_coex_i154_funcs_md5 +fi + +if [ $FAILURES -gt 0 ]; then + exit 1 +fi diff --git a/components/esp_phy/lib b/components/esp_phy/lib index b3e4adbe76..1ab8c85ff1 160000 --- a/components/esp_phy/lib +++ b/components/esp_phy/lib @@ -1 +1 @@ -Subproject commit b3e4adbe7663700ff6950d9d420e112a743f586f +Subproject commit 1ab8c85ff11a8e0f85d430726b2ff2d3c40dbf1b diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index b3cff57720..371a13ffa6 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -25,7 +25,6 @@ #include "endian.h" #include "esp_private/phy.h" #include "phy_init_data.h" -#include "esp_coexist_internal.h" #include "esp_private/periph_ctrl.h" #include "esp_private/wifi.h" #include "esp_rom_crc.h" diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld index 9ea94bb162..91eda2dc40 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ld @@ -1768,7 +1768,7 @@ rcGetHighestRateIdx = 0x40001eac; pm_tx_null_data_done_process = 0x40001eb0; pm_tx_data_process = 0x40001eb4; pm_attach = 0x40001eb8; -pm_coex_schm_process = 0x40001ebc; +/* pm_coex_schm_process = 0x40001ebc; */ ppInitTxq = 0x40001ec0; pp_attach = 0x40001ec4; pp_deattach = 0x40001ec8; @@ -1948,12 +1948,12 @@ ieee80211_sta_is_connected = 0x40002080; current_task_is_wifi_task = 0x40002084; wifi_get_init_state = 0x40002088; ieee80211_timer_process = 0x4000208c; -cnx_coexist_timeout = 0x40002090; +/* cnx_coexist_timeout = 0x40002090; */ /* sta_recv_mgmt = 0x40002094;*/ ieee80211_send_setup = 0x40002098; ieee80211_send_probereq = 0x4000209c; sta_auth_shared = 0x400020a4; -cnx_coexist_timeout_process = 0x400020ac; +/* cnx_coexist_timeout_process = 0x400020ac; */ ieee80211_alloc_challenge = 0x400020b0; cnx_assoc_timeout = 0x400020b4; ieee80211_vnd_ie_set = 0x400020b8; diff --git a/components/esp_system/CMakeLists.txt b/components/esp_system/CMakeLists.txt index 14a2349548..1fd108bdb3 100644 --- a/components/esp_system/CMakeLists.txt +++ b/components/esp_system/CMakeLists.txt @@ -121,7 +121,7 @@ if(CONFIG_VFS_SUPPORT_IO) endif() if(CONFIG_SW_COEXIST_ENABLE OR CONFIG_EXTERNAL_COEX_ENABLE) - idf_component_optional_requires(PRIVATE esp_wifi) + idf_component_optional_requires(PRIVATE esp_coex) endif() if(NOT BOOTLOADER_BUILD) diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 74291c9bf3..a78c273998 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -17,7 +17,6 @@ if(CONFIG_ESP_WIFI_ENABLED) endif() set(srcs - "src/coexist.c" "src/mesh_event.c" "src/smartconfig.c" "src/wifi_init.c" @@ -36,7 +35,7 @@ idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "include" REQUIRES esp_event esp_phy esp_netif PRIV_REQUIRES driver esptool_py esp_pm esp_timer nvs_flash - wpa_supplicant hal lwip ${extra_priv_requires} + wpa_supplicant hal lwip esp_coex ${extra_priv_requires} LDFRAGMENTS "${ldfragments}") if(CONFIG_ESP_WIFI_ENABLED) @@ -47,9 +46,9 @@ if(CONFIG_ESP_WIFI_ENABLED) if(link_binary_libs) if(CONFIG_IDF_TARGET_ESP32C2) - set(blobs coexist core espnow net80211 pp smartconfig) + set(blobs core espnow net80211 pp smartconfig) else() - set(blobs coexist core espnow mesh net80211 pp smartconfig wapi) + set(blobs core espnow mesh net80211 pp smartconfig wapi) endif() foreach(blob ${blobs}) diff --git a/components/esp_wifi/Kconfig b/components/esp_wifi/Kconfig index 0c234bea7e..cfa1d77aaa 100644 --- a/components/esp_wifi/Kconfig +++ b/components/esp_wifi/Kconfig @@ -6,18 +6,6 @@ menu "Wi-Fi" bool default y if SOC_WIFI_SUPPORTED - config ESP_WIFI_SW_COEXIST_ENABLE - bool "Software controls WiFi/Bluetooth coexistence" - depends on ESP_WIFI_ENABLED && BT_ENABLED - default y - select ESP_WIFI_STA_DISCONNECTED_PM_ENABLE - help - If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware. - Recommended for heavy traffic scenarios. Both coexistence configuration options are - automatically managed, no user intervention is required. - If only Bluetooth is used, it is recommended to disable this option to reduce binary file - size. - config ESP_WIFI_STATIC_RX_BUFFER_NUM int "Max number of WiFi static RX buffers" range 2 25 if !SOC_WIFI_HE_SUPPORT @@ -323,18 +311,6 @@ menu "Wi-Fi" Select this option to enable power_management for station when disconnected. Chip will do modem-sleep when rf module is not in use any more. - config ESP_WIFI_EXTERNAL_COEXIST_ENABLE - bool "WiFi External Coexistence" - default n - depends on (!(BT_ENABLED||NIMBLE_ENABLED)&&(!IDF_TARGET_ESP32)) - help - If enabled, HW External coexistence arbitration is managed by GPIO pins. - It can support three types of wired combinations so far which are 1-wired/2-wired/3-wired. - User can select GPIO pins in application code with configure interfaces. - - This function depends on BT-off - because currently we do not support external coex and internal coex simultaneously. - config ESP_WIFI_GCMP_SUPPORT bool "WiFi GCMP Support(GCMP128 and GCMP256)" default n diff --git a/components/esp_wifi/esp32/esp_adapter.c b/components/esp_wifi/esp32/esp_adapter.c index 3a99aeed04..20de25ec02 100644 --- a/components/esp_wifi/esp32/esp_adapter.c +++ b/components/esp_wifi/esp32/esp_adapter.c @@ -40,10 +40,10 @@ #include "os.h" #include "esp_smartconfig.h" #include "esp_coexist_internal.h" -#include "esp_coexist_adapter.h" #include "dport_access.h" #include "esp_rom_sys.h" #include "esp32/rom/ets_sys.h" +#include "esp_modem_wrapper.h" #define TAG "esp_adapter" @@ -172,15 +172,6 @@ static void wifi_delete_queue_wrapper(void *queue) wifi_delete_queue(queue); } -static bool IRAM_ATTR env_is_chip_wrapper(void) -{ -#ifdef CONFIG_IDF_ENV_FPGA - return false; -#else - return true; -#endif -} - static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio) { esp_rom_route_intr_matrix(cpu_no, intr_source, intr_num); @@ -196,58 +187,11 @@ static void set_isr_wrapper(int32_t n, void *f, void *arg) xt_set_interrupt_handler(n, (xt_handler)f, arg); } -static void * spin_lock_create_wrapper(void) -{ - portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; - void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - - if (mux) { - memcpy(mux,&tmp,sizeof(portMUX_TYPE)); - return mux; - } - return NULL; -} - -static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux) -{ - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(wifi_int_mux); - } else { - portENTER_CRITICAL(wifi_int_mux); - } - - return 0; -} - -static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) -{ - if (xPortInIsrContext()) { - portEXIT_CRITICAL_ISR(wifi_int_mux); - } else { - portEXIT_CRITICAL(wifi_int_mux); - } -} - static bool IRAM_ATTR is_from_isr_wrapper(void) { return !xPortCanYield(); } -static void IRAM_ATTR task_yield_from_isr_wrapper(void) -{ - portYIELD_FROM_ISR(); -} - -static void * semphr_create_wrapper(uint32_t max, uint32_t init) -{ - return (void *)xSemaphoreCreateCounting(max, init); -} - -static void semphr_delete_wrapper(void *semphr) -{ - vSemaphoreDelete(semphr); -} - static void wifi_thread_semphr_free(void* data) { SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data); @@ -283,96 +227,6 @@ static void * wifi_thread_semphr_get_wrapper(void) return (void*)sem; } -static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(semphr, block_time_tick); - } -} - -static int32_t semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(semphr); -} - - -static void *internal_semphr_create_wrapper(uint32_t max, uint32_t init) -{ - wifi_static_queue_t *semphr = heap_caps_calloc(1, sizeof(wifi_static_queue_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - if (!semphr) { - return NULL; - } - -#ifdef CONFIG_SPIRAM_USE_MALLOC - semphr->storage = heap_caps_calloc(1, sizeof(StaticSemaphore_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - if (!semphr->storage) { - goto _error; - } - - semphr->handle = xSemaphoreCreateCountingStatic(max, init, semphr->storage); - if (!semphr->handle) { - goto _error; - } - return (void *)semphr; - -_error: - if (semphr) { - if (semphr->storage) { - free(semphr->storage); - } - - free(semphr); - } - return NULL; -#else - semphr->handle = xSemaphoreCreateCounting(max, init); - return (void *)semphr; -#endif -} - -void internal_semphr_delete_wrapper(void *semphr) -{ - wifi_static_queue_t *semphr_item = (wifi_static_queue_t *)semphr; - if (semphr_item) { - if (semphr_item->handle) { - vSemaphoreDelete(semphr_item->handle); - } -#ifdef CONFIG_SPIRAM_USE_MALLOC - if (semphr_item->storage) { - free(semphr_item->storage); - } -#endif - free(semphr_item); - } -} - -static int32_t IRAM_ATTR internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreTakeFromISR(((wifi_static_queue_t *)semphr)->handle, hptw); -} - -static int32_t IRAM_ATTR internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreGiveFromISR(((wifi_static_queue_t *)semphr)->handle, hptw); -} - -static int32_t internal_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(((wifi_static_queue_t *)semphr)->handle, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(((wifi_static_queue_t *)semphr)->handle, block_time_tick); - } -} - -static int32_t internal_semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(((wifi_static_queue_t *)semphr)->handle); -} - - static void * recursive_mutex_create_wrapper(void) { return (void *)xSemaphoreCreateRecursiveMutex(); @@ -493,26 +347,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat ets_timer_arm(timer, tmout, repeat); } -static void IRAM_ATTR timer_disarm_wrapper(void *timer) -{ - ets_timer_disarm(timer); -} - -static void timer_done_wrapper(void *ptimer) -{ - ets_timer_done(ptimer); -} - -static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) -{ - ets_timer_setfn(ptimer, pfunction, parg); -} - -static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) -{ - ets_timer_arm_us(ptimer, us, repeat); -} - static void wifi_reset_mac_wrapper(void) { periph_module_reset(PERIPH_WIFI_MODULE); @@ -533,11 +367,6 @@ static int get_time_wrapper(void *t) return os_get_time(t); } -static void * IRAM_ATTR malloc_internal_wrapper(size_t size) -{ - return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); -} - static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); @@ -693,24 +522,6 @@ static void * coex_schm_curr_phase_get_wrapper(void) #endif } -static int coex_schm_curr_phase_idx_set_wrapper(int idx) -{ -#if CONFIG_SW_COEXIST_ENABLE - return coex_schm_curr_phase_idx_set(idx); -#else - return 0; -#endif -} - -static int coex_schm_curr_phase_idx_get_wrapper(void) -{ -#if CONFIG_SW_COEXIST_ENABLE - return coex_schm_curr_phase_idx_get(); -#else - return 0; -#endif -} - static int coex_register_start_cb_wrapper(int (* cb)(void)) { #if CONFIG_SW_COEXIST_ENABLE @@ -720,34 +531,47 @@ static int coex_register_start_cb_wrapper(int (* cb)(void)) #endif } +static int coex_schm_process_restart_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_process_restart(); +#else + return 0; +#endif +} + +static int coex_schm_register_cb_wrapper(int type, int(*cb)(int)) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_register_callback(type, cb); +#else + return 0; +#endif +} + static void IRAM_ATTR esp_empty_wrapper(void) { } -int IRAM_ATTR coex_is_in_isr_wrapper(void) -{ - return !xPortCanYield(); -} - wifi_osi_funcs_t g_wifi_osi_funcs = { ._version = ESP_WIFI_OS_ADAPTER_VERSION, - ._env_is_chip = env_is_chip_wrapper, + ._env_is_chip = esp_coex_common_env_is_chip_wrapper, ._set_intr = set_intr_wrapper, ._clear_intr = clear_intr_wrapper, ._set_isr = set_isr_wrapper, ._ints_on = esp_cpu_intr_enable, ._ints_off = esp_cpu_intr_disable, ._is_from_isr = is_from_isr_wrapper, - ._spin_lock_create = spin_lock_create_wrapper, + ._spin_lock_create = esp_coex_common_spin_lock_create_wrapper, ._spin_lock_delete = free, - ._wifi_int_disable = wifi_int_disable_wrapper, - ._wifi_int_restore = wifi_int_restore_wrapper, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, + ._wifi_int_disable = esp_coex_common_int_disable_wrapper, + ._wifi_int_restore = esp_coex_common_int_restore_wrapper, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, ._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper, ._mutex_create = mutex_create_wrapper, ._recursive_mutex_create = recursive_mutex_create_wrapper, @@ -790,10 +614,10 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._phy_update_country_info = esp_phy_update_country_info, ._read_mac = esp_read_mac, ._timer_arm = timer_arm_wrapper, - ._timer_disarm = timer_disarm_wrapper, - ._timer_done = timer_done_wrapper, - ._timer_setfn = timer_setfn_wrapper, - ._timer_arm_us = timer_arm_us_wrapper, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, ._wifi_reset_mac = wifi_reset_mac_wrapper, ._wifi_clock_enable = wifi_clock_enable_wrapper, ._wifi_clock_disable = wifi_clock_disable_wrapper, @@ -818,7 +642,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._log_write = esp_log_write, ._log_writev = esp_log_writev, ._log_timestamp = esp_log_timestamp, - ._malloc_internal = malloc_internal_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper, ._calloc_internal = calloc_internal_wrapper, ._zalloc_internal = zalloc_internal_wrapper, @@ -845,32 +669,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._coex_schm_interval_get = coex_schm_interval_get_wrapper, ._coex_schm_curr_period_get = coex_schm_curr_period_get_wrapper, ._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper, - ._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper, - ._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper, + ._coex_schm_process_restart = coex_schm_process_restart_wrapper, + ._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, }; - -coex_adapter_funcs_t g_coex_adapter_funcs = { - ._version = COEX_ADAPTER_VERSION, - ._spin_lock_create = spin_lock_create_wrapper, - ._spin_lock_delete = free, - ._int_disable = wifi_int_disable_wrapper, - ._int_enable = wifi_int_restore_wrapper, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = internal_semphr_create_wrapper, - ._semphr_delete = internal_semphr_delete_wrapper, - ._semphr_take_from_isr = internal_semphr_take_from_isr_wrapper, - ._semphr_give_from_isr = internal_semphr_give_from_isr_wrapper, - ._semphr_take = internal_semphr_take_wrapper, - ._semphr_give = internal_semphr_give_wrapper, - ._is_in_isr = coex_is_in_isr_wrapper, - ._malloc_internal = malloc_internal_wrapper, - ._free = free, - ._timer_disarm = timer_disarm_wrapper, - ._timer_done = timer_done_wrapper, - ._timer_setfn = timer_setfn_wrapper, - ._timer_arm_us = timer_arm_us_wrapper, - ._esp_timer_get_time = esp_timer_get_time, - ._magic = COEX_ADAPTER_MAGIC, -}; diff --git a/components/esp_wifi/esp32c2/esp_adapter.c b/components/esp_wifi/esp32c2/esp_adapter.c index bec2a25ac1..a6dfd46059 100644 --- a/components/esp_wifi/esp32c2/esp_adapter.c +++ b/components/esp_wifi/esp32c2/esp_adapter.c @@ -41,8 +41,8 @@ #include "os.h" #include "esp_smartconfig.h" #include "esp_coexist_internal.h" -#include "esp_coexist_adapter.h" #include "esp32c2/rom/ets_sys.h" +#include "esp_modem_wrapper.h" #define TAG "esp_adapter" @@ -103,15 +103,6 @@ static void wifi_delete_queue_wrapper(void *queue) wifi_delete_queue(queue); } -static bool IRAM_ATTR env_is_chip_wrapper(void) -{ -#ifdef CONFIG_IDF_ENV_FPGA - return false; -#else - return true; -#endif -} - static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio) { intr_matrix_route(intr_source, intr_num); @@ -139,58 +130,11 @@ static void disable_intr_wrapper(uint32_t intr_mask) esprv_intc_int_disable(intr_mask); } -static void * spin_lock_create_wrapper(void) -{ - portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; - void *mux = malloc(sizeof(portMUX_TYPE)); - - if (mux) { - memcpy(mux,&tmp,sizeof(portMUX_TYPE)); - return mux; - } - return NULL; -} - -static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux) -{ - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(wifi_int_mux); - } else { - portENTER_CRITICAL(wifi_int_mux); - } - - return 0; -} - -static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) -{ - if (xPortInIsrContext()) { - portEXIT_CRITICAL_ISR(wifi_int_mux); - } else { - portEXIT_CRITICAL(wifi_int_mux); - } -} - static bool IRAM_ATTR is_from_isr_wrapper(void) { return !xPortCanYield(); } -static void IRAM_ATTR task_yield_from_isr_wrapper(void) -{ - portYIELD_FROM_ISR(); -} - -static void * semphr_create_wrapper(uint32_t max, uint32_t init) -{ - return (void *)xSemaphoreCreateCounting(max, init); -} - -static void semphr_delete_wrapper(void *semphr) -{ - vSemaphoreDelete(semphr); -} - static void wifi_thread_semphr_free(void* data) { SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data); @@ -226,30 +170,6 @@ static void * wifi_thread_semphr_get_wrapper(void) return (void*)sem; } -static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreTakeFromISR(semphr, hptw); -} - -static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreGiveFromISR(semphr, hptw); -} - -static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(semphr, block_time_tick); - } -} - -static int32_t semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(semphr); -} - static void * recursive_mutex_create_wrapper(void) { return (void *)xSemaphoreCreateRecursiveMutex(); @@ -370,26 +290,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat ets_timer_arm(timer, tmout, repeat); } -static void IRAM_ATTR timer_disarm_wrapper(void *timer) -{ - ets_timer_disarm(timer); -} - -static void timer_done_wrapper(void *ptimer) -{ - ets_timer_done(ptimer); -} - -static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) -{ - ets_timer_setfn(ptimer, pfunction, parg); -} - -static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) -{ - ets_timer_arm_us(ptimer, us, repeat); -} - static void wifi_reset_mac_wrapper(void) { periph_module_reset(PERIPH_WIFI_MODULE); @@ -424,19 +324,6 @@ static int get_time_wrapper(void *t) return os_get_time(t); } -static uint32_t esp_clk_slowclk_cal_get_wrapper(void) -{ - /* The bit width of WiFi light sleep clock calibration is 12 while the one of - * system is 19. It should shift 19 - 12 = 7. - */ - return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); -} - -static void * IRAM_ATTR malloc_internal_wrapper(size_t size) -{ - return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); -} - static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); @@ -619,24 +506,6 @@ static void * coex_schm_curr_phase_get_wrapper(void) #endif } -static int coex_schm_curr_phase_idx_set_wrapper(int idx) -{ -#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_set(idx); -#else - return 0; -#endif -} - -static int coex_schm_curr_phase_idx_get_wrapper(void) -{ -#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_get(); -#else - return 0; -#endif -} - static int coex_register_start_cb_wrapper(int (* cb)(void)) { #if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE @@ -646,6 +515,24 @@ static int coex_register_start_cb_wrapper(int (* cb)(void)) #endif } +static int coex_schm_process_restart_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_process_restart(); +#else + return 0; +#endif +} + +static int coex_schm_register_cb_wrapper(int type, int(*cb)(int)) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_register_callback(type, cb); +#else + return 0; +#endif +} + static void IRAM_ATTR esp_empty_wrapper(void) { @@ -653,22 +540,22 @@ static void IRAM_ATTR esp_empty_wrapper(void) wifi_osi_funcs_t g_wifi_osi_funcs = { ._version = ESP_WIFI_OS_ADAPTER_VERSION, - ._env_is_chip = env_is_chip_wrapper, + ._env_is_chip = esp_coex_common_env_is_chip_wrapper, ._set_intr = set_intr_wrapper, ._clear_intr = clear_intr_wrapper, ._set_isr = set_isr_wrapper, ._ints_on = enable_intr_wrapper, ._ints_off = disable_intr_wrapper, ._is_from_isr = is_from_isr_wrapper, - ._spin_lock_create = spin_lock_create_wrapper, + ._spin_lock_create = esp_coex_common_spin_lock_create_wrapper, ._spin_lock_delete = free, - ._wifi_int_disable = wifi_int_disable_wrapper, - ._wifi_int_restore = wifi_int_restore_wrapper, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, + ._wifi_int_disable = esp_coex_common_int_disable_wrapper, + ._wifi_int_restore = esp_coex_common_int_restore_wrapper, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, ._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper, ._mutex_create = mutex_create_wrapper, ._recursive_mutex_create = recursive_mutex_create_wrapper, @@ -709,10 +596,10 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._phy_update_country_info = esp_phy_update_country_info, ._read_mac = esp_read_mac_wrapper, ._timer_arm = timer_arm_wrapper, - ._timer_disarm = timer_disarm_wrapper, - ._timer_done = timer_done_wrapper, - ._timer_setfn = timer_setfn_wrapper, - ._timer_arm_us = timer_arm_us_wrapper, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, ._wifi_reset_mac = wifi_reset_mac_wrapper, ._wifi_clock_enable = wifi_clock_enable_wrapper, ._wifi_clock_disable = wifi_clock_disable_wrapper, @@ -734,11 +621,11 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._get_random = os_get_random, ._get_time = get_time_wrapper, ._random = os_random, - ._slowclk_cal_get = esp_clk_slowclk_cal_get_wrapper, + ._slowclk_cal_get = esp_coex_common_clk_slowclk_cal_get_wrapper, ._log_write = esp_log_write_wrapper, ._log_writev = esp_log_writev_wrapper, ._log_timestamp = esp_log_timestamp, - ._malloc_internal = malloc_internal_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper, ._calloc_internal = calloc_internal_wrapper, ._zalloc_internal = zalloc_internal_wrapper, @@ -765,26 +652,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._coex_schm_interval_get = coex_schm_interval_get_wrapper, ._coex_schm_curr_period_get = coex_schm_curr_period_get_wrapper, ._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper, - ._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper, - ._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper, + ._coex_schm_process_restart = coex_schm_process_restart_wrapper, + ._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, }; - -coex_adapter_funcs_t g_coex_adapter_funcs = { - ._version = COEX_ADAPTER_VERSION, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take_from_isr = semphr_take_from_isr_wrapper, - ._semphr_give_from_isr = semphr_give_from_isr_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, - ._is_in_isr = xPortInIsrContext, - ._malloc_internal = malloc_internal_wrapper, - ._free = free, - ._esp_timer_get_time = esp_timer_get_time, - ._env_is_chip = env_is_chip_wrapper, - ._slowclk_cal_get = esp_clk_slowclk_cal_get_wrapper, - ._magic = COEX_ADAPTER_MAGIC, -}; diff --git a/components/esp_wifi/esp32c3/esp_adapter.c b/components/esp_wifi/esp32c3/esp_adapter.c index 165f9e2fdf..13b619031b 100644 --- a/components/esp_wifi/esp32c3/esp_adapter.c +++ b/components/esp_wifi/esp32c3/esp_adapter.c @@ -42,8 +42,8 @@ #include "os.h" #include "esp_smartconfig.h" #include "esp_coexist_internal.h" -#include "esp_coexist_adapter.h" #include "esp32c3/rom/ets_sys.h" +#include "esp_modem_wrapper.h" #define TAG "esp_adapter" @@ -106,15 +106,6 @@ static void wifi_delete_queue_wrapper(void *queue) wifi_delete_queue(queue); } -static bool IRAM_ATTR env_is_chip_wrapper(void) -{ -#ifdef CONFIG_IDF_ENV_FPGA - return false; -#else - return true; -#endif -} - static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio) { intr_matrix_route(intr_source, intr_num); @@ -142,58 +133,11 @@ static void disable_intr_wrapper(uint32_t intr_mask) esprv_intc_int_disable(intr_mask); } -static void * spin_lock_create_wrapper(void) -{ - portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; - void *mux = malloc(sizeof(portMUX_TYPE)); - - if (mux) { - memcpy(mux,&tmp,sizeof(portMUX_TYPE)); - return mux; - } - return NULL; -} - -static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux) -{ - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(wifi_int_mux); - } else { - portENTER_CRITICAL(wifi_int_mux); - } - - return 0; -} - -static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) -{ - if (xPortInIsrContext()) { - portEXIT_CRITICAL_ISR(wifi_int_mux); - } else { - portEXIT_CRITICAL(wifi_int_mux); - } -} - static bool IRAM_ATTR is_from_isr_wrapper(void) { return !xPortCanYield(); } -static void IRAM_ATTR task_yield_from_isr_wrapper(void) -{ - portYIELD_FROM_ISR(); -} - -static void * semphr_create_wrapper(uint32_t max, uint32_t init) -{ - return (void *)xSemaphoreCreateCounting(max, init); -} - -static void semphr_delete_wrapper(void *semphr) -{ - vSemaphoreDelete(semphr); -} - static void wifi_thread_semphr_free(void* data) { SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data); @@ -229,30 +173,6 @@ static void * wifi_thread_semphr_get_wrapper(void) return (void*)sem; } -static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreTakeFromISR(semphr, hptw); -} - -static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreGiveFromISR(semphr, hptw); -} - -static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(semphr, block_time_tick); - } -} - -static int32_t semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(semphr); -} - static void * recursive_mutex_create_wrapper(void) { return (void *)xSemaphoreCreateRecursiveMutex(); @@ -373,26 +293,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat ets_timer_arm(timer, tmout, repeat); } -static void IRAM_ATTR timer_disarm_wrapper(void *timer) -{ - ets_timer_disarm(timer); -} - -static void timer_done_wrapper(void *ptimer) -{ - ets_timer_done(ptimer); -} - -static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) -{ - ets_timer_setfn(ptimer, pfunction, parg); -} - -static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) -{ - ets_timer_arm_us(ptimer, us, repeat); -} - static void wifi_reset_mac_wrapper(void) { periph_module_reset(PERIPH_WIFI_MODULE); @@ -427,24 +327,6 @@ static int get_time_wrapper(void *t) return os_get_time(t); } -static uint32_t esp_clk_slowclk_cal_get_wrapper(void) -{ - /* The bit width of WiFi light sleep clock calibration is 12 while the one of - * system is 19. It should shift 19 - 12 = 7. - */ - if (GET_PERI_REG_MASK(SYSTEM_BT_LPCK_DIV_FRAC_REG, SYSTEM_LPCLK_SEL_XTAL)) { - uint64_t time_per_us = 1000000ULL; - return (((time_per_us << RTC_CLK_CAL_FRACT) / (MHZ)) >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); - } else { - return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); - } -} - -static void * IRAM_ATTR malloc_internal_wrapper(size_t size) -{ - return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); -} - static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); @@ -627,24 +509,6 @@ static void * coex_schm_curr_phase_get_wrapper(void) #endif } -static int coex_schm_curr_phase_idx_set_wrapper(int idx) -{ -#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_set(idx); -#else - return 0; -#endif -} - -static int coex_schm_curr_phase_idx_get_wrapper(void) -{ -#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_get(); -#else - return 0; -#endif -} - static int coex_register_start_cb_wrapper(int (* cb)(void)) { #if CONFIG_SW_COEXIST_ENABLE @@ -654,6 +518,24 @@ static int coex_register_start_cb_wrapper(int (* cb)(void)) #endif } +static int coex_schm_process_restart_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_process_restart(); +#else + return 0; +#endif +} + +static int coex_schm_register_cb_wrapper(int type, int(*cb)(int)) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_register_callback(type, cb); +#else + return 0; +#endif +} + static void IRAM_ATTR esp_empty_wrapper(void) { @@ -661,22 +543,22 @@ static void IRAM_ATTR esp_empty_wrapper(void) wifi_osi_funcs_t g_wifi_osi_funcs = { ._version = ESP_WIFI_OS_ADAPTER_VERSION, - ._env_is_chip = env_is_chip_wrapper, + ._env_is_chip = esp_coex_common_env_is_chip_wrapper, ._set_intr = set_intr_wrapper, ._clear_intr = clear_intr_wrapper, ._set_isr = set_isr_wrapper, ._ints_on = enable_intr_wrapper, ._ints_off = disable_intr_wrapper, ._is_from_isr = is_from_isr_wrapper, - ._spin_lock_create = spin_lock_create_wrapper, + ._spin_lock_create = esp_coex_common_spin_lock_create_wrapper, ._spin_lock_delete = free, - ._wifi_int_disable = wifi_int_disable_wrapper, - ._wifi_int_restore = wifi_int_restore_wrapper, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, + ._wifi_int_disable = esp_coex_common_int_disable_wrapper, + ._wifi_int_restore = esp_coex_common_int_restore_wrapper, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, ._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper, ._mutex_create = mutex_create_wrapper, ._recursive_mutex_create = recursive_mutex_create_wrapper, @@ -717,10 +599,10 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._phy_update_country_info = esp_phy_update_country_info, ._read_mac = esp_read_mac_wrapper, ._timer_arm = timer_arm_wrapper, - ._timer_disarm = timer_disarm_wrapper, - ._timer_done = timer_done_wrapper, - ._timer_setfn = timer_setfn_wrapper, - ._timer_arm_us = timer_arm_us_wrapper, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, ._wifi_reset_mac = wifi_reset_mac_wrapper, ._wifi_clock_enable = wifi_clock_enable_wrapper, ._wifi_clock_disable = wifi_clock_disable_wrapper, @@ -742,11 +624,11 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._get_random = os_get_random, ._get_time = get_time_wrapper, ._random = os_random, - ._slowclk_cal_get = esp_clk_slowclk_cal_get_wrapper, + ._slowclk_cal_get = esp_coex_common_clk_slowclk_cal_get_wrapper, ._log_write = esp_log_write_wrapper, ._log_writev = esp_log_writev_wrapper, ._log_timestamp = esp_log_timestamp, - ._malloc_internal = malloc_internal_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper, ._calloc_internal = calloc_internal_wrapper, ._zalloc_internal = zalloc_internal_wrapper, @@ -773,24 +655,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._coex_schm_interval_get = coex_schm_interval_get_wrapper, ._coex_schm_curr_period_get = coex_schm_curr_period_get_wrapper, ._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper, - ._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper, - ._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper, + ._coex_schm_process_restart = coex_schm_process_restart_wrapper, + ._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, }; - -coex_adapter_funcs_t g_coex_adapter_funcs = { - ._version = COEX_ADAPTER_VERSION, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take_from_isr = semphr_take_from_isr_wrapper, - ._semphr_give_from_isr = semphr_give_from_isr_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, - ._is_in_isr = xPortInIsrContext, - ._malloc_internal = malloc_internal_wrapper, - ._free = free, - ._esp_timer_get_time = esp_timer_get_time, - ._magic = COEX_ADAPTER_MAGIC, -}; diff --git a/components/esp_wifi/esp32c6/esp_adapter.c b/components/esp_wifi/esp32c6/esp_adapter.c index 76eb31bd0b..86cc1b7005 100644 --- a/components/esp_wifi/esp32c6/esp_adapter.c +++ b/components/esp_wifi/esp32c6/esp_adapter.c @@ -40,8 +40,8 @@ #include "os.h" #include "esp_smartconfig.h" #include "esp_coexist_internal.h" -#include "esp_coexist_adapter.h" #include "esp32c6/rom/ets_sys.h" +#include "esp_modem_wrapper.h" #define TAG "esp_adapter" @@ -102,15 +102,6 @@ static void wifi_delete_queue_wrapper(void *queue) wifi_delete_queue(queue); } -static bool IRAM_ATTR env_is_chip_wrapper(void) -{ -#ifdef CONFIG_IDF_ENV_FPGA - return false; -#else - return true; -#endif -} - static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio) { intr_matrix_route(intr_source, intr_num); @@ -138,58 +129,11 @@ static void disable_intr_wrapper(uint32_t intr_mask) esprv_intc_int_disable(intr_mask); } -static void *spin_lock_create_wrapper(void) -{ - portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; - void *mux = malloc(sizeof(portMUX_TYPE)); - - if (mux) { - memcpy(mux, &tmp, sizeof(portMUX_TYPE)); - return mux; - } - return NULL; -} - -static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux) -{ - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(wifi_int_mux); - } else { - portENTER_CRITICAL(wifi_int_mux); - } - - return 0; -} - -static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) -{ - if (xPortInIsrContext()) { - portEXIT_CRITICAL_ISR(wifi_int_mux); - } else { - portEXIT_CRITICAL(wifi_int_mux); - } -} - static bool IRAM_ATTR is_from_isr_wrapper(void) { return !xPortCanYield(); } -static void IRAM_ATTR task_yield_from_isr_wrapper(void) -{ - portYIELD_FROM_ISR(); -} - -static void *semphr_create_wrapper(uint32_t max, uint32_t init) -{ - return (void *)xSemaphoreCreateCounting(max, init); -} - -static void semphr_delete_wrapper(void *semphr) -{ - vSemaphoreDelete(semphr); -} - static void wifi_thread_semphr_free(void *data) { SemaphoreHandle_t *sem = (SemaphoreHandle_t *)(data); @@ -225,30 +169,6 @@ static void *wifi_thread_semphr_get_wrapper(void) return (void *)sem; } -static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreTakeFromISR(semphr, hptw); -} - -static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreGiveFromISR(semphr, hptw); -} - -static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(semphr, block_time_tick); - } -} - -static int32_t semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(semphr); -} - static void *recursive_mutex_create_wrapper(void) { return (void *)xSemaphoreCreateRecursiveMutex(); @@ -369,26 +289,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat ets_timer_arm(timer, tmout, repeat); } -static void IRAM_ATTR timer_disarm_wrapper(void *timer) -{ - ets_timer_disarm(timer); -} - -static void timer_done_wrapper(void *ptimer) -{ - ets_timer_done(ptimer); -} - -static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) -{ - ets_timer_setfn(ptimer, pfunction, parg); -} - -static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) -{ - ets_timer_arm_us(ptimer, us, repeat); -} - static void wifi_reset_mac_wrapper(void) { // TODO: IDF-5713 @@ -422,19 +322,6 @@ static int get_time_wrapper(void *t) return os_get_time(t); } -static uint32_t esp_clk_slowclk_cal_get_wrapper(void) -{ - /* The bit width of WiFi light sleep clock calibration is 12 while the one of - * system is 19. It should shift 19 - 12 = 7. - */ - return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); -} - -static void *IRAM_ATTR malloc_internal_wrapper(size_t size) -{ - return heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL); -} - static void *IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL); @@ -617,24 +504,6 @@ static void *coex_schm_curr_phase_get_wrapper(void) #endif } -static int coex_schm_curr_phase_idx_set_wrapper(int idx) -{ -#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_set(idx); -#else - return 0; -#endif -} - -static int coex_schm_curr_phase_idx_get_wrapper(void) -{ -#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_get(); -#else - return 0; -#endif -} - static int coex_register_start_cb_wrapper(int (* cb)(void)) { #if CONFIG_SW_COEXIST_ENABLE @@ -644,6 +513,24 @@ static int coex_register_start_cb_wrapper(int (* cb)(void)) #endif } +static int coex_schm_process_restart_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_process_restart(); +#else + return 0; +#endif +} + +static int coex_schm_register_cb_wrapper(int type, int(*cb)(int)) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_register_callback(type, cb); +#else + return 0; +#endif +} + static void IRAM_ATTR esp_empty_wrapper(void) { @@ -651,22 +538,22 @@ static void IRAM_ATTR esp_empty_wrapper(void) wifi_osi_funcs_t g_wifi_osi_funcs = { ._version = ESP_WIFI_OS_ADAPTER_VERSION, - ._env_is_chip = env_is_chip_wrapper, + ._env_is_chip = esp_coex_common_env_is_chip_wrapper, ._set_intr = set_intr_wrapper, ._clear_intr = clear_intr_wrapper, ._set_isr = set_isr_wrapper, ._ints_on = enable_intr_wrapper, ._ints_off = disable_intr_wrapper, ._is_from_isr = is_from_isr_wrapper, - ._spin_lock_create = spin_lock_create_wrapper, + ._spin_lock_create = esp_coex_common_spin_lock_create_wrapper, ._spin_lock_delete = free, - ._wifi_int_disable = wifi_int_disable_wrapper, - ._wifi_int_restore = wifi_int_restore_wrapper, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, + ._wifi_int_disable = esp_coex_common_int_disable_wrapper, + ._wifi_int_restore = esp_coex_common_int_restore_wrapper, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, ._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper, ._mutex_create = mutex_create_wrapper, ._recursive_mutex_create = recursive_mutex_create_wrapper, @@ -707,10 +594,10 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._phy_update_country_info = esp_phy_update_country_info, ._read_mac = esp_read_mac_wrapper, ._timer_arm = timer_arm_wrapper, - ._timer_disarm = timer_disarm_wrapper, - ._timer_done = timer_done_wrapper, - ._timer_setfn = timer_setfn_wrapper, - ._timer_arm_us = timer_arm_us_wrapper, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, ._wifi_reset_mac = wifi_reset_mac_wrapper, ._wifi_clock_enable = wifi_clock_enable_wrapper, ._wifi_clock_disable = wifi_clock_disable_wrapper, @@ -732,11 +619,11 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._get_random = os_get_random, ._get_time = get_time_wrapper, ._random = os_random, - ._slowclk_cal_get = esp_clk_slowclk_cal_get_wrapper, + ._slowclk_cal_get = esp_coex_common_clk_slowclk_cal_get_wrapper, ._log_write = esp_log_write_wrapper, ._log_writev = esp_log_writev_wrapper, ._log_timestamp = esp_log_timestamp, - ._malloc_internal = malloc_internal_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper, ._calloc_internal = calloc_internal_wrapper, ._zalloc_internal = zalloc_internal_wrapper, @@ -763,8 +650,6 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._coex_schm_interval_get = coex_schm_interval_get_wrapper, ._coex_schm_curr_period_get = coex_schm_curr_period_get_wrapper, ._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper, - ._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper, - ._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper, #if 0//CONFIG_IDF_TARGET_ESP32C6 // TODO: WIFI-5150 @@ -773,23 +658,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._sleep_retention_entries_create = (int (*)(const void *, int, int, int))sleep_retention_entries_create, ._sleep_retention_entries_destroy = sleep_retention_entries_destroy, #endif + ._coex_schm_process_restart = coex_schm_process_restart_wrapper, + ._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, }; - -coex_adapter_funcs_t g_coex_adapter_funcs = { - ._version = COEX_ADAPTER_VERSION, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take_from_isr = semphr_take_from_isr_wrapper, - ._semphr_give_from_isr = semphr_give_from_isr_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, - ._is_in_isr = xPortInIsrContext, - ._malloc_internal = malloc_internal_wrapper, - ._free = free, - ._esp_timer_get_time = esp_timer_get_time, - ._env_is_chip = env_is_chip_wrapper, - ._slowclk_cal_get = esp_clk_slowclk_cal_get_wrapper, - ._magic = COEX_ADAPTER_MAGIC, -}; diff --git a/components/esp_wifi/esp32s2/esp_adapter.c b/components/esp_wifi/esp32s2/esp_adapter.c index 4a022638e1..6468d800f7 100644 --- a/components/esp_wifi/esp32s2/esp_adapter.c +++ b/components/esp_wifi/esp32s2/esp_adapter.c @@ -42,9 +42,9 @@ #include "os.h" #include "esp_smartconfig.h" #include "esp_coexist_internal.h" -#include "esp_coexist_adapter.h" #include "esp_rom_sys.h" #include "esp32s2/rom/ets_sys.h" +#include "esp_modem_wrapper.h" #define TAG "esp_adapter" @@ -163,15 +163,6 @@ static void wifi_delete_queue_wrapper(void *queue) wifi_delete_queue(queue); } -static bool IRAM_ATTR env_is_chip_wrapper(void) -{ -#ifdef CONFIG_IDF_ENV_FPGA - return false; -#else - return true; -#endif -} - static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio) { esp_rom_route_intr_matrix(cpu_no, intr_source, intr_num); @@ -187,58 +178,11 @@ static void set_isr_wrapper(int32_t n, void *f, void *arg) xt_set_interrupt_handler(n, (xt_handler)f, arg); } -static void * spin_lock_create_wrapper(void) -{ - portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; - void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - - if (mux) { - memcpy(mux,&tmp,sizeof(portMUX_TYPE)); - return mux; - } - return NULL; -} - -static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux) -{ - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(wifi_int_mux); - } else { - portENTER_CRITICAL(wifi_int_mux); - } - - return 0; -} - -static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) -{ - if (xPortInIsrContext()) { - portEXIT_CRITICAL_ISR(wifi_int_mux); - } else { - portEXIT_CRITICAL(wifi_int_mux); - } -} - static bool IRAM_ATTR is_from_isr_wrapper(void) { return !xPortCanYield(); } -static void IRAM_ATTR task_yield_from_isr_wrapper(void) -{ - portYIELD_FROM_ISR(); -} - -static void * semphr_create_wrapper(uint32_t max, uint32_t init) -{ - return (void *)xSemaphoreCreateCounting(max, init); -} - -static void semphr_delete_wrapper(void *semphr) -{ - vSemaphoreDelete(semphr); -} - static void wifi_thread_semphr_free(void* data) { SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data); @@ -274,94 +218,6 @@ static void * wifi_thread_semphr_get_wrapper(void) return (void*)sem; } -static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(semphr, block_time_tick); - } -} - -static int32_t semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(semphr); -} - -static void *internal_semphr_create_wrapper(uint32_t max, uint32_t init) -{ - wifi_static_queue_t *semphr = heap_caps_calloc(1, sizeof(wifi_static_queue_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - if (!semphr) { - return NULL; - } - -#ifdef CONFIG_SPIRAM_USE_MALLOC - semphr->storage = heap_caps_calloc(1, sizeof(StaticSemaphore_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - if (!semphr->storage) { - goto _error; - } - - semphr->handle = xSemaphoreCreateCountingStatic(max, init, semphr->storage); - if (!semphr->handle) { - goto _error; - } - return (void *)semphr; - -_error: - if (semphr) { - if (semphr->storage) { - free(semphr->storage); - } - - free(semphr); - } - return NULL; -#else - semphr->handle = xSemaphoreCreateCounting(max, init); - return (void *)semphr; -#endif -} - -void internal_semphr_delete_wrapper(void *semphr) -{ - wifi_static_queue_t *semphr_item = (wifi_static_queue_t *)semphr; - if (semphr_item) { - if (semphr_item->handle) { - vSemaphoreDelete(semphr_item->handle); - } -#ifdef CONFIG_SPIRAM_USE_MALLOC - if (semphr_item->storage) { - free(semphr_item->storage); - } -#endif - free(semphr_item); - } -} - -static int32_t IRAM_ATTR internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreTakeFromISR(((wifi_static_queue_t *)semphr)->handle, hptw); -} - -static int32_t IRAM_ATTR internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreGiveFromISR(((wifi_static_queue_t *)semphr)->handle, hptw); -} - -static int32_t internal_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(((wifi_static_queue_t *)semphr)->handle, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(((wifi_static_queue_t *)semphr)->handle, block_time_tick); - } -} - -static int32_t internal_semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(((wifi_static_queue_t *)semphr)->handle); -} - static void * recursive_mutex_create_wrapper(void) { return (void *)xSemaphoreCreateRecursiveMutex(); @@ -482,26 +338,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat ets_timer_arm(timer, tmout, repeat); } -static void IRAM_ATTR timer_disarm_wrapper(void *timer) -{ - ets_timer_disarm(timer); -} - -static void timer_done_wrapper(void *ptimer) -{ - ets_timer_done(ptimer); -} - -static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) -{ - ets_timer_setfn(ptimer, pfunction, parg); -} - -static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) -{ - ets_timer_arm_us(ptimer, us, repeat); -} - static void wifi_reset_mac_wrapper(void) { periph_module_reset(PERIPH_WIFI_MODULE); @@ -522,19 +358,6 @@ static int get_time_wrapper(void *t) return os_get_time(t); } -static uint32_t esp_clk_slowclk_cal_get_wrapper(void) -{ - /* The bit width of WiFi light sleep clock calibration is 12 while the one of - * system is 19. It should shift 19 - 12 = 7. - */ - return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); -} - -static void * IRAM_ATTR malloc_internal_wrapper(size_t size) -{ - return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); -} - static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); @@ -694,24 +517,6 @@ static void * coex_schm_curr_phase_get_wrapper(void) #endif } -static int coex_schm_curr_phase_idx_set_wrapper(int idx) -{ -#if CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_set(idx); -#else - return 0; -#endif -} - -static int coex_schm_curr_phase_idx_get_wrapper(void) -{ -#if CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_get(); -#else - return 0; -#endif -} - static int coex_register_start_cb_wrapper(int (* cb)(void)) { #if CONFIG_SW_COEXIST_ENABLE @@ -721,34 +526,47 @@ static int coex_register_start_cb_wrapper(int (* cb)(void)) #endif } +static int coex_schm_process_restart_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_process_restart(); +#else + return 0; +#endif +} + +static int coex_schm_register_cb_wrapper(int type, int(*cb)(int)) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_register_callback(type, cb); +#else + return 0; +#endif +} + static void IRAM_ATTR esp_empty_wrapper(void) { } -int IRAM_ATTR coex_is_in_isr_wrapper(void) -{ - return !xPortCanYield(); -} - wifi_osi_funcs_t g_wifi_osi_funcs = { ._version = ESP_WIFI_OS_ADAPTER_VERSION, - ._env_is_chip = env_is_chip_wrapper, + ._env_is_chip = esp_coex_common_env_is_chip_wrapper, ._set_intr = set_intr_wrapper, ._clear_intr = clear_intr_wrapper, ._set_isr = set_isr_wrapper, ._ints_on = esp_cpu_intr_enable, ._ints_off = esp_cpu_intr_disable, ._is_from_isr = is_from_isr_wrapper, - ._spin_lock_create = spin_lock_create_wrapper, + ._spin_lock_create = esp_coex_common_spin_lock_create_wrapper, ._spin_lock_delete = free, - ._wifi_int_disable = wifi_int_disable_wrapper, - ._wifi_int_restore = wifi_int_restore_wrapper, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, + ._wifi_int_disable = esp_coex_common_int_disable_wrapper, + ._wifi_int_restore = esp_coex_common_int_restore_wrapper, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, ._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper, ._mutex_create = mutex_create_wrapper, ._recursive_mutex_create = recursive_mutex_create_wrapper, @@ -791,10 +609,10 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._phy_update_country_info = esp_phy_update_country_info, ._read_mac = esp_read_mac, ._timer_arm = timer_arm_wrapper, - ._timer_disarm = timer_disarm_wrapper, - ._timer_done = timer_done_wrapper, - ._timer_setfn = timer_setfn_wrapper, - ._timer_arm_us = timer_arm_us_wrapper, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, ._wifi_reset_mac = wifi_reset_mac_wrapper, ._wifi_clock_enable = wifi_clock_enable_wrapper, ._wifi_clock_disable = wifi_clock_disable_wrapper, @@ -816,11 +634,11 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._get_random = os_get_random, ._get_time = get_time_wrapper, ._random = os_random, - ._slowclk_cal_get = esp_clk_slowclk_cal_get_wrapper, + ._slowclk_cal_get = esp_coex_common_clk_slowclk_cal_get_wrapper, ._log_write = esp_log_write, ._log_writev = esp_log_writev, ._log_timestamp = esp_log_timestamp, - ._malloc_internal = malloc_internal_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper, ._calloc_internal = calloc_internal_wrapper, ._zalloc_internal = zalloc_internal_wrapper, @@ -847,24 +665,9 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._coex_schm_interval_get = coex_schm_interval_get_wrapper, ._coex_schm_curr_period_get = coex_schm_curr_period_get_wrapper, ._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper, - ._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper, - ._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper, + ._coex_schm_process_restart = coex_schm_process_restart_wrapper, + ._coex_schm_register_cb = coex_schm_register_cb_wrapper, + ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, }; - -coex_adapter_funcs_t g_coex_adapter_funcs = { - ._version = COEX_ADAPTER_VERSION, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = internal_semphr_create_wrapper, - ._semphr_delete = internal_semphr_delete_wrapper, - ._semphr_take_from_isr = internal_semphr_take_from_isr_wrapper, - ._semphr_give_from_isr = internal_semphr_give_from_isr_wrapper, - ._semphr_take = internal_semphr_take_wrapper, - ._semphr_give = internal_semphr_give_wrapper, - ._is_in_isr = coex_is_in_isr_wrapper, - ._malloc_internal = malloc_internal_wrapper, - ._free = free, - ._esp_timer_get_time = esp_timer_get_time, - ._magic = COEX_ADAPTER_MAGIC, -}; diff --git a/components/esp_wifi/esp32s3/esp_adapter.c b/components/esp_wifi/esp32s3/esp_adapter.c index dd67515fda..9a76e61279 100644 --- a/components/esp_wifi/esp32s3/esp_adapter.c +++ b/components/esp_wifi/esp32s3/esp_adapter.c @@ -43,9 +43,9 @@ #include "os.h" #include "esp_smartconfig.h" #include "esp_coexist_internal.h" -#include "esp_coexist_adapter.h" #include "esp_rom_sys.h" #include "esp32s3/rom/ets_sys.h" +#include "esp_modem_wrapper.h" #define TAG "esp_adapter" @@ -166,15 +166,6 @@ static void wifi_delete_queue_wrapper(void *queue) wifi_delete_queue(queue); } -static bool IRAM_ATTR env_is_chip_wrapper(void) -{ -#ifdef CONFIG_IDF_ENV_FPGA - return false; -#else - return true; -#endif -} - static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio) { esp_rom_route_intr_matrix(cpu_no, intr_source, intr_num); @@ -190,58 +181,11 @@ static void set_isr_wrapper(int32_t n, void *f, void *arg) xt_set_interrupt_handler(n, (xt_handler)f, arg); } -static void * spin_lock_create_wrapper(void) -{ - portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; - void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - - if (mux) { - memcpy(mux,&tmp,sizeof(portMUX_TYPE)); - return mux; - } - return NULL; -} - -static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux) -{ - if (xPortInIsrContext()) { - portENTER_CRITICAL_ISR(wifi_int_mux); - } else { - portENTER_CRITICAL(wifi_int_mux); - } - - return 0; -} - -static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) -{ - if (xPortInIsrContext()) { - portEXIT_CRITICAL_ISR(wifi_int_mux); - } else { - portEXIT_CRITICAL(wifi_int_mux); - } -} - static bool IRAM_ATTR is_from_isr_wrapper(void) { return !xPortCanYield(); } -static void IRAM_ATTR task_yield_from_isr_wrapper(void) -{ - portYIELD_FROM_ISR(); -} - -static void * semphr_create_wrapper(uint32_t max, uint32_t init) -{ - return (void *)xSemaphoreCreateCounting(max, init); -} - -static void semphr_delete_wrapper(void *semphr) -{ - vSemaphoreDelete(semphr); -} - static void wifi_thread_semphr_free(void* data) { SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data); @@ -277,94 +221,6 @@ static void * wifi_thread_semphr_get_wrapper(void) return (void*)sem; } -static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(semphr, block_time_tick); - } -} - -static int32_t semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(semphr); -} - -static void *internal_semphr_create_wrapper(uint32_t max, uint32_t init) -{ - wifi_static_queue_t *semphr = heap_caps_calloc(1, sizeof(wifi_static_queue_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - if (!semphr) { - return NULL; - } - -#ifdef CONFIG_SPIRAM_USE_MALLOC - semphr->storage = heap_caps_calloc(1, sizeof(StaticSemaphore_t), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); - if (!semphr->storage) { - goto _error; - } - - semphr->handle = xSemaphoreCreateCountingStatic(max, init, semphr->storage); - if (!semphr->handle) { - goto _error; - } - return (void *)semphr; - -_error: - if (semphr) { - if (semphr->storage) { - free(semphr->storage); - } - - free(semphr); - } - return NULL; -#else - semphr->handle = xSemaphoreCreateCounting(max, init); - return (void *)semphr; -#endif -} - -void internal_semphr_delete_wrapper(void *semphr) -{ - wifi_static_queue_t *semphr_item = (wifi_static_queue_t *)semphr; - if (semphr_item) { - if (semphr_item->handle) { - vSemaphoreDelete(semphr_item->handle); - } -#ifdef CONFIG_SPIRAM_USE_MALLOC - if (semphr_item->storage) { - free(semphr_item->storage); - } -#endif - free(semphr_item); - } -} - -static int32_t IRAM_ATTR internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreTakeFromISR(((wifi_static_queue_t *)semphr)->handle, hptw); -} - -static int32_t IRAM_ATTR internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw) -{ - return (int32_t)xSemaphoreGiveFromISR(((wifi_static_queue_t *)semphr)->handle, hptw); -} - -static int32_t internal_semphr_take_wrapper(void *semphr, uint32_t block_time_tick) -{ - if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { - return (int32_t)xSemaphoreTake(((wifi_static_queue_t *)semphr)->handle, portMAX_DELAY); - } else { - return (int32_t)xSemaphoreTake(((wifi_static_queue_t *)semphr)->handle, block_time_tick); - } -} - -static int32_t internal_semphr_give_wrapper(void *semphr) -{ - return (int32_t)xSemaphoreGive(((wifi_static_queue_t *)semphr)->handle); -} - static void * recursive_mutex_create_wrapper(void) { return (void *)xSemaphoreCreateRecursiveMutex(); @@ -485,26 +341,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat ets_timer_arm(timer, tmout, repeat); } -static void IRAM_ATTR timer_disarm_wrapper(void *timer) -{ - ets_timer_disarm(timer); -} - -static void timer_done_wrapper(void *ptimer) -{ - ets_timer_done(ptimer); -} - -static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) -{ - ets_timer_setfn(ptimer, pfunction, parg); -} - -static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) -{ - ets_timer_arm_us(ptimer, us, repeat); -} - static void wifi_reset_mac_wrapper(void) { periph_module_reset(PERIPH_WIFI_MODULE); @@ -539,24 +375,6 @@ static int get_time_wrapper(void *t) return os_get_time(t); } -static uint32_t esp_clk_slowclk_cal_get_wrapper(void) -{ - /* The bit width of WiFi light sleep clock calibration is 12 while the one of - * system is 19. It should shift 19 - 12 = 7. - */ - if (GET_PERI_REG_MASK(SYSTEM_BT_LPCK_DIV_FRAC_REG, SYSTEM_LPCLK_SEL_XTAL)) { - uint64_t time_per_us = 1000000ULL; - return (((time_per_us << RTC_CLK_CAL_FRACT) / (MHZ)) >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); - } else { - return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); - } -} - -static void * IRAM_ATTR malloc_internal_wrapper(size_t size) -{ - return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); -} - static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); @@ -716,24 +534,6 @@ static void * coex_schm_curr_phase_get_wrapper(void) #endif } -static int coex_schm_curr_phase_idx_set_wrapper(int idx) -{ -#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_set(idx); -#else - return 0; -#endif -} - -static int coex_schm_curr_phase_idx_get_wrapper(void) -{ -#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE - return coex_schm_curr_phase_idx_get(); -#else - return 0; -#endif -} - static int coex_register_start_cb_wrapper(int (* cb)(void)) { #if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE @@ -743,34 +543,47 @@ static int coex_register_start_cb_wrapper(int (* cb)(void)) #endif } +static int coex_schm_process_restart_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_process_restart(); +#else + return 0; +#endif +} + +static int coex_schm_register_cb_wrapper(int type, int(*cb)(int)) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_schm_register_callback(type, cb); +#else + return 0; +#endif +} + static void IRAM_ATTR esp_empty_wrapper(void) { } -int IRAM_ATTR coex_is_in_isr_wrapper(void) -{ - return !xPortCanYield(); -} - wifi_osi_funcs_t g_wifi_osi_funcs = { ._version = ESP_WIFI_OS_ADAPTER_VERSION, - ._env_is_chip = env_is_chip_wrapper, + ._env_is_chip = esp_coex_common_env_is_chip_wrapper, ._set_intr = set_intr_wrapper, ._clear_intr = clear_intr_wrapper, ._set_isr = set_isr_wrapper, ._ints_on = esp_cpu_intr_enable, ._ints_off = esp_cpu_intr_disable, ._is_from_isr = is_from_isr_wrapper, - ._spin_lock_create = spin_lock_create_wrapper, + ._spin_lock_create = esp_coex_common_spin_lock_create_wrapper, ._spin_lock_delete = free, - ._wifi_int_disable = wifi_int_disable_wrapper, - ._wifi_int_restore = wifi_int_restore_wrapper, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = semphr_create_wrapper, - ._semphr_delete = semphr_delete_wrapper, - ._semphr_take = semphr_take_wrapper, - ._semphr_give = semphr_give_wrapper, + ._wifi_int_disable = esp_coex_common_int_disable_wrapper, + ._wifi_int_restore = esp_coex_common_int_restore_wrapper, + ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper, + ._semphr_create = esp_coex_common_semphr_create_wrapper, + ._semphr_delete = esp_coex_common_semphr_delete_wrapper, + ._semphr_take = esp_coex_common_semphr_take_wrapper, + ._semphr_give = esp_coex_common_semphr_give_wrapper, ._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper, ._mutex_create = mutex_create_wrapper, ._recursive_mutex_create = recursive_mutex_create_wrapper, @@ -811,10 +624,10 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._phy_update_country_info = esp_phy_update_country_info, ._read_mac = esp_read_mac, ._timer_arm = timer_arm_wrapper, - ._timer_disarm = timer_disarm_wrapper, - ._timer_done = timer_done_wrapper, - ._timer_setfn = timer_setfn_wrapper, - ._timer_arm_us = timer_arm_us_wrapper, + ._timer_disarm = esp_coex_common_timer_disarm_wrapper, + ._timer_done = esp_coex_common_timer_done_wrapper, + ._timer_setfn = esp_coex_common_timer_setfn_wrapper, + ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper, ._wifi_reset_mac = wifi_reset_mac_wrapper, ._wifi_clock_enable = wifi_clock_enable_wrapper, ._wifi_clock_disable = wifi_clock_disable_wrapper, @@ -836,11 +649,11 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._get_random = os_get_random, ._get_time = get_time_wrapper, ._random = os_random, - ._slowclk_cal_get = esp_clk_slowclk_cal_get_wrapper, + ._slowclk_cal_get = esp_coex_common_clk_slowclk_cal_get_wrapper, ._log_write = esp_log_write, ._log_writev = esp_log_writev, ._log_timestamp = esp_log_timestamp, - ._malloc_internal = malloc_internal_wrapper, + ._malloc_internal = esp_coex_common_malloc_internal_wrapper, ._realloc_internal = realloc_internal_wrapper, ._calloc_internal = calloc_internal_wrapper, ._zalloc_internal = zalloc_internal_wrapper, @@ -867,24 +680,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._coex_schm_interval_get = coex_schm_interval_get_wrapper, ._coex_schm_curr_period_get = coex_schm_curr_period_get_wrapper, ._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper, - ._coex_schm_curr_phase_idx_set = coex_schm_curr_phase_idx_set_wrapper, - ._coex_schm_curr_phase_idx_get = coex_schm_curr_phase_idx_get_wrapper, ._coex_register_start_cb = coex_register_start_cb_wrapper, + ._coex_schm_process_restart = coex_schm_process_restart_wrapper, + ._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, }; - -coex_adapter_funcs_t g_coex_adapter_funcs = { - ._version = COEX_ADAPTER_VERSION, - ._task_yield_from_isr = task_yield_from_isr_wrapper, - ._semphr_create = internal_semphr_create_wrapper, - ._semphr_delete = internal_semphr_delete_wrapper, - ._semphr_take_from_isr = internal_semphr_take_from_isr_wrapper, - ._semphr_give_from_isr = internal_semphr_give_from_isr_wrapper, - ._semphr_take = internal_semphr_take_wrapper, - ._semphr_give = internal_semphr_give_wrapper, - ._is_in_isr = coex_is_in_isr_wrapper, - ._malloc_internal = malloc_internal_wrapper, - ._free = free, - ._esp_timer_get_time = esp_timer_get_time, - ._magic = COEX_ADAPTER_MAGIC, -}; diff --git a/components/esp_wifi/include/esp_private/wifi_os_adapter.h b/components/esp_wifi/include/esp_private/wifi_os_adapter.h index d17b5fc47d..d23cbdeacb 100644 --- a/components/esp_wifi/include/esp_private/wifi_os_adapter.h +++ b/components/esp_wifi/include/esp_private/wifi_os_adapter.h @@ -142,8 +142,6 @@ typedef struct { uint32_t (* _coex_schm_interval_get)(void); uint8_t (* _coex_schm_curr_period_get)(void); void * (* _coex_schm_curr_phase_get)(void); - int (* _coex_schm_curr_phase_idx_set)(int idx); - int (* _coex_schm_curr_phase_idx_get)(void); int (* _coex_register_start_cb)(int (* cb)(void)); #if CONFIG_IDF_TARGET_ESP32C6 void (* _regdma_link_set_write_wait_content)(void *, uint32_t, uint32_t); @@ -151,6 +149,8 @@ typedef struct { int (* _sleep_retention_entries_create)(const void *, int, int, int); void (* _sleep_retention_entries_destroy)(int); #endif + int (* _coex_schm_process_restart)(void); + int (* _coex_schm_register_cb)(int, int (* cb)(int)); int32_t _magic; } wifi_osi_funcs_t; diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index 7e1c6ef8bf..adf9880a99 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit 7e1c6ef8bff1d666b2a150110367abdf646ffafc +Subproject commit adf9880a99c6fba80a5f0d376f17de5c91151ff3 diff --git a/components/esp_wifi/linker.lf b/components/esp_wifi/linker.lf index 4e5c3403d5..99c7a0482e 100644 --- a/components/esp_wifi/linker.lf +++ b/components/esp_wifi/linker.lf @@ -135,12 +135,6 @@ entries: if ESP_WIFI_RX_IRAM_OPT || ESP_WIFI_SLP_IRAM_OPT: * (wifi_slp_rx_iram) -[mapping:coexist] -archive: libcoexist.a -entries: - if ESP_WIFI_SLP_IRAM_OPT = y: - * (wifi_slp_iram) - [mapping:esp_wifi] archive: libesp_wifi.a entries: diff --git a/components/esp_wifi/sdkconfig.rename b/components/esp_wifi/sdkconfig.rename index 13c24f78ef..d6c1642ce2 100644 --- a/components/esp_wifi/sdkconfig.rename +++ b/components/esp_wifi/sdkconfig.rename @@ -1,13 +1,8 @@ # sdkconfig replacement configurations for deprecated options formatted as # CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION -CONFIG_SW_COEXIST_ENABLE CONFIG_ESP_WIFI_SW_COEXIST_ENABLE -CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE CONFIG_ESP_WIFI_SW_COEXIST_ENABLE -CONFIG_EXTERNAL_COEX_ENABLE CONFIG_ESP_WIFI_EXTERNAL_COEXIST_ENABLE - # renaming of esp_wifi kconfig options CONFIG_ESP32_WIFI_ENABLED CONFIG_ESP_WIFI_ENABLED -CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE CONFIG_ESP_WIFI_SW_COEXIST_ENABLE CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM CONFIG_ESP32_WIFI_RX_BA_WIN CONFIG_ESP_WIFI_RX_BA_WIN CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED CONFIG_ESP_WIFI_AMPDU_RX_ENABLED diff --git a/components/esp_wifi/test_md5/test_md5.sh b/components/esp_wifi/test_md5/test_md5.sh index aff6cbcf6f..28e85b3a8f 100755 --- a/components/esp_wifi/test_md5/test_md5.sh +++ b/components/esp_wifi/test_md5/test_md5.sh @@ -44,7 +44,6 @@ ${PREFIX}ld --unresolved-symbols=ignore-all --entry 0 -o ${ELF_FILE} \ -u g_wifi_type_md5 \ -u g_wifi_he_type_md5 \ -u g_wifi_osi_funcs_md5 \ - -u g_coex_adapter_funcs_md5 \ -u g_wifi_supplicant_funcs_md5 \ ${IDF_PATH}/components/esp_wifi/lib/${LIB_DIR}/*.a @@ -75,7 +74,6 @@ check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_private/wifi_os_adapter.h check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_crypto_types.h g_wifi_crypto_funcs_md5 check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_types.h g_wifi_type_md5 check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_he_types.h g_wifi_he_type_md5 -check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_coexist_adapter.h g_coex_adapter_funcs_md5 check_md5 ${IDF_PATH}/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h g_wifi_supplicant_funcs_md5 if [ $FAILURES -gt 0 ]; then diff --git a/docs/en/api-guides/coexist.rst b/docs/en/api-guides/coexist.rst index 0f6bdb2e65..e560f48e75 100644 --- a/docs/en/api-guides/coexist.rst +++ b/docs/en/api-guides/coexist.rst @@ -194,7 +194,7 @@ Setting Coexistence Compile-time Options .. list:: - - After writing the coexistence program, you must check :ref:`CONFIG_ESP_WIFI_SW_COEXIST_ENABLE` option through menuconfig to open coexistence configuration on software, otherwise the coexistence function mentioned above cannot be used. + - After writing the coexistence program, you must check :ref:`CONFIG_ESP_COEX_SW_COEXIST_ENABLE` option through menuconfig to open coexistence configuration on software, otherwise the coexistence function mentioned above cannot be used. :esp32: - To ensure better communication performance of Wi-Fi and Bluetooth in the case of coexistence, run the task of the Wi-Fi protocol stack, the task of the Bluetooth Controller and Host protocol stack on different CPUs. You can use :ref:`CONFIG_BTDM_CTRL_PINNED_TO_CORE_CHOICE` and :ref:`CONFIG_BT_BLUEDROID_PINNED_TO_CORE_CHOICE` (or :ref:`CONFIG_BT_NIMBLE_PINNED_TO_CORE_CHOICE`) to put the tasks of the Bluetooth controller and the host protocol stack on the same CPU, and then use :ref:`CONFIG_ESP_WIFI_TASK_CORE_ID` to place the task of the Wi-Fi protocol stack on another CPU. diff --git a/docs/zh_CN/api-guides/coexist.rst b/docs/zh_CN/api-guides/coexist.rst index c3738054ac..74e6fc88e7 100644 --- a/docs/zh_CN/api-guides/coexist.rst +++ b/docs/zh_CN/api-guides/coexist.rst @@ -194,7 +194,7 @@ BLE MESH 共存状态描述 .. list:: - - 在完成共存程序编写的时候,您必须通过 menuconfig 选择 :ref:`CONFIG_ESP_WIFI_SW_COEXIST_ENABLE` 打开软件共存配置选项,否则就无法使用上文中提到的共存功能。 + - 在完成共存程序编写的时候,您必须通过 menuconfig 选择 :ref:`CONFIG_ESP_COEX_SW_COEXIST_ENABLE` 打开软件共存配置选项,否则就无法使用上文中提到的共存功能。 :esp32: - 为了在共存情况下获得更好的 Wi-Fi 和蓝牙的通信性能,建议将 Wi-Fi 协议栈的 task 和蓝牙 Controller 以及 Host 协议栈的 task 运行在不同的 CPU 上。您可以通过 :ref:`CONFIG_BTDM_CTRL_PINNED_TO_CORE_CHOICE` 和 :ref:`CONFIG_BT_BLUEDROID_PINNED_TO_CORE_CHOICE` (或者 :ref:`CONFIG_BT_NIMBLE_PINNED_TO_CORE_CHOICE` )选择将蓝牙 controller 以及 host 协议栈的 task 放在同一个 CPU 上,再通过 :ref:`CONFIG_ESP_WIFI_TASK_CORE_ID` 选择将 Wi-Fi 协议栈 task 放在另一个 CPU 上。 diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index 024e6b9eb6..b2a06e8e5a 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -98,6 +98,8 @@ components/esp_hw_support/include/esp_private/esp_memprot_internal.h ### Here are the files that use CONFIG_XXX values but don't include sdkconfig.h # components/esp_wifi/include/esp_private/wifi_os_adapter.h +components/esp_coex/include/esp_coexist_adapter.h +components/esp_coex/include/esp_coex_i154.h ### To be fixed: headers that rely on implicit inclusion # components/esp_rom/include/esp32/rom/rtc.h @@ -118,11 +120,9 @@ components/esp_rom/include/esp32s2/rom/opi_flash.h components/esp_rom/include/esp32s2/rom/efuse.h components/esp_ringbuf/include/freertos/ringbuf.h components/esp_wifi/include/esp_wifi_crypto_types.h -components/esp_wifi/include/esp_coexist_internal.h components/esp_wifi/include/esp_wifi_netif.h components/esp_wifi/include/smartconfig_ack.h components/esp_wifi/include/esp_wifi_default.h -components/esp_wifi/include/esp_coexist_adapter.h components/esp_event/include/esp_event_base.h components/esp_netif/include/esp_netif_sta_list.h components/esp_netif/include/esp_netif_defaults.h diff --git a/tools/ci/executable-list.txt b/tools/ci/executable-list.txt index 495a212209..051f3b2138 100644 --- a/tools/ci/executable-list.txt +++ b/tools/ci/executable-list.txt @@ -1,6 +1,7 @@ components/app_update/otatool.py components/efuse/efuse_table_gen.py components/efuse/test_efuse_host/efuse_tests.py +components/esp_coex/test_md5/test_md5.sh components/esp_wifi/test_md5/test_md5.sh components/espcoredump/espcoredump.py components/espcoredump/test/test_espcoredump.py