2022-05-14 16:42:37 +00:00
|
|
|
#ifndef PIC_H
|
|
|
|
#define PIC_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define PIC1 0x20 /* IO base address for master PIC */
|
|
|
|
#define PIC2 0xA0 /* IO base address for slave PIC */
|
|
|
|
#define PIC1_COMMAND PIC1
|
|
|
|
#define PIC1_DATA (PIC1+1)
|
|
|
|
#define PIC2_COMMAND PIC2
|
|
|
|
#define PIC2_DATA (PIC2+1)
|
|
|
|
|
|
|
|
#define PIC_EOI 0x20 /* End-of-interrupt command code */
|
|
|
|
|
|
|
|
#define ICW1_ICW4 0x01 /* ICW4 (not) needed */
|
|
|
|
#define ICW1_SINGLE 0x02 /* Single (cascade) mode */
|
|
|
|
#define ICW1_INTERVAL4 0x04 /* Call address interval 4 (8) */
|
|
|
|
#define ICW1_LEVEL 0x08 /* Level triggered (edge) mode */
|
|
|
|
#define ICW1_INIT 0x10 /* Initialization - required! */
|
|
|
|
|
|
|
|
#define ICW4_8086 0x01 /* 8086/88 (MCS-80/85) mode */
|
|
|
|
#define ICW4_AUTO 0x02 /* Auto (normal) EOI */
|
|
|
|
#define ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */
|
|
|
|
#define ICW4_BUF_MASTER 0x0C /* Buffered mode/master */
|
|
|
|
#define ICW4_SFNM 0x10 /* Special fully nested (not) */
|
|
|
|
|
|
|
|
#define PIC_READ_IRR 0x0a /* OCW3 irq ready next CMD read */
|
|
|
|
#define PIC_READ_ISR 0x0b /* OCW3 irq service next CMD read */
|
|
|
|
|
2022-05-15 23:02:09 +00:00
|
|
|
#define IRQ_PIT 0
|
|
|
|
#define IRQ_KEYBOARD 1
|
|
|
|
#define IRQ_INTERNAL 2
|
|
|
|
#define IRQ_COM2 3
|
|
|
|
#define IRQ_COM1 4
|
|
|
|
#define IRQ_LPT2 5
|
|
|
|
#define IRQ_FLOPPY 6
|
|
|
|
#define IRQ_LPT1 7
|
|
|
|
#define IRQ_CMOS 8
|
|
|
|
#define IRQ_UNUSED 9
|
|
|
|
#define IRQ_UNUSED 10
|
|
|
|
#define IRQ_UNUSED 11
|
|
|
|
#define IRQ_PS2_MOUSE 12
|
|
|
|
#define IRQ_FPU 13
|
|
|
|
#define IRQ_ATA_PRIMARY 14
|
|
|
|
#define IRQ_ATA_SECONDARY 15
|
2022-05-14 16:42:37 +00:00
|
|
|
|
|
|
|
void pic_send_eoi(uint8_t irq);
|
|
|
|
void pic_remap(int offset1, int offset2);
|
|
|
|
void pic_mask_irq(uint8_t irq);
|
|
|
|
void pic_unmask_irq(uint8_t irq);
|
|
|
|
static uint16_t __pic_get_irq_reg(int ocw3);
|
|
|
|
uint16_t pic_get_irr();
|
|
|
|
uint16_t pic_get_isr();
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|