2023-08-28 02:02:08 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
|
|
|
if(${target} STREQUAL "linux")
|
|
|
|
return() # This component is not supported by the POSIX/Linux simulator
|
|
|
|
endif()
|
|
|
|
|
2019-11-26 04:48:38 -05:00
|
|
|
idf_build_get_property(components_to_build BUILD_COMPONENTS)
|
|
|
|
|
2019-11-13 23:03:14 -05:00
|
|
|
set(srcs)
|
2019-08-13 01:11:46 -04:00
|
|
|
set(include)
|
2023-09-01 12:27:04 -04:00
|
|
|
set(ld_fragments linker.lf)
|
2022-01-28 06:47:04 -05:00
|
|
|
# As CONFIG_ETH_ENABLED comes from Kconfig, it is not evaluated yet
|
|
|
|
# when components are being registered.
|
|
|
|
# Thus, always add the (private) requirements, regardless of Kconfig
|
2024-04-26 06:27:54 -04:00
|
|
|
set(priv_requires log esp_timer esp_driver_spi esp_driver_gpio)
|
2019-04-10 04:24:50 -04:00
|
|
|
|
2019-11-13 23:03:14 -05:00
|
|
|
# If Ethernet disabled in Kconfig, this is a config-only component
|
2019-08-13 01:11:46 -04:00
|
|
|
if(CONFIG_ETH_ENABLED)
|
2024-04-26 06:27:54 -04:00
|
|
|
set(srcs "src/esp_eth.c" "src/phy/esp_eth_phy_802_3.c")
|
2019-08-13 01:11:46 -04:00
|
|
|
set(include "include")
|
2019-11-26 04:48:38 -05:00
|
|
|
|
2020-01-09 06:32:51 -05:00
|
|
|
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
|
|
|
|
# esp_netif related
|
|
|
|
if(esp_netif IN_LIST components_to_build)
|
|
|
|
list(APPEND srcs "src/esp_eth_netif_glue.c")
|
|
|
|
endif()
|
2019-11-26 04:48:38 -05:00
|
|
|
endif()
|
2019-08-13 01:11:46 -04:00
|
|
|
|
|
|
|
if(CONFIG_ETH_USE_ESP32_EMAC)
|
2024-04-26 06:27:54 -04:00
|
|
|
list(APPEND srcs "src/mac/esp_eth_mac_esp.c"
|
|
|
|
"src/mac/esp_eth_mac_esp_dma.c"
|
|
|
|
"src/mac/esp_eth_mac_esp_gpio.c"
|
|
|
|
"src/phy/esp_eth_phy_dp83848.c"
|
|
|
|
"src/phy/esp_eth_phy_ip101.c"
|
|
|
|
"src/phy/esp_eth_phy_ksz80xx.c"
|
|
|
|
"src/phy/esp_eth_phy_lan87xx.c"
|
|
|
|
"src/phy/esp_eth_phy_rtl8201.c")
|
2019-08-13 01:11:46 -04:00
|
|
|
endif()
|
2019-04-10 04:24:50 -04:00
|
|
|
|
2019-08-13 01:11:46 -04:00
|
|
|
if(CONFIG_ETH_SPI_ETHERNET_DM9051)
|
2024-04-26 06:27:54 -04:00
|
|
|
list(APPEND srcs "src/spi/dm9051/esp_eth_mac_dm9051.c"
|
|
|
|
"src/spi/dm9051/esp_eth_phy_dm9051.c")
|
2019-08-13 01:11:46 -04:00
|
|
|
endif()
|
2019-06-25 07:36:56 -04:00
|
|
|
|
2020-11-05 23:17:18 -05:00
|
|
|
if(CONFIG_ETH_SPI_ETHERNET_W5500)
|
2024-04-26 06:27:54 -04:00
|
|
|
list(APPEND srcs "src/spi/w5500/esp_eth_mac_w5500.c"
|
|
|
|
"src/spi/w5500/esp_eth_phy_w5500.c")
|
2020-11-05 23:17:18 -05:00
|
|
|
endif()
|
|
|
|
|
2021-02-28 22:39:23 -05:00
|
|
|
if(CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL)
|
2024-04-26 06:27:54 -04:00
|
|
|
list(APPEND srcs "src/spi/ksz8851snl/esp_eth_mac_ksz8851snl.c"
|
|
|
|
"src/spi/ksz8851snl/esp_eth_phy_ksz8851snl.c")
|
2021-02-28 22:39:23 -05:00
|
|
|
endif()
|
|
|
|
|
2019-11-13 23:03:14 -05:00
|
|
|
if(CONFIG_ETH_USE_OPENETH)
|
2024-04-26 06:27:54 -04:00
|
|
|
list(APPEND srcs "src/openeth/esp_eth_mac_openeth.c"
|
|
|
|
"src/phy/esp_eth_phy_dp83848.c")
|
2019-11-13 23:03:14 -05:00
|
|
|
endif()
|
2019-10-01 12:50:34 -04:00
|
|
|
endif()
|
|
|
|
|
2019-08-13 01:11:46 -04:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
2019-11-13 23:03:14 -05:00
|
|
|
INCLUDE_DIRS ${include}
|
2023-09-01 12:27:04 -04:00
|
|
|
LDFRAGMENTS ${ld_fragments}
|
2022-06-23 06:13:50 -04:00
|
|
|
REQUIRES esp_event # For using "ESP_EVENT_DECLARE_BASE" in header file
|
2019-11-26 04:48:38 -05:00
|
|
|
PRIV_REQUIRES ${priv_requires})
|
2022-06-23 06:13:50 -04:00
|
|
|
|
2022-05-11 10:01:48 -04:00
|
|
|
if(CONFIG_ETH_ENABLED)
|
|
|
|
if(CONFIG_ETH_USE_SPI_ETHERNET)
|
2024-04-26 06:27:54 -04:00
|
|
|
idf_component_optional_requires(PUBLIC esp_driver_spi)
|
2022-05-11 10:01:48 -04:00
|
|
|
endif()
|
2024-05-31 07:08:46 -04:00
|
|
|
idf_component_optional_requires(PRIVATE esp_netif esp_pm esp_mm)
|
2022-06-23 06:13:50 -04:00
|
|
|
endif()
|