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