Trait kernel::net::phy::reg::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.

Object Safety§

This trait is not object safe.

Implementors§