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§
Sourcefn init<M: MdioBus>(
&mut self,
mdio: &mut M,
max_speed: Speed,
) -> Result<(), PhyError>
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.
Sourcefn poll_link<M: MdioBus>(
&mut self,
mdio: &mut M,
_cx: Option<&mut Context<'_>>,
) -> LinkState
fn poll_link<M: MdioBus>( &mut self, mdio: &mut M, _cx: Option<&mut Context<'_>>, ) -> LinkState
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Phy for GenericPhy
unstable only.