blob: abba5e8d08750c726cf65d36af14e1b31311c8fa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// MIT License, Copyright (c) 2021 Marvin Borner
#include <def.h>
#include <drivers/cpu.h>
#include <drivers/pit.h>
#include <timer.h>
CLEAR static void pit_phase(u32 hz)
{
u32 divisor = 3579545 / 3 / hz;
outb(0x43, 0x36); // 01 10 11 0b // CTR, RW, MODE, BCD
outb(0x40, (u8)(divisor & 0xFF));
outb(0x40, (u8)(divisor >> 8));
}
CLEAR void pit_install(void)
{
pit_phase(1000);
timer_install_handler();
}
|