Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Architecture-specific IRQ APIs

Macros

#define ARCH_IRQ_CONNECT(irq, pri, isr, arg, flags)
 Arch-specific hook for statically connecting an interrupt.
#define ARCH_PCIE_IRQ_CONNECT(bdf, irq, pri, isr, arg, flags)
 Arch-specific hook for connecting a PCIe endpoint interrupt.
#define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p)
 Arch-specific hook for statically connecting a direct interrupt.
#define ARCH_ISR_DIRECT_PM()
 Arch-specific hook for power management in a direct ISR.
#define ARCH_ISR_DIRECT_HEADER()
 Arch-specific bookkeeping on direct interrupt entry.
#define ARCH_ISR_DIRECT_FOOTER(swap)
 Arch-specific bookkeeping on direct interrupt exit.
#define ARCH_ISR_DIRECT_DECLARE(name)
 Arch-specific hook for declaring a direct interrupt service routine.
#define ARCH_EXCEPT(reason_p)
 Generate a software induced fatal error.

Functions

static _Bool arch_is_in_isr (void)
 Test if the current context is in interrupt context.
static unsigned int arch_irq_lock (void)
 Lock interrupts on the current CPU.
static void arch_irq_unlock (unsigned int key)
 Unlock interrupts on the current CPU.
static bool arch_irq_unlocked (unsigned int key)
 Test if calling arch_irq_unlock() with this key would unlock irqs.
static bool arch_cpu_irqs_are_enabled (void)
 Probe the current CPU overall interrupt controller lock state without modifying it.
void arch_irq_disable (unsigned int irq)
 Disable the specified interrupt line.
void arch_irq_enable (unsigned int irq)
 Enable the specified interrupt line.
int arch_irq_is_enabled (unsigned int irq)
 Test if an interrupt line is enabled.
int arch_irq_connect_dynamic (unsigned int irq, unsigned int priority, void(*routine)(const void *parameter), const void *parameter, uint32_t flags)
 Arch-specific hook to install a dynamic interrupt.
int arch_irq_disconnect_dynamic (unsigned int irq, unsigned int priority, void(*routine)(const void *parameter), const void *parameter, uint32_t flags)
 Arch-specific hook to dynamically uninstall a shared interrupt.
unsigned int arch_irq_allocate (void)
 Arch-specific hook for allocating IRQs.
void arch_irq_set_used (unsigned int irq)
 Arch-specific hook for declaring an IRQ being used.
bool arch_irq_is_used (unsigned int irq)
 Arch-specific hook for checking if an IRQ is being used already.

Detailed Description

Macro Definition Documentation

◆ ARCH_EXCEPT

#define ARCH_EXCEPT ( reason_p)

#include <arch_interface.h>

Generate a software induced fatal error.

If the caller is running in user mode, only K_ERR_KERNEL_OOPS or K_ERR_STACK_CHK_FAIL may be induced.

This should ideally generate a software trap, with exception context indicating state when this was invoked. General purpose register state at the time of trap should not be disturbed from the calling context.

Parameters
reason_pK_ERR_ scoped reason code for the fatal error.

◆ ARCH_IRQ_CONNECT

#define ARCH_IRQ_CONNECT ( irq,
pri,
isr,
arg,
flags )

#include <arch_interface.h>

Arch-specific hook for statically connecting an interrupt.

Statically populate the interrupt tables at build time such that isr is invoked with arg as its argument when interrupt irq fires, with interrupt priority pri and architecture-specific configuration flags. All arguments must be usable in a constant expression context.

Parameters
irqInterrupt line number
priInterrupt priority
isrInterrupt service routine
argArgument passed to the ISR
flagsArch-specific IRQ configuration flags
See also
IRQ_CONNECT()

◆ ARCH_IRQ_DIRECT_CONNECT

#define ARCH_IRQ_DIRECT_CONNECT ( irq_p,
priority_p,
isr_p,
flags_p )

#include <arch_interface.h>

Arch-specific hook for statically connecting a direct interrupt.

