#include <cpu_io.h>
#include <opensbi_interface.h>
#include "arch.h"
#include "basic_info.hpp"
#include "interrupt.h"
#include "kernel.h"
#include "task_manager.hpp"
Go to the source code of this file.
◆ InterruptDelegate
- Copyright
- Copyright The SimpleKernel Contributors
Definition at line 14 of file timer.cpp.
◆ TimerInit()
| auto TimerInit |
( |
| ) |
-> void |
初始化定时器
- Precondition
- InterruptInit 已完成
- Postcondition
- 定时器中断已启用,系统 tick 开始计数
Definition at line 34 of file timer.cpp.
34 {
35
36 interval = BasicInfoSingleton::instance().interval / SIMPLEKERNEL_TICK;
37
38
39 InterruptSingleton::instance().RegisterInterruptFunc(
40 cpu_io::ScauseInfo::kSupervisorTimerInterrupt,
41 InterruptDelegate::create<TimerHandler>());
42
43
44 cpu_io::Sie::Stie::Set();
45
46
47 sbi_set_timer(cpu_io::Time::Read() + interval);
48}
◆ TimerInitSMP()
| auto TimerInitSMP |
( |
| ) |
-> void |
从核的定时器初始化
- Precondition
- 主核已完成 TimerInit,从核已完成 InterruptInitSMP
- Postcondition
- 从核的定时器中断已启用
Definition at line 26 of file timer.cpp.
26 {
27
28 cpu_io::Sie::Stie::Set();
29
30
31 sbi_set_timer(cpu_io::Time::Read() + interval);
32}