2 * (c) 2011 Alexander Warg <warg@os.inf.tu-dresden.de>
3 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU General Public License 2.
7 * Please see the COPYING-GPL-2 file for details.
25 L4::Cap<L4::Irq> _irq;
26 unsigned short _flags;
27 unsigned short _max_sw_irqs;
29 void chg_flags(bool set, unsigned flags)
38 L4::Cap<L4::Irq> irq() const { return _irq; }
39 void irq(L4::Cap<L4::Irq> i) { _irq = i; }
41 Io_irq_pin() : _sw_irqs(0), _irq(), _flags(0), _max_sw_irqs(0) {}
43 void set_shareable(bool s)
44 { chg_flags(s, F_shareable); }
46 void set_chained(bool s)
47 { chg_flags(s, F_chained); }
50 void add_sw_irq() { ++_max_sw_irqs; }
51 int sw_irqs() const { return _sw_irqs; }
52 void inc_sw_irqs() { ++_sw_irqs; }
53 void dec_sw_irqs() { ++_sw_irqs; }
54 virtual int bind(L4::Cap<L4::Irq> irq, unsigned mode) = 0;
55 virtual int unmask() = 0;
56 virtual int unbind() = 0;
57 virtual ~Io_irq_pin() {}
59 bool shared() const { return _max_sw_irqs > 1; }
60 bool shareable() const { return _flags & F_shareable; }
61 bool chained() const { return _flags & F_chained; }
64 class Kernel_irq_pin : public Io_irq_pin
69 Kernel_irq_pin(unsigned idx) : Io_irq_pin(), _idx(idx) {}
70 int bind(L4::Cap<L4::Irq> irq, unsigned mode);