From 07c1b7d7840d739963a8f074081605cb8eb7d7f6 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 5 Apr 2009 09:23:43 +0000 Subject: [PATCH] tiny DSP cleanup: Move pending exceptions register into SDSP struct. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2869 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp | 2 +- .../Src/gdsp_interpreter.cpp | 27 ++++++++++--------- .../Src/gdsp_interpreter.h | 5 ++++ .../Src/gdsp_registers.h | 6 ++--- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp index 47019f21ee..5ea0ff1e59 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_aram.cpp @@ -17,6 +17,7 @@ #include "Globals.h" #include "gdsp_interface.h" +#include "gdsp_interpreter.h" extern u16 dsp_swap16(u16 x); @@ -63,7 +64,6 @@ s16 ADPCM_Step(u32& _rSamplePos, u32 _BaseAddress) return val; } -extern void gdsp_generate_exception(u8 level); u16 dsp_read_aram() { // u32 BaseAddress = (gdsp_ifx_regs[DSP_ACSAH] << 16) | gdsp_ifx_regs[DSP_ACSAL]; diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp index 5765e4366e..d6c83154fd 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp @@ -47,6 +47,8 @@ u16* SDSP::coef = 0; u8* SDSP::cpu_ram = 0; u16 SDSP::cr = 0; u8 SDSP::reg_stack_ptr[4]; +u8 SDSP::exceptions; + // lets make stack depth to 32 for now u16 SDSP::reg_stack[4][DSP_STACK_DEPTH]; void (*SDSP::irq_request)() = NULL; @@ -63,6 +65,11 @@ u64 SDSP::step_counter = 0; static bool CR_HALT = true; static bool CR_EXTERNAL_INT = false; + +bool gdsp_running; +extern volatile u32 dsp_running; + + void UpdateCachedCR() { CR_HALT = (g_dsp.cr & 0x4) != 0; @@ -131,10 +138,9 @@ void gdsp_reset() } -u8 gdsp_exceptions = 0; void gdsp_generate_exception(u8 level) { - gdsp_exceptions |= 1 << level; + g_dsp.exceptions |= 1 << level; } @@ -269,7 +275,7 @@ void gdsp_step() } // check if there is an external interrupt - if (CR_EXTERNAL_INT) + if (CR_EXTERNAL_INT) { if (dsp_SR_is_flag_set(FLAG_ENABLE_INTERUPT) && (g_dsp.exception_in_progress_hack == false)) { @@ -281,19 +287,19 @@ void gdsp_step() } // check exceptions - if ((gdsp_exceptions > 0) && (!g_dsp.exception_in_progress_hack)) + if ((g_dsp.exceptions != 0) && (!g_dsp.exception_in_progress_hack)) { - for (u8 i=0; i<8; i++) + for (int i = 0; i < 8; i++) { - if (gdsp_exceptions & (1<