-
Notifications
You must be signed in to change notification settings - Fork 2
/
i8259.h
48 lines (39 loc) · 1.22 KB
/
i8259.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
/* i8259.h - Defines used in interactions with the 8259 interrupt
* controller
* vim:ts=4 noexpandtab
*/
#ifndef _I8259_H
#define _I8259_H
#include "types.h"
/* Ports that each PIC sits on */
#define MASTER_8259_PORT 0x20
#define SLAVE_8259_PORT 0xA0
#define MASTER_8259_PORT_DATA (MASTER_8259_PORT+1)
#define SLAVE_8259_PORT_DATA (SLAVE_8259_PORT+1)
#define MS_PIN 2
#define MS_OFFSET 8
#define MASTER_INIT_MASK 0xFB
#define SLAVE_INIT_MASK 0xFF
/* Initialization control words to init each PIC.
* See the Intel manuals for details on the meaning
* of each word */
#define ICW1 0x11
#define ICW2_MASTER 0x20
#define ICW2_SLAVE 0x28
#define ICW3_MASTER 0x04
#define ICW3_SLAVE 0x02
#define ICW4 0x01
/* End-of-interrupt byte. This gets OR'd with
* the interrupt number and sent out to the PIC
* to declare the interrupt finished */
#define EOI 0x60
/* Externally-visible functions */
/* Initialize both PICs */
void i8259_init(void);
/* Enable (unmask) the specified IRQ */
void enable_irq(uint32_t irq_num);
/* Disable (mask) the specified IRQ */
void disable_irq(uint32_t irq_num);
/* Send end-of-interrupt signal for the specified IRQ */
void send_eoi(uint32_t irq_num);
#endif /* _I8259_H */