-
Notifications
You must be signed in to change notification settings - Fork 1
/
picirq.c
51 lines (34 loc) · 893 Bytes
/
picirq.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
#include "picirq.h"
#include "x86.h"
#include "types.h"
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);
static void
picsetmask(ushort mask)
{
irqmask = mask;
outb(IO_PIC1+1, mask);
outb(IO_PIC2+1, mask >> 8);
}
void picenable(int irqport)
{
picsetmask(irqmask & ~(1<<irqport));
}
void picinit(void)
{
outb(IO_PIC1+1, 0xFF);
outb(IO_PIC2+1, 0xFF);
outb(IO_PIC1, 0x11);
outb(IO_PIC1+1, T_IRQ0);
outb(IO_PIC1+1, 1<<IRQ_SLAVE);
outb(IO_PIC1+1, 0x3);
outb(IO_PIC2, 0x11);
outb(IO_PIC2+1, T_IRQ0 + 8);
outb(IO_PIC2+1, IRQ_SLAVE);
outb(IO_PIC2+1, 0x3);
outb(IO_PIC1, 0x68);
outb(IO_PIC1, 0x0a);
outb(IO_PIC2, 0x68);
outb(IO_PIC2, 0x0a);
if(irqmask != 0xFFFF)
picsetmask(irqmask);
}