xref: /nrf52832-nimble/rt-thread/libcpu/risc-v/rv32m1/interrupt.c (revision 104654410c56c573564690304ae786df310c91fc)
1 /*
2  * Copyright (c) 2006-2018, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2018/10/01     Bernard      The first version
9  */
10 
11 #include <rthw.h>
12 
13 #include <board.h>
14 #include <RV32M1_ri5cy.h>
15 
16 typedef void (*irq_handler_t)(void);
17 extern const irq_handler_t isrTable[];
18 
SystemIrqHandler(uint32_t mcause)19 void SystemIrqHandler(uint32_t mcause)
20 {
21     uint32_t intNum;
22 
23     if (mcause & 0x80000000) /* For external interrupt. */
24     {
25         intNum = mcause & 0x1FUL;
26 
27         /* Clear pending flag in EVENT unit .*/
28         EVENT_UNIT->INTPTPENDCLEAR = (1U << intNum);
29 
30         /* Now call the real irq handler for intNum */
31         isrTable[intNum]();
32     }
33 }
34