L4Re - L4 Runtime Environment

C IRQ interface. More...

+ Collaboration diagram for IRQs:

Enumerations

enum  L4_irq_mode {
  L4_IRQ_F_NONE = 0, L4_IRQ_F_LEVEL = 0x2, L4_IRQ_F_EDGE = 0x0, L4_IRQ_F_POS = 0x0,
  L4_IRQ_F_NEG = 0x4, L4_IRQ_F_BOTH = 0x8, L4_IRQ_F_LEVEL_HIGH = 0x3, L4_IRQ_F_LEVEL_LOW = 0x7,
  L4_IRQ_F_POS_EDGE = 0x1, L4_IRQ_F_NEG_EDGE = 0x5, L4_IRQ_F_BOTH_EDGE = 0x9, L4_IRQ_F_MASK = 0xf,
  L4_IRQ_F_SET_WAKEUP = 0x10, L4_IRQ_F_CLEAR_WAKEUP = 0x20
}
 Interrupt attributes. More...
 

Functions

l4_msgtag_t l4_irq_attach (l4_cap_idx_t irq, l4_umword_t label, l4_cap_idx_t thread) L4_NOTHROW
 Attach a thread to an interrupt source. More...
 
l4_msgtag_t l4_irq_attach_u (l4_cap_idx_t irq, l4_umword_t label, l4_cap_idx_t thread, l4_utcb_t *utcb) L4_NOTHROW
 Attach a thread to this interrupt. More...
 
l4_msgtag_t l4_irq_mux_chain (l4_cap_idx_t irq, l4_cap_idx_t slave) L4_NOTHROW
 Chain an IRQ to another master IRQ source. More...
 
l4_msgtag_t l4_irq_mux_chain_u (l4_cap_idx_t irq, l4_cap_idx_t slave, l4_utcb_t *utcb) L4_NOTHROW
 Attach an IRQ to this multiplexer. More...
 
l4_msgtag_t l4_irq_detach (l4_cap_idx_t irq) L4_NOTHROW
 Detach from an interrupt source. More...
 
