Loading...
Searching...
No Matches
irq.h
Go to the documentation of this file.
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>,
* Björn Döbel <doebel@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/kernel_object.h>
#include <l4/sys/ipc.h>
#include <l4/sys/rcv_endpoint.h>
L4_INLINE l4_msgtag_t
l4_irq_detach(l4_cap_idx_t irq) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_detach_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_bind_vcpu(l4_cap_idx_t irq, l4_cap_idx_t thread,
l4_umword_t cfg) L4_NOTHROW;
L4_INLINE 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;
L4_INLINE l4_msgtag_t
l4_irq_trigger(l4_cap_idx_t irq) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_trigger_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_receive(l4_cap_idx_t irq, l4_timeout_t to) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_receive_u(l4_cap_idx_t irq, l4_timeout_t timeout, l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_wait(l4_cap_idx_t irq, l4_umword_t *label,
l4_timeout_t to) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_wait_u(l4_cap_idx_t irq, l4_umword_t *label,
l4_timeout_t timeout, l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_unmask(l4_cap_idx_t irq) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_irq_unmask_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW;
enum L4_irq_sender_op
{
L4_IRQ_SENDER_OP_RESERVED1 = 0, // Ex ATTACH
L4_IRQ_SENDER_OP_DETACH = 1,
L4_IRQ_SENDER_OP_BIND_VCPU = 2,
};
enum L4_irq_op
{
L4_IRQ_OP_TRIGGER = 2,
L4_IRQ_OP_EOI = 4
};
/**************************************************************************
* Implementations
*/
L4_INLINE l4_msgtag_t
l4_irq_detach_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
{
l4_utcb_mr_u(utcb)->mr[0] = L4_IRQ_SENDER_OP_DETACH;
return l4_ipc_call(irq, utcb, l4_msgtag(L4_PROTO_IRQ_SENDER, 1, 0, 0),
L4_IPC_NEVER);
}
L4_INLINE 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
{
l4_msg_regs_t *m = l4_utcb_mr_u(utcb);
m->mr[0] = L4_IRQ_SENDER_OP_BIND_VCPU;
m->mr[1] = cfg;
m->mr[2] = l4_map_obj_control(0, 0);
m->mr[3] = l4_obj_fpage(thread, 0, L4_CAP_FPAGE_RWS).raw;
return l4_ipc_call(irq, utcb, l4_msgtag(L4_PROTO_IRQ_SENDER, 2, 1, 0),
L4_IPC_NEVER);
}
L4_INLINE l4_msgtag_t
l4_irq_trigger_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
{
return l4_ipc_send(irq, utcb, l4_msgtag(L4_PROTO_IRQ, 0, 0, 0),
L4_IPC_BOTH_TIMEOUT_0);
}
L4_INLINE l4_msgtag_t
l4_irq_receive_u(l4_cap_idx_t irq, l4_timeout_t to, l4_utcb_t *utcb) L4_NOTHROW
{
l4_utcb_mr_u(utcb)->mr[0] = L4_IRQ_OP_EOI;
return l4_ipc_call(irq, utcb, l4_msgtag(L4_PROTO_IRQ, 1, 0, 0), to);
}
L4_INLINE l4_msgtag_t
l4_irq_wait_u(l4_cap_idx_t irq, l4_umword_t *label,
l4_timeout_t to, l4_utcb_t *utcb) L4_NOTHROW
{
l4_utcb_mr_u(utcb)->mr[0] = L4_IRQ_OP_EOI;
return l4_ipc_send_and_wait(irq, utcb, l4_msgtag(L4_PROTO_IRQ, 1, 0, 0),
label, to);
}
L4_INLINE l4_msgtag_t
l4_irq_unmask_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
{
l4_utcb_mr_u(utcb)->mr[0] = L4_IRQ_OP_EOI;
return l4_ipc_send(irq, utcb, l4_msgtag(L4_PROTO_IRQ, 1, 0, 0), L4_IPC_NEVER);
}
L4_INLINE l4_msgtag_t
l4_irq_detach(l4_cap_idx_t irq) L4_NOTHROW
{
return l4_irq_detach_u(irq, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_irq_bind_vcpu(l4_cap_idx_t irq, l4_cap_idx_t thread,
l4_umword_t cfg) L4_NOTHROW
{
return l4_irq_bind_vcpu_u(irq, thread, cfg, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_irq_trigger(l4_cap_idx_t irq) L4_NOTHROW
{
return l4_irq_trigger_u(irq, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_irq_receive(l4_cap_idx_t irq, l4_timeout_t to) L4_NOTHROW
{
return l4_irq_receive_u(irq, to, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_irq_wait(l4_cap_idx_t irq, l4_umword_t *label,
l4_timeout_t to) L4_NOTHROW
{
return l4_irq_wait_u(irq, label, to, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_irq_unmask(l4_cap_idx_t irq) L4_NOTHROW
{
return l4_irq_unmask_u(irq, l4_utcb());
}
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
l4_cap_idx_t
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
l4_obj_fpage
l4_fpage_t l4_obj_fpage(l4_cap_idx_t obj, unsigned int order, unsigned char rights) L4_NOTHROW
Create a kernel-object flexpage.
Definition __l4_fpage.h:715
L4_CAP_FPAGE_RWS
@ L4_CAP_FPAGE_RWS
Read, interface specific 'W', and 'S' rights for capability flexpages.
Definition __l4_fpage.h:206
l4_ipc_send_and_wait
l4_msgtag_t l4_ipc_send_and_wait(l4_cap_idx_t dest, l4_utcb_t *utcb, l4_msgtag_t tag, l4_umword_t *label, l4_timeout_t timeout) L4_NOTHROW
Send a message and do an open wait.
Definition ipc.h:579
l4_ipc_send
l4_msgtag_t l4_ipc_send(l4_cap_idx_t dest, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Send a message to an object (do not wait for a reply).
Definition ipc.h:586
l4_ipc_call
l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Object call (usual invocation).
Definition ipc.h:565
l4_irq_wait_u
l4_msgtag_t l4_irq_wait_u(l4_cap_idx_t irq, l4_umword_t *label, l4_timeout_t timeout, l4_utcb_t *utcb) L4_NOTHROW
Unmask IRQ and (open) wait for any message.
Definition irq.h:277
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_detach
l4_msgtag_t l4_irq_detach(l4_cap_idx_t irq) L4_NOTHROW
Detach from an interrupt source.
Definition irq.h:294
l4_irq_unmask_u
l4_msgtag_t l4_irq_unmask_u(l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
Unmask this IRQ.
Definition irq.h:286
l4_irq_unmask
l4_msgtag_t l4_irq_unmask(l4_cap_idx_t irq) L4_NOTHROW
Unmask IRQ.
Definition irq.h:326
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_receive
l4_msgtag_t l4_irq_receive(l4_cap_idx_t irq, l4_timeout_t to) L4_NOTHROW
Unmask and wait for specified IRQ.
Definition irq.h:313
l4_irq_wait
l4_msgtag_t l4_irq_wait(l4_cap_idx_t irq, l4_umword_t *label, l4_timeout_t to) L4_NOTHROW
Unmask IRQ and wait for any message.
Definition irq.h:319
l4_irq_bind_vcpu
l4_msgtag_t l4_irq_bind_vcpu(l4_cap_idx_t irq, l4_cap_idx_t thread, l4_umword_t cfg) L4_NOTHROW
Bind a thread to this Irq for vCPU interrupt forwarding.
Definition irq.h:300
l4_irq_trigger
l4_msgtag_t l4_irq_trigger(l4_cap_idx_t irq) L4_NOTHROW
Trigger an IRQ.
Definition irq.h:307
l4_map_obj_control
l4_umword_t l4_map_obj_control(l4_umword_t spot, unsigned grant) L4_NOTHROW
Create the first word for a map item that is a send item for the object space.
Definition __l4_fpage.h:749
l4_msgtag
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition types.h:405
L4_PROTO_IRQ
@ L4_PROTO_IRQ
IRQ message.
Definition types.h:44
L4_PROTO_IRQ_SENDER
@ L4_PROTO_IRQ_SENDER
Protocol for IRQ senders (IRQ -> IPC).
Definition types.h:60
L4_IPC_BOTH_TIMEOUT_0
#define L4_IPC_BOTH_TIMEOUT_0
0 receive and send timeout
Definition __timeout.h:79
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
L4_NOTHROW
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
kernel_object.h
Kernel object system calls.
ipc.h
Common IPC interface.
rcv_endpoint.h
Receive endpoint C interface.
l4_msgtag_t
Message tag data structure.
Definition types.h:154
l4_fpage_t::raw
l4_umword_t raw
Raw value.
Definition __l4_fpage.h:78
l4_msg_regs_t
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:68
l4_msg_regs_t::mr
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69
l4_timeout_t
Timeout pair.
Definition __timeout.h:53