ethernet: support flow control for esp32 emac

This commit is contained in:
morris
2020-07-20 20:42:52 +08:00
parent e97e7281b2
commit 4e38aab1b0
17 changed files with 490 additions and 32 deletions

View File

@@ -78,6 +78,7 @@ typedef enum {
ETH_STATE_LINK, /*!< Link status changed */
ETH_STATE_SPEED, /*!< Speed updated */
ETH_STATE_DUPLEX, /*!< Duplex updated */
ETH_STATE_PAUSE, /*!< Pause ability updated */
} esp_eth_state_t;
/**
@@ -91,6 +92,7 @@ typedef enum {
ETH_CMD_S_PHY_ADDR, /*!< Set PHY address */
ETH_CMD_G_SPEED, /*!< Get Speed */
ETH_CMD_S_PROMISCUOUS, /*!< Set promiscuous mode */
ETH_CMD_S_FLOW_CTRL, /*!< Set flow control */
} esp_eth_io_cmd_t;
/**

View File

@@ -252,6 +252,31 @@ struct esp_eth_mac_s {
*/
esp_err_t (*set_promiscuous)(esp_eth_mac_t *mac, bool enable);
/**
* @brief Enable flow control on MAC layer or not
*
* @param[in] mac: Ethernet MAC instance
* @param[in] enable: 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 (*enable_flow_ctrl)(esp_eth_mac_t *mac, bool enable);
/**
* @brief Set the PAUSE ability of peer node
*
* @param[in] mac: Ethernet MAC instance
* @param[in] ability: 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 (*set_peer_pause_ability)(esp_eth_mac_t *mac, uint32_t ability);
/**
* @brief Free memory of Ethernet MAC
*

View File

@@ -160,6 +160,19 @@ struct esp_eth_phy_s {
*/
esp_err_t (*get_addr)(esp_eth_phy_t *phy, uint32_t *addr);
/**
* @brief Advertise pause function supported by MAC layer
*
* @param[in] phy: Ethernet PHY instance
* @param[out] addr: Pause ability
*
* @return
* - ESP_OK: Advertise pause ability successfully
* - ESP_ERR_INVALID_ARG: Advertise pause ability failed because of invalid argument
*
*/
esp_err_t (*advertise_pause_ability)(esp_eth_phy_t *phy, uint32_t ability);
/**
* @brief Free memory of Ethernet PHY instance
*