void init_iapetus(int res) { int i; interrupt_set_level_mask(0xF); for (i = 0; i < 0x80; i++) bios_set_sh2_interrupt(i, 0); for (i = 0x40; i < 0x60; i++) bios_set_scu_interrupt(i, 0); // Make sure all interrupts have been called bios_change_scu_interrupt_mask(0, 0); bios_change_scu_interrupt_mask(0xFFFFFFFF, 0xFFFFFFFF); vdp_init(res); per_init(); commlink_stop_service(); cl_set_service_func(cl_check2); #ifdef DEBUG debug_init(); #endif // If DSP is running, stop it if (dsp_is_exec()) dsp_stop(); if (interrupt_get_level_mask() > 0x7) interrupt_set_level_mask(0x7); }
void init_test(void) { // Put saturn in a minimalized state int i; interrupt_set_level_mask(0xF); for (i = 0; i < 0x80; i++) bios_set_sh2_interrupt(i, 0); for (i = 0x40; i < 0x60; i++) bios_set_scu_interrupt(i, 0); // Make sure all interrupts have been called bios_change_scu_interrupt_mask(0, 0); bios_change_scu_interrupt_mask(0xFFFFFFFF, 0xFFFFFFFF); vdp_init(RES_320x224); // per_init(); commlink_stop_service(); // if (InterruptGetLevelMask() > 0x7) // interrupt_set_level_mask(0x7); vdp_rbg0_init(&test_disp_settings); }
void div_interrupt_test(void) { // This tests to make sure an interrupt is generated when the registers are setup // for it, and an overflow occurs stage_status = STAGESTAT_WAITINGFORINT; bios_set_sh2_interrupt(0x6E, sh2_int_test_func); SH2REG_VCRDIV = 0x6E; SH2REG_IPRA = 0xF << 12; interrupt_set_level_mask(0xE); SH2REG_DVSR = 0; SH2REG_DVCR = 0x2; SH2REG_DVDNT = 0xD0000000; // Alright, test is all setup, now when the interrupt is done, the test // will successfully complete }
void do_tests(const char *testname, int x, int y) { int i; u8 stage=0; u8 line=0; // Clear out test log area memset((void *)TEST_LOG_ADDRESS, 0, TEST_LOG_SIZE); *((u32 *)TEST_LOG_ADDRESS) = TEST_LOG_ADDRESS+4; // Print messages and cursor vdp_printf(&test_disp_font, x * 8, y * 8, 0xF, (char *)testname); auto_test_section_start((char *)testname); for(;;) { vdp_vsync(); if (stage_status != STAGESTAT_BUSY && stage_status != STAGESTAT_WAITINGFORINT) { int textx = x * 8; int texty = (y + line + 2) * 8; int textstatx = (x + 38) * 8; if (stage_status == STAGESTAT_DONE) { vdp_printf(&test_disp_font, textstatx, texty, 0xA, "OK"); auto_test_send_result("PASS"); } else if (stage_status < 0) { // Handle error switch (stage_status) { case STAGESTAT_BADTIMING: vdp_printf(&test_disp_font, textstatx, texty, 0xE, "BT"); auto_test_send_result("FAIL (Bad Timing)"); break; case STAGESTAT_BADDATA: vdp_printf(&test_disp_font, textstatx, texty, 0xC, "BD"); auto_test_send_result("FAIL (Bad Data)"); break; case STAGESTAT_BADSIZE: vdp_printf(&test_disp_font, textstatx, texty, 0xC, "BS"); auto_test_send_result("FAIL (Bad Size)"); break; case STAGESTAT_BADINTERRUPT: vdp_printf(&test_disp_font, textstatx, texty, 0xC, "BI"); auto_test_send_result("FAIL (Bad Interrupt)"); break; case STAGESTAT_NOTEST: vdp_printf(&test_disp_font, textstatx, texty, 0xF, "NT"); auto_test_send_result("FAIL (No Test)"); break; default: vdp_printf(&test_disp_font, textstatx, texty, 0xC, "failed"); auto_test_send_result("FAIL"); break; } } if (stage >= numtests) { vdp_printf(&test_disp_font, textx, texty+8, 0xF, "All tests done."); break; } #ifndef BUILD_AUTOMATED_TESTING else if (line >= 23) { vdp_printf(&test_disp_font,textx, texty+8, 0xF, "Press any button to continue"); tests_wait_press(); // Clear window vdp_clear_screen(&test_disp_font); vdp_printf(&test_disp_font, x * 8, y * 8, 0xF, (char *)testname); line = 0; texty = (y + line + 2) * 8; } #endif stage_status = STAGESTAT_BUSY; if (tests[stage].name) { vdp_printf(&test_disp_font, textx, texty+8, 0xF, (char *)tests[stage].name); auto_test_sub_test_start((char *)tests[stage].name); } if (tests[stage].testfunc) tests[stage].testfunc(); waitcounter = 60 * 5; stage++; line++; } else { if (stage_status == STAGESTAT_WAITINGFORINT) { // decrement waitcounter waitcounter--; if (waitcounter <= 0) stage_status = STAGESTAT_BADINTERRUPT; #ifdef DEBUG vdp_printf(&test_disp_font, 0 * 8, 23 * 8, 0xF, "%08X", waitcounter); #endif } } } interrupt_set_level_mask(0xF); // Reset all interrupts for (i = 0; i < 0x80; i++) bios_set_sh2_interrupt(i, 0); for (i = 0x40; i < 0x60; i++) bios_set_scu_interrupt(i, 0); // Make sure all interrupts have been called bios_change_scu_interrupt_mask(0, 0); bios_change_scu_interrupt_mask(0xFFFFFFFF, 0xFFFFFFFF); auto_test_section_end(); // Enable commlink connection cl_set_service_func(ud_check); commlink_start_service(); tests_wait_press(); commlink_stop_service(); }
void sh2_int_test_func(void) { bios_set_sh2_interrupt(0x6E, 0); SH2REG_DVCR = 0; stage_status = STAGESTAT_DONE; }