MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / TimerInit

Function TimerInit

src/arch/aarch64/timer.cpp:49–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49auto 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}

Callers

nothing calls this directly

Calls 5

GetCurrentCoreIdFunction · 0.85
WriteFunction · 0.85
GetAarch64IntidMethod · 0.80
RegisterInterruptFuncMethod · 0.45
PpiMethod · 0.45

Tested by

no test coverage detected