以太网
应用示例
以太网基本示例:ethernet/basic.
以太网 iperf 示例:ethernet/iperf.
以太网驱动程序模型
以太网通用接口
以太网 MAC 接口
以太网 PHY 接口
以太网 PHY 公共寄存器
API 参考 – 通用接口
Header File
Structures
-
struct esp_eth_mediator_s
Ethernet mediator.
Public Members
-
esp_err_t (*phy_reg_read)(esp_eth_mediator_t *eth, uint32_t phy_addr, uint32_t phy_reg, uint32_t *reg_value)
Read PHY register.
- Param eth
[in] mediator of Ethernet driver
- Param phy_addr
[in] PHY Chip address (0~31)
- Param phy_reg
[in] PHY register index code
- Param reg_value
[out] PHY register value
- Return
ESP_OK: read PHY register successfully
ESP_FAIL: read PHY register failed because some error occurred
-
esp_err_t (*phy_reg_write)(esp_eth_mediator_t *eth, uint32_t phy_addr, uint32_t phy_reg, uint32_t reg_value)
Write PHY register.
- Param eth
[in] mediator of Ethernet driver
- Param phy_addr
[in] PHY Chip address (0~31)
- Param phy_reg
[in] PHY register index code
- Param reg_value
[in] PHY register value
- Return
ESP_OK: write PHY register successfully
ESP_FAIL: write PHY register failed because some error occurred
-
esp_err_t (*stack_input)(esp_eth_mediator_t *eth, uint8_t *buffer, uint32_t length)
Deliver packet to upper stack.
- Param eth
[in] mediator of Ethernet driver
- Param buffer
[in] packet buffer
- Param length
[in] length of the packet
- Return
ESP_OK: deliver packet to upper stack successfully
ESP_FAIL: deliver packet failed because some error occurred
-
esp_err_t (*on_state_changed)(esp_eth_mediator_t *eth, esp_eth_state_t state, void *args)
Callback on Ethernet state changed.
- Param eth
[in] mediator of Ethernet driver
- Param state
[in] new state
- Param args
[in] optional argument for the new state
- Return
ESP_OK: process the new state successfully
ESP_FAIL: process the new state failed because some error occurred
-
esp_err_t (*phy_reg_read)(esp_eth_mediator_t *eth, uint32_t phy_addr, uint32_t phy_reg, uint32_t *reg_value)
Type Definitions
-
typedef struct esp_eth_mediator_s esp_eth_mediator_t
Ethernet mediator.
Enumerations
-
enum esp_eth_state_t
Ethernet driver state.
Values:
-
enumerator ETH_STATE_LLINIT
Lowlevel init done
-
enumerator ETH_STATE_DEINIT
Deinit done
-
enumerator ETH_STATE_LINK
Link status changed
-
enumerator ETH_STATE_SPEED
Speed updated
-
enumerator ETH_STATE_DUPLEX
Duplex updated
-
enumerator ETH_STATE_PAUSE
Pause ability updated
-
enumerator ETH_STATE_LLINIT
API 参考 – MAC 接口
Header File
Functions
-
esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config, const eth_mac_config_t *config)
Create ESP32 Ethernet MAC instance.
- 参数
esp32_config – EMAC specific configuration
config – Ethernet MAC configuration
- 返回
instance: create MAC instance successfully
NULL: create MAC instance failed because some error occurred
Unions
-
union eth_mac_clock_config_t
- #include <esp_eth_mac.h>
Ethernet MAC Clock Configuration.
Public Members
-
struct eth_mac_clock_config_t::[anonymous] mii
EMAC MII Clock Configuration
-
emac_rmii_clock_mode_t clock_mode
RMII Clock Mode Configuration
-
emac_rmii_clock_gpio_t clock_gpio
RMII Clock GPIO Configuration
-
struct eth_mac_clock_config_t::[anonymous] rmii
EMAC RMII Clock Configuration
-
struct eth_mac_clock_config_t::[anonymous] mii
Structures
-
struct esp_eth_mac_s
Ethernet MAC.
Public Members
-
esp_err_t (*set_mediator)(esp_eth_mac_t *mac, esp_eth_mediator_t *eth)
Set mediator for Ethernet MAC.
- Param mac
[in] Ethernet MAC instance
- Param eth
[in] Ethernet mediator
- Return
ESP_OK: set mediator for Ethernet MAC successfully
ESP_ERR_INVALID_ARG: set mediator for Ethernet MAC failed because of invalid argument
-
esp_err_t (*init)(esp_eth_mac_t *mac)
Initialize Ethernet MAC.
- Param mac
[in] Ethernet MAC instance
- Return
ESP_OK: initialize Ethernet MAC successfully
ESP_ERR_TIMEOUT: initialize Ethernet MAC failed because of timeout
ESP_FAIL: initialize Ethernet MAC failed because some other error occurred
-
esp_err_t (*deinit)(esp_eth_mac_t *mac)
Deinitialize Ethernet MAC.
- Param mac
[in] Ethernet MAC instance
- Return
ESP_OK: deinitialize Ethernet MAC successfully
ESP_FAIL: deinitialize Ethernet MAC failed because some error occurred
-
esp_err_t (*start)(esp_eth_mac_t *mac)
Start Ethernet MAC.
- Param mac
[in] Ethernet MAC instance
- Return
ESP_OK: start Ethernet MAC successfully
ESP_FAIL: start Ethernet MAC failed because some other error occurred
-
esp_err_t (*stop)(esp_eth_mac_t *mac)
Stop Ethernet MAC.
- Param mac
[in] Ethernet MAC instance
- Return
ESP_OK: stop Ethernet MAC successfully
ESP_FAIL: stop Ethernet MAC failed because some error occurred
-
esp_err_t (*transmit)(esp_eth_mac_t *mac, uint8_t *buf, uint32_t length)
Transmit packet from Ethernet MAC.
备注
Returned error codes may differ for each specific MAC chip.
- Param mac
[in] Ethernet MAC instance
- Param buf
[in] packet buffer to transmit
- Param length
[in] length of packet
- Return
ESP_OK: transmit packet successfully
ESP_ERR_INVALID_SIZE: number of actually sent bytes differs to expected
ESP_FAIL: transmit packet failed because some other error occurred
-
esp_err_t (*transmit_vargs)(esp_eth_mac_t *mac, uint32_t argc, va_list args)
Transmit packet from Ethernet MAC constructed with special parameters at Layer2.
备注
Typical intended use case is to make possible to construct a frame from multiple higher layer buffers without a need of buffer reallocations. However, other use cases are not limited.
备注
Returned error codes may differ for each specific MAC chip.
- Param mac
[in] Ethernet MAC instance
- Param argc
[in] number variable arguments
- Param args
[in] variable arguments
- Return
ESP_OK: transmit packet successfully
ESP_ERR_INVALID_SIZE: number of actually sent bytes differs to expected
ESP_FAIL: transmit packet failed because some other error occurred
-
esp_err_t (*receive)(esp_eth_mac_t *mac, uint8_t *buf, uint32_t *length)
Receive packet from Ethernet MAC.
备注
Memory of buf is allocated in the Layer2, make sure it get free after process.
备注
Before this function got invoked, the value of “length” should set by user, equals the size of buffer. After the function returned, the value of “length” means the real length of received data.
- Param mac
[in] Ethernet MAC instance
- Param buf
[out] packet buffer which will preserve the received frame
- Param length
[out] length of the received packet
- Return
ESP_OK: receive packet successfully
ESP_ERR_INVALID_ARG: receive packet failed because of invalid argument
ESP_ERR_INVALID_SIZE: input buffer size is not enough to hold the incoming data. in this case, value of returned “length” indicates the real size of incoming data.
ESP_FAIL: receive packet failed because some other error occurred
-
esp_err_t (*read_phy_reg)(esp_eth_mac_t *mac, uint32_t phy_addr, uint32_t phy_reg, uint32_t *reg_value)
Read PHY register.
- Param mac
[in] Ethernet MAC instance
- Param phy_addr
[in] PHY chip address (0~31)
- Param phy_reg
[in] PHY register index code
- Param reg_value
[out] PHY register value
- Return
ESP_OK: read PHY register successfully
ESP_ERR_INVALID_ARG: read PHY register failed because of invalid argument
ESP_ERR_INVALID_STATE: read PHY register failed because of wrong state of MAC
ESP_ERR_TIMEOUT: read PHY register failed because of timeout
ESP_FAIL: read PHY register failed because some other error occurred
-
esp_err_t (*write_phy_reg)(esp_eth_mac_t *mac, uint32_t phy_addr, uint32_t phy_reg, uint32_t reg_value)
Write PHY register.
- Param mac
[in] Ethernet MAC instance
- Param phy_addr
[in] PHY chip address (0~31)
- Param phy_reg
[in] PHY register index code
- Param reg_value
[in] PHY register value
- Return
ESP_OK: write PHY register successfully
ESP_ERR_INVALID_STATE: write PHY register failed because of wrong state of MAC
ESP_ERR_TIMEOUT: write PHY register failed because of timeout
ESP_FAIL: write PHY register failed because some other error occurred
-
esp_err_t (*set_addr)(esp_eth_mac_t *mac, uint8_t *addr)
Set MAC address.
- Param mac
[in] Ethernet MAC instance
- Param addr
[in] MAC address
- Return
ESP_OK: set MAC address successfully
ESP_ERR_INVALID_ARG: set MAC address failed because of invalid argument
ESP_FAIL: set MAC address failed because some other error occurred
-
esp_err_t (*get_addr)(esp_eth_mac_t *mac, uint8_t *addr)
Get MAC address.
- Param mac
[in] Ethernet MAC instance
- Param addr
[out] MAC address
- Return
ESP_OK: get MAC address successfully
ESP_ERR_INVALID_ARG: get MAC address failed because of invalid argument
ESP_FAIL: get MAC address failed because some other error occurred
-
esp_err_t (*set_speed)(esp_eth_mac_t *mac, eth_speed_t speed)
Set speed of MAC.
- Param ma:c
[in] Ethernet MAC instance
- Param speed
[in] MAC speed
- Return
ESP_OK: set MAC speed successfully
ESP_ERR_INVALID_ARG: set MAC speed failed because of invalid argument
ESP_FAIL: set MAC speed failed because some other error occurred
-
esp_err_t (*set_duplex)(esp_eth_mac_t *mac, eth_duplex_t duplex)
Set duplex mode of MAC.
- Param mac
[in] Ethernet MAC instance
- Param duplex
[in] MAC duplex
- Return
ESP_OK: set MAC duplex mode successfully
ESP_ERR_INVALID_ARG: set MAC duplex failed because of invalid argument
ESP_FAIL: set MAC duplex failed because some other error occurred
-
esp_err_t (*set_link)(esp_eth_mac_t *mac, eth_link_t link)
Set link status of MAC.
- Param mac
[in] Ethernet MAC instance
- Param link
[in] Link status
- Return
ESP_OK: set link status successfully
ESP_ERR_INVALID_ARG: set link status failed because of invalid argument
ESP_FAIL: set link status failed because some other error occurred
-
esp_err_t (*set_promiscuous)(esp_eth_mac_t *mac, bool enable)
Set promiscuous of MAC.
- Param mac
[in] Ethernet MAC instance
- Param enable
[in] set true to enable promiscuous mode; set false to disable promiscuous mode
- Return
ESP_OK: set promiscuous mode successfully
ESP_FAIL: set promiscuous mode failed because some error occurred
-
esp_err_t (*enable_flow_ctrl)(esp_eth_mac_t *mac, bool enable)
Enable flow control on MAC layer or not.
- Param mac
[in] Ethernet MAC instance
- Param enable
[in] set true to enable flow control; set false to disable flow control
- Return
ESP_OK: set flow control successfully
ESP_FAIL: set flow control failed because some error occurred
-
esp_err_t (*set_peer_pause_ability)(esp_eth_mac_t *mac, uint32_t ability)
Set the PAUSE ability of peer node.
- Param mac
[in] Ethernet MAC instance
- Param ability
[in] zero indicates that pause function is supported by link partner; non-zero indicates that pause function is not supported by link partner
- Return
ESP_OK: set peer pause ability successfully
ESP_FAIL: set peer pause ability failed because some error occurred
-
esp_err_t (*custom_ioctl)(esp_eth_mac_t *mac, uint32_t cmd, void *data)
Custom IO function of MAC driver. This function is intended to extend common options of esp_eth_ioctl to cover specifics of MAC chip.
备注
This function may not be assigned when the MAC chip supports only most common set of configuration options.
- Param mac
[in] Ethernet MAC instance
- Param cmd
[in] IO control command
- Param data
[inout] address of data for
set
command or address where to store the data when used withget
command- Return
ESP_OK: process io command successfully
ESP_ERR_INVALID_ARG: process io command failed because of some invalid argument
ESP_FAIL: process io command failed because some other error occurred
ESP_ERR_NOT_SUPPORTED: requested feature is not supported
-
esp_err_t (*del)(esp_eth_mac_t *mac)
Free memory of Ethernet MAC.
- Param mac
[in] Ethernet MAC instance
- Return
ESP_OK: free Ethernet MAC instance successfully
ESP_FAIL: free Ethernet MAC instance failed because some error occurred
-
esp_err_t (*set_mediator)(esp_eth_mac_t *mac, esp_eth_mediator_t *eth)
-
struct eth_mac_config_t
Configuration of Ethernet MAC object.
-
struct eth_esp32_emac_config_t
EMAC specific configuration.
Public Members
-
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
-
int smi_mdc_gpio_num
Macros
-
ETH_MAC_FLAG_WORK_WITH_CACHE_DISABLE
MAC driver can work when cache is disabled
-
ETH_MAC_FLAG_PIN_TO_CORE
Pin MAC task to the CPU core where driver installation happened
-
ETH_MAC_DEFAULT_CONFIG()
Default configuration for Ethernet MAC object.
-
ETH_ESP32_EMAC_DEFAULT_CONFIG()
Default ESP32’s EMAC specific configuration.
Type Definitions
-
typedef struct esp_eth_mac_s esp_eth_mac_t
Ethernet MAC.
Enumerations
-
enum emac_rmii_clock_mode_t
RMII Clock Mode Options.
Values:
-
enumerator EMAC_CLK_DEFAULT
Default values configured using Kconfig are going to be used when “Default” selected.
-
enumerator EMAC_CLK_EXT_IN
Input RMII Clock from external. EMAC Clock GPIO number needs to be configured when this option is selected.
备注
MAC will get RMII clock from outside. Note that ESP32 only supports GPIO0 to input the RMII clock.
-
enumerator EMAC_CLK_OUT
Output RMII Clock from internal APLL Clock. EMAC Clock GPIO number needs to be configured when this option is selected.
-
enumerator EMAC_CLK_DEFAULT
-
enum emac_rmii_clock_gpio_t
RMII Clock GPIO number Options.
Values:
-
enumerator EMAC_CLK_IN_GPIO
MAC will get RMII clock from outside at this GPIO.
备注
ESP32 only supports GPIO0 to input the RMII clock.
-
enumerator EMAC_APPL_CLK_OUT_GPIO
Output RMII Clock from internal APLL Clock available at GPIO0.
备注
GPIO0 can be set to output a pre-divided PLL clock (test only!). Enabling this option will configure GPIO0 to output a 50MHz clock. In fact this clock doesn’t have directly relationship with EMAC peripheral. Sometimes this clock won’t work well with your PHY chip. You might need to add some extra devices after GPIO0 (e.g. inverter). Note that outputting RMII clock on GPIO0 is an experimental practice. If you want the Ethernet to work with WiFi, don’t select GPIO0 output mode for stability.
-
enumerator EMAC_CLK_OUT_GPIO
Output RMII Clock from internal APLL Clock available at GPIO16.
-
enumerator EMAC_CLK_OUT_180_GPIO
Inverted Output RMII Clock from internal APLL Clock available at GPIO17.
-
enumerator EMAC_CLK_IN_GPIO
API 参考 – PHY 接口
Header File
Functions
-
esp_eth_phy_t *esp_eth_phy_new_ip101(const eth_phy_config_t *config)
Create a PHY instance of IP101.
- 参数
config – [in] configuration of PHY
- 返回
instance: create PHY instance successfully
NULL: create PHY instance failed because some error occurred
-
esp_eth_phy_t *esp_eth_phy_new_rtl8201(const eth_phy_config_t *config)
Create a PHY instance of RTL8201.
- 参数
config – [in] configuration of PHY
- 返回
instance: create PHY instance successfully
NULL: create PHY instance failed because some error occurred
-
esp_eth_phy_t *esp_eth_phy_new_lan87xx(const eth_phy_config_t *config)
Create a PHY instance of LAN87xx.
- 参数
config – [in] configuration of PHY
- 返回
instance: create PHY instance successfully
NULL: create PHY instance failed because some error occurred
-
esp_eth_phy_t *esp_eth_phy_new_dp83848(const eth_phy_config_t *config)
Create a PHY instance of DP83848.
- 参数
config – [in] configuration of PHY
- 返回
instance: create PHY instance successfully
NULL: create PHY instance failed because some error occurred
-
esp_eth_phy_t *esp_eth_phy_new_ksz80xx(const eth_phy_config_t *config)
Create a PHY instance of KSZ80xx.
The phy model from the KSZ80xx series is detected automatically. If the driver is unable to detect a supported model,
NULL
is returned.Currently, the following models are supported: KSZ8001, KSZ8021, KSZ8031, KSZ8041, KSZ8051, KSZ8061, KSZ8081, KSZ8091
- 参数
config – [in] configuration of PHY
- 返回
instance: create PHY instance successfully
NULL: create PHY instance failed because some error occurred
Structures
-
struct esp_eth_phy_s
Ethernet PHY.
Public Members
-
esp_err_t (*set_mediator)(esp_eth_phy_t *phy, esp_eth_mediator_t *mediator)
Set mediator for PHY.
- Param phy
[in] Ethernet PHY instance
- Param mediator
[in] mediator of Ethernet driver
- Return
ESP_OK: set mediator for Ethernet PHY instance successfully
ESP_ERR_INVALID_ARG: set mediator for Ethernet PHY instance failed because of some invalid arguments
-
esp_err_t (*reset)(esp_eth_phy_t *phy)
Software Reset Ethernet PHY.
- Param phy
[in] Ethernet PHY instance
- Return
ESP_OK: reset Ethernet PHY successfully
ESP_FAIL: reset Ethernet PHY failed because some error occurred
-
esp_err_t (*reset_hw)(esp_eth_phy_t *phy)
Hardware Reset Ethernet PHY.
备注
Hardware reset is mostly done by pull down and up PHY’s nRST pin
- Param phy
[in] Ethernet PHY instance
- Return
ESP_OK: reset Ethernet PHY successfully
ESP_FAIL: reset Ethernet PHY failed because some error occurred
-
esp_err_t (*init)(esp_eth_phy_t *phy)
Initialize Ethernet PHY.
- Param phy
[in] Ethernet PHY instance
- Return
ESP_OK: initialize Ethernet PHY successfully
ESP_FAIL: initialize Ethernet PHY failed because some error occurred
-
esp_err_t (*deinit)(esp_eth_phy_t *phy)
Deinitialize Ethernet PHY.
- Param phy
[in] Ethernet PHY instance
- Return
ESP_OK: deinitialize Ethernet PHY successfully
ESP_FAIL: deinitialize Ethernet PHY failed because some error occurred
-
esp_err_t (*autonego_ctrl)(esp_eth_phy_t *phy, eth_phy_autoneg_cmd_t cmd, bool *autonego_en_stat)
Configure auto negotiation.
- Param phy
[in] Ethernet PHY instance
- Param cmd
[in] Configuration command, it is possible to Enable (restart), Disable or get current status of PHY auto negotiation
- Param autonego_en_stat
[out] Address where to store current status of auto negotiation configuration
- Return
ESP_OK: restart auto negotiation successfully
ESP_FAIL: restart auto negotiation failed because some error occurred
ESP_ERR_INVALID_ARG: invalid command
-
esp_err_t (*get_link)(esp_eth_phy_t *phy)
Get Ethernet PHY link status.
- Param phy
[in] Ethernet PHY instance
- Return
ESP_OK: get Ethernet PHY link status successfully
ESP_FAIL: get Ethernet PHY link status failed because some error occurred
-
esp_err_t (*pwrctl)(esp_eth_phy_t *phy, bool enable)
Power control of Ethernet PHY.
- Param phy
[in] Ethernet PHY instance
- Param enable
[in] set true to power on Ethernet PHY; ser false to power off Ethernet PHY
- Return
ESP_OK: control Ethernet PHY power successfully
ESP_FAIL: control Ethernet PHY power failed because some error occurred
-
esp_err_t (*set_addr)(esp_eth_phy_t *phy, uint32_t addr)
Set PHY chip address.
- Param phy
[in] Ethernet PHY instance
- Param addr
[in] PHY chip address
- Return
ESP_OK: set Ethernet PHY address successfully
ESP_FAIL: set Ethernet PHY address failed because some error occurred
-
esp_err_t (*get_addr)(esp_eth_phy_t *phy, uint32_t *addr)
Get PHY chip address.
- Param phy
[in] Ethernet PHY instance
- Param addr
[out] PHY chip address
- Return
ESP_OK: get Ethernet PHY address successfully
ESP_ERR_INVALID_ARG: get Ethernet PHY address failed because of invalid argument
-
esp_err_t (*advertise_pause_ability)(esp_eth_phy_t *phy, uint32_t ability)
Advertise pause function supported by MAC layer.
- Param phy
[in] Ethernet PHY instance
- Param addr
[out] Pause ability
- Return
ESP_OK: Advertise pause ability successfully
ESP_ERR_INVALID_ARG: Advertise pause ability failed because of invalid argument
-
esp_err_t (*loopback)(esp_eth_phy_t *phy, bool enable)
Sets the PHY to loopback mode.
- Param phy
[in] Ethernet PHY instance
- Param enable
[in] enables or disables PHY loopback
- Return
ESP_OK: PHY instance loopback mode has been configured successfully
ESP_FAIL: PHY instance loopback configuration failed because some error occurred
-
esp_err_t (*set_speed)(esp_eth_phy_t *phy, eth_speed_t speed)
Sets PHY speed mode.
备注
Autonegotiation feature needs to be disabled prior to calling this function for the new setting to be applied
- Param phy
[in] Ethernet PHY instance
- Param speed
[in] Speed mode to be set
- Return
ESP_OK: PHY instance speed mode has been configured successfully
ESP_FAIL: PHY instance speed mode configuration failed because some error occurred
-
esp_err_t (*set_duplex)(esp_eth_phy_t *phy, eth_duplex_t duplex)
Sets PHY duplex mode.
备注
Autonegotiation feature needs to be disabled prior to calling this function for the new setting to be applied
- Param phy
[in] Ethernet PHY instance
- Param duplex
[in] Duplex mode to be set
- Return
ESP_OK: PHY instance duplex mode has been configured successfully
ESP_FAIL: PHY instance duplex mode configuration failed because some error occurred
-
esp_err_t (*custom_ioctl)(esp_eth_phy_t *phy, uint32_t cmd, void *data)
Custom IO function of PHY driver. This function is intended to extend common options of esp_eth_ioctl to cover specifics of PHY chip.
备注
This function may not be assigned when the PHY chip supports only most common set of configuration options.
- Param phy
[in] Ethernet PHY instance
- Param cmd
[in] IO control command
- Param data
[inout] address of data for
set
command or address where to store the data when used withget
command- Return
ESP_OK: process io command successfully
ESP_ERR_INVALID_ARG: process io command failed because of some invalid argument
ESP_FAIL: process io command failed because some other error occurred
ESP_ERR_NOT_SUPPORTED: requested feature is not supported
-
esp_err_t (*del)(esp_eth_phy_t *phy)
Free memory of Ethernet PHY instance.
- Param phy
[in] Ethernet PHY instance
- Return
ESP_OK: free PHY instance successfully
ESP_FAIL: free PHY instance failed because some error occurred
-
esp_err_t (*set_mediator)(esp_eth_phy_t *phy, esp_eth_mediator_t *mediator)
-
struct eth_phy_config_t
Ethernet PHY configuration.
Public Members
-
int32_t phy_addr
PHY address, set -1 to enable PHY address detection at initialization stage
-
uint32_t reset_timeout_ms
Reset timeout value (Unit: ms)
-
uint32_t autonego_timeout_ms
Auto-negotiation timeout value (Unit: ms)
-
int reset_gpio_num
Reset GPIO number, -1 means no hardware reset
-
int32_t phy_addr
Macros
-
ESP_ETH_PHY_ADDR_AUTO
-
ETH_PHY_DEFAULT_CONFIG()
Default configuration for Ethernet PHY object.
Type Definitions
-
typedef struct esp_eth_phy_s esp_eth_phy_t
Ethernet PHY.
API 参考 – esp_netif 相关使用
Header File
Functions
-
esp_eth_netif_glue_handle_t esp_eth_new_netif_glue(esp_eth_handle_t eth_hdl)
Create a netif glue for Ethernet driver.
备注
netif glue is used to attach io driver to TCP/IP netif
- 参数
eth_hdl – Ethernet driver handle
- 返回
glue object, which inherits esp_netif_driver_base_t
-
esp_err_t esp_eth_del_netif_glue(esp_eth_netif_glue_handle_t eth_netif_glue)
Delete netif glue of Ethernet driver.
- 参数
eth_netif_glue – netif glue
- 返回
-ESP_OK: delete netif glue successfully