From 3e9d2155eb4701cd4a2b756665137d0d6236fbe0 Mon Sep 17 00:00:00 2001 From: Omar Chebib Date: Tue, 22 Aug 2023 19:08:19 +0800 Subject: [PATCH] feat(esp_eth): add opencores ethernet support for ESP32-C3 (QEMU) target --- components/esp_eth/CMakeLists.txt | 3 ++- components/esp_eth/src/esp_openeth.h | 24 ++++++++++++++++++++++++ components/esp_eth/src/openeth.h | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 components/esp_eth/src/esp_openeth.h diff --git a/components/esp_eth/CMakeLists.txt b/components/esp_eth/CMakeLists.txt index 5b8c7c57203..7701396bb5e 100644 --- a/components/esp_eth/CMakeLists.txt +++ b/components/esp_eth/CMakeLists.txt @@ -44,7 +44,8 @@ if(CONFIG_ETH_ENABLED) endif() if(CONFIG_ETH_USE_OPENETH) - list(APPEND srcs "src/esp_eth_mac_openeth.c") + list(APPEND srcs "src/esp_eth_mac_openeth.c" + "src/esp_eth_phy_dp83848.c") endif() endif() diff --git a/components/esp_eth/src/esp_openeth.h b/components/esp_eth/src/esp_openeth.h new file mode 100644 index 00000000000..f4d10ea3b85 --- /dev/null +++ b/components/esp_eth/src/esp_openeth.h @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "sdkconfig.h" +#include "soc/interrupts.h" + +#if CONFIG_IDF_TARGET_ESP32C3 + +/** + * @brief Since ESP32-C3 target in QEMU doesn't support Wifi, re-use its interrupt source for ethernet + */ +#define ETS_ETH_MAC_INTR_SOURCE ETS_WIFI_MAC_INTR_SOURCE + + +/** + * @brief Use an empty I/O range for the ethernet registers + */ +#define DR_REG_EMAC_BASE 0x600CD000 + +#endif // CONFIG_IDF_TARGET_ESP32C3 diff --git a/components/esp_eth/src/openeth.h b/components/esp_eth/src/openeth.h index d7e4be23108..da1e25a0d5d 100644 --- a/components/esp_eth/src/openeth.h +++ b/components/esp_eth/src/openeth.h @@ -10,6 +10,7 @@ #include #include "sdkconfig.h" #include "soc/soc.h" +#include "esp_openeth.h" #include "esp_assert.h" #ifdef __cplusplus