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

Function TimerInit

src/arch/riscv64/timer.cpp:36–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36auto 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}

Callers 2

mainFunction · 0.50
mainFunction · 0.50

Calls 2

ReadFunction · 0.85
RegisterInterruptFuncMethod · 0.45

Tested by

no test coverage detected