1 /*
2  * Copyright (c) 2006-2024, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2021-05-20     bigmagic      The first version
9  */
10 
11 #ifndef INTERRUPT_H__
12 #define INTERRUPT_H__
13 
14 #define MAX_HANDLERS 128
15 
16 #include <rthw.h>
17 #include "stack.h"
18 
19 enum
20 {
21     EP_INSTRUCTION_ADDRESS_MISALIGNED = 0,
22     EP_INSTRUCTION_ACCESS_FAULT,
23     EP_ILLEGAL_INSTRUCTION,
24     EP_BREAKPOINT,
25     EP_LOAD_ADDRESS_MISALIGNED,
26     EP_LOAD_ACCESS_FAULT,
27     EP_STORE_ADDRESS_MISALIGNED,
28     EP_STORE_ACCESS_FAULT,
29     EP_ENVIRONMENT_CALL_U_MODE,
30     EP_ENVIRONMENT_CALL_S_MODE,
31     EP_RESERVED10,
32     EP_ENVIRONMENT_CALL_M_MODE,
33     EP_INSTRUCTION_PAGE_FAULT, /* page attr */
34     EP_LOAD_PAGE_FAULT,        /* read data */
35     EP_RESERVED14,
36     EP_STORE_PAGE_FAULT, /* write data */
37 };
38 
39 int rt_hw_plic_irq_enable(int irq_number);
40 int rt_hw_plic_irq_disable(int irq_number);
41 void rt_hw_interrupt_init(void);
42 void rt_hw_interrupt_mask(int vector);
43 rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, void *param, const char *name);
44 void handle_trap(rt_ubase_t xcause, rt_ubase_t xtval, rt_ubase_t xepc, struct rt_hw_stack_frame *sp);
45 
46 #endif
47