]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/ux/timer-ux.cpp
2bcce1bdd81468b9743973ba52872459b9f43688
[l4.git] / kernel / fiasco / src / kern / ux / timer-ux.cpp
1 // ------------------------------------------------------------------------
2 INTERFACE[ux]:
3
4 EXTENSION class Timer
5 {
6 private:
7   static void bootstrap();
8 };
9
10 // ------------------------------------------------------------------------
11 IMPLEMENTATION[ux]:
12
13 #include <cstdio>
14 #include <cstdlib>
15 #include <unistd.h>
16 #include <sys/types.h>
17 #include "boot_info.h"
18 #include "initcalls.h"
19 #include "irq_chip.h"
20 #include "irq_mgr.h"
21 #include "pic.h"
22
23 PUBLIC static inline NEEDS["pic.h"]
24 unsigned
25 Timer::irq() { return Pic::Irq_timer; }
26
27 PUBLIC static inline
28 unsigned
29 Timer::irq_mode() { return 0; }
30
31 IMPLEMENT FIASCO_INIT_CPU
32 void
33 Timer::init(unsigned)
34 {
35   if (Boot_info::irq0_disabled())
36     return;
37
38   if (!Pic::setup_irq_prov(Pic::Irq_timer, Boot_info::irq0_path(), bootstrap))
39     {
40       puts ("Problems setting up timer interrupt!");
41       exit (1);
42     }
43 }
44
45 IMPLEMENT FIASCO_INIT_CPU
46 void
47 Timer::bootstrap()
48 {
49   close(Boot_info::fd());
50   execl(Boot_info::irq0_path(), "[I](irq0)", NULL);
51 }
52
53 PUBLIC static inline
54 void
55 Timer::acknowledge()
56 {}
57
58
59 IMPLEMENT inline
60 void
61 Timer::update_timer(Unsigned64)
62 {
63   // does nothing in periodic mode
64 }