Interface for individual MCUs.
The trait defines chip-specific properties of Tock's operation. These include whether and which memory protection mechanism and scheduler_timer to use, how to switch between the kernel and userland applications, and how to handle hardware events.
Each microcontroller should define a struct and implement this trait.
The particular Memory Protection Unit (MPU) for this chip.
The implementation of the interface between userspace and the kernel for this specific chip. Likely this is architecture specific, but individual chips may have various custom requirements.
type SchedulerTimer: SchedulerTimer
The implementation of the timer used to create the timeslices provided to applications.
The implementation of the WatchDog timer used to monitor the running of the kernel.
The kernel calls this function to tell the chip to check for all pending interrupts and to correctly dispatch them to the peripheral drivers for the chip.
This function should loop internally until all interrupts have been handled. It is ok, however, if an interrupt occurs after the last check but before this function returns. The kernel will handle this edge case.
fn has_pending_interrupts(&self) -> bool
Ask the chip to check if there are any pending interrupts.
Returns a reference to the implementation for the MPU on this chip.
fn scheduler_timer(&self) -> &Self::SchedulerTimer
Returns a reference to the implementation of the scheduler_timer timer for this chip.
Returns a reference to the implementation for the WatchDog on this chip.
fn userspace_kernel_boundary(&self) -> &Self::UserspaceKernelBoundary
Returns a reference to the implementation for the interface between userspace and kernelspace.
Called when there is nothing left for the chip to do and it should enter a low power sleep state. This low power sleep state should allow interrupts to still be active so that the next interrupt event wakes the chip and resumes the scheduler.
Run a function in an atomic state, which means that interrupts are disabled so that an interrupt will not fire during the passed in function's execution.
unsafe fn print_state(&self, writer: &mut dyn Write)
Print out chip state (system registers) to a supplied
writer. This does not print out the execution context
(data registers), as this depends on how they are stored;
that is implemented by
This also does not print out a process memory state,
that is implemented by
The MPU state is printed by the MPU's implementation of
the Display trait.
Used by panic.