feat(extconn): Supports external WiFi connections for ESP32p4 and other espressf chips

pull/13550/head
xiehang 2024-03-27 16:29:09 +08:00
rodzic 9d7bd6a8dd
commit f3c5047638
26 zmienionych plików z 1128 dodań i 263 usunięć

Wyświetl plik

@ -31,7 +31,9 @@
#include "osi/allocator.h"
#include <string.h>
#ifdef CONFIG_ESP_COEX_ENABLED
#include "esp_coexist.h"
#endif
/*****************************************************************************
** Constants and types
@ -91,7 +93,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
bta_dm_pin_reply, /* BTA_DM_API_PIN_REPLY_EVT */
#endif ///SMP_INCLUDED == TRUE
#if (BTA_DM_PM_INCLUDED == TRUE)
/* power manger events */
/* power manager events */
bta_dm_pm_btm_status, /* BTA_DM_PM_BTM_STATUS_EVT */
bta_dm_pm_timer, /* BTA_DM_PM_TIMER_EVT */
#endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */

Wyświetl plik

@ -4,20 +4,23 @@ if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(CONFIG_ESP_COEX_SW_COEXIST_ENABLE OR CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE)
if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)
set(ldfragments)
else()
set(link_binary_libs 1)
set(ldfragments "linker.lf")
if(CONFIG_ESP_COEX_ENABLED)
if(CONFIG_ESP_COEX_SW_COEXIST_ENABLE OR CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE)
if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)
set(ldfragments)
else()
set(link_binary_libs 1)
set(ldfragments "linker.lf")
endif()
set(srcs "src/coexist.c"
"src/lib_printf.c"
"${idf_target}/esp_coex_adapter.c")
endif()
set(srcs "src/coexist.c"
"${idf_target}/esp_coex_adapter.c")
endif()
if(CONFIG_ESP_WIFI_ENABLED)
list(APPEND srcs "${idf_target}/esp_coex_adapter.c")
if(CONFIG_ESP_WIFI_ENABLED)
list(APPEND srcs "${idf_target}/esp_coex_adapter.c")
endif()
endif()
idf_component_register(SRCS "${srcs}"
@ -25,21 +28,23 @@ idf_component_register(SRCS "${srcs}"
PRIV_REQUIRES esp_timer driver esp_event
LDFRAGMENTS "${ldfragments}")
if(CONFIG_ESP_COEX_SW_COEXIST_ENABLE OR CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE)
idf_build_get_property(build_dir BUILD_DIR)
if(CONFIG_ESP_COEX_ENABLED)
if(CONFIG_ESP_COEX_SW_COEXIST_ENABLE OR CONFIG_ESP_COEX_EXTERNAL_COEXIST_ENABLE)
idf_build_get_property(build_dir BUILD_DIR)
set(target_name "${idf_target}")
target_link_directories(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}")
set(target_name "${idf_target}")
target_link_directories(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}")
if(link_binary_libs)
set(blob coexist)
add_prebuilt_library(${blob} "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}/lib${blob}.a"
REQUIRES ${COMPONENT_NAME})
target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob})
if(CONFIG_IDF_TARGET_ESP32)
target_link_libraries(${COMPONENT_LIB} PRIVATE btdm_app)
if(link_binary_libs)
set(blob coexist)
add_prebuilt_library(${blob} "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}/lib${blob}.a"
REQUIRES ${COMPONENT_NAME})
target_link_libraries(${COMPONENT_LIB} PUBLIC ${blob})
if(CONFIG_IDF_TARGET_ESP32)
target_link_libraries(${COMPONENT_LIB} PRIVATE btdm_app)
endif()
endif()
endif()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
endif()
endif()

Wyświetl plik

