-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterrupt.c
51 lines (41 loc) · 1.03 KB
/
interrupt.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
interrupt.c
Copyright (c) 2013-2021 Akihisa ONODA
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
*/
#include <defines.h>
#include <itron.h>
#include <kernel.h>
#include <interrupt.h>
#include <task.h>
#include <service_call.h>
#include <lib.h>
#define SystemControlSpace 0xE000E000
#define NVIC_ISER (SystemControlSpace + 0x0100)
#define NVIC_ICER (SystemControlSpace + 0x0180)
#define NVIC_ICPR (SystemControlSpace + 0x0280)
FP interrupt_handlers[TMAX_INHNO];
void
interrupt_init(void)
{
/* 全ての割り込みを禁止 */
//*(volatile uint32_t *)NVIC_ICER = ~0;
/* 全ての割り込み要因をクリア */
//*(volatile uint32_t *)NVIC_ICPR = ~0;
memset(interrupt_handlers, 0, sizeof(FP) * TMAX_INHNO);
}
void
interrupt_handler_execute(INHNO inhno)
{
if (interrupt_handlers[inhno]) {
interrupt_handlers[inhno]();
}
task_reschedule();
}
void
interrupt_disable(INHNO inhno)
{
inhno -= (inhno + 16);
*(volatile unsigned long *)NVIC_ICER = 1 << (inhno & 0x1f);
}