DSPSPY improvements

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4352 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Marko Pusljar 2009-10-01 15:12:12 +00:00
parent c6f0335b62
commit f099ea7be4
5 changed files with 82 additions and 29 deletions

View File

@ -183,7 +183,7 @@ void DSPCore_CheckExceptions()
// but for sure they should not be called together therefore the
// g_dsp.exception_in_progress
if (g_dsp.exception_in_progress != -1) {
#ifdef DEBUG_EXP
#if defined(_DEBUG) || defined(DEBUGFAST)
ERROR_LOG(DSPLLE, "Firing exception %d failed exception %d active", g_dsp.exceptions, g_dsp.exception_in_progress);
#endif
return;
@ -206,7 +206,7 @@ void DSPCore_CheckExceptions()
g_dsp.exception_in_progress = i;
break;
} else {
#ifdef DEBUG_EXP
#if defined(_DEBUG) || defined(DEBUGFAST)
ERROR_LOG(DSPLLE, "Firing exception %d failed", i);
#endif
}

View File

@ -87,7 +87,7 @@ void gdsp_mbox_write_l(u8 mbx, u16 val)
if (DSPHost_OnThread())
g_CriticalSection.Leave();
#ifdef DEBUG_EXP
#if defined(_DEBUG) || defined(DEBUGFAST)
if (mbx == GDSP_MBOX_DSP)
{
NOTICE_LOG(DSP_MAIL, "DSP(WM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
@ -116,7 +116,7 @@ u16 gdsp_mbox_read_l(u8 mbx)
if (DSPHost_OnThread())
g_CriticalSection.Leave();
#ifdef DEBUG_EXP
#if defined(_DEBUG) || defined(DEBUGFAST)
if (mbx == GDSP_MBOX_DSP)
{
NOTICE_LOG(DSP_MAIL, "DSP(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
@ -315,7 +315,7 @@ void gdsp_do_dma()
ERROR_LOG(DSPLLE, "DMA ERROR pc: %04x ctl: %04x addr: %08x da: %04x size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len);
exit(0);
}
#ifdef DEBUG_EXP
#if defined(_DEBUG) || defined(DEBUGFAST)
NOTICE_LOG(DSPLLE, "DMA pc: %04x ctl: %04x addr: %08x da: %04x size: %04x", g_dsp.pc, ctl, addr, dsp_addr, len);
#endif
switch (ctl & 0x3)

View File

@ -22,7 +22,6 @@
// emulation core can access the environment it runs in. If the emulation
// core isn't used, for example in an asm/disasm tool, then most of these
// can be stubbed out.
#define DEBUG_EXP 1
u8 DSPHost_ReadHostMemory(u32 addr);
void DSPHost_WriteHostMemory(u8 value, u32 addr);

View File

@ -45,6 +45,7 @@
#ifdef HW_RVL
#include <wiiuse/wpad.h>
#include <sdcard/wiisd_io.h>
#endif
#include "ConsoleHelper.h"
@ -392,9 +393,16 @@ void handle_dsp_mail(void)
}
}
void dump_all_ucodes(void)
void dump_all_ucodes(bool fastmode)
{
char filename[260] = {0};
char temp[100];
u32 written;
sprintf(filename, "sd:/dsp_dump_all.bin");
FILE *f2 = fopen(filename, "wb");
fclose(f2);
for (int UCodeToDump = 0; UCodeToDump < NUM_UCODES; UCodeToDump++)
{
// First, change the microcode
@ -414,22 +422,55 @@ void dump_all_ucodes(void)
handle_dsp_mail();
VIDEO_WaitVSync();
// Then write microcode dump to file
sprintf(filename, "sd:/dsp_dump%d.bin", UCodeToDump);
FILE *f = fopen(filename, "wb");
if (f)
{
// First write initial regs
u32 written = fwrite(dspreg_in, 1, 32 * 2, f);
sprintf(filename, "sd:/dsp_dump_all.bin");
FILE *f2 = fopen(filename, "ab");
// Then write all the dumps.
written += fwrite(dspreg_out, 1, dsp_steps * 32 * 2, f);
fclose(f);
CON_PrintRow(4, 24, "Dump %i Successful. Wrote %d bytes, steps: %d", UCodeToDump, written, dsp_steps);
if (fastmode == false)
{
// Then write microcode dump to file
sprintf(filename, "sd:/dsp_dump%d.bin", UCodeToDump);
FILE *f = fopen(filename, "wb");
if (f)
{
// First write initial regs
written = fwrite(dspreg_in, 1, 32 * 2, f);
// Then write all the dumps.
written += fwrite(dspreg_out, 1, dsp_steps * 32 * 2, f);
fclose(f);
}
else
{
UpdateLastMessage("SD Write Error");
break;
}
}
if (f2) //all in 1 dump file (extra)
{
if (UCodeToDump == 0) {
// First write initial regs
written = fwrite(dspreg_in, 1, 32 * 2, f2);
written += fwrite(dspreg_out, 1, dsp_steps * 32 * 2, f2);
}
else {
written = fwrite(dspreg_out, 1, dsp_steps * 32 * 2, f2);
}
fclose(f2);
if (UCodeToDump < NUM_UCODES-1)
{
sprintf(temp, "Dump %d Successful. Wrote %d bytes, steps: %d", UCodeToDump+1, written, dsp_steps);
UpdateLastMessage(temp);
}
else {
UpdateLastMessage("DUMPING DONE!");
}
}
else
{
CON_PrintRow(4, 24, "Dump %i Failed", UCodeToDump);
UpdateLastMessage("SD Write Error");
break;
}
}
@ -472,7 +513,8 @@ void InitGeneral()
#ifdef HW_RVL
// Initialize FAT so we can write to SD.
fatInit(8, false);
__io_wiisd.startup();
fatMountSimple("sd", &__io_wiisd);
#else
// Init debug over BBA...change IPs to suite your needs
tcp_localip="192.168.1.103";
@ -484,6 +526,11 @@ void InitGeneral()
void ExitToLoader()
{
#ifdef HW_RVL
fatUnmount("sd");
__io_wiisd.shutdown();
#endif
UpdateLastMessage("Exiting...");
real_dsp.Reset();
reboot();
@ -523,16 +570,16 @@ int main()
ExitToLoader();
CON_Printf(2, 18, "Controls:");
CON_Printf(4, 19, "+/- to move");
CON_Printf(4, 20, "A to edit register, B to start over");
CON_Printf(4, 21, "1 to move to next microcode");
CON_Printf(4, 22, "2 to dump all microcode results to SD");
CON_Printf(4, 23, "Home to exit");
CON_Printf(4, 19, "+/- (GC:'L'/'R') to move");
CON_Printf(4, 20, "A (GC:'A') to edit register; B (GC:'B') to start over");
CON_Printf(4, 21, "1 (GC:'Z') to move next microcode");
CON_Printf(4, 22, "2 (GC:'X') dump results to SD; UP (GC:'Y') dump results to SD (SINGLE FILE)");
CON_Printf(4, 23, "Home (GC:'START') to exit");
#else
CON_Printf(2, 18, "Controls:");
CON_Printf(4, 19, "L/R to move");
CON_Printf(4, 21, "A to edit register, B to start over");
CON_Printf(4, 20, "Z to move to next microcode");
CON_Printf(4, 20, "A to edit register, B to start over");
CON_Printf(4, 21, "Z to move to next microcode");
CON_Printf(4, 22, "Start to exit");
#endif
@ -630,9 +677,16 @@ int main()
// The future is web-based reporting ;)
if ((WPAD_ButtonsDown(0) & WPAD_BUTTON_2) || (PAD_ButtonsDown(0) & PAD_BUTTON_X))
{
dump_all_ucodes();
dump_all_ucodes(false);
}
// Dump all results into 1 file (skip file per ucode part) = FAST because of LIBFAT filecreate bug
if ((WPAD_ButtonsDown(0) & WPAD_BUTTON_UP) || (PAD_ButtonsDown(0) & PAD_BUTTON_Y))
{
dump_all_ucodes(true);
}
#endif
} // end main loop
ExitToLoader();

View File

@ -58,7 +58,7 @@ bool DSPHost_Running()
void DSPHost_InterruptRequest()
{
#ifdef DEBUG_EXP
#if defined(_DEBUG) || defined(DEBUGFAST)
NOTICE_LOG(DSPLLE, "Firing an interrupt on the PPC ASAP");
#endif
// Fire an interrupt on the PPC ASAP.