Skip to main content

Irq

Struct Irq 

Source
pub struct Irq { /* private fields */ }
Expand description

The interrupt this driver was granted, if any, and how many it has seen.

Implementations§

Source§

impl Irq

Source

pub fn granted(ctx: &ServiceContext) -> Self

The interrupt the kernel routed to this driver at spawn. A driver asks for one in its spawn row (hwclass::pci_irq) and never names a vector: routing a vector is authority the kernel keeps.

Source

pub fn routed(&self) -> bool

Was an interrupt routed at all? false means every Irq::wait ends on a request or its deadline.

Source

pub fn vector(&self) -> Option<u8>

The vector the kernel routed, for a driver that reports it or tells its notice apart itself.

Reading it is not routing it: the vector is the kernel’s to choose (see Irq::granted), and a driver that knows the number still cannot ask for another one.

Source

pub fn seen(&self) -> u64

Interrupts seen by Irq::wait and Irq::take so far - evidence, for a driver to report.

Source

pub fn wait(&self, ctx: &ServiceContext, within: Budget) -> Woke

Wait for the interrupt, a request or within, whichever is first.

On a machine whose clock the kernel could not calibrate, within is not a duration: the wait ends after one scheduler quantum whatever was asked (see deadline_ticks).

#[inline(always)] because it returns a 4 KiB message by value; as its own frame that would be 4 KiB of stack on every caller (the SDK’s recv_timeout says the same).

Source

pub fn take(&self, ctx: &ServiceContext) -> Option<Woke>

Take what is already waiting, without blocking: the interrupt, a request, or None when nothing is queued. Never Woke::Timeout.

For a driver that DRAINS its endpoint in a bounded loop and blocks only at the end of a pass - dwc2 and xhci both do, so a burst of requests is served in one pass. Each drain used to tell the interrupt apart by hand, and dwc2 once dropped one as a capless request, leaving its line masked for good; this is the same test Irq::wait makes, so the two cannot disagree.

Source

pub fn rearm(&self, ctx: &ServiceContext)

Let the interrupt fire again, after the driver has cleared its source. A level-triggered line is held masked by the kernel while it is being handled, so it cannot storm; this re-opens it. For an MSI, which is an edge and is never masked, it is a no-op - so a driver calls it either way and does not have to know which it was given.

Auto Trait Implementations§

§

impl !Freeze for Irq

§

impl !RefUnwindSafe for Irq

§

impl Send for Irq

§

impl !Sync for Irq

§

impl Unpin for Irq

§

impl UnsafeUnpin for Irq

§

impl UnwindSafe for Irq

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.