ReactOS  0.4.13-dev-982-g9853eab
pit.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _PIT_CHANNEL
 

Macros

#define PIT_CHANNELS   3
 
#define PIT_BASE_FREQUENCY   1193182LL
 
#define PIT_DATA_PORT(x)   (0x40 + (x))
 
#define PIT_COMMAND_PORT   0x43
 
#define WRITE_PIT_VALUE(PitChannel, Value)   (PitChannel).Bcd ? BCD_TO_BINARY(Value) : (Value)
 
#define READ_PIT_VALUE(PitChannel, Value)   (PitChannel).Bcd ? BINARY_TO_BCD(Value) : (Value)
 

Typedefs

typedef enum _PIT_MODE PIT_MODE
 
typedef enum _PIT_MODEPPIT_MODE
 
typedef VOID(WINAPIPIT_OUT_FUNCTION) (LPVOID Param, BOOLEAN State)
 
typedef struct _PIT_CHANNEL PIT_CHANNEL
 
typedef struct _PIT_CHANNELPPIT_CHANNEL
 

Enumerations

enum  _PIT_MODE {
  PIT_MODE_INT_ON_TERMINAL_COUNT, PIT_MODE_HARDWARE_ONE_SHOT, PIT_MODE_RATE_GENERATOR, PIT_MODE_SQUARE_WAVE,
  PIT_MODE_SOFTWARE_STROBE, PIT_MODE_HARDWARE_STROBE
}
 

Functions

VOID PitSetOutFunction (BYTE Channel, LPVOID Param, PIT_OUT_FUNCTION OutFunction)
 
VOID PitSetGate (BYTE Channel, BOOLEAN State)
 
WORD PitGetReloadValue (BYTE Channel)
 
VOID PitInitialize (VOID)
 

Macro Definition Documentation

◆ PIT_BASE_FREQUENCY

#define PIT_BASE_FREQUENCY   1193182LL

Definition at line 17 of file pit.h.

◆ PIT_CHANNELS

#define PIT_CHANNELS   3

Definition at line 16 of file pit.h.

◆ PIT_COMMAND_PORT

#define PIT_COMMAND_PORT   0x43

Definition at line 19 of file pit.h.

◆ PIT_DATA_PORT

#define PIT_DATA_PORT (   x)    (0x40 + (x))

Definition at line 18 of file pit.h.

◆ READ_PIT_VALUE

#define READ_PIT_VALUE (   PitChannel,
  Value 
)    (PitChannel).Bcd ? BINARY_TO_BCD(Value) : (Value)

Definition at line 24 of file pit.h.

◆ WRITE_PIT_VALUE

#define WRITE_PIT_VALUE (   PitChannel,
  Value 
)    (PitChannel).Bcd ? BCD_TO_BINARY(Value) : (Value)

Definition at line 21 of file pit.h.

Typedef Documentation

◆ PIT_CHANNEL

◆ PIT_MODE

◆ PIT_OUT_FUNCTION

typedef VOID(WINAPI * PIT_OUT_FUNCTION) (LPVOID Param, BOOLEAN State)

Definition at line 37 of file pit.h.

◆ PPIT_CHANNEL

◆ PPIT_MODE

Enumeration Type Documentation

◆ _PIT_MODE

Enumerator
PIT_MODE_INT_ON_TERMINAL_COUNT 
PIT_MODE_HARDWARE_ONE_SHOT 
PIT_MODE_RATE_GENERATOR 
PIT_MODE_SQUARE_WAVE 
PIT_MODE_SOFTWARE_STROBE 
PIT_MODE_HARDWARE_STROBE 

Definition at line 27 of file pit.h.

Function Documentation

◆ PitGetReloadValue()

WORD PitGetReloadValue ( BYTE  Channel)

Definition at line 493 of file pit.c.

