[NTVDM]
[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
6 * (Interrupt Controller Adapter (ICA) in Windows terminology)
7 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
8 */
9
10 #ifndef _PIC_H_
11 #define _PIC_H_
12
13 /* INCLUDES *******************************************************************/
14
15 #include "ntvdm.h"
16
17 /* DEFINES ********************************************************************/
18
19 #define PIC_MASTER_CMD 0x20
20 #define PIC_MASTER_DATA 0x21
21 #define PIC_SLAVE_CMD 0xA0
22 #define PIC_SLAVE_DATA 0xA1
23 #define PIC_ICW1 0x10
24 #define PIC_ICW1_ICW4 (1 << 0)
25 #define PIC_ICW1_SINGLE (1 << 1)
26 #define PIC_ICW4_8086 (1 << 0)
27 #define PIC_ICW4_AEOI (1 << 1)
28 #define PIC_OCW2_NUM_MASK 0x07
29 #define PIC_OCW2_EOI (1 << 5)
30 #define PIC_OCW2_SL (1 << 6)
31 #define PIC_OCW3 (1 << 3)
32 #define PIC_OCW3_READ_ISR 0x0B
33
34 typedef struct _PIC
35 {
36 BOOLEAN Initialization;
37 BYTE MaskRegister;
38 BYTE IntRequestRegister;
39 BYTE InServiceRegister;
40 BYTE IntOffset;
41 BYTE ConfigRegister;
42 BYTE CascadeRegister;
43 BOOLEAN CascadeRegisterSet;
44 BOOLEAN AutoEoi;
45 BOOLEAN Slave;
46 BOOLEAN ReadIsr;
47 } PIC, *PPIC;
48
49 /* FUNCTIONS ******************************************************************/
50
51 VOID PicInterruptRequest(BYTE Number);
52 BYTE PicGetInterrupt(VOID);
53 BOOLEAN PicInitialize(VOID);
54
55 #endif // _PIC_H_
56
57 /* EOF */