@ -1,29 +1,36 @@
menu "Wireless Coexistence"
config ESP_COEX_SW_COEXIST_ENABLE
bool "Software controls WiFi/Bluetooth coexistence"
depends on (ESP_WIFI_ENABLED && BT_ENABLED) || \
(ESP_WIFI_ENABLED && IEEE802154_ENABLED) || \
(IEEE802154_ENABLED && BT_ENABLED)
default y
select ESP_WIFI_STA_DISCONNECTED_PM_ENABLE if (ESP_WIFI_ENABLED)
help
If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware.
Recommended for heavy traffic scenarios. Both coexistence configuration options are
automatically managed, no user intervention is required.
If only Bluetooth is used, it is recommended to disable this option to reduce binary file
size.
config ESP_COEX_EXTERNAL_COEXIST_ENABLE
bool "External Coexistence"
default n
depends on (!(BT_ENABLED||NIMBLE_ENABLED)&&(!IDF_TARGET_ESP32))
help
If enabled, HW External coexistence arbitration is managed by GPIO pins.
It can support three types of wired combinations so far which are 1-wired/2-wired/3-wired.
User can select GPIO pins in application code with configure interfaces.
config ESP_COEX_ENABLED
bool
default y if (!SOC_WIRELESS_HOST_SUPPORTED)
This function depends on BT-off
because currently we do not support external coex and internal coex simultaneously.
if(ESP_COEX_ENABLED)
config ESP_COEX_SW_COEXIST_ENABLE
bool "Software controls WiFi/Bluetooth coexistence"
depends on (ESP_WIFI_ENABLED && BT_ENABLED) || \
(ESP_WIFI_ENABLED && IEEE802154_ENABLED) || \
(IEEE802154_ENABLED && BT_ENABLED)
default y
select ESP_WIFI_STA_DISCONNECTED_PM_ENABLE if (ESP_WIFI_ENABLED)
help
If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware.
Recommended for heavy traffic scenarios. Both coexistence configuration options are
automatically managed, no user intervention is required.
If only Bluetooth is used, it is recommended to disable this option to reduce binary file
size.
config ESP_COEX_EXTERNAL_COEXIST_ENABLE
bool "External Coexistence"
default n
depends on (!(BT_ENABLED||NIMBLE_ENABLED)&&(!IDF_TARGET_ESP32))
help
If enabled, HW External coexistence arbitration is managed by GPIO pins.
It can support three types of wired combinations so far which are 1-wired/2-wired/3-wired.
User can select GPIO pins in application code with configure interfaces.
This function depends on BT-off
because currently we do not support external coex and internal coex simultaneously.
endif
endmenu # Wireless Coexistence

Wyświetl plik

@ -0,0 +1,52 @@
/*
* SPDX-FileCopyrightText: 2016-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file lib_printf.c
*
* This file contains library-specific printf functions
* used by WiFi libraries in the `lib` directory.
* These function are used to catch any output which gets printed
* by libraries, and redirect it to ESP_LOG macros.
*
* Eventually WiFi libraries will use ESP_LOG functions internally
* and these definitions will be removed.
*/
#include <stdio.h>
#include <stdlib.h>
#include "esp_log.h"
#include "esp_attr.h"
#define VPRINTF_STACK_BUFFER_SIZE 80
static int lib_printf(const char* tag, const char* format, va_list arg)
{
char temp[VPRINTF_STACK_BUFFER_SIZE];
int len = vsnprintf(temp, sizeof(temp) - 1, format, arg);
temp[sizeof(temp) - 1] = 0;
int i;
for (i = len - 1; i >= 0; --i) {
if (temp[i] != '\n' && temp[i] != '\r' && temp[i] != ' ') {
break;
}
temp[i] = 0;
}
if (i > 0) {
ESP_LOGI(tag, "%s", temp);
}
va_end(arg);
return len;
}
int coexist_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("coexist", format, arg);
va_end(arg);
return res;
}

Wyświetl plik

