-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathint.c
57 lines (42 loc) · 927 Bytes
/
int.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
55
56
#include "head.h"
extern struct FIFO8 keyfifo;
extern struct FIFO8 mousefifo;
void init_pic(void)
{
io_out8(PIC0_IMR, 0xff);
io_out8(PIC1_IMR, 0xff);
io_out8(PIC0_ICW1, 0x11);
io_out8(PIC0_ICW2, 0x20);
io_out8(PIC0_ICW3, 1<<2);
io_out8(PIC0_ICW4, 0x01);
io_out8(PIC1_ICW1, 0x11);
io_out8(PIC1_ICW2, 0x28);
io_out8(PIC1_ICW3, 2);
io_out8(PIC1_ICW4, 0x01);
io_out8(PIC0_IMR, 0xfb);
io_out8(PIC1_IMR, 0xff);
// keybuf.next_r = keybuf.next_w = keybuf.len = 0;
return;
}
void inthandler21(int *esp) //process keyboard int
{
unsigned char data;
io_out8(PIC0_OCW2, 0x61);
data=io_in8(PORT_KEYDAT);
fifo8_put(&keyfifo, data);
return;
}
void inthandler2c(int *esp) //process mouse int
{
unsigned char data;
io_out8(PIC1_OCW2, 0x64);
io_out8(PIC0_OCW2, 0x62);
data=io_in8(PORT_KEYDAT);
fifo8_put(&mousefifo, data);
return;
}
void inthandler27(int *esp)
{
io_out8(PIC0_OCW2, 0x67);
return;
}