EasyManua.ls Logo

Espressif ESP32-S2 - Page 195

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
ESP_OK: stop Ethernet MAC successfully
ESP_FAIL: stop Ethernet MAC failed because some error occurred
Parameters
[in] mac: Ethernet MAC instance
esp_err_t (*transmit)(esp_eth_mac_t *mac, uint8_t *buf, uint32_t length)
Transmit packet from Ethernet MAC.
Return
ESP_OK: transmit packet successfully
ESP_ERR_INVALID_ARG: transmit packet failed because of invalid argument
ESP_ERR_INVALID_STATE: transmit packet failed because of wrong state of MAC
ESP_FAIL: transmit packet failed because some other error occurred
Parameters
[in] mac: Ethernet MAC instance
[in] buf: packet buffer to transmit
[in] length: length of packet
esp_err_t (*receive)(esp_eth_mac_t *mac, uint8_t *buf, uint32_t *length)
Receive packet from Ethernet MAC.
Note Memory of buf is allocated in the Layer2, make sure it get free after process.
Note Before this function got invoked, the value oflengthshould set by user, equals the size of buffer.
After the function returned, the value of lengthmeans the real length of received data.
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 lengthindicates the real size of incoming data.
ESP_FAIL: receive packet failed because some other error occurred
Parameters
[in] mac: Ethernet MAC instance
[out] buf: packet buffer which will preserve the received frame
[out] length: length of the received packet
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.
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
Parameters
[in] mac: Ethernet MAC instance
[in] phy_addr: PHY chip address (0~31)
[in] phy_reg: PHY register index code
[out] reg_value: PHY register value
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.
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
Parameters
[in] mac: Ethernet MAC instance
Espressif Systems 184
Submit Document Feedback
Release v4.4

Table of Contents