]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/ia32/timer-rtc.cpp
update
[l4.git] / kernel / fiasco / src / kern / ia32 / timer-rtc.cpp
1 IMPLEMENTATION[{ia32,amd64}-rtc_timer]:
2
3 #include "irq_chip.h"
4 #include "irq_pin.h"
5 #include "rtc.h"
6 #include "pit.h"
7
8 #include <cstdio>
9
10 IMPLEMENT inline int Timer::irq_line() { return 8; }
11
12 IMPLEMENT
13 void
14 Timer::init()
15 {
16   Irq_chip *c = Irq_chip::hw_chip;
17   unsigned in = c->legacy_override(8);
18   printf("Using the RTC on IRQ %d (%sHz) for scheduling\n", in,
19 #ifdef CONFIG_SLOW_RTC
20          "64"
21 #else
22          "1k"
23 #endif
24       );
25
26   // set up timer interrupt (~ 1ms)
27   Rtc::init(in);
28
29   // make sure that PIT does pull its interrupt line
30   Pit::done();
31
32   // from now we can save energy in getchar()
33   Config::getchar_does_hlt_works_ok = Config::hlt_works_ok;
34 }
35
36 IMPLEMENT inline NEEDS["rtc.h","irq_pin.h"]
37 void
38 Timer::acknowledge()
39 {
40   // periodic scheduling is triggered by irq 8 connected with RTC
41   Rtc::irq->pin()->mask();
42   Rtc::ack_reset();
43   Rtc::irq->pin()->unmask();
44 }
45
46 IMPLEMENT inline NEEDS["irq_pin.h"]
47 void
48 Timer::enable()
49 {
50   Rtc::irq->pin()->unmask();
51 }
52
53 IMPLEMENT inline NEEDS["irq_pin.h"]
54 void
55 Timer::disable()
56 {
57   Rtc::irq->pin()->mask();
58 }
59
60 IMPLEMENT inline
61 void
62 Timer::update_timer(Unsigned64)
63 {
64   // does nothing in periodic mode
65 }