Rev 42 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
42 | pj | 1 | /* Project: OSLib |
2 | * Description: The OS Construction Kit |
||
3 | * Date: 1.6.2000 |
||
4 | * Idea by: Luca Abeni & Gerardo Lamastra |
||
5 | * |
||
6 | * OSLib is an SO project aimed at developing a common, easy-to-use |
||
7 | * low-level infrastructure for developing OS kernels and Embedded |
||
8 | * Applications; it partially derives from the HARTIK project but it |
||
9 | * currently is independently developed. |
||
10 | * |
||
11 | * OSLib is distributed under GPL License, and some of its code has |
||
12 | * been derived from the Linux kernel source; also some important |
||
13 | * ideas come from studying the DJGPP go32 extender. |
||
14 | * |
||
15 | * We acknowledge the Linux Community, Free Software Foundation, |
||
16 | * D.J. Delorie and all the other developers who believe in the |
||
17 | * freedom of software and ideas. |
||
18 | * |
||
19 | * For legalese, check out the included GPL license. |
||
20 | */ |
||
21 | |||
22 | /* The Programmable Interrupt Controller management code */ |
||
23 | |||
24 | #ifndef __PIC_H__ |
||
25 | #define __PIC_H__ |
||
26 | |||
27 | #include <ll/i386/defs.h> |
||
28 | BEGIN_DEF |
||
29 | |||
30 | #include <ll/i386/hw-data.h> |
||
31 | #include <ll/i386/hw-instr.h> |
||
32 | #include <ll/i386/hw-func.h> |
||
33 | |||
34 | #define PIC1_BASE 0x040 /* Interrupt base for each PIC */ |
||
35 | #define PIC2_BASE 0x070 |
||
36 | |||
37 | void PIC_init(void); |
||
38 | void PIC_end(void); |
||
39 | void irq_mask(WORD irqno); |
||
40 | void irq_unmask(WORD irqno); |
||
41 | |||
42 | INLINE_OP void l1_exc_bind(int i, void (*f)(int n)) |
||
43 | { |
||
44 | l1_int_bind(i, f); |
||
45 | } |
||
46 | |||
47 | INLINE_OP int l1_irq_bind(int irq, void *f) |
||
48 | { |
||
49 | int i; |
||
50 | |||
51 | if (irq < 8) { |
||
52 | i = irq + PIC1_BASE; |
||
53 | } else if (irq < 15) { |
||
54 | i = irq + PIC2_BASE; |
||
55 | } else { |
||
56 | return -1; |
||
57 | } |
||
58 | |||
59 | l1_int_bind(i, f); |
||
60 | return 1; |
||
61 | } |
||
62 | |||
63 | END_DEF |
||
64 | #endif /* __PIC_H__ */ |