diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-11-17 21:21:07 +0100 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-11-17 21:21:07 +0100 |
| commit | 3d1f0b2cc16ba6a5bb1d47e24f4bb9e33a7e1aaf (patch) | |
| tree | 4e9f4e18563985c20b3406fe0f4241bf90674a2b /kernel/timer.c | |
| parent | 3e151cb6371ecba06e21c3e56e0a95c8af4e93f9 (diff) | |
minor fixes and testing
Diffstat (limited to 'kernel/timer.c')
| -rw-r--r-- | kernel/timer.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index da9e6bd..956195b 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -30,12 +30,15 @@ */ -#include "kernel.h" +#define FOOLOS_MODULE_NAME "timer" + +#include "timer.h" #include "x86.h" #include "../lib/logger/log.h" // logger facilities -#define FOOLOS_MODULE_NAME "timer" +//static volatile +static uint64_t task_system_clock=0; void timer_init() { @@ -43,7 +46,7 @@ void timer_init() // http://en.wikipedia.org/wiki/Intel_8253#Control_Word_Register // http://www.brokenthorn.com/Resources/OSDevPit.html // int0 will be triggered ~25 times a second. - + __asm__("pusha"); __asm__("mov %0, %%dx"::"X" (1193180 / 25)); @@ -60,4 +63,15 @@ void timer_init() __asm__("popa"); log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"Configured PIT Channel 0 : Mode 2 : 1/25 s."); + +} + +void timer_tick() +{ + task_system_clock++; +} + +uint64_t timer_get_ticks() +{ + return task_system_clock; } |
