mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
HW/ProcessorInterface: Store reference to System in class.
This commit is contained in:
parent
ba852a7812
commit
31d33d0efd
@ -18,6 +18,7 @@
|
|||||||
#include "Core/IOS/IOS.h"
|
#include "Core/IOS/IOS.h"
|
||||||
#include "Core/IOS/STM/STM.h"
|
#include "Core/IOS/STM/STM.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
#include "Core/System.h"
|
||||||
#include "VideoCommon/AsyncRequests.h"
|
#include "VideoCommon/AsyncRequests.h"
|
||||||
#include "VideoCommon/Fifo.h"
|
#include "VideoCommon/Fifo.h"
|
||||||
|
|
||||||
@ -27,6 +28,12 @@ constexpr u32 FLIPPER_REV_A = 0x046500B0;
|
|||||||
constexpr u32 FLIPPER_REV_B = 0x146500B1;
|
constexpr u32 FLIPPER_REV_B = 0x146500B1;
|
||||||
constexpr u32 FLIPPER_REV_C = 0x246500B1;
|
constexpr u32 FLIPPER_REV_C = 0x246500B1;
|
||||||
|
|
||||||
|
ProcessorInterfaceManager::ProcessorInterfaceManager(Core::System& system) : m_system(system)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessorInterfaceManager::~ProcessorInterfaceManager() = default;
|
||||||
|
|
||||||
void ProcessorInterfaceManager::DoState(PointerWrap& p)
|
void ProcessorInterfaceManager::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
p.Do(m_interrupt_mask);
|
p.Do(m_interrupt_mask);
|
||||||
@ -49,8 +56,7 @@ void ProcessorInterfaceManager::Init()
|
|||||||
m_reset_code = 0; // Cold reset
|
m_reset_code = 0; // Cold reset
|
||||||
m_interrupt_cause = INT_CAUSE_RST_BUTTON | INT_CAUSE_VI;
|
m_interrupt_cause = INT_CAUSE_RST_BUTTON | INT_CAUSE_VI;
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
auto& core_timing = m_system.GetCoreTiming();
|
||||||
auto& core_timing = system.GetCoreTiming();
|
|
||||||
m_event_type_toggle_reset_button =
|
m_event_type_toggle_reset_button =
|
||||||
core_timing.RegisterEvent("ToggleResetButton", ToggleResetButtonCallback);
|
core_timing.RegisterEvent("ToggleResetButton", ToggleResetButtonCallback);
|
||||||
m_event_type_ios_notify_reset_button =
|
m_event_type_ios_notify_reset_button =
|
||||||
@ -65,14 +71,14 @@ void ProcessorInterfaceManager::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
|||||||
MMIO::ComplexWrite<u32>([](Core::System& system, u32, u32 val) {
|
MMIO::ComplexWrite<u32>([](Core::System& system, u32, u32 val) {
|
||||||
auto& processor_interface = system.GetProcessorInterface();
|
auto& processor_interface = system.GetProcessorInterface();
|
||||||
processor_interface.m_interrupt_cause &= ~val;
|
processor_interface.m_interrupt_cause &= ~val;
|
||||||
processor_interface.UpdateException(system);
|
processor_interface.UpdateException();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
mmio->Register(base | PI_INTERRUPT_MASK, MMIO::DirectRead<u32>(&m_interrupt_mask),
|
mmio->Register(base | PI_INTERRUPT_MASK, MMIO::DirectRead<u32>(&m_interrupt_mask),
|
||||||
MMIO::ComplexWrite<u32>([](Core::System& system, u32, u32 val) {
|
MMIO::ComplexWrite<u32>([](Core::System& system, u32, u32 val) {
|
||||||
auto& processor_interface = system.GetProcessorInterface();
|
auto& processor_interface = system.GetProcessorInterface();
|
||||||
processor_interface.m_interrupt_mask = val;
|
processor_interface.m_interrupt_mask = val;
|
||||||
processor_interface.UpdateException(system);
|
processor_interface.UpdateException();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
mmio->Register(base | PI_FIFO_BASE, MMIO::DirectRead<u32>(&m_fifo_cpu_base),
|
mmio->Register(base | PI_FIFO_BASE, MMIO::DirectRead<u32>(&m_fifo_cpu_base),
|
||||||
@ -137,9 +143,9 @@ void ProcessorInterfaceManager::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessorInterfaceManager::UpdateException(Core::System& system)
|
void ProcessorInterfaceManager::UpdateException()
|
||||||
{
|
{
|
||||||
auto& ppc_state = system.GetPPCState();
|
auto& ppc_state = m_system.GetPPCState();
|
||||||
if ((m_interrupt_cause & m_interrupt_mask) != 0)
|
if ((m_interrupt_cause & m_interrupt_mask) != 0)
|
||||||
ppc_state.Exceptions |= EXCEPTION_EXTERNAL_INT;
|
ppc_state.Exceptions |= EXCEPTION_EXTERNAL_INT;
|
||||||
else
|
else
|
||||||
@ -209,7 +215,7 @@ void ProcessorInterfaceManager::SetInterrupt(u32 cause_mask, bool set)
|
|||||||
m_interrupt_cause &= ~cause_mask; // is there any reason to have this possibility?
|
m_interrupt_cause &= ~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(Core::System::GetInstance());
|
UpdateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessorInterfaceManager::SetResetButton(bool set)
|
void ProcessorInterfaceManager::SetResetButton(bool set)
|
||||||
@ -252,8 +258,7 @@ void ProcessorInterfaceManager::ResetButton_Tap()
|
|||||||
if (!Core::IsRunning())
|
if (!Core::IsRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
auto& core_timing = m_system.GetCoreTiming();
|
||||||
auto& core_timing = system.GetCoreTiming();
|
|
||||||
core_timing.ScheduleEvent(0, m_event_type_toggle_reset_button, true, CoreTiming::FromThread::ANY);
|
core_timing.ScheduleEvent(0, m_event_type_toggle_reset_button, true, CoreTiming::FromThread::ANY);
|
||||||
core_timing.ScheduleEvent(0, m_event_type_ios_notify_reset_button, 0,
|
core_timing.ScheduleEvent(0, m_event_type_ios_notify_reset_button, 0,
|
||||||
CoreTiming::FromThread::ANY);
|
CoreTiming::FromThread::ANY);
|
||||||
@ -266,8 +271,7 @@ void ProcessorInterfaceManager::PowerButton_Tap()
|
|||||||
if (!Core::IsRunning())
|
if (!Core::IsRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
auto& core_timing = m_system.GetCoreTiming();
|
||||||
auto& core_timing = system.GetCoreTiming();
|
|
||||||
core_timing.ScheduleEvent(0, m_event_type_ios_notify_power_button, 0,
|
core_timing.ScheduleEvent(0, m_event_type_ios_notify_power_button, 0,
|
||||||
CoreTiming::FromThread::ANY);
|
CoreTiming::FromThread::ANY);
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,13 @@ enum
|
|||||||
class ProcessorInterfaceManager
|
class ProcessorInterfaceManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
explicit ProcessorInterfaceManager(Core::System& system);
|
||||||
|
ProcessorInterfaceManager(const ProcessorInterfaceManager& other) = delete;
|
||||||
|
ProcessorInterfaceManager(ProcessorInterfaceManager&& other) = delete;
|
||||||
|
ProcessorInterfaceManager& operator=(const ProcessorInterfaceManager& other) = delete;
|
||||||
|
ProcessorInterfaceManager& operator=(ProcessorInterfaceManager&& other) = delete;
|
||||||
|
~ProcessorInterfaceManager();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
@ -87,7 +94,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Let the PPC know that an external exception is set/cleared
|
// Let the PPC know that an external exception is set/cleared
|
||||||
void UpdateException(Core::System& system);
|
void UpdateException();
|
||||||
|
|
||||||
void SetResetButton(bool set);
|
void SetResetButton(bool set);
|
||||||
|
|
||||||
@ -101,5 +108,7 @@ private:
|
|||||||
CoreTiming::EventType* m_event_type_ios_notify_power_button = nullptr;
|
CoreTiming::EventType* m_event_type_ios_notify_power_button = nullptr;
|
||||||
|
|
||||||
u32 m_reset_code = 0;
|
u32 m_reset_code = 0;
|
||||||
|
|
||||||
|
Core::System& m_system;
|
||||||
};
|
};
|
||||||
} // namespace ProcessorInterface
|
} // namespace ProcessorInterface
|
||||||
|
@ -38,7 +38,8 @@ struct System::Impl
|
|||||||
explicit Impl(System& system)
|
explicit Impl(System& system)
|
||||||
: m_audio_interface(system), m_core_timing(system), m_dsp(system), m_dvd_interface(system),
|
: m_audio_interface(system), m_core_timing(system), m_dsp(system), m_dvd_interface(system),
|
||||||
m_dvd_thread(system), m_expansion_interface(system), m_gp_fifo(system), m_memory(system),
|
m_dvd_thread(system), m_expansion_interface(system), m_gp_fifo(system), m_memory(system),
|
||||||
m_ppc_state(PowerPC::ppcState), m_serial_interface(system), m_video_interface(system)
|
m_ppc_state(PowerPC::ppcState), m_processor_interface(system), m_serial_interface(system),
|
||||||
|
m_video_interface(system)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user