summaryrefslogtreecommitdiff
path: root/driver/timer.h
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-21 19:42:33 +0200
committerMiguel <m.i@gmx.at>2018-08-21 19:42:33 +0200
commit72c6e9763ca61bc9d7de5f7080ee1c8a1c7c1562 (patch)
tree839bce03c26e96f1137d4b4d3550ad3e909d351c /driver/timer.h
parent6c926175afbf1f9ec2715fb007acc28588b36c4a (diff)
cleaning up a bit
Diffstat (limited to 'driver/timer.h')
-rw-r--r--driver/timer.h50
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();