Type Alias esp_idf_sys::esp_eth_phy_t

source ·
pub type esp_eth_phy_t = esp_eth_phy_s;
Expand description

@brief Ethernet PHY

Aliased Type§

struct esp_eth_phy_t {
Show 16 fields pub set_mediator: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: *mut esp_eth_mediator_s) -> i32>, pub reset: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>, pub reset_hw: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>, pub init: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>, pub deinit: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>, pub autonego_ctrl: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32, _: *mut bool) -> i32>, pub get_link: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>, pub pwrctl: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: bool) -> i32>, pub set_addr: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32) -> i32>, pub get_addr: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: *mut u32) -> i32>, pub advertise_pause_ability: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32) -> i32>, pub loopback: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: bool) -> i32>, pub set_speed: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32) -> i32>, pub set_duplex: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32) -> i32>, pub custom_ioctl: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32, _: *mut c_void) -> i32>, pub del: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>,
}

Fields§

§set_mediator: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: *mut esp_eth_mediator_s) -> i32>

@brief Set mediator for PHY

@param[in] phy: Ethernet PHY instance @param[in] mediator: 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

§reset: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>

@brief Software Reset Ethernet PHY

@param[in] phy: Ethernet PHY instance

@return - ESP_OK: reset Ethernet PHY successfully - ESP_FAIL: reset Ethernet PHY failed because some error occurred

§reset_hw: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>

@brief Hardware Reset Ethernet PHY

@note Hardware reset is mostly done by pull down and up PHY’s nRST pin

@param[in] phy: Ethernet PHY instance

@return - ESP_OK: reset Ethernet PHY successfully - ESP_FAIL: reset Ethernet PHY failed because some error occurred

§init: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>

@brief Initialize Ethernet PHY

@param[in] phy: Ethernet PHY instance

@return - ESP_OK: initialize Ethernet PHY successfully - ESP_FAIL: initialize Ethernet PHY failed because some error occurred

§deinit: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>

@brief Deinitialize Ethernet PHY

@param[in] phy: Ethernet PHY instance

@return - ESP_OK: deinitialize Ethernet PHY successfully - ESP_FAIL: deinitialize Ethernet PHY failed because some error occurred

§autonego_ctrl: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32, _: *mut bool) -> i32>

@brief Configure auto negotiation

@param[in] phy: Ethernet PHY instance @param[in] cmd: Configuration command, it is possible to Enable (restart), Disable or get current status of PHY auto negotiation @param[out] autonego_en_stat: 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

§get_link: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>

@brief Get Ethernet PHY link status

@param[in] phy: Ethernet PHY instance

@return - ESP_OK: get Ethernet PHY link status successfully - ESP_FAIL: get Ethernet PHY link status failed because some error occurred

§pwrctl: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: bool) -> i32>

@brief Power control of Ethernet PHY

@param[in] phy: Ethernet PHY instance @param[in] enable: 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

§set_addr: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32) -> i32>

@brief Set PHY chip address

@param[in] phy: Ethernet PHY instance @param[in] addr: PHY chip address

@return - ESP_OK: set Ethernet PHY address successfully - ESP_FAIL: set Ethernet PHY address failed because some error occurred

§get_addr: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: *mut u32) -> i32>

@brief Get PHY chip address

@param[in] phy: Ethernet PHY instance @param[out] addr: PHY chip address

@return - ESP_OK: get Ethernet PHY address successfully - ESP_ERR_INVALID_ARG: get Ethernet PHY address failed because of invalid argument

§advertise_pause_ability: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32) -> i32>

@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

§loopback: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: bool) -> i32>

@brief Sets the PHY to loopback mode

@param[in] phy: Ethernet PHY instance @param[in] enable: 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

§set_speed: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32) -> i32>

@brief Sets PHY speed mode

@note Autonegotiation feature needs to be disabled prior to calling this function for the new setting to be applied

@param[in] phy: Ethernet PHY instance @param[in] speed: 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

§set_duplex: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32) -> i32>

@brief Sets PHY duplex mode

@note Autonegotiation feature needs to be disabled prior to calling this function for the new setting to be applied

@param[in] phy: Ethernet PHY instance @param[in] duplex: 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

§custom_ioctl: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s, _: u32, _: *mut c_void) -> i32>

@brief Custom IO function of PHY driver. This function is intended to extend common options of esp_eth_ioctl to cover specifics of PHY chip.

@note This function may not be assigned when the PHY chip supports only most common set of configuration options.

@param[in] phy: Ethernet PHY instance @param[in] cmd: IO control 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 - ESP_ERR_NOT_SUPPORTED: requested feature is not supported

§del: Option<unsafe extern "C" fn(_: *mut esp_eth_phy_s) -> i32>

@brief Free memory of Ethernet PHY instance

@param[in] phy: Ethernet PHY instance

@return - ESP_OK: free PHY instance successfully - ESP_FAIL: free PHY instance failed because some error occurred