From 72c6e9763ca61bc9d7de5f7080ee1c8a1c7c1562 Mon Sep 17 00:00:00 2001 From: Miguel Date: Tue, 21 Aug 2018 19:42:33 +0200 Subject: cleaning up a bit --- driver/timer.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 driver/timer.h (limited to 'driver/timer.h') 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 + +/** + * 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(); -- cgit v1.2.3