]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/ia32/timer-rtc.cpp
03643f99d1c8e85ba13f423a4d3a530cc3bb78db
[l4.git] / kernel / fiasco / src / kern / ia32 / timer-rtc.cpp
1 IMPLEMENTATION[{ia32,amd64}-rtc_timer]:
2
3 #include "irq_chip.h"
4 #include "rtc.h"
5 #include "pit.h"
6
7 #include <cstdio>
8
9 //IMPLEMENT inline int Timer::irq() { return 8; }
10
11 PUBLIC static inline
12 unsigned Timer::irq() { return 8; }
13
14 PUBLIC static inline NEEDS["irq_chip.h"]
15 unsigned Timer::irq_mode()
16 { return Irq_base::Trigger_edge | Irq_base::Polarity_high; }
17
18 IMPLEMENT
19 void
20 Timer::init(Cpu_number)
21 {
22   printf("Using the RTC on IRQ %d (%sHz) for scheduling\n", 8,
23 #ifdef CONFIG_SLOW_RTC
24          "64"
25 #else
26          "1k"
27 #endif
28       );
29
30   // set up timer interrupt (~ 1ms)
31   Rtc::init();
32
33   // make sure that PIT does pull its interrupt line
34   Pit::done();
35 }
36
37 PUBLIC static inline NEEDS["rtc.h"]
38 void
39 Timer::acknowledge()
40 {
41   // periodic scheduling is triggered by irq 8 connected with RTC
42   //  irq.mask();
43   Rtc::reset();
44   //  irq.ack();
45   //  Rtc::reset();
46   //  irq.unmask();
47 }
48
49 IMPLEMENT inline
50 void
51 Timer::update_timer(Unsigned64)
52 {
53   // does nothing in periodic mode
54 }