Skip to main content

Phy

Trait Phy 

Source
pub trait Phy {
    // Required methods
    fn init<M: MdioBus>(
        &mut self,
        mdio: &mut M,
        max_speed: Speed,
    ) -> 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, max_speed: Speed, ) -> Result<(), PhyError>

One-time hardware initialization.

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

max_speed is the fastest speed the wired MAC interface can carry (100 Mbps for MII/RMII, 1000 Mbps for RGMII). Faster abilities must not be advertised, or the link partner may settle on a speed the MAC cannot drive.

Polls the current link state.

Returns LinkState with up == true once the link partner is detected.

In async mode the context must be used to schedule the next poll: register a waker for a PHY interrupt or a timer, or wake immediately. An implementation that does neither will never be polled again, so drivers without an interrupt source wake immediately, which busy-polls. Wrap them to rate-limit the polling if a timer is available.

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".

Implementors§

Source§

impl Phy for GenericPhy

Available on crate feature unstable only.