@ -11,43 +11,44 @@ endif()
if(CONFIG_ESP_PHY_ENABLED)
set(srcs "src/phy_override.c" "src/lib_printf.c" "src/phy_common.c")
set(srcs "src/phy_override.c" "src/lib_printf.c" "src/phy_common.c")
if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)
set(ldfragments)
else()
set(link_binary_libs 1)
set(ldfragments "linker.lf")
endif()
if(CONFIG_SOC_IEEE802154_BLE_ONLY)
list(APPEND srcs "src/phy_init_esp32hxx.c")
else()
list(APPEND srcs "src/phy_init.c")
endif()
if(CONFIG_SOC_BT_SUPPORTED OR CONFIG_SOC_IEEE802154_SUPPORTED OR CONFIG_SOC_IEEE802154_BLE_ONLY)
list(APPEND srcs "src/btbb_init.c")
endif()
if(CONFIG_ESP_PHY_ENABLE_CERT_TEST)
list(APPEND srcs "src/phy_callback.c")
endif()
idf_build_get_property(build_dir BUILD_DIR)
if(CONFIG_SOC_WIFI_SUPPORTED)
if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN)
if(NOT EXISTS "${build_dir}/phy_multiple_init_data.bin")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${idf_target}/phy_multiple_init_data.bin DESTINATION "${build_dir}")
if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)
set(ldfragments)
else()
set(link_binary_libs 1)
set(ldfragments "linker.lf")
endif()
endif()
if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED)
set(embed_files "${build_dir}/phy_multiple_init_data.bin")
endif()
endif()
if(CONFIG_SOC_IEEE802154_BLE_ONLY)
list(APPEND srcs "src/phy_init_esp32hxx.c")
else()
list(APPEND srcs "src/phy_init.c")
endif()
if(CONFIG_SOC_BT_SUPPORTED OR CONFIG_SOC_IEEE802154_SUPPORTED OR CONFIG_SOC_IEEE802154_BLE_ONLY)
list(APPEND srcs "src/btbb_init.c")
endif()
if(CONFIG_ESP_PHY_ENABLE_CERT_TEST)
list(APPEND srcs "src/phy_callback.c")
endif()
idf_build_get_property(build_dir BUILD_DIR)
if(CONFIG_SOC_WIFI_SUPPORTED)
if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN)
if(NOT EXISTS "${build_dir}/phy_multiple_init_data.bin")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${idf_target}/phy_multiple_init_data.bin
DESTINATION "${build_dir}")
endif()
endif()
if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED)
set(embed_files "${build_dir}/phy_multiple_init_data.bin")
endif()
endif()
endif()
# [refactor-todo]: requires "driver" component for periph_ctrl header file
@ -59,29 +60,29 @@ idf_component_register(SRCS "${srcs}"
)
if(CONFIG_ESP_PHY_ENABLED)
set(target_name "${idf_target}")
target_link_directories(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}")
set(target_name "${idf_target}")
target_link_directories(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}")
# Override functions in PHY lib with the functions in 'phy_override.c'
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u include_esp_phy_override")
# Override functions in PHY lib with the functions in 'phy_override.c'
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u include_esp_phy_override")
if(link_binary_libs)
target_link_libraries(${COMPONENT_LIB} PUBLIC phy)
if(link_binary_libs)
target_link_libraries(${COMPONENT_LIB} PUBLIC phy)
idf_component_get_property(esp_phy_lib esp_phy COMPONENT_LIB)
idf_component_get_property(esp_phy_lib esp_phy COMPONENT_LIB)
if(CONFIG_IDF_TARGET_ESP32)
target_link_libraries(${COMPONENT_LIB} PUBLIC rtc)
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${esp_phy_lib}> libphy.a librtc.a
$<TARGET_FILE:${esp_phy_lib}>)
elseif(CONFIG_IDF_TARGET_ESP32S2)
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${esp_phy_lib}> libphy.a
$<TARGET_FILE:${esp_phy_lib}>)
elseif(CONFIG_SOC_BT_SUPPORTED OR CONFIG_SOC_IEEE802154_SUPPORTED)
target_link_libraries(${COMPONENT_LIB} PUBLIC btbb)
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${esp_phy_lib}> libphy.a libbtbb.a
$<TARGET_FILE:${esp_phy_lib}>)
endif()
if(CONFIG_IDF_TARGET_ESP32)
target_link_libraries(${COMPONENT_LIB} PUBLIC rtc)
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${esp_phy_lib}> libphy.a librtc.a
$<TARGET_FILE:${esp_phy_lib}>)
elseif(CONFIG_IDF_TARGET_ESP32S2)
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${esp_phy_lib}> libphy.a
$<TARGET_FILE:${esp_phy_lib}>)
elseif(CONFIG_SOC_BT_SUPPORTED OR CONFIG_SOC_IEEE802154_SUPPORTED)
target_link_libraries(${COMPONENT_LIB} PUBLIC btbb)
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${esp_phy_lib}> libphy.a libbtbb.a
$<TARGET_FILE:${esp_phy_lib}>)
endif()
if(CONFIG_ESP_PHY_ENABLE_CERT_TEST)
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${esp_phy_lib}> libbttestmode.a
@ -89,42 +90,43 @@ if(link_binary_libs)
endif()
endif()
if(CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION)
idf_component_get_property(esp_common_dir esp_common COMPONENT_DIR)
partition_table_get_partition_info(phy_partition_offset "--partition-type data --partition-subtype phy" "offset")
if(CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION)
idf_component_get_property(esp_common_dir esp_common COMPONENT_DIR)
partition_table_get_partition_info(phy_partition_offset
"--partition-type data --partition-subtype phy" "offset")
if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN)
set(phy_init_data_bin "${build_dir}/phy_multiple_init_data.bin")
if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED)
set(COMPONENT_EMBED_FILES "${build_dir}/phy_multiple_init_data.bin")
if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN)
set(phy_init_data_bin "${build_dir}/phy_multiple_init_data.bin")
if(CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED)
set(COMPONENT_EMBED_FILES "${build_dir}/phy_multiple_init_data.bin")
endif()
else()
set(phy_init_data_bin "${build_dir}/phy_init_data.bin")
# To get the phy_init_data.bin file, compile phy_init_data.h as a C file and then objcopy
# the object file to a raw binary
idf_build_get_property(config_dir CONFIG_DIR)
add_custom_command(
OUTPUT ${phy_init_data_bin}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include/phy_init_data.h
COMMAND ${CMAKE_C_COMPILER} -x c -c
-I ${esp_common_dir}/include -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${config_dir}
-o phy_init_data.obj
${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include/phy_init_data.h
COMMAND ${CMAKE_OBJCOPY} -O binary phy_init_data.obj ${phy_init_data_bin}
)
add_custom_target(phy_init_data ALL DEPENDS ${phy_init_data_bin})
add_dependencies(flash phy_init_data)
idf_component_get_property(main_args esptool_py FLASH_ARGS)
idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS)
endif()
else()
set(phy_init_data_bin "${build_dir}/phy_init_data.bin")
# To get the phy_init_data.bin file, compile phy_init_data.h as a C file and then objcopy
# the object file to a raw binary
idf_build_get_property(config_dir CONFIG_DIR)
add_custom_command(
OUTPUT ${phy_init_data_bin}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include/phy_init_data.h
COMMAND ${CMAKE_C_COMPILER} -x c -c
-I ${esp_common_dir}/include -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${config_dir}
-o phy_init_data.obj
${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include/phy_init_data.h
COMMAND ${CMAKE_OBJCOPY} -O binary phy_init_data.obj ${phy_init_data_bin}
)
add_custom_target(phy_init_data ALL DEPENDS ${phy_init_data_bin})
add_dependencies(flash phy_init_data)
set(phy_name "phy")
idf_component_get_property(main_args esptool_py FLASH_ARGS)
idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS)
esptool_py_flash_target(${phy_name}-flash "${main_args}" "${sub_args}")
esptool_py_flash_target_image(${phy_name}-flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}")
esptool_py_flash_target_image(flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}")
endif()
set(phy_name "phy")
esptool_py_flash_target(${phy_name}-flash "${main_args}" "${sub_args}")
esptool_py_flash_target_image(${phy_name}-flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}")
esptool_py_flash_target_image(flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}")
endif()
endif()

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2016-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2016-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -60,93 +60,3 @@ int rtc_printf(const char* format, ...)
va_end(arg);
return res;
}
int wpa_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("wpa", format, arg);
va_end(arg);
return res;
}
int wpa2_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("wpa2", format, arg);
va_end(arg);
return res;
}
int wps_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("wps", format, arg);
va_end(arg);
return res;
}
int pp_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("pp", format, arg);
va_end(arg);
return res;
}
int sc_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("smartconfig", format, arg);
va_end(arg);
return res;
}
int core_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("core", format, arg);
va_end(arg);
return res;
}
int net80211_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("net80211", format, arg);
va_end(arg);
return res;
}
int coexist_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("coexist", format, arg);
va_end(arg);
return res;
}
int wapi_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("wapi", format, arg);
va_end(arg);
return res;
}
int mesh_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("mesh", format, arg);
va_end(arg);
return res;
}

