Skip to main content

Phy

Trait Phy 

Source
pub trait Phy {
    // Required methods
    fn init<M: MdioBus>(&mut self, mdio: &mut M) -> Result<(), PhyError>;
    fn poll_link<M: MdioBus>(
        &mut self,
        mdio: &mut M,
        _cx: Option<&mut Context<'_>>,
    ) -> LinkState;
    fn address(&self) -> u8;
}
Expand description

Ethernet PHY driver.

Required Methods§

Source

fn init<M: MdioBus>(&mut self, mdio: &mut M) -> Result<(), PhyError>

One-time hardware initialization.

Should reset the PHY, configure auto-negotiation, and wait until the hardware is ready to respond to further MDIO transactions.

Polls the current link state.

Returns LinkState with up == true once auto-negotiation is complete and the link partner is detected. The context can be used to wake the caller when the link state should be re-polled, if the PHY chip supports interrupt-driven notifications.

Source

fn address(&self) -> u8

Returns the Clause 22 PHY address on the MDIO bus.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Phy for GenericPhy

Available on crate feature unstable only.