As for ARCH_IRQ_CONNECT(), but for an ISR declared with ARCH_ISR_DIRECT_DECLARE() that is installed to bypass the common software ISR dispatch for minimum latency. Direct ISRs take no argument.

Parameters
irq_pInterrupt line number
priority_pInterrupt priority
isr_pDirect interrupt service routine
flags_pArch-specific IRQ configuration flags
See also
IRQ_DIRECT_CONNECT()

◆ ARCH_ISR_DIRECT_DECLARE

#define ARCH_ISR_DIRECT_DECLARE ( name)

#include <arch_interface.h>

Arch-specific hook for declaring a direct interrupt service routine.

Declare a function name suitable for installation with ARCH_IRQ_DIRECT_CONNECT(), wrapping the function body that follows such that ARCH_ISR_DIRECT_HEADER() and ARCH_ISR_DIRECT_FOOTER() run around it and any architecture-specific ISR prologue/epilogue (such as interrupt attributes) is applied. The wrapped body returns non-zero if a context switch may be performed on interrupt exit.

Parameters
nameName of the direct interrupt service routine to declare
See also
ISR_DIRECT_DECLARE()

◆ ARCH_ISR_DIRECT_FOOTER

#define ARCH_ISR_DIRECT_FOOTER ( swap)

#include <arch_interface.h>

Arch-specific bookkeeping on direct interrupt exit.

Counterpart to ARCH_ISR_DIRECT_HEADER(): undo the interrupt-entry bookkeeping and, if swap is non-zero, check whether a context switch is needed on interrupt exit and arrange for it. Invoked at the end of every direct ISR through ISR_DIRECT_FOOTER().

Parameters
swapNon-zero if a context switch may be performed on exit
See also
ISR_DIRECT_FOOTER()

◆ ARCH_ISR_DIRECT_HEADER

#define ARCH_ISR_DIRECT_HEADER ( )

#include <arch_interface.h>

Arch-specific bookkeeping on direct interrupt entry.

Perform the interrupt-entry bookkeeping that the common interrupt dispatch path would otherwise do, such as tracking interrupt nesting and emitting tracing events. Invoked at the top of every direct ISR through ISR_DIRECT_HEADER().

See also
ISR_DIRECT_HEADER()

◆ ARCH_ISR_DIRECT_PM

#define ARCH_ISR_DIRECT_PM ( )

#include <arch_interface.h>

Arch-specific hook for power management in a direct ISR.

Perform the power management bookkeeping that the common interrupt dispatch path would otherwise do (such as exiting a low-power idle state). Direct ISRs that may interrupt the idle loop invoke this through ISR_DIRECT_PM().

See also
ISR_DIRECT_PM()

◆ ARCH_PCIE_IRQ_CONNECT

#define ARCH_PCIE_IRQ_CONNECT ( bdf,
irq,
pri,
isr,
arg,
flags )

#include <arch_interface.h>

Arch-specific hook for connecting a PCIe endpoint interrupt.

As for ARCH_IRQ_CONNECT(), but for an interrupt belonging to the PCIe endpoint identified by bdf, so the architecture may resolve the final interrupt vector from the endpoint at build or run time.

Parameters
bdfPCIe endpoint bus/device/function identifier
irqInterrupt line number
priInterrupt priority
isrInterrupt service routine
argArgument passed to the ISR
flagsArch-specific IRQ configuration flags
See also
PCIE_IRQ_CONNECT()

Function Documentation

◆ arch_cpu_irqs_are_enabled()

bool arch_cpu_irqs_are_enabled ( void )
inlinestatic

#include <arch_interface.h>

Probe the current CPU overall interrupt controller lock state without modifying it.

Unlike arch_irq_unlocked() which inspects a saved key, this reports the instantaneous state of the calling CPU's overall interrupt enable.

Returns
true if interrupts are currently enabled on the calling CPU.

◆ arch_irq_allocate()

unsigned int arch_irq_allocate ( void )

#include <arch_interface.h>

Arch-specific hook for allocating IRQs.

