Struct rp2040_hal::vector_table::VectorTable

source ·
#[repr(C, align(256))]
pub struct VectorTable { /* private fields */ }
Expand description

Data type for a properly aligned interrupt vector table

The VTOR register can only point to a 256 byte offsets - see Cortex-M0+ Devices Generic User Guide - so that is our required alignment. The vector table length depends on the number of interrupts the system supports. The first 16 words are defined in the ARM Cortex-M spec. The M0+ cores on RP2040 have 32 interrupts, of which only 26 are wired to external interrupt signals - but the last 6 can be used for software interrupts so leave room for them

Implementations§

source§

impl VectorTable

source

pub const fn new() -> VectorTable

Create a new vector table. All entries will point to 0 - you must call init() on this to copy the current vector table before setting it as active

source

pub fn init(&mut self, ppb: &mut PPB)

Initialise our vector table by copying the current table on top of it

source

pub fn register_handler( &mut self, interrupt_idx: usize, interrupt_fn: extern "C" fn() )

Dynamically register a function as being an interrupt handler

source

pub unsafe fn set_sp(&mut self, stack_pointer_address: usize)

Set the stack pointer address in a VectorTable. This will be used on Reset

§Safety

There is no checking whether this is a valid stack pointer address

source

pub unsafe fn set_entry(&mut self, entry_address: usize)

Set the entry-point address in a VectorTable. This will be used on Reset

§Safety

There is no checking whether this is a valid entry point

source

pub unsafe fn activate(&mut self, ppb: &mut PPB)

Switch the current core to use this Interrupt Vector Table

§Safety

Until the vector table has valid entries, activating it will cause an unhandled hardfault! You must call init() first.

Trait Implementations§

source§

impl Default for VectorTable

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<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

source§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

source§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

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

§

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>,

§

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.