a15c9a1572bbeeabacf5e6b05bb04dbb566a5903
[reactos.git] / subsystems / ntvdm / hardware / timer.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: timer.h
5 * PURPOSE: Programmable Interval Timer emulation
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 #ifndef _TIMER_H_
10 #define _TIMER_H_
11
12 /* INCLUDES *******************************************************************/
13
14 #include "ntvdm.h"
15
16 /* DEFINES ********************************************************************/
17
18 #define PIT_CHANNELS 3
19 #define PIT_BASE_FREQUENCY 1193182LL
20 #define PIT_DATA_PORT(x) (0x40 + (x))
21 #define PIT_COMMAND_PORT 0x43
22
23 enum
24 {
25 PIT_MODE_INT_ON_TERMINAL_COUNT,
26 PIT_MODE_HARDWARE_ONE_SHOT,
27 PIT_MODE_RATE_GENERATOR,
28 PIT_MODE_SQUARE_WAVE,
29 PIT_MODE_SOFTWARE_STROBE,
30 PIT_MODE_HARDWARE_STROBE
31 };
32
33 typedef struct _PIT_CHANNEL
34 {
35 WORD ReloadValue;
36 WORD CurrentValue;
37 WORD LatchedValue;
38 INT Mode;
39 BOOLEAN Pulsed;
40 BOOLEAN LatchSet;
41 BOOLEAN InputFlipFlop;
42 BOOLEAN OutputFlipFlop;
43 BYTE AccessMode;
44 } PIT_CHANNEL, *PPIT_CHANNEL;
45
46 extern PPIT_CHANNEL PitChannel2; // Needed for PC Speaker
47
48 /* FUNCTIONS ******************************************************************/
49
50 VOID PitDecrementCount(DWORD Count);
51 DWORD PitGetResolution(VOID);
52
53 VOID PitInitialize(VOID);
54
55 #endif // _TIMER_H_
56
57 /* EOF */