Use the SIPoll register to determine how frequent to poll SI
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4447 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d33295a9c4
commit
500497ec2d
|
@ -20,7 +20,9 @@
|
|||
#include "../ConfigManager.h"
|
||||
#include "../CoreTiming.h"
|
||||
|
||||
#include "SystemTimers.h"
|
||||
#include "ProcessorInterface.h"
|
||||
#include "VideoInterface.h"
|
||||
|
||||
#include "SI.h"
|
||||
|
||||
|
@ -246,6 +248,7 @@ void Init()
|
|||
}
|
||||
|
||||
g_Poll.Hex = 0;
|
||||
g_Poll.X = 7;
|
||||
g_ComCSR.Hex = 0;
|
||||
g_StatusReg.Hex = 0;
|
||||
g_EXIClockCount.Hex = 0;
|
||||
|
@ -399,10 +402,12 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
|||
case SI_CHANNEL_3_IN_LO: g_Channel[3].m_InLo.Hex = _iValue; break;
|
||||
|
||||
case SI_POLL:
|
||||
DEBUG_LOG(SERIALINTERFACE, "Poll: X=%03d Y=%03d %s%s%s%s%s%s%s%s",
|
||||
INFO_LOG(SERIALINTERFACE, "Poll: X=%03d Y=%03d %s%s%s%s%s%s%s%s",
|
||||
g_Poll.X, g_Poll.Y,
|
||||
g_Poll.EN0 ? "EN0 ":" ", g_Poll.EN1 ? "EN1 ":" ", g_Poll.EN2 ? "EN2 ":" ", g_Poll.EN3 ? "EN3 ":" ",
|
||||
g_Poll.VBCPY0 ? "VBCPY0 ":" ", g_Poll.VBCPY1 ? "VBCPY1 ":" ", g_Poll.VBCPY2 ? "VBCPY2 ":" ", g_Poll.VBCPY3 ? "VBCPY3 ":" ");
|
||||
g_Poll.EN0 ? "EN0 ":" ", g_Poll.EN1 ? "EN1 ":" ",
|
||||
g_Poll.EN2 ? "EN2 ":" ", g_Poll.EN3 ? "EN3 ":" ",
|
||||
g_Poll.VBCPY0 ? "VBCPY0 ":" ", g_Poll.VBCPY1 ? "VBCPY1 ":" ",
|
||||
g_Poll.VBCPY2 ? "VBCPY2 ":" ", g_Poll.VBCPY3 ? "VBCPY3 ":" ");
|
||||
g_Poll.Hex = _iValue;
|
||||
break;
|
||||
|
||||
|
@ -600,16 +605,26 @@ void RunSIBuffer()
|
|||
else
|
||||
outLength++;
|
||||
|
||||
#if MAX_LOGLEVEL >= INFO_LEVEL
|
||||
#if MAX_LOGLEVEL >= DEBUG_LEVEL
|
||||
int numOutput =
|
||||
#endif
|
||||
g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength);
|
||||
|
||||
INFO_LOG(SERIALINTERFACE, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput);
|
||||
DEBUG_LOG(SERIALINTERFACE, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput);
|
||||
|
||||
// Transfer completed
|
||||
GenerateSIInterrupt(INT_TCINT);
|
||||
g_ComCSR.TSTART = 0;
|
||||
}
|
||||
|
||||
int GetTicksToNextSIPoll()
|
||||
{
|
||||
if (!g_Poll.Y && g_Poll.X)
|
||||
return VideoInterface::GetTicksPerLine() * g_Poll.X;
|
||||
else if (!g_Poll.Y)
|
||||
return SystemTimers::GetTicksPerSecond() / 60;
|
||||
|
||||
return min(VideoInterface::GetTicksPerFrame() / g_Poll.Y, VideoInterface::GetTicksPerLine() * g_Poll.X);
|
||||
}
|
||||
|
||||
} // end of namespace SerialInterface
|
||||
|
|
|
@ -39,6 +39,8 @@ void ChangeDevice(TSIDevices device, int deviceNumber);
|
|||
void Read32(u32& _uReturnValue, const u32 _iAddress);
|
||||
void Write32(const u32 _iValue, const u32 _iAddress);
|
||||
|
||||
int GetTicksToNextSIPoll();
|
||||
|
||||
}; // end of namespace SerialInterface
|
||||
|
||||
#endif
|
||||
|
|
|
@ -184,14 +184,13 @@ void VICallback(u64 userdata, int cyclesLate)
|
|||
WII_IPC_HLE_Interface::Update();
|
||||
|
||||
VideoInterface::Update();
|
||||
CoreTiming::ScheduleEvent(VideoInterface::getTicksPerLine() - cyclesLate, et_VI);
|
||||
CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerLine() - cyclesLate, et_VI);
|
||||
}
|
||||
|
||||
void SICallback(u64 userdata, int cyclesLate)
|
||||
{
|
||||
// TODO make this obey the SIPoll register
|
||||
SerialInterface::UpdateDevices();
|
||||
CoreTiming::ScheduleEvent((GetTicksPerSecond() / 60) - cyclesLate, et_SI);
|
||||
CoreTiming::ScheduleEvent(SerialInterface::GetTicksToNextSIPoll() - cyclesLate, et_SI);
|
||||
}
|
||||
|
||||
void DecrementerCallback(u64 userdata, int cyclesLate)
|
||||
|
@ -286,7 +285,7 @@ void Init()
|
|||
et_PatchEngine = CoreTiming::RegisterEvent("PatchEngine", PatchEngineCallback);
|
||||
|
||||
CoreTiming::ScheduleEvent(AI_PERIOD, et_AI);
|
||||
CoreTiming::ScheduleEvent(VideoInterface::getTicksPerLine(), et_VI);
|
||||
CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerLine(), et_VI);
|
||||
CoreTiming::ScheduleEvent(DSP_PERIOD, et_DSP);
|
||||
CoreTiming::ScheduleEvent(GetTicksPerSecond() / 60, et_SI);
|
||||
CoreTiming::ScheduleEvent(CPU_CORE_CLOCK / (32000 * 4 / 32), et_AudioFifo);
|
||||
|
|
|
@ -1044,12 +1044,18 @@ void UpdateTiming()
|
|||
}
|
||||
}
|
||||
|
||||
int getTicksPerLine() {
|
||||
int GetTicksPerLine()
|
||||
{
|
||||
if (s_lineCount == 0)
|
||||
return 100000;
|
||||
return TicksPerFrame / s_lineCount;
|
||||
}
|
||||
|
||||
int GetTicksPerFrame()
|
||||
{
|
||||
return TicksPerFrame;
|
||||
}
|
||||
|
||||
|
||||
static void BeginField(FieldType field)
|
||||
{
|
||||
|
|
|
@ -54,7 +54,8 @@ namespace VideoInterface
|
|||
// Change values pertaining to video mode
|
||||
void UpdateTiming();
|
||||
|
||||
int getTicksPerLine();
|
||||
int GetTicksPerLine();
|
||||
int GetTicksPerFrame();
|
||||
};
|
||||
|
||||
#endif // _VIDEOINTERFACE_H
|
||||
|
|
Loading…
Reference in New Issue