@@ -8,16 +8,19 @@ pub struct Control {
8
8
9
9
impl Control {
10
10
/// Creates a `Control` value from raw bits.
11
+ #[ inline]
11
12
pub fn from_bits ( bits : u32 ) -> Self {
12
13
Self { bits }
13
14
}
14
15
15
16
/// Returns the contents of the register as raw bits
17
+ #[ inline]
16
18
pub fn bits ( & self ) -> u32 {
17
19
self . bits
18
20
}
19
21
20
22
/// Thread mode privilege level
23
+ #[ inline]
21
24
pub fn npriv ( & self ) -> Npriv {
22
25
if self . bits & ( 1 << 0 ) == ( 1 << 0 ) {
23
26
Npriv :: Unprivileged
@@ -27,6 +30,7 @@ impl Control {
27
30
}
28
31
29
32
/// Sets the thread mode privilege level value (nPRIV).
33
+ #[ inline]
30
34
pub fn set_npriv ( & mut self , npriv : Npriv ) {
31
35
let mask = 1 << 0 ;
32
36
match npriv {
@@ -36,6 +40,7 @@ impl Control {
36
40
}
37
41
38
42
/// Currently active stack pointer
43
+ #[ inline]
39
44
pub fn spsel ( & self ) -> Spsel {
40
45
if self . bits & ( 1 << 1 ) == ( 1 << 1 ) {
41
46
Spsel :: Psp
@@ -45,6 +50,7 @@ impl Control {
45
50
}
46
51
47
52
/// Sets the SPSEL value.
53
+ #[ inline]
48
54
pub fn set_spsel ( & mut self , spsel : Spsel ) {
49
55
let mask = 1 << 1 ;
50
56
match spsel {
@@ -54,6 +60,7 @@ impl Control {
54
60
}
55
61
56
62
/// Whether context floating-point is currently active
63
+ #[ inline]
57
64
pub fn fpca ( & self ) -> Fpca {
58
65
if self . bits & ( 1 << 2 ) == ( 1 << 2 ) {
59
66
Fpca :: Active
@@ -63,6 +70,7 @@ impl Control {
63
70
}
64
71
65
72
/// Sets the FPCA value.
73
+ #[ inline]
66
74
pub fn set_fpca ( & mut self , fpca : Fpca ) {
67
75
let mask = 1 << 2 ;
68
76
match fpca {
@@ -83,11 +91,13 @@ pub enum Npriv {
83
91
84
92
impl Npriv {
85
93
/// Is in privileged thread mode?
94
+ #[ inline]
86
95
pub fn is_privileged ( & self ) -> bool {
87
96
* self == Npriv :: Privileged
88
97
}
89
98
90
99
/// Is in unprivileged thread mode?
100
+ #[ inline]
91
101
pub fn is_unprivileged ( & self ) -> bool {
92
102
* self == Npriv :: Unprivileged
93
103
}
@@ -104,11 +114,13 @@ pub enum Spsel {
104
114
105
115
impl Spsel {
106
116
/// Is MSP the current stack pointer?
117
+ #[ inline]
107
118
pub fn is_msp ( & self ) -> bool {
108
119
* self == Spsel :: Msp
109
120
}
110
121
111
122
/// Is PSP the current stack pointer?
123
+ #[ inline]
112
124
pub fn is_psp ( & self ) -> bool {
113
125
* self == Spsel :: Psp
114
126
}
@@ -125,11 +137,13 @@ pub enum Fpca {
125
137
126
138
impl Fpca {
127
139
/// Is a floating-point context active?
140
+ #[ inline]
128
141
pub fn is_active ( & self ) -> bool {
129
142
* self == Fpca :: Active
130
143
}
131
144
132
145
/// Is a floating-point context not active?
146
+ #[ inline]
133
147
pub fn is_not_active ( & self ) -> bool {
134
148
* self == Fpca :: NotActive
135
149
}
0 commit comments