Trait Register

Source
pub trait Register: Sealed {
    // Required methods
    fn read(&self, dev: &mut Device) -> Result<u16>;
    fn write(&self, dev: &mut Device, val: u16) -> Result;
    fn read_status(dev: &mut Device) -> Result<u16>;
}
Expand description

Accesses PHY registers.

This trait is used to implement the unified interface to access C22 and C45 PHY registers.

§Examples

fn link_change_notify(dev: &mut Device) {
    // read C22 BMCR register
    dev.read(C22::BMCR);
    // read C45 PMA/PMD control 1 register
    dev.read(C45::new(Mmd::PMAPMD, 0));

    // Checks the link status as reported by registers in the C22 namespace
    // and updates current link state.
    dev.genphy_read_status::<phy::C22>();
    // Checks the link status as reported by registers in the C45 namespace
    // and updates current link state.
    dev.genphy_read_status::<phy::C45>();
}

Required Methods§

Source

fn read(&self, dev: &mut Device) -> Result<u16>

Reads a PHY register.

Source

fn write(&self, dev: &mut Device, val: u16) -> Result

Writes a PHY register.

Source

fn read_status(dev: &mut Device) -> Result<u16>

Checks the link status and updates current link state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§