diff --git a/components/esp_wifi/esp32p4/esp_adapter.c b/components/esp_wifi/esp32p4/esp_adapter.c index a1d525e74a..4def952a2c 100644 --- a/components/esp_wifi/esp32p4/esp_adapter.c +++ b/components/esp_wifi/esp32p4/esp_adapter.c @@ -53,6 +53,10 @@ extern void wifi_apb80m_request(void); extern void wifi_apb80m_release(void); #endif +#if CONFIG_ESP_EXT_CONN_ENABLE +extern uint8_t *esp_extconn_get_mac(void); +#endif + IRAM_ATTR void *wifi_malloc(size_t size) { #if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP @@ -427,7 +431,26 @@ static void esp_log_write_wrapper(unsigned int level, const char *tag, const cha static esp_err_t esp_read_mac_wrapper(uint8_t *mac, unsigned int type) { + if (mac == NULL) { + ESP_LOGE(TAG, "mac address param is NULL"); + return ESP_ERR_INVALID_ARG; + } + + // get mac address from target +#if CONFIG_ESP_EXT_CONN_ENABLE + memcpy(mac, esp_extconn_get_mac(), 6); +#else + ESP_LOGE(TAG, "Not support read mac"); return ESP_FAIL; +#endif + + if (type == ESP_MAC_WIFI_SOFTAP) { + mac[5] += 1; + } + + ESP_LOGD(TAG, "%s MAC addr: " MACSTR, (type == ESP_MAC_WIFI_STA ? "STA" : "AP"), MAC2STR(mac)); + + return ESP_OK; } static int coex_init_wrapper(void) diff --git a/examples/wifi/.build-test-rules.yml b/examples/wifi/.build-test-rules.yml index 1a6e8bc6d6..2d36717070 100644 --- a/examples/wifi/.build-test-rules.yml +++ b/examples/wifi/.build-test-rules.yml @@ -39,9 +39,10 @@ examples/wifi/getting_started: examples/wifi/iperf: disable: - - if: SOC_WIFI_SUPPORTED != 1 + - if: (SOC_WIFI_SUPPORTED != 1) and (SOC_WIRELESS_HOST_SUPPORTED != 1) + - if: (IDF_TARGET == "esp32p4") and CONFIG_NAME in ["defaults", "99"] disable_test: - - if: IDF_TARGET != "esp32" + - if: IDF_TARGET not in ["esp32"] temporary: true reason: lack of runners depends_components: diff --git a/examples/wifi/iperf/README.md b/examples/wifi/iperf/README.md index b42b7c4440..0287fa9d0d 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-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | # Iperf Example diff --git a/examples/wifi/iperf/main/idf_component.yml b/examples/wifi/iperf/main/idf_component.yml index fa9a6e59d6..fdb795321d 100644 --- a/examples/wifi/iperf/main/idf_component.yml +++ b/examples/wifi/iperf/main/idf_component.yml @@ -7,3 +7,7 @@ dependencies: version: "~0.1.0" esp-qa/ping-cmd: version: "~0.0.1" + espressif/esp-extconn: + version: "~0.1.0" + rules: + - if: "target in [esp32p4]" diff --git a/examples/wifi/iperf/main/iperf_example_main.c b/examples/wifi/iperf/main/iperf_example_main.c index a856e20ebc..a7d8bbea97 100644 --- a/examples/wifi/iperf/main/iperf_example_main.c +++ b/examples/wifi/iperf/main/iperf_example_main.c @@ -35,6 +35,9 @@ extern int wifi_cmd_get_rx_statistics(int argc, char **argv); extern int wifi_cmd_clr_rx_statistics(int argc, char **argv); #endif +#ifdef CONFIG_ESP_EXT_CONN_ENABLE +#include "esp_extconn.h" +#endif void iperf_hook_show_wifi_stats(iperf_traffic_type_t type, iperf_status_t status) { @@ -69,6 +72,11 @@ void iperf_hook_show_wifi_stats(iperf_traffic_type_t type, iperf_status_t status void app_main(void) { +#if CONFIG_ESP_EXT_CONN_ENABLE + esp_extconn_config_t ext_config = ESP_EXTCONN_CONFIG_DEFAULT(); + esp_extconn_init(&ext_config); +#endif + esp_err_t ret = nvs_flash_init(); if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { ESP_ERROR_CHECK(nvs_flash_erase()); diff --git a/examples/wifi/iperf/sdkconfig.ci.esp32p4_with_extconn b/examples/wifi/iperf/sdkconfig.ci.esp32p4_with_extconn new file mode 100644 index 0000000000..f675f0a416 --- /dev/null +++ b/examples/wifi/iperf/sdkconfig.ci.esp32p4_with_extconn @@ -0,0 +1,6 @@ +# +# ESP32-P4 +# +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESP_HOST_WIFI_ENABLED=y +CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y