From 3d1f0b2cc16ba6a5bb1d47e24f4bb9e33a7e1aaf Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Mon, 17 Nov 2014 21:21:07 +0100 Subject: minor fixes and testing --- kernel/timer.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'kernel/timer.c') 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; } -- cgit v1.2.3