Cpsr

Struct Cpsr 

Source
pub struct Cpsr { /* private fields */ }
Expand description

CPSR (Current Program Status Register)

Implementations§

Source§

impl Cpsr

Source

pub const ZERO: Self

Creates a new instance with a raw value of 0. Equivalent to [Self::new_with_raw_value(0)].

Source

pub const fn raw_value(&self) -> u32

Returns the underlying raw value of this bitfield

Source

pub const fn new_with_raw_value(value: u32) -> Cpsr

Creates a new instance of this bitfield with the given raw value.

No checks are performed on the value, so it is possible to set bits that don’t have any accessors specified.

Source

pub const fn n(&self) -> bool

Negative Result from ALU

Source

pub const fn z(&self) -> bool

Zero Result from ALU

Source

pub const fn c(&self) -> bool

ALU operation Carry Out

Source

pub const fn v(&self) -> bool

ALU operation Overflow

Source

pub const fn q(&self) -> bool

Cumulative Saturation

Source

pub const fn j(&self) -> bool

Jazelle State

Source

pub const fn e(&self) -> bool

Endianness

Source

pub const fn with_e(&self, field_value: bool) -> Self

Endianness

Source

pub fn set_e(&mut self, field_value: bool)

Endianness

Source

pub const fn a(&self) -> bool

Asynchronous Aborts

Source

pub const fn with_a(&self, field_value: bool) -> Self

Asynchronous Aborts

Source

pub fn set_a(&mut self, field_value: bool)

Asynchronous Aborts

Source

pub const fn i(&self) -> bool

Interrupts Enabled

Source

pub const fn with_i(&self, field_value: bool) -> Self

Interrupts Enabled

Source

pub fn set_i(&mut self, field_value: bool)

Interrupts Enabled

Source

pub const fn f(&self) -> bool

Fast Interrupts Enabled

Source

pub const fn with_f(&self, field_value: bool) -> Self

Fast Interrupts Enabled

Source

pub fn set_f(&mut self, field_value: bool)

Fast Interrupts Enabled

Source

pub const fn t(&self) -> bool

Thumb state

Source

pub const fn with_t(&self, field_value: bool) -> Self

Thumb state

Source

pub fn set_t(&mut self, field_value: bool)

Thumb state

Source

pub const fn mode(&self) -> Result<ProcessorMode, u8>

Processor Mode

Source

pub const fn with_mode(&self, field_value: ProcessorMode) -> Self

Processor Mode

Source

pub fn set_mode(&mut self, field_value: ProcessorMode)

Processor Mode

Source§

impl Cpsr

Source

pub fn read() -> Self

Read CPSR (Current Program Status Register)

Source

pub unsafe fn write(_value: Self)

Write CPSR (Current Program Status Register)

§Safety

Changing the Program Status Register can affect whether interrupts are enabled, whether we are executing Arm or Thumb instructions, or which processor mode are in. You must be absolutely certain that the new CPSR value is valid and appropriate for continued Rust code execution.

You almost certainly want to follow this with an ISB instruction.

Source

pub unsafe fn modify<F>(f: F)
where F: FnOnce(&mut Self),

Modify SCTLR (System Control Register)

§Safety

See docs for Self::write.

Trait Implementations§

Source§

impl Clone for Cpsr

Source§

fn clone(&self) -> Cpsr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cpsr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for Cpsr

Auto Trait Implementations§

§

impl Freeze for Cpsr

§

impl RefUnwindSafe for Cpsr

§

impl Send for Cpsr

§

impl Sync for Cpsr

§

impl Unpin for Cpsr

§

impl UnwindSafe for Cpsr

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.