pub struct PSR(/* private fields */);
Expand description
A wrapper over u16
in order to faciliate the PSR.
The word is encoded as the following:
PSR[15..16]
: Privilege mode (0 = supervisor, 1 = user)PSR[8..11]
: Interrupt priorityPSR[0..3]
: Condition codes
privilege
| interrupt priority
| | condition codes
| | |
V V V
0x8002: 1000 0000 0000 0010
~ ~~~ ~~~
Each of these are exposed as the PSR::privileged
, PSR::priority
, and PSR::cc
values.
Implementations§
Source§impl PSR
impl PSR
Sourcepub fn privileged(&self) -> bool
pub fn privileged(&self) -> bool
Checks whether the simulator is in privileged mode.
true
= supervisor modefalse
= user mode
Sourcepub fn set_privileged(&mut self, privl: bool)
pub fn set_privileged(&mut self, privl: bool)
Sets whether the simulator is in privileged mode.
Sourcepub fn set_priority(&mut self, prio: u8)
pub fn set_priority(&mut self, prio: u8)
Sets the current interrupt priority of the simulator.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PSR
impl RefUnwindSafe for PSR
impl Send for PSR
impl Sync for PSR
impl Unpin for PSR
impl UnwindSafe for PSR
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more