]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/pic.cpp
f98e051281e6a879e321fdf86ab50990925913be
[l4.git] / kernel / fiasco / src / kern / pic.cpp
1 INTERFACE:
2
3 /**
4  * Encapsulation of the platforms interrupt controller
5  */
6 class Pic
7 {
8 public:
9   /**
10    * The type holding the saved Pic state.
11    */
12   typedef unsigned Status;
13
14   /**
15    * Static initalization of the interrupt controller
16    */
17   static void init();
18
19   /**
20    * Disable the given irq (without lock protection).
21    * @pre The Cpu_lock must be locked (cli'ed)
22    *
23    * This function must be implemented in the
24    * architecture specific part (e.g. pic-i8259.cpp).
25    */
26   static void disable_locked( unsigned irqnum );
27
28   /**
29    * Enable the given irq (without lock protection).
30    * @pre The Cpu_lock must be locked (cli'ed)
31    *
32    * This function must be implemented in the
33    * architecture specific part (e.g. pic-i8259.cpp).
34    */
35   static void enable_locked(unsigned irqnum, unsigned prio = 0);
36
37   /**
38    * Temporarily block the IRQ til the next ACK.
39    * @pre The Cpu_lock must be locked (cli'ed)
40    *
41    * This function must be implemented in the
42    * architecture specific part (e.g. pic-i8259.cpp).
43    */
44   static void block_locked(unsigned irqnum);
45
46   /**
47    * Disable all IRQ's and and return the old Pic state.
48    * @pre Must be done with disabled interrupts.
49    */
50   static Status disable_all_save();
51
52   /**
53    * Restore the IRQ's to the saved state s.
54    * @pre Must be done with disabled interrupts.
55    * @param s, the saved state.
56    */
57   static void restore_all( Status s );
58
59   /**
60    * Acknowledge the given IRQ.
61    * @pre The Cpu_lock must be locked (cli'ed).
62    * @param irq, the irq to acknowledge.
63    *
64    * This function must be implemented in the
65    * architecture specific part (e.g. pic-i8259.cpp).
66    */
67   static void acknowledge_locked( unsigned irq );
68
69   /**
70    * Set CPU affinity of IRQ.
71    * @param irq IRQ.
72    * @param cpu Logical CPU.
73    */
74   static void set_cpu(unsigned irq, unsigned cpu);
75 };