diff options
author | Alexis211 <alexis211@gmail.com> | 2010-08-10 20:39:57 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2010-08-10 20:39:57 +0200 |
commit | f81bf65484fa8c81a1886f456c71f1e6eebe84e9 (patch) | |
tree | 146f304d8de8828003edd548df22cca581044017 /src/kernel/task/timer.c | |
parent | 0ec0ca40a4fedfe97c49903a329b2a9ad2e22d03 (diff) | |
download | TCE-f81bf65484fa8c81a1886f456c71f1e6eebe84e9.tar.gz TCE-f81bf65484fa8c81a1886f456c71f1e6eebe84e9.zip |
Added a lot of comments in kernel code. A bit of cleaning too.
Diffstat (limited to 'src/kernel/task/timer.c')
-rw-r--r-- | src/kernel/task/timer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/kernel/task/timer.c b/src/kernel/task/timer.c index e924657..1ec1523 100644 --- a/src/kernel/task/timer.c +++ b/src/kernel/task/timer.c @@ -5,6 +5,8 @@ static uint32_t tick = 0, frequency = 0, uptime = 0; +/* Called when IRQ0 fires. Updates the uptime variable. + DOES NOT provoke a task switch. The task switch is called in idt.c (IRQ handler). */ void timer_callback(struct registers *regs) { tick++; if (tick == frequency) { @@ -13,12 +15,15 @@ void timer_callback(struct registers *regs) { } } +/* Accessor function to get machine uptime. */ uint32_t timer_uptime() { return uptime; } +/* Accessor function, gets uptime in miliseconds. */ uint32_t timer_time() { return (uptime * 1000) + (tick * 1000 / frequency); } +/* Called by kmain. Sets up the PIT and the IRQ0 handler. */ void timer_init(uint32_t freq) { frequency = freq; |