static VOID WINAPI Port61hWrite(ULONG Port, BYTE Data)
{
- // BOOLEAN SpeakerChange = FALSE;
+ // BOOLEAN SpeakerStateChange = FALSE;
BYTE OldPort61hState = Port61hState;
/* Only the four lowest bytes can be written */
if ((OldPort61hState ^ Port61hState) & 0x01)
{
DPRINT("PIT 2 Gate %s\n", Port61hState & 0x01 ? "on" : "off");
- // SpeakerChange = TRUE;
+ PitSetGate(2, !!(Port61hState & 0x01));
+ // SpeakerStateChange = TRUE;
}
- PitSetGate(2, !!(Port61hState & 0x01));
-
if ((OldPort61hState ^ Port61hState) & 0x02)
{
/* There were some change for the speaker... */
DPRINT("Speaker %s\n", Port61hState & 0x02 ? "on" : "off");
- // SpeakerChange = TRUE;
+ // SpeakerStateChange = TRUE;
}
- // if (SpeakerChange) SpeakerChange();
+ // if (SpeakerStateChange) SpeakerChange();
SpeakerChange();
}
static VOID WINAPI PitChan2Out(LPVOID Param, BOOLEAN State)
{
- // BYTE OldPort61hState = Port61hState;
+ BYTE OldPort61hState = Port61hState;
#if 0
if (State)
#else
Port61hState = (Port61hState & 0xDF) | (State << 5);
#endif
- DPRINT("Speaker PIT out\n");
- // if ((OldPort61hState ^ Port61hState) & 0x20)
- // SpeakerChange();
+
+ if ((OldPort61hState ^ Port61hState) & 0x20)
+ {
+ DPRINT("PitChan2Out -- Port61hState changed\n");
+ SpeakerChange();
+ }
}
/* PRIVATE FUNCTIONS **********************************************************/
+static DWORD OldReloadValue = 0;
+static PIT_MODE OldMode = 0;
+
/* PUBLIC FUNCTIONS ***********************************************************/
VOID SpeakerChange(VOID)
DWORD PitChannel2ReloadValue = PitChannel2->ReloadValue;
if (PitChannel2ReloadValue == 0) PitChannel2ReloadValue = 65536;
+ DPRINT("(1) PitChannel2(Bcd = %s, Mode = %d ; ReloadValue = %d)\n", PitChannel2->Bcd ? "true" : "false", PitChannel2->Mode, PitChannel2ReloadValue);
+
+ if (OldMode == PitChannel2->Mode && OldReloadValue == PitChannel2ReloadValue)
+ return;
+
+ OldMode = PitChannel2->Mode;
+ OldReloadValue = PitChannel2ReloadValue;
+
+ DPRINT("(2) PitChannel2(Bcd = %s, Mode = %d ; ReloadValue = %d)\n", PitChannel2->Bcd ? "true" : "false", PitChannel2->Mode, PitChannel2ReloadValue);
+
/* Set beep data */
- BeepSetParameters.Frequency = (PIT_BASE_FREQUENCY / PitChannel2ReloadValue)
- /* * (PitChannel2->Mode == PIT_MODE_SQUARE_WAVE ? 2 : 1) */;
+ BeepSetParameters.Frequency = (PIT_BASE_FREQUENCY / PitChannel2ReloadValue);
BeepSetParameters.Duration = INFINITE;
/* Send the beep */
IO_STATUS_BLOCK IoStatusBlock;
BEEP_SET_PARAMETERS BeepSetParameters;
+ OldMode = 0;
+ OldReloadValue = 0;
+
/* Set beep data */
BeepSetParameters.Frequency = 0x00;
BeepSetParameters.Duration = 0x00;