1#![allow(stable_features)]
2#![no_std]
3
4pub type Priority = u32;
5pub type RelativeTime = u32;
6pub type SystemTime = u64;
7pub type ActivateCount = u32;
8pub type SemaphoreCount = u32;
9pub type FlagPattern = u32;
10
11#[derive(Clone, Copy)]
12pub enum Order {
13 Priority,
14 Fifo,
15}
16
17#[derive(Clone, Copy)]
18pub enum Error {
19 Timeout,
20}
21
22pub mod cpu;
23pub use cpu::*;
24
25pub mod context;
26pub use context::*;
27
28pub mod system;
29pub use system::*;
30
31pub mod interrupt;
32pub mod irc;
33
34mod priority_queue;
35mod timeout_queue;
36
37pub mod task;
38pub use task::*;
39
40pub mod semaphore;
41pub use semaphore::*;
42
43pub mod eventflag;
44pub use eventflag::*;
45
46pub mod time;
47pub use time::*;
48
49pub unsafe fn initialize() {
50 cpu::cpu_initialize();
51 context::context_initialize();
52}
53
54static mut DEBUG_PRINT: Option<fn(str: &str)> = None;
57
58pub fn set_debug_print(fnc: Option<fn(str: &str)>) {
59 unsafe {
60 DEBUG_PRINT = fnc;
61 }
62}
63
64pub fn debug_print(str: &str) {
65 unsafe {
66 match DEBUG_PRINT {
67 Some(print) => {
68 print(str);
69 }
70 None => (),
71 }
72 }
73}