l4_msgtag_t l4_irq_detach_u (l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
 Detach from this interrupt. More...
 
l4_msgtag_t l4_irq_trigger (l4_cap_idx_t irq) L4_NOTHROW
 Trigger an IRQ. More...
 
l4_msgtag_t l4_irq_trigger_u (l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
 Trigger. More...
 
l4_msgtag_t l4_irq_receive (l4_cap_idx_t irq, l4_timeout_t to) L4_NOTHROW
 Unmask and wait for specified IRQ. More...
 
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. More...
 
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. More...
 
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. More...
 
l4_msgtag_t l4_irq_unmask (l4_cap_idx_t irq) L4_NOTHROW
 Unmask IRQ. More...
 
l4_msgtag_t l4_irq_unmask_u (l4_cap_idx_t irq, l4_utcb_t *utcb) L4_NOTHROW
 Unmask IRQ. More...
 

Detailed Description

C IRQ interface.

The IRQ interface provides access to abstract interrupts provided by the microkernel. Interrupts may be

IRQ objects can be created using a factory, see the Factory API (use l4_factory_create_irq()).

Include File
#include <l4/sys/irq.h>

For the C++ interface refer to the L4::Irq API for an overview.

Enumeration Type Documentation

◆ L4_irq_mode

Interrupt attributes.

Enumerator
L4_IRQ_F_NONE 

Flow types.

None

L4_IRQ_F_LEVEL 

Level triggered.

L4_IRQ_F_EDGE 

Edge triggered.

L4_IRQ_F_POS 

Positive trigger.

L4_IRQ_F_NEG 

Negative trigger.

L4_IRQ_F_BOTH 

Both edges trigger.

L4_IRQ_F_LEVEL_HIGH 

Level high trigger.

L4_IRQ_F_LEVEL_LOW 

Level low trigger.

L4_IRQ_F_POS_EDGE 

Positive edge trigger.

L4_IRQ_F_NEG_EDGE 

Negative edge trigger.

L4_IRQ_F_BOTH_EDGE 

Both edges trigger.

L4_IRQ_F_MASK 

Mask.

L4_IRQ_F_SET_WAKEUP 

Wakeup source?

Use irq as wakeup source

L4_IRQ_F_CLEAR_WAKEUP 

Do not use irq as wakeup source.

Definition at line 67 of file icu.h.

Function Documentation

◆ l4_irq_attach()

l4_msgtag_t l4_irq_attach ( l4_cap_idx_t  irq,
l4_umword_t  label,
l4_cap_idx_t  thread 
)
inline

Attach a thread to an interrupt source.

Parameters
irqIRQ object where thread is attached to.
labelIdentifier of the IRQ.
threadThe thread object to attach irq to.
Returns
Syscall return tag

The protected label is stored in the kernel and sent to the attached thread with the IRQ-triggered notification. It allows the receiver thread to securely identify the IRQ.

Definition at line 331 of file irq.h.

References l4_irq_attach_u(), and l4_utcb().

+ Here is the call graph for this function:

◆ l4_irq_attach_u()

l4_msgtag_t l4_irq_attach_u ( l4_cap_idx_t  irq,
l4_umword_t  label,
l4_cap_idx_t  thread,
l4_utcb_t utcb 
)
inline

Attach a thread to this interrupt.

Parameters
irqIRQ object where thread is attached to.
labelIdentifier of the IRQ (protected label used for messages)
threadCapability of the thread to attach the IRQ to.
utcbUTCB to be used for this operation, usually the UTCB of the calling thread.
Returns
Syscall return tag

The protected label is stored in the kernel and sent to the attached thread with the IRQ-triggered notification. It allows the receiver thread to securely identify the IRQ.

Deprecated:
Use bind_thread().

Definition at line 261 of file irq.h.

Referenced by l4_irq_attach().

+ Here is the caller graph for this function:

◆ l4_irq_detach()

l4_msgtag_t l4_irq_detach ( l4_cap_idx_t  irq)
inline

Detach from an interrupt source.

Parameters
irqThe IRQ object that shall be detached.
Returns
Syscall return tag
Examples:
examples/sys/isr/main.c.

Definition at line 347 of file irq.h.

References l4_irq_detach_u(), and l4_utcb().

+ Here is the call graph for this function:

◆ l4_irq_detach_u()

l4_msgtag_t l4_irq_detach_u ( l4_cap_idx_t  irq,
l4_utcb_t utcb 
)
inline

Detach from this interrupt.

Parameters
irqThe IRQ object that shall be detached.
utcbUTCB to be used for this operation, usually the UTCB of the calling thread.
Returns
Syscall return tag

Definition at line 292 of file irq.h.

Referenced by l4_irq_detach().

+ Here is the caller graph for this function:

◆ l4_irq_mux_chain()

l4_msgtag_t l4_irq_mux_chain ( l4_cap_idx_t  irq,
l4_cap_idx_t  slave 
)
inline

Chain an IRQ to another master IRQ source.

Parameters
irqThe master IRQ object.
slaveThe slave that shall be attached to the master.
Returns
Syscall return tag

The chaining feature of IRQ objects allows to deal with shared IRQs. For chaining IRQs there must be a master IRQ object, bound to the real IRQ source. Note, the master IRQ must not have a thread attached to it.

This function allows to add a limited number of slave IRQs to this master IRQ, with the semantics that each of the slave IRQs is triggered whenever the master IRQ is triggered. The master IRQ will be masked automatically when an IRQ is delivered and shall be unmasked when all attached slave IRQs are unmasked.

Definition at line 341 of file irq.h.

References l4_irq_mux_chain_u(), and l4_utcb().

+ Here is the call graph for this function:

◆ l4_irq_mux_chain_u()

l4_msgtag_t l4_irq_mux_chain_u ( l4_cap_idx_t  irq,
l4_cap_idx_t  slave,
l4_utcb_t utcb 
)
inline

Attach an IRQ to this multiplexer.

Parameters
irqThe master IRQ object.
slaveThe slave that shall be attached to the master.
utcbUTCB to be used for this operation, usually the UTCB of the calling thread.
Returns
Syscall return tag

The chaining feature of IRQ objects allows to deal with shared IRQs. For chaining IRQs there must be an IRQ multiplexer (Irq_mux) bound to the real IRQ source. This function allows to add slave IRQs to this multiplexer.

Definition at line 280 of file irq.h.

Referenced by l4_irq_mux_chain().

+ Here is the caller graph for this function:

◆ l4_irq_receive()

l4_msgtag_t l4_irq_receive ( l4_cap_idx_t  irq,
l4_timeout_t  to 
)
inline

Unmask and wait for specified IRQ.

Parameters
irqThe IRQ object that shall be unmasked.
toTimeout.
Returns
Syscall return tag
Examples:
examples/sys/isr/main.c.

Definition at line 359 of file irq.h.

References l4_irq_receive_u(), and l4_utcb().

+ Here is the call graph for this function:

◆ l4_irq_receive_u()

l4_msgtag_t l4_irq_receive_u ( l4_cap_idx_t  irq,
l4_timeout_t  timeout,
l4_utcb_t utcb 
)
inline

Unmask and wait for this IRQ.

Parameters
irqThe IRQ object that shall be unmasked.
timeoutTimeout.
utcbUTCB to be used for this operation, usually the UTCB of the calling thread.
Returns
Syscall return tag
Note
If this is the function normally used for your IRQs consider using L4::Semaphore instead of L4::Irq.

Definition at line 307 of file irq.h.

Referenced by l4_irq_receive().

+ Here is the caller graph for this function:

◆ l4_irq_trigger()

l4_msgtag_t l4_irq_trigger ( l4_cap_idx_t  irq)
inline

Trigger an IRQ.

Parameters
irqThe IRQ object that shall be triggered.
Returns
Syscall return tag.

Note that this function is a send only operation, i.e. there is no return value except for a failed send operation. Especially l4_error() will return an error value from the message tag which still contains the IRQ protocol used for the send operation.

Use l4_ipc_error() to check for (send) errors.

Definition at line 353 of file irq.h.

References l4_irq_trigger_u(), and l4_utcb().

+ Here is the call graph for this function:

◆ l4_irq_trigger_u()

l4_msgtag_t l4_irq_trigger_u ( l4_cap_idx_t  irq,
l4_utcb_t utcb 
)
inline

Trigger.

Parameters
irqThe IRQ object that shall be triggered.
utcbUTCB to be used for this operation, usually the UTCB of the calling thread.
Returns
Syscall return tag for a send-only operation, use l4_ipc_error() to check for errors (do not use l4_error()).
Note
This function is a send-only operation, this means there is no return value except for a failed send operation. Use l4_ipc_error() to check for errors, do not use l4_error(), because l4_error() will always return an error.

Definition at line 300 of file irq.h.

References L4_IPC_BOTH_TIMEOUT_0, l4_ipc_send(), l4_msgtag(), and L4_PROTO_IRQ.

Referenced by l4_irq_trigger().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l4_irq_unmask()

l4_msgtag_t l4_irq_unmask ( l4_cap_idx_t  irq)
inline

Unmask IRQ.

Parameters
irqThe IRQ object that shall be unmasked.
Returns
Syscall return tag
Note
l4_irq_wait() and l4_irq_receive() are doing the unmask themselves.

Definition at line 372 of file irq.h.

References l4_irq_unmask_u(), and l4_utcb().

+ Here is the call graph for this function:

◆ l4_irq_unmask_u()

l4_msgtag_t l4_irq_unmask_u ( l4_cap_idx_t  irq,
l4_utcb_t utcb 
)
inline

Unmask IRQ.

Parameters
irqThe IRQ object that shall be unmasked.
utcbUTCB to be used for this operation, usually the UTCB of the calling thread.
Returns
Syscall return tag for a send-only operation, use l4_ipc_error() to check for errors (do not use l4_error()).
Note
This function is a send-only operation, this means there is no return value except for a failed send operation. Use l4_ipc_error() to check for errors, do not use l4_error(), because l4_error() will always return an error.

Irq::wait() and Irq::receive() operations already include an unmask(), do not use an extra unmask() in these cases.

Deprecated:
Use L4::Irq_eoi::unmask()

Definition at line 323 of file irq.h.

Referenced by l4_irq_unmask().

+ Here is the caller graph for this function:

◆ l4_irq_wait()

l4_msgtag_t l4_irq_wait ( l4_cap_idx_t  irq,
l4_umword_t label,
l4_timeout_t  to 
)
inline

Unmask IRQ and wait for any message.

Parameters
irqThe IRQ object that shall be unmasked.
labelReceive label.
toTimeout.
Returns
Syscall return tag

Definition at line 365 of file irq.h.

References l4_irq_wait_u(), and l4_utcb().

+ Here is the call graph for this function:

◆ 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 
)
inline

Unmask IRQ and (open) wait for any message.

Parameters
irqThe IRQ object that shall be unmasked.
labelThe protected label shall be received here.
timeoutTimeout.
utcbUTCB to be used for this operation, usually the UTCB of the calling thread.
Returns
Syscall return tag

Definition at line 314 of file irq.h.

Referenced by l4_irq_wait().

+ Here is the caller graph for this function: