bern_arch/core.rs
1//! CPU core peripherals.
2
3/// Execution modes of the CPU.
4pub enum ExecMode {
5 /// Kernel is active, e.g. syscall or ISR.
6 Kernel,
7 /// CPU is in thread mode.
8 Thread,
9}
10
11/// CPU core peripherals.
12pub trait ICore {
13 /// Setup core peripherals and return core object.
14 fn new() -> Self;
15 /// Set the system tick divisor.
16 fn set_systick_div(&mut self, divisor: u32);
17 /// Start peripherals used by kernel.
18 fn start(&mut self);
19 /// Break point instruction.
20 fn bkpt();
21 /// CPU execution mode.
22 fn execution_mode() -> ExecMode;
23 /// Returns true if the CPU is processing an interrupt.
24 fn is_in_interrupt() -> bool;
25 /// Cycles counted by CPU for debug purposes.
26 fn debug_time() -> u32;
27}