blob: 1e3d066d5a5b4649b5e76dddcd7f15c4a0a1a164 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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();
|