Struct VexRiscvInterruptController

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

Rust wrapper around the raw CSR-based VexRiscv interrupt controller

The wrapper supports saving all currently pending interrupts to an internal state, which can then be used for interrupt processing.

Implementations§

Source§

impl VexRiscvInterruptController

Source

pub const fn new() -> Self

Construct a new VexRiscvInterruptController instance

Source

pub unsafe fn save_pending(&self) -> bool

Save the currently pending interrupts in hardware to the internal state

This should be accessed in an atomic context to ensure a consistent view on the pending interrupts is saved.

Source

pub fn next_saved(&self) -> Option<usize>

Return the next pending interrupts in the saved state

If no interrupt is pending in the saved state, this function returns None.

The ordering is determined by the interrupt number, lower having a higher priority.

Source

pub fn complete_saved(&self, idx: usize)

Mark a saved interrupt as complete, removing it from the next_saved queue

If all interrupts are marked as complete, next_saved will return None.

Source

pub unsafe fn mask_interrupt(idx: usize)

Suppress (mask) a specific interrupt source in the interrupt controller

Source

pub unsafe fn unmask_interrupt(idx: usize)

Unsuppress (unmask) a specific interrupt source in the interrupt controller

Source

pub unsafe fn mask_all_interrupts()

Suppress (mask) all interrupts in the interrupt controller

Source

pub unsafe fn unmask_all_interrupts()

Unsuppress (unmask) all interrupts in the interrupt controller

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.