[zion] Move more initialization into the ApicTimer class.
This commit is contained in:
parent
d99624daf6
commit
f8de60e2dd
3 changed files with 12 additions and 11 deletions
|
|
@ -4,11 +4,15 @@
|
|||
#include "interrupt/apic.h"
|
||||
#include "interrupt/timer.h"
|
||||
|
||||
const uint32_t kScheduleFrequency = 20;
|
||||
ApicTimer* gApicTimer = nullptr;
|
||||
|
||||
void ApicTimer::Init() {
|
||||
gApicTimer = new ApicTimer();
|
||||
gApicTimer->StartCalibration();
|
||||
asm("sti;");
|
||||
gApicTimer->WaitCalibration();
|
||||
asm("cli;");
|
||||
}
|
||||
|
||||
void ApicTimer::StartCalibration() {
|
||||
|
|
@ -33,5 +37,6 @@ void ApicTimer::Calibrate() {
|
|||
|
||||
void ApicTimer::FinishCalibration() {
|
||||
MaskPit();
|
||||
SetLocalTimer(calculated_frequency_ / 20, LAPIC_TIMER_PERIODIC);
|
||||
SetLocalTimer(calculated_frequency_ / kScheduleFrequency,
|
||||
LAPIC_TIMER_PERIODIC);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue