28 #include <l4/sys/cxx/ipc_legacy>
30 namespace L4Re {
namespace Util {
32 template<
typename ICU >
36 ICU
const *this_icu()
const {
return static_cast<ICU
const *
>(
this); }
37 ICU *this_icu() {
return static_cast<ICU*
>(
this); }
40 L4_RPC_LEGACY_DISPATCH(
L4::Icu);
46 int op_info(L4::Icu::Rights, L4::Icu::_Info &info);
47 int op_msi_info(L4::Icu::Rights,
l4_umword_t irqnum,
55 template<
typename ICU>
inline
57 Icu_svr<ICU>::op_bind(L4::Icu::Rights,
l4_umword_t irqnum,
60 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
64 return irq->bind(this_icu(), irq_fp);
67 template<
typename ICU>
inline
69 Icu_svr<ICU>::op_unbind(L4::Icu::Rights,
l4_umword_t irqnum,
72 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
76 return irq->unbind(this_icu(), irq_fp);
79 template<
typename ICU>
inline
81 Icu_svr<ICU>::op_info(L4::Icu::Rights, L4::Icu::_Info &info)
84 this_icu()->icu_get_info(&i);
91 template<
typename ICU>
inline
93 Icu_svr<ICU>::op_msi_info(L4::Icu::Rights,
l4_umword_t irqnum,
96 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
99 return irq->msi_info(source, &info);
102 template<
typename ICU>
inline
104 Icu_svr<ICU>::op_mask(L4::Icu::Rights,
l4_umword_t irqnum)
106 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
112 template<
typename ICU>
inline
114 Icu_svr<ICU>::op_unmask(L4::Icu::Rights,
l4_umword_t irqnum)
116 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
123 template<
typename ICU >
124 class Icu_cap_array_svr :
public Icu_svr<ICU>
141 ~Irq() { ICU::free_irq_cap(_cap); }
144 {
if (_cap) _cap->trigger(); }
148 void mask(
bool mask)
const
166 Icu_cap_array_svr(
unsigned nr_irqs, Irq *irqs)
167 : _irqs(irqs), _nr_irqs(nr_irqs)
172 if (irqnum >= _nr_irqs)
175 return _irqs + irqnum;
186 template<
typename ICU >
197 int r = cfb->server_iface()->realloc_rcv_cap(0);
201 ICU::free_irq_cap(_cap);
206 template<
typename ICU >
210 ICU::free_irq_cap(_cap);
bool free(L4::Cap< void > cap, l4_cap_idx_t task=L4_INVALID_CAP, unsigned unmap_flags=L4_FP_ALL_SPACES) noexcept
Free the capability.
void invalidate() noexcept
Set this capability to invalid (L4_INVALID_CAP).
Generic RPC wrapper for L4 flex-pages.
bool cap_received() const noexcept
Check if the capability has been mapped.
unsigned long l4_umword_t
Unsigned machine word.
unsigned long long l4_uint64_t
Unsigned 64bit value.
@ L4_EINVAL
Invalid argument.
Common L4 ABI Data Types.
_Cap_alloc & cap_alloc
Capability allocator.
Info structure for an ICU.
unsigned nr_msis
The number of MSI vectors supported by the ICU,.
unsigned nr_irqs
The number of IRQ lines supported by the ICU,.
unsigned features
Feature flags.
Info to use for a specific MSI.
Common task related definitions.