Wyświetl plik

@ -4,7 +4,7 @@ if(${idf_target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
if(CONFIG_ESP_WIFI_ENABLED)
if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
if(CONFIG_APP_NO_BLOBS)
set(link_binary_libs 0)
@ -22,6 +22,7 @@ if(CONFIG_ESP_WIFI_ENABLED)
endif()
set(srcs
"src/lib_printf.c"
"src/mesh_event.c"
"src/smartconfig.c"
"src/wifi_init.c"
@ -55,17 +56,26 @@ idf_component_register(SRCS "${srcs}"
wpa_supplicant hal lwip esp_coex ${extra_priv_requires}
LDFRAGMENTS "${ldfragments}")
if(CONFIG_ESP_WIFI_ENABLED)
if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
idf_build_get_property(build_dir BUILD_DIR)
set(target_name "${idf_target}")
if(CONFIG_ESP_HOST_WIFI_ENABLED)
set(target_name "${CONFIG_ESP_WIFI_CONTROLLER_TARGET}_host")
else()
set(target_name "${idf_target}")
endif()
target_link_directories(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/lib/${target_name}")
if(link_binary_libs)
if(CONFIG_IDF_TARGET_ESP32C2)
set(blobs core espnow net80211 pp smartconfig)
if(CONFIG_ESP_HOST_WIFI_ENABLED)
set(blobs core espnow net80211 target smartconfig wapi)
else()
set(blobs core espnow mesh net80211 pp smartconfig wapi)
if(CONFIG_IDF_TARGET_ESP32C2)
set(blobs core espnow net80211 pp smartconfig)
else()
set(blobs core espnow mesh net80211 pp smartconfig wapi)
endif()
endif()
foreach(blob ${blobs})

Wyświetl plik

@ -7,7 +7,22 @@ menu "Wi-Fi"
bool
default y if SOC_WIFI_SUPPORTED
if ESP_WIFI_ENABLED
config ESP_HOST_WIFI_ENABLED
bool "Host WiFi Enable"
depends on SOC_WIRELESS_HOST_SUPPORTED
default n
config ESP_WIFI_CONTROLLER_TARGET
depends on ESP_HOST_WIFI_ENABLED
string
default "esp32"
config ESP_WIFI_TARGET_ESP32
depends on ESP_HOST_WIFI_ENABLED
bool
default y if ESP_WIFI_CONTROLLER_TARGET="esp32"
if (ESP_WIFI_ENABLED || ESP_HOST_WIFI_ENABLED)
config ESP_WIFI_STATIC_RX_BUFFER_NUM
int "Max number of WiFi static RX buffers"
@ -194,7 +209,7 @@ menu "Wi-Fi"
Set the size of WiFi Block Ack RX window. Generally a bigger value means higher throughput and better
compatibility but more memory. Most of time we should NOT change the default value unless special
reason, e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the
recommended value is 9~12. If PSRAM is used and WiFi memory is prefered to allocat in PSRAM first,
recommended value is 9~12. If PSRAM is used and WiFi memory is preferred to allocate in PSRAM first,
the default and minimum value should be 16 to achieve better throughput and compatibility with both
stations and APs.
@ -231,14 +246,14 @@ menu "Wi-Fi"
help
ESP-MESH utilizes beacon frames to detect and resolve root node conflicts (see documentation). However
the default length of a beacon frame can simultaneously hold only five root node identifier structures,
meaning that a root node conflict of up to five nodes can be detected at one time. In the occurence of
meaning that a root node conflict of up to five nodes can be detected at one time. In the occurrence of
more root nodes conflict involving more than five root nodes, the conflict resolution process will
detect five of the root nodes, resolve the conflict, and re-detect more root nodes. This process will
repeat until all root node conflicts are resolved. However this process can generally take a very long
time.
To counter this situation, the beacon frame length can be increased such that more root nodes can be
detected simultaneously. Each additional root node will require 36 bytes and should be added ontop of
detected simultaneously. Each additional root node will require 36 bytes and should be added on top of
the default beacon frame length of
752 bytes. For example, if you want to detect 10 root nodes simultaneously, you need to set the beacon
frame length as
@ -490,9 +505,9 @@ menu "Wi-Fi"
help
Select this option to use MbedTLS TLS client for WPA2 enterprise connection.
Please note that from MbedTLS-3.0 onwards, MbedTLS does not support SSL-3.0
TLS-v1.0, TLS-v1.1 versions. Incase your server is using one of these version,
TLS-v1.0, TLS-v1.1 versions. In case your server is using one of these version,
it is advisable to update your server.
Please disable this option for compatibilty with older TLS versions.
Please disable this option for compatibility with older TLS versions.
config ESP_WIFI_EAP_TLS1_3
bool "Enable EAP-TLS v1.3 Support for WiFi Enterprise connection"
@ -600,7 +615,7 @@ menu "Wi-Fi"
default n
help
Select this option to enable validate each WPS attribute
rigorously. Disabling this add the workaorunds with various APs.
rigorously. Disabling this add the workarounds with various APs.
Enabling this may cause inter operability issues with some APs.
config ESP_WIFI_WPS_PASSPHRASE
@ -608,9 +623,9 @@ menu "Wi-Fi"
default n
help
Select this option to get passphrase during WPS configuration.
This option fakes the virtual display capabilites to get the
This option fakes the virtual display capabilities to get the
configuration in passphrase mode.
Not recommanded to be used since WPS credentials should not
Not recommended to be used since WPS credentials should not
be shared to other devices, making it in readable format increases
that risk, also passphrase requires pbkdf2 to convert in psk.

Wyświetl plik

@ -0,0 +1,754 @@
/*
* SPDX-FileCopyrightText: 2022-2024 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/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"
#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"
#include "esp32p4/rom/ets_sys.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 )
{
#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
}
/*
If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
If failed, try to allocate it in internal memory then.
*/
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
}
/*
If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
If failed, try to allocate it in internal memory then.
*/
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)
{
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;
}
#if CONFIG_SPIRAM_USE_MALLOC
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);
}
}
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_FAIL;
}
static int coex_init_wrapper(void)
{
return 0;
}
static void coex_deinit_wrapper(void)
{
}
static int coex_enable_wrapper(void)
{
return 0;
}
static void coex_disable_wrapper(void)
{
}
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
{
return 0;
}
static int coex_wifi_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration)
{
return 0;
}
static IRAM_ATTR int coex_wifi_release_wrapper(uint32_t event)
{
return 0;
}
static int coex_wifi_channel_set_wrapper(uint8_t primary, uint8_t secondary)
{
return 0;
}
static IRAM_ATTR int coex_event_duration_get_wrapper(uint32_t event, uint32_t *duration)
{
return 0;
}
static int coex_pti_get_wrapper(uint32_t event, uint8_t *pti)
{
return 0;
}
static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status)
{
}
static void coex_schm_status_bit_set_wrapper(uint32_t type, uint32_t status)
{
}
static IRAM_ATTR int coex_schm_interval_set_wrapper(uint32_t interval)
{
return 0;
}
static uint32_t coex_schm_interval_get_wrapper(void)
{
return 0;
}
static uint8_t coex_schm_curr_period_get_wrapper(void)
{
return 0;
}
static void *coex_schm_curr_phase_get_wrapper(void)
{
return NULL;
}
static int coex_register_start_cb_wrapper(int (* cb)(void))
{
return 0;
}
static int coex_schm_process_restart_wrapper(void)
{
return 0;
}
static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
{
return 0;
}
static void IRAM_ATTR esp_empty_wrapper(void)
{
}
static void esp_phy_enable_wrapper(void)
{
// esp_phy_enable(PHY_MODEM_WIFI);
// phy_wifi_enable_set(1);
}
static void esp_phy_disable_wrapper(void)
{
// phy_wifi_enable_set(0);
// esp_phy_disable(PHY_MODEM_WIFI);
}
void esp_phy_disable(void)
{
}
void esp_phy_enable(void)
{
}
void esp_phy_common_clock_enable(void)
{
}
void esp_phy_common_clock_disable(void)
{
}
esp_err_t esp_phy_update_country_info(const char *country)
{
return ESP_OK;
}
bool IRAM_ATTR esp_coex_common_env_is_chip_wrapper(void)
{
#ifdef CONFIG_IDF_ENV_FPGA
return false;
#else
return true;
#endif
}
void * esp_coex_common_spin_lock_create_wrapper(void)
{
portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED;
void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL);
if (mux) {
memcpy(mux,&tmp,sizeof(portMUX_TYPE));
return mux;
}
return NULL;
}
uint32_t IRAM_ATTR esp_coex_common_int_disable_wrapper(void *wifi_int_mux)
{
if (xPortInIsrContext()) {
portENTER_CRITICAL_ISR(wifi_int_mux);
} else {
portENTER_CRITICAL(wifi_int_mux);
}
return 0;
}
void IRAM_ATTR esp_coex_common_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp)
{
if (xPortInIsrContext()) {
portEXIT_CRITICAL_ISR(wifi_int_mux);
} else {
portEXIT_CRITICAL(wifi_int_mux);
}
}
void IRAM_ATTR esp_coex_common_task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
}
void * esp_coex_common_semphr_create_wrapper(uint32_t max, uint32_t init)
{
return (void *)xSemaphoreCreateCounting(max, init);
}
void esp_coex_common_semphr_delete_wrapper(void *semphr)
{
vSemaphoreDelete(semphr);
}
int32_t esp_coex_common_semphr_take_wrapper(void *semphr, uint32_t block_time_tick)
{
if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY);
} else {
return (int32_t)xSemaphoreTake(semphr, block_time_tick);
}
}
int32_t esp_coex_common_semphr_give_wrapper(void *semphr)
{
return (int32_t)xSemaphoreGive(semphr);
}
void IRAM_ATTR esp_coex_common_timer_disarm_wrapper(void *timer)
{
ets_timer_disarm(timer);
}
void esp_coex_common_timer_done_wrapper(void *ptimer)
{
ets_timer_done(ptimer);
}
void esp_coex_common_timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
{
ets_timer_setfn(ptimer, pfunction, parg);
}
void IRAM_ATTR esp_coex_common_timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat)
{
ets_timer_arm_us(ptimer, us, repeat);
}
void * IRAM_ATTR esp_coex_common_malloc_internal_wrapper(size_t size)
{
return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
}
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_common_clock_enable = esp_phy_common_clock_enable,
._phy_common_clock_disable = esp_phy_common_clock_disable,
._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,
._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,
._coex_schm_process_restart = coex_schm_process_restart_wrapper,
._coex_schm_register_cb = coex_schm_register_cb_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};

