1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2021/04/24     Juice      The first version
9  */
10 
11 #include <rthw.h>
12 
13 #include <board.h>
14 
15 typedef void (*irq_handler_t)(void);
16 extern const irq_handler_t isrTable[];
17 
handle_trap(uintptr_t mcause,uintptr_t epc,uintptr_t * sp)18 uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t *sp)
19 {
20     uint32_t intNum;
21     if (mcause & 0x80000000) /* For external interrupt. */
22     {
23     }
24     else
25     {
26         intNum = mcause & 0x1FUL;
27         /* Now call the real irq handler for intNum */
28         if (intNum <= 24)
29         {
30             if (isrTable[intNum])isrTable[intNum]();
31         }
32     }
33 }
34