aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2019-10-02 20:40:09 +0200
committerMarvin Borner2019-10-02 20:40:09 +0200
commit7e81739528577c2e7f92b42b2d186b63fdd3d6d5 (patch)
tree9c536f1e38c37130a865da5cc30b119990d24c0c
parent173f122fcc5c731387c611abe155249b232fbf07 (diff)
Made timer more precise
-rw-r--r--src/kernel/timer/timer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/kernel/timer/timer.c b/src/kernel/timer/timer.c
index f332429..7d650e8 100644
--- a/src/kernel/timer/timer.c
+++ b/src/kernel/timer/timer.c
@@ -4,13 +4,13 @@
static unsigned int timer_ticks = 0;
void timer_phase(int hz) {
- int divisor = 1193180 / hz;
+ int divisor = (int) (3579545.0 / 3.0 / (double) hz);
send_b(0x43, 0x36); // 01 10 11 0b // CTR, RW, MODE, BCD
send_b(0x40, divisor & 0xFF);
send_b(0x40, divisor >> 8);
}
-// Executed 100 times per second
+// Executed 1000 times per second
void timer_handler(struct regs *r) {
timer_ticks++;
}
@@ -31,6 +31,6 @@ unsigned int get_time() {
// Install timer handler into IRQ0
void timer_install() {
- timer_phase(100);
+ timer_phase(1000);
irq_install_handler(0, timer_handler);
} \ No newline at end of file