| 1 |
|
| 2 |
|
| 3 |
#ifndef PC80_I8259_H |
| 4 |
#define PC80_I8259_H |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
#define IRQ_DIS 0x1F |
| 16 |
#define IRQ_0 0x00 |
| 17 |
#define IRQ_1 0x01 |
| 18 |
#define IRQ_2 0x02 |
| 19 |
#define IRQ_3 0x03 |
| 20 |
#define IRQ_4 0x04 |
| 21 |
#define IRQ_5 0x05 |
| 22 |
#define IRQ_6 0x06 |
| 23 |
#define IRQ_7 0x07 |
| 24 |
#define IRQ_8 0x08 |
| 25 |
#define IRQ_9 0x09 |
| 26 |
#define IRQ_10 0x0A |
| 27 |
#define IRQ_11 0x0B |
| 28 |
#define IRQ_12 0x0C |
| 29 |
#define IRQ_13 0x0D |
| 30 |
#define IRQ_14 0x0E |
| 31 |
#define IRQ_15 0x0F |
| 32 |
|
| 33 |
#define MASTER_PIC_ICW1 0x20 |
| 34 |
#define SLAVE_PIC_ICW1 0xa0 |
| 35 |
#define ICW_SELECT (1 << 4) |
| 36 |
#define OCW_SELECT (0 << 4) |
| 37 |
#define ADI (1 << 2) |
| 38 |
#define SNGL (1 << 1) |
| 39 |
#define IC4 (1 << 0) |
| 40 |
|
| 41 |
#define MASTER_PIC_ICW2 0x21 |
| 42 |
#define SLAVE_PIC_ICW2 0xa1 |
| 43 |
#define INT_VECTOR_MASTER 0x20 |
| 44 |
#define IRQ0 0x00 |
| 45 |
#define IRQ1 0x01 |
| 46 |
#define INT_VECTOR_SLAVE 0x28 |
| 47 |
#define IRQ8 0x00 |
| 48 |
#define IRQ9 0x01 |
| 49 |
|
| 50 |
#define MASTER_PIC_ICW3 0x21 |
| 51 |
#define CASCADED_PIC (1 << 2) |
| 52 |
|
| 53 |
#define MASTER_PIC_ICW4 0x21 |
| 54 |
#define SLAVE_PIC_ICW4 0xa1 |
| 55 |
#define MICROPROCESSOR_MODE (1 << 0) |
| 56 |
|
| 57 |
#define SLAVE_PIC_ICW3 0xa1 |
| 58 |
#define SLAVE_ID 0x02 |
| 59 |
|
| 60 |
#define MASTER_PIC_OCW1 0x21 |
| 61 |
#define SLAVE_PIC_OCW1 0xa1 |
| 62 |
#define IRQ2 (1 << 2) |
| 63 |
#define ALL_IRQS 0xff |
| 64 |
|
| 65 |
#define ELCR1 0x4d0 |
| 66 |
#define ELCR2 0x4d1 |
| 67 |
|
| 68 |
#define IRQ_LEVEL_TRIGGERED 1 |
| 69 |
#define IRQ_EDGE_TRIGGERED 0 |
| 70 |
|
| 71 |
u16 pic_read_irq_mask(void); |
| 72 |
void pic_write_irq_mask(u16 mask); |
| 73 |
void pic_irq_enable(u8 int_num, u8 mask); |
| 74 |
void setup_i8259(void); |
| 75 |
void i8259_configure_irq_trigger(int int_num, int is_level_triggered); |
| 76 |
|
| 77 |
#endif |