mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-27 17:27:15 +02:00
IDF master 3e370c4296
* Fix build compilation due to changes in the HW_TIMER's structs * Fix compilation warnings and errors with USB * Update USBCDC.cpp * Update CMakeLists.txt * Update HWCDC.cpp
This commit is contained in:
@ -265,12 +265,24 @@ esp_err_t esp_eth_receive(esp_eth_handle_t hdl, uint8_t *buf, uint32_t *length)
|
||||
*
|
||||
* @param[in] hdl: handle of Ethernet driver
|
||||
* @param[in] cmd: IO control command
|
||||
* @param[in] data: specificed data for command
|
||||
* @param[in, out] data: address of data for `set` command or address where to store the data when used with `get` 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
|
||||
*
|
||||
* The following IO control commands are supported:
|
||||
* @li @c ETH_CMD_S_MAC_ADDR sets Ethernet interface MAC address. @c data argument is pointer to MAC address buffer with expected size of 6 bytes.
|
||||
* @li @c ETH_CMD_G_MAC_ADDR gets Ethernet interface MAC address. @c data argument is pointer to a buffer to which MAC address is to be copied. The buffer size must be at least 6 bytes.
|
||||
* @li @c ETH_CMD_S_PHY_ADDR sets PHY address in range of <0-31>. @c data argument is pointer to memory of uint32_t datatype from where the configuration option is read.
|
||||
* @li @c ETH_CMD_G_PHY_ADDR gets PHY address. @c data argument is pointer to memory of uint32_t datatype to which the PHY address is to be stored.
|
||||
* @li @c ETH_CMD_G_SPEED gets current Ethernet link speed. @c data argument is pointer to memory of eth_speed_t datatype to which the speed is to be stored.
|
||||
* @li @c ETH_CMD_S_PROMISCUOUS sets/resets Ethernet interface promiscuous mode. @c data argument is pointer to memory of bool datatype from which the configuration option is read.
|
||||
* @li @c ETH_CMD_S_FLOW_CTRL sets/resets Ethernet interface flow control. @c data argument is pointer to memory of bool datatype from which the configuration option is read.
|
||||
* @li @c ETH_CMD_G_DUPLEX_MODE gets current Ethernet link duplex mode. @c data argument is pointer to memory of eth_duplex_t datatype to which the duplex mode is to be stored.
|
||||
* @li @c ETH_CMD_S_PHY_LOOPBACK sets/resets PHY to/from loopback mode. @c data argument is pointer to memory of bool datatype from which the configuration option is read.
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_eth_ioctl(esp_eth_handle_t hdl, esp_eth_io_cmd_t cmd, void *data);
|
||||
|
||||
|
@ -89,6 +89,7 @@ typedef enum {
|
||||
ETH_CMD_S_PROMISCUOUS, /*!< Set promiscuous mode */
|
||||
ETH_CMD_S_FLOW_CTRL, /*!< Set flow control */
|
||||
ETH_CMD_G_DUPLEX_MODE, /*!< Get Duplex mode */
|
||||
ETH_CMD_S_PHY_LOOPBACK,/*!< Set PHY loopback */
|
||||
} esp_eth_io_cmd_t;
|
||||
|
||||
/**
|
||||
|
@ -391,7 +391,7 @@ typedef struct {
|
||||
#define ETH_MAC_DEFAULT_CONFIG() \
|
||||
{ \
|
||||
.sw_reset_timeout_ms = 100, \
|
||||
.rx_task_stack_size = 4096, \
|
||||
.rx_task_stack_size = 2048, \
|
||||
.rx_task_prio = 15, \
|
||||
.smi_mdc_gpio_num = 23, \
|
||||
.smi_mdio_gpio_num = 18, \
|
||||
|
@ -19,6 +19,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Handle of netif glue - an intermediate layer between netif and Ethernet driver
|
||||
*
|
||||
*/
|
||||
typedef struct esp_eth_netif_glue_t* esp_eth_netif_glue_handle_t;
|
||||
|
||||
/**
|
||||
* @brief Create a netif glue for Ethernet driver
|
||||
* @note netif glue is used to attach io driver to TCP/IP netif
|
||||
@ -26,20 +32,23 @@ extern "C" {
|
||||
* @param eth_hdl Ethernet driver handle
|
||||
* @return glue object, which inherits esp_netif_driver_base_t
|
||||
*/
|
||||
void *esp_eth_new_netif_glue(esp_eth_handle_t eth_hdl);
|
||||
esp_eth_netif_glue_handle_t esp_eth_new_netif_glue(esp_eth_handle_t eth_hdl);
|
||||
|
||||
/**
|
||||
* @brief Delete netif glue of Ethernet driver
|
||||
*
|
||||
* @param glue netif glue
|
||||
* @param eth_netif_glue netif glue
|
||||
* @return -ESP_OK: delete netif glue successfully
|
||||
*/
|
||||
esp_err_t esp_eth_del_netif_glue(void *glue);
|
||||
esp_err_t esp_eth_del_netif_glue(esp_eth_netif_glue_handle_t eth_netif_glue);
|
||||
|
||||
/**
|
||||
* @brief Register default IP layer handlers for Ethernet
|
||||
*
|
||||
* @note: Ethernet handle might not yet properly initialized when setting up these default handlers
|
||||
* @warning: This function is deprecated and is kept here only for compatibility reasons. Registration
|
||||
* of default IP layer handlers for Ethernet is now handled automatically. Do not call this
|
||||
* function if you want to use multiple Ethernet instances at a time.
|
||||
*
|
||||
* @param[in] esp_netif esp network interface handle created for Ethernet driver
|
||||
* @return
|
||||
@ -47,12 +56,15 @@ esp_err_t esp_eth_del_netif_glue(void *glue);
|
||||
* - ESP_OK: set default IP layer handlers successfully
|
||||
* - others: other failure occurred during register esp_event handler
|
||||
*/
|
||||
|
||||
esp_err_t esp_eth_set_default_handlers(void *esp_netif);
|
||||
esp_err_t esp_eth_set_default_handlers(void *esp_netif) __attribute__ ((deprecated));
|
||||
|
||||
/**
|
||||
* @brief Unregister default IP layer handlers for Ethernet
|
||||
*
|
||||
* @warning: This function is deprecated and is kept here only for compatibility reasons. Unregistration
|
||||
* of default IP layer handlers for Ethernet is now handled automatically if not registered
|
||||
* by calling esp_eth_set_default_handlers.
|
||||
*
|
||||
* @param[in] esp_netif esp network interface handle created for Ethernet driver
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG: invalid parameter (esp_netif is NULL)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
// Copyright 2019-2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@ -173,6 +173,19 @@ struct esp_eth_phy_s {
|
||||
*/
|
||||
esp_err_t (*advertise_pause_ability)(esp_eth_phy_t *phy, uint32_t ability);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param[in] phy: Ethernet PHY instance
|
||||
* @param[in] enable: enables or disables PHY loopback
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: configures PHY instance loopback function successfully
|
||||
* - ESP_FAIL: PHY instance loopback configuration failed because some error occurred
|
||||
*
|
||||
*/
|
||||
esp_err_t (*loopback)(esp_eth_phy_t *phy, bool enable);
|
||||
|
||||
/**
|
||||
* @brief Free memory of Ethernet PHY instance
|
||||
*
|
||||
@ -232,7 +245,7 @@ esp_eth_phy_t *esp_eth_phy_new_ip101(const eth_phy_config_t *config);
|
||||
esp_eth_phy_t *esp_eth_phy_new_rtl8201(const eth_phy_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Create a PHY instance of LAN8720
|
||||
* @brief Create a PHY instance of LAN87xx
|
||||
*
|
||||
* @param[in] config: configuration of PHY
|
||||
*
|
||||
@ -240,7 +253,23 @@ esp_eth_phy_t *esp_eth_phy_new_rtl8201(const eth_phy_config_t *config);
|
||||
* - instance: create PHY instance successfully
|
||||
* - NULL: create PHY instance failed because some error occurred
|
||||
*/
|
||||
esp_eth_phy_t *esp_eth_phy_new_lan8720(const eth_phy_config_t *config);
|
||||
esp_eth_phy_t *esp_eth_phy_new_lan87xx(const eth_phy_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Create a PHY instance of LAN8720
|
||||
*
|
||||
* @note For ESP-IDF backwards compatibility reasons. In all other cases, use esp_eth_phy_new_lan87xx instead.
|
||||
*
|
||||
* @param[in] config: configuration of PHY
|
||||
*
|
||||
* @return
|
||||
* - instance: create PHY instance successfully
|
||||
* - NULL: create PHY instance failed because some error occurred
|
||||
*/
|
||||
static inline esp_eth_phy_t *esp_eth_phy_new_lan8720(const eth_phy_config_t *config)
|
||||
{
|
||||
return esp_eth_phy_new_lan87xx(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a PHY instance of DP83848
|
||||
|
Reference in New Issue
Block a user