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)
|
2019-11-26 04:48:38 -05:00
|
|
|
set(priv_requires)
|
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)
|
2019-12-23 04:06:02 -05:00
|
|
|
set(srcs "src/esp_eth.c" "src/esp_eth_phy.c")
|
2019-08-13 01:11:46 -04:00
|
|
|
set(include "include")
|
2021-04-19 03:05:29 -04:00
|
|
|
set(priv_requires "driver" "log" "esp_timer") # require "driver" for using some GPIO APIs
|
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")
|
2020-07-21 05:15:19 -04:00
|
|
|
list(APPEND priv_requires esp_netif esp_pm)
|
2020-01-09 06:32:51 -05:00
|
|
|
endif()
|
2019-11-26 04:48:38 -05:00
|
|
|
endif()
|
2019-08-13 01:11:46 -04:00
|
|
|
|
|
|
|
if(CONFIG_ETH_USE_ESP32_EMAC)
|
2021-04-01 08:00:54 -04:00
|
|
|
list(APPEND srcs "src/esp_eth_mac_esp.c"
|
2019-11-13 23:03:14 -05:00
|
|
|
"src/esp_eth_phy_dp83848.c"
|
|
|
|
"src/esp_eth_phy_ip101.c"
|
2021-03-15 00:50:39 -04:00
|
|
|
"src/esp_eth_phy_ksz80xx.c"
|
2019-11-13 23:03:14 -05:00
|
|
|
"src/esp_eth_phy_lan8720.c"
|
|
|
|
"src/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)
|
|
|
|
list(APPEND srcs "src/esp_eth_mac_dm9051.c"
|
2019-11-13 23:03:14 -05:00
|
|
|
"src/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)
|
|
|
|
list(APPEND srcs "src/esp_eth_mac_w5500.c"
|
|
|
|
"src/esp_eth_phy_w5500.c")
|
|
|
|
endif()
|
|
|
|
|
2021-02-28 22:39:23 -05:00
|
|
|
if(CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL)
|
|
|
|
list(APPEND srcs "src/esp_eth_mac_ksz8851snl.c"
|
|
|
|
"src/esp_eth_phy_ksz8851snl.c")
|
|
|
|
endif()
|
|
|
|
|
2019-11-13 23:03:14 -05:00
|
|
|
if(CONFIG_ETH_USE_OPENETH)
|
|
|
|
list(APPEND srcs "src/esp_eth_mac_openeth.c")
|
|
|
|
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}
|
2019-11-26 04:48:38 -05:00
|
|
|
REQUIRES "esp_event" # For using "ESP_EVENT_DECLARE_BASE" in header file
|
|
|
|
PRIV_REQUIRES ${priv_requires})
|
|
|
|
|
|
|
|
# uses C11 atomic feature
|
|
|
|
set_source_files_properties(src/esp_eth.c PROPERTIES COMPILE_FLAGS -std=gnu11)
|