#include "ntvdm.h"
#include <debug.h>
#include "emulator.h"
#include "pit.h"
#include "io.h"
#include "pic.h"
#include "clock.h"
Go to the source code of this file.
◆ NDEBUG
Definition at line 15 of file pit.c.
◆ PitClock()
Definition at line 463 of file pit.c.
464{
466
468 {
469
471 }
472}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static VOID PitDecrementCount(PPIT_CHANNEL Channel, DWORD Count)
static PIT_CHANNEL PitChannels[PIT_CHANNELS]
Referenced by PitInitialize().
◆ PitDecrementCount()
Definition at line 321 of file pit.c.
322{
323 if (
Count == 0)
return;
324
325 switch (Channel->
Mode)
326 {
328 {
329
331 {
332
334 }
336
337
339 {
340
342 }
343 break;
344 }
345
347 {
349
351 {
354 {
355
357
358
360
361
363 }
364 else
365 {
366
368
369
371
372
374 {
377 }
378 }
379 }
380
381
383
384 break;
385 }
386
388 {
391
392
393 ReloadValue &= ~1;
394
396 {
399 {
400
402
403
405
406
407 ReloadCount++;
408 }
409 else
410 {
411
413
414
416
417
419 {
420
422
423
424 ReloadCount++;
425 }
426 }
427 }
428
429 if (ReloadCount == 0) break;
430
431
432 if (ReloadCount & 1)
433 {
436 }
437
438
439 if ((Channel->
FlipFlop && (ReloadCount == 1)) || (ReloadCount > 1))
440 {
441
443 }
444
445 break;
446 }
447
449 {
450
451 break;
452 }
453
456 {
457
458 break;
459 }
460 }
461}
static VOID PitSetOut(PPIT_CHANNEL Channel, BOOLEAN State)
@ PIT_MODE_HARDWARE_ONE_SHOT
@ PIT_MODE_HARDWARE_STROBE
@ PIT_MODE_RATE_GENERATOR
@ PIT_MODE_SOFTWARE_STROBE
@ PIT_MODE_INT_ON_TERMINAL_COUNT
Referenced by PitClock().
◆ PitGetReloadValue()
◆ PitInitCounter()
◆ PitInitialize()
Definition at line 503 of file pit.c.
504{
505
512
513
518
519
523}
#define HARDWARE_TIMER_ENABLED
#define HARDWARE_TIMER_PRECISE
static VOID FASTCALL PitClock(ULONGLONG Count)
static VOID WINAPI PitWritePort(USHORT Port, BYTE Data)
VOID PitSetOutFunction(BYTE Channel, LPVOID Param, PIT_OUT_FUNCTION OutFunction)
VOID PitSetGate(BYTE Channel, BOOLEAN State)
static BYTE WINAPI PitReadPort(USHORT Port)
static PHARDWARE_TIMER MasterClock
PHARDWARE_TIMER CreateHardwareTimer(ULONG Flags, ULONGLONG Delay, PHARDWARE_TIMER_PROC Callback)
#define PIT_BASE_FREQUENCY
VOID RegisterIoPort(USHORT Port, EMULATOR_INB_PROC InHandler, EMULATOR_OUTB_PROC OutHandler)
Referenced by EmulatorInitialize().
◆ PitLatchChannelCount()
static VOID PitLatchChannelCount |
( |
BYTE |
Channel | ) |
|
|
static |
Definition at line 58 of file pit.c.
59{
61
62
63
64
65
66
67
69 {
70
72
73
76 }
77}
static UCHAR ReadStatus(_In_ PUCHAR ReadDataPort)
#define READ_PIT_VALUE(PitChannel, Value)
Referenced by PitReadData(), and PitWriteCommand().
◆ PitLatchChannelStatus()
static VOID PitLatchChannelStatus |
( |
BYTE |
Channel | ) |
|
|
static |
HACK!!
HACK!!
Definition at line 32 of file pit.c.
33{
35
36
37
38
39
40
41
43 {
44 BYTE StatusLatch = 0;
BYTE NullCount = 0;
51
52
55 }
56}
Referenced by PitWriteCommand().
◆ PitReadData()
Definition at line 193 of file pit.c.
194{
197
198
199
200
201
203 {
206 }
207
208
210
211
213
216
218 {
219
221 return LOBYTE(*CurrentValue);
222 }
223
225 {
226
228 return HIBYTE(*CurrentValue);
229 }
230
231
233 return 0;
234}
static VOID ReadWriteMode(_In_ UCHAR Mode)
static VOID PitLatchChannelCount(BYTE Channel)
Referenced by PitReadPort().
◆ PitReadPort()
Definition at line 286 of file pit.c.
287{
289 {
293 {
295 }
296 }
297
298 return 0;
299}
static BYTE PitReadData(BYTE Channel)
Referenced by PitInitialize().
◆ PitSetGate()
◆ PitSetOut()
◆ PitSetOutFunction()
◆ PitWriteCommand()
static VOID PitWriteCommand |
( |
BYTE |
Value | ) |
|
|
static |
HACK!!
HACK!!
Definition at line 109 of file pit.c.
110{
115
116
117
118
119
121
122
124 {
125 if ((
Value & 0x20) == 0)
126 {
130 }
131 if ((
Value & 0x10) == 0)
132 {
136 }
137 return;
138 }
139
140
142 {
144 return;
145 }
146
147
151
154
160
162 if (IsBcd &&
PitChannels[Channel].CurrentValue > 9999)
164
166 {
167 case 0:
168 case 1:
169 case 2:
170 case 3:
171 case 4:
172 case 5:
173 {
175 break;
176 }
177
178 case 6:
179 case 7:
180 {
181
182
183
184
186 break;
187 }
188 }
189
191}
static VOID PitInitCounter(PPIT_CHANNEL Channel)
static VOID PitLatchChannelStatus(BYTE Channel)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Referenced by PitWritePort().
◆ PitWriteData()
Definition at line 236 of file pit.c.
237{
239
241 {
243 }
244
246
248
250 {
251
255 }
257 {
258
262 }
263
264
266 {
268 {
269
272 else
274 }
275
276
280
281
283 }
284}
#define WRITE_PIT_VALUE(PitChannel, Value)
Referenced by PitWritePort().
◆ PitWritePort()
Definition at line 301 of file pit.c.
302{
304 {
306 {
308 break;
309 }
310
314 {
316 break;
317 }
318 }
319}
static VOID PitWriteData(BYTE Channel, BYTE Value)
static VOID PitWriteCommand(BYTE Value)
Referenced by PitInitialize().
◆ MasterClock
◆ PitChannels