Wyświetl plik

@ -81,7 +81,7 @@ typedef struct wifi_osi_funcs_t {
void (* _wifi_apb80m_release)(void);
void (* _phy_disable)(void);
void (* _phy_enable)(void);
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_ESP_WIFI_TARGET_ESP32
void (* _phy_common_clock_enable)(void);
void (* _phy_common_clock_disable)(void);
#endif
@ -113,7 +113,7 @@ typedef struct wifi_osi_funcs_t {
int (* _get_random)(uint8_t *buf, size_t len);
int (* _get_time)(void *t);
unsigned long (* _random)(void);
#if !CONFIG_IDF_TARGET_ESP32
#if !CONFIG_IDF_TARGET_ESP32 && !CONFIG_ESP_WIFI_TARGET_ESP32
uint32_t (* _slowclk_cal_get)(void);
#endif
void (* _log_write)(unsigned int level, const char* tag, const char* format, ...);

@ -1 +1 @@
Subproject commit 4eac0d1c3d5e0663949b5c0364e7612d423d6205
Subproject commit 1fbf7cd43098b06be5afe9226eb483c6998d46f1

Wyświetl plik

@ -0,0 +1,106 @@
/*
* SPDX-FileCopyrightText: 2016-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file lib_printf.c
*
* This file contains library-specific printf functions
* used by WiFi libraries in the `lib` directory.
* These function are used to catch any output which gets printed
* by libraries, and redirect it to ESP_LOG macros.
*
* Eventually WiFi libraries will use ESP_LOG functions internally
* and these definitions will be removed.
*/
#include <stdio.h>
#include <stdlib.h>
#include "esp_log.h"
#include "esp_attr.h"
#define VPRINTF_STACK_BUFFER_SIZE 80
static int lib_printf(const char* tag, const char* format, va_list arg)
{
char temp[VPRINTF_STACK_BUFFER_SIZE];
int len = vsnprintf(temp, sizeof(temp) - 1, format, arg);
temp[sizeof(temp) - 1] = 0;
int i;
for (i = len - 1; i >= 0; --i) {
if (temp[i] != '\n' && temp[i] != '\r' && temp[i] != ' ') {
break;
}
temp[i] = 0;
}
if (i > 0) {
ESP_LOGI(tag, "%s", temp);
}
va_end(arg);
return len;
}
int pp_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("pp", format, arg);
va_end(arg);
return res;
}
int sc_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("smartconfig", format, arg);
va_end(arg);
return res;
}
int core_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("core", format, arg);
va_end(arg);
return res;
}
int net80211_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("net80211", format, arg);
va_end(arg);
return res;
}
int target_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("target", format, arg);
va_end(arg);
return res;
}
int wapi_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("wapi", format, arg);
va_end(arg);
return res;
}
int mesh_printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
int res = lib_printf("mesh", format, arg);
va_end(arg);
return res;
}

