File tree Expand file tree Collapse file tree
aarch32-cpu/src/generic_timer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,6 +99,30 @@ pub trait GenericTimer {
9999 }
100100}
101101
102+ /// A free-standing function to get the current Physical Timer value
103+ ///
104+ /// In some circumstances (e.g. timestamping a defmt log) you just want to get
105+ /// the time and don't want to drag around an object representing the whole
106+ /// timer.
107+ ///
108+ /// This is just a thin wrapper around the relevant CPU register's read function
109+ /// - this just has a more discoverable name.
110+ pub fn read_physical_timer ( ) -> u64 {
111+ crate :: register:: CntPct :: read ( ) . 0
112+ }
113+
114+ /// A free-standing function to get the current Virtual Timer value
115+ ///
116+ /// In some circumstances (e.g. timestamping a defmt log) you just want to get
117+ /// the time and don't want to drag around an object representing the whole
118+ /// timer.
119+ ///
120+ /// This is just a thin wrapper around the relevant CPU register's read function
121+ /// - this just has a more discoverable name.
122+ pub fn read_virtual_timer ( ) -> u64 {
123+ crate :: register:: CntVct :: read ( ) . 0
124+ }
125+
102126/// Describes the configuration for an Edvent
103127#[ derive( Debug , Clone , PartialEq , Eq ) ]
104128pub struct EventConfig {
You can’t perform that action at this time.
0 commit comments