[][src]Struct minimult_cortex_m::Minimult

pub struct Minimult<'a> { /* fields omitted */ }

Multitasking API

Methods

impl<'a> Minimult<'a>[src]

pub const fn mem<B>() -> MTMemBlk<B>[src]

Reserves a memory block to be used by Minimult instance.

  • Any type B specifies a size of the memory block. Typically use [u8; N] for N bytes.
  • Returns the reserved memory block.

pub fn new<B>(mem: &mut MTMemBlk<B>, num_tasks: MTTaskId) -> Minimult[src]

Creates Minimult instance.

  • mem - reserved memory block.
  • num_tasks - number of tasks.
  • Returns the created instance.
  • (num_tasks * (32 + 4)) bytes of the memory block is consumed.

pub fn msgq<M>(&mut self, len: usize) -> MTMsgQueue<'a, M>[src]

Creates a message queue.

  • M - type of the message element.
  • len - length of the message queue array.
  • Returns the created message queue.
  • (len * (size of M)) bytes of the memory block is consumed.

pub fn share<M>(&mut self, m: M) -> MTShared<'a, M>[src]

Creates a shared variable.

  • m: M - the variable to be shared.
  • Returns the created shared variable.

pub fn register<T>(
    &mut self,
    tid: MTTaskId,
    pri: MTTaskPri,
    stack_len: usize,
    task: T
) where
    T: FnOnce() + Send + 'a, 
[src]

Registers a closure as a task.

  • tid - task identifier. 0 to num_tasks - 1.
  • pri - task priority. The lower value is the higher priority.
  • stack_len - length of a stack used by the task.
    • Minimult kernel performs stack checks when task-switching. If a target is thumbv8m.*, MSPLIM stack limit check is also enabled.
  • task: T - task closure.
  • (stack_len * size of usize) bytes of the memory block is consumed.

pub fn run(self) -> ![src]

Runs into a loop to dispatch the registered tasks.

  • Never returns.
  • NOTE: Enters a WFI loop when there is no ready task. As a result some systems may get into a low power state and block SysTick and other core peripherals.

pub fn idle()[src]

Brings a current running task into an idle state.

pub fn dispatch()[src]

Makes a service call to request dispatching.

pub fn kick(tid: MTTaskId)[src]

Wakes up a task in an idle state.

  • tid - task identifier. 0 to num_tasks - 1.

pub fn curr_tid() -> Option<MTTaskId>[src]

Gets task identifier of a current running task if any.

  • Returns task identifier in Option.

Trait Implementations

impl<'_> Drop for Minimult<'_>[src]

Auto Trait Implementations

impl<'a> Unpin for Minimult<'a>

impl<'a> Send for Minimult<'a>

impl<'a> Sync for Minimult<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self