494 {
495  if (Channel >= PIT_CHANNELS) return 0xFFFF;
496 
497  if (PitChannels[Channel].ReloadValue == 0)
498  return 0xFFFF;
499  else
500  return PitChannels[Channel].ReloadValue;
501 }
static PIT_CHANNEL PitChannels[PIT_CHANNELS]
Definition: pit.c:27
WORD ReloadValue
Definition: pit.h:61
#define PIT_CHANNELS
Definition: pit.h:16

Referenced by SpeakerChange().

◆ PitInitialize()

VOID PitInitialize ( VOID  )

Definition at line 503 of file pit.c.

504 {
505  /* Set up the timers to their default value */
507  PitSetGate(0, TRUE);
509  PitSetGate(1, TRUE);
511  PitSetGate(2, FALSE);
512 
513  /* Register the I/O Ports */
518 
519  /* Register the hardware timer */
522  PitClock);
523 }
#define TRUE
Definition: types.h:120
static VOID WINAPI PitWritePort(USHORT Port, BYTE Data)
Definition: pit.c:301
VOID PitSetOutFunction(BYTE Channel, LPVOID Param, PIT_OUT_FUNCTION OutFunction)
Definition: pit.c:476
VOID RegisterIoPort(USHORT Port, EMULATOR_INB_PROC InHandler, EMULATOR_OUTB_PROC OutHandler)
Definition: io.c:320
static BYTE WINAPI PitReadPort(USHORT Port)
Definition: pit.c:286
PHARDWARE_TIMER CreateHardwareTimer(ULONG Flags, ULONGLONG Delay, PHARDWARE_TIMER_PROC Callback)
Definition: clock.c:144
smooth NULL
Definition: ftsmooth.c:416
#define PIT_COMMAND_PORT
Definition: pit.h:19
#define HARDWARE_TIMER_PRECISE
Definition: clock.h:17
#define HARDWARE_TIMER_ENABLED
Definition: clock.h:15
static VOID FASTCALL PitClock(ULONGLONG Count)
Definition: pit.c:463
#define PIT_BASE_FREQUENCY
Definition: pit.h:17
#define HZ_TO_NS(Freq)
Definition: clock.h:20
#define PIT_DATA_PORT(x)
Definition: pit.h:18
static PHARDWARE_TIMER MasterClock
Definition: pit.c:28
VOID PitSetGate(BYTE Channel, BOOLEAN State)
Definition: pit.c:484

Referenced by EmulatorInitialize().

◆ PitSetGate()

VOID PitSetGate ( BYTE  Channel,
BOOLEAN  State 
)

Definition at line 484 of file pit.c.

485 {
486  if (Channel >= PIT_CHANNELS) return;
487  if (State == PitChannels[Channel].Gate) return;
488 
489  /* UNIMPLEMENTED */
490  PitChannels[Channel].Gate = State;
491 }
BOOLEAN Gate
Definition: pit.h:55
static PIT_CHANNEL PitChannels[PIT_CHANNELS]
Definition: pit.c:27
#define PIT_CHANNELS
Definition: pit.h:16
enum State_ State
Definition: pofuncs.h:54

Referenced by PitInitialize(), and Port61hWrite().

◆ PitSetOutFunction()

VOID PitSetOutFunction ( BYTE  Channel,
LPVOID  Param,
PIT_OUT_FUNCTION  OutFunction 
)

Definition at line 476 of file pit.c.

477 {
478  if (Channel >= PIT_CHANNELS) return;
479 
480  PitChannels[Channel].OutParam = Param;
481  PitChannels[Channel].OutFunction = OutFunction;
482 }
static PIT_CHANNEL PitChannels[PIT_CHANNELS]
Definition: pit.c:27
PIT_OUT_FUNCTION OutFunction
Definition: pit.h:68
LPVOID OutParam
Definition: pit.h:67
#define PIT_CHANNELS
Definition: pit.h:16

Referenced by EmulatorInitialize(), and PitInitialize().