[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 (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 InServiceRegister;
38 BYTE IntOffset;
39 BYTE ConfigRegister;
40 BYTE CascadeRegister;
41 BOOLEAN CascadeRegisterSet;
42 BOOLEAN AutoEoi;
43 BOOLEAN Slave;
44 BOOLEAN ReadIsr;
45 } PIC, *PPIC;
46
47 /* FUNCTIONS ******************************************************************/
48
49 BYTE PicReadCommand(BYTE Port);
50 VOID PicWriteCommand(BYTE Port, BYTE Value);
51 BYTE PicReadData(BYTE Port);
52 VOID PicWriteData(BYTE Port, BYTE Value);
53 VOID PicInterruptRequest(BYTE Number);
54
55 #endif
56
57 /* EOF */