pub struct PLIC<A: BaseAddress> { /* private fields */ }Expand description
Platform-Level Interrupt Controller.
Implementations§
source§impl<const B: usize> PLIC<Static<B>>
impl<const B: usize> PLIC<Static<B>>
sourcepub const unsafe fn steal_static() -> PLIC<Static<B>>
pub const unsafe fn steal_static() -> PLIC<Static<B>>
Create a peripheral instance from statically known address.
This function is unsafe for it forces to seize ownership from possible wrapped peripheral group types. Users should normally retrieve ownership from wrapped types.
Methods from Deref<Target = Plic>§
sourcepub fn set_priority<S>(&self, source: S, value: u32)where
S: InterruptSource,
pub fn set_priority<S>(&self, source: S, value: u32)where S: InterruptSource,
Sets priority for interrupt source to value.
Write 0 to priority value effectively disables this interrupt source, for the priority
value 0 is reserved for “never interrupt” by the PLIC specification.
The lowest active priority is priority 1. The maximum priority depends on PLIC implementation
and can be detected with Plic::probe_priority_bits.
See §4.
sourcepub fn get_priority<S>(&self, source: S) -> u32where
S: InterruptSource,
pub fn get_priority<S>(&self, source: S) -> u32where S: InterruptSource,
Gets priority for interrupt source.
See §4.
sourcepub fn probe_priority_bits<S>(&self, source: S) -> u32where
S: InterruptSource,
pub fn probe_priority_bits<S>(&self, source: S) -> u32where S: InterruptSource,
Probe maximum level of priority for interrupt source.
See §4.
sourcepub fn is_pending<S>(&self, source: S) -> boolwhere
S: InterruptSource,
pub fn is_pending<S>(&self, source: S) -> boolwhere S: InterruptSource,
Check if interrupt source is pending.
See §5.
sourcepub fn enable<S, C>(&self, source: S, context: C)where
S: InterruptSource,
C: HartContext,
pub fn enable<S, C>(&self, source: S, context: C)where S: InterruptSource, C: HartContext,
Enable interrupt source in context.
See §6.
sourcepub fn disable<S, C>(&self, source: S, context: C)where
S: InterruptSource,
C: HartContext,
pub fn disable<S, C>(&self, source: S, context: C)where S: InterruptSource, C: HartContext,
Disable interrupt source in context.
See §6.
sourcepub fn is_enabled<S, C>(&self, source: S, context: C) -> boolwhere
S: InterruptSource,
C: HartContext,
pub fn is_enabled<S, C>(&self, source: S, context: C) -> boolwhere S: InterruptSource, C: HartContext,
Check if interrupt source is enabled in context.
See §6.
sourcepub fn get_threshold<C>(&self, context: C) -> u32where
C: HartContext,
pub fn get_threshold<C>(&self, context: C) -> u32where C: HartContext,
Get interrupt threshold in context.
See §7.
sourcepub fn set_threshold<C>(&self, context: C, value: u32)where
C: HartContext,
pub fn set_threshold<C>(&self, context: C, value: u32)where C: HartContext,
Set interrupt threshold for context to value.
See §7.
sourcepub fn probe_threshold_bits<C>(&self, context: C) -> u32where
C: HartContext,
pub fn probe_threshold_bits<C>(&self, context: C) -> u32where C: HartContext,
Probe maximum supported threshold value the context supports.
See §7.
sourcepub fn claim<C>(&self, context: C) -> Option<NonZeroU32>where
C: HartContext,
pub fn claim<C>(&self, context: C) -> Option<NonZeroU32>where C: HartContext,
Claim an interrupt in context, returning its source.
It is always legal for a hart to perform a claim even if EIP is not set.
A hart could set threshold to maximum to disable interrupt notification, but it does not mean
interrupt source has stopped to send interrupt signals. In this case, hart would instead
poll for active interrupt by periodically calling the claim function.
See §8.
sourcepub fn complete<C, S>(&self, context: C, source: S)where
C: HartContext,
S: InterruptSource,
pub fn complete<C, S>(&self, context: C, source: S)where C: HartContext, S: InterruptSource,
Mark that interrupt identified by source is completed in context.
See §9.