1use crate::types::*;
6
7#[derive(Debug, Clone, Copy)]
9pub enum Context {
10 Boot,
12 Thd,
14 Isr(XwIrq),
16 Bh,
18 Idle,
20}
21
22extern "C" {
23 fn xwrustffi_skd_get_context_lc(ctxbuf: *mut XwSq, irqnbuf: *mut XwIrq);
24 fn xwrustffi_skd_dspmpt_lc();
25 fn xwrustffi_skd_enpmpt_lc();
26}
27
28pub fn context() -> Context
39{
40 let mut ctx: XwSq = 0;
41 let mut irq: XwIrq = 0;
42
43 unsafe { xwrustffi_skd_get_context_lc(&mut ctx, &mut irq); }
44 match ctx {
45 0 => Context::Boot,
46 1 => Context::Thd,
47 2 => Context::Isr(irq),
48 3 => Context::Bh,
49 _ => Context::Idle,
50 }
51}
52
53pub fn dspmpt() {
56 unsafe { xwrustffi_skd_dspmpt_lc(); }
57}
58
59pub fn enpmpt() {
62 unsafe { xwrustffi_skd_enpmpt_lc(); }
63}