ethernet: remove CONFIG_ETHERNET
1. Hello World application shows no footprint difference before and after this change 2. examples/ethernet/ethernet application compiles properly (can't test with my board)
This commit is contained in:
parent
159a2d01d1
commit
8348a71847
8 changed files with 43 additions and 53 deletions
|
@ -56,46 +56,17 @@ static esp_err_t system_event_sta_connected_handle_default(system_event_t *event
|
|||
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
|
||||
};
|
||||
static system_event_handler_t default_event_handlers[SYSTEM_EVENT_MAX] = { 0 };
|
||||
|
||||
#ifdef CONFIG_ETHERNET
|
||||
esp_err_t system_event_eth_start_handle_default(system_event_t *event)
|
||||
{
|
||||
tcpip_adapter_ip_info_t eth_ip;
|
||||
|
@ -151,7 +122,6 @@ esp_err_t system_event_eth_disconnected_handle_default(system_event_t *event)
|
|||
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)
|
||||
{
|
||||
|
@ -417,3 +387,11 @@ esp_err_t esp_wifi_init(wifi_init_config_t *config)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -159,6 +159,11 @@ esp_err_t esp_event_send(system_event_t *event);
|
|||
*/
|
||||
esp_err_t esp_event_process_default(system_event_t *event);
|
||||
|
||||
/**
|
||||
* @brief Install default event handlers for Ethernet interface
|
||||
*
|
||||
*/
|
||||
void esp_event_set_default_eth_handlers();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
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.
|
||||
|
@ -19,7 +14,6 @@ config DMA_TX_BUF_NUM
|
|||
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.
|
||||
|
@ -28,7 +22,6 @@ config DMA_TX_BUF_NUM
|
|||
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
|
||||
|
@ -46,7 +39,7 @@ config EMAC_TASK_PRIORITY
|
|||
int "EMAC_TASK_PRIORITY"
|
||||
default 20
|
||||
range 3 22
|
||||
depends on ETHERNET
|
||||
help
|
||||
Ethernet MAC task priority.
|
||||
|
||||
endmenu
|
|
@ -101,15 +101,11 @@ struct emac_open_cmd {
|
|||
struct emac_close_cmd {
|
||||
int8_t err;
|
||||
};
|
||||
#if CONFIG_ETHERNET
|
||||
|
||||
#define DMA_RX_BUF_NUM CONFIG_DMA_RX_BUF_NUM
|
||||
#define DMA_TX_BUF_NUM CONFIG_DMA_TX_BUF_NUM
|
||||
#define EMAC_TASK_PRIORITY CONFIG_EMAC_TASK_PRIORITY
|
||||
#else
|
||||
#define DMA_RX_BUF_NUM 1
|
||||
#define DMA_TX_BUF_NUM 1
|
||||
#define EMAC_TASK_PRIORITY 10
|
||||
#endif
|
||||
|
||||
#define DMA_RX_BUF_SIZE 1600
|
||||
#define DMA_TX_BUF_SIZE 1600
|
||||
|
||||
|
|
|
@ -978,13 +978,14 @@ esp_err_t IRAM_ATTR emac_post(emac_sig_t sig, emac_par_t par)
|
|||
}
|
||||
|
||||
esp_err_t esp_eth_init(eth_config_t *config)
|
||||
{
|
||||
esp_event_set_default_eth_handlers();
|
||||
return esp_eth_init_internal(config);
|
||||
}
|
||||
|
||||
esp_err_t esp_eth_init_internal(eth_config_t *config)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
#if !CONFIG_ETHERNET
|
||||
ESP_LOGI(TAG, "eth driver init fail,please make menuconfig and enable ethernet .");
|
||||
ret = ESP_FAIL;
|
||||
goto _exit;
|
||||
#endif
|
||||
if (emac_config.emac_status != EMAC_RUNTIME_NOT_INIT) {
|
||||
goto _exit;
|
||||
}
|
||||
|
|
|
@ -117,6 +117,24 @@ typedef struct {
|
|||
*/
|
||||
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
|
||||
*
|
||||
|
|
|
@ -1 +1 @@
|
|||
CONFIG_ETHERNET=y
|
||||
|
||||
|
|
|
@ -191,7 +191,6 @@ CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
|||
# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set
|
||||
CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20
|
||||
CONFIG_ESP32_PHY_MAX_TX_POWER=20
|
||||
# CONFIG_ETHERNET is not set
|
||||
|
||||
#
|
||||
# FAT Filesystem support
|
||||
|
|
Loading…
Reference in a new issue