esp_wifi: move coex part from esp_wifi to esp_coex

This commit is contained in:
liuning 2022-12-14 17:10:54 +08:00 committed by BOT
parent 103772df94
commit 38316b38b5
33 changed files with 1006 additions and 659 deletions

View File

@ -77,13 +77,18 @@ test_check_kconfigs:
check_blobs: check_blobs:
extends: .pre_check_template extends: .pre_check_template
variables: 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: script:
# Check if Wi-Fi library header files match between IDF and the version used when compiling the libraries # 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=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=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=esp32s3 $IDF_PATH/components/esp_wifi/test_md5/test_md5.sh
- IDF_TARGET=esp32c3 $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 # Check if Wi-Fi, PHY, BT blobs contain references to specific symbols
- bash $IDF_PATH/tools/ci/check_blobs.sh - bash $IDF_PATH/tools/ci/check_blobs.sh

View File

@ -183,6 +183,7 @@
- "components/cmock/CMock" - "components/cmock/CMock"
- "components/esp_phy/lib" - "components/esp_phy/lib"
- "components/esp_wifi/lib" - "components/esp_wifi/lib"
- "components/esp_coex/lib"
- "components/ieee802154/lib" - "components/ieee802154/lib"
- "components/json/cJSON" - "components/json/cJSON"
- "components/lwip/lwip" - "components/lwip/lwip"

4
.gitmodules vendored
View File

@ -86,3 +86,7 @@
[submodule "components/heap/tlsf"] [submodule "components/heap/tlsf"]
path = components/heap/tlsf path = components/heap/tlsf
url = ../../espressif/tlsf.git url = ../../espressif/tlsf.git
[submodule "components/esp_coex/lib"]
path = components/esp_coex/lib
url = ../../espressif/esp-coex-lib.git

View File

@ -691,7 +691,7 @@ endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}" INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}"
REQUIRES esp_timer esp_wifi REQUIRES esp_timer esp_wifi esp_coex
PRIV_REQUIRES nvs_flash soc esp_pm esp_phy mbedtls driver vfs PRIV_REQUIRES nvs_flash soc esp_pm esp_phy mbedtls driver vfs
LDFRAGMENTS "linker.lf") LDFRAGMENTS "linker.lf")

View File

@ -0,0 +1,46 @@
idf_build_get_property(idf_target IDF_TARGET)
if(CONFIG_SW_COEXIST_ENABLE OR CONFIG_EXTERNAL_COEX_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_ESP32_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
LDFRAGMENTS "${ldfragments}")
if(CONFIG_SW_COEXIST_ENABLE OR CONFIG_EXTERNAL_COEX_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(blobs coexist)
foreach(blob ${blobs})
add_prebuilt_library(${blob} "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}/lib${blob}.a"
REQUIRES ${COMPONENT_NAME})
set(blob_reqs ${blobs})
list(REMOVE_ITEM blob_reqs ${blob}) # remove itself from requirements
set_property(TARGET ${blob} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${blob_reqs})
target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob})
endforeach()
endif()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
endif()

View File

@ -0,0 +1,29 @@
menu "ESP-COEX"
visible if !IDF_TARGET_ESP32H4
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_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.
endmenu # Wi-Fi

View File

