ReactOS  0.4.15-dev-3165-gdf6fff7
pic.h
Go to the documentation of this file.
1 /*
2  * PROJECT: NEC PC-98 series onboard hardware
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Intel 8259A PIC header file
5  * COPYRIGHT: Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
6  */
7 
8 #pragma once
9 
10 #define PIC1_CONTROL_PORT 0x00
11 #define PIC1_DATA_PORT 0x02
12 #define PIC2_CONTROL_PORT 0x08
13 #define PIC2_DATA_PORT 0x0A
14 
15 #define PIC_TIMER_IRQ 0
16 #define PIC_CASCADE_IRQ 7
17 #define PIC_RTC_IRQ 15
18 
19 /*
20  * Definitions for ICW/OCW Bits
21  */
23 {
27 
29 {
33 
35 {
39 
41 {
45 
47 {
51 
53 {
59 
60 typedef enum _I8259_READ_REQUEST
61 {
67 
68 typedef enum _I8259_EOI_MODE
69 {
79 
80 /*
81  * Definitions for ICW Registers
82  */
83 typedef union _I8259_ICW1
84 {
85  struct
86  {
87  UCHAR NeedIcw4:1;
89  UCHAR Interval:1;
91  UCHAR Init:1;
93  };
94  UCHAR Bits;
96 
97 typedef union _I8259_ICW2
98 {
99  struct
100  {
101  UCHAR Sbz:3;
103  };
104  UCHAR Bits;
106 
107 typedef union _I8259_ICW3
108 {
109  union
110  {
111  struct
112  {
113  UCHAR SlaveIrq0:1;
114  UCHAR SlaveIrq1:1;
115  UCHAR SlaveIrq2:1;
116  UCHAR SlaveIrq3:1;
117  UCHAR SlaveIrq4:1;
118  UCHAR SlaveIrq5:1;
119  UCHAR SlaveIrq6:1;
120  UCHAR SlaveIrq7:1;
121  };
122  struct
123  {
124  UCHAR SlaveId:3;
125  UCHAR Reserved:5;
126  };
127  };
128  UCHAR Bits;
130 
131 typedef union _I8259_ICW4
132 {
133  struct
134  {
135  UCHAR SystemMode:1;
136  UCHAR EoiMode:1;
139  UCHAR Reserved:3;
140  };
141  UCHAR Bits;
143 
144 typedef union _I8259_OCW2
145 {
146  struct
147  {
148  UCHAR IrqNumber:3;
149  UCHAR Sbz:2;
150  UCHAR EoiMode:3;
151  };
152  UCHAR Bits;
154 
155 typedef union _I8259_OCW3
156 {
157  struct
158  {
159  UCHAR ReadRequest:2;
160  UCHAR PollCommand:1;
161  UCHAR Sbo:1;
162  UCHAR Sbz:1;
164  UCHAR Reserved:1;
165  };
166  UCHAR Bits;
168 
169 typedef union _I8259_ISR
170 {
171  struct
172  {
173  UCHAR Irq0:1;
174  UCHAR Irq1:1;
175  UCHAR Irq2:1;
176  UCHAR Irq3:1;
177  UCHAR Irq4:1;
178  UCHAR Irq5:1;
179  UCHAR Irq6:1;
180  UCHAR Irq7:1;
181  };
182  UCHAR Bits;
184 
186 
187 /*
188  * NESA Edge/Level Triggered Register
189  */
190 #define EISA_ELCR_MASTER 0x98D2
191 #define EISA_ELCR_SLAVE 0x98D4
192 
193 typedef union _EISA_ELCR
194 {
195  struct
196  {
197  struct
198  {
199  UCHAR Irq0Level:1;
200  UCHAR Irq1Level:1;
201  UCHAR Irq2Level:1;
202  UCHAR Irq3Level:1;
203  UCHAR Irq4Level:1;
204  UCHAR Irq5Level:1;
205  UCHAR Irq6Level:1;
206  UCHAR Irq7Level:1;
207  } Master;
208  struct
209  {
210  UCHAR Irq8Level:1;
211  UCHAR Irq9Level:1;
212  UCHAR Irq10Level:1;
213  UCHAR Irq11Level:1;
214  UCHAR Irq12Level:1;
215  UCHAR Irq13Level:1;
216  UCHAR Irq14Level:1;
217  UCHAR Irq15Level:1;
218  } Slave;
219  };
220  USHORT Bits;
222 
223 typedef union _PIC_MASK
224 {
225  struct
226  {
227  UCHAR Master;
228  UCHAR Slave;
229  };
230  USHORT Both;
231 } PIC_MASK, *PPIC_MASK;
UCHAR InterruptVector
Definition: halhw.h:242
UCHAR IrqNumber
Definition: halhw.h:288
UCHAR Irq8Level
Definition: halhw.h:353
UCHAR SpecialMaskMode
Definition: halhw.h:303
enum _I8259_ICW4_BUFFERED_MODE I8259_ICW4_BUFFERED_MODE
I8259_ISR * PI8259_IDR
Definition: pic.h:185
UCHAR Irq11Level
Definition: halhw.h:356
UCHAR Master
Definition: halhw.h:370
UCHAR Interval
Definition: halhw.h:229
enum _I8259_ICW1_INTERVAL I8259_ICW1_INTERVAL
union _I8259_ICW3 I8259_ICW3
UCHAR Irq5
Definition: halhw.h:318
_I8259_READ_REQUEST
Definition: halhw.h:200
UCHAR InterruptMode
Definition: halhw.h:230
USHORT Bits
Definition: halhw.h:363
Definition: pic.h:37
UCHAR Irq0
Definition: halhw.h:313
UCHAR EoiMode
Definition: halhw.h:290
UCHAR SlaveIrq5
Definition: halhw.h:258
UCHAR Sbz
Definition: halhw.h:289
union _I8259_ICW1 * PI8259_ICW1
union _I8259_OCW3 * PI8259_OCW3
UCHAR Irq2Level
Definition: halhw.h:344
struct _EISA_ELCR::@1465::@1467 Master
UCHAR Irq9Level
Definition: halhw.h:354
union _I8259_ISR * PI8259_ISR
Definition: pic.h:36
union _I8259_ICW4 I8259_ICW4
_I8259_ICW1_OPERATING_MODE
Definition: halhw.h:162
Definition: pic.h:24
UCHAR SlaveIrq3
Definition: halhw.h:256
UCHAR SlaveIrq2
Definition: halhw.h:255
union _EISA_ELCR * PEISA_ELCR
UCHAR Bits
Definition: halhw.h:244
UCHAR Bits
Definition: halhw.h:268
UCHAR SlaveIrq7
Definition: halhw.h:260
UCHAR ReadRequest
Definition: halhw.h:299
enum _I8259_ICW4_SYSTEM_MODE I8259_ICW4_SYSTEM_MODE
union _I8259_ICW3 * PI8259_ICW3
UCHAR Irq2
Definition: halhw.h:315
UCHAR Bits
Definition: halhw.h:322
UCHAR Irq4Level
Definition: halhw.h:346
UCHAR SpecialFullyNestedMode
Definition: halhw.h:278
UCHAR Reserved
Definition: halhw.h:279
UCHAR Irq6Level
Definition: halhw.h:348
struct _EISA_ELCR::@1465::@1468 Slave
_I8259_ICW1_INTERRUPT_MODE
Definition: halhw.h:168
Definition: pic.h:25
UCHAR Sbz
Definition: halhw.h:241
union _EISA_ELCR EISA_ELCR
union _I8259_ICW1 I8259_ICW1
UCHAR Bits
Definition: halhw.h:234
UCHAR Sbo
Definition: halhw.h:301
UCHAR Irq4
Definition: halhw.h:317
UCHAR SlaveIrq6
Definition: halhw.h:259
UCHAR SystemMode
Definition: halhw.h:275
_I8259_ICW4_BUFFERED_MODE
Definition: halhw.h:192
UCHAR OperatingMode
Definition: halhw.h:228
UCHAR BufferedMode
Definition: halhw.h:277
UCHAR NeedIcw4
Definition: halhw.h:227
Definition: pic.h:64
UCHAR Irq5Level
Definition: halhw.h:347
union _I8259_ICW2 I8259_ICW2
union _I8259_ISR I8259_ISR
union _I8259_ICW4 * PI8259_ICW4
enum _I8259_ICW1_INTERRUPT_MODE I8259_ICW1_INTERRUPT_MODE
I8259_ISR I8259_IDR
Definition: pic.h:185
UCHAR Irq15Level
Definition: halhw.h:360
UCHAR Irq7
Definition: halhw.h:320
UCHAR EoiMode
Definition: halhw.h:276
UCHAR Irq1Level
Definition: halhw.h:343
USHORT Both
Definition: halhw.h:373
_I8259_ICW1_INTERVAL
Definition: halhw.h:174
unsigned char UCHAR
Definition: xmlstorage.h:181
enum _I8259_READ_REQUEST I8259_READ_REQUEST
UCHAR Irq10Level
Definition: halhw.h:355
enum _I8259_ICW4_EOI_MODE I8259_ICW4_EOI_MODE
UCHAR Irq3Level
Definition: halhw.h:345
UCHAR Bits
Definition: halhw.h:281
UCHAR Bits
Definition: halhw.h:292
UCHAR Irq7Level
Definition: halhw.h:349
UCHAR SlaveIrq4
Definition: halhw.h:257
UCHAR Irq14Level
Definition: halhw.h:359
Definition: pic.h:65
union _I8259_OCW2 * PI8259_OCW2
UCHAR Reserved
Definition: halhw.h:304
_I8259_ICW4_SYSTEM_MODE
Definition: halhw.h:180
UCHAR InterruptVectorAddress
Definition: halhw.h:232
UCHAR Irq6
Definition: halhw.h:319
UCHAR PollCommand
Definition: halhw.h:300
Definition: pic.h:48
UCHAR Irq0Level
Definition: halhw.h:342
UCHAR Bits
Definition: halhw.h:306
unsigned short USHORT
Definition: pedump.c:61
union _PIC_MASK PIC_MASK
UCHAR SlaveIrq0
Definition: halhw.h:253
UCHAR Init
Definition: halhw.h:231
_I8259_ICW4_EOI_MODE
Definition: halhw.h:186
UCHAR Irq3
Definition: halhw.h:316
union _I8259_OCW3 I8259_OCW3
_I8259_EOI_MODE
Definition: halhw.h:208
union _I8259_OCW2 I8259_OCW2
UCHAR Irq13Level
Definition: halhw.h:358
enum _I8259_ICW1_OPERATING_MODE I8259_ICW1_OPERATING_MODE
UCHAR Sbz
Definition: halhw.h:302
UCHAR SlaveId
Definition: halhw.h:264
UCHAR Reserved
Definition: halhw.h:265
union _I8259_ICW2 * PI8259_ICW2
UCHAR SlaveIrq1
Definition: halhw.h:254
UCHAR Irq1
Definition: halhw.h:314
union _PIC_MASK * PPIC_MASK
UCHAR Slave
Definition: halhw.h:371
UCHAR Irq12Level
Definition: halhw.h:357
enum _I8259_EOI_MODE I8259_EOI_MODE