ReactOS 0.4.15-dev-7958-gcd0bb1a
ppi.c File Reference
#include "ntvdm.h"
#include <debug.h>
#include "emulator.h"
#include "ppi.h"
#include "hardware/pit.h"
#include "hardware/sound/speaker.h"
#include "io.h"
Include dependency graph for ppi.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static BYTE WINAPI PpiReadPort (USHORT Port)
 
static VOID WINAPI Port61hWrite (USHORT Port, BYTE Data)
 
static VOID WINAPI Port62hWrite (USHORT Port, BYTE Data)
 
VOID PpiInitialize (VOID)
 

Variables

BYTE Port61hState = 0x00
 
static BYTE Port62hState = 0x00
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 18 of file ppi.c.

Function Documentation

◆ Port61hWrite()

static VOID WINAPI Port61hWrite ( USHORT  Port,
BYTE  Data 
)
static

Definition at line 46 of file ppi.c.

47{
48 // BOOLEAN SpeakerStateChange = FALSE;
49 BYTE OldPort61hState = Port61hState;
50
51 /* Only the four lowest bytes can be written */
52 Port61hState = (Port61hState & 0xF0) | (Data & 0x0F);
53
54 if ((OldPort61hState ^ Port61hState) & 0x01)
55 {
56 DPRINT("PIT 2 Gate %s\n", Port61hState & 0x01 ? "on" : "off");
57 PitSetGate(2, !!(Port61hState & 0x01));
58 // SpeakerStateChange = TRUE;
59 }
60
61 if ((OldPort61hState ^ Port61hState) & 0x02)
62 {
63 /* There were some change for the speaker... */
64 DPRINT("Speaker %s\n", Port61hState & 0x02 ? "on" : "off");
65 // SpeakerStateChange = TRUE;
66 }
67 // if (SpeakerStateChange) SpeakerChange(Port61hState);
69}
VOID PitSetGate(BYTE Channel, BOOLEAN State)
Definition: pit.c:484
BYTE Port61hState
Definition: ppi.c:31
#define DPRINT
Definition: sndvol32.h:71
VOID SpeakerChange(UCHAR Port61hValue)
Definition: speaker.c:196
unsigned char BYTE
Definition: xxhash.c:193

Referenced by PpiInitialize().

◆ Port62hWrite()

static VOID WINAPI Port62hWrite ( USHORT  Port,
BYTE  Data 
)
static

Definition at line 71 of file ppi.c.

72{
74}
static BYTE Port62hState
Definition: ppi.c:32

Referenced by PpiInitialize().

◆ PpiInitialize()

VOID PpiInitialize ( VOID  )

Definition at line 78 of file ppi.c.

79{
80 /* Register the I/O Ports */
81 // Port 0x60 is now used by the PS/2 controller
84 // Port 0x63 is unused
85}
static VOID WINAPI Port61hWrite(USHORT Port, BYTE Data)
Definition: ppi.c:46
static VOID WINAPI Port62hWrite(USHORT Port, BYTE Data)
Definition: ppi.c:71
static BYTE WINAPI PpiReadPort(USHORT Port)
Definition: ppi.c:36
#define PPI_PORT_62H
Definition: ppi.h:16
#define PPI_PORT_61H
Definition: ppi.h:15
VOID RegisterIoPort(USHORT Port, EMULATOR_INB_PROC InHandler, EMULATOR_OUTB_PROC OutHandler)
Definition: io.c:320

Referenced by EmulatorInitialize().

◆ PpiReadPort()

static BYTE WINAPI PpiReadPort ( USHORT  Port)
static

Definition at line 36 of file ppi.c.

37{
38 if (Port == PPI_PORT_61H)
39 return Port61hState;
40 else if (Port == PPI_PORT_62H)
41 return Port62hState;
42
43 return 0x00;
44}
CPPORT Port[4]
Definition: headless.c:35

Referenced by PpiInitialize().

Variable Documentation

◆ Port61hState

BYTE Port61hState = 0x00

Definition at line 31 of file ppi.c.

Referenced by PitChan1Out(), PitChan2Out(), Port61hWrite(), and PpiReadPort().

◆ Port62hState

BYTE Port62hState = 0x00
static

Definition at line 32 of file ppi.c.

Referenced by Port62hWrite(), and PpiReadPort().