@ -0,0 +1,196 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#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;
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;
}
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;
}
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);
}
}
void IRAM_ATTR task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
}
void *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
}
void 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);
}
}
int32_t IRAM_ATTR internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreTakeFromISR(((modem_static_queue_t *)semphr)->handle, hptw);
}
int32_t IRAM_ATTR internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreGiveFromISR(((modem_static_queue_t *)semphr)->handle, hptw);
}
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(((modem_static_queue_t *)semphr)->handle, portMAX_DELAY);
} else {
return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, block_time_tick);
}
}
int32_t internal_semphr_give_wrapper(void *semphr)
{
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
}
void IRAM_ATTR timer_disarm_wrapper(void *timer)
{
ets_timer_disarm(timer);
}
void timer_done_wrapper(void *ptimer)
{
ets_timer_done(ptimer);
}
void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
{
ets_timer_setfn(ptimer, pfunction, parg);
}
void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat)
{
ets_timer_arm_us(ptimer, us, repeat);
}
void * IRAM_ATTR malloc_internal_wrapper(size_t size)
{
return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
}
int IRAM_ATTR coex_is_in_isr_wrapper(void)
{
return !xPortCanYield();
}
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,
._esp_timer_get_time = esp_timer_get_time,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -0,0 +1,131 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#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 env_is_chip_wrapper(void)
{
#ifdef CONFIG_IDF_ENV_FPGA
return false;
#else
return true;
#endif
}
void IRAM_ATTR task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
}
void * semphr_create_wrapper(uint32_t max, uint32_t init)
{
return (void *)xSemaphoreCreateCounting(max, init);
}
void semphr_delete_wrapper(void *semphr)
{
vSemaphoreDelete(semphr);
}
int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreTakeFromISR(semphr, hptw);
}
int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
}
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);
}
}
int32_t semphr_give_wrapper(void *semphr)
{
return (int32_t)xSemaphoreGive(semphr);
}
void IRAM_ATTR timer_disarm_wrapper(void *timer)
{
ets_timer_disarm(timer);
}
void timer_done_wrapper(void *ptimer)
{
ets_timer_done(ptimer);
}
void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
{
ets_timer_setfn(ptimer, pfunction, parg);
}
void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat)
{
ets_timer_arm_us(ptimer, us, repeat);
}
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));
}
void * IRAM_ATTR malloc_internal_wrapper(size_t size)
{
return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
}
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,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -0,0 +1,110 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#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 "esp32c3/rom/ets_sys.h"
#define TAG "esp_coex_adapter"
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
void IRAM_ATTR task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
}
void * semphr_create_wrapper(uint32_t max, uint32_t init)
{
return (void *)xSemaphoreCreateCounting(max, init);
}
void semphr_delete_wrapper(void *semphr)
{
vSemaphoreDelete(semphr);
}
int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreTakeFromISR(semphr, hptw);
}
int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
}
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);
}
}
int32_t semphr_give_wrapper(void *semphr)
{
return (int32_t)xSemaphoreGive(semphr);
}
void IRAM_ATTR timer_disarm_wrapper(void *timer)
{
ets_timer_disarm(timer);
}
void timer_done_wrapper(void *ptimer)
{
ets_timer_done(ptimer);
}
void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
{
ets_timer_setfn(ptimer, pfunction, parg);
}
void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat)
{
ets_timer_arm_us(ptimer, us, repeat);
}
void * IRAM_ATTR malloc_internal_wrapper(size_t size)
{
return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
}
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,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -0,0 +1,160 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#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 "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;
void IRAM_ATTR task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
}
void *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
}
void 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);
}
}
int32_t IRAM_ATTR internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreTakeFromISR(((modem_static_queue_t *)semphr)->handle, hptw);
}
int32_t IRAM_ATTR internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreGiveFromISR(((modem_static_queue_t *)semphr)->handle, hptw);
}
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(((modem_static_queue_t *)semphr)->handle, portMAX_DELAY);
} else {
return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, block_time_tick);
}
}
int32_t internal_semphr_give_wrapper(void *semphr)
{
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
}
void IRAM_ATTR timer_disarm_wrapper(void *timer)
{
ets_timer_disarm(timer);
}
void timer_done_wrapper(void *ptimer)
{
ets_timer_done(ptimer);
}
void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
{
ets_timer_setfn(ptimer, pfunction, parg);
}
void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat)
{
ets_timer_arm_us(ptimer, us, repeat);
}
void * IRAM_ATTR malloc_internal_wrapper(size_t size)
{
return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
}
int IRAM_ATTR coex_is_in_isr_wrapper(void)
{
return !xPortCanYield();
}
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,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -0,0 +1,160 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
#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 "esp32s3/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;
void IRAM_ATTR task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
}
void *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
}
void 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);
}
}
int32_t IRAM_ATTR internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreTakeFromISR(((modem_static_queue_t *)semphr)->handle, hptw);
}
int32_t IRAM_ATTR internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreGiveFromISR(((modem_static_queue_t *)semphr)->handle, hptw);
}
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(((modem_static_queue_t *)semphr)->handle, portMAX_DELAY);
} else {
return (int32_t)xSemaphoreTake(((modem_static_queue_t *)semphr)->handle, block_time_tick);
}
}
int32_t internal_semphr_give_wrapper(void *semphr)
{
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
}
void IRAM_ATTR timer_disarm_wrapper(void *timer)
{
ets_timer_disarm(timer);
}
void timer_done_wrapper(void *ptimer)
{
ets_timer_done(ptimer);
}
void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
{
ets_timer_setfn(ptimer, pfunction, parg);
}
void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat)
{
ets_timer_arm_us(ptimer, us, repeat);
}
void * IRAM_ATTR malloc_internal_wrapper(size_t size)
{
return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
}
int IRAM_ATTR coex_is_in_isr_wrapper(void)
{
return !xPortCanYield();
}
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,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -0,0 +1,78 @@
/*
* 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 <string.h>
#include <stdint.h>
#include <stdbool.h>
#ifdef CONFIG_IDF_TARGET_ESP32
void * spin_lock_create_wrapper(void);
uint32_t wifi_int_disable_wrapper(void *wifi_int_mux);
void wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp);
#endif
void task_yield_from_isr_wrapper(void);
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
void *internal_semphr_create_wrapper(uint32_t max, uint32_t init);
void internal_semphr_delete_wrapper(void *semphr);
int32_t internal_semphr_take_from_isr_wrapper(void *semphr, void *hptw);
int32_t internal_semphr_give_from_isr_wrapper(void *semphr, void *hptw);
int32_t internal_semphr_take_wrapper(void *semphr, uint32_t block_time_tick);
int32_t internal_semphr_give_wrapper(void *semphr);
#else
void * semphr_create_wrapper(uint32_t max, uint32_t init);
void semphr_delete_wrapper(void *semphr);
int32_t semphr_take_from_isr_wrapper(void *semphr, void *hptw);
int32_t semphr_give_from_isr_wrapper(void *semphr, void *hptw);
int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick);
int32_t semphr_give_wrapper(void *semphr);
#endif
void timer_disarm_wrapper(void *timer);
void timer_done_wrapper(void *ptimer);
void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg);
void timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat);
void * malloc_internal_wrapper(size_t size);
#if CONFIG_IDF_TARGET_ESP32C2
bool env_is_chip_wrapper(void);
uint32_t esp_clk_slowclk_cal_get_wrapper(void);
#endif
#ifdef __cplusplus
}
#endif
#endif

@ -0,0 +1 @@
Subproject commit 22df5f006409c215a6856c954eb3d32d19ec8fdc

View File

@ -0,0 +1,5 @@
[mapping:coexist]
archive: libcoexist.a
entries:
if ESP_WIFI_SLP_IRAM_OPT = y:
* (wifi_slp_iram)

View File

@ -0,0 +1,66 @@
#!/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-
;;
esp32c3)
PREFIX=riscv32-esp-elf-
;;
*)
echo "Invalid IDF_TARGET value: \"${IDF_TARGET}\""
exit 1
;;
esac
LIB_DIR=${IDF_TARGET}
ELF_FILE=test.elf
${PREFIX}ld --unresolved-symbols=ignore-all --entry 0 -o ${ELF_FILE} \
-u g_coex_adapter_funcs_md5 \
${IDF_PATH}/components/esp_coex/lib/${LIB_DIR}/*.a
FAILURES=0
function check_md5()
{
FILENAME=$1
SYMBOL=$2
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 [ $FAILURES -gt 0 ]; then
exit 1
fi

View File

@ -25,7 +25,6 @@
#include "endian.h" #include "endian.h"
#include "esp_private/phy.h" #include "esp_private/phy.h"
#include "phy_init_data.h" #include "phy_init_data.h"
#include "esp_coexist_internal.h"
#include "esp_private/periph_ctrl.h" #include "esp_private/periph_ctrl.h"
#include "esp_private/wifi.h" #include "esp_private/wifi.h"
#include "esp_rom_crc.h" #include "esp_rom_crc.h"

View File

@ -121,7 +121,7 @@ if(CONFIG_VFS_SUPPORT_IO)
endif() endif()
if(CONFIG_SW_COEXIST_ENABLE OR CONFIG_EXTERNAL_COEX_ENABLE) 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() endif()
if(NOT BOOTLOADER_BUILD) if(NOT BOOTLOADER_BUILD)

View File

@ -17,7 +17,6 @@ if(CONFIG_ESP_WIFI_ENABLED)
endif() endif()
set(srcs set(srcs
"src/coexist.c"
"src/mesh_event.c" "src/mesh_event.c"
"src/smartconfig.c" "src/smartconfig.c"
"src/wifi_init.c" "src/wifi_init.c"
@ -36,7 +35,7 @@ idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include" INCLUDE_DIRS "include"
REQUIRES esp_event esp_phy esp_netif REQUIRES esp_event esp_phy esp_netif
PRIV_REQUIRES driver esptool_py esp_pm esp_timer nvs_flash 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}") LDFRAGMENTS "${ldfragments}")
if(CONFIG_ESP_WIFI_ENABLED) if(CONFIG_ESP_WIFI_ENABLED)
@ -47,9 +46,9 @@ if(CONFIG_ESP_WIFI_ENABLED)
if(link_binary_libs) if(link_binary_libs)
if(CONFIG_IDF_TARGET_ESP32C2) if(CONFIG_IDF_TARGET_ESP32C2)
set(blobs coexist core espnow net80211 pp smartconfig) set(blobs core espnow net80211 pp smartconfig)
else() else()
set(blobs coexist core espnow mesh net80211 pp smartconfig wapi) set(blobs core espnow mesh net80211 pp smartconfig wapi)
endif() endif()
foreach(blob ${blobs}) foreach(blob ${blobs})

View File

@ -6,18 +6,6 @@ menu "Wi-Fi"
bool bool
default y if SOC_WIFI_SUPPORTED 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 config ESP_WIFI_STATIC_RX_BUFFER_NUM
int "Max number of WiFi static RX buffers" int "Max number of WiFi static RX buffers"
range 2 25 if !SOC_WIFI_HE_SUPPORT 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. 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. 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 config ESP_WIFI_GCMP_SUPPORT
bool "WiFi GCMP Support(GCMP128 and GCMP256)" bool "WiFi GCMP Support(GCMP128 and GCMP256)"
default n default n

View File

@ -40,10 +40,10 @@
#include "os.h" #include "os.h"
#include "esp_smartconfig.h" #include "esp_smartconfig.h"
#include "esp_coexist_internal.h" #include "esp_coexist_internal.h"
#include "esp_coexist_adapter.h"
#include "dport_access.h" #include "dport_access.h"
#include "esp_rom_sys.h" #include "esp_rom_sys.h"
#include "esp32/rom/ets_sys.h" #include "esp32/rom/ets_sys.h"
#include "esp_modem_wrapper.h"
#define TAG "esp_adapter" #define TAG "esp_adapter"
@ -196,48 +196,11 @@ static void set_isr_wrapper(int32_t n, void *f, void *arg)
xt_set_interrupt_handler(n, (xt_handler)f, 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) static bool IRAM_ATTR is_from_isr_wrapper(void)
{ {
return !xPortCanYield(); 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) static void * semphr_create_wrapper(uint32_t max, uint32_t init)
{ {
return (void *)xSemaphoreCreateCounting(max, init); return (void *)xSemaphoreCreateCounting(max, init);
@ -297,82 +260,6 @@ static int32_t semphr_give_wrapper(void *semphr)
return (int32_t)xSemaphoreGive(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) static void * recursive_mutex_create_wrapper(void)
{ {
return (void *)xSemaphoreCreateRecursiveMutex(); return (void *)xSemaphoreCreateRecursiveMutex();
@ -493,26 +380,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat
ets_timer_arm(timer, tmout, 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) static void wifi_reset_mac_wrapper(void)
{ {
periph_module_reset(PERIPH_WIFI_MODULE); periph_module_reset(PERIPH_WIFI_MODULE);
@ -533,11 +400,6 @@ static int get_time_wrapper(void *t)
return os_get_time(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) 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); return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
@ -725,11 +587,6 @@ 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 = { wifi_osi_funcs_t g_wifi_osi_funcs = {
._version = ESP_WIFI_OS_ADAPTER_VERSION, ._version = ESP_WIFI_OS_ADAPTER_VERSION,
._env_is_chip = env_is_chip_wrapper, ._env_is_chip = env_is_chip_wrapper,
@ -850,27 +707,3 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC, ._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,
._esp_timer_get_time = esp_timer_get_time,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -41,8 +41,8 @@
#include "os.h" #include "os.h"
#include "esp_smartconfig.h" #include "esp_smartconfig.h"
#include "esp_coexist_internal.h" #include "esp_coexist_internal.h"
#include "esp_coexist_adapter.h"
#include "esp32c2/rom/ets_sys.h" #include "esp32c2/rom/ets_sys.h"
#include "esp_modem_wrapper.h"
#define TAG "esp_adapter" #define TAG "esp_adapter"
@ -103,15 +103,6 @@ static void wifi_delete_queue_wrapper(void *queue)
wifi_delete_queue(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) 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); intr_matrix_route(intr_source, intr_num);
@ -176,21 +167,6 @@ static bool IRAM_ATTR is_from_isr_wrapper(void)
return !xPortCanYield(); 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) static void wifi_thread_semphr_free(void* data)
{ {
SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data); SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data);
@ -226,30 +202,6 @@ static void * wifi_thread_semphr_get_wrapper(void)
return (void*)sem; 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) static void * recursive_mutex_create_wrapper(void)
{ {
return (void *)xSemaphoreCreateRecursiveMutex(); return (void *)xSemaphoreCreateRecursiveMutex();
@ -370,26 +322,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat
ets_timer_arm(timer, tmout, 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) static void wifi_reset_mac_wrapper(void)
{ {
periph_module_reset(PERIPH_WIFI_MODULE); periph_module_reset(PERIPH_WIFI_MODULE);
@ -424,19 +356,6 @@ static int get_time_wrapper(void *t)
return os_get_time(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) 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); return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
@ -770,25 +689,3 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC, ._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,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -42,8 +42,8 @@
#include "os.h" #include "os.h"
#include "esp_smartconfig.h" #include "esp_smartconfig.h"
#include "esp_coexist_internal.h" #include "esp_coexist_internal.h"
#include "esp_coexist_adapter.h"
#include "esp32c3/rom/ets_sys.h" #include "esp32c3/rom/ets_sys.h"
#include "esp_modem_wrapper.h"
#define TAG "esp_adapter" #define TAG "esp_adapter"
@ -179,21 +179,6 @@ static bool IRAM_ATTR is_from_isr_wrapper(void)
return !xPortCanYield(); 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) static void wifi_thread_semphr_free(void* data)
{ {
SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data); SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data);
@ -229,30 +214,6 @@ static void * wifi_thread_semphr_get_wrapper(void)
return (void*)sem; 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) static void * recursive_mutex_create_wrapper(void)
{ {
return (void *)xSemaphoreCreateRecursiveMutex(); return (void *)xSemaphoreCreateRecursiveMutex();
@ -373,26 +334,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat
ets_timer_arm(timer, tmout, 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) static void wifi_reset_mac_wrapper(void)
{ {
periph_module_reset(PERIPH_WIFI_MODULE); periph_module_reset(PERIPH_WIFI_MODULE);
@ -440,11 +381,6 @@ static uint32_t esp_clk_slowclk_cal_get_wrapper(void)
} }
} }
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) 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); return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
@ -778,23 +714,3 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC, ._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,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -42,9 +42,9 @@
#include "os.h" #include "os.h"
#include "esp_smartconfig.h" #include "esp_smartconfig.h"
#include "esp_coexist_internal.h" #include "esp_coexist_internal.h"
#include "esp_coexist_adapter.h"
#include "esp_rom_sys.h" #include "esp_rom_sys.h"
#include "esp32s2/rom/ets_sys.h" #include "esp32s2/rom/ets_sys.h"
#include "esp_modem_wrapper.h"
#define TAG "esp_adapter" #define TAG "esp_adapter"
@ -224,11 +224,6 @@ static bool IRAM_ATTR is_from_isr_wrapper(void)
return !xPortCanYield(); 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) static void * semphr_create_wrapper(uint32_t max, uint32_t init)
{ {
return (void *)xSemaphoreCreateCounting(max, init); return (void *)xSemaphoreCreateCounting(max, init);
@ -288,80 +283,6 @@ static int32_t semphr_give_wrapper(void *semphr)
return (int32_t)xSemaphoreGive(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) static void * recursive_mutex_create_wrapper(void)
{ {
return (void *)xSemaphoreCreateRecursiveMutex(); return (void *)xSemaphoreCreateRecursiveMutex();
@ -482,26 +403,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat
ets_timer_arm(timer, tmout, 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) static void wifi_reset_mac_wrapper(void)
{ {
periph_module_reset(PERIPH_WIFI_MODULE); periph_module_reset(PERIPH_WIFI_MODULE);
@ -530,11 +431,6 @@ static uint32_t esp_clk_slowclk_cal_get_wrapper(void)
return (esp_clk_slowclk_cal_get() >> (RTC_CLK_CAL_FRACT - SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH)); 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) 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); return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
@ -726,11 +622,6 @@ 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 = { wifi_osi_funcs_t g_wifi_osi_funcs = {
._version = ESP_WIFI_OS_ADAPTER_VERSION, ._version = ESP_WIFI_OS_ADAPTER_VERSION,
._env_is_chip = env_is_chip_wrapper, ._env_is_chip = env_is_chip_wrapper,
@ -853,23 +744,3 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._magic = ESP_WIFI_OS_ADAPTER_MAGIC, ._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,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -43,9 +43,9 @@
#include "os.h" #include "os.h"
#include "esp_smartconfig.h" #include "esp_smartconfig.h"
#include "esp_coexist_internal.h" #include "esp_coexist_internal.h"
#include "esp_coexist_adapter.h"
#include "esp_rom_sys.h" #include "esp_rom_sys.h"
#include "esp32s3/rom/ets_sys.h" #include "esp32s3/rom/ets_sys.h"
#include "esp_modem_wrapper.h"
#define TAG "esp_adapter" #define TAG "esp_adapter"
@ -227,11 +227,6 @@ static bool IRAM_ATTR is_from_isr_wrapper(void)
return !xPortCanYield(); 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) static void * semphr_create_wrapper(uint32_t max, uint32_t init)
{ {
return (void *)xSemaphoreCreateCounting(max, init); return (void *)xSemaphoreCreateCounting(max, init);
@ -291,80 +286,6 @@ static int32_t semphr_give_wrapper(void *semphr)
return (int32_t)xSemaphoreGive(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) static void * recursive_mutex_create_wrapper(void)
{ {
return (void *)xSemaphoreCreateRecursiveMutex(); return (void *)xSemaphoreCreateRecursiveMutex();
@ -485,26 +406,6 @@ static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat
ets_timer_arm(timer, tmout, 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) static void wifi_reset_mac_wrapper(void)
{ {
periph_module_reset(PERIPH_WIFI_MODULE); periph_module_reset(PERIPH_WIFI_MODULE);
@ -552,11 +453,6 @@ static uint32_t esp_clk_slowclk_cal_get_wrapper(void)
} }
} }
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) 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); return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
@ -748,11 +644,6 @@ 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 = { wifi_osi_funcs_t g_wifi_osi_funcs = {
._version = ESP_WIFI_OS_ADAPTER_VERSION, ._version = ESP_WIFI_OS_ADAPTER_VERSION,
._env_is_chip = env_is_chip_wrapper, ._env_is_chip = env_is_chip_wrapper,
@ -872,23 +763,3 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_schm_register_cb = coex_schm_register_cb_wrapper, ._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC, ._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,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._magic = COEX_ADAPTER_MAGIC,
};

View File

@ -135,12 +135,6 @@ entries:
if ESP_WIFI_RX_IRAM_OPT || ESP_WIFI_SLP_IRAM_OPT: if ESP_WIFI_RX_IRAM_OPT || ESP_WIFI_SLP_IRAM_OPT:
* (wifi_slp_rx_iram) * (wifi_slp_rx_iram)
[mapping:coexist]
archive: libcoexist.a
entries:
if ESP_WIFI_SLP_IRAM_OPT = y:
* (wifi_slp_iram)
[mapping:esp_wifi] [mapping:esp_wifi]
archive: libesp_wifi.a archive: libesp_wifi.a
entries: entries:

View File

@ -44,7 +44,6 @@ ${PREFIX}ld --unresolved-symbols=ignore-all --entry 0 -o ${ELF_FILE} \
-u g_wifi_type_md5 \ -u g_wifi_type_md5 \
-u g_wifi_he_type_md5 \ -u g_wifi_he_type_md5 \
-u g_wifi_osi_funcs_md5 \ -u g_wifi_osi_funcs_md5 \
-u g_coex_adapter_funcs_md5 \
-u g_wifi_supplicant_funcs_md5 \ -u g_wifi_supplicant_funcs_md5 \
${IDF_PATH}/components/esp_wifi/lib/${LIB_DIR}/*.a ${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_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_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_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 check_md5 ${IDF_PATH}/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h g_wifi_supplicant_funcs_md5
if [ $FAILURES -gt 0 ]; then if [ $FAILURES -gt 0 ]; then

View File

@ -118,11 +118,11 @@ components/esp_rom/include/esp32s2/rom/opi_flash.h
components/esp_rom/include/esp32s2/rom/efuse.h components/esp_rom/include/esp32s2/rom/efuse.h
components/esp_ringbuf/include/freertos/ringbuf.h components/esp_ringbuf/include/freertos/ringbuf.h
components/esp_wifi/include/esp_wifi_crypto_types.h components/esp_wifi/include/esp_wifi_crypto_types.h
components/esp_wifi/include/esp_coexist_internal.h components/esp_coex/include/esp_coexist_internal.h
components/esp_wifi/include/esp_wifi_netif.h components/esp_wifi/include/esp_wifi_netif.h
components/esp_wifi/include/smartconfig_ack.h components/esp_wifi/include/smartconfig_ack.h
components/esp_wifi/include/esp_wifi_default.h components/esp_wifi/include/esp_wifi_default.h
components/esp_wifi/include/esp_coexist_adapter.h components/esp_coex/include/esp_coexist_adapter.h
components/esp_event/include/esp_event_base.h components/esp_event/include/esp_event_base.h
components/esp_netif/include/esp_netif_sta_list.h components/esp_netif/include/esp_netif_sta_list.h
components/esp_netif/include/esp_netif_defaults.h components/esp_netif/include/esp_netif_defaults.h

View File

@ -1,6 +1,7 @@
components/app_update/otatool.py components/app_update/otatool.py
components/efuse/efuse_table_gen.py components/efuse/efuse_table_gen.py
components/efuse/test_efuse_host/efuse_tests.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/esp_wifi/test_md5/test_md5.sh
components/espcoredump/espcoredump.py components/espcoredump/espcoredump.py
components/espcoredump/test/test_espcoredump.py components/espcoredump/test/test_espcoredump.py