From aac42066645b44021ab12cb16991b63516b682f6 Mon Sep 17 00:00:00 2001 From: magumagu Date: Thu, 27 Mar 2014 15:51:57 -0700 Subject: [PATCH] Move UDSPControl structure into DSP.h . --- Source/Core/AudioCommon/AudioCommon.h | 25 ---------------------- Source/Core/Core/HW/DSP.cpp | 30 +-------------------------- Source/Core/Core/HW/DSP.h | 29 ++++++++++++++++++++++++++ Source/Core/Core/HW/DSPHLE/DSPHLE.cpp | 2 +- Source/Core/Core/HW/DSPHLE/DSPHLE.h | 3 ++- Source/Core/Core/HW/DSPLLE/DSPLLE.cpp | 6 +----- 6 files changed, 34 insertions(+), 61 deletions(-) diff --git a/Source/Core/AudioCommon/AudioCommon.h b/Source/Core/AudioCommon/AudioCommon.h index 054c0fe47e..a44d9ef6b5 100644 --- a/Source/Core/AudioCommon/AudioCommon.h +++ b/Source/Core/AudioCommon/AudioCommon.h @@ -12,31 +12,6 @@ class CMixer; extern SoundStream *soundStream; -// UDSPControl -union UDSPControl -{ - u16 Hex; - struct - { - u16 DSPReset : 1; // Write 1 to reset and waits for 0 - u16 DSPAssertInt : 1; - u16 DSPHalt : 1; - - u16 AI : 1; - u16 AI_mask : 1; - u16 ARAM : 1; - u16 ARAM_mask : 1; - u16 DSP : 1; - u16 DSP_mask : 1; - - u16 ARAM_DMAState : 1; // DSPGetDMAStatus() uses this flag - u16 DSPInitCode : 1; - u16 DSPInit : 1; // DSPInit() writes to this flag - u16 pad : 4; - }; - UDSPControl(u16 _Hex = 0) : Hex(_Hex) {} -}; - namespace AudioCommon { SoundStream *InitSoundStream(CMixer *mixer, void *hWnd); diff --git a/Source/Core/Core/HW/DSP.cpp b/Source/Core/Core/HW/DSP.cpp index 858f7ff748..114a23b1e8 100644 --- a/Source/Core/Core/HW/DSP.cpp +++ b/Source/Core/Core/HW/DSP.cpp @@ -76,34 +76,6 @@ union UARAMCount }; }; -// UDSPControl -#define DSP_CONTROL_MASK 0x0C07 -union UDSPControl -{ - u16 Hex; - struct - { - // DSP Control - u16 DSPReset : 1; // Write 1 to reset and waits for 0 - u16 DSPAssertInt : 1; - u16 DSPHalt : 1; - // Interrupt for DMA to the AI/speakers - u16 AID : 1; - u16 AID_mask : 1; - // ARAM DMA interrupt - u16 ARAM : 1; - u16 ARAM_mask : 1; - // DSP DMA interrupt - u16 DSP : 1; - u16 DSP_mask : 1; - // Other ??? - u16 DMAState : 1; // DSPGetDMAStatus() uses this flag. __ARWaitForDMA() uses it too...maybe it's just general DMA flag - u16 unk3 : 1; - u16 DSPInit : 1; // DSPInit() writes to this flag - u16 pad : 4; - }; -}; - // DSPState struct DSPState { @@ -394,7 +366,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) if (tmpControl.DSP) g_dspState.DSPControl.DSP = 0; // unknown - g_dspState.DSPControl.unk3 = tmpControl.unk3; + g_dspState.DSPControl.DSPInitCode = tmpControl.DSPInitCode; g_dspState.DSPControl.pad = tmpControl.pad; if (g_dspState.DSPControl.pad != 0) { diff --git a/Source/Core/Core/HW/DSP.h b/Source/Core/Core/HW/DSP.h index 2a9475a210..293a4a6733 100644 --- a/Source/Core/Core/HW/DSP.h +++ b/Source/Core/Core/HW/DSP.h @@ -27,6 +27,35 @@ enum ARAM_MASK = 0x00FFFFFF, }; +// UDSPControl +#define DSP_CONTROL_MASK 0x0C07 +union UDSPControl +{ + u16 Hex; + struct + { + // DSP Control + u16 DSPReset : 1; // Write 1 to reset and waits for 0 + u16 DSPAssertInt : 1; + u16 DSPHalt : 1; + // Interrupt for DMA to the AI/speakers + u16 AID : 1; + u16 AID_mask : 1; + // ARAM DMA interrupt + u16 ARAM : 1; + u16 ARAM_mask : 1; + // DSP DMA interrupt + u16 DSP : 1; + u16 DSP_mask : 1; + // Other ??? + u16 DMAState : 1; // DSPGetDMAStatus() uses this flag. __ARWaitForDMA() uses it too...maybe it's just general DMA flag + u16 DSPInitCode : 1; // Indicator that the DSP was initialized? + u16 DSPInit : 1; // DSPInit() writes to this flag + u16 pad : 4; + }; + UDSPControl(u16 _Hex = 0) : Hex(_Hex) {} +}; + void Init(bool hle); void Shutdown(); diff --git a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp index eb7ca52ab8..77284665c3 100644 --- a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp @@ -274,7 +274,7 @@ void DSPHLE::InitMixer() // Other DSP fuctions u16 DSPHLE::DSP_WriteControlRegister(unsigned short _Value) { - UDSPControl Temp(_Value); + DSP::UDSPControl Temp(_Value); if (!m_InitMixer) { if (!Temp.DSPHalt) diff --git a/Source/Core/Core/HW/DSPHLE/DSPHLE.h b/Source/Core/Core/HW/DSPHLE/DSPHLE.h index 3a8df834a6..4642f9d9b2 100644 --- a/Source/Core/Core/HW/DSPHLE/DSPHLE.h +++ b/Source/Core/Core/HW/DSPHLE/DSPHLE.h @@ -8,6 +8,7 @@ #include "AudioCommon/SoundStream.h" #include "Core/DSPEmulator.h" +#include "Core/HW/DSP.h" #include "Core/HW/DSPHLE/MailHandler.h" class IUCode; @@ -73,7 +74,7 @@ private: IUCode* m_pUCode; IUCode* m_lastUCode; - UDSPControl m_DSPControl; + DSP::UDSPControl m_DSPControl; CMailHandler m_MailHandler; bool m_bHalt; diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp index 420d5dc84d..796df42734 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp @@ -192,13 +192,9 @@ void DSPLLE::InitMixer() u16 DSPLLE::DSP_WriteControlRegister(u16 _uFlag) { - UDSPControl Temp(_uFlag); if (!m_InitMixer) { - if (!Temp.DSPHalt) - { - InitMixer(); - } + InitMixer(); } DSPInterpreter::WriteCR(_uFlag);