| 47 | } |
| 48 | |
| 49 | auto TimerInit() -> void { |
| 50 | // 计算 interval |
| 51 | interval = BasicInfoSingleton::instance().interval / SIMPLEKERNEL_TICK; |
| 52 | |
| 53 | // 获取定时器中断号 |
| 54 | timer_intid = KernelFdtSingleton::instance() |
| 55 | .GetAarch64Intid("arm,armv8-timer") |
| 56 | .value() + |
| 57 | Gic::kPpiBase; |
| 58 | |
| 59 | InterruptSingleton::instance().RegisterInterruptFunc( |
| 60 | timer_intid, InterruptDelegate::create<TimerHandler>()); |
| 61 | |
| 62 | InterruptSingleton::instance().Ppi(timer_intid, cpu_io::GetCurrentCoreId()); |
| 63 | |
| 64 | cpu_io::CNTV_CTL_EL0::ENABLE::Clear(); |
| 65 | cpu_io::CNTV_CTL_EL0::IMASK::Set(); |
| 66 | |
| 67 | cpu_io::CNTV_TVAL_EL0::Write(interval); |
| 68 | |
| 69 | cpu_io::CNTV_CTL_EL0::ENABLE::Set(); |
| 70 | cpu_io::CNTV_CTL_EL0::IMASK::Clear(); |
| 71 | } |
nothing calls this directly
no test coverage detected