Skip to content

Commit cef7f32

Browse files
committed
Utility function to get mtime frequency from mtimer peripheral
1 parent 2c5b62c commit cef7f32

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

riscv-peripheral/src/aclint/mtimer.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ impl<M: Mtimer> MTIMER<M> {
5656
M::MTIMECMP_BASE as *const u64
5757
}
5858

59+
/// Returns the clock frequency of the `MTIME` register.
60+
#[inline]
61+
pub const fn mtime_freq(self) -> usize {
62+
M::MTIME_FREQ
63+
}
64+
5965
/// Returns `true` if a machine timer interrupt is pending.
6066
#[inline]
6167
pub fn is_interrupting(self) -> bool {

0 commit comments

Comments
 (0)