diff options
| author | Miguel <m.i@gmx.at> | 2018-08-20 00:47:53 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-08-20 00:47:53 +0200 |
| commit | 39100c30b7a16103e75187c9840a79c7df54f3da (patch) | |
| tree | ea54cd41375e3cc38a291dfff47abffbdb468a7e /kernel/timer.h | |
| parent | dc5b5d1e5cf82b06fe97ffc8c9374c055e12a748 (diff) | |
schicophrenic cleanup after realizing many fundamental desgin problems!
Diffstat (limited to 'kernel/timer.h')
| -rw-r--r-- | kernel/timer.h | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/kernel/timer.h b/kernel/timer.h index a39d433..15488ff 100644 --- a/kernel/timer.h +++ b/kernel/timer.h @@ -1,6 +1,48 @@ + +/** + * @file +/// PIT /// Timer stuff // CMOS + http://www.brokenthorn.com/Resources/OSDevPit.html + https://wiki.osdev.org/CMOS + + vcc/gnd - voltage/ground + + D0-D7 - data lines (data bus) + wr/rd - writing / reading (system control bus) + cs - ignore wr/rd or not (address bus) + a0-a1 (address bus) + + // the three 16bit down counters/timers/channels + clk 0-2 (in) + gate 0-2 (in) + out 0-2 (out) + + //typical + out1 -> pic interrupt on every tick (system timer) + out2 - was used for genearting dram memory refresh (Do not use) + out3 -> pc speaker + + gate pins : depend on mode of operation + we do have modes 0-5. + mode0: counts down to zero , triggers interrupt and waits + mode1: + mode2: rate generator (sys timer) + .... + */ + #include <stdint.h> -void timer_init(); -void timer_tick(); +/** + * Initilize time and PIT (trigger 25 times a second). + * Returns the number of seconds passed since 1970. + */ +uint64_t timer_init(); + +/** get number of ticks since boot */ uint64_t timer_get_ticks(); + +/** get number of milliseconds since boot */ uint64_t timer_get_uptime_ms(); + +/** get number of milliseconds since 1970 */ +uint64_t timer_get_ms(); |
