Thread: [Lapetus-cvs] lapetus/tests/regtest scu.c,1.2,1.3 scu.h,1.2,1.3
Status: Inactive
Brought to you by:
cyberwarriorx
From: Theo B. <cyb...@us...> - 2008-01-12 18:17:55
|
Update of /cvsroot/lapetus/lapetus/tests/regtest In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16517 Modified Files: scu.c scu.h Log Message: -Fixed interrupt tests -Added SCU VER register and Interrupt tests to menu. Index: scu.h =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/scu.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- scu.h 8 Jan 2008 09:28:40 -0000 1.2 +++ scu.h 12 Jan 2008 18:17:51 -0000 1.3 @@ -48,6 +48,7 @@ void TestDSP(); void TestMVI_Imm_d(); +void scuregistertest(void); void scuinttest(void); void scudmatest(); void scudsptest(); Index: scu.c =================================================================== RCS file: /cvsroot/lapetus/lapetus/tests/regtest/scu.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- scu.c 8 Jan 2008 09:28:40 -0000 1.2 +++ scu.c 12 Jan 2008 18:17:51 -0000 1.3 @@ -65,11 +65,11 @@ int choice; MENUITEMSTRUCT scumenu[] = { -// { "SCU Register Test", &scuregistertest, }, - -// { "SCU Interrupt Test", &scuinttest, }, - { "SCU DMA Test" , &scudmatest, }, - { "SCU DSP Test" , &scudsptest, }, + { "Register Test", &scuregistertest, }, + { "Interrupt Test", &scuinttest, }, + { "DMA Test" , &scudmatest, }, + { "DSP Test" , &scudsptest, }, +// { "Misc" , &scumisctest, }, { "Go back to main menu", NULL }, { "\0", NULL } }; @@ -84,8 +84,8 @@ } ////////////////////////////////////////////////////////////////////////////// -/* -void scuinttest(void) + +void scuregistertest(void) { InterruptSetLevelMask(0xF); @@ -101,7 +101,7 @@ DoTests("SCU Register tests", 0, 0); } -*/ + ////////////////////////////////////////////////////////////////////////////// void scuinttest() @@ -116,16 +116,16 @@ VdpDispOn(); UnregisterAllTests(); - RegisterTest(&TestISTandIMS, "Interrupt status and mask"); +// RegisterTest(&TestISTandIMS, "Interrupt status and mask"); RegisterTest(&TestVBlankInInterrupt, "Vblank-out Interrupt"); RegisterTest(&TestVBlankOutInterrupt, "Vblank-in Interrupt"); RegisterTest(&TestHBlankInInterrupt, "HBlank-in Interrupt"); RegisterTest(&TestTimer0Interrupt, "Timer 0 Interrupt"); RegisterTest(&TestTimer1Interrupt, "Timer 1 Interrupt"); -// RegisterTest(&TestDSPEndInterrupt, "DSP End Interrupt"); + RegisterTest(&TestDSPEndInterrupt, "DSP End Interrupt"); RegisterTest(&TestSoundRequestInterrupt, "Sound Request Interrupt"); -// RegisterTest(&TestSMPCInterrupt, "SMPC Interrupt"); -// RegisterTest(&TestPadInterrupt, "Pad Interrupt"); + RegisterTest(&TestSMPCInterrupt, "SMPC Interrupt"); + RegisterTest(&TestPadInterrupt, "Pad Interrupt"); RegisterTest(&TestDMA0Interrupt, "DMA0 Interrupt"); RegisterTest(&TestDMA1Interrupt, "DMA1 Interrupt"); RegisterTest(&TestDMA2Interrupt, "DMA2 Interrupt"); @@ -135,7 +135,6 @@ // If Netlink is connected, do a test on it too // if (NetlinkInit() == LAPETUS_ERR_OK) // RegisterTest(&TestNetlinkInterrupt, "Netlink Interrupt"); - DoTests("SCU Interrupt tests", 0, 0); } @@ -171,10 +170,6 @@ void TestSCUVERRegister() { // Make sure it's at least version 4 - VdpPrintf(&testdispfont, 0 * 8, 23 * 8, 0xF, "%08X", SCUREG_PPAF); - SCUREG_PPAF = 0; - VdpPrintf(&testdispfont, 0 * 8, 24 * 8, 0xF, "%08X", SCUREG_PPAF); - if (SCUREG_VER < 4) stagestatus = STAGESTAT_BADDATA; else @@ -207,8 +202,6 @@ { // Need to do an A-bus interrupt acknowledge } - - VdpPrintf(&testdispfont, 0 * 8, 25 * 8, 0xF, "int"); } ////////////////////////////////////////////////////////////////////////////// @@ -216,23 +209,21 @@ void SetupInterrupt(u8 vector, u32 mask) { InterruptSetLevelMask(0xF); - VdpPrintf(&testdispfont, 0 * 8, 25 * 8, 0xF, " "); - VdpPrintf(&testdispfont, 0 * 8, 24 * 8, 0xF, "setup start"); intvector = vector; stagestatus = STAGESTAT_WAITINGFORINT; oldfunc = BIOS_GetSCUInterrupt(intvector); oldmask = BIOS_GetSCUInterruptMask(); + BIOS_SetSCUInterruptMask(0xFFFFFFFF); BIOS_SetSCUInterrupt(intvector, testintfunc); isinttime = 1; BIOS_ChangeSCUInterruptMask(~mask, 0); - VdpPrintf(&testdispfont, 0 * 8, 24 * 8, 0xF, "setup done "); } ////////////////////////////////////////////////////////////////////////////// void TestVBlankInInterrupt() { - SetupInterrupt(0x40, 0x0001); + SetupInterrupt(0x40, MASK_VBLANKIN); InterruptSetLevelMask(0xE); } @@ -241,7 +232,7 @@ void TestVBlankOutInterrupt() { - SetupInterrupt(0x41, 0x0002); + SetupInterrupt(0x41, MASK_VBLANKOUT); InterruptSetLevelMask(0xD); } @@ -250,7 +241,7 @@ void TestHBlankInInterrupt() { - SetupInterrupt(0x42, 0x0004); + SetupInterrupt(0x42, MASK_HBLANKIN); InterruptSetLevelMask(0xC); } @@ -259,9 +250,10 @@ void TestTimer0Interrupt() { - SetupInterrupt(0x43, 0x0008); + SetupInterrupt(0x43, MASK_TIMER0); - // Enable Timer 0 + // Enable Timer 0 compare + SCUREG_T1MD = 0x001; SCUREG_T0C = 19; InterruptSetLevelMask(0xB); @@ -274,7 +266,7 @@ SCUREG_T1MD = 0; SCUREG_T1S = 100; - SetupInterrupt(0x44, 0x0010); + SetupInterrupt(0x44, MASK_TIMER1); SCUREG_T1MD = 1; InterruptSetLevelMask(0xA); @@ -284,22 +276,19 @@ void TestDSPEndInterrupt() { - SetupInterrupt(0x45, 0x0020); - - // Clear out program control port - u32 testval = SCUREG_PPAF; + u32 dspprog[1]; - // Make sure program is stopped, etc. - SCUREG_PPAF = 0; + SetupInterrupt(0x45, MASK_DSPEND); - // Setup DSP so we can send a program to it - SCUREG_PPAF = 0x8000; + dspprog[0] = ENDI(); - // Upload our program(ENDI instruction) - SCUREG_PPD = 0xF8000000; + if (DSPLoad(dspprog, 0, 1) != LAPETUS_ERR_OK) + { + stagestatus = STAGESTAT_BADDATA; + return; + } - // Start executing program - SCUREG_PPAF = 0x10000; + DSPExec(0); InterruptSetLevelMask(0x9); } @@ -308,7 +297,7 @@ void TestSoundRequestInterrupt() { - SetupInterrupt(0x46, 0x0040); + SetupInterrupt(0x46, MASK_SNDREQUEST); // Reset all Sound interrupts *((volatile u16*)0x25B0042E) = 0x7FF; @@ -326,8 +315,7 @@ void TestSMPCInterrupt() { - SetupInterrupt(0x47, 0x0080); - // Insert triggering mechanism here(fix me) + SetupInterrupt(0x47, MASK_SYSTEMMANAGER); SmpcWaitTillReady(); SMPC_REG_IREG(0) = 0x00; // no intback status SMPC_REG_IREG(1) = 0x0A; // 15-byte mode, peripheral data returned, time optimized @@ -340,8 +328,8 @@ void TestPadInterrupt() { - SetupInterrupt(0x48, 0x0100); - // Insert triggering mechanism here(fix me) + SetupInterrupt(0x48, MASK_PAD); + // Insert triggering mechanism here(fix me) - How does this one even work? InterruptSetLevelMask(0x7); } @@ -349,7 +337,7 @@ void TestDMA0Interrupt() { - SetupInterrupt(0x4B, 0x0800); + SetupInterrupt(0x4B, MASK_DMA0); // Do a quick DMA SCUREG_D0EN = 0; @@ -367,7 +355,7 @@ void TestDMA1Interrupt() { - SetupInterrupt(0x4A, 0x0400); + SetupInterrupt(0x4A, MASK_DMA1); // Do a quick DMA SCUREG_D1EN = 0; @@ -385,7 +373,7 @@ void TestDMA2Interrupt() { - SetupInterrupt(0x49, 0x0200); + SetupInterrupt(0x49, MASK_DMA2); // Do a quick DMA SCUREG_D2EN = 0; @@ -403,7 +391,8 @@ void TestDMAIllegalInterrupt() { - SetupInterrupt(0x4C, 0x1000); + SetupInterrupt(0x4C, MASK_DMAILLEGAL); + // Insert triggering mechanism here(fix me) // Do a quick DMA SCUREG_D0EN = 0; @@ -422,7 +411,7 @@ { sprite_struct localcoord; - SetupInterrupt(0x4D, 0x2000); + SetupInterrupt(0x4D, MASK_DRAWEND); localcoord.attr = 0; localcoord.x = 0; @@ -576,9 +565,9 @@ SCUREG_IST = 0; // Set DMA 0 interrupt function - BIOS_SetSCUInterrupt(0x4B, testintfunc); - - stagestatus = STAGESTAT_WAITINGFORINT; +// BIOS_SetSCUInterrupt(0x4B, testintfunc); +// stagestatus = STAGESTAT_WAITINGFORINT; + SetupInterrupt(0x4B, MASK_DMA0); // Do a quick DMA SCUREG_D0R = 0x06000C00; |