Wyświetl plik

@ -17,7 +17,9 @@
#include "esp_private/esp_clk.h"
#include "esp_wpa.h"
#include "esp_netif.h"
#ifdef CONFIG_ESP_COEX_ENABLED
#include "private/esp_coexist_internal.h"
#endif
#ifdef CONFIG_ESP_PHY_ENABLED
#include "esp_phy_init.h"
#include "esp_private/phy.h"

Wyświetl plik

@ -187,7 +187,7 @@
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM: 1, 3, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 21, 22, 23)
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0xEF0FEAULL
// The Clock Out singnal is binding to the pin's IO_MUX function
// The Clock Out signal is binding to the pin's IO_MUX function
#define SOC_GPIO_CLOCKOUT_BY_IO_MUX (1)
/*-------------------------- I2C CAPS ----------------------------------------*/

Wyświetl plik

@ -136,7 +136,7 @@
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_6~GPIO_NUM_20)
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00000000001FFFC0ULL
// The Clock Out singnal is route to the pin by GPIO matrix
// The Clock Out signal is route to the pin by GPIO matrix
#define SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX (1)
/*-------------------------- Dedicated GPIO CAPS -----------------------------*/

Wyświetl plik

@ -174,7 +174,7 @@
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_6~GPIO_NUM_21)
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00000000003FFFC0ULL
// The Clock Out singnal is route to the pin by GPIO matrix
// The Clock Out signal is route to the pin by GPIO matrix
#define SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX (1)
/*-------------------------- Dedicated GPIO CAPS -----------------------------*/

