ReactOS 0.4.16-dev-320-g3bd9ddc
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
27typedef enum _PIT_MODE
28{
36
38
39typedef 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
74VOID PitSetOutFunction(BYTE Channel, LPVOID Param, PIT_OUT_FUNCTION OutFunction);
77
79
80#endif /* _PIT_H_ */
unsigned char BOOLEAN
#define VOID
Definition: acefi.h:82
unsigned short WORD
Definition: ntddk_ex.h:93
BOOLEAN Bcd
Definition: pit.h:43
BOOLEAN LatchStatusSet
Definition: pit.h:51
BYTE ReadWriteMode
Definition: pit.h:44
WORD ReloadValue
Definition: pit.h:61
BYTE WriteStatus
Definition: pit.h:48
PIT_OUT_FUNCTION OutFunction
Definition: pit.h:68
BYTE ReadStatus
Definition: pit.h:47
WORD CountRegister
Definition: pit.h:57
BYTE StatusLatch
Definition: pit.h:52
PIT_MODE Mode
Definition: pit.h:42
WORD CurrentValue
Definition: pit.h:62
BOOLEAN Gate
Definition: pit.h:55
LPVOID OutParam
Definition: pit.h:67
WORD OutputLatch
Definition: pit.h:58
BOOLEAN Out
Definition: pit.h:65
struct _PIT_CHANNEL * PPIT_CHANNEL
VOID PitSetOutFunction(BYTE Channel, LPVOID Param, PIT_OUT_FUNCTION OutFunction)
Definition: pit.c:476
VOID PitSetGate(BYTE Channel, BOOLEAN State)
Definition: pit.c:484
WORD PitGetReloadValue(BYTE Channel)
Definition: pit.c:493
VOID(WINAPI * PIT_OUT_FUNCTION)(LPVOID Param, BOOLEAN State)
Definition: pit.h:37
enum _PIT_MODE PIT_MODE
enum _PIT_MODE * PPIT_MODE
_PIT_MODE
Definition: pit.h:28
@ PIT_MODE_HARDWARE_ONE_SHOT
Definition: pit.h:30
@ PIT_MODE_HARDWARE_STROBE
Definition: pit.h:34
@ PIT_MODE_RATE_GENERATOR
Definition: pit.h:31
@ PIT_MODE_SOFTWARE_STROBE
Definition: pit.h:33
@ PIT_MODE_SQUARE_WAVE
Definition: pit.h:32
@ PIT_MODE_INT_ON_TERMINAL_COUNT
Definition: pit.h:29
struct _PIT_CHANNEL PIT_CHANNEL
VOID PitInitialize(VOID)
Definition: pit.c:503
#define WINAPI
Definition: msvc.h:6
unsigned char BYTE
Definition: xxhash.c:193