Skip to main content

EmacDriverState

Struct EmacDriverState 

Source
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

Source

pub const fn new() -> Self

Create a new state with link initially down.

Source

pub fn irq_counters(&self) -> IrqCounters

Diagnostic counters from the ISR.

Source

pub fn driver_counters(&self) -> DriverCounters

Diagnostic counters from Driver::receive / Driver::transmit and the matching tokens.

Read the cached link state.

Update the cached link state and wake stack tasks.

Mark the link as up and wake the stack.

Mark the link as down and wake the stack.

Source

pub fn on_interrupt_status(&self, status: InterruptStatus)

Wake RX/TX tasks based on a snapshot of the DMA interrupt status.

Source

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.

Trait Implementations§

Source§

impl Default for EmacDriverState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.