Wyświetl plik

@ -212,7 +212,7 @@
// Support to hold a single digital I/O when the digital domain is powered off
#define SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP (1)
// The Clock Out singnal is route to the pin by GPIO matrix
// The Clock Out signal is route to the pin by GPIO matrix
#define SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX (1)
#define SOC_CLOCKOUT_HAS_SOURCE_GATE (1)
@ -511,7 +511,7 @@
#define SOC_PM_SUPPORT_BEACON_WAKEUP (1)
#define SOC_PM_SUPPORT_BT_WAKEUP (1)
#define SOC_PM_SUPPORT_EXT1_WAKEUP (1)
#define SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN (1) /*!<Supports one bit per pin to configue the EXT1 trigger level */
#define SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN (1) /*!<Supports one bit per pin to configure the EXT1 trigger level */
#define SOC_PM_SUPPORT_CPU_PD (1)
#define SOC_PM_SUPPORT_MODEM_PD (1)
#define SOC_PM_SUPPORT_XTAL32K_PD (1)

Wyświetl plik

@ -7,10 +7,6 @@ config SOC_UART_SUPPORTED
bool
default y
config SOC_PHY_SUPPORTED
bool
default y
config SOC_SUPPORTS_SECURE_DL_MODE
bool
default y

Wyświetl plik

@ -28,7 +28,6 @@
// #define SOC_ASYNC_MEMCPY_SUPPORTED 1 //TODO: [ESP32C61] IDF-9315
// #define SOC_USB_SERIAL_JTAG_SUPPORTED 1 //TODO: [ESP32C61] IDF-9319
// #define SOC_TEMP_SENSOR_SUPPORTED 1 //TODO: [ESP32C61] IDF-9322
#define SOC_PHY_SUPPORTED 1
// #define SOC_WIFI_SUPPORTED 1
#define SOC_SUPPORTS_SECURE_DL_MODE 1
// #define SOC_ULP_SUPPORTED 1
@ -213,7 +212,7 @@
// Support to hold a single digital I/O when the digital domain is powered off
#define SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP (1)
// The Clock Out singnal is route to the pin by GPIO matrix
// The Clock Out signal is route to the pin by GPIO matrix
#define SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX (1)
/*-------------------------- RTCIO CAPS --------------------------------------*/
@ -506,7 +505,7 @@
#define SOC_PM_SUPPORT_BEACON_WAKEUP (1)
#define SOC_PM_SUPPORT_BT_WAKEUP (1)
#define SOC_PM_SUPPORT_EXT1_WAKEUP (1)
#define SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN (1) /*!<Supports one bit per pin to configue the EXT1 trigger level */
#define SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN (1) /*!<Supports one bit per pin to configure the EXT1 trigger level */
// #define SOC_PM_SUPPORT_CPU_PD (1)
#define SOC_PM_SUPPORT_MODEM_PD (1)
#define SOC_PM_SUPPORT_XTAL32K_PD (1)

