diff --git a/components/ethernet/emac_main.c b/components/ethernet/emac_main.c index 2b78663f94..e1b402aa39 100644 --- a/components/ethernet/emac_main.c +++ b/components/ethernet/emac_main.c @@ -79,6 +79,7 @@ static bool pause_send = false; #ifdef CONFIG_PM_ENABLE static esp_pm_lock_handle_t s_pm_lock; #endif +ESP_EVENT_DEFINE_BASE(ETH_EVENT); static esp_err_t emac_ioctl(emac_sig_t sig, emac_par_t par); esp_err_t emac_post(emac_sig_t sig, emac_par_t par); diff --git a/components/ethernet/include/esp_eth.h b/components/ethernet/include/esp_eth.h index ccbc59d040..5fe7129284 100644 --- a/components/ethernet/include/esp_eth.h +++ b/components/ethernet/include/esp_eth.h @@ -19,6 +19,9 @@ extern "C" { #endif +#include +#include +#include "esp_event_base.h" #include "esp_types.h" #include "esp_err.h" @@ -130,6 +133,17 @@ typedef struct { uint32_t reset_timeout_ms; /*!< timeout value for reset emac */ } eth_config_t; +/** Ethernet event declarations */ +typedef enum { + ETHERNET_EVENT_START, /**< ESP32 ethernet start */ + ETHERNET_EVENT_STOP, /**< ESP32 ethernet stop */ + ETHERNET_EVENT_CONNECTED, /**< ESP32 ethernet phy link up */ + ETHERNET_EVENT_DISCONNECTED, /**< ESP32 ethernet phy link down */ +} eth_event_t; + +/** @brief Ethernet event base declaration */ +ESP_EVENT_DECLARE_BASE(ETH_EVENT); + /** * @brief Init ethernet mac *