diff options
author | Marvin Borner | 2019-10-02 20:40:09 +0200 |
---|---|---|
committer | Marvin Borner | 2019-10-02 20:40:09 +0200 |
commit | 7e81739528577c2e7f92b42b2d186b63fdd3d6d5 (patch) | |
tree | 9c536f1e38c37130a865da5cc30b119990d24c0c /src/kernel | |
parent | 173f122fcc5c731387c611abe155249b232fbf07 (diff) |
Made timer more precise
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/timer/timer.c | 6 |
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 |