]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/pic-i8259.cpp
Some minor fixes.
[l4.git] / kernel / fiasco / src / kern / pic-i8259.cpp
1 INTERFACE[i8259 && (ia32 || amd64)]:
2
3 #include "initcalls.h"
4
5 EXTENSION class Pic
6 {
7   friend class Jdb_kern_info_pic_state;
8   friend class Io_m;
9 private:
10   enum
11   {
12     MASTER_PIC_BASE = 0x20,
13     SLAVES_PIC_BASE = 0xa0,
14     OFF_ICW         = 0x00,
15     OFF_OCW         = 0x01,
16
17     MASTER_ICW      = MASTER_PIC_BASE + OFF_ICW,
18     MASTER_OCW      = MASTER_PIC_BASE + OFF_OCW,
19     SLAVES_ICW      = SLAVES_PIC_BASE + OFF_ICW,
20     SLAVES_OCW      = SLAVES_PIC_BASE + OFF_OCW,
21   };
22 };
23
24
25 IMPLEMENTATION [i8259 && (ia32 || amd64)]:
26
27 #include "io.h"
28
29 PUBLIC static inline NEEDS["io.h"]
30 Unsigned16
31 Pic::disable_all_save()
32 {
33   Unsigned16 s;
34   s  = Io::in8(MASTER_OCW);
35   s |= Io::in8(SLAVES_OCW) << 8;
36   Io::out8(0xff, MASTER_OCW);
37   Io::out8(0xff, SLAVES_OCW);
38
39   return s;
40 }
41
42 PUBLIC static inline NEEDS["io.h"]
43 void
44 Pic::restore_all(Unsigned16 s)
45 {
46   Io::out8(s & 0x0ff, MASTER_OCW);
47   Io::out8((s >> 8) & 0x0ff, SLAVES_OCW);
48 }
49
50