Loading...
Searching...
No Matches
irq
Go to the documentation of this file.
// vi:set ft=cpp: -*- Mode: C++ -*-
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/sys/icu.h>
#include <l4/sys/irq.h>
#include <l4/sys/capability>
#include <l4/sys/rcv_endpoint>
#include <l4/sys/cxx/ipc_iface>
#include <l4/sys/cxx/ipc_types>
namespace L4 {
class Irq_eoi : public Kobject_0t<Irq_eoi, L4::PROTO_EMPTY>
{
public:
l4_msgtag_t unmask(unsigned irqnum, l4_umword_t *label = 0,
l4_timeout_t to = L4_IPC_NEVER,
l4_utcb_t *utcb = l4_utcb()) noexcept
{
return l4_icu_control_u(cap(), irqnum, L4_ICU_CTL_UNMASK, label, to, utcb);
}
};
struct Triggerable : Kobject_t<Triggerable, Irq_eoi, L4_PROTO_IRQ>
{
l4_msgtag_t trigger(l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_irq_trigger_u(cap(), utcb); }
};
class Irq : public Kobject_2t<Irq, Triggerable, Rcv_endpoint, L4_PROTO_IRQ_SENDER>
{
public:
using Triggerable::unmask;
l4_msgtag_t bind_vcpu(L4::Cap<Thread> const &thread, l4_umword_t cfg,
l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_irq_bind_vcpu_u(cap(), thread.cap(), cfg, utcb); }
l4_msgtag_t detach(l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_irq_detach_u(cap(), utcb); }
l4_msgtag_t receive(l4_timeout_t timeout = L4_IPC_NEVER,
l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_irq_receive_u(cap(), timeout, utcb); }
l4_msgtag_t wait(l4_umword_t *label, l4_timeout_t timeout = L4_IPC_NEVER,
l4_utcb_t *utcb = l4_utcb()) noexcept
{ return unmask(-1, label, timeout, utcb); }
l4_msgtag_t unmask(l4_utcb_t *utcb = l4_utcb()) noexcept
{ return unmask(-1, 0, L4_IPC_NEVER, utcb); }
};
class Icu :
public Kobject_t<Icu, Irq_eoi, L4_PROTO_IRQ,
Type_info::Demand_t<1> >
{
public:
enum Mode
{
F_none = L4_IRQ_F_NONE,
F_level_high = L4_IRQ_F_LEVEL_HIGH,
F_level_low = L4_IRQ_F_LEVEL_LOW,
F_pos_edge = L4_IRQ_F_POS_EDGE,
F_neg_edge = L4_IRQ_F_NEG_EDGE,
F_both_edge = L4_IRQ_F_BOTH_EDGE,
F_mask = L4_IRQ_F_MASK,
F_set_wakeup = L4_IRQ_F_SET_WAKEUP,
F_clear_wakeup = L4_IRQ_F_CLEAR_WAKEUP,
};
enum Flags
{
F_msi = L4_ICU_FLAG_MSI
};
class Info : public l4_icu_info_t
{
public:
bool supports_msi() const noexcept { return features & F_msi; }
};
l4_msgtag_t bind(unsigned irqnum, L4::Cap<Triggerable> irq,
l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_icu_bind_u(cap(), irqnum, irq.cap(), utcb); }
L4_RPC_NF_OP(
L4_ICU_OP_BIND,
l4_msgtag_t, bind, (l4_umword_t irqnum, Ipc::Cap<Irq> irq)
);
l4_msgtag_t unbind(unsigned irqnum, L4::Cap<Triggerable> irq,
l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_icu_unbind_u(cap(), irqnum, irq.cap(), utcb); }
L4_RPC_NF_OP(
L4_ICU_OP_UNBIND,
l4_msgtag_t, unbind, (l4_umword_t irqnum, Ipc::Cap<Irq> irq)
);
l4_msgtag_t info(l4_icu_info_t *info, l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_icu_info_u(cap(), info, utcb); }
struct _Info { l4_umword_t features, nr_irqs, nr_msis; };
L4_RPC_NF_OP(L4_ICU_OP_INFO, l4_msgtag_t, info, (_Info *info));
L4_INLINE_RPC_OP(L4_ICU_OP_MSI_INFO,
l4_msgtag_t, msi_info, (l4_umword_t irqnum, l4_uint64_t source,
l4_icu_msi_info_t *msi_info));
l4_msgtag_t control(unsigned irqnum, unsigned op, l4_umword_t *label,
l4_timeout_t to, l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_icu_control_u(cap(), irqnum, op, label, to, utcb); }
l4_msgtag_t mask(unsigned irqnum,
l4_umword_t *label = 0,
l4_timeout_t to = L4_IPC_NEVER,
l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_icu_mask_u(cap(), irqnum, label, to, utcb); }
L4_RPC_NF_OP(
L4_ICU_OP_MASK,
l4_msgtag_t, mask, (l4_umword_t irqnum),
L4::Ipc::Send_only
);
L4_RPC_NF_OP(
L4_ICU_OP_UNMASK,
l4_msgtag_t, unmask, (l4_umword_t irqnum),
L4::Ipc::Send_only
);
l4_msgtag_t set_mode(unsigned irqnum, l4_umword_t mode,
l4_utcb_t *utcb = l4_utcb()) noexcept
{ return l4_icu_set_mode_u(cap(), irqnum, mode, utcb); }
L4_RPC_NF_OP(
L4_ICU_OP_SET_MODE,
l4_msgtag_t, set_mode, (l4_umword_t irqnum, l4_umword_t mode)
);
typedef L4::Typeid::Rpcs_sys<
bind_t, unbind_t, info_t, msi_info_t, unmask_t, mask_t, set_mode_t
> Rpcs;
};
}
capability
L4::Cap related definitions.
L4::Cap_base::cap
l4_cap_idx_t cap() const noexcept
Return capability selector.
Definition capability.h:49
L4::Cap
C++ interface for capabilities.
Definition capability.h:224
L4::Icu::Info
This class encapsulates information about an ICU.
Definition irq:278
L4::Icu::Info::supports_msi
bool supports_msi() const noexcept
True, if the ICU has support for MSIs.
Definition irq:281
L4::Icu
C++ Icu interface, see Interrupt controller for the C interface.
Definition irq:253
L4::Icu::msi_info
l4_msgtag_t msi_info(l4_umword_t irqnum, l4_uint64_t source, l4_icu_msi_info_t *msi_info)
Get MSI info about IRQ.
L4::Icu::info
l4_msgtag_t info(l4_icu_info_t *info, l4_utcb_t *utcb=l4_utcb()) noexcept
Get information about the ICU features.
Definition irq:345
L4::Icu::set_mode
l4_msgtag_t set_mode(unsigned irqnum, l4_umword_t mode, l4_utcb_t *utcb=l4_utcb()) noexcept
Set interrupt mode.
Definition irq:421
L4::Icu::unbind
l4_msgtag_t unbind(unsigned irqnum, L4::Cap< Triggerable > irq, l4_utcb_t *utcb=l4_utcb()) noexcept
Remove binding of an interrupt line from the interrupt controller object.
Definition irq:328
L4::Icu::mask
l4_msgtag_t mask(unsigned irqnum, l4_umword_t *label=0, l4_timeout_t to=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
Mask an IRQ line.
Definition irq:393
L4::Icu::bind
l4_msgtag_t bind(unsigned irqnum, L4::Cap< Triggerable > irq, l4_utcb_t *utcb=l4_utcb()) noexcept
Bind an interrupt line of an interrupt controller to an interrupt object.
Definition irq:310
L4::Ipc::Cap
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:699
L4::Irq_eoi
Interface for sending an unmask message to an object.
Definition irq:38
L4::Irq_eoi::unmask
l4_msgtag_t unmask(unsigned irqnum, l4_umword_t *label=0, l4_timeout_t to=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
Unmask the given interrupt line.
Definition irq:64
L4::Irq
C++ Irq interface, see IRQs for the C interface.
Definition irq:121
L4::Irq::detach
l4_msgtag_t detach(l4_utcb_t *utcb=l4_utcb()) noexcept
Detach from this interrupt.
Definition irq:176
L4::Irq::wait
l4_msgtag_t wait(l4_umword_t *label, l4_timeout_t timeout=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
Unmask IRQ and (open) wait for any message.
Definition irq:204
L4::Irq::unmask
l4_msgtag_t unmask(l4_utcb_t *utcb=l4_utcb()) noexcept
Unmask this IRQ.
Definition irq:221
L4::Irq::receive
l4_msgtag_t receive(l4_timeout_t timeout=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
Unmask and wait for this IRQ.
Definition irq:191
L4::Irq::bind_vcpu
l4_msgtag_t bind_vcpu(L4::Cap< Thread > const &thread, l4_umword_t cfg, l4_utcb_t *utcb=l4_utcb()) noexcept
Bind a thread to this Irq for vCPU interrupt forwarding.
Definition irq:158
L4::Kobject_2t
Helper class to create an L4Re interface class that is derived from two base classes (see L4::Kobject...
Definition __typeinfo.h:828
L4::Kobject_t
Helper class to create an L4Re interface class that is derived from a single base class.
Definition __typeinfo.h:750
L4::Kobject::cap
l4_cap_idx_t cap() const noexcept
Return capability selector.
Definition kobject:69
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
l4_uint64_t
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:31
l4_icu_bind_u
l4_msgtag_t l4_icu_bind_u(l4_cap_idx_t icu, unsigned irqnum, l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
Bind an interrupt line of an interrupt controller to an interrupt object.
Definition icu.h:396
l4_icu_info_u
l4_msgtag_t l4_icu_info_u(l4_cap_idx_t icu, l4_icu_info_t *info, l4_utcb_t *utcb) L4_NOTHROW
Get information about the ICU features.
Definition icu.h:420
l4_icu_set_mode_u
l4_msgtag_t l4_icu_set_mode_u(l4_cap_idx_t icu, unsigned irqnum, l4_umword_t mode, l4_utcb_t *utcb) L4_NOTHROW
Set interrupt mode.
Definition icu.h:457
l4_icu_mask_u
l4_msgtag_t l4_icu_mask_u(l4_cap_idx_t icu, unsigned irqnum, l4_umword_t *label, l4_timeout_t to, l4_utcb_t *utcb) L4_NOTHROW
Mask an IRQ line.
Definition icu.h:483
l4_icu_unbind_u
l4_msgtag_t l4_icu_unbind_u(l4_cap_idx_t icu, unsigned irqnum, l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
Remove binding of an interrupt line from the interrupt controller object.
Definition icu.h:408
L4_ICU_FLAG_MSI
@ L4_ICU_FLAG_MSI
Flag to denote that the IRQ is actually an MSI.
Definition icu.h:62
l4_irq_trigger_u
l4_msgtag_t l4_irq_trigger_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
Trigger the object.
Definition irq.h:263
l4_irq_bind_vcpu_u
l4_msgtag_t l4_irq_bind_vcpu_u(l4_cap_idx_t irq, l4_cap_idx_t thread, l4_umword_t cfg, l4_utcb_t *utcb) L4_NOTHROW
Bind a thread to this Irq for vCPU interrupt forwarding.
Definition irq.h:250
l4_irq_receive_u
l4_msgtag_t l4_irq_receive_u(l4_cap_idx_t irq, l4_timeout_t timeout, l4_utcb_t *utcb) L4_NOTHROW
Unmask and wait for this IRQ.
Definition irq.h:270
l4_irq_detach_u
l4_msgtag_t l4_irq_detach_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
Detach from this interrupt.
Definition irq.h:242
L4_IRQ_F_MASK
@ L4_IRQ_F_MASK
Mask.
Definition icu.h:85
L4_IRQ_F_NEG_EDGE
@ L4_IRQ_F_NEG_EDGE
Negative edge trigger.
Definition icu.h:83
L4_IRQ_F_CLEAR_WAKEUP
@ L4_IRQ_F_CLEAR_WAKEUP
Do not use irq as wakeup source.
Definition icu.h:89
L4_IRQ_F_SET_WAKEUP
@ L4_IRQ_F_SET_WAKEUP
Wakeup source?
Definition icu.h:88
L4_IRQ_F_LEVEL_HIGH
@ L4_IRQ_F_LEVEL_HIGH
Level high trigger.
Definition icu.h:80
L4_IRQ_F_BOTH_EDGE
@ L4_IRQ_F_BOTH_EDGE
Both edges trigger.
Definition icu.h:84
L4_IRQ_F_POS_EDGE
@ L4_IRQ_F_POS_EDGE
Positive edge trigger.
Definition icu.h:82
L4_IRQ_F_NONE
@ L4_IRQ_F_NONE
Flow types.
Definition icu.h:73
L4_IRQ_F_LEVEL_LOW
@ L4_IRQ_F_LEVEL_LOW
Level low trigger.
Definition icu.h:81
L4_ICU_OP_MASK
@ L4_ICU_OP_MASK
Mask opcode.
Definition icu.h:139
L4_ICU_OP_SET_MODE
@ L4_ICU_OP_SET_MODE
Set-mode opcode.
Definition icu.h:146
L4_ICU_OP_UNMASK
@ L4_ICU_OP_UNMASK
Unmask opcode.
Definition icu.h:132
L4_ICU_OP_INFO
@ L4_ICU_OP_INFO
Info opcode.
Definition icu.h:118
L4_ICU_OP_MSI_INFO
@ L4_ICU_OP_MSI_INFO
Msi-info opcode.
Definition icu.h:125
L4_ICU_OP_UNBIND
@ L4_ICU_OP_UNBIND
Unbind opcode.
Definition icu.h:111
L4_ICU_OP_BIND
@ L4_ICU_OP_BIND
Bind opcode.
Definition icu.h:104
L4_IPC_NEVER
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:76
l4_utcb_t
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
icu.h
Interrupt controller.
ipc_iface
Interface Definition Language.
L4_RPC_NF_OP
#define L4_RPC_NF_OP(op, res, name, args...)
Define an RPC call type with specific opcode (the type only, no callable).
Definition ipc_iface:525
L4_INLINE_RPC_OP
#define L4_INLINE_RPC_OP(op, res, name, args, attr...)
Define an inline RPC call with specific opcode (type and callable).
Definition ipc_iface:497
ipc_types
irq.h
C Irq interface.
L4
L4 low-level kernel interface.
Definition l4sys-l4f-groups.dox:50
rcv_endpoint
The C++ Receive endpoint interface.
L4::Ipc::Send_only
RPC attribute for a send-only RPC.
Definition ipc_iface:288
L4::Triggerable
Interface that allows an object to be triggered by some source.
Definition irq:80
L4::Triggerable::trigger
l4_msgtag_t trigger(l4_utcb_t *utcb=l4_utcb()) noexcept
Trigger the object.
Definition irq:91
L4::Typeid::Rpcs_sys
List of RPCs typically used for kernel interfaces.
Definition __typeinfo.h:465
l4_icu_info_t
Info structure for an ICU.
Definition icu.h:164
l4_icu_info_t::features
unsigned features
Feature flags.
Definition icu.h:170
l4_icu_msi_info_t
Info to use for a specific MSI.
Definition icu.h:185
l4_msgtag_t
Message tag data structure.
Definition types.h:154
l4_timeout_t
Timeout pair.
Definition __timeout.h:53