Wyświetl plik

@ -213,7 +213,7 @@
// Support to hold a single digital I/O when the digital domain is powered off
#define SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP (1)
// The Clock Out singnal is route to the pin by GPIO matrix
// The Clock Out signal is route to the pin by GPIO matrix
#define SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX (1)
#define SOC_CLOCKOUT_HAS_SOURCE_GATE (1)
@ -497,7 +497,7 @@
/*-------------------------- Power Management CAPS ----------------------------*/
#define SOC_PM_SUPPORT_BT_WAKEUP (1)
#define SOC_PM_SUPPORT_EXT1_WAKEUP (1)
#define SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN (1) /*!<Supports one bit per pin to configue the EXT1 trigger level */
#define SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN (1) /*!<Supports one bit per pin to configure the EXT1 trigger level */
#define SOC_PM_SUPPORT_CPU_PD (1)
#define SOC_PM_SUPPORT_MODEM_PD (1) /*!<modem includes BLE and 15.4 */
#define SOC_PM_SUPPORT_XTAL32K_PD (1)

Wyświetl plik

@ -75,6 +75,10 @@ config SOC_USB_OTG_SUPPORTED
bool
default y
config SOC_WIRELESS_HOST_SUPPORTED
bool
default y
config SOC_TEMP_SENSOR_SUPPORTED
bool
default y

Wyświetl plik

@ -38,6 +38,7 @@
#define SOC_ASYNC_MEMCPY_SUPPORTED 1
#define SOC_EMAC_SUPPORTED 1
#define SOC_USB_OTG_SUPPORTED 1
#define SOC_WIRELESS_HOST_SUPPORTED 1
// disable usb serial jtag for esp32p4, current image does not support
// #define SOC_USB_SERIAL_JTAG_SUPPORTED 1 //TODO: IDF-7496
#define SOC_TEMP_SENSOR_SUPPORTED 1

Wyświetl plik

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -176,7 +176,7 @@
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_26~GPIO_NUM_46)
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00007FFFFC000000ULL
// The Clock Out singnal is binding to the pin's IO_MUX function
// The Clock Out signal is binding to the pin's IO_MUX function
#define SOC_GPIO_CLOCKOUT_BY_IO_MUX (1)
/*-------------------------- Dedicated GPIO CAPS ---------------------------------------*/
@ -255,7 +255,7 @@
#define SOC_RMT_MEM_WORDS_PER_CHANNEL 64 /*!< Each channel owns 64 words memory (1 word = 4 Bytes) */
#define SOC_RMT_SUPPORT_RX_DEMODULATION 1 /*!< Support signal demodulation on RX path (i.e. remove carrier) */
#define SOC_RMT_SUPPORT_TX_ASYNC_STOP 1 /*!< Support stop transmission asynchronously */
#define SOC_RMT_SUPPORT_TX_LOOP_COUNT 1 /*!< Support transmiting specified number of cycles in loop mode */
#define SOC_RMT_SUPPORT_TX_LOOP_COUNT 1 /*!< Support transmitting specified number of cycles in loop mode */
#define SOC_RMT_SUPPORT_TX_SYNCHRO 1 /*!< Support coordinate a group of TX channels to start simultaneously */
#define SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY 1 /*!< TX carrier can be modulated to data phase only */
#define SOC_RMT_SUPPORT_REF_TICK 1 /*!< Support set REF_TICK as the RMT clock source */

Wyświetl plik

@ -184,7 +184,7 @@
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_26~GPIO_NUM_48)
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x0001FFFFFC000000ULL
// The Clock Out singnal is binding to the pin's IO_MUX function
// The Clock Out signal is binding to the pin's IO_MUX function
#define SOC_GPIO_CLOCKOUT_BY_IO_MUX (1)
/*-------------------------- Dedicated GPIO CAPS -----------------------------*/

Wyświetl plik

@ -6,7 +6,7 @@ else()
set(linker_fragments linker.lf)
endif()
if(NOT CONFIG_ESP_WIFI_ENABLED AND NOT CMAKE_BUILD_EARLY_EXPANSION)
if(NOT CONFIG_ESP_WIFI_ENABLED AND NOT CONFIG_ESP_HOST_WIFI_ENABLED AND NOT CMAKE_BUILD_EARLY_EXPANSION)
# This component provides only "esp_supplicant" headers if WiFi not enabled
# (implementation supported optionally in a managed component esp_wifi_remote)
idf_component_register(INCLUDE_DIRS esp_supplicant/include)

Wyświetl plik

@ -121,7 +121,7 @@ void wifi_init_sta(void)
.sta = {
.ssid = EXAMPLE_ESP_WIFI_SSID,
.password = EXAMPLE_ESP_WIFI_PASS,
/* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (pasword len => 8).
/* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (password len => 8).
* If you want to connect the device to deprecated WEP/WPA networks, Please set the threshold value
* to WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK and set the password with length and format matching to
* WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK standards.