diff options
Diffstat (limited to 'driver/timer.h')
| -rw-r--r-- | driver/timer.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/driver/timer.h b/driver/timer.h new file mode 100644 index 0000000..1e3d066 --- /dev/null +++ b/driver/timer.h @@ -0,0 +1,50 @@ + +/** + * @file + * References + * ---------- + * * 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> + +/** + * 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(); |
