Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
irq.h File Reference

ARCv2 public interrupt handling. More...

#include <arch/arc/v2/aux_regs.h>
#include <toolchain/common.h>
#include <irq.h>
#include <sys/util.h>
#include <sw_isr_table.h>

Go to the source code of this file.

Macros

#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p)
 
#define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p)
 
#define ARCH_ISR_DIRECT_HEADER()   arch_isr_direct_header()
 
#define ARCH_ISR_DIRECT_FOOTER(swap)   arch_isr_direct_footer(swap)
 
#define ARCH_ISR_DIRECT_DECLARE(name)
 

Functions

void arch_irq_enable (unsigned int irq)
 
void arch_irq_disable (unsigned int irq)
 
int arch_irq_is_enabled (unsigned int irq)
 
static void arch_isr_direct_header (void)
 
static void arch_isr_direct_footer (int maybe_swap)
 
static ALWAYS_INLINE unsigned int arch_irq_lock (void)
 Disable all interrupts on the local CPU. More...
 
static ALWAYS_INLINE void arch_irq_unlock (unsigned int key)
 
static ALWAYS_INLINE bool arch_irq_unlocked (unsigned int key)
 

Detailed Description

ARCv2 public interrupt handling.

ARCv2 kernel interrupt handling interface. Included by arc/arch.h.

Macro Definition Documentation

◆ ARCH_IRQ_CONNECT

#define ARCH_IRQ_CONNECT (   irq_p,
  priority_p,
  isr_p,
  isr_param_p,
  flags_p 
)
Value:
{ \
Z_ISR_DECLARE(irq_p, 0, isr_p, isr_param_p); \
z_irq_priority_set(irq_p, priority_p, flags_p); \
}

◆ ARCH_IRQ_DIRECT_CONNECT

#define ARCH_IRQ_DIRECT_CONNECT (   irq_p,
  priority_p,
  isr_p,
  flags_p 
)
Value:
{ \
Z_ISR_DECLARE(irq_p, ISR_FLAG_DIRECT, isr_p, NULL); \
BUILD_ASSERT(priority_p || !IS_ENABLED(CONFIG_ARC_FIRQ) || \
(IS_ENABLED(CONFIG_ARC_FIRQ_STACK) && \
!IS_ENABLED(CONFIG_ARC_STACK_CHECKING)), \
"irq priority cannot be set to 0 when CONFIG_ARC_FIRQ_STACK" \
"is not configured or CONFIG_ARC_FIRQ_STACK " \
"and CONFIG_ARC_STACK_CHECKING are configured together"); \
z_irq_priority_set(irq_p, priority_p, flags_p); \
}
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition: util_macro.h:101
#define ISR_FLAG_DIRECT
Definition: sw_isr_table.h:59

Configure a 'direct' static interrupt.

When firq has no separate stack(CONFIG_ARC_FIRQ_STACK=N), it's not safe to call C ISR handlers because sp will be switched to bank1's sp which is undefined value. So for this case, the priority cannot be set to 0 but next level 1

When firq has separate stack (CONFIG_ARC_FIRQ_STACK=y) but at the same time stack checking is enabled (CONFIG_ARC_STACK_CHECKING=y) the stack checking can raise stack check exception as sp is switched to firq's stack (bank1's sp). So for this case, the priority cannot be set to 0 but next level 1.

Note that for the above cases, if application still wants to use firq by setting priority to 0. Application can call z_irq_priority_set again. Then it's left to application to handle the details of firq

See include/irq.h for details. All arguments must be computable at build time.

◆ ARCH_ISR_DIRECT_DECLARE

#define ARCH_ISR_DIRECT_DECLARE (   name)
Value:
static inline int name##_body(void); \
__attribute__ ((_ARC_DIRECT_ISR_FUNC_ATTRIBUTE))void name(void) \
{ \
ISR_DIRECT_HEADER(); \
name##_body(); \
ISR_DIRECT_FOOTER(0); \
} \
static inline int name##_body(void)

◆ ARCH_ISR_DIRECT_FOOTER

#define ARCH_ISR_DIRECT_FOOTER (   swap)    arch_isr_direct_footer(swap)

◆ ARCH_ISR_DIRECT_HEADER

#define ARCH_ISR_DIRECT_HEADER ( )    arch_isr_direct_header()

Function Documentation

◆ arch_irq_disable()

void arch_irq_disable ( unsigned int  irq)

◆ arch_irq_enable()

void arch_irq_enable ( unsigned int  irq)

◆ arch_irq_is_enabled()

int arch_irq_is_enabled ( unsigned int  irq)

◆ arch_irq_lock()

static ALWAYS_INLINE unsigned int arch_irq_lock ( void  )
static

Disable all interrupts on the local CPU.

This routine disables interrupts. It can be called from either interrupt or thread level. This routine returns an architecture-dependent lock-out key representing the "interrupt disable state" prior to the call; this key can be passed to irq_unlock() to re-enable interrupts.

The lock-out key should only be used as the argument to the irq_unlock() API. It should never be used to manually re-enable interrupts or to inspect or manipulate the contents of the source register.

This function can be called recursively: it will return a key to return the state of interrupt locking to the previous level.

WARNINGS Invoking a kernel routine with interrupts locked may result in interrupts being re-enabled for an unspecified period of time. If the called routine blocks, interrupts will be re-enabled while another thread executes, or while the system is idle.

The "interrupt disable state" is an attribute of a thread. Thus, if a thread disables interrupts and subsequently invokes a kernel routine that causes the calling thread to block, the interrupt disable state will be restored when the thread is later rescheduled for execution.

Returns
An architecture-dependent lock-out key representing the "interrupt disable state" prior to the call.

◆ arch_irq_unlock()

static ALWAYS_INLINE void arch_irq_unlock ( unsigned int  key)
static

◆ arch_irq_unlocked()

static ALWAYS_INLINE bool arch_irq_unlocked ( unsigned int  key)
static

◆ arch_isr_direct_footer()

static void arch_isr_direct_footer ( int  maybe_swap)
inlinestatic

◆ arch_isr_direct_header()

void arch_isr_direct_header ( void  )
inlinestatic