You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
251 B
13 lines
251 B
4 years ago
|
use riscv::register::time;
|
||
|
use crate::sbi::set_timer;
|
||
|
use crate::config::CPU_FREQ;
|
||
|
|
||
|
const TICKS_PER_SEC: usize = 100;
|
||
|
|
||
|
pub fn get_time() -> usize {
|
||
|
time::read()
|
||
|
}
|
||
|
|
||
|
pub fn set_next_trigger() {
|
||
|
set_timer(get_time() + CPU_FREQ / TICKS_PER_SEC);
|
||
|
}
|