xref: /DragonOS/kernel/src/arch/riscv64/time.rs (revision b8ed38251dc255b0c525801b5dbf37d3b0d0d61e)
1 use crate::time::{clocksource::HZ, TimeArch};
2 pub struct RiscV64TimeArch;
3 
4 /// 这个是系统jiffies时钟源的固有频率(不是调频之后的)
5 pub const CLOCK_TICK_RATE: u32 = HZ as u32 * 1000000;
6 
7 impl TimeArch for RiscV64TimeArch {
8     fn get_cycles() -> usize {
9         riscv::register::cycle::read()
10     }
11 
12     fn cal_expire_cycles(ns: usize) -> usize {
13         todo!()
14     }
15     /// 将CPU的时钟周期数转换为纳秒
16     #[inline(always)]
17     fn cycles2ns(cycles: usize) -> usize {
18         todo!()
19     }
20 }
21