[Lapetus-cvs] lapetus/tests/regtest dsp.c,1.1,1.2
Status: Inactive
Brought to you by:
cyberwarriorx
From: Theo B. <cyb...@us...> - 2008-01-12 21:43:43
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv654 Modified Files: dsp.c Log Message: -Fixed the DSP tests Index: dsp.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/dsp.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dsp.c 7 Jan 2008 03:10:46 -0000 1.1 +++ dsp.c 12 Jan 2008 21:43:37 -0000 1.2 @@ -60,10 +60,11 @@ // Clear out program control port u32 testval = SCUREG_PPAF; // Make sure program is stopped, etc. - SCUREG_PPAF = 0; + DSPStop(); - if (SCUREG_PPAF != 0) + if (DSPIsExec()) { + VdpPrintf(&testdispfont, 0 * 8, 20 * 8, 0xF, "DSPIsExec() == 1"); stagestatus = STAGESTAT_BADDATA; return; } @@ -72,23 +73,30 @@ SCUREG_PPAF = 0x8000; // Upload our program(END instruction) - SCUREG_PPD = 0xF0000000; + SCUREG_PPD = END(); SCUREG_PPD = 0x00000000; + SCUREG_PPD = END(); + SCUREG_PPD = END(); + SCUREG_PPD = END(); + SCUREG_PPD = END(); - if ((SCUREG_PPAF & 0xFF) != 0x02) + if ((SCUREG_PPAF & 0xFF) != 0x06) { stagestatus = STAGESTAT_BADDATA; return; } // Start executing program - SCUREG_PPAF = 0x10000; + DSPExec(0); // Check the flags - while ((testval = SCUREG_PPAF) & 0x10000) {} + while (DSPIsExec()) {} - if (testval != 0x01) + testval = SCUREG_PPAF; + + if (testval != 0x02) { + VdpPrintf(&testdispfont, 0 * 8, 20 * 8, 0xF, "testval != 0x02(%08X)", testval); stagestatus = STAGESTAT_BADDATA; return; } @@ -132,7 +140,7 @@ void TestMVI_Imm_d() { - FillDSPProg(0xF0000000); + FillDSPProg(END()); dspprog[0] = MOV_Imm_d(0, MOVDEST_CT0); dspprog[1] = MOV_Imm_d(0, MOVDEST_CT1); @@ -155,14 +163,16 @@ dspprog[8] = 0xB1FEEDED; // NOP dspprog[9] = NOP(); + dspprog[0xEE] = NOP(); if (DSPLoad(dspprog, 0, 255) != LAPETUS_ERR_OK) { + VdpPrintf(&testdispfont, 0 * 8, 20 * 8, 0xF, "DSPLoad error"); stagestatus = STAGESTAT_BADDATA; return; } - DSPExec(); + DSPExec(0); // Wait until we're done while (SCUREG_PPAF & 0x10000) {} @@ -171,6 +181,7 @@ SCUREG_PDA = (0 << 6) | 0; if (SCUREG_PDD != 0xFF0DEAD0) { + VdpPrintf(&testdispfont, 0 * 8, 21 * 8, 0xF, "SCUREG_PDD != 0xFF0DEAD0(%08X)", SCUREG_PDD); stagestatus = STAGESTAT_BADDATA; return; } @@ -178,6 +189,7 @@ SCUREG_PDA = (1 << 6) | 0; if (SCUREG_PDD != 0xFF1DEAD0) { + VdpPrintf(&testdispfont, 0 * 8, 22 * 8, 0xF, "SCUREG_PDD != 0xFF1DEAD0(%08X)", SCUREG_PDD); stagestatus = STAGESTAT_BADDATA; return; } @@ -185,6 +197,7 @@ SCUREG_PDA = (2 << 6) | 0; if (SCUREG_PDD != 0xFF2DEAD0) { + VdpPrintf(&testdispfont, 0 * 8, 22 * 8, 0xF, "SCUREG_PDD != 0xFF2DEAD0(%08X)", SCUREG_PDD); stagestatus = STAGESTAT_BADDATA; return; } @@ -192,13 +205,15 @@ SCUREG_PDA = (3 << 6) | 0; if (SCUREG_PDD != 0xFF3DEAD0) { + VdpPrintf(&testdispfont, 0 * 8, 22 * 8, 0xF, "SCUREG_PDD != 0xFF3DEAD0(%08X)", SCUREG_PDD); stagestatus = STAGESTAT_BADDATA; return; } // Ok, that looks good. Now check the PC, and we're done! - if ((SCUREG_PPAF & 0xFF) != 0xEE) + if ((SCUREG_PPAF & 0xFF) != 0xEF) { + VdpPrintf(&testdispfont, 0 * 8, 22 * 8, 0xF, "(SCUREG_PPAF & 0xFF) != 0xEF(%08X)", SCUREG_PPAF); stagestatus = STAGESTAT_BADDATA; return; } @@ -214,13 +229,13 @@ u32 freq; u32 starttime; u32 endtime; + u32 testval; FillDSPProg(NOP()); dspprog[0] = CLR_A(); dspprog[1] = MOV_Imm_d(1, MOVDEST_PL); - dspprog[2] = ADD(); - dspprog[3] = MOV_ALU_A(); + dspprog[2] = ADD() | MOV_ALU_A(); dspprog[4] = MOV_Imm_d(0, MOVDEST_CT0); dspprog[5] = MOV_s_d(MOVSRC_ALUL, MOVDEST_MC0); dspprog[249] = JMP_Imm(2); @@ -229,30 +244,34 @@ if (DSPLoad(dspprog, 0, 255) != LAPETUS_ERR_OK) { + VdpPrintf(&testdispfont, 0 * 8, 20 * 8, 0xF, "DSPLoad error"); stagestatus = STAGESTAT_BADDATA; return; } starttime = TimerCounter(); - DSPExec(); + DSPExec(0); // Wait about X number of seconds, etc. - while (((endtime = TimerCounter()) - starttime) < (224 * 60)) {} + while (((endtime = TimerCounter()) - starttime) < (224 * 60)) { + if (!DSPIsExec()) + VdpPrintf(&testdispfont, 0 * 8, 25 * 8, 0xF, "DSP stopped prematurely"); + } // Stop DSP, check counter in data ram to see how much got executed DSPStop(); // Now we can figure out how much time it took SCUREG_PDA = (0 << 6) | 0; - VdpPrintf(&testdispfont, 0 * 8, 23 * 8, 0xF, "%08X", SCUREG_PDD); + testval = SCUREG_PDD; -/* - if (SCUREG_PDD != ??) + if (testval != 0xB40F) { + VdpPrintf(&testdispfont, 0 * 8, 23 * 8, 0xF, "SCUREG_PDD != 0xB40F(%08X)", testval); stagestatus = STAGESTAT_BADTIMING; return; } -*/ + stagestatus = STAGESTAT_DONE; } |