pub struct EmacDriverState { /* private fields */ }Expand description
Shared state for the embassy-net driver.
Holds the RX, TX, and link wakers plus the cached link state. Place
in a static so it can be reached from the EMAC ISR.
Implementations§
Source§impl EmacDriverState
impl EmacDriverState
Sourcepub fn irq_counters(&self) -> IrqCounters
pub fn irq_counters(&self) -> IrqCounters
Diagnostic counters from the ISR.
Sourcepub fn driver_counters(&self) -> DriverCounters
pub fn driver_counters(&self) -> DriverCounters
Diagnostic counters from Driver::receive / Driver::transmit
and the matching tokens.
Sourcepub fn link_state(&self) -> LinkState
pub fn link_state(&self) -> LinkState
Read the cached link state.
Sourcepub fn set_link_state(&self, state: LinkState)
pub fn set_link_state(&self, state: LinkState)
Update the cached link state and wake stack tasks.
Sourcepub fn set_link_up(&self)
pub fn set_link_up(&self)
Mark the link as up and wake the stack.
Sourcepub fn set_link_down(&self)
pub fn set_link_down(&self)
Mark the link as down and wake the stack.
Sourcepub fn on_interrupt_status(&self, status: InterruptStatus)
pub fn on_interrupt_status(&self, status: InterruptStatus)
Wake RX/TX tasks based on a snapshot of the DMA interrupt status.
Sourcepub fn handle_emac_interrupt(&self)
pub fn handle_emac_interrupt(&self)
Read the DMA status register, clear the interrupts, and wake any tasks waiting on RX or TX.
Does not wake link_waker — link state isn’t reflected in
DMASTATUS and is updated separately by whatever PHY-polling
task calls set_link_up /
set_link_down. That path takes care
of waking link-state observers itself.
Intended to be called from the EMAC ISR. Touches only memory-
mapped EMAC registers and the embedded wakers, so there is no
aliasing concern with the EmacDriver holding a raw pointer
to the Emac state.