From 87803758593df1e9dd6671a01362fcc98fe71a5f Mon Sep 17 00:00:00 2001 From: xuxiao Date: Tue, 20 Aug 2024 17:39:25 +0800 Subject: [PATCH 1/4] feat(wifi): add wifi support for esp32c61 --- .../esp_coex/esp32c61/esp_coex_adapter.c | 164 +++++ components/esp_phy/CMakeLists.txt | 2 +- .../esp32c61/include/btbb_retention_reg.h | 24 + .../esp_phy/esp32c61/include/phy_init_data.h | 64 ++ components/esp_phy/esp32c61/phy_init_data.c | 147 ++++ .../esp32c61/phy_multiple_init_data.bin | Bin 0 -> 1072 bytes components/esp_phy/lib | 2 +- components/esp_phy/src/phy_init.c | 7 +- components/esp_rom/CMakeLists.txt | 7 + .../esp_rom/esp32c5/ld/esp32c5.rom.pp.ld | 2 +- .../esp32c61/ld/esp32c61.rom.net80211.ld | 2 +- .../esp_rom/esp32c61/ld/esp32c61.rom.phy.ld | 2 + .../esp_rom/esp32c61/ld/esp32c61.rom.pp.ld | 26 +- components/esp_wifi/esp32c61/esp_adapter.c | 688 ++++++++++++++++++ .../esp_private/esp_wifi_he_types_private.h | 6 +- .../include/esp_private/wifi_os_adapter.h | 2 +- .../esp_wifi/include/esp_wifi_he_types.h | 4 +- .../include/local/esp_wifi_types_native.h | 2 +- .../esp_wifi/test_apps/.build-test-rules.yml | 3 + .../esp_wifi/test_apps/wifi_connect/README.md | 4 +- .../test_apps/wifi_function/README.md | 4 +- .../esp32c61/include/soc/Kconfig.soc_caps.in | 36 + .../soc/esp32c61/include/soc/soc_caps.h | 17 +- .../wpa_supplicant/src/utils/includes.h | 2 + components/wpa_supplicant/test_apps/README.md | 4 +- docs/conf_common.py | 3 +- .../low-power-mode/low-power-mode-wifi.rst | 6 +- .../low-power-mode/low-power-mode-wifi.rst | 6 +- .../mesh/internal_communication/README.md | 4 +- examples/mesh/ip_internal_network/README.md | 4 +- examples/mesh/manual_networking/README.md | 4 +- examples/network/eth2ap/README.md | 4 +- examples/network/simple_sniffer/README.md | 4 +- examples/network/sta2eth/README.md | 4 +- examples/openthread/.build-test-rules.yml | 2 +- examples/provisioning/wifi_prov_mgr/README.md | 4 +- examples/wifi/.build-test-rules.yml | 4 + examples/wifi/espnow/README.md | 4 +- examples/wifi/fast_scan/README.md | 4 +- .../wifi/getting_started/softAP/README.md | 4 +- .../wifi/getting_started/station/README.md | 4 +- examples/wifi/iperf/README.md | 4 +- .../wifi/iperf/sdkconfig.defaults.esp32c61 | 42 ++ examples/wifi/itwt/README.md | 4 +- examples/wifi/power_save/README.md | 4 +- examples/wifi/roaming/roaming_11kvr/README.md | 4 +- examples/wifi/roaming/roaming_app/README.md | 4 +- examples/wifi/scan/README.md | 4 +- examples/wifi/smart_config/README.md | 4 +- examples/wifi/softap_sta/README.md | 4 +- examples/wifi/wifi_eap_fast/README.md | 4 +- .../wifi_easy_connect/dpp-enrollee/README.md | 4 +- examples/wifi/wifi_enterprise/README.md | 4 +- examples/wifi/wps/README.md | 4 +- examples/wifi/wps_softap_registrar/README.md | 4 +- examples/zigbee/.build-test-rules.yml | 4 +- .../peripherals/.build-test-rules.yml | 3 + .../test_apps/peripherals/i2c_wifi/README.md | 4 +- tools/test_apps/phy/.build-test-rules.yml | 2 +- .../phy/phy_multi_init_data_test/README.md | 4 +- 60 files changed, 1292 insertions(+), 105 deletions(-) create mode 100644 components/esp_coex/esp32c61/esp_coex_adapter.c create mode 100644 components/esp_phy/esp32c61/include/btbb_retention_reg.h create mode 100644 components/esp_phy/esp32c61/include/phy_init_data.h create mode 100644 components/esp_phy/esp32c61/phy_init_data.c create mode 100644 components/esp_phy/esp32c61/phy_multiple_init_data.bin create mode 100644 components/esp_wifi/esp32c61/esp_adapter.c create mode 100644 examples/wifi/iperf/sdkconfig.defaults.esp32c61 diff --git a/components/esp_coex/esp32c61/esp_coex_adapter.c b/components/esp_coex/esp32c61/esp_coex_adapter.c new file mode 100644 index 000000000000..5d433bb09371 --- /dev/null +++ b/components/esp_coex/esp32c61/esp_coex_adapter.c @@ -0,0 +1,164 @@ +/* + * 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 "private/esp_coexist_adapter.h" +#include "esp32c61/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, + ._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_phy/CMakeLists.txt b/components/esp_phy/CMakeLists.txt index 5509b5b1aac4..6035e3067dd8 100644 --- a/components/esp_phy/CMakeLists.txt +++ b/components/esp_phy/CMakeLists.txt @@ -4,7 +4,7 @@ if(${idf_target} STREQUAL "linux") return() # This component is not supported by the POSIX/Linux simulator endif() -if(IDF_TARGET STREQUAL "esp32p4" OR IDF_TARGET STREQUAL "esp32c61") +if(IDF_TARGET STREQUAL "esp32p4") # TODO: IDF-7460, IDF-8851, IDF-9553 idf_component_register() return() diff --git a/components/esp_phy/esp32c61/include/btbb_retention_reg.h b/components/esp_phy/esp32c61/include/btbb_retention_reg.h new file mode 100644 index 000000000000..fbb399729618 --- /dev/null +++ b/components/esp_phy/esp32c61/include/btbb_retention_reg.h @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +// btbb sleep retention reg + +#define BB_PART_0_SIZE 93 +#define BB_PART_1_SIZE 62 +#define BB_PART_2_SIZE 19 +#define BB_PART_0_ADDR 0x600A2000 +#define BB_PART_1_ADDR 0x600A2800 +#define BB_PART_2_ADDR 0x600A2C00 + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_phy/esp32c61/include/phy_init_data.h b/components/esp_phy/esp32c61/include/phy_init_data.h new file mode 100644 index 000000000000..8a0eb2401683 --- /dev/null +++ b/components/esp_phy/esp32c61/include/phy_init_data.h @@ -0,0 +1,64 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef PHY_INIT_DATA_H +#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ +#include +#include "esp_phy_init.h" +#include "sdkconfig.h" + +#ifdef __cplusplus +extern "C" { +#endif +// constrain a value between 'low' and 'high', inclusive +#define LIMIT(val, low, high) ((val < low) ? low : (val > high) ? high : val) +#define PHY_INIT_MAGIC "PHYINIT" +#define PHY_INIT_MAGIC_LEN 8 // should be strlen(PHY_INIT_MAGIC) + 1 + +// define the lowest tx power as LOWEST_PHY_TX_POWER +#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 52) +#define PHY_TX_POWER_OFFSET 2 +#define PHY_TX_POWER_NUM 14 + +#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN +#define PHY_CRC_ALGORITHM 1 +#define PHY_COUNTRY_CODE_LEN 2 +#define PHY_INIT_DATA_TYPE_OFFSET 254 +#define PHY_SUPPORT_MULTIPLE_BIN_OFFSET 253 +#endif + +extern const char phy_init_magic_pre[]; +extern const esp_phy_init_data_t phy_init_data; +extern const char phy_init_magic_post[]; + +#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN +/** + * @brief PHY init data control information structure + */ +typedef struct { + uint8_t control_info_checksum[4]; /*!< 4-byte control information checksum */ + uint8_t multiple_bin_checksum[4]; /*!< 4-byte multiple bin checksum */ + uint8_t check_algorithm; /*!< check algorithm */ + uint8_t version; /*!< PHY init data bin version */ + uint8_t number; /*!< PHY init data bin number */ + uint8_t length[2]; /*!< Length of each PHY init data bin */ + uint8_t reserved[19]; /*!< 19-byte reserved */ +} __attribute__ ((packed)) phy_control_info_data_t; + +/** + * @brief Country corresponds to PHY init data type structure + */ +typedef struct { + char cc[PHY_COUNTRY_CODE_LEN]; + uint8_t type; +} phy_country_to_bin_type_t; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PHY_INIT_DATA_H */ diff --git a/components/esp_phy/esp32c61/phy_init_data.c b/components/esp_phy/esp32c61/phy_init_data.c new file mode 100644 index 000000000000..9bb8099d8b71 --- /dev/null +++ b/components/esp_phy/esp32c61/phy_init_data.c @@ -0,0 +1,147 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "sdkconfig.h" +#include "phy_init_data.h" + + +const char __attribute__((section(".rodata"))) phy_init_magic_pre[] = PHY_INIT_MAGIC; + +/** + * @brief Structure containing default recommended PHY initialization parameters. + */ +const esp_phy_init_data_t phy_init_data= { { +0x1, + 0x0, + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x34), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x34), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x30), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x30), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x28), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x24), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x24), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x24), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x4c), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x2c), + LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x2c), + 0x0, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0x51 +} }; + +const char __attribute__((section(".rodata"))) phy_init_magic_post[] = PHY_INIT_MAGIC; diff --git a/components/esp_phy/esp32c61/phy_multiple_init_data.bin b/components/esp_phy/esp32c61/phy_multiple_init_data.bin new file mode 100644 index 0000000000000000000000000000000000000000..0f754a2c496b5cf7b712c49b15e83a02082692f4 GIT binary patch literal 1072 zcmWIWi1hUH3}Ikk2nY!9@$vBS@Nn^Rb8}+&PdWe^LLOjbSQY?v$8?!PY};f-av2%e z85*#fhVD*AH)QbN0U6-pVKtbrAR}WeW;ik0_`raTjm>`(4;U~pF+u0KfB;aOuvJ)9 zFfx6`W5oeSoe&_c1ImJiwtrssC9tu-K0r;SRWb w3?s(5*M1#v +#include +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/event_groups.h" +#include "freertos/portmacro.h" +#include "riscv/interrupt.h" +#include "esp_types.h" +#include "esp_random.h" +#include "esp_mac.h" +#include "esp_task.h" +#include "esp_intr_alloc.h" +#include "esp_attr.h" +#include "esp_log.h" +#include "esp_event.h" +#include "esp_heap_caps.h" +#include "esp_timer.h" +#include "esp_private/esp_modem_clock.h" +#include "esp_private/wifi_os_adapter.h" +#include "esp_private/wifi.h" +#ifdef CONFIG_ESP_PHY_ENABLED +#include "esp_phy_init.h" +#include "phy_init_data.h" +#endif +#include "soc/rtc_cntl_periph.h" +#include "soc/rtc.h" +#include "esp_private/periph_ctrl.h" +#include "esp_private/esp_clk.h" +#include "nvs.h" +#include "os.h" +#include "esp_smartconfig.h" +#ifdef CONFIG_ESP_COEX_ENABLED +#include "private/esp_coexist_internal.h" +#endif +#include "esp32c61/rom/ets_sys.h" +#include "private/esp_modem_wrapper.h" +#include "esp_private/esp_modem_clock.h" + +#if SOC_PM_MODEM_RETENTION_BY_REGDMA +#include "esp_private/esp_regdma.h" +#include "esp_private/sleep_retention.h" +#endif + +#define TAG "esp_adapter" + +#ifdef CONFIG_PM_ENABLE +extern void wifi_apb80m_request(void); +extern void wifi_apb80m_release(void); +#endif + +IRAM_ATTR void *wifi_malloc(size_t size) +{ + return malloc(size); +} + +IRAM_ATTR void *wifi_realloc(void *ptr, size_t size) +{ + return realloc(ptr, size); +} + +IRAM_ATTR void *wifi_calloc(size_t n, size_t size) +{ + return calloc(n, size); +} + +static void *IRAM_ATTR wifi_zalloc_wrapper(size_t size) +{ + void *ptr = wifi_calloc(1, size); + return ptr; +} + +wifi_static_queue_t *wifi_create_queue(int queue_len, int item_size) +{ + wifi_static_queue_t *queue = NULL; + + queue = (wifi_static_queue_t *)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); + if (!queue) { + return NULL; + } + + queue->handle = xQueueCreate(queue_len, item_size); + return queue; +} + +void wifi_delete_queue(wifi_static_queue_t *queue) +{ + if (queue) { + vQueueDelete(queue->handle); + free(queue); + } +} + +static void *wifi_create_queue_wrapper(int queue_len, int item_size) +{ + return wifi_create_queue(queue_len, item_size); +} + +static void wifi_delete_queue_wrapper(void *queue) +{ + wifi_delete_queue(queue); +} + +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); + esprv_int_set_priority(intr_num, intr_prio); + esprv_int_set_type(intr_num, INTR_TYPE_LEVEL); +} + +static void clear_intr_wrapper(uint32_t intr_source, uint32_t intr_num) +{ + +} + +static void set_isr_wrapper(int32_t n, void *f, void *arg) +{ + intr_handler_set(n, (intr_handler_t)f, arg); +} + +static void enable_intr_wrapper(uint32_t intr_mask) +{ + esprv_int_enable(intr_mask); +} + +static void disable_intr_wrapper(uint32_t intr_mask) +{ + esprv_int_disable(intr_mask); +} + +static bool IRAM_ATTR is_from_isr_wrapper(void) +{ + return !xPortCanYield(); +} + +static void wifi_thread_semphr_free(void *data) +{ + SemaphoreHandle_t *sem = (SemaphoreHandle_t *)(data); + + if (sem) { + vSemaphoreDelete(sem); + } +} + +static void *wifi_thread_semphr_get_wrapper(void) +{ + static bool s_wifi_thread_sem_key_init = false; + static pthread_key_t s_wifi_thread_sem_key; + SemaphoreHandle_t sem = NULL; + + if (s_wifi_thread_sem_key_init == false) { + if (0 != pthread_key_create(&s_wifi_thread_sem_key, wifi_thread_semphr_free)) { + return NULL; + } + s_wifi_thread_sem_key_init = true; + } + + sem = pthread_getspecific(s_wifi_thread_sem_key); + if (!sem) { + sem = xSemaphoreCreateCounting(1, 0); + if (sem) { + pthread_setspecific(s_wifi_thread_sem_key, sem); + ESP_LOGV(TAG, "thread sem create: sem=%p", sem); + } + } + + ESP_LOGV(TAG, "thread sem get: sem=%p", sem); + return (void *)sem; +} + +static void *recursive_mutex_create_wrapper(void) +{ + return (void *)xSemaphoreCreateRecursiveMutex(); +} + +static void *mutex_create_wrapper(void) +{ + return (void *)xSemaphoreCreateMutex(); +} + +static void mutex_delete_wrapper(void *mutex) +{ + vSemaphoreDelete(mutex); +} + +static int32_t IRAM_ATTR mutex_lock_wrapper(void *mutex) +{ + return (int32_t)xSemaphoreTakeRecursive(mutex, portMAX_DELAY); +} + +static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex) +{ + return (int32_t)xSemaphoreGiveRecursive(mutex); +} + +static void *queue_create_wrapper(uint32_t queue_len, uint32_t item_size) +{ + return (void *)xQueueCreate(queue_len, item_size); +} + +static int32_t queue_send_wrapper(void *queue, void *item, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xQueueSend(queue, item, portMAX_DELAY); + } else { + return (int32_t)xQueueSend(queue, item, block_time_tick); + } +} + +static int32_t IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw) +{ + return (int32_t)xQueueSendFromISR(queue, item, hptw); +} + +static int32_t queue_send_to_back_wrapper(void *queue, void *item, uint32_t block_time_tick) +{ + return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_BACK); +} + +static int32_t queue_send_to_front_wrapper(void *queue, void *item, uint32_t block_time_tick) +{ + return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_FRONT); +} + +static int32_t queue_recv_wrapper(void *queue, void *item, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xQueueReceive(queue, item, portMAX_DELAY); + } else { + return (int32_t)xQueueReceive(queue, item, block_time_tick); + } +} + +static uint32_t event_group_wait_bits_wrapper(void *event, uint32_t bits_to_wait_for, int clear_on_exit, int wait_for_all_bits, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, portMAX_DELAY); + } else { + return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, block_time_tick); + } +} + +static int32_t task_create_pinned_to_core_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id) +{ + return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY)); +} + +static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle) +{ + return (uint32_t)xTaskCreate(task_func, name, stack_depth, param, prio, task_handle); +} + +static int32_t IRAM_ATTR task_ms_to_tick_wrapper(uint32_t ms) +{ + return (int32_t)(ms / portTICK_PERIOD_MS); +} + +static int32_t task_get_max_priority_wrapper(void) +{ + return (int32_t)(configMAX_PRIORITIES); +} + +static int32_t esp_event_post_wrapper(const char *event_base, int32_t event_id, void *event_data, size_t event_data_size, uint32_t ticks_to_wait) +{ + if (ticks_to_wait == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)esp_event_post(event_base, event_id, event_data, event_data_size, portMAX_DELAY); + } else { + return (int32_t)esp_event_post(event_base, event_id, event_data, event_data_size, ticks_to_wait); + } +} + +static void IRAM_ATTR wifi_apb80m_request_wrapper(void) +{ +#ifdef CONFIG_PM_ENABLE + wifi_apb80m_request(); +#endif +} + +static void IRAM_ATTR wifi_apb80m_release_wrapper(void) +{ +#ifdef CONFIG_PM_ENABLE + wifi_apb80m_release(); +#endif +} + +static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat) +{ + ets_timer_arm(timer, tmout, repeat); +} + +static void wifi_reset_mac_wrapper(void) +{ + modem_clock_module_mac_reset(PERIPH_WIFI_MODULE); +} + +static void wifi_clock_enable_wrapper(void) +{ + wifi_module_enable(); +} + +static void wifi_clock_disable_wrapper(void) +{ + wifi_module_disable(); +} + +static int get_time_wrapper(void *t) +{ + return os_get_time(t); +} + +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); +} + +static void *IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size) +{ + return heap_caps_calloc(n, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL); +} + +static void *IRAM_ATTR zalloc_internal_wrapper(size_t size) +{ + void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL); + return ptr; +} + +static esp_err_t nvs_open_wrapper(const char *name, unsigned int open_mode, nvs_handle_t *out_handle) +{ + return nvs_open(name, (nvs_open_mode_t)open_mode, out_handle); +} + +static void esp_log_writev_wrapper(unsigned int level, const char *tag, const char *format, va_list args) +{ + return esp_log_writev((esp_log_level_t)level, tag, format, args); +} + +static void esp_log_write_wrapper(unsigned int level, const char *tag, const char *format, ...) +{ + va_list list; + va_start(list, format); + esp_log_writev((esp_log_level_t)level, tag, format, list); + va_end(list); +} + +static esp_err_t esp_read_mac_wrapper(uint8_t *mac, unsigned int type) +{ + return esp_read_mac(mac, (esp_mac_type_t)type); +} + +static int coex_init_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_init(); +#else + return 0; +#endif +} + +static void coex_deinit_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + coex_deinit(); +#endif +} + +static int coex_enable_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_enable(); +#else + return 0; +#endif +} + +static void coex_disable_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + coex_disable(); +#endif +} + +static IRAM_ATTR uint32_t coex_status_get_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_status_get(); +#else + return 0; +#endif +} + +static int coex_wifi_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_wifi_request(event, latency, duration); +#else + return 0; +#endif +} + +static IRAM_ATTR int coex_wifi_release_wrapper(uint32_t event) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_wifi_release(event); +#else + return 0; +#endif +} + +static int coex_wifi_channel_set_wrapper(uint8_t primary, uint8_t secondary) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_wifi_channel_set(primary, secondary); +#else + return 0; +#endif +} + +static IRAM_ATTR int coex_event_duration_get_wrapper(uint32_t event, uint32_t *duration) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_event_duration_get(event, duration); +#else + return 0; +#endif +} + +static int coex_pti_get_wrapper(uint32_t event, uint8_t *pti) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_pti_get(event, pti); +#else + return 0; +#endif +} + +static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + coex_schm_status_bit_clear(type, status); +#endif +} + +static void coex_schm_status_bit_set_wrapper(uint32_t type, uint32_t status) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + coex_schm_status_bit_set(type, status); +#endif +} + +static IRAM_ATTR int coex_schm_interval_set_wrapper(uint32_t interval) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_schm_interval_set(interval); +#else + return 0; +#endif +} + +static uint32_t coex_schm_interval_get_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_schm_interval_get(); +#else + return 0; +#endif +} + +static uint8_t coex_schm_curr_period_get_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_schm_curr_period_get(); +#else + return 0; +#endif +} + +static void *coex_schm_curr_phase_get_wrapper(void) +{ +#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE + return coex_schm_curr_phase_get(); +#else + return NULL; +#endif +} + +static int coex_register_start_cb_wrapper(int (* cb)(void)) +{ +#if CONFIG_SW_COEXIST_ENABLE + return coex_register_start_cb(cb); +#else + return 0; +#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 int coex_schm_flexible_period_set_wrapper(uint8_t period) +{ +#if CONFIG_ESP_COEX_POWER_MANAGEMENT + return coex_schm_flexible_period_set(period); +#else + return 0; +#endif +} + +static uint8_t coex_schm_flexible_period_get_wrapper(void) +{ +#if CONFIG_ESP_COEX_POWER_MANAGEMENT + return coex_schm_flexible_period_get(); +#else + return 1; +#endif +} + +static void IRAM_ATTR esp_empty_wrapper(void) +{ + +} + +extern void set_bb_wdg(bool busy_chk, bool srch_chk, uint16_t max_busy, uint16_t max_srch, bool rst_en, bool int_en, bool clr); + +static void esp_phy_enable_wrapper(void) +{ + esp_phy_enable(PHY_MODEM_WIFI); + phy_wifi_enable_set(1); + //disable bb idle check(max: 139ms) for temporary to avoid unexpected RXTXPANIC + //TODO + set_bb_wdg(true, false, 0x18, 0xaa, false, false, false); +} + +static void esp_phy_disable_wrapper(void) +{ + phy_wifi_enable_set(0); + esp_phy_disable(PHY_MODEM_WIFI); +} + +wifi_osi_funcs_t g_wifi_osi_funcs = { + ._version = ESP_WIFI_OS_ADAPTER_VERSION, + ._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 = esp_coex_common_spin_lock_create_wrapper, + ._spin_lock_delete = free, + ._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, + ._mutex_delete = mutex_delete_wrapper, + ._mutex_lock = mutex_lock_wrapper, + ._mutex_unlock = mutex_unlock_wrapper, + ._queue_create = queue_create_wrapper, + ._queue_delete = (void(*)(void *))vQueueDelete, + ._queue_send = queue_send_wrapper, + ._queue_send_from_isr = queue_send_from_isr_wrapper, + ._queue_send_to_back = queue_send_to_back_wrapper, + ._queue_send_to_front = queue_send_to_front_wrapper, + ._queue_recv = queue_recv_wrapper, + ._queue_msg_waiting = (uint32_t(*)(void *))uxQueueMessagesWaiting, + ._event_group_create = (void *(*)(void))xEventGroupCreate, + ._event_group_delete = (void(*)(void *))vEventGroupDelete, + ._event_group_set_bits = (uint32_t(*)(void *, uint32_t))xEventGroupSetBits, + ._event_group_clear_bits = (uint32_t(*)(void *, uint32_t))xEventGroupClearBits, + ._event_group_wait_bits = event_group_wait_bits_wrapper, + ._task_create_pinned_to_core = task_create_pinned_to_core_wrapper, + ._task_create = task_create_wrapper, + ._task_delete = (void(*)(void *))vTaskDelete, + ._task_delay = vTaskDelay, + ._task_ms_to_tick = task_ms_to_tick_wrapper, + ._task_get_current_task = (void *(*)(void))xTaskGetCurrentTaskHandle, + ._task_get_max_priority = task_get_max_priority_wrapper, + ._malloc = malloc, + ._free = free, + ._event_post = esp_event_post_wrapper, + ._get_free_heap_size = esp_get_free_internal_heap_size, + ._rand = esp_random, + ._dport_access_stall_other_cpu_start_wrap = esp_empty_wrapper, + ._dport_access_stall_other_cpu_end_wrap = esp_empty_wrapper, + ._wifi_apb80m_request = wifi_apb80m_request_wrapper, + ._wifi_apb80m_release = wifi_apb80m_release_wrapper, + ._phy_disable = esp_phy_disable_wrapper, + ._phy_enable = esp_phy_enable_wrapper, + ._phy_update_country_info = esp_phy_update_country_info, + ._read_mac = esp_read_mac_wrapper, + ._timer_arm = timer_arm_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, + ._wifi_rtc_enable_iso = esp_empty_wrapper, + ._wifi_rtc_disable_iso = esp_empty_wrapper, + ._esp_timer_get_time = esp_timer_get_time, + ._nvs_set_i8 = nvs_set_i8, + ._nvs_get_i8 = nvs_get_i8, + ._nvs_set_u8 = nvs_set_u8, + ._nvs_get_u8 = nvs_get_u8, + ._nvs_set_u16 = nvs_set_u16, + ._nvs_get_u16 = nvs_get_u16, + ._nvs_open = nvs_open_wrapper, + ._nvs_close = nvs_close, + ._nvs_commit = nvs_commit, + ._nvs_set_blob = nvs_set_blob, + ._nvs_get_blob = nvs_get_blob, + ._nvs_erase_key = nvs_erase_key, + ._get_random = os_get_random, + ._get_time = get_time_wrapper, + ._random = os_random, + ._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 = esp_coex_common_malloc_internal_wrapper, + ._realloc_internal = realloc_internal_wrapper, + ._calloc_internal = calloc_internal_wrapper, + ._zalloc_internal = zalloc_internal_wrapper, + ._wifi_malloc = wifi_malloc, + ._wifi_realloc = wifi_realloc, + ._wifi_calloc = wifi_calloc, + ._wifi_zalloc = wifi_zalloc_wrapper, + ._wifi_create_queue = wifi_create_queue_wrapper, + ._wifi_delete_queue = wifi_delete_queue_wrapper, + ._coex_init = coex_init_wrapper, + ._coex_deinit = coex_deinit_wrapper, + ._coex_enable = coex_enable_wrapper, + ._coex_disable = coex_disable_wrapper, + ._coex_status_get = coex_status_get_wrapper, + ._coex_wifi_request = coex_wifi_request_wrapper, + ._coex_wifi_release = coex_wifi_release_wrapper, + ._coex_wifi_channel_set = coex_wifi_channel_set_wrapper, + ._coex_event_duration_get = coex_event_duration_get_wrapper, + ._coex_pti_get = coex_pti_get_wrapper, + ._coex_schm_status_bit_clear = coex_schm_status_bit_clear_wrapper, + ._coex_schm_status_bit_set = coex_schm_status_bit_set_wrapper, + ._coex_schm_interval_set = coex_schm_interval_set_wrapper, + ._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_register_start_cb = coex_register_start_cb_wrapper, +#if SOC_PM_MODEM_RETENTION_BY_REGDMA + ._regdma_link_set_write_wait_content = regdma_link_set_write_wait_content, + ._sleep_retention_find_link_by_id = sleep_retention_find_link_by_id, +#endif + ._coex_schm_process_restart = coex_schm_process_restart_wrapper, + ._coex_schm_register_cb = coex_schm_register_cb_wrapper, + ._coex_schm_flexible_period_set = coex_schm_flexible_period_set_wrapper, + ._coex_schm_flexible_period_get = coex_schm_flexible_period_get_wrapper, + ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, +}; diff --git a/components/esp_wifi/include/esp_private/esp_wifi_he_types_private.h b/components/esp_wifi/include/esp_private/esp_wifi_he_types_private.h index 4a0197aa4dc5..763aa7144bcc 100644 --- a/components/esp_wifi/include/esp_private/esp_wifi_he_types_private.h +++ b/components/esp_wifi/include/esp_private/esp_wifi_he_types_private.h @@ -189,7 +189,7 @@ typedef struct { uint32_t txbf; uint32_t dcm; } nonmimo[ESP_TEST_RX_MU_USER_NUM]; -#if CONFIG_IDF_TARGET_ESP32C5 +#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 uint32_t mu_bru_id_0: 16; uint32_t mu_bru_id_bssidx: 16; uint32_t mu_bru_id_2047: 16; @@ -200,7 +200,7 @@ typedef struct { #endif } esp_test_rx_mu_statistics_t; //10932 bytes -#if CONFIG_IDF_TARGET_ESP32C5 +#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 typedef struct { uint32_t legacy; uint32_t legacy_noeb; @@ -406,7 +406,7 @@ typedef struct { uint16_t rxhung_statis; uint16_t txhung_statis; uint32_t rxtxhung; -#if CONFIG_IDF_TARGET_ESP32C5 +#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 uint32_t rxtxpanic; uint8_t bf_ndp_timeout; uint8_t bf_report_err; 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 ded8bc0c21a9..1e45e91736f1 100644 --- a/components/esp_wifi/include/esp_private/wifi_os_adapter.h +++ b/components/esp_wifi/include/esp_private/wifi_os_adapter.h @@ -149,7 +149,7 @@ typedef struct wifi_osi_funcs_t { int (* _coex_schm_process_restart)(void); int (* _coex_schm_register_cb)(int, int (* cb)(int)); int (* _coex_register_start_cb)(int (* cb)(void)); -#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32C5 +#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 void (* _regdma_link_set_write_wait_content)(void *, uint32_t, uint32_t); void * (* _sleep_retention_find_link_by_id)(int); #endif diff --git a/components/esp_wifi/include/esp_wifi_he_types.h b/components/esp_wifi/include/esp_wifi_he_types.h index f6b9fcc20edc..49131091a7ee 100644 --- a/components/esp_wifi/include/esp_wifi_he_types.h +++ b/components/esp_wifi/include/esp_wifi_he_types.h @@ -41,7 +41,7 @@ enum { /** * @brief Channel state information(CSI) configuration type */ -#if CONFIG_IDF_TARGET_ESP32C5 +#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 typedef struct { uint32_t enable : 1; /**< enable to acquire CSI */ uint32_t acquire_csi_legacy : 1; /**< enable to acquire L-LTF */ @@ -172,7 +172,7 @@ typedef enum { /** * @brief RxControl Info */ -#if CONFIG_IDF_TARGET_ESP32C5 +#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 typedef struct { signed rssi: 8; /**< the RSSI of the reception frame */ unsigned rate: 5; /**< if cur_bb_format is RX_BB_FORMAT_11B, it's the transmission rate. otherwise it's Rate field of L-SIG */ diff --git a/components/esp_wifi/include/local/esp_wifi_types_native.h b/components/esp_wifi/include/local/esp_wifi_types_native.h index 76a45d25b870..20f85a38998f 100644 --- a/components/esp_wifi/include/local/esp_wifi_types_native.h +++ b/components/esp_wifi/include/local/esp_wifi_types_native.h @@ -18,7 +18,7 @@ extern "C" { #if CONFIG_IDF_TARGET_ESP32C2 #define ESP_WIFI_MAX_CONN_NUM (4) /**< max number of stations which can connect to ESP32C2 soft-AP */ -#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32C5 +#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 #define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32C3 soft-AP */ #else #define ESP_WIFI_MAX_CONN_NUM (15) /**< max number of stations which can connect to ESP32/ESP32S3/ESP32S2 soft-AP */ diff --git a/components/esp_wifi/test_apps/.build-test-rules.yml b/components/esp_wifi/test_apps/.build-test-rules.yml index 7b3e1c0bf0f0..35cbadb2379f 100644 --- a/components/esp_wifi/test_apps/.build-test-rules.yml +++ b/components/esp_wifi/test_apps/.build-test-rules.yml @@ -10,3 +10,6 @@ components/esp_wifi/test_apps/wifi_connect: components/esp_wifi/test_apps/wifi_function: disable: - if: SOC_WIFI_SUPPORTED != 1 + disable_test: + - if: IDF_TARGET == "esp32c61" + reason: lack of runner diff --git a/components/esp_wifi/test_apps/wifi_connect/README.md b/components/esp_wifi/test_apps/wifi_connect/README.md index 0c839f750c49..1c350929488b 100644 --- a/components/esp_wifi/test_apps/wifi_connect/README.md +++ b/components/esp_wifi/test_apps/wifi_connect/README.md @@ -1,2 +1,2 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | diff --git a/components/esp_wifi/test_apps/wifi_function/README.md b/components/esp_wifi/test_apps/wifi_function/README.md index 097edbf0c4d4..aa42f91b6bd9 100644 --- a/components/esp_wifi/test_apps/wifi_function/README.md +++ b/components/esp_wifi/test_apps/wifi_function/README.md @@ -1,3 +1,3 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | diff --git a/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in b/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in index 1d32f8ce5ead..ea4d47d64f36 100644 --- a/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32c61/include/soc/Kconfig.soc_caps.in @@ -31,6 +31,14 @@ config SOC_ASYNC_MEMCPY_SUPPORTED bool default y +config SOC_PHY_SUPPORTED + bool + default y + +config SOC_WIFI_SUPPORTED + bool + default y + config SOC_SUPPORTS_SECURE_DL_MODE bool default y @@ -791,6 +799,34 @@ config SOC_RCC_IS_INDEPENDENT bool default y +config SOC_WIFI_HW_TSF + bool + default y + +config SOC_WIFI_FTM_SUPPORT + bool + default n + +config SOC_WIFI_GCMP_SUPPORT + bool + default y + +config SOC_WIFI_WAPI_SUPPORT + bool + default y + +config SOC_WIFI_CSI_SUPPORT + bool + default y + +config SOC_WIFI_MESH_SUPPORT + bool + default y + +config SOC_WIFI_HE_SUPPORT + bool + default y + config SOC_PHY_COMBO_MODULE bool default y diff --git a/components/soc/esp32c61/include/soc/soc_caps.h b/components/soc/esp32c61/include/soc/soc_caps.h index 7aa5e31bef79..801bc852294a 100644 --- a/components/soc/esp32c61/include/soc/soc_caps.h +++ b/components/soc/esp32c61/include/soc/soc_caps.h @@ -28,7 +28,8 @@ #define SOC_USB_SERIAL_JTAG_SUPPORTED 1 #define SOC_ASYNC_MEMCPY_SUPPORTED 1 // \#define SOC_TEMP_SENSOR_SUPPORTED 1 //TODO: [ESP32C61] IDF-9322 -// \#define SOC_WIFI_SUPPORTED 1 +#define SOC_PHY_SUPPORTED 1 +#define SOC_WIFI_SUPPORTED 1 #define SOC_SUPPORTS_SECURE_DL_MODE 1 #define SOC_EFUSE_KEY_PURPOSE_FIELD 1 #define SOC_EFUSE_SUPPORTED 1 @@ -457,13 +458,13 @@ // #define SOC_TEMPERATURE_SENSOR_INTR_SUPPORT (1) /*------------------------------------ WI-FI CAPS ------------------------------------*/ -// #define SOC_WIFI_HW_TSF (1) /*!< Support hardware TSF */ -// #define SOC_WIFI_FTM_SUPPORT (0) /*!< Support FTM */ -// #define SOC_WIFI_GCMP_SUPPORT (1) /*!< Support GCMP(GCMP128 and GCMP256) */ -// #define SOC_WIFI_WAPI_SUPPORT (1) /*!< Support WAPI */ -// #define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */ -// #define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */ -// #define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */ +#define SOC_WIFI_HW_TSF (1) /*!< Support hardware TSF */ +#define SOC_WIFI_FTM_SUPPORT (0) /*!< Support FTM */ +#define SOC_WIFI_GCMP_SUPPORT (1) /*!< Support GCMP(GCMP128 and GCMP256) */ +#define SOC_WIFI_WAPI_SUPPORT (1) /*!< Support WAPI */ +#define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */ +#define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */ +#define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */ /*---------------------------------- Bluetooth CAPS ----------------------------------*/ // \#define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */ diff --git a/components/wpa_supplicant/src/utils/includes.h b/components/wpa_supplicant/src/utils/includes.h index e22c75bb3204..544ad04d8aa0 100644 --- a/components/wpa_supplicant/src/utils/includes.h +++ b/components/wpa_supplicant/src/utils/includes.h @@ -78,6 +78,8 @@ #include "esp32h2/rom/ets_sys.h" #elif CONFIG_IDF_TARGET_ESP32P4 #include "esp32p4/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32C61 +#include "esp32c61/rom/ets_sys.h" #endif #endif /* !__ets__ */ diff --git a/components/wpa_supplicant/test_apps/README.md b/components/wpa_supplicant/test_apps/README.md index 57661ca2581d..e5c31559f2a5 100644 --- a/components/wpa_supplicant/test_apps/README.md +++ b/components/wpa_supplicant/test_apps/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # wpa_supplicant unit test diff --git a/docs/conf_common.py b/docs/conf_common.py index 4050fdc96cd2..2a9a6fee84bb 100644 --- a/docs/conf_common.py +++ b/docs/conf_common.py @@ -230,7 +230,7 @@ ESP32C5_DOCS = ['api-guides/phy.rst'] -ESP32C61_DOCS = [''] +ESP32C61_DOCS = ['api-guides/phy.rst'] ESP32C6_DOCS = ['api-guides/RF_calibration.rst', 'api-reference/peripherals/sd_pullup_requirements.rst', @@ -305,6 +305,7 @@ 'esp32c3':ESP32C3_DOCS, 'esp32c5':ESP32C5_DOCS, 'esp32c6':ESP32C6_DOCS, + 'esp32c61':ESP32C61_DOCS, 'esp32h2':ESP32H2_DOCS, 'esp32p4':ESP32P4_DOCS} diff --git a/docs/en/api-guides/low-power-mode/low-power-mode-wifi.rst b/docs/en/api-guides/low-power-mode/low-power-mode-wifi.rst index 9f2d4fefb1dc..208b6c1df263 100644 --- a/docs/en/api-guides/low-power-mode/low-power-mode-wifi.rst +++ b/docs/en/api-guides/low-power-mode/low-power-mode-wifi.rst @@ -12,7 +12,7 @@ To help users select appropriate low power mode, a summary table of low power mo .. todo - add sleep-current/esp32c5_summary.inc -.. only:: not esp32c5 +.. only:: not esp32c5 and not esp32c61 .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_summary.inc @@ -367,7 +367,7 @@ Modem-sleep Mode Configuration .. todo - add sleep-current/esp32c5_modem_sleep.inc - .. only:: not esp32c5 + .. only:: not esp32c5 and not esp32c61 .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_modem_sleep.inc @@ -383,7 +383,7 @@ Auto Light-sleep mode in Wi-Fi scenarios does not require wake-up source configu .. todo - add sleep-current/esp32c5_light_sleep.inc - .. only:: not esp32c5 + .. only:: not esp32c5 and not esp32c61 .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_light_sleep.inc diff --git a/docs/zh_CN/api-guides/low-power-mode/low-power-mode-wifi.rst b/docs/zh_CN/api-guides/low-power-mode/low-power-mode-wifi.rst index 01681e2b0759..40a8f0625bf6 100644 --- a/docs/zh_CN/api-guides/low-power-mode/low-power-mode-wifi.rst +++ b/docs/zh_CN/api-guides/low-power-mode/low-power-mode-wifi.rst @@ -12,7 +12,7 @@ Wi-Fi 场景如何选择低功耗模式 .. todo - add sleep-current/esp32c5_summary.inc -.. only:: not esp32c5 +.. only:: not esp32c5 and not esp32c61 .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_summary.inc @@ -367,7 +367,7 @@ Modem-sleep 模式配置 .. todo - add sleep-current/esp32c5_modem_sleep.inc - .. only:: not esp32c5 + .. only:: not esp32c5 and not esp32c61 .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_modem_sleep.inc @@ -383,7 +383,7 @@ Auto Light-sleep 在 Wi-Fi 场景下的配置比纯系统下少了唤醒源的 .. todo - add sleep-current/esp32c5_light_sleep.inc - .. only:: not esp32c5 + .. only:: not esp32c5 and not esp32c61 .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_light_sleep.inc diff --git a/examples/mesh/internal_communication/README.md b/examples/mesh/internal_communication/README.md index a86b04351c78..c2a5b5f4881b 100644 --- a/examples/mesh/internal_communication/README.md +++ b/examples/mesh/internal_communication/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | # Mesh Internal Communication Example diff --git a/examples/mesh/ip_internal_network/README.md b/examples/mesh/ip_internal_network/README.md index 2cbf75ed5873..394e9622b801 100644 --- a/examples/mesh/ip_internal_network/README.md +++ b/examples/mesh/ip_internal_network/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | # Mesh IP Internal Networking example diff --git a/examples/mesh/manual_networking/README.md b/examples/mesh/manual_networking/README.md index 276ea1613001..5fc60d9bf912 100644 --- a/examples/mesh/manual_networking/README.md +++ b/examples/mesh/manual_networking/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | # Mesh Manual Networking Example diff --git a/examples/network/eth2ap/README.md b/examples/network/eth2ap/README.md index 20306fa97308..f6437c1728d6 100644 --- a/examples/network/eth2ap/README.md +++ b/examples/network/eth2ap/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # eth2ap Example (See the README.md file in the upper level 'examples' directory for more information about examples. To try a more complex application about Ethernet to WiFi data forwarding, please go to [iot-solution](https://github.com/espressif/esp-iot-solution/tree/release/v1.0/examples/eth2wifi).) diff --git a/examples/network/simple_sniffer/README.md b/examples/network/simple_sniffer/README.md index 950343508474..2af07bb09657 100644 --- a/examples/network/simple_sniffer/README.md +++ b/examples/network/simple_sniffer/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Simple Sniffer Example diff --git a/examples/network/sta2eth/README.md b/examples/network/sta2eth/README.md index 8c91e7a47782..12e812d1f481 100644 --- a/examples/network/sta2eth/README.md +++ b/examples/network/sta2eth/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # WiFi station to "Wired" interface L2 forwarder diff --git a/examples/openthread/.build-test-rules.yml b/examples/openthread/.build-test-rules.yml index 0a85007f193d..59b8f90ea8cc 100644 --- a/examples/openthread/.build-test-rules.yml +++ b/examples/openthread/.build-test-rules.yml @@ -20,7 +20,7 @@ examples/openthread/ot_br: enable: - - if: SOC_WIFI_SUPPORTED == 1 and IDF_TARGET != "esp32c5" + - if: SOC_WIFI_SUPPORTED == 1 and IDF_TARGET not in ["esp32c5", "esp32c61"] disable_test: - if: IDF_TARGET not in ["esp32s3"] reason: only test on esp32s3 diff --git a/examples/provisioning/wifi_prov_mgr/README.md b/examples/provisioning/wifi_prov_mgr/README.md index 7648e5867097..50a458f5c5bd 100644 --- a/examples/provisioning/wifi_prov_mgr/README.md +++ b/examples/provisioning/wifi_prov_mgr/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi Provisioning Manager Example diff --git a/examples/wifi/.build-test-rules.yml b/examples/wifi/.build-test-rules.yml index 947775c85291..e7160aac53ce 100644 --- a/examples/wifi/.build-test-rules.yml +++ b/examples/wifi/.build-test-rules.yml @@ -61,6 +61,10 @@ examples/wifi/power_save: <<: *wifi_depends_default disable: - if: (SOC_WIFI_SUPPORTED != 1) or (IDF_TARGET == "esp32c5") + disable_test: + - if: IDF_TARGET == "esp32c61" + temporary: true + reason: lack of runners depends_components: - esp_driver_uart diff --git a/examples/wifi/espnow/README.md b/examples/wifi/espnow/README.md index 198522d83803..c9880f6fbe45 100644 --- a/examples/wifi/espnow/README.md +++ b/examples/wifi/espnow/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # ESPNOW Example diff --git a/examples/wifi/fast_scan/README.md b/examples/wifi/fast_scan/README.md index 2be7009b422e..003351dba656 100644 --- a/examples/wifi/fast_scan/README.md +++ b/examples/wifi/fast_scan/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi Fast Scan Example diff --git a/examples/wifi/getting_started/softAP/README.md b/examples/wifi/getting_started/softAP/README.md index 7a7277cfa548..4c9713eadb65 100644 --- a/examples/wifi/getting_started/softAP/README.md +++ b/examples/wifi/getting_started/softAP/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi SoftAP Example diff --git a/examples/wifi/getting_started/station/README.md b/examples/wifi/getting_started/station/README.md index 6a35555d95eb..07ca4f962a6c 100644 --- a/examples/wifi/getting_started/station/README.md +++ b/examples/wifi/getting_started/station/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi Station Example diff --git a/examples/wifi/iperf/README.md b/examples/wifi/iperf/README.md index 42fa05184529..e270751d305a 100644 --- a/examples/wifi/iperf/README.md +++ b/examples/wifi/iperf/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | # Iperf Example diff --git a/examples/wifi/iperf/sdkconfig.defaults.esp32c61 b/examples/wifi/iperf/sdkconfig.defaults.esp32c61 new file mode 100644 index 000000000000..90376cdd15c7 --- /dev/null +++ b/examples/wifi/iperf/sdkconfig.defaults.esp32c61 @@ -0,0 +1,42 @@ +# +# ESP32C61-Specific +# +CONFIG_IDF_ENV_FPGA=n + +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=15 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=30 +CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=30 +CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP_WIFI_TX_BA_WIN=20 +CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP_WIFI_RX_BA_WIN=14 +CONFIG_ESP_WIFI_NVS_ENABLED=n + +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=18432 +CONFIG_LWIP_TCP_WND_DEFAULT=18432 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=48 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 +CONFIG_LWIP_IP_REASS_MAX_PBUFS=15 + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHFREQ_40M=y + +# +# Wi-Fi +# +CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS=y +CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS=y +CONFIG_ESP_WIFI_ENABLE_WIFI_RX_MU_STATS=y +CONFIG_ESP_WIFI_ENABLE_DUMP_HESIGB=n +CONFIG_ESP_WIFI_ENABLE_DUMP_MU_CFO=n +CONFIG_ESP_WIFI_ENABLE_DUMP_CTRL_NDPA=n +CONFIG_ESP_WIFI_ENABLE_DUMP_CTRL_BFRP=n +CONFIG_ESP_WIFI_SLP_IRAM_OPT=n +CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION=n + +CONFIG_LWIP_TCPIP_CORE_LOCKING=y +CONFIG_LWIP_TCPIP_CORE_LOCKING_INPUT=y diff --git a/examples/wifi/itwt/README.md b/examples/wifi/itwt/README.md index 49ba38a5c297..74079c36beb3 100644 --- a/examples/wifi/itwt/README.md +++ b/examples/wifi/itwt/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-C5 | ESP32-C6 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-C5 | ESP32-C6 | ESP32-C61 | +| ----------------- | -------- | -------- | --------- | # Wifi itwt Example diff --git a/examples/wifi/power_save/README.md b/examples/wifi/power_save/README.md index 95e01f1acdb9..0b794afeffa1 100644 --- a/examples/wifi/power_save/README.md +++ b/examples/wifi/power_save/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | # Wifi Power Save Example diff --git a/examples/wifi/roaming/roaming_11kvr/README.md b/examples/wifi/roaming/roaming_11kvr/README.md index 024d06cc5544..489d5ce403bc 100644 --- a/examples/wifi/roaming/roaming_11kvr/README.md +++ b/examples/wifi/roaming/roaming_11kvr/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Roaming Example diff --git a/examples/wifi/roaming/roaming_app/README.md b/examples/wifi/roaming/roaming_app/README.md index 5484547e0995..6a26485be531 100644 --- a/examples/wifi/roaming/roaming_app/README.md +++ b/examples/wifi/roaming/roaming_app/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi Station Example diff --git a/examples/wifi/scan/README.md b/examples/wifi/scan/README.md index 44fe4c7fe710..f69e8a56b64b 100644 --- a/examples/wifi/scan/README.md +++ b/examples/wifi/scan/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi Scan Example diff --git a/examples/wifi/smart_config/README.md b/examples/wifi/smart_config/README.md index 822c52226b8a..191d3d085ee2 100644 --- a/examples/wifi/smart_config/README.md +++ b/examples/wifi/smart_config/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # smartconfig Example diff --git a/examples/wifi/softap_sta/README.md b/examples/wifi/softap_sta/README.md index 21a5098a2a6b..1c7e0469591c 100644 --- a/examples/wifi/softap_sta/README.md +++ b/examples/wifi/softap_sta/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi SoftAP & Station Example diff --git a/examples/wifi/wifi_eap_fast/README.md b/examples/wifi/wifi_eap_fast/README.md index 670c852fcfe6..ea048f914626 100644 --- a/examples/wifi/wifi_eap_fast/README.md +++ b/examples/wifi/wifi_eap_fast/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # WPA2 Enterprise Example diff --git a/examples/wifi/wifi_easy_connect/dpp-enrollee/README.md b/examples/wifi/wifi_easy_connect/dpp-enrollee/README.md index 5e6740aa2820..859ccb2f773f 100644 --- a/examples/wifi/wifi_easy_connect/dpp-enrollee/README.md +++ b/examples/wifi/wifi_easy_connect/dpp-enrollee/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Device Provisioning Protocol (Enrollee) Example diff --git a/examples/wifi/wifi_enterprise/README.md b/examples/wifi/wifi_enterprise/README.md index 06404b82c5ae..c9b821f29516 100644 --- a/examples/wifi/wifi_enterprise/README.md +++ b/examples/wifi/wifi_enterprise/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Understanding different WiFi enterprise modes: diff --git a/examples/wifi/wps/README.md b/examples/wifi/wps/README.md index 089f1fd0f148..4260e86dfafa 100644 --- a/examples/wifi/wps/README.md +++ b/examples/wifi/wps/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi WPS Example diff --git a/examples/wifi/wps_softap_registrar/README.md b/examples/wifi/wps_softap_registrar/README.md index 1af61b74d89c..e6dcd9da9149 100644 --- a/examples/wifi/wps_softap_registrar/README.md +++ b/examples/wifi/wps_softap_registrar/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # Wi-Fi WPS Registrar Example diff --git a/examples/zigbee/.build-test-rules.yml b/examples/zigbee/.build-test-rules.yml index a8abfba2d42e..793bc65b937c 100644 --- a/examples/zigbee/.build-test-rules.yml +++ b/examples/zigbee/.build-test-rules.yml @@ -8,8 +8,8 @@ examples/zigbee/esp_zigbee_gateway: enable: - - if: SOC_WIFI_SUPPORTED == 1 and IDF_TARGET not in ["esp32c2", "esp32c5"] - reason: not supported esp32c2 and esp32c5 + - if: SOC_WIFI_SUPPORTED == 1 and IDF_TARGET not in ["esp32c2", "esp32c5", "esp32c61"] + reason: not supported esp32c2 and esp32c5 and esp32c61 <<: *zigbee_dependencies examples/zigbee/esp_zigbee_rcp: diff --git a/tools/test_apps/peripherals/.build-test-rules.yml b/tools/test_apps/peripherals/.build-test-rules.yml index c62ccdbdc51f..4519409689a9 100644 --- a/tools/test_apps/peripherals/.build-test-rules.yml +++ b/tools/test_apps/peripherals/.build-test-rules.yml @@ -3,3 +3,6 @@ tools/test_apps/peripherals/i2c_wifi: disable: - if: SOC_I2C_SUPPORTED != 1 or SOC_WIFI_SUPPORTED != 1 + disable_test: + - if: IDF_TARGET == "esp32c61" + reason: lack of runner diff --git a/tools/test_apps/peripherals/i2c_wifi/README.md b/tools/test_apps/peripherals/i2c_wifi/README.md index e2fe90896527..fd5ce5dc511a 100644 --- a/tools/test_apps/peripherals/i2c_wifi/README.md +++ b/tools/test_apps/peripherals/i2c_wifi/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | # I2C-WIFI Test diff --git a/tools/test_apps/phy/.build-test-rules.yml b/tools/test_apps/phy/.build-test-rules.yml index b7d0fdb4e246..2cd352547c59 100644 --- a/tools/test_apps/phy/.build-test-rules.yml +++ b/tools/test_apps/phy/.build-test-rules.yml @@ -4,7 +4,7 @@ tools/test_apps/phy/phy_multi_init_data_test: disable: - if: SOC_WIFI_SUPPORTED != 1 disable_test: - - if: IDF_TARGET in ["esp32c5"] + - if: IDF_TARGET in ["esp32c5", "esp32c61"] reason: lack of runner tools/test_apps/phy/phy_tsens: diff --git a/tools/test_apps/phy/phy_multi_init_data_test/README.md b/tools/test_apps/phy/phy_multi_init_data_test/README.md index 0c839f750c49..1c350929488b 100644 --- a/tools/test_apps/phy/phy_multi_init_data_test/README.md +++ b/tools/test_apps/phy/phy_multi_init_data_test/README.md @@ -1,2 +1,2 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | From 418c856db0ec8e01211b4292c139a676d4cd0c22 Mon Sep 17 00:00:00 2001 From: liuning Date: Fri, 9 Aug 2024 15:23:33 +0800 Subject: [PATCH 2/4] feat(coex): support esp32c61 coex support --- components/esp_coex/lib | 2 +- components/esp_coex/test_md5/test_md5.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp_coex/lib b/components/esp_coex/lib index 3880b604ad75..6a3c4b312155 160000 --- a/components/esp_coex/lib +++ b/components/esp_coex/lib @@ -1 +1 @@ -Subproject commit 3880b604ad7529c91fb4173da479dd9713ce1f66 +Subproject commit 6a3c4b312155e49593b5df184ffecb54404d295d diff --git a/components/esp_coex/test_md5/test_md5.sh b/components/esp_coex/test_md5/test_md5.sh index 560c7e832fb1..24f80b76e3bb 100755 --- a/components/esp_coex/test_md5/test_md5.sh +++ b/components/esp_coex/test_md5/test_md5.sh @@ -22,7 +22,7 @@ case $IDF_TARGET in esp32s3) PREFIX=xtensa-esp32s3-elf- ;; - esp32c2|esp32c3|esp32c6|esp32h2|esp32c5) + esp32c2|esp32c3|esp32c6|esp32h2|esp32c5|esp32c61) PREFIX=riscv32-esp-elf- ;; *) From 506bff240b91486d162bb267e4c962b7163a7b0f Mon Sep 17 00:00:00 2001 From: xuxiao Date: Fri, 23 Aug 2024 10:51:44 +0800 Subject: [PATCH 3/4] feat(wifi): add SPIRAM wifi support for esp32c5 and esp32c61 --- components/esp_wifi/esp32c5/esp_adapter.c | 63 +++++++++++++++++++++- components/esp_wifi/esp32c61/esp_adapter.c | 63 +++++++++++++++++++++- 2 files changed, 124 insertions(+), 2 deletions(-) diff --git a/components/esp_wifi/esp32c5/esp_adapter.c b/components/esp_wifi/esp32c5/esp_adapter.c index c0c735e01a79..0bc270b856bb 100644 --- a/components/esp_wifi/esp32c5/esp_adapter.c +++ b/components/esp_wifi/esp32c5/esp_adapter.c @@ -63,17 +63,29 @@ extern void wifi_apb80m_release(void); IRAM_ATTR void *wifi_malloc(size_t size) { +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL); +#else return malloc(size); +#endif } IRAM_ATTR void *wifi_realloc(void *ptr, size_t size) { +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_realloc_prefer(ptr, size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL); +#else return realloc(ptr, size); +#endif } IRAM_ATTR void *wifi_calloc(size_t n, size_t size) { +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL); +#else return calloc(n, size); +#endif } static void *IRAM_ATTR wifi_zalloc_wrapper(size_t size) @@ -91,14 +103,47 @@ wifi_static_queue_t *wifi_create_queue(int queue_len, int item_size) return NULL; } +#if CONFIG_SPIRAM_USE_MALLOC + /* Wi-Fi still use internal RAM */ + + queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len * item_size), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); + if (!queue->storage) { + goto _error; + } + + queue->handle = xQueueCreateStatic(queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage)); + + if (!queue->handle) { + goto _error; + } + + return queue; + +_error: + if (queue) { + if (queue->storage) { + free(queue->storage); + } + + free(queue); + } + + return NULL; +#else queue->handle = xQueueCreate(queue_len, item_size); return queue; +#endif } void wifi_delete_queue(wifi_static_queue_t *queue) { if (queue) { vQueueDelete(queue->handle); +#if CONFIG_SPIRAM_USE_MALLOC + if (queue->storage) { + free(queue->storage); + } +#endif free(queue); } } @@ -207,7 +252,23 @@ static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex) static void *queue_create_wrapper(uint32_t queue_len, uint32_t item_size) { +#if CONFIG_SPIRAM_USE_MALLOC + /* Use xQueueCreateWithCaps() to allocate from SPIRAM */ + return (void *)xQueueCreateWithCaps(queue_len, item_size, MALLOC_CAP_SPIRAM); +#else return (void *)xQueueCreate(queue_len, item_size); +#endif +} + +static void queue_delete_wrapper(void *queue) +{ + if (queue) { +#if CONFIG_SPIRAM_USE_MALLOC + vQueueDeleteWithCaps(queue); +#else + vQueueDelete(queue); +#endif + } } static int32_t queue_send_wrapper(void *queue, void *item, uint32_t block_time_tick) @@ -587,7 +648,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._mutex_lock = mutex_lock_wrapper, ._mutex_unlock = mutex_unlock_wrapper, ._queue_create = queue_create_wrapper, - ._queue_delete = (void(*)(void *))vQueueDelete, + ._queue_delete = queue_delete_wrapper, ._queue_send = queue_send_wrapper, ._queue_send_from_isr = queue_send_from_isr_wrapper, ._queue_send_to_back = queue_send_to_back_wrapper, diff --git a/components/esp_wifi/esp32c61/esp_adapter.c b/components/esp_wifi/esp32c61/esp_adapter.c index 360d7ae6f7a4..8f6aac92169c 100644 --- a/components/esp_wifi/esp32c61/esp_adapter.c +++ b/components/esp_wifi/esp32c61/esp_adapter.c @@ -63,17 +63,29 @@ extern void wifi_apb80m_release(void); IRAM_ATTR void *wifi_malloc(size_t size) { +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL); +#else return malloc(size); +#endif } IRAM_ATTR void *wifi_realloc(void *ptr, size_t size) { +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_realloc_prefer(ptr, size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL); +#else return realloc(ptr, size); +#endif } IRAM_ATTR void *wifi_calloc(size_t n, size_t size) { +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL); +#else return calloc(n, size); +#endif } static void *IRAM_ATTR wifi_zalloc_wrapper(size_t size) @@ -91,14 +103,47 @@ wifi_static_queue_t *wifi_create_queue(int queue_len, int item_size) return NULL; } +#if CONFIG_SPIRAM_USE_MALLOC + /* Wi-Fi still use internal RAM */ + + queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len * item_size), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); + if (!queue->storage) { + goto _error; + } + + queue->handle = xQueueCreateStatic(queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage)); + + if (!queue->handle) { + goto _error; + } + + return queue; + +_error: + if (queue) { + if (queue->storage) { + free(queue->storage); + } + + free(queue); + } + + return NULL; +#else queue->handle = xQueueCreate(queue_len, item_size); return queue; +#endif } void wifi_delete_queue(wifi_static_queue_t *queue) { if (queue) { vQueueDelete(queue->handle); +#if CONFIG_SPIRAM_USE_MALLOC + if (queue->storage) { + free(queue->storage); + } +#endif free(queue); } } @@ -207,7 +252,23 @@ static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex) static void *queue_create_wrapper(uint32_t queue_len, uint32_t item_size) { +#if CONFIG_SPIRAM_USE_MALLOC + /* Use xQueueCreateWithCaps() to allocate from SPIRAM */ + return (void *)xQueueCreateWithCaps(queue_len, item_size, MALLOC_CAP_SPIRAM); +#else return (void *)xQueueCreate(queue_len, item_size); +#endif +} + +static void queue_delete_wrapper(void *queue) +{ + if (queue) { +#if CONFIG_SPIRAM_USE_MALLOC + vQueueDeleteWithCaps(queue); +#else + vQueueDelete(queue); +#endif + } } static int32_t queue_send_wrapper(void *queue, void *item, uint32_t block_time_tick) @@ -587,7 +648,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._mutex_lock = mutex_lock_wrapper, ._mutex_unlock = mutex_unlock_wrapper, ._queue_create = queue_create_wrapper, - ._queue_delete = (void(*)(void *))vQueueDelete, + ._queue_delete = queue_delete_wrapper, ._queue_send = queue_send_wrapper, ._queue_send_from_isr = queue_send_from_isr_wrapper, ._queue_send_to_back = queue_send_to_back_wrapper, From 7c9109d9e1e972276fff01c398a7a2771216c248 Mon Sep 17 00:00:00 2001 From: xuxiao Date: Fri, 23 Aug 2024 19:11:34 +0800 Subject: [PATCH 4/4] fix(wifi): fix code comments --- components/esp_phy/CMakeLists.txt | 2 +- components/esp_phy/esp32c61/phy_init_data.c | 4 +-- .../include/local/esp_wifi_types_native.h | 2 +- components/esp_wifi/lib | 2 +- .../low-power-mode/low-power-mode-wifi.rst | 32 +++++++++--------- .../low-power-mode/low-power-mode-wifi.rst | 33 ++++++++++--------- examples/openthread/.build-test-rules.yml | 2 +- examples/openthread/ot_br/README.md | 6 ++-- 8 files changed, 42 insertions(+), 41 deletions(-) diff --git a/components/esp_phy/CMakeLists.txt b/components/esp_phy/CMakeLists.txt index 6035e3067dd8..d8a75f179631 100644 --- a/components/esp_phy/CMakeLists.txt +++ b/components/esp_phy/CMakeLists.txt @@ -5,7 +5,7 @@ if(${idf_target} STREQUAL "linux") endif() if(IDF_TARGET STREQUAL "esp32p4") - # TODO: IDF-7460, IDF-8851, IDF-9553 + # TODO: IDF-7460 idf_component_register() return() endif() diff --git a/components/esp_phy/esp32c61/phy_init_data.c b/components/esp_phy/esp32c61/phy_init_data.c index 9bb8099d8b71..801431525687 100644 --- a/components/esp_phy/esp32c61/phy_init_data.c +++ b/components/esp_phy/esp32c61/phy_init_data.c @@ -14,7 +14,7 @@ const char __attribute__((section(".rodata"))) phy_init_magic_pre[] = PHY_INIT_M * @brief Structure containing default recommended PHY initialization parameters. */ const esp_phy_init_data_t phy_init_data= { { -0x1, + 0x1, 0x0, LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50), LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 0x50), @@ -96,7 +96,7 @@ const esp_phy_init_data_t phy_init_data= { { 0, 0, 0, - 0, + 0, 0, 0, 0, diff --git a/components/esp_wifi/include/local/esp_wifi_types_native.h b/components/esp_wifi/include/local/esp_wifi_types_native.h index 20f85a38998f..3efc979daad8 100644 --- a/components/esp_wifi/include/local/esp_wifi_types_native.h +++ b/components/esp_wifi/include/local/esp_wifi_types_native.h @@ -19,7 +19,7 @@ extern "C" { #if CONFIG_IDF_TARGET_ESP32C2 #define ESP_WIFI_MAX_CONN_NUM (4) /**< max number of stations which can connect to ESP32C2 soft-AP */ #elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 -#define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32C3 soft-AP */ +#define ESP_WIFI_MAX_CONN_NUM (10) /**< max number of stations which can connect to ESP32C3/ESP32C6/ESP32C5/ESP32C61 soft-AP */ #else #define ESP_WIFI_MAX_CONN_NUM (15) /**< max number of stations which can connect to ESP32/ESP32S3/ESP32S2 soft-AP */ #endif diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index f28ad22ab853..e66a47c0ba36 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit f28ad22ab853677d8b0d398abe89babe274c222f +Subproject commit e66a47c0ba36a6cf4edfe0dbf4d21588d07b374e diff --git a/docs/en/api-guides/low-power-mode/low-power-mode-wifi.rst b/docs/en/api-guides/low-power-mode/low-power-mode-wifi.rst index 208b6c1df263..1f3b710d4c4a 100644 --- a/docs/en/api-guides/low-power-mode/low-power-mode-wifi.rst +++ b/docs/en/api-guides/low-power-mode/low-power-mode-wifi.rst @@ -5,18 +5,18 @@ Introduction to Low Power Mode in Wi-Fi Scenarios After the previous introduction to low power mode from a systemic perspective, this section delves into low power mode in Wi-Fi scenarios. Due to the complexity of Wi-Fi scenarios, basic principles of Wi-Fi power saving will be introduced before specific low power mode. This section is focused on station mode. -Choosing Low Power Mode in Wi-Fi Scenarios ---------------------------------------------- +.. todo - add sleep-current/esp32c5_summary.inc and sleep-current/esp32c61_summary.inc -To help users select appropriate low power mode, a summary table of low power modes in Wi-Fi scenarios is provided before detailed introduction. +.. only:: not esp32c5 and not esp32c61 -.. todo - add sleep-current/esp32c5_summary.inc + Choosing Low Power Mode in Wi-Fi Scenarios + --------------------------------------------- -.. only:: not esp32c5 and not esp32c61 + To help users select appropriate low power mode, a summary table of low power modes in Wi-Fi scenarios is provided before detailed introduction. - .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_summary.inc + .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_summary.inc -.. note:: + .. note:: All currents in the table are average currents, and the terms in the table are explained in the following text. Users can refer to them as needed. @@ -363,13 +363,13 @@ Modem-sleep Mode Configuration * - ``light_sleep_enable`` - false -- Configuration Performance + .. todo - add sleep-current/esp32c5_modem_sleep.inc sleep-current/esp32c61_modem_sleep.inc - .. todo - add sleep-current/esp32c5_modem_sleep.inc + .. only:: not esp32c5 and not esp32c61 - .. only:: not esp32c5 and not esp32c61 + - Configuration Performance - .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_modem_sleep.inc + .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_modem_sleep.inc Auto Light-sleep Mode + Wi-Fi Scenario Configuration @@ -377,15 +377,15 @@ Auto Light-sleep Mode + Wi-Fi Scenario Configuration Auto Light-sleep mode in Wi-Fi scenarios does not require wake-up source configuration compared with a pure system. But the remaining part of configuration is basically the same in the two operation scenarios. Therefore, detailed introduction of configurable options, configuration steps, and recommended configurations can be found in the previous section :ref:`Deep-sleep Mode`, with the Wi-Fi-related configurations set to default. -- Configuration Performance +.. todo - add sleep-current/esp32c5_light_sleep.inc and leep-current/esp32c61_light_sleep.inc - The configuration performance mirrors that of the recommended Auto Light-sleep mode configuration in a pure system, combined with the default Wi-Fi-related configurations in the Wi-Fi environment. +.. only:: not esp32c5 and not esp32c61 - .. todo - add sleep-current/esp32c5_light_sleep.inc + - Configuration Performance - .. only:: not esp32c5 and not esp32c61 + The configuration performance mirrors that of the recommended Auto Light-sleep mode configuration in a pure system, combined with the default Wi-Fi-related configurations in the Wi-Fi environment. - .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_light_sleep.inc + .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_light_sleep.inc Deep-sleep Mode + Wi-Fi Scenario Configuration ++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/docs/zh_CN/api-guides/low-power-mode/low-power-mode-wifi.rst b/docs/zh_CN/api-guides/low-power-mode/low-power-mode-wifi.rst index 40a8f0625bf6..ac6af18ba323 100644 --- a/docs/zh_CN/api-guides/low-power-mode/low-power-mode-wifi.rst +++ b/docs/zh_CN/api-guides/low-power-mode/low-power-mode-wifi.rst @@ -5,18 +5,19 @@ Wi-Fi 场景下低功耗模式介绍 本节将结合纯系统下的功耗模式来介绍 Wi-Fi 场景下的低功耗模式。因为 Wi-Fi 场景的复杂性,本节会首先介绍 Wi-Fi 省电的基本原理,然后再介绍具体的低功耗模式。本节主要针对 station 模式。 -Wi-Fi 场景如何选择低功耗模式 --------------------------------------- +.. todo - add sleep-current/esp32c5_summary.inc and sleep-current/esp32c61_summary.inc -在介绍具体内容前先给出 Wi-Fi 场景下低功耗模式总结表,以方便用户根据需求快速选择想要了解的内容,选择合适的低功耗模式。 +.. only:: not esp32c5 and not esp32c61 -.. todo - add sleep-current/esp32c5_summary.inc + Wi-Fi 场景如何选择低功耗模式 + -------------------------------------- -.. only:: not esp32c5 and not esp32c61 + 在介绍具体内容前先给出 Wi-Fi 场景下低功耗模式总结表,以方便用户根据需求快速选择想要了解的内容,选择合适的低功耗模式。 - .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_summary.inc -.. note:: + .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_summary.inc + + .. note:: 上表中所有电流均为平均电流,表中术语在下文均有介绍,用户可根据需求进行查看。 @@ -363,13 +364,13 @@ Modem-sleep 模式配置 * - ``light_sleep_enable`` - false -- 配置表现 + .. todo - add sleep-current/esp32c5_modem_sleep.inc sleep-current/esp32c61_modem_sleep.inc - .. todo - add sleep-current/esp32c5_modem_sleep.inc + .. only:: not esp32c5 and not esp32c61 - .. only:: not esp32c5 and not esp32c61 + - 配置表现 - .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_modem_sleep.inc + .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_modem_sleep.inc Auto Light-sleep 模式 + Wi-Fi 场景配置 @@ -377,15 +378,15 @@ Auto Light-sleep 模式 + Wi-Fi 场景配置 Auto Light-sleep 在 Wi-Fi 场景下的配置比纯系统下少了唤醒源的配置要求,其余几乎与纯系统下配置一致,因此可配置选项、配置步骤、推荐配置的详细介绍可以参考上文 :ref:`Deep-sleep 模式`。同时 Wi-Fi 相关配置保持默认。 -- 配置表现 +.. todo - add sleep-current/esp32c5_light_sleep.inc and leep-current/esp32c61_light_sleep.inc - 该配置表现为 Auto Light-sleep 模式纯系统推荐配置 + 默认的 Wi-Fi 相关配置在 Wi-Fi 场景的表现。 +.. only:: not esp32c5 and not esp32c61 - .. todo - add sleep-current/esp32c5_light_sleep.inc + - 配置表现 - .. only:: not esp32c5 and not esp32c61 + 该配置表现为 Auto Light-sleep 模式纯系统推荐配置 + 默认的 Wi-Fi 相关配置在 Wi-Fi 场景的表现。 - .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_light_sleep.inc + .. include:: ../sleep-current/{IDF_TARGET_PATH_NAME}_light_sleep.inc Deep-sleep 模式 + Wi-Fi 场景配置 +++++++++++++++++++++++++++++++++++ diff --git a/examples/openthread/.build-test-rules.yml b/examples/openthread/.build-test-rules.yml index 59b8f90ea8cc..7518ec1873d0 100644 --- a/examples/openthread/.build-test-rules.yml +++ b/examples/openthread/.build-test-rules.yml @@ -20,7 +20,7 @@ examples/openthread/ot_br: enable: - - if: SOC_WIFI_SUPPORTED == 1 and IDF_TARGET not in ["esp32c5", "esp32c61"] + - if: SOC_WIFI_SUPPORTED == 1 and IDF_TARGET != "esp32c61" disable_test: - if: IDF_TARGET not in ["esp32s3"] reason: only test on esp32s3 diff --git a/examples/openthread/ot_br/README.md b/examples/openthread/ot_br/README.md index 1e8af0bddb2c..fe3c90938afc 100644 --- a/examples/openthread/ot_br/README.md +++ b/examples/openthread/ot_br/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | # OpenThread Border Router Example @@ -52,7 +52,7 @@ Two ways are provided to setup the Thread Border Router in this example: - Auto Start Enable `OPENTHREAD_BR_AUTO_START`, configure the `CONFIG_EXAMPLE_WIFI_SSID` and `CONFIG_EXAMPLE_WIFI_PASSWORD` with your access point's ssid and psk. -The device will connect to Wi-Fi and form a Thread network automatically after bootup. +The device will connect to Wi-Fi and form a Thread network automatically after boot up. - Manual mode Disable `OPENTHREAD_BR_AUTO_START` and enable `OPENTHREAD_CLI_ESP_EXTENSION`. `wifi` command will be added for connecting the device to the Wi-Fi network.