-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasm_handle.h
142 lines (120 loc) · 2.72 KB
/
asm_handle.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef _ASM
#define _ASM
#include "timer.h"
#include "keyboard.h"
#include "rtc.h"
//#include "lib.h"
//#include "term_driver.h"
#define TIMER_IRQ 0x00
#define KEYBOARD_IRQ 0x01
#define CASCADE_IRQ 0x02
#define IRQ3 0x03
#define SERIAL_IRQ 0x04
#define IRQ5 0x05
#define IRQ6 0x06
#define IRQ7 0x07
#define RTC_IRQ 0x08
#define IRQ9 0x09
#define IRQ10 0x0A
#define ETH0_IRQ 0x0B
#define MOUSE_IRQ 0x0C
#define IDE0_IRQ 0x0D
#define IRQ14 0x0E
//define interrupt handlers
void default_hndl_asm(void);
void hndl_timer(void);
void hndl_keyboard(void);
void hndl_cascade(void);
void hndl_irq3(void);
void hndl_serial(void);
void hndl_irq5(void);
void hndl_irq6(void);
void hndl_irq7(void);
void hndl_rtc(void);
void hndl_irq9(void);
void hndl_irq10(void);
void hndl_eth0(void);
void hndl_mouse(void);
void hndl_ide0(void);
void hndl_irq14(void);
extern int32_t term_switch;
/* These functions are called by the interrupt handlers. */
/* used for unknown interrupts */
void default_handler()
{
printf("Got some kind of interrupt\n");
}
/* takes care of timer chip interrupts */
void handler_timer(void){
//printf("Timer Chip Interrupt\n");
handle_tick();
send_eoi(TIMER_IRQ);
}
/* takes care of keyboard events (ie. key presses) */
void handler_keyboard(void){
handle_press();
send_eoi(KEYBOARD_IRQ);
}
/* takes care of PIC cascade events */
void handler_cascade(void)
{
printf("Cascade Interrupt\n");
send_eoi(CASCADE_IRQ);
}
void handler_irq3(void)
{
printf("irq3 interrupt\n");
send_eoi(IRQ3);
}
/* takes care of serial port events */
void handler_serial(void)
{
printf("serial port interrupt\n");
send_eoi(SERIAL_IRQ);
}
void handler_irq5(void){
printf("irq5 interrupt\n");
send_eoi(IRQ5);
}
void handler_irq6(void){
printf("irq6 interrupt\n");
send_eoi(IRQ6);
}
void handler_irq7(void){
printf("irq7 interrupt\n");
send_eoi(IRQ7);
}
/* takes care of periodic interrupts from the real time clock */
void handler_rtc(void){
//printf("RTC INT");
handle_rtc();
send_eoi(RTC_IRQ);
}
void handler_irq9(void){
printf("irq9 interrupt\n");
send_eoi(IRQ9);
}
void handler_irq10(void){
printf("irq10 interrupt\n");
send_eoi(IRQ10);
}
/* takes care of network events */
void handler_eth0(void){
printf("eth0 interrupt\n");
send_eoi(ETH0_IRQ);
}
/* takes care of events from the PS/2 mouse */
void handler_mouse(void){
printf("PS/2 mouse interrupt\n");
send_eoi(MOUSE_IRQ);
}
/* takes care of events from the hard drive */
void handler_ide0(void){
printf("ide0 interrupt\n");
send_eoi(IDE0_IRQ);
}
void handler_irq14(void){
printf("irq14 interrupt\n");
send_eoi(IRQ14);
}
#endif