Note: disable/enable IRQ relevantly inside the implementation of such function to avoid concurrency issues. Also, an allocated IRQ is assumed to be used thus a following

See also
arch_irq_is_used() should return true.

This API is only used when no PCIe controller driver is enabled (

CONFIG_PCIE_CONTROLLER 

); with a controller driver, IRQ allocation is handled by the controller instead.

Returns
The newly allocated IRQ or UINT_MAX on error.

◆ arch_irq_connect_dynamic()

int arch_irq_connect_dynamic ( unsigned int irq,
unsigned int priority,
void(* routine )(const void *parameter),
const void * parameter,
uint32_t flags )

#include <arch_interface.h>

Arch-specific hook to install a dynamic interrupt.

Parameters
irqIRQ line number
priorityInterrupt priority
routineInterrupt service routine
parameterISR parameter
flagsArch-specific IRQ configuration flag
Returns
The vector assigned to this interrupt

◆ arch_irq_disable()

void arch_irq_disable ( unsigned int irq)

#include <arch_interface.h>

Disable the specified interrupt line.

Note
: The behavior of interrupts that arrive after this call returns and before the corresponding call to arch_irq_enable() is undefined. The hardware is not required to latch and deliver such an interrupt, though on some architectures that may work. Other architectures will simply lose such an interrupt and never deliver it. Many drivers and subsystems are not tolerant of such dropped interrupts and it is the job of the application layer to ensure that behavior remains correct.
See also
irq_disable()

◆ arch_irq_disconnect_dynamic()

int arch_irq_disconnect_dynamic ( unsigned int irq,
unsigned int priority,
void(* routine )(const void *parameter),
const void * parameter,
uint32_t flags )

#include <arch_interface.h>

Arch-specific hook to dynamically uninstall a shared interrupt.

If the interrupt is not being shared, then the associated _sw_isr_table entry will be replaced by (NULL, z_irq_spurious) (default entry).

Parameters
irqIRQ line number
priorityInterrupt priority
routineInterrupt service routine
parameterISR parameter
flagsArch-specific IRQ configuration flag
Returns
0 in case of success, negative value otherwise

◆ arch_irq_enable()

void arch_irq_enable ( unsigned int irq)

#include <arch_interface.h>

Enable the specified interrupt line.

See also
irq_enable()

◆ arch_irq_is_enabled()

int arch_irq_is_enabled ( unsigned int irq)

#include <arch_interface.h>

Test if an interrupt line is enabled.

See also
irq_is_enabled()

◆ arch_irq_is_used()

bool arch_irq_is_used ( unsigned int irq)

#include <arch_interface.h>

Arch-specific hook for checking if an IRQ is being used already.

Parameters
irqthe IRQ to check
Returns
true if being, false otherwise

◆ arch_irq_lock()

unsigned int arch_irq_lock ( void )
inlinestatic

#include <arch_interface.h>

Lock interrupts on the current CPU.

See also
irq_lock()

◆ arch_irq_set_used()

void arch_irq_set_used ( unsigned int irq)

#include <arch_interface.h>

Arch-specific hook for declaring an IRQ being used.

Note: disable/enable IRQ relevantly inside the implementation of such function to avoid concurrency issues.

Parameters
irqthe IRQ to declare being used

◆ arch_irq_unlock()

void arch_irq_unlock ( unsigned int key)
inlinestatic

#include <arch_interface.h>

Unlock interrupts on the current CPU.

See also
irq_unlock()

◆ arch_irq_unlocked()

bool arch_irq_unlocked ( unsigned int key)
inlinestatic

#include <arch_interface.h>

Test if calling arch_irq_unlock() with this key would unlock irqs.

Parameters
keyvalue returned by arch_irq_lock()
Returns
true if interrupts were unlocked prior to the arch_irq_lock() call that produced the key argument.

◆ arch_is_in_isr()

_Bool arch_is_in_isr ( void )
inlinestatic

#include <kernel_arch_interface.h>

Test if the current context is in interrupt context.

XXX: This is inconsistently handled among arches wrt exception context See: #17656

Returns
true if we are in interrupt context