mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-25 06:44:59 +00:00
Merge pull request #6620 from lioncash/dvd
DVDInterface: Deduplicate code in UpdateInterrupts()
This commit is contained in:
commit
67f8e6e60a
3 changed files with 18 additions and 22 deletions
|
@ -588,15 +588,11 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
|
|
||||||
void UpdateInterrupts()
|
void UpdateInterrupts()
|
||||||
{
|
{
|
||||||
if ((s_DISR.DEINT & s_DISR.DEINITMASK) || (s_DISR.TCINT & s_DISR.TCINTMASK) ||
|
const bool set_mask = (s_DISR.DEINT & s_DISR.DEINITMASK) || (s_DISR.TCINT & s_DISR.TCINTMASK) ||
|
||||||
(s_DISR.BRKINT & s_DISR.BRKINTMASK) || (s_DICVR.CVRINT & s_DICVR.CVRINTMASK))
|
(s_DISR.BRKINT & s_DISR.BRKINTMASK) ||
|
||||||
{
|
(s_DICVR.CVRINT & s_DICVR.CVRINTMASK);
|
||||||
ProcessorInterface::SetInterrupt(ProcessorInterface::INT_CAUSE_DI, true);
|
|
||||||
}
|
ProcessorInterface::SetInterrupt(ProcessorInterface::INT_CAUSE_DI, set_mask);
|
||||||
else
|
|
||||||
{
|
|
||||||
ProcessorInterface::SetInterrupt(ProcessorInterface::INT_CAUSE_DI, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Required for Summoner: A Goddess Reborn
|
// Required for Summoner: A Goddess Reborn
|
||||||
CoreTiming::ForceExceptionCheck(50);
|
CoreTiming::ForceExceptionCheck(50);
|
||||||
|
|
|
@ -135,9 +135,9 @@ void UpdateException()
|
||||||
PowerPC::ppcState.Exceptions &= ~EXCEPTION_EXTERNAL_INT;
|
PowerPC::ppcState.Exceptions &= ~EXCEPTION_EXTERNAL_INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* Debug_GetInterruptName(u32 _causemask)
|
static const char* Debug_GetInterruptName(u32 cause_mask)
|
||||||
{
|
{
|
||||||
switch (_causemask)
|
switch (cause_mask)
|
||||||
{
|
{
|
||||||
case INT_CAUSE_PI:
|
case INT_CAUSE_PI:
|
||||||
return "INT_CAUSE_PI";
|
return "INT_CAUSE_PI";
|
||||||
|
@ -176,33 +176,33 @@ static const char* Debug_GetInterruptName(u32 _causemask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetInterrupt(u32 _causemask, bool _bSet)
|
void SetInterrupt(u32 cause_mask, bool set)
|
||||||
{
|
{
|
||||||
DEBUG_ASSERT_MSG(POWERPC, Core::IsCPUThread(), "SetInterrupt from wrong thread");
|
DEBUG_ASSERT_MSG(POWERPC, Core::IsCPUThread(), "SetInterrupt from wrong thread");
|
||||||
|
|
||||||
if (_bSet && !(m_InterruptCause & _causemask))
|
if (set && !(m_InterruptCause & cause_mask))
|
||||||
{
|
{
|
||||||
DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (set)", Debug_GetInterruptName(_causemask));
|
DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (set)", Debug_GetInterruptName(cause_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_bSet && (m_InterruptCause & _causemask))
|
if (!set && (m_InterruptCause & cause_mask))
|
||||||
{
|
{
|
||||||
DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (clear)",
|
DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (clear)",
|
||||||
Debug_GetInterruptName(_causemask));
|
Debug_GetInterruptName(cause_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_bSet)
|
if (set)
|
||||||
m_InterruptCause |= _causemask;
|
m_InterruptCause |= cause_mask;
|
||||||
else
|
else
|
||||||
m_InterruptCause &= ~_causemask; // is there any reason to have this possibility?
|
m_InterruptCause &= ~cause_mask; // is there any reason to have this possibility?
|
||||||
// F|RES: i think the hw devices reset the interrupt in the PI to 0
|
// F|RES: i think the hw devices reset the interrupt in the PI to 0
|
||||||
// if the interrupt cause is eliminated. that isn't done by software (afaik)
|
// if the interrupt cause is eliminated. that isn't done by software (afaik)
|
||||||
UpdateException();
|
UpdateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetResetButton(bool _bSet)
|
static void SetResetButton(bool set)
|
||||||
{
|
{
|
||||||
SetInterrupt(INT_CAUSE_RST_BUTTON, !_bSet);
|
SetInterrupt(INT_CAUSE_RST_BUTTON, !set);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ToggleResetButtonCallback(u64 userdata, s64 cyclesLate)
|
static void ToggleResetButtonCallback(u64 userdata, s64 cyclesLate)
|
||||||
|
|
|
@ -73,7 +73,7 @@ inline u32 GetCause()
|
||||||
return m_InterruptCause;
|
return m_InterruptCause;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetInterrupt(u32 _causemask, bool _bSet = true);
|
void SetInterrupt(u32 cause_mask, bool set = true);
|
||||||
|
|
||||||
// Thread-safe func which sets and clears reset button state automagically
|
// Thread-safe func which sets and clears reset button state automagically
|
||||||
void ResetButton_Tap();
|
void ResetButton_Tap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue