@@ -8,16 +8,19 @@ pub struct Control {
88
99impl Control {
1010 /// Creates a `Control` value from raw bits.
11+ #[ inline]
1112 pub fn from_bits ( bits : u32 ) -> Self {
1213 Self { bits }
1314 }
1415
1516 /// Returns the contents of the register as raw bits
17+ #[ inline]
1618 pub fn bits ( & self ) -> u32 {
1719 self . bits
1820 }
1921
2022 /// Thread mode privilege level
23+ #[ inline]
2124 pub fn npriv ( & self ) -> Npriv {
2225 if self . bits & ( 1 << 0 ) == ( 1 << 0 ) {
2326 Npriv :: Unprivileged
@@ -27,6 +30,7 @@ impl Control {
2730 }
2831
2932 /// Sets the thread mode privilege level value (nPRIV).
33+ #[ inline]
3034 pub fn set_npriv ( & mut self , npriv : Npriv ) {
3135 let mask = 1 << 0 ;
3236 match npriv {
@@ -36,6 +40,7 @@ impl Control {
3640 }
3741
3842 /// Currently active stack pointer
43+ #[ inline]
3944 pub fn spsel ( & self ) -> Spsel {
4045 if self . bits & ( 1 << 1 ) == ( 1 << 1 ) {
4146 Spsel :: Psp
@@ -45,6 +50,7 @@ impl Control {
4550 }
4651
4752 /// Sets the SPSEL value.
53+ #[ inline]
4854 pub fn set_spsel ( & mut self , spsel : Spsel ) {
4955 let mask = 1 << 1 ;
5056 match spsel {
@@ -54,6 +60,7 @@ impl Control {
5460 }
5561
5662 /// Whether context floating-point is currently active
63+ #[ inline]
5764 pub fn fpca ( & self ) -> Fpca {
5865 if self . bits & ( 1 << 2 ) == ( 1 << 2 ) {
5966 Fpca :: Active
@@ -63,6 +70,7 @@ impl Control {
6370 }
6471
6572 /// Sets the FPCA value.
73+ #[ inline]
6674 pub fn set_fpca ( & mut self , fpca : Fpca ) {
6775 let mask = 1 << 2 ;
6876 match fpca {
@@ -83,11 +91,13 @@ pub enum Npriv {
8391
8492impl Npriv {
8593 /// Is in privileged thread mode?
94+ #[ inline]
8695 pub fn is_privileged ( & self ) -> bool {
8796 * self == Npriv :: Privileged
8897 }
8998
9099 /// Is in unprivileged thread mode?
100+ #[ inline]
91101 pub fn is_unprivileged ( & self ) -> bool {
92102 * self == Npriv :: Unprivileged
93103 }
@@ -104,11 +114,13 @@ pub enum Spsel {
104114
105115impl Spsel {
106116 /// Is MSP the current stack pointer?
117+ #[ inline]
107118 pub fn is_msp ( & self ) -> bool {
108119 * self == Spsel :: Msp
109120 }
110121
111122 /// Is PSP the current stack pointer?
123+ #[ inline]
112124 pub fn is_psp ( & self ) -> bool {
113125 * self == Spsel :: Psp
114126 }
@@ -125,11 +137,13 @@ pub enum Fpca {
125137
126138impl Fpca {
127139 /// Is a floating-point context active?
140+ #[ inline]
128141 pub fn is_active ( & self ) -> bool {
129142 * self == Fpca :: Active
130143 }
131144
132145 /// Is a floating-point context not active?
146+ #[ inline]
133147 pub fn is_not_active ( & self ) -> bool {
134148 * self == Fpca :: NotActive
135149 }
0 commit comments