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
impl Irq
Sourcepub fn granted(ctx: &ServiceContext) -> Self
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.
Sourcepub fn routed(&self) -> bool
pub fn routed(&self) -> bool
Was an interrupt routed at all? false means every Irq::wait ends on a request or its deadline.
Sourcepub fn vector(&self) -> Option<u8>
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.
Sourcepub fn wait(&self, ctx: &ServiceContext, within: Budget) -> Woke
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).
Sourcepub fn take(&self, ctx: &ServiceContext) -> Option<Woke>
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.
Sourcepub fn rearm(&self, ctx: &ServiceContext)
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.