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, whosewakethe 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
impl RunToCompletionLevels
Sourcepub unsafe fn install(&self, core: LevelCore, boot_level: u8) -> bool
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.
Sourcepub fn set_worker(&self, level: u8, worker: &'static mut BandWorker)
pub fn set_worker(&self, level: u8, worker: &'static mut BandWorker)
Record level’s band worker (from LevelCore::open_level_with).
Sourcepub unsafe fn pass(&self, level: u8, arm: fn(Option<u64>))
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.