4 * \brief Interrupt functionality
8 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>
10 * economic rights: Technische Universität Dresden (Germany)
12 * This file is part of TUD:OS and distributed under the terms of the
13 * GNU General Public License 2.
14 * Please see the COPYING-GPL-2 file for details.
16 * As a special exception, you may use this file as part of a free software
17 * library without restriction. Specifically, if other files instantiate
18 * templates or use macros or inline functions from this file, or you compile
19 * this file and link it with other files to produce an executable, this
20 * file does not by itself cause the resulting executable to be covered by
21 * the GNU General Public License. This exception does not however
22 * invalidate any other reasons why the executable file might be covered by
23 * the GNU General Public License.
28 #include <l4/sys/icu.h>
29 #include <l4/sys/irq.h>
30 #include <l4/sys/capability>
33 namespace Protocol { enum { Icu = L4_PROTO_IRQ }; }
34 namespace Protocol { enum { Irq = L4_PROTO_IRQ }; }
36 class Irq_eio : public Kobject_t<Irq_eio, Kobject, L4_PROTO_IRQ>
38 L4_KOBJECT_DISABLE_COPY(Irq_eio)
41 l4_msgtag_t unmask(unsigned irqnum, l4_umword_t *label, l4_timeout_t to,
42 l4_utcb_t *utcb = l4_utcb()) throw()
43 { return l4_icu_control_u(cap(), irqnum, L4_ICU_CTL_UNMASK, label, to, utcb); }
47 * \brief C++ version of an L4 IRQ.
50 * <c>\#include <l4/sys/irq></c>
52 * \see \ref l4_irq_api for an overview and C bindings.
54 class Irq : public Kobject_t<Irq, Irq_eio, L4_PROTO_IRQ>
61 * \copydoc l4_irq_attach()
62 * \note \a irq is the implicit \a this pointer.
64 l4_msgtag_t attach(l4_umword_t label, Cap<Thread> const &thread,
65 l4_utcb_t *utcb = l4_utcb()) throw()
66 { return l4_irq_attach_u(cap(), label, thread.cap(), utcb); }
69 * \copydoc l4_irq_chain()
70 * \note \a irq is the implicit \a this pointer.
72 l4_msgtag_t chain(l4_umword_t label, Cap<Irq> const &slave,
73 l4_utcb_t *utcb = l4_utcb()) throw()
74 { return l4_irq_chain_u(cap(), label, slave.cap(), utcb); }
77 * \copydoc l4_irq_detach()
78 * \note \a irq is the implicit \a this pointer.
80 l4_msgtag_t detach(l4_utcb_t *utcb = l4_utcb()) throw()
81 { return l4_irq_detach_u(cap(), utcb); }
85 * \copydoc l4_irq_receive()
86 * \note \a irq is the implicit \a this pointer.
88 l4_msgtag_t receive(l4_timeout_t to = L4_IPC_NEVER,
89 l4_utcb_t *utcb = l4_utcb()) throw()
90 { return l4_irq_receive_u(cap(), to, utcb); }
93 * \copydoc l4_irq_wait()
94 * \note \a irq is the implicit \a this pointer.
96 l4_msgtag_t wait(l4_umword_t *label, l4_timeout_t to = L4_IPC_NEVER,
97 l4_utcb_t *utcb = l4_utcb()) throw()
98 { return l4_irq_wait_u(cap(), label, to, utcb); }
101 * \copydoc l4_irq_unmask()
102 * \note \a irq is the implicit \a this pointer.
104 l4_msgtag_t unmask(l4_utcb_t *utcb = l4_utcb()) throw()
105 { return l4_irq_unmask_u(cap(), utcb); }
108 * \copydoc l4_irq_trigger()
109 * \note \a irq is the implicit \a this pointer.
111 l4_msgtag_t trigger(l4_utcb_t *utcb = l4_utcb()) throw()
112 { return l4_irq_trigger_u(cap(), utcb); }
118 * \brief C++ version of an interrupt controller.
119 * \ingroup l4_icu_api
121 * <c>\#include <l4/sys/icu></c>
123 * \see \ref l4_icu_api for an overview and C bindings.
125 class Icu : public Kobject_t<Icu, Irq_eio, L4_PROTO_IRQ>
132 F_none = L4_IRQ_F_NONE,
133 F_level_high = L4_IRQ_F_LEVEL_HIGH,
134 F_level_low = L4_IRQ_F_LEVEL_LOW,
135 F_pos_edge = L4_IRQ_F_POS_EDGE,
136 F_neg_edge = L4_IRQ_F_NEG_EDGE,
137 F_mask = L4_IRQ_F_MASK,
142 F_msi = L4_ICU_FLAG_MSI
146 * \brief Info for an ICU.
147 * \ingroup l4_icu_api
149 * This class adds access functions.
150 * \see l4_icu_info().
152 class Info : public l4_icu_info_t
155 bool supports_msi() const { return features & F_msi; }
159 * \copydoc l4_icu_bind()
160 * \note \a the icu argument is the implicit \a this pointer.
162 l4_msgtag_t bind(unsigned irqnum, L4::Cap<Irq> irq,
163 l4_utcb_t *utcb = l4_utcb()) throw()
164 { return l4_icu_bind_u(cap(), irqnum, irq.cap(), utcb); }
167 * \copydoc l4_icu_unbind()
168 * \note \a the icu argument is the implicit \a this pointer.
170 l4_msgtag_t unbind(unsigned irqnum, L4::Cap<Irq> irq,
171 l4_utcb_t *utcb = l4_utcb()) throw()
172 { return l4_icu_unbind_u(cap(), irqnum, irq.cap(), utcb); }
175 * \copydoc l4_icu_info()
176 * \note \a the icu argument is the implicit \a this pointer.
178 l4_msgtag_t info(l4_icu_info_t *info, l4_utcb_t *utcb = l4_utcb()) throw()
179 { return l4_icu_info_u(cap(), info, utcb); }
182 * \copydoc l4_icu_msi_info()
183 * \note \a the icu argument is the implicit \a this pointer.
185 l4_msgtag_t msi_info(unsigned irqnum, l4_umword_t *msg,
186 l4_utcb_t *utcb = l4_utcb()) throw()
187 { return l4_icu_msi_info_u(cap(), irqnum, msg, utcb); }
189 l4_msgtag_t control(unsigned irqnum, unsigned op, l4_umword_t *label,
190 l4_timeout_t to, l4_utcb_t *utcb = l4_utcb()) throw()
191 { return l4_icu_control_u(cap(), irqnum, op, label, to, utcb); }
193 l4_msgtag_t mask(unsigned irqnum, l4_umword_t *label, l4_timeout_t to,
194 l4_utcb_t *utcb = l4_utcb()) throw()
195 { return l4_icu_control_u(cap(), irqnum, L4_ICU_CTL_MASK, label, to, utcb); }
197 l4_msgtag_t set_mode(unsigned irqnum, l4_umword_t mode,
198 l4_utcb_t *utcb = l4_utcb()) throw()
199 { return l4_icu_set_mode_u(cap(), irqnum, mode, utcb); }