14#ifndef ZEPHYR_INCLUDE_ARCH_RISCV_IRQ_H_
15#define ZEPHYR_INCLUDE_ARCH_RISCV_IRQ_H_
30#define RISCV_EXC_ECALLU 8
32#define RISCV_EXC_ECALLM 11
37#define RISCV_IRQ_MSOFT 3
39#define RISCV_IRQ_MEXT 11
42#define RISCV_MCAUSE_IRQ_POS 63U
43#define RISCV_MCAUSE_IRQ_BIT BIT64(RISCV_MCAUSE_IRQ_POS)
45#define RISCV_MCAUSE_IRQ_POS 31U
46#define RISCV_MCAUSE_IRQ_BIT BIT(RISCV_MCAUSE_IRQ_POS)
55#if defined(CONFIG_RISCV_HAS_PLIC) || defined(CONFIG_RISCV_HAS_CLIC)
56extern void z_riscv_irq_priority_set(
unsigned int irq,
60#define z_riscv_irq_priority_set(i, p, f)
63#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
65 Z_ISR_DECLARE(irq_p + CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET, \
66 0, isr_p, isr_param_p); \
67 z_riscv_irq_priority_set(irq_p, priority_p, flags_p); \
70#define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
72 Z_ISR_DECLARE_DIRECT(irq_p + CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET, \
73 ISR_FLAG_DIRECT, isr_p); \
74 z_riscv_irq_priority_set(irq_p, priority_p, flags_p); \
77#define ARCH_ISR_DIRECT_HEADER() arch_isr_direct_header()
78#define ARCH_ISR_DIRECT_FOOTER(swap) arch_isr_direct_footer(swap)
80#ifdef CONFIG_TRACING_ISR
87#ifdef CONFIG_TRACING_ISR
94extern void __soc_handle_irq(
unsigned long mcause);
102 __asm__
volatile(
"csrr %0, mcause" :
"=r" (mcause));
103 mcause &= CONFIG_RISCV_MCAUSE_EXCEPTION_MASK;
106 __soc_handle_irq(mcause);
111#ifdef CONFIG_TRACING_ISR
119#define ARCH_ISR_DIRECT_DECLARE(name) \
120 static inline int name##_body(void); \
121 __attribute__ ((interrupt)) void name(void) \
123 ISR_DIRECT_HEADER(); \
125 ISR_DIRECT_FOOTER(0); \
127 static inline int name##_body(void)
static ALWAYS_INLINE _cpu_t * arch_curr_cpu(void)
Definition: arch_inlines.h:17
static void arch_isr_direct_header(void)
Definition: irq.h:91
static void arch_isr_direct_footer(int maybe_swap)
Definition: irq.h:98
#define arch_irq_disable(irq)
Definition: irq.h:107
#define arch_irq_enable(irq)
Definition: irq.h:106
#define arch_irq_is_enabled(irq)
Definition: irq.h:109
void sys_trace_isr_enter(void)
Called when entering an ISR.
void sys_trace_isr_exit(void)
Called when exiting an ISR.
Public interface for configuring interrupts.
flags
Definition: parser.h:96
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
Software-managed ISR table.