diff options
author | Alexis211 <alexis211@gmail.com> | 2010-02-03 15:22:30 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2010-02-03 15:22:30 +0100 |
commit | 9c4310651a91e64c10a17f3190c895a49096aeb1 (patch) | |
tree | af87d115512249458f80f184d53db403c3f0bb0f /src/stem/timer.c | |
parent | 7f72a900c12ba62db12df0872cb66f79a27aa9d9 (diff) | |
download | TCE-9c4310651a91e64c10a17f3190c895a49096aeb1.tar.gz TCE-9c4310651a91e64c10a17f3190c895a49096aeb1.zip |
Reogranization
Diffstat (limited to 'src/stem/timer.c')
-rw-r--r-- | src/stem/timer.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/stem/timer.c b/src/stem/timer.c deleted file mode 100644 index 10651ab..0000000 --- a/src/stem/timer.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "timer.h" -#include "idt.h" -#include "sys.h" -#include "monitor.h" - -static uint32_t tick = 0, frequency = 0, uptime = 0; - -void timer_callback(struct registers *regs) { - tick++; - if (tick == frequency) { - uptime++; - tick = 0; - } -} - -uint32_t timer_uptime() { return uptime; } - -uint32_t timer_time() { - return (uptime * 1000) + (tick * 1000 / frequency); -} - -void timer_init(uint32_t freq) { - frequency = freq; - - idt_handleIrq(0, timer_callback); - - uint32_t divisor = 1193180 / freq; - - outb(0x43, 0x36); //Command byte - - uint8_t l = (divisor & 0xFF), h = (divisor >> 8); - outb(0x40, l); - outb(0x40, h); - - monitor_write("Timer started\n"); -} |