| 34 | } |
| 35 | |
| 36 | auto TimerInit() -> void { |
| 37 | // 计算 interval |
| 38 | interval = BasicInfoSingleton::instance().interval / SIMPLEKERNEL_TICK; |
| 39 | |
| 40 | // 注册时钟中断 |
| 41 | InterruptSingleton::instance().RegisterInterruptFunc( |
| 42 | cpu_io::ScauseInfo::kSupervisorTimerInterrupt, |
| 43 | InterruptDelegate::create<TimerHandler>()); |
| 44 | |
| 45 | // 开启时钟中断 |
| 46 | cpu_io::Sie::Stie::Set(); |
| 47 | |
| 48 | // 设置初次时钟中断时间 |
| 49 | sbi_set_timer(cpu_io::Time::Read() + interval); |
| 50 | } |
no test coverage detected