forked from espressif/esp-idf
Merge branch 'bugfix/emac_config_dma_burst_len' into 'master'
esp_eth: Make EMAC DMA burst size configurable (GitHub PR) Closes IDFGH-6199 and IDFGH-5658 See merge request espressif/esp-idf!16412
This commit is contained in:
@@ -1,16 +1,8 @@
|
|||||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// 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.
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@@ -374,11 +366,7 @@ typedef struct {
|
|||||||
uint32_t sw_reset_timeout_ms; /*!< Software reset timeout value (Unit: ms) */
|
uint32_t sw_reset_timeout_ms; /*!< Software reset timeout value (Unit: ms) */
|
||||||
uint32_t rx_task_stack_size; /*!< Stack size of the receive task */
|
uint32_t rx_task_stack_size; /*!< Stack size of the receive task */
|
||||||
uint32_t rx_task_prio; /*!< Priority of the receive task */
|
uint32_t rx_task_prio; /*!< Priority of the receive task */
|
||||||
int smi_mdc_gpio_num; /*!< SMI MDC GPIO number, set to -1 could bypass the SMI GPIO configuration */
|
|
||||||
int smi_mdio_gpio_num; /*!< SMI MDIO GPIO number, set to -1 could bypass the SMI GPIO configuration */
|
|
||||||
uint32_t flags; /*!< Flags that specify extra capability for mac driver */
|
uint32_t flags; /*!< Flags that specify extra capability for mac driver */
|
||||||
eth_data_interface_t interface; /*!< EMAC Data interface to PHY (MII/RMII) */
|
|
||||||
eth_mac_clock_config_t clock_config; /*!< EMAC Interface clock configuration */
|
|
||||||
} eth_mac_config_t;
|
} eth_mac_config_t;
|
||||||
|
|
||||||
#define ETH_MAC_FLAG_WORK_WITH_CACHE_DISABLE (1 << 0) /*!< MAC driver can work when cache is disabled */
|
#define ETH_MAC_FLAG_WORK_WITH_CACHE_DISABLE (1 << 0) /*!< MAC driver can work when cache is disabled */
|
||||||
@@ -393,9 +381,30 @@ typedef struct {
|
|||||||
.sw_reset_timeout_ms = 100, \
|
.sw_reset_timeout_ms = 100, \
|
||||||
.rx_task_stack_size = 2048, \
|
.rx_task_stack_size = 2048, \
|
||||||
.rx_task_prio = 15, \
|
.rx_task_prio = 15, \
|
||||||
|
.flags = 0, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||||
|
/**
|
||||||
|
* @brief EMAC specific configuration
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
int smi_mdc_gpio_num; /*!< SMI MDC GPIO number, set to -1 could bypass the SMI GPIO configuration */
|
||||||
|
int smi_mdio_gpio_num; /*!< SMI MDIO GPIO number, set to -1 could bypass the SMI GPIO configuration */
|
||||||
|
eth_data_interface_t interface; /*!< EMAC Data interface to PHY (MII/RMII) */
|
||||||
|
eth_mac_clock_config_t clock_config; /*!< EMAC Interface clock configuration */
|
||||||
|
eth_mac_dma_burst_len_t dma_burst_len; /*!< EMAC DMA burst length for both Tx and Rx */
|
||||||
|
} eth_esp32_emac_config_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Default ESP32's EMAC specific configuration
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define ETH_ESP32_EMAC_DEFAULT_CONFIG() \
|
||||||
|
{ \
|
||||||
.smi_mdc_gpio_num = 23, \
|
.smi_mdc_gpio_num = 23, \
|
||||||
.smi_mdio_gpio_num = 18, \
|
.smi_mdio_gpio_num = 18, \
|
||||||
.flags = 0, \
|
|
||||||
.interface = EMAC_DATA_INTERFACE_RMII, \
|
.interface = EMAC_DATA_INTERFACE_RMII, \
|
||||||
.clock_config = \
|
.clock_config = \
|
||||||
{ \
|
{ \
|
||||||
@@ -404,10 +413,10 @@ typedef struct {
|
|||||||
.clock_mode = EMAC_CLK_DEFAULT, \
|
.clock_mode = EMAC_CLK_DEFAULT, \
|
||||||
.clock_gpio = EMAC_CLK_IN_GPIO \
|
.clock_gpio = EMAC_CLK_IN_GPIO \
|
||||||
} \
|
} \
|
||||||
} \
|
}, \
|
||||||
|
.dma_burst_len = ETH_DMA_BURST_LEN_32 \
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
|
||||||
/**
|
/**
|
||||||
* @brief Create ESP32 Ethernet MAC instance
|
* @brief Create ESP32 Ethernet MAC instance
|
||||||
*
|
*
|
||||||
@@ -417,7 +426,7 @@ typedef struct {
|
|||||||
* - instance: create MAC instance successfully
|
* - instance: create MAC instance successfully
|
||||||
* - NULL: create MAC instance failed because some error occurred
|
* - NULL: create MAC instance failed because some error occurred
|
||||||
*/
|
*/
|
||||||
esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_mac_config_t *config);
|
esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config, const eth_mac_config_t *config);
|
||||||
#endif // CONFIG_ETH_USE_ESP32_EMAC
|
#endif // CONFIG_ETH_USE_ESP32_EMAC
|
||||||
|
|
||||||
#if CONFIG_ETH_SPI_ETHERNET_DM9051
|
#if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -61,6 +61,7 @@ typedef struct {
|
|||||||
#ifdef CONFIG_PM_ENABLE
|
#ifdef CONFIG_PM_ENABLE
|
||||||
esp_pm_lock_handle_t pm_lock;
|
esp_pm_lock_handle_t pm_lock;
|
||||||
#endif
|
#endif
|
||||||
|
eth_mac_dma_burst_len_t dma_burst_len;
|
||||||
} emac_esp32_t;
|
} emac_esp32_t;
|
||||||
|
|
||||||
static esp_err_t esp_emac_alloc_driver_obj(const eth_mac_config_t *config, emac_esp32_t **emac_out_hdl, void **out_descriptors);
|
static esp_err_t esp_emac_alloc_driver_obj(const eth_mac_config_t *config, emac_esp32_t **emac_out_hdl, void **out_descriptors);
|
||||||
@@ -342,8 +343,9 @@ static esp_err_t emac_esp32_init(esp_eth_mac_t *mac)
|
|||||||
emac_hal_reset_desc_chain(&emac->hal);
|
emac_hal_reset_desc_chain(&emac->hal);
|
||||||
/* init mac registers by default */
|
/* init mac registers by default */
|
||||||
emac_hal_init_mac_default(&emac->hal);
|
emac_hal_init_mac_default(&emac->hal);
|
||||||
/* init dma registers by default */
|
/* init dma registers with selected EMAC-DMA configuration */
|
||||||
emac_hal_init_dma_default(&emac->hal);
|
emac_hal_dma_config_t dma_config = { .dma_burst_len = emac->dma_burst_len };
|
||||||
|
emac_hal_init_dma_default(&emac->hal, &dma_config);
|
||||||
/* get emac address from efuse */
|
/* get emac address from efuse */
|
||||||
ESP_GOTO_ON_ERROR(esp_read_mac(emac->addr, ESP_MAC_ETH), err, TAG, "fetch ethernet mac address failed");
|
ESP_GOTO_ON_ERROR(esp_read_mac(emac->addr, ESP_MAC_ETH), err, TAG, "fetch ethernet mac address failed");
|
||||||
/* set MAC address to emac register */
|
/* set MAC address to emac register */
|
||||||
@@ -497,12 +499,12 @@ err:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static esp_err_t esp_emac_config_data_interface(const eth_mac_config_t *config, emac_esp32_t *emac)
|
static esp_err_t esp_emac_config_data_interface(const eth_esp32_emac_config_t *esp32_emac_config, emac_esp32_t *emac)
|
||||||
{
|
{
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
switch (config->interface) {
|
switch (esp32_emac_config->interface) {
|
||||||
case EMAC_DATA_INTERFACE_MII:
|
case EMAC_DATA_INTERFACE_MII:
|
||||||
emac->clock_config = config->clock_config;
|
emac->clock_config = esp32_emac_config->clock_config;
|
||||||
/* MII interface GPIO initialization */
|
/* MII interface GPIO initialization */
|
||||||
emac_hal_iomux_init_mii();
|
emac_hal_iomux_init_mii();
|
||||||
/* Enable MII clock */
|
/* Enable MII clock */
|
||||||
@@ -510,7 +512,7 @@ static esp_err_t esp_emac_config_data_interface(const eth_mac_config_t *config,
|
|||||||
break;
|
break;
|
||||||
case EMAC_DATA_INTERFACE_RMII:
|
case EMAC_DATA_INTERFACE_RMII:
|
||||||
// by default, the clock mode is selected at compile time (by Kconfig)
|
// by default, the clock mode is selected at compile time (by Kconfig)
|
||||||
if (config->clock_config.rmii.clock_mode == EMAC_CLK_DEFAULT) {
|
if (esp32_emac_config->clock_config.rmii.clock_mode == EMAC_CLK_DEFAULT) {
|
||||||
#if CONFIG_ETH_RMII_CLK_INPUT
|
#if CONFIG_ETH_RMII_CLK_INPUT
|
||||||
#if CONFIG_ETH_RMII_CLK_IN_GPIO == 0
|
#if CONFIG_ETH_RMII_CLK_IN_GPIO == 0
|
||||||
emac->clock_config.rmii.clock_mode = EMAC_CLK_EXT_IN;
|
emac->clock_config.rmii.clock_mode = EMAC_CLK_EXT_IN;
|
||||||
@@ -529,7 +531,7 @@ static esp_err_t esp_emac_config_data_interface(const eth_mac_config_t *config,
|
|||||||
#error "Unsupported RMII clock mode"
|
#error "Unsupported RMII clock mode"
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
emac->clock_config = config->clock_config;
|
emac->clock_config = esp32_emac_config->clock_config;
|
||||||
}
|
}
|
||||||
/* RMII interface GPIO initialization */
|
/* RMII interface GPIO initialization */
|
||||||
emac_hal_iomux_init_rmii();
|
emac_hal_iomux_init_rmii();
|
||||||
@@ -559,13 +561,13 @@ static esp_err_t esp_emac_config_data_interface(const eth_mac_config_t *config,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ESP_GOTO_ON_FALSE(false, ESP_ERR_INVALID_ARG, err, TAG, "invalid EMAC Data Interface:%d", config->interface);
|
ESP_GOTO_ON_FALSE(false, ESP_ERR_INVALID_ARG, err, TAG, "invalid EMAC Data Interface:%d", esp32_emac_config->interface);
|
||||||
}
|
}
|
||||||
err:
|
err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_mac_config_t *config)
|
esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config, const eth_mac_config_t *config)
|
||||||
{
|
{
|
||||||
esp_err_t ret_code = ESP_OK;
|
esp_err_t ret_code = ESP_OK;
|
||||||
esp_eth_mac_t *ret = NULL;
|
esp_eth_mac_t *ret = NULL;
|
||||||
@@ -588,12 +590,13 @@ esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_mac_config_t *config)
|
|||||||
emac_isr_default_handler, &emac->hal, &(emac->intr_hdl));
|
emac_isr_default_handler, &emac->hal, &(emac->intr_hdl));
|
||||||
}
|
}
|
||||||
ESP_GOTO_ON_FALSE(ret_code == ESP_OK, NULL, err, TAG, "alloc emac interrupt failed");
|
ESP_GOTO_ON_FALSE(ret_code == ESP_OK, NULL, err, TAG, "alloc emac interrupt failed");
|
||||||
ret_code = esp_emac_config_data_interface(config, emac);
|
ret_code = esp_emac_config_data_interface(esp32_config, emac);
|
||||||
ESP_GOTO_ON_FALSE(ret_code == ESP_OK, NULL, err_interf, TAG, "config emac interface failed");
|
ESP_GOTO_ON_FALSE(ret_code == ESP_OK, NULL, err_interf, TAG, "config emac interface failed");
|
||||||
|
|
||||||
|
emac->dma_burst_len = esp32_config->dma_burst_len;
|
||||||
emac->sw_reset_timeout_ms = config->sw_reset_timeout_ms;
|
emac->sw_reset_timeout_ms = config->sw_reset_timeout_ms;
|
||||||
emac->smi_mdc_gpio_num = config->smi_mdc_gpio_num;
|
emac->smi_mdc_gpio_num = esp32_config->smi_mdc_gpio_num;
|
||||||
emac->smi_mdio_gpio_num = config->smi_mdio_gpio_num;
|
emac->smi_mdio_gpio_num = esp32_config->smi_mdio_gpio_num;
|
||||||
emac->flow_control_high_water_mark = FLOW_CONTROL_HIGH_WATER_MARK;
|
emac->flow_control_high_water_mark = FLOW_CONTROL_HIGH_WATER_MARK;
|
||||||
emac->flow_control_low_water_mark = FLOW_CONTROL_LOW_WATER_MARK;
|
emac->flow_control_low_water_mark = FLOW_CONTROL_LOW_WATER_MARK;
|
||||||
emac->use_apll = false;
|
emac->use_apll = false;
|
||||||
|
@@ -97,7 +97,8 @@ TEST_CASE("esp32 ethernet io test", "[ethernet][test_env=UT_T2_Ethernet]")
|
|||||||
{
|
{
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
mac_config.flags = ETH_MAC_FLAG_PIN_TO_CORE; // pin to core
|
mac_config.flags = ETH_MAC_FLAG_PIN_TO_CORE; // pin to core
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
// auto detect PHY address
|
// auto detect PHY address
|
||||||
phy_config.phy_addr = ESP_ETH_PHY_ADDR_AUTO;
|
phy_config.phy_addr = ESP_ETH_PHY_ADDR_AUTO;
|
||||||
@@ -131,7 +132,8 @@ TEST_CASE("esp32 ethernet speed/duplex/autonegotiation", "[ethernet][test_env=UT
|
|||||||
TEST_ESP_OK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, ð_event_handler, eth_event_group));
|
TEST_ESP_OK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, ð_event_handler, eth_event_group));
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
mac_config.flags = ETH_MAC_FLAG_PIN_TO_CORE; // pin to core
|
mac_config.flags = ETH_MAC_FLAG_PIN_TO_CORE; // pin to core
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
// auto detect PHY address
|
// auto detect PHY address
|
||||||
phy_config.phy_addr = ESP_ETH_PHY_ADDR_AUTO;
|
phy_config.phy_addr = ESP_ETH_PHY_ADDR_AUTO;
|
||||||
@@ -310,7 +312,8 @@ TEST_CASE("esp32 ethernet event test", "[ethernet][test_env=UT_T2_Ethernet]")
|
|||||||
TEST_ESP_OK(esp_event_loop_create_default());
|
TEST_ESP_OK(esp_event_loop_create_default());
|
||||||
TEST_ESP_OK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, ð_event_handler, eth_event_group));
|
TEST_ESP_OK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, ð_event_handler, eth_event_group));
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
||||||
@@ -350,7 +353,8 @@ TEST_CASE("esp32 ethernet dhcp test", "[ethernet][test_env=UT_T2_Ethernet]")
|
|||||||
esp_netif_t *eth_netif = esp_netif_new(&netif_cfg);
|
esp_netif_t *eth_netif = esp_netif_new(&netif_cfg);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
||||||
@@ -397,7 +401,8 @@ TEST_CASE("esp32 ethernet start/stop stress test", "[ethernet][test_env=UT_T2_Et
|
|||||||
esp_netif_t *eth_netif = esp_netif_new(&netif_cfg);
|
esp_netif_t *eth_netif = esp_netif_new(&netif_cfg);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
||||||
@@ -495,7 +500,8 @@ TEST_CASE("esp32 ethernet download test", "[ethernet][test_env=UT_T2_Ethernet][t
|
|||||||
esp_netif_t *eth_netif = esp_netif_new(&netif_cfg);
|
esp_netif_t *eth_netif = esp_netif_new(&netif_cfg);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
|
||||||
|
@@ -48,7 +48,8 @@ TEST_CASE("start_and_stop", "[esp_eth]")
|
|||||||
TEST_ASSERT(eth_event_group != NULL);
|
TEST_ASSERT(eth_event_group != NULL);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config); // create MAC instance
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config); // create MAC instance
|
||||||
TEST_ASSERT_NOT_NULL(mac);
|
TEST_ASSERT_NOT_NULL(mac);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
|
||||||
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
|
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
|
||||||
@@ -99,7 +100,8 @@ TEST_CASE("get_set_mac", "[esp_eth]")
|
|||||||
TEST_ASSERT_NOT_NULL(mutex);
|
TEST_ASSERT_NOT_NULL(mutex);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config); // create MAC instance
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config); // create MAC instance
|
||||||
TEST_ASSERT_NOT_NULL(mac);
|
TEST_ASSERT_NOT_NULL(mac);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
|
||||||
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
|
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
|
||||||
@@ -152,7 +154,8 @@ TEST_CASE("ethernet_broadcast_transmit", "[esp_eth]")
|
|||||||
TEST_ASSERT_NOT_NULL(mutex);
|
TEST_ASSERT_NOT_NULL(mutex);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config); // create MAC instance
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config); // create MAC instance
|
||||||
TEST_ASSERT_NOT_NULL(mac);
|
TEST_ASSERT_NOT_NULL(mac);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
|
||||||
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
|
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
|
||||||
@@ -222,7 +225,8 @@ TEST_CASE("recv_pkt", "[esp_eth]")
|
|||||||
TEST_ASSERT(eth_event_group != NULL);
|
TEST_ASSERT(eth_event_group != NULL);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); // apply default MAC configuration
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config); // create MAC instance
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config); // create MAC instance
|
||||||
TEST_ASSERT_NOT_NULL(mac);
|
TEST_ASSERT_NOT_NULL(mac);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); // apply default PHY configuration
|
||||||
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
|
#if defined(CONFIG_TARGET_ETH_PHY_DEVICE_IP101)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -144,7 +144,8 @@ static void ethernet_init(test_vfs_eth_network_t *network_hndls)
|
|||||||
network_hndls->eth_netif = esp_netif_new(&netif_cfg);
|
network_hndls->eth_netif = esp_netif_new(&netif_cfg);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
network_hndls->mac = esp_eth_mac_new_esp32(&mac_config);
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
network_hndls->mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
network_hndls->phy = esp_eth_phy_new_ip101(&phy_config);
|
network_hndls->phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(network_hndls->mac, network_hndls->phy);
|
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(network_hndls->mac, network_hndls->phy);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -265,7 +265,7 @@ void emac_hal_enable_flow_ctrl(emac_hal_context_t *hal, bool enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void emac_hal_init_dma_default(emac_hal_context_t *hal)
|
void emac_hal_init_dma_default(emac_hal_context_t *hal, emac_hal_dma_config_t *hal_config)
|
||||||
{
|
{
|
||||||
/* DMAOMR Configuration */
|
/* DMAOMR Configuration */
|
||||||
/* Enable Dropping of TCP/IP Checksum Error Frames */
|
/* Enable Dropping of TCP/IP Checksum Error Frames */
|
||||||
@@ -294,11 +294,10 @@ void emac_hal_init_dma_default(emac_hal_context_t *hal)
|
|||||||
emac_ll_mixed_burst_enable(hal->dma_regs, true);
|
emac_ll_mixed_burst_enable(hal->dma_regs, true);
|
||||||
/* Enable Address Aligned Beates */
|
/* Enable Address Aligned Beates */
|
||||||
emac_ll_addr_align_enable(hal->dma_regs, true);
|
emac_ll_addr_align_enable(hal->dma_regs, true);
|
||||||
/* Use Separate PBL */
|
/* Don't use Separate PBL */
|
||||||
emac_ll_use_separate_pbl_enable(hal->dma_regs, true);
|
emac_ll_use_separate_pbl_enable(hal->dma_regs, false);
|
||||||
/* Set Rx/Tx DMA Burst Length */
|
/* Set Rx/Tx DMA Burst Length */
|
||||||
emac_ll_set_rx_dma_pbl(hal->dma_regs, EMAC_LL_DMA_BURST_LENGTH_32BEAT);
|
emac_ll_set_prog_burst_len(hal->dma_regs, hal_config->dma_burst_len);
|
||||||
emac_ll_set_prog_burst_len(hal->dma_regs, EMAC_LL_DMA_BURST_LENGTH_32BEAT);
|
|
||||||
/* Enable Enhanced Descriptor,8 Words(32 Bytes) */
|
/* Enable Enhanced Descriptor,8 Words(32 Bytes) */
|
||||||
emac_ll_enhance_desc_enable(hal->dma_regs, true);
|
emac_ll_enhance_desc_enable(hal->dma_regs, true);
|
||||||
/* Specifies the number of word to skip between two unchained descriptors (Ring mode) */
|
/* Specifies the number of word to skip between two unchained descriptors (Ring mode) */
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -468,9 +468,14 @@ static inline void emac_ll_set_rx_dma_pbl(emac_dma_dev_t *dma_regs, uint32_t pbl
|
|||||||
dma_regs->dmabusmode.rx_dma_pbl = pbl;
|
dma_regs->dmabusmode.rx_dma_pbl = pbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void emac_ll_set_prog_burst_len(emac_dma_dev_t *dma_regs, uint32_t len)
|
static inline void emac_ll_set_prog_burst_len(emac_dma_dev_t *dma_regs, eth_mac_dma_burst_len_t dma_burst_len)
|
||||||
{
|
{
|
||||||
dma_regs->dmabusmode.prog_burst_len = len;
|
dma_regs->dmabusmode.prog_burst_len = dma_burst_len == ETH_DMA_BURST_LEN_1 ? EMAC_LL_DMA_BURST_LENGTH_1BEAT :
|
||||||
|
dma_burst_len == ETH_DMA_BURST_LEN_2 ? EMAC_LL_DMA_BURST_LENGTH_2BEAT :
|
||||||
|
dma_burst_len == ETH_DMA_BURST_LEN_4 ? EMAC_LL_DMA_BURST_LENGTH_4BEAT :
|
||||||
|
dma_burst_len == ETH_DMA_BURST_LEN_8 ? EMAC_LL_DMA_BURST_LENGTH_8BEAT :
|
||||||
|
dma_burst_len == ETH_DMA_BURST_LEN_16 ? EMAC_LL_DMA_BURST_LENGTH_16BEAT :
|
||||||
|
EMAC_LL_DMA_BURST_LENGTH_32BEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void emac_ll_enhance_desc_enable(emac_dma_dev_t *dma_regs, bool enable)
|
static inline void emac_ll_enhance_desc_enable(emac_dma_dev_t *dma_regs, bool enable)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -164,6 +164,13 @@ typedef struct {
|
|||||||
|
|
||||||
} emac_hal_context_t;
|
} emac_hal_context_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief EMAC related configuration
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
eth_mac_dma_burst_len_t dma_burst_len; /*!< eth-type enum of chosen dma burst-len */
|
||||||
|
} emac_hal_dma_config_t;
|
||||||
|
|
||||||
void emac_hal_init(emac_hal_context_t *hal, void *descriptors,
|
void emac_hal_init(emac_hal_context_t *hal, void *descriptors,
|
||||||
uint8_t **rx_buf, uint8_t **tx_buf);
|
uint8_t **rx_buf, uint8_t **tx_buf);
|
||||||
|
|
||||||
@@ -189,7 +196,7 @@ void emac_hal_set_csr_clock_range(emac_hal_context_t *hal, int freq);
|
|||||||
|
|
||||||
void emac_hal_init_mac_default(emac_hal_context_t *hal);
|
void emac_hal_init_mac_default(emac_hal_context_t *hal);
|
||||||
|
|
||||||
void emac_hal_init_dma_default(emac_hal_context_t *hal);
|
void emac_hal_init_dma_default(emac_hal_context_t *hal, emac_hal_dma_config_t *hal_config);
|
||||||
|
|
||||||
void emac_hal_set_speed(emac_hal_context_t *hal, uint32_t speed);
|
void emac_hal_set_speed(emac_hal_context_t *hal, uint32_t speed);
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -49,3 +49,15 @@ typedef enum {
|
|||||||
ETH_CHECKSUM_SW, /*!< Ethernet checksum calculate by software */
|
ETH_CHECKSUM_SW, /*!< Ethernet checksum calculate by software */
|
||||||
ETH_CHECKSUM_HW /*!< Ethernet checksum calculate by hardware */
|
ETH_CHECKSUM_HW /*!< Ethernet checksum calculate by hardware */
|
||||||
} eth_checksum_t;
|
} eth_checksum_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal ethernet EMAC's DMA available burst sizes
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
ETH_DMA_BURST_LEN_32,
|
||||||
|
ETH_DMA_BURST_LEN_16,
|
||||||
|
ETH_DMA_BURST_LEN_8,
|
||||||
|
ETH_DMA_BURST_LEN_4,
|
||||||
|
ETH_DMA_BURST_LEN_2,
|
||||||
|
ETH_DMA_BURST_LEN_1,
|
||||||
|
} eth_mac_dma_burst_len_t;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -100,7 +100,8 @@ void connect_test_fixture_setup(void)
|
|||||||
s_eth_netif = esp_netif_new(&netif_cfg);
|
s_eth_netif = esp_netif_new(&netif_cfg);
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
s_mac = esp_eth_mac_new_esp32(&mac_config);
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
|
s_mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
s_phy = esp_eth_phy_new_ip101(&phy_config);
|
s_phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(s_mac, s_phy);
|
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(s_mac, s_phy);
|
||||||
|
@@ -379,9 +379,10 @@ static esp_netif_t *eth_start(void)
|
|||||||
phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR;
|
phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR;
|
||||||
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
|
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
|
||||||
#if CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET
|
#if CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET
|
||||||
mac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
esp32_emac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
||||||
s_mac = esp_eth_mac_new_esp32(&mac_config);
|
esp32_emac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
||||||
|
s_mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
#if CONFIG_EXAMPLE_ETH_PHY_IP101
|
#if CONFIG_EXAMPLE_ETH_PHY_IP101
|
||||||
s_phy = esp_eth_phy_new_ip101(&phy_config);
|
s_phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
||||||
|
@@ -101,9 +101,10 @@ void app_main(void)
|
|||||||
|
|
||||||
phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR;
|
phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR;
|
||||||
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
|
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
|
||||||
mac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
esp32_emac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
esp32_emac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
#if CONFIG_EXAMPLE_ETH_PHY_IP101
|
#if CONFIG_EXAMPLE_ETH_PHY_IP101
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
||||||
|
@@ -101,8 +101,6 @@ void app_main(void)
|
|||||||
enc28j60_config.int_gpio_num = CONFIG_EXAMPLE_ENC28J60_INT_GPIO;
|
enc28j60_config.int_gpio_num = CONFIG_EXAMPLE_ENC28J60_INT_GPIO;
|
||||||
|
|
||||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
mac_config.smi_mdc_gpio_num = -1; // ENC28J60 doesn't have SMI interface
|
|
||||||
mac_config.smi_mdio_gpio_num = -1;
|
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_enc28j60(&enc28j60_config, &mac_config);
|
esp_eth_mac_t *mac = esp_eth_mac_new_enc28j60(&enc28j60_config, &mac_config);
|
||||||
|
|
||||||
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
|
||||||
|
@@ -158,9 +158,10 @@ static void initialize_ethernet(void)
|
|||||||
phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR;
|
phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR;
|
||||||
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
|
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
|
||||||
#if CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET
|
#if CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET
|
||||||
mac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
esp32_emac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
esp32_emac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
#if CONFIG_EXAMPLE_ETH_PHY_IP101
|
#if CONFIG_EXAMPLE_ETH_PHY_IP101
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
||||||
|
@@ -208,9 +208,10 @@ void register_ethernet(void)
|
|||||||
phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR;
|
phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR;
|
||||||
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
|
phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO;
|
||||||
#if CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET
|
#if CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET
|
||||||
mac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
esp32_emac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
esp32_emac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
#if CONFIG_EXAMPLE_ETH_PHY_IP101
|
#if CONFIG_EXAMPLE_ETH_PHY_IP101
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
#elif CONFIG_EXAMPLE_ETH_PHY_RTL8201
|
||||||
@@ -293,8 +294,6 @@ void register_ethernet(void)
|
|||||||
eth_enc28j60_config_t enc28j60_config = ETH_ENC28J60_DEFAULT_CONFIG(spi_handle);
|
eth_enc28j60_config_t enc28j60_config = ETH_ENC28J60_DEFAULT_CONFIG(spi_handle);
|
||||||
enc28j60_config.int_gpio_num = CONFIG_EXAMPLE_ETH_SPI_INT_GPIO;
|
enc28j60_config.int_gpio_num = CONFIG_EXAMPLE_ETH_SPI_INT_GPIO;
|
||||||
|
|
||||||
mac_config.smi_mdc_gpio_num = -1; // ENC28J60 doesn't have SMI interface
|
|
||||||
mac_config.smi_mdio_gpio_num = -1;
|
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_enc28j60(&enc28j60_config, &mac_config);
|
esp_eth_mac_t *mac = esp_eth_mac_new_enc28j60(&enc28j60_config, &mac_config);
|
||||||
|
|
||||||
phy_config.autonego_timeout_ms = 0; // ENC28J60 doesn't support auto-negotiation
|
phy_config.autonego_timeout_ms = 0; // ENC28J60 doesn't support auto-negotiation
|
||||||
|
@@ -135,9 +135,10 @@ static void initialize_eth(void)
|
|||||||
phy_config.phy_addr = CONFIG_SNIFFER_ETH_PHY_ADDR;
|
phy_config.phy_addr = CONFIG_SNIFFER_ETH_PHY_ADDR;
|
||||||
phy_config.reset_gpio_num = CONFIG_SNIFFER_ETH_PHY_RST_GPIO;
|
phy_config.reset_gpio_num = CONFIG_SNIFFER_ETH_PHY_RST_GPIO;
|
||||||
#if CONFIG_SNIFFER_USE_INTERNAL_ETHERNET
|
#if CONFIG_SNIFFER_USE_INTERNAL_ETHERNET
|
||||||
mac_config.smi_mdc_gpio_num = CONFIG_SNIFFER_ETH_MDC_GPIO;
|
eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_SNIFFER_ETH_MDIO_GPIO;
|
esp32_emac_config.smi_mdc_gpio_num = CONFIG_SNIFFER_ETH_MDC_GPIO;
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
esp32_emac_config.smi_mdio_gpio_num = CONFIG_SNIFFER_ETH_MDIO_GPIO;
|
||||||
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
|
||||||
#if CONFIG_SNIFFER_ETH_PHY_IP101
|
#if CONFIG_SNIFFER_ETH_PHY_IP101
|
||||||
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||||
#elif CONFIG_SNIFFER_ETH_PHY_RTL8201
|
#elif CONFIG_SNIFFER_ETH_PHY_RTL8201
|
||||||
|
@@ -439,7 +439,6 @@ components/esp_common/include/esp_compiler.h
|
|||||||
components/esp_common/include/esp_types.h
|
components/esp_common/include/esp_types.h
|
||||||
components/esp_common/src/esp_err_to_name.c
|
components/esp_common/src/esp_err_to_name.c
|
||||||
components/esp_common/test/test_attr.c
|
components/esp_common/test/test_attr.c
|
||||||
components/esp_eth/include/esp_eth_mac.h
|
|
||||||
components/esp_eth/include/eth_phy_regs_struct.h
|
components/esp_eth/include/eth_phy_regs_struct.h
|
||||||
components/esp_eth/src/dm9051.h
|
components/esp_eth/src/dm9051.h
|
||||||
components/esp_eth/src/esp_eth_mac_openeth.c
|
components/esp_eth/src/esp_eth_mac_openeth.c
|
||||||
|
Reference in New Issue
Block a user