MP3 1.0
This is the Doxygen document for ECE391 MP3.
Loading...
Searching...
No Matches
i8259.h
Go to the documentation of this file.
1
10#ifndef _I8259_H
11#define _I8259_H
12
13#include "types.h"
14
15/* Ports that each PIC sits on */
16#define MASTER_8259_PORT 0x20
17#define SLAVE_8259_PORT 0xA0
18
19/*command port and data port*/
20#define MASTER_COMMAND MASTER_8259_PORT
21#define MASTER_DATA (MASTER_8259_PORT+1)
22#define SLAVE_COMMAND SLAVE_8259_PORT
23#define SLAVE_DATA (SLAVE_8259_PORT+1)
24
25
26/* Initialization control words to init each PIC.
27 * See the Intel manuals for details on the meaning
28 * of each word */
29#define ICW1 0x11 //starts the initialization command sequence.
30#define ICW2_MASTER 0x20 //master's vector offset
31#define ICW2_SLAVE 0x28 //slave's vector offset
32#define ICW3_MASTER 0x04 //how it is wired to slaves(slave at IRQ2)
33#define ICW3_SLAVE 0x02 //how it is wired to master(cascade identity 0000 0010)
34#define ICW4 0x01 //8086/88 mode
35
36/* End-of-interrupt byte. This gets OR'd with
37 * the interrupt number and sent out to the PIC
38 * to declare the interrupt finished */
39#define EOI 0x60
40
41// Devices and their corresponding IRQ number
42#define IRQ_KEYBOARD (1)
43#define IRQ_RTC (8)
44#define IRQ_PIT (0)
45/* Externally-visible functions */
46
59int i8259_init(void);
60
69int enable_irq(uint32_t irq_num);
70
79int disable_irq(uint32_t irq_num);
80
89int send_eoi(uint32_t irq_num);
90
91#endif /* _I8259_H */
int enable_irq(uint32_t irq_num)
Enable (unmask) the specified IRQ.
Definition: i8259.c:59
int i8259_init(void)
Initialize the 8259 PIC.
Definition: i8259.c:25
int disable_irq(uint32_t irq_num)
Disable (mask) the specified IRQ.
Definition: i8259.c:96
int send_eoi(uint32_t irq_num)
Send end-of-interrupt signal for the specified IRQ.
Definition: i8259.c:132
Defines to use the familiar explicitly-sized types in this OS.
unsigned int uint32_t
Definition: types.h:19