From 00e76759130897bd899cd84323f439b1f911bc0e Mon Sep 17 00:00:00 2001 From: Ondrej Kosta Date: Thu, 31 Mar 2022 14:52:27 +0200 Subject: [PATCH] examples: added ESP-NETIF L2 TAP example * Original commit: espressif/esp-idf@fcdb0306d04f521531534e2f577e4fead27ec755 --- .../common_components/protocol_examples_common/connect.c | 6 ++++++ .../include/protocol_examples_common.h | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/examples/common_components/protocol_examples_common/connect.c b/examples/common_components/protocol_examples_common/connect.c index c54deae67..85878d78b 100644 --- a/examples/common_components/protocol_examples_common/connect.c +++ b/examples/common_components/protocol_examples_common/connect.c @@ -479,6 +479,7 @@ static void eth_stop(void) ESP_ERROR_CHECK(esp_eth_stop(s_eth_handle)); ESP_ERROR_CHECK(esp_eth_del_netif_glue(s_eth_glue)); ESP_ERROR_CHECK(esp_eth_driver_uninstall(s_eth_handle)); + s_eth_handle = NULL; ESP_ERROR_CHECK(s_phy->del(s_phy)); ESP_ERROR_CHECK(s_mac->del(s_mac)); @@ -486,6 +487,11 @@ static void eth_stop(void) s_example_esp_netif = NULL; } +esp_eth_handle_t get_example_eth_handle(void) +{ + return s_eth_handle; +} + #endif // CONFIG_EXAMPLE_CONNECT_ETHERNET esp_netif_t *get_example_netif(void) 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 8c0a0a30e..7afc78a74 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 @@ -78,6 +78,15 @@ esp_netif_t *get_example_netif(void); */ esp_netif_t *get_example_netif_from_desc(const char *desc); +#ifdef CONFIG_EXAMPLE_CONNECT_ETHERNET +/** + * @brief Get the example Ethernet driver handle + * + * @return esp_eth_handle_t + */ +esp_eth_handle_t get_example_eth_handle(void); +#endif // CONFIG_EXAMPLE_CONNECT_ETHERNET + #ifdef __cplusplus } #endif