#[repr(transparent)]pub struct Device(/* private fields */);
Expand description
An instance of a PHY device.
Wraps the kernel’s struct phy_device
.
A Device
instance is created when a callback in Driver
is executed. A PHY driver
executes Driver
’s methods during the callback.
Invariants
Referencing a phy_device
using this struct asserts that you are in
a context where all methods defined on this struct are safe to call.
Implementations§
source§impl Device
impl Device
sourcepub fn state(&self) -> DeviceState
pub fn state(&self) -> DeviceState
Gets the state of PHY state machine states.
sourcepub fn is_link_up(&self) -> bool
pub fn is_link_up(&self) -> bool
Gets the current link state.
It returns true if the link is up.
sourcepub fn is_autoneg_enabled(&self) -> bool
pub fn is_autoneg_enabled(&self) -> bool
Gets the current auto-negotiation configuration.
It returns true if auto-negotiation is enabled.
sourcepub fn is_autoneg_completed(&self) -> bool
pub fn is_autoneg_completed(&self) -> bool
Gets the current auto-negotiation state.
It returns true if auto-negotiation is completed.
sourcepub fn set_duplex(&mut self, mode: DuplexMode)
pub fn set_duplex(&mut self, mode: DuplexMode)
Sets duplex mode.
sourcepub fn resolve_aneg_linkmode(&mut self)
pub fn resolve_aneg_linkmode(&mut self)
Resolves the advertisements into PHY settings.
sourcepub fn genphy_soft_reset(&mut self) -> Result
pub fn genphy_soft_reset(&mut self) -> Result
Executes software reset the PHY via BMCR_RESET
bit.
sourcepub fn start_aneg(&mut self) -> Result
pub fn start_aneg(&mut self) -> Result
Starts auto-negotiation.
sourcepub fn genphy_resume(&mut self) -> Result
pub fn genphy_resume(&mut self) -> Result
Resumes the PHY via BMCR_PDOWN
bit.
sourcepub fn genphy_suspend(&mut self) -> Result
pub fn genphy_suspend(&mut self) -> Result
Suspends the PHY via BMCR_PDOWN
bit.
sourcepub fn genphy_read_status(&mut self) -> Result<u16>
pub fn genphy_read_status(&mut self) -> Result<u16>
Checks the link status and updates current link state.
sourcepub fn genphy_update_link(&mut self) -> Result
pub fn genphy_update_link(&mut self) -> Result
Updates the link status.
sourcepub fn genphy_read_lpa(&mut self) -> Result
pub fn genphy_read_lpa(&mut self) -> Result
Reads link partner ability.
sourcepub fn genphy_read_abilities(&mut self) -> Result
pub fn genphy_read_abilities(&mut self) -> Result
Reads PHY abilities.