diff options
author | 2020-01-11 18:27:11 +0100 | |
---|---|---|
committer | 2020-01-11 18:27:11 +0100 | |
commit | 4666507bfc483862fcadb6d1d5379549bfdd051e (patch) | |
tree | ab3bc41800361f3deefc6e0b6c81645fca7f9225 /cortex-m-rt/src | |
parent | befa1213606ce22306584f04473c2271ce55e708 (diff) | |
download | cortex-m-4666507bfc483862fcadb6d1d5379549bfdd051e.tar.gz cortex-m-4666507bfc483862fcadb6d1d5379549bfdd051e.tar.zst cortex-m-4666507bfc483862fcadb6d1d5379549bfdd051e.zip |
Make `ExceptionFrame`s fields private
Diffstat (limited to 'cortex-m-rt/src')
-rw-r--r-- | cortex-m-rt/src/lib.rs | 61 |
1 files changed, 44 insertions, 17 deletions
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index 8bfdd69..e184fd2 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -416,33 +416,60 @@ pub use macros::{entry, exception, pre_init}; #[doc(hidden)] pub static __ONCE__: () = (); -/// Registers stacked (pushed into the stack) during an exception +/// Registers stacked (pushed into the stack) during an exception. #[derive(Clone, Copy)] #[repr(C)] pub struct ExceptionFrame { - /// (General purpose) Register 0 - pub r0: u32, + r0: u32, + r1: u32, + r2: u32, + r3: u32, + r12: u32, + lr: u32, + pc: u32, + xpsr: u32, +} - /// (General purpose) Register 1 - pub r1: u32, +impl ExceptionFrame { + /// Returns the value of (general purpose) register 0. + pub fn r0(&self) -> u32 { + self.r0 + } - /// (General purpose) Register 2 - pub r2: u32, + /// Returns the value of (general purpose) register 1. + pub fn r1(&self) -> u32 { + self.r1 + } + + /// Returns the value of (general purpose) register 2. + pub fn r2(&self) -> u32 { + self.r2 + } - /// (General purpose) Register 3 - pub r3: u32, + /// Returns the value of (general purpose) register 3. + pub fn r3(&self) -> u32 { + self.r3 + } - /// (General purpose) Register 12 - pub r12: u32, + /// Returns the value of (general purpose) register 12. + pub fn r12(&self) -> u32 { + self.r12 + } - /// Linker Register - pub lr: u32, + /// Returns the value of the Link Register. + pub fn lr(&self) -> u32 { + self.lr + } - /// Program Counter - pub pc: u32, + /// Returns the value of the Program Counter. + pub fn pc(&self) -> u32 { + self.pc + } - /// Program Status Register - pub xpsr: u32, + /// Returns the value of the Program Status Register. + pub fn xpsr(&self) -> u32 { + self.xpsr + } } impl fmt::Debug for ExceptionFrame { |