Sync with trunk r63192.
[reactos.git] / subsystems / ntvdm / hardware / 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
24 #define PIC_ICW1 0x10
25 #define PIC_ICW1_ICW4 (1 << 0)
26 #define PIC_ICW1_SINGLE (1 << 1)
27 #define PIC_ICW4_8086 (1 << 0)
28 #define PIC_ICW4_AEOI (1 << 1)
29
30 #define PIC_OCW2_NUM_MASK 0x07
31 #define PIC_OCW2_EOI (1 << 5)
32 #define PIC_OCW2_SL (1 << 6)
33
34 #define PIC_OCW3 (1 << 3)
35 #define PIC_OCW3_READ_ISR 0x0B
36
37 typedef struct _PIC
38 {
39 BOOLEAN Initialization;
40 BYTE MaskRegister;
41 BYTE IntRequestRegister;
42 BYTE InServiceRegister;
43 BYTE IntOffset;
44 BYTE ConfigRegister;
45 BYTE CascadeRegister;
46 BOOLEAN CascadeRegisterSet;
47 BOOLEAN AutoEoi;
48 BOOLEAN Slave;
49 BOOLEAN ReadIsr;
50 } PIC, *PPIC;
51
52 /* FUNCTIONS ******************************************************************/
53
54 VOID PicInterruptRequest(BYTE Number);
55 BYTE PicGetInterrupt(VOID);
56
57 VOID PicInitialize(VOID);
58
59 #endif // _PIC_H_
60
61 /* EOF */