28#include <l4/sys/cxx/ipc_legacy>
30namespace L4Re {
namespace Util {
32template<
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,
55template<
typename ICU>
inline
57Icu_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);
67template<
typename ICU>
inline
69Icu_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);
79template<
typename ICU>
inline
81Icu_svr<ICU>::op_info(L4::Icu::Rights, L4::Icu::_Info &info)
84 this_icu()->icu_get_info(&i);
91template<
typename ICU>
inline
93Icu_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);
102template<
typename ICU>
inline
104Icu_svr<ICU>::op_mask(L4::Icu::Rights,
l4_umword_t irqnum)
106 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
112template<
typename ICU>
inline
114Icu_svr<ICU>::op_unmask(L4::Icu::Rights,
l4_umword_t irqnum)
116 typename ICU::Irq *irq = this_icu()->icu_get_irq(irqnum);
123template<
typename ICU >
124class Icu_cap_array_svr :
public Icu_svr<ICU>
141 ~Irq() { ICU::free_irq_cap(_cap); }
151 void mask(
bool )
const
169 Icu_cap_array_svr(
unsigned nr_irqs, Irq *irqs)
170 : _irqs(irqs), _nr_irqs(nr_irqs)
175 if (irqnum >= _nr_irqs)
178 return _irqs + irqnum;
189template<
typename ICU >
200 int r = cfb->server_iface()->realloc_rcv_cap(0);
204 ICU::free_irq_cap(_cap);
209template<
typename ICU >
213 ICU::free_irq_cap(_cap);
void invalidate() noexcept
Set this capability to invalid (L4_INVALID_CAP).
C++ interface for capabilities.
C++ Icu interface, see Interrupt controller for the C interface.
bool cap_received() const noexcept
Check if at least one 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.
_Cap_alloc & cap_alloc
Capability allocator.
Common L4 ABI Data Types.
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.