Skip to main content

RunToCompletionLevels

Struct RunToCompletionLevels 

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

Levels that RUN TO COMPLETION: one pass per wake, never a blocking wait.

An RTIC level is a software task at its own hardware priority. A level that parked on a timed wait, as a threaded RTOS’s level does, would hold its priority and starve every level below it, the boot level’s transport included. So each non-boot level’s task does ONE band pass (LevelCore::spin_level_once with a zero timeout) per wake, and two things wake it:

  • an arrival in its band, through the level’s BandWaiter, whose wake the image points at “spawn this level’s task” (LevelCore::open_level_with);
  • its band’s next timer, through ONE board one-shot armed at the earliest deadline over the non-boot levels (Self::rearm). Without it a higher band’s due timer would wait out the boot level’s park, which is bounded by the boot band’s own timers only.

A band’s deadline is read at the end of that level’s own pass, the one moment it is exact (a band’s timers are credited their elapsed time by its own passes), and kept as an absolute time per level.

A const static: the image’s boot task Self::installs the core once, before any level runs, and every level and the wake interrupt read it after.

Implementations§

Source§

impl RunToCompletionLevels

Source

pub const fn new() -> Self

An empty runner, for a static.

Source

pub unsafe fn install(&self, core: LevelCore, boot_level: u8) -> bool

Hand the runner its core, once, before any level task runs. false when it already has one.

§Safety

No level task or wake interrupt reads this runner until it returns.

Source

pub fn core(&self) -> Option<&LevelCore>

The core, once installed.

Source

pub fn set_worker(&self, level: u8, worker: &'static mut BandWorker)

Record level’s band worker (from LevelCore::open_level_with).

Source

pub unsafe fn pass(&self, level: u8, arm: fn(Option<u64>))

One pass of level’s band, then its next deadline is recorded and the board one-shot re-armed through arm. A level with no worker (or a runner not yet installed) does nothing.

§Safety

Called only from level’s own task, never re-entered for one level.

Source

pub fn rearm(&self, arm: fn(Option<u64>))

Arm the board one-shot at the earliest deadline over the non-boot levels, or disarm it when none has a timer.

Source

pub fn is_due(&self, level: u8, now: u64) -> bool

Whether level’s next timer is due at now (the wake interrupt spawns exactly these).

Trait Implementations§

Source§

impl Default for RunToCompletionLevels

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Sync for RunToCompletionLevels

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.