static esp_err_t system_event_sta_disconnected_handle_default(system_event_t *event);
static esp_err_t system_event_sta_got_ip_default(system_event_t *event);
-#ifdef CONFIG_ETHERNET
static esp_err_t system_event_eth_start_handle_default(system_event_t *event);
static esp_err_t system_event_eth_stop_handle_default(system_event_t *event);
static esp_err_t system_event_eth_connected_handle_default(system_event_t *event);
static esp_err_t system_event_eth_disconnected_handle_default(system_event_t *event);
-#endif
/* Default event handler functions
Any entry in this table which is disabled by config will have a NULL handler.
*/
-static system_event_handler_t default_event_handlers[SYSTEM_EVENT_MAX] = {
- [SYSTEM_EVENT_WIFI_READY] = NULL,
- [SYSTEM_EVENT_SCAN_DONE] = NULL,
- [SYSTEM_EVENT_STA_START] = NULL,
- [SYSTEM_EVENT_STA_STOP] = NULL,
- [SYSTEM_EVENT_STA_CONNECTED] = NULL,
- [SYSTEM_EVENT_STA_DISCONNECTED] = NULL,
- [SYSTEM_EVENT_STA_AUTHMODE_CHANGE] = NULL,
- [SYSTEM_EVENT_STA_GOT_IP] = NULL,
- [SYSTEM_EVENT_STA_WPS_ER_SUCCESS] = NULL,
- [SYSTEM_EVENT_STA_WPS_ER_FAILED] = NULL,
- [SYSTEM_EVENT_STA_WPS_ER_TIMEOUT] = NULL,
- [SYSTEM_EVENT_STA_WPS_ER_PIN] = NULL,
- [SYSTEM_EVENT_AP_START] = NULL,
- [SYSTEM_EVENT_AP_STOP] = NULL,
- [SYSTEM_EVENT_AP_STACONNECTED] = NULL,
- [SYSTEM_EVENT_AP_STADISCONNECTED] = NULL,
- [SYSTEM_EVENT_AP_PROBEREQRECVED] = NULL,
- [SYSTEM_EVENT_AP_STA_GOT_IP6] = NULL,
-#ifdef CONFIG_ETHERNET
- [SYSTEM_EVENT_ETH_START] = system_event_eth_start_handle_default,
- [SYSTEM_EVENT_ETH_STOP] = system_event_eth_stop_handle_default,
- [SYSTEM_EVENT_ETH_CONNECTED] = system_event_eth_connected_handle_default,
- [SYSTEM_EVENT_ETH_DISCONNECTED] = system_event_eth_disconnected_handle_default,
- [SYSTEM_EVENT_ETH_GOT_IP] = NULL,
-#endif
-};
-
-#ifdef CONFIG_ETHERNET
+static system_event_handler_t default_event_handlers[SYSTEM_EVENT_MAX] = { 0 };
+
esp_err_t system_event_eth_start_handle_default(system_event_t *event)
{
tcpip_adapter_ip_info_t eth_ip;
tcpip_adapter_down(TCPIP_ADAPTER_IF_ETH);
return ESP_OK;
}
-#endif
static esp_err_t system_event_sta_got_ip_default(system_event_t *event)
{
esp_register_shutdown_handler((shutdown_handler_t)esp_wifi_stop);
return esp_wifi_init_internal(config);
}
+
+void esp_event_set_default_eth_handlers()
+{
+ default_event_handlers[SYSTEM_EVENT_ETH_START] = system_event_eth_start_handle_default;
+ default_event_handlers[SYSTEM_EVENT_ETH_STOP] = system_event_eth_stop_handle_default;
+ default_event_handlers[SYSTEM_EVENT_ETH_CONNECTED] = system_event_eth_connected_handle_default;
+ default_event_handlers[SYSTEM_EVENT_ETH_DISCONNECTED] = system_event_eth_disconnected_handle_default;
+}
-menuconfig ETHERNET
- bool "Ethernet"
- default n
- help
- Select this option to enable ethernet driver and show the submenu with ethernet features.
+menu ETHERNET
config DMA_RX_BUF_NUM
int "Number of DMA RX buffers"
range 3 20
default 10
- depends on ETHERNET
help
Number of DMA receive buffers. Each buffer is 1600 bytes.
Buffers are allocated statically.
int "Number of DMA RX buffers"
range 3 20
default 10
- depends on ETHERNET
help
Number of DMA transmit buffers. Each buffer is 1600 bytes.
Buffers are allocated statically.
config EMAC_L2_TO_L3_RX_BUF_MODE
bool "Enable copy between Layer2 and Layer3"
default n
- depends on ETHERNET
help
If this options is selected, a copy of each received buffer will be created when
passing it from the Ethernet MAC (L2) to the IP stack (L3). Otherwise, IP stack
int "EMAC_TASK_PRIORITY"
default 20
range 3 22
- depends on ETHERNET
help
Ethernet MAC task priority.
+endmenu
\ No newline at end of file
*/
esp_err_t esp_eth_init(eth_config_t *config);
+/**
+ * @brief Init Ethernet mac driver only
+ *
+ * For the most part, you need not call this function directly. It gets called
+ * from esp_eth_init().
+ *
+ * This function may be called, if you only need to initialize the Ethernet
+ * driver without having to use the network stack on top.
+ *
+ * @note config can not be NULL,and phy chip must be suitable to phy init func.
+ * @param[in] config mac init data.
+ *
+ * @return
+ * - ESP_OK
+ * - ESP_FAIL
+ */
+esp_err_t esp_eth_init_internal(eth_config_t *config);
+
/**
* @brief Send packet from tcp/ip to mac
*