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. - This struct always has a valid
self.0.mdio.dev
.
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<R: Register>(&mut self) -> Result<u16>
pub fn genphy_read_status<R: Register>(&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.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Device
impl !RefUnwindSafe for Device
impl !Send for Device
impl !Sync for Device
impl !Unpin for Device
impl UnwindSafe for Device
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot
. Read more