]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/arm/timer-arm.cpp
update
[l4.git] / kernel / fiasco / src / kern / arm / timer-arm.cpp
1 INTERFACE [arm]:
2
3 EXTENSION class Timer
4 {
5 public:
6   static unsigned irq_mode() { return 0; }
7
8 private:
9   static inline void update_one_shot(Unsigned64 wakeup);
10 };
11
12 // ------------------------------------------------------------------------
13 IMPLEMENTATION [arm && vcache]:
14
15 #include "mem_unit.h"
16
17 PRIVATE static inline NEEDS["mem_unit.h"]
18 void
19 Timer::kipclock_cache()
20 {
21   Mem_unit::clean_dcache((void *)&Kip::k()->clock);
22 }
23
24 // ------------------------------------------------------------------------
25 IMPLEMENTATION [arm && !vcache]:
26
27 PRIVATE static inline
28 void
29 Timer::kipclock_cache()
30 {}
31
32 // ------------------------------------------------------------------------
33 IMPLEMENTATION [arm]:
34
35 #include "config.h"
36 #include "globals.h"
37 #include "kip.h"
38 #include "watchdog.h"
39
40 IMPLEMENT inline NEEDS["kip.h"]
41 void
42 Timer::init_system_clock()
43 {
44   Kip::k()->clock = 0;
45 }
46
47 IMPLEMENT inline NEEDS["config.h", "globals.h", "kip.h", "watchdog.h", Timer::kipclock_cache]
48 void
49 Timer::update_system_clock(unsigned cpu)
50 {
51   if (cpu == 0)
52     {
53       Kip::k()->clock += Config::Scheduler_granularity;
54       kipclock_cache();
55       Watchdog::touch();
56     }
57 }
58
59 IMPLEMENT inline NEEDS[Timer::update_one_shot, "config.h"]
60 void
61 Timer::update_timer(Unsigned64 wakeup)
62 {
63   if (Config::Scheduler_one_shot)
64     update_one_shot(wakeup);
65 }