Skip to main content

Phy

Trait Phy 

Source
pub trait Phy {
    // Required methods
    fn phy_reset(&mut self, smi: &mut Smi) -> Result<(), SmiError>;
    fn phy_init(&mut self, smi: &mut Smi) -> Result<(), SmiError>;
    fn poll_link(
        &mut self,
        smi: &mut Smi,
        cx: &mut Context<'_>,
    ) -> Result<bool, SmiError>;

    // Provided methods
    fn full_duplex(&mut self, _smi: &mut Smi) -> Result<bool, SmiError> { ... }
    fn speed_100m(&mut self, _smi: &mut Smi) -> Result<bool, SmiError> { ... }
    fn next_polarity(&mut self, _smi: &mut Smi) -> Result<bool, SmiError> { ... }
}
Expand description

Trait for Ethernet PHY drivers.

Methods propagate errors from PHY management transactions.

Required Methods§

Source

fn phy_reset(&mut self, smi: &mut Smi) -> Result<(), SmiError>

Reset the PHY and wait for it to come out of reset.

Source

fn phy_init(&mut self, smi: &mut Smi) -> Result<(), SmiError>

Initialize the PHY (enable autonegotiation, etc).

Poll the link state. Returns true if link is up.

Provided Methods§

Source

fn full_duplex(&mut self, _smi: &mut Smi) -> Result<bool, SmiError>

Duplex mode of the established link (called on each link-up). Returns true for full duplex. The default keeps the MAC in full duplex.

Source

fn speed_100m(&mut self, _smi: &mut Smi) -> Result<bool, SmiError>

Speed of the established link (called on each link-up). Returns true for 100 Mbit/s. The default keeps the MAC at 100 Mbit/s.

Source

fn next_polarity(&mut self, _smi: &mut Smi) -> Result<bool, SmiError>

Switch to the next receive-pair polarity and restart auto-negotiation.

Called while the link is down, so a polarity that does not link is retried on a later poll instead of leaving the link unusable. Returns true if the PHY reconfigured itself. The default leaves the PHY alone.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§