Loading...
Searching...
No Matches
semaphore.h
Go to the documentation of this file.
/*
* (c) 2015 Alexander Warg <alexander.warg@kernkonzept.com>
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/sys/irq.h>
enum L4_semaphore_op
{
L4_SEMAPHORE_OP_DOWN = 0,
// semaphore up is IRQ_OP_TRIGGER with IRQ/Triggerable protocol
};
L4_INLINE l4_msgtag_t
l4_semaphore_up(l4_cap_idx_t sem) L4_NOTHROW
{
return l4_irq_trigger(sem);
}
L4_INLINE l4_msgtag_t
l4_semaphore_up_u(l4_cap_idx_t sem, l4_utcb_t *utcb) L4_NOTHROW
{
return l4_irq_trigger_u(sem, utcb);
}
L4_INLINE l4_msgtag_t
l4_semaphore_down(l4_cap_idx_t sem, l4_timeout_t timeout) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_semaphore_down_u(l4_cap_idx_t sem, l4_timeout_t to,
l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_semaphore_down_u(l4_cap_idx_t sem, l4_timeout_t to,
l4_utcb_t *utcb) L4_NOTHROW
{
l4_msg_regs_t *m = l4_utcb_mr_u(utcb);
m->mr[0] = L4_SEMAPHORE_OP_DOWN;
return l4_ipc_call(sem, utcb, l4_msgtag(L4_PROTO_SEMAPHORE, 1, 0, 0), to);
}
L4_INLINE l4_msgtag_t
l4_semaphore_down(l4_cap_idx_t sem, l4_timeout_t to) L4_NOTHROW
{
return l4_semaphore_down_u(sem, to, l4_utcb());
}
l4_cap_idx_t
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
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_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_trigger
l4_msgtag_t l4_irq_trigger(l4_cap_idx_t irq) L4_NOTHROW
Trigger an IRQ.
Definition irq.h:307
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_SEMAPHORE
@ L4_PROTO_SEMAPHORE
Protocol for semaphore objects.
Definition types.h:62
l4_semaphore_up
l4_msgtag_t l4_semaphore_up(l4_cap_idx_t sem) L4_NOTHROW
Semaphore up operation (wrapper for trigger()).
Definition semaphore.h:45
l4_semaphore_down
l4_msgtag_t l4_semaphore_down(l4_cap_idx_t sem, l4_timeout_t timeout) L4_NOTHROW
Semaphore down operation.
Definition semaphore.h:100
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
irq.h
C Irq interface.
l4_msgtag_t
Message tag data structure.
Definition types.h:154
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