[FAST486]
[reactos.git] / subsystems / ntvdm / pic.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: pic.h
5 * PURPOSE: Programmable Interrupt Controller emulation (header file)
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 #ifndef _PIC_H_
10 #define _PIC_H_
11
12 /* INCLUDES *******************************************************************/
13
14 #include "ntvdm.h"
15
16 /* DEFINES ********************************************************************/
17
18 #define PIC_MASTER_CMD 0x20
19 #define PIC_MASTER_DATA 0x21
20 #define PIC_SLAVE_CMD 0xA0
21 #define PIC_SLAVE_DATA 0xA1
22 #define PIC_ICW1 0x10
23 #define PIC_ICW1_ICW4 (1 << 0)
24 #define PIC_ICW1_SINGLE (1 << 1)
25 #define PIC_ICW4_8086 (1 << 0)
26 #define PIC_ICW4_AEOI (1 << 1)
27 #define PIC_OCW2_NUM_MASK 0x07
28 #define PIC_OCW2_EOI (1 << 5)
29 #define PIC_OCW2_SL (1 << 6)
30 #define PIC_OCW3 (1 << 3)
31 #define PIC_OCW3_READ_ISR 0x0B
32
33 typedef struct _PIC
34 {
35 BOOLEAN Initialization;
36 BYTE MaskRegister;
37 BYTE IntRequestRegister;
38 BYTE InServiceRegister;
39 BYTE IntOffset;
40 BYTE ConfigRegister;
41 BYTE CascadeRegister;
42 BOOLEAN CascadeRegisterSet;
43 BOOLEAN AutoEoi;
44 BOOLEAN Slave;
45 BOOLEAN ReadIsr;
46 } PIC, *PPIC;
47
48 /* FUNCTIONS ******************************************************************/
49
50 BYTE PicReadCommand(BYTE Port);
51 VOID PicWriteCommand(BYTE Port, BYTE Value);
52 BYTE PicReadData(BYTE Port);
53 VOID PicWriteData(BYTE Port, BYTE Value);
54 VOID PicInterruptRequest(BYTE Number);
55 BYTE PicGetInterrupt(VOID);
56
57 #endif // _PIC_H_
58
59 /* EOF */