From 680f3a50c2076b63ebd5c3be72e8508f0985f112 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Thu, 9 Jun 2022 09:48:20 +0200 Subject: [PATCH 1/4] esp_eth: Rename drivers main header to esp_eth_driver The original would be used as API header bringing both driver and netif related includes --- components/esp_eth/include/{esp_eth.h => esp_eth_driver.h} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename components/esp_eth/include/{esp_eth.h => esp_eth_driver.h} (100%) diff --git a/components/esp_eth/include/esp_eth.h b/components/esp_eth/include/esp_eth_driver.h similarity index 100% rename from components/esp_eth/include/esp_eth.h rename to components/esp_eth/include/esp_eth_driver.h From 5e19b9c9518ae253d82400ab24b86af8af832425 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 2 May 2022 15:47:05 +0200 Subject: [PATCH 2/4] esp-netif: Make dependency on esp-eth optional * esp-netif to optionally depend on esp-eth (only for l2tap config) * esp_eth.h now includes the original ethernet header and the ethernet-netif glue layer * Updated examples and test to explicitely use esp-eth dependency if needed --- components/esp_eth/include/esp_eth.h | 16 ++++++++++++++++ components/esp_netif/CMakeLists.txt | 13 +++++++++++-- components/esp_netif/esp_netif_defaults.c | 3 --- components/esp_netif/include/esp_netif.h | 4 ---- components/esp_netif/test/CMakeLists.txt | 2 +- components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c | 3 +-- components/mdns/CMakeLists.txt | 4 ++++ components/mdns/mdns.c | 4 ++++ components/mqtt/test/CMakeLists.txt | 2 +- .../protocol_examples_common/CMakeLists.txt | 2 +- .../include/protocol_examples_common.h | 1 + .../components/eth_enc28j60/CMakeLists.txt | 2 +- .../ethernet/eth2ap/main/ethernet_example_main.c | 2 +- .../network/simple_sniffer/main/cmd_sniffer.h | 2 ++ 14 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 components/esp_eth/include/esp_eth.h diff --git a/components/esp_eth/include/esp_eth.h b/components/esp_eth/include/esp_eth.h new file mode 100644 index 0000000000..d37353550b --- /dev/null +++ b/components/esp_eth/include/esp_eth.h @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +/** + * Purpose of this file is to create a common header for the typical ethernet usecase, + * so using the ethernet driver and the default glue layer to its network interface. + * + * If you prefer to create a custom network interface or use the Ethernet as a driver only, + * then it is recommended to include the "esp_eth_driver.h" only. + */ +#include "esp_eth_driver.h" +#include "esp_eth_netif_glue.h" diff --git a/components/esp_netif/CMakeLists.txt b/components/esp_netif/CMakeLists.txt index 44c9ef8e0d..c18bd3552b 100644 --- a/components/esp_netif/CMakeLists.txt +++ b/components/esp_netif/CMakeLists.txt @@ -10,7 +10,6 @@ set(srcs "esp_netif_handlers.c" "esp_netif_objects.c" "esp_netif_defaults.c" - "vfs_l2tap/esp_vfs_l2tap.c" "lwip/esp_netif_lwip.c" "lwip/esp_netif_lwip_defaults.c" "lwip/esp_netif_sta_list.c") @@ -33,7 +32,17 @@ list(APPEND srcs "loopback/esp_netif_loopback.c") endif() +if(CONFIG_ESP_NETIF_L2_TAP) +list(APPEND srcs + "vfs_l2tap/esp_vfs_l2tap.c") +endif() + idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}" - REQUIRES lwip esp_eth) + REQUIRES lwip) + + +if(CONFIG_ESP_NETIF_L2_TAP) +idf_component_optional_requires(PRIVATE esp_eth) +endif() diff --git a/components/esp_netif/esp_netif_defaults.c b/components/esp_netif/esp_netif_defaults.c index 3a1297da18..70cefa4961 100644 --- a/components/esp_netif/esp_netif_defaults.c +++ b/components/esp_netif/esp_netif_defaults.c @@ -6,9 +6,6 @@ #include "esp_netif.h" #include "esp_wifi_default.h" -#if CONFIG_ETH_ENABLED -#include "esp_eth.h" -#endif // // Purpose of this module is to provide diff --git a/components/esp_netif/include/esp_netif.h b/components/esp_netif/include/esp_netif.h index d0d076626e..bd0f2847b5 100644 --- a/components/esp_netif/include/esp_netif.h +++ b/components/esp_netif/include/esp_netif.h @@ -14,10 +14,6 @@ #include "esp_netif_types.h" #include "esp_netif_defaults.h" -#ifdef CONFIG_ETH_ENABLED -#include "esp_eth_netif_glue.h" -#endif - #ifdef __cplusplus extern "C" { diff --git a/components/esp_netif/test/CMakeLists.txt b/components/esp_netif/test/CMakeLists.txt index c6b2652edd..1015ae9683 100644 --- a/components/esp_netif/test/CMakeLists.txt +++ b/components/esp_netif/test/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRC_DIRS "." PRIV_INCLUDE_DIRS "../private_include" "." - PRIV_REQUIRES cmock test_utils esp_netif nvs_flash driver) + PRIV_REQUIRES cmock test_utils esp_netif nvs_flash driver esp_eth) diff --git a/components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c b/components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c index e6e93800d0..45af6099a3 100644 --- a/components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c +++ b/components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c @@ -19,12 +19,12 @@ #include "esp_log.h" #include "esp_check.h" #include "esp_netif.h" +#include "esp_eth.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "freertos/queue.h" -#if CONFIG_ESP_NETIF_L2_TAP #define INVALID_FD (-1) @@ -624,4 +624,3 @@ esp_err_t esp_vfs_l2tap_intf_unregister(const char *base_path) return ESP_OK; } -#endif // CONFIG_ESP_NETIF_L2_TAP diff --git a/components/mdns/CMakeLists.txt b/components/mdns/CMakeLists.txt index cb3ed49960..bdb439fce9 100644 --- a/components/mdns/CMakeLists.txt +++ b/components/mdns/CMakeLists.txt @@ -20,3 +20,7 @@ idf_component_register( PRIV_INCLUDE_DIRS "private_include" REQUIRES ${dependencies} PRIV_REQUIRES ${private_dependencies}) + +if(CONFIG_ETH_ENABLED) + idf_component_optional_requires(PRIVATE esp_eth) +endif() diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index 15b32e3388..71cb073244 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -17,6 +17,10 @@ #include "mdns_networking.h" #include "esp_log.h" #include "esp_random.h" +#if CONFIG_ETH_ENABLED +#include "esp_eth.h" +#endif + #ifdef MDNS_ENABLE_DEBUG void mdns_debug_packet(const uint8_t * data, size_t len); diff --git a/components/mqtt/test/CMakeLists.txt b/components/mqtt/test/CMakeLists.txt index a86bbd002c..a5b760667b 100644 --- a/components/mqtt/test/CMakeLists.txt +++ b/components/mqtt/test/CMakeLists.txt @@ -1,2 +1,2 @@ idf_component_register(SRC_DIRS "." - PRIV_REQUIRES cmock test_utils mqtt nvs_flash app_update) + PRIV_REQUIRES cmock test_utils mqtt nvs_flash app_update esp_eth) diff --git a/examples/common_components/protocol_examples_common/CMakeLists.txt b/examples/common_components/protocol_examples_common/CMakeLists.txt index 5f9317e17d..5f903a75d0 100644 --- a/examples/common_components/protocol_examples_common/CMakeLists.txt +++ b/examples/common_components/protocol_examples_common/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register(SRCS "connect.c" "stdin_out.c" "addr_from_stdin.c" INCLUDE_DIRS "include" - PRIV_REQUIRES esp_netif driver + PRIV_REQUIRES esp_netif driver esp_eth ) diff --git a/examples/common_components/protocol_examples_common/include/protocol_examples_common.h b/examples/common_components/protocol_examples_common/include/protocol_examples_common.h index 7afc78a745..d43e94e0d0 100644 --- a/examples/common_components/protocol_examples_common/include/protocol_examples_common.h +++ b/examples/common_components/protocol_examples_common/include/protocol_examples_common.h @@ -15,6 +15,7 @@ extern "C" { #include "esp_err.h" #include "esp_netif.h" +#include "esp_eth.h" #ifdef CONFIG_EXAMPLE_CONNECT_ETHERNET #define EXAMPLE_INTERFACE get_example_netif() diff --git a/examples/ethernet/enc28j60/components/eth_enc28j60/CMakeLists.txt b/examples/ethernet/enc28j60/components/eth_enc28j60/CMakeLists.txt index 1ee84a2a4a..64babbe55b 100644 --- a/examples/ethernet/enc28j60/components/eth_enc28j60/CMakeLists.txt +++ b/examples/ethernet/enc28j60/components/eth_enc28j60/CMakeLists.txt @@ -1,4 +1,4 @@ idf_component_register(SRCS "esp_eth_mac_enc28j60.c" "esp_eth_phy_enc28j60.c" - PRIV_REQUIRES driver + PRIV_REQUIRES driver esp_eth INCLUDE_DIRS ".") diff --git a/examples/ethernet/eth2ap/main/ethernet_example_main.c b/examples/ethernet/eth2ap/main/ethernet_example_main.c index 4f11e4591b..a5ca36fe1f 100644 --- a/examples/ethernet/eth2ap/main/ethernet_example_main.c +++ b/examples/ethernet/eth2ap/main/ethernet_example_main.c @@ -14,7 +14,7 @@ #include "freertos/queue.h" #include "esp_event.h" #include "esp_log.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "esp_wifi.h" #include "nvs_flash.h" #include "esp_private/wifi.h" diff --git a/examples/network/simple_sniffer/main/cmd_sniffer.h b/examples/network/simple_sniffer/main/cmd_sniffer.h index d20085a127..ae0563efc1 100644 --- a/examples/network/simple_sniffer/main/cmd_sniffer.h +++ b/examples/network/simple_sniffer/main/cmd_sniffer.h @@ -8,6 +8,8 @@ */ #pragma once +#include "esp_eth.h" + #ifdef __cplusplus extern "C" { #endif From 343cf2696edfdfd3ea93c7cea0b5bbcf462f577c Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 27 May 2022 09:06:42 +0200 Subject: [PATCH 3/4] esp_eth: Reduce internal deps onto netif-glue --- .../esp_eth/include/esp_eth_netif_glue.h | 2 +- components/esp_eth/src/esp_eth.c | 2 +- components/esp_eth/src/esp_eth_mac_dm9051.c | 2 +- components/esp_eth/src/esp_eth_mac_esp.c | 2 +- .../esp_eth/src/esp_eth_mac_ksz8851snl.c | 4 ++-- components/esp_eth/src/esp_eth_mac_openeth.c | 2 +- components/esp_eth/src/esp_eth_mac_w5500.c | 20 ++++++------------- components/esp_eth/src/esp_eth_netif_glue.c | 2 +- components/esp_eth/src/esp_eth_phy.c | 20 ++++++------------- components/esp_eth/src/esp_eth_phy_dm9051.c | 2 +- components/esp_eth/src/esp_eth_phy_dp83848.c | 2 +- components/esp_eth/src/esp_eth_phy_ip101.c | 2 +- components/esp_eth/src/esp_eth_phy_ksz80xx.c | 2 +- .../esp_eth/src/esp_eth_phy_ksz8851snl.c | 4 ++-- components/esp_eth/src/esp_eth_phy_lan87xx.c | 2 +- components/esp_eth/src/esp_eth_phy_rtl8201.c | 2 +- components/esp_eth/src/esp_eth_phy_w5500.c | 2 +- .../esp_netif/vfs_l2tap/esp_vfs_l2tap.c | 2 +- components/lwip/port/esp32/netif/ethernetif.c | 2 +- .../network/simple_sniffer/main/cmd_sniffer.h | 2 +- tools/ci/check_copyright_config.yaml | 7 +++++++ tools/ci/check_copyright_ignore.txt | 2 -- 22 files changed, 39 insertions(+), 50 deletions(-) diff --git a/components/esp_eth/include/esp_eth_netif_glue.h b/components/esp_eth/include/esp_eth_netif_glue.h index 3025b848a0..60e6bcf531 100644 --- a/components/esp_eth/include/esp_eth_netif_glue.h +++ b/components/esp_eth/include/esp_eth_netif_glue.h @@ -5,7 +5,7 @@ */ #pragma once -#include "esp_eth.h" +#include "esp_eth_driver.h" #ifdef __cplusplus extern "C" { diff --git a/components/esp_eth/src/esp_eth.c b/components/esp_eth/src/esp_eth.c index 54734bd45a..a3662453e9 100644 --- a/components/esp_eth/src/esp_eth.c +++ b/components/esp_eth/src/esp_eth.c @@ -8,7 +8,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "esp_event.h" #include "esp_heap_caps.h" #include "esp_timer.h" diff --git a/components/esp_eth/src/esp_eth_mac_dm9051.c b/components/esp_eth/src/esp_eth_mac_dm9051.c index 2c2fa4b4a5..6fa25d4517 100644 --- a/components/esp_eth/src/esp_eth_mac_dm9051.c +++ b/components/esp_eth/src/esp_eth_mac_dm9051.c @@ -12,7 +12,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "esp_timer.h" #include "esp_system.h" #include "esp_intr_alloc.h" diff --git a/components/esp_eth/src/esp_eth_mac_esp.c b/components/esp_eth/src/esp_eth_mac_esp.c index 5140e0420b..ef2587381a 100644 --- a/components/esp_eth/src/esp_eth_mac_esp.c +++ b/components/esp_eth/src/esp_eth_mac_esp.c @@ -12,7 +12,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "esp_pm.h" #include "esp_mac.h" #include "esp_heap_caps.h" diff --git a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c index a7ebc7861f..4990d758ee 100644 --- a/components/esp_eth/src/esp_eth_mac_ksz8851snl.c +++ b/components/esp_eth/src/esp_eth_mac_ksz8851snl.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: MIT * - * SPDX-FileContributor: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2021-2022 Espressif Systems (Shanghai) CO LTD */ #include @@ -15,7 +15,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "ksz8851.h" diff --git a/components/esp_eth/src/esp_eth_mac_openeth.c b/components/esp_eth/src/esp_eth_mac_openeth.c index f72d89181c..a42571c219 100644 --- a/components/esp_eth/src/esp_eth_mac_openeth.c +++ b/components/esp_eth/src/esp_eth_mac_openeth.c @@ -19,7 +19,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "esp_intr_alloc.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/esp_eth/src/esp_eth_mac_w5500.c b/components/esp_eth/src/esp_eth_mac_w5500.c index bb35652988..9917e03669 100644 --- a/components/esp_eth/src/esp_eth_mac_w5500.c +++ b/components/esp_eth/src/esp_eth_mac_w5500.c @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include #include @@ -19,7 +11,7 @@ #include "esp_attr.h" #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "esp_system.h" #include "esp_intr_alloc.h" #include "esp_heap_caps.h" diff --git a/components/esp_eth/src/esp_eth_netif_glue.c b/components/esp_eth/src/esp_eth_netif_glue.c index cfb0adf72d..5f71325a33 100644 --- a/components/esp_eth/src/esp_eth_netif_glue.c +++ b/components/esp_eth/src/esp_eth_netif_glue.c @@ -5,7 +5,7 @@ */ #include #include "esp_netif.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "esp_eth_netif_glue.h" #include "esp_event.h" #include "esp_log.h" diff --git a/components/esp_eth/src/esp_eth_phy.c b/components/esp_eth/src/esp_eth_phy.c index 6fae9ae79c..05b09eb17a 100644 --- a/components/esp_eth/src/esp_eth_phy.c +++ b/components/esp_eth/src/esp_eth_phy.c @@ -1,20 +1,12 @@ -// Copyright 2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include #include "esp_log.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "eth_phy_regs_struct.h" static const char *TAG = "esp_eth.phy"; diff --git a/components/esp_eth/src/esp_eth_phy_dm9051.c b/components/esp_eth/src/esp_eth_phy_dm9051.c index ec5fa2d8b7..5d30d65520 100644 --- a/components/esp_eth/src/esp_eth_phy_dm9051.c +++ b/components/esp_eth/src/esp_eth_phy_dm9051.c @@ -8,7 +8,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "eth_phy_regs_struct.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/esp_eth/src/esp_eth_phy_dp83848.c b/components/esp_eth/src/esp_eth_phy_dp83848.c index adbb16b587..c6b5a05076 100644 --- a/components/esp_eth/src/esp_eth_phy_dp83848.c +++ b/components/esp_eth/src/esp_eth_phy_dp83848.c @@ -8,7 +8,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "eth_phy_regs_struct.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/esp_eth/src/esp_eth_phy_ip101.c b/components/esp_eth/src/esp_eth_phy_ip101.c index 18949d7029..a17bbb915d 100644 --- a/components/esp_eth/src/esp_eth_phy_ip101.c +++ b/components/esp_eth/src/esp_eth_phy_ip101.c @@ -8,7 +8,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "eth_phy_regs_struct.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/esp_eth/src/esp_eth_phy_ksz80xx.c b/components/esp_eth/src/esp_eth_phy_ksz80xx.c index 2ea90c08e6..c2329d23b2 100644 --- a/components/esp_eth/src/esp_eth_phy_ksz80xx.c +++ b/components/esp_eth/src/esp_eth_phy_ksz80xx.c @@ -8,7 +8,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "eth_phy_regs_struct.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/esp_eth/src/esp_eth_phy_ksz8851snl.c b/components/esp_eth/src/esp_eth_phy_ksz8851snl.c index 8beaee2a7c..066a6c7db9 100644 --- a/components/esp_eth/src/esp_eth_phy_ksz8851snl.c +++ b/components/esp_eth/src/esp_eth_phy_ksz8851snl.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: MIT * - * SPDX-FileContributor: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2021-2022 Espressif Systems (Shanghai) CO LTD */ #include #include "esp_check.h" @@ -13,7 +13,7 @@ #include "esp_rom_gpio.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "ksz8851.h" diff --git a/components/esp_eth/src/esp_eth_phy_lan87xx.c b/components/esp_eth/src/esp_eth_phy_lan87xx.c index 6f44cd1a92..3396e924be 100644 --- a/components/esp_eth/src/esp_eth_phy_lan87xx.c +++ b/components/esp_eth/src/esp_eth_phy_lan87xx.c @@ -8,7 +8,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "eth_phy_regs_struct.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/esp_eth/src/esp_eth_phy_rtl8201.c b/components/esp_eth/src/esp_eth_phy_rtl8201.c index 892fb38acb..b0a1f2493d 100644 --- a/components/esp_eth/src/esp_eth_phy_rtl8201.c +++ b/components/esp_eth/src/esp_eth_phy_rtl8201.c @@ -9,7 +9,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "eth_phy_regs_struct.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/esp_eth/src/esp_eth_phy_w5500.c b/components/esp_eth/src/esp_eth_phy_w5500.c index c571ccdda0..f298fdb1d4 100644 --- a/components/esp_eth/src/esp_eth_phy_w5500.c +++ b/components/esp_eth/src/esp_eth_phy_w5500.c @@ -8,7 +8,7 @@ #include #include "esp_log.h" #include "esp_check.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/gpio.h" diff --git a/components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c b/components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c index 45af6099a3..3a814b791d 100644 --- a/components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c +++ b/components/esp_netif/vfs_l2tap/esp_vfs_l2tap.c @@ -19,7 +19,7 @@ #include "esp_log.h" #include "esp_check.h" #include "esp_netif.h" -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" diff --git a/components/lwip/port/esp32/netif/ethernetif.c b/components/lwip/port/esp32/netif/ethernetif.c index 147499b4d5..f8c4a1f652 100644 --- a/components/lwip/port/esp32/netif/ethernetif.c +++ b/components/lwip/port/esp32/netif/ethernetif.c @@ -48,7 +48,7 @@ #include #include -#include "esp_eth.h" +#include "esp_eth_driver.h" #include "esp_netif.h" #include "esp_netif_net_stack.h" #include "esp_compiler.h" diff --git a/examples/network/simple_sniffer/main/cmd_sniffer.h b/examples/network/simple_sniffer/main/cmd_sniffer.h index ae0563efc1..8972d0dca3 100644 --- a/examples/network/simple_sniffer/main/cmd_sniffer.h +++ b/examples/network/simple_sniffer/main/cmd_sniffer.h @@ -8,7 +8,7 @@ */ #pragma once -#include "esp_eth.h" +#include "esp_eth_driver.h" #ifdef __cplusplus extern "C" { diff --git a/tools/ci/check_copyright_config.yaml b/tools/ci/check_copyright_config.yaml index bff6dd197c..1c34b84bf0 100644 --- a/tools/ci/check_copyright_config.yaml +++ b/tools/ci/check_copyright_config.yaml @@ -81,6 +81,13 @@ freertos_component: - Apache-2.0 #Files added to the freertos added by us - MIT #FreeRTOS sources and port files +ethernet_component: + include: + - 'components/esp_eth/**' + allowed_licenses: + - Apache-2.0 + - MIT # To allow contributed drivers + systemview: include: - 'components/app_trace/sys_view' diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 4dfd30df98..b14700539e 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -419,8 +419,6 @@ components/esp32/include/rom/tjpgd.h components/esp32/include/rom/uart.h components/esp_eth/include/eth_phy_regs_struct.h components/esp_eth/src/dm9051.h -components/esp_eth/src/esp_eth_mac_w5500.c -components/esp_eth/src/esp_eth_phy.c components/esp_eth/src/ksz8851.h components/esp_eth/src/openeth.h components/esp_eth/src/w5500.h From fd366fac9e6d9debdf0918bbda8930e3ec6133fd Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 27 May 2022 09:12:31 +0200 Subject: [PATCH 4/4] esp_eth: Remove deprecated esp_eth_receive() --- components/esp_eth/include/esp_eth_driver.h | 23 --------------------- components/esp_eth/src/esp_eth.c | 13 ------------ 2 files changed, 36 deletions(-) diff --git a/components/esp_eth/include/esp_eth_driver.h b/components/esp_eth/include/esp_eth_driver.h index ab19f210cf..f6f358f015 100644 --- a/components/esp_eth/include/esp_eth_driver.h +++ b/components/esp_eth/include/esp_eth_driver.h @@ -268,29 +268,6 @@ esp_err_t esp_eth_transmit(esp_eth_handle_t hdl, void *buf, size_t length); */ esp_err_t esp_eth_transmit_vargs(esp_eth_handle_t hdl, uint32_t argc, ...); -/** -* @brief General Receive is deprecated and shall not be accessed from app code, -* as polling is not supported by Ethernet. -* -* @param[in] hdl: handle of Ethernet driver -* @param[out] buf: buffer to preserve the received packet -* @param[out] length: length of the received packet -* -* @note Before this function got invoked, the value of "length" should set by user, equals the size of buffer. -* After the function returned, the value of "length" means the real length of received data. -* @note This API was exposed by accident, users should not use this API in their applications. -* Ethernet driver is interrupt driven, and doesn't support polling mode. -* Instead, users should register input callback with ``esp_eth_update_input_path``. -* -* @return -* - ESP_OK: receive frame buffer successfully -* - ESP_ERR_INVALID_ARG: receive frame buffer failed because of some invalid argument -* - ESP_ERR_INVALID_SIZE: input buffer size is not enough to hold the incoming data. -* in this case, value of returned "length" indicates the real size of incoming data. -* - ESP_FAIL: receive frame buffer failed because some other error occurred -*/ -esp_err_t esp_eth_receive(esp_eth_handle_t hdl, uint8_t *buf, uint32_t *length) __attribute__((deprecated("Ethernet driver is interrupt driven only, please register input callback with esp_eth_update_input_path"))); - /** * @brief Misc IO function of Etherent driver * diff --git a/components/esp_eth/src/esp_eth.c b/components/esp_eth/src/esp_eth.c index a3662453e9..566c96b1c5 100644 --- a/components/esp_eth/src/esp_eth.c +++ b/components/esp_eth/src/esp_eth.c @@ -388,19 +388,6 @@ err: return ret; } -esp_err_t esp_eth_receive(esp_eth_handle_t hdl, uint8_t *buf, uint32_t *length) -{ - esp_err_t ret = ESP_OK; - esp_eth_driver_t *eth_driver = (esp_eth_driver_t *)hdl; - ESP_GOTO_ON_FALSE(buf && length, ESP_ERR_INVALID_ARG, err, TAG, "can't set buf and length to null"); - ESP_GOTO_ON_FALSE(*length > 60, ESP_ERR_INVALID_ARG, err, TAG, "length can't be less than 60"); - ESP_GOTO_ON_FALSE(eth_driver, ESP_ERR_INVALID_ARG, err, TAG, "ethernet driver handle can't be null"); - esp_eth_mac_t *mac = eth_driver->mac; - ret = mac->receive(mac, buf, length); -err: - return ret; -} - esp_err_t esp_eth_ioctl(esp_eth_handle_t hdl, esp_eth_io_cmd_t cmd, void *data) { esp_err_t ret = ESP_OK;