mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
esp_eth: Make EMAC DMA burst size configurable
Merges https://github.com/espressif/esp-idf/pull/7874 Closes https://github.com/espressif/esp-idf/issues/7380
This commit is contained in:
committed by
David Čermák
parent
a6ca3d39a8
commit
2553fb5845
@ -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>
|
||||||
@ -365,6 +357,26 @@ typedef union {
|
|||||||
} rmii; /*!< EMAC RMII Clock Configuration */
|
} rmii; /*!< EMAC RMII Clock Configuration */
|
||||||
} eth_mac_clock_config_t;
|
} eth_mac_clock_config_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Options of EMAC DMA burst len
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
ETH_DMA_RX_BURST_LEN_32,
|
||||||
|
ETH_DMA_RX_BURST_LEN_16,
|
||||||
|
ETH_DMA_RX_BURST_LEN_8,
|
||||||
|
} eth_mac_dma_rx_burst_len_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief EMAC specific configuration (sub-struct of Ethernet MAC config)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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_rx_burst_len_t dma_rx_burst_len; /*!< EMAC DMA Rx burst len configuration */
|
||||||
|
} eth_esp32_emac_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configuration of Ethernet MAC object
|
* @brief Configuration of Ethernet MAC object
|
||||||
@ -374,11 +386,15 @@ 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) */
|
union {
|
||||||
eth_mac_clock_config_t clock_config; /*!< EMAC Interface clock configuration */
|
eth_esp32_emac_t esp32_emac; /*!< ESP32's internal EMAC configuration */
|
||||||
|
// Placeholder for another supported MAC configs
|
||||||
|
struct eth_custom_mac *p_custom_mac; /*!< Opaque pointer to an additional custom MAC config
|
||||||
|
* Note: This config could be used for IDF supported MAC
|
||||||
|
* as well as any additional MAC introduced in user-space
|
||||||
|
* */
|
||||||
|
}; /*!< Union of mutually exclusive vendor specific MAC options */
|
||||||
} 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 */
|
||||||
@ -388,21 +404,24 @@ typedef struct {
|
|||||||
* @brief Default configuration for Ethernet MAC object
|
* @brief Default configuration for Ethernet MAC object
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define ETH_MAC_DEFAULT_CONFIG() \
|
#define ETH_MAC_DEFAULT_CONFIG() \
|
||||||
{ \
|
{ \
|
||||||
.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, \
|
||||||
.smi_mdc_gpio_num = 23, \
|
|
||||||
.smi_mdio_gpio_num = 18, \
|
|
||||||
.flags = 0, \
|
.flags = 0, \
|
||||||
.interface = EMAC_DATA_INTERFACE_RMII, \
|
.esp32_emac = { \
|
||||||
.clock_config = \
|
.smi_mdc_gpio_num = 23, \
|
||||||
{ \
|
.smi_mdio_gpio_num = 18, \
|
||||||
.rmii = \
|
.interface = EMAC_DATA_INTERFACE_RMII, \
|
||||||
|
.clock_config = \
|
||||||
{ \
|
{ \
|
||||||
.clock_mode = EMAC_CLK_DEFAULT, \
|
.rmii = \
|
||||||
.clock_gpio = EMAC_CLK_IN_GPIO \
|
{ \
|
||||||
|
.clock_mode = EMAC_CLK_DEFAULT, \
|
||||||
|
.clock_gpio = EMAC_CLK_IN_GPIO \
|
||||||
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -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_rx_burst_len_t dma_rx_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,11 @@ 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 by default with selected EMAC_RX_DMA_BURST */
|
||||||
emac_hal_init_dma_default(&emac->hal);
|
emac_hal_init_dma_default(&emac->hal,
|
||||||
|
emac->dma_rx_burst_len == ETH_DMA_RX_BURST_LEN_8 ? EMAC_LL_DMA_BURST_LENGTH_8BEAT :
|
||||||
|
emac->dma_rx_burst_len == ETH_DMA_RX_BURST_LEN_16 ? EMAC_LL_DMA_BURST_LENGTH_16BEAT :
|
||||||
|
EMAC_LL_DMA_BURST_LENGTH_32BEAT);
|
||||||
/* 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 */
|
||||||
@ -462,6 +466,7 @@ static esp_err_t esp_emac_alloc_driver_obj(const eth_mac_config_t *config, emac_
|
|||||||
emac = calloc(1, sizeof(emac_esp32_t));
|
emac = calloc(1, sizeof(emac_esp32_t));
|
||||||
}
|
}
|
||||||
ESP_GOTO_ON_FALSE(emac, ESP_ERR_NO_MEM, err, TAG, "no mem for esp emac object");
|
ESP_GOTO_ON_FALSE(emac, ESP_ERR_NO_MEM, err, TAG, "no mem for esp emac object");
|
||||||
|
emac->dma_rx_burst_len = config->esp32_emac.dma_rx_burst_len;
|
||||||
/* alloc memory for ethernet dma descriptor */
|
/* alloc memory for ethernet dma descriptor */
|
||||||
uint32_t desc_size = CONFIG_ETH_DMA_RX_BUFFER_NUM * sizeof(eth_dma_rx_descriptor_t) +
|
uint32_t desc_size = CONFIG_ETH_DMA_RX_BUFFER_NUM * sizeof(eth_dma_rx_descriptor_t) +
|
||||||
CONFIG_ETH_DMA_TX_BUFFER_NUM * sizeof(eth_dma_tx_descriptor_t);
|
CONFIG_ETH_DMA_TX_BUFFER_NUM * sizeof(eth_dma_tx_descriptor_t);
|
||||||
@ -500,9 +505,9 @@ err:
|
|||||||
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_mac_config_t *config, emac_esp32_t *emac)
|
||||||
{
|
{
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
switch (config->interface) {
|
switch (config->esp32_emac.interface) {
|
||||||
case EMAC_DATA_INTERFACE_MII:
|
case EMAC_DATA_INTERFACE_MII:
|
||||||
emac->clock_config = config->clock_config;
|
emac->clock_config = config->esp32_emac.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 +515,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 (config->esp32_emac.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 +534,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 = config->esp32_emac.clock_config;
|
||||||
}
|
}
|
||||||
/* RMII interface GPIO initialization */
|
/* RMII interface GPIO initialization */
|
||||||
emac_hal_iomux_init_rmii();
|
emac_hal_iomux_init_rmii();
|
||||||
@ -559,7 +564,7 @@ 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", config->esp32_emac.interface);
|
||||||
}
|
}
|
||||||
err:
|
err:
|
||||||
return ret;
|
return ret;
|
||||||
@ -592,8 +597,8 @@ esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_mac_config_t *config)
|
|||||||
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->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 = config->esp32_emac.smi_mdc_gpio_num;
|
||||||
emac->smi_mdio_gpio_num = config->smi_mdio_gpio_num;
|
emac->smi_mdio_gpio_num = config->esp32_emac.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;
|
||||||
|
@ -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, uint32_t dma_rx_burst_len)
|
||||||
{
|
{
|
||||||
/* DMAOMR Configuration */
|
/* DMAOMR Configuration */
|
||||||
/* Enable Dropping of TCP/IP Checksum Error Frames */
|
/* Enable Dropping of TCP/IP Checksum Error Frames */
|
||||||
@ -297,7 +297,7 @@ void emac_hal_init_dma_default(emac_hal_context_t *hal)
|
|||||||
/* Use Separate PBL */
|
/* Use Separate PBL */
|
||||||
emac_ll_use_separate_pbl_enable(hal->dma_regs, true);
|
emac_ll_use_separate_pbl_enable(hal->dma_regs, true);
|
||||||
/* 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_8BEAT);
|
emac_ll_set_rx_dma_pbl(hal->dma_regs, dma_rx_burst_len);
|
||||||
emac_ll_set_prog_burst_len(hal->dma_regs, EMAC_LL_DMA_BURST_LENGTH_32BEAT);
|
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);
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
@ -189,7 +189,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, uint32_t dma_rx_burst_len);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -379,8 +379,8 @@ 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;
|
mac_config.esp32_emac.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
mac_config.esp32_emac.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
||||||
s_mac = esp_eth_mac_new_esp32(&mac_config);
|
s_mac = esp_eth_mac_new_esp32(&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);
|
||||||
|
@ -101,8 +101,8 @@ 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;
|
mac_config.esp32_emac.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
mac_config.esp32_emac.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&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);
|
||||||
|
@ -101,8 +101,7 @@ 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.p_custom_mac = NULL; // ENC28J60 MAC doesn't use any specific config
|
||||||
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,8 +158,8 @@ 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;
|
mac_config.esp32_emac.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
mac_config.esp32_emac.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&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);
|
||||||
|
@ -208,8 +208,8 @@ 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;
|
mac_config.esp32_emac.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO;
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
mac_config.esp32_emac.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO;
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&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);
|
||||||
@ -293,8 +293,7 @@ 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.p_custom_mac = NULL; // ENC28J60 MAC doesn't use any specific config
|
||||||
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,8 +135,8 @@ 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;
|
mac_config.esp32_emac.smi_mdc_gpio_num = CONFIG_SNIFFER_ETH_MDC_GPIO;
|
||||||
mac_config.smi_mdio_gpio_num = CONFIG_SNIFFER_ETH_MDIO_GPIO;
|
mac_config.esp32_emac.smi_mdio_gpio_num = CONFIG_SNIFFER_ETH_MDIO_GPIO;
|
||||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
|
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&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);
|
||||||
|
@ -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