-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterrupt_handlers.c
54 lines (46 loc) · 1.19 KB
/
interrupt_handlers.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
52
53
54
/*
* File: interrupt_handlers.c
* ---------------------------
* Interrupt handlers.
*/
#include "gpio.h"
#include "gprof.h"
#include "mouse.h"
#include "timer.h"
#include "printf.h"
#include "armtimer.h"
#include "keyboard.h"
#include "register.h"
#include "threading.h"
#include "gpioevent.h"
extern void keyboard_vector();
extern void mouse_vector();
extern thread_manager_t* manager;
extern unsigned interrupt_pc;
static unsigned last_time = 0;
unsigned context_switch_count = 0;
/*
* Function: interrupt_vector
* --------------------------
* Manages interrupt vectors.
*/
void interrupt_vector (unsigned pc) {
interrupt_pc = pc;
system_disable_interrupts();
if (armtimer_has_interrupt()) {
context_switch_count ++;
armtimer_clear_interrupt();
} else if (gpio_check_and_clear_event(21)) {
printf("Manual GPIO yield\n");
delay(1);
last_time = timer_get_time();
} else {
printf("Undefined interrupt\n");
}
}
void reset_vector(int pc) {}
void fast_interrupt_vector(int pc) {}
void undefined_instruction_vector(int pc) {}
void software_interrupt_vector(int pc) {}
void prefetch_abort_vector(int pc) {}
void data_abort_vector(int pc) {}