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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#[cfg(any())]
use crate::error::Kind;
use crate::{
abi,
error::{Error, ErrorCode, ErrorKind},
};
define_error_kind! {
pub enum ExitError {
#[cfg(any())]
AccessDenied,
}
}
impl ErrorKind for ExitError {
fn from_error_code(code: ErrorCode) -> Option<Self> {
match code.get() {
#[cfg(any())]
abi::E_OACV => Some(Self::AccessDenied(Kind::from_error_code(code))),
_ => None,
}
}
}
#[inline]
#[doc(alias = "sns_ctx")]
pub fn is_task_context() -> bool {
match () {
#[cfg(not(feature = "none"))]
() => (unsafe { abi::sns_ctx() } == 0),
#[cfg(feature = "none")]
() => unimplemented!(),
}
}
#[inline]
#[doc(alias = "sns_loc")]
pub fn is_cpu_lock_active() -> bool {
match () {
#[cfg(not(feature = "none"))]
() => (unsafe { abi::sns_loc() } != 0),
#[cfg(feature = "none")]
() => unimplemented!(),
}
}
#[inline]
#[doc(alias = "sns_dsp")]
pub fn is_dispatching_disabled() -> bool {
match () {
#[cfg(not(feature = "none"))]
() => (unsafe { abi::sns_dsp() } != 0),
#[cfg(feature = "none")]
() => unimplemented!(),
}
}
#[inline]
#[doc(alias = "sns_dpn")]
pub fn is_dispatch_pending_active() -> bool {
match () {
#[cfg(not(feature = "none"))]
() => (unsafe { abi::sns_dpn() } != 0),
#[cfg(feature = "none")]
() => unimplemented!(),
}
}
#[inline]
#[doc(alias = "sns_ker")]
pub fn is_operational() -> bool {
match () {
#[cfg(not(feature = "none"))]
() => (unsafe { abi::sns_ker() } == 0),
#[cfg(feature = "none")]
() => unimplemented!(),
}
}
#[inline]
#[doc(alias = "ext_ker")]
pub fn exit() -> Error<ExitError> {
match () {
#[cfg(not(feature = "none"))]
() => unsafe { Error::new_unchecked(ErrorCode::new_unchecked(abi::ext_ker())) },
#[cfg(feature = "none")]
() => unimplemented!(),
}
}