ReactOS  0.4.13-dev-882-gd48345a
pit.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GPL - See COPYING in the top level directory
3  * PROJECT: ReactOS Virtual DOS Machine
4  * FILE: subsystems/mvdm/ntvdm/hardware/pit.h
5  * PURPOSE: Programmable Interval Timer emulation -
6  * i82C54/8254 compatible
7  * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
8  * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
9  */
10 
11 #ifndef _PIT_H_
12 #define _PIT_H_
13 
14 /* DEFINES ********************************************************************/
15 
16 #define PIT_CHANNELS 3
17 #define PIT_BASE_FREQUENCY 1193182LL
18 #define PIT_DATA_PORT(x) (0x40 + (x))
19 #define PIT_COMMAND_PORT 0x43
20 
21 #define WRITE_PIT_VALUE(PitChannel, Value) \
22  (PitChannel).Bcd ? BCD_TO_BINARY(Value) : (Value)
23 
24 #define READ_PIT_VALUE(PitChannel, Value) \
25  (PitChannel).Bcd ? BINARY_TO_BCD(Value) : (Value)
26 
27 typedef enum _PIT_MODE
28 {
36 
38 
39 typedef struct _PIT_CHANNEL
40 {
41  /* PIT Status fields */
44  BYTE ReadWriteMode; // 0 --> Counter Latch ; 1 --> LSB R/W ; 2 --> MSB R/W ; 3 --> LSB then MSB R/W
45 
46  /* For interleaved reading and writing in 2-byte RW mode */
47  BYTE ReadStatus; // Same convention as ReadWriteMode
48  BYTE WriteStatus; // Same convention as ReadWriteMode
49 
50  /* For reading the PIT status byte */
53 
54  /* Counting */
56 
57  WORD CountRegister; // Our ReloadValue ???
59  /*******************************/
60 
61  WORD ReloadValue; // Max value of the counter
62  WORD CurrentValue; // Real value of the counter
63 
64  /* PIT Output */
65  BOOLEAN Out; // 0: Low ; 1: HighBOOLEAN FlipFlop;/** HACK!! **/
69 
71 
72 /* FUNCTIONS ******************************************************************/
73 
74 VOID PitSetOutFunction(BYTE Channel, LPVOID Param, PIT_OUT_FUNCTION OutFunction);
75 VOID PitSetGate(BYTE Channel, BOOLEAN State);
76 WORD PitGetReloadValue(BYTE Channel);
77 
79 
80 #endif /* _PIT_H_ */
BOOLEAN Gate
Definition: pit.h:55
BOOLEAN LatchStatusSet
Definition: pit.h:51
BYTE ReadWriteMode
Definition: pit.h:44
VOID PitInitialize(VOID)
Definition: pit.c:503
BYTE ReadStatus
Definition: pit.h:47
PIT_OUT_FUNCTION OutFunction
Definition: pit.h:68
VOID(WINAPI * PIT_OUT_FUNCTION)(LPVOID Param, BOOLEAN State)
Definition: pit.h:37
PIT_MODE Mode
Definition: pit.h:42
BYTE StatusLatch
Definition: pit.h:52
WORD ReloadValue
Definition: pit.h:61
VOID PitSetGate(BYTE Channel, BOOLEAN State)
Definition: pit.c:484
WORD CurrentValue
Definition: pit.h:62
unsigned char BOOLEAN
LPVOID OutParam
Definition: pit.h:67
VOID PitSetOutFunction(BYTE Channel, LPVOID Param, PIT_OUT_FUNCTION OutFunction)
Definition: pit.c:476
_PIT_MODE
Definition: pit.h:27
#define WINAPI
Definition: msvc.h:8
unsigned short WORD
Definition: ntddk_ex.h:93
enum _PIT_MODE * PPIT_MODE
BYTE WriteStatus
Definition: pit.h:48
struct _PIT_CHANNEL PIT_CHANNEL
#define VOID
Definition: acefi.h:82
unsigned char BYTE
Definition: mem.h:68
WORD OutputLatch
Definition: pit.h:58
enum _PIT_MODE PIT_MODE
WORD CountRegister
Definition: pit.h:57
enum State_ State
Definition: pofuncs.h:54
struct _PIT_CHANNEL * PPIT_CHANNEL
WORD PitGetReloadValue(BYTE Channel)
Definition: pit.c:493
BOOLEAN Out
Definition: pit.h:65
BOOLEAN Bcd
Definition: pit.h:43