add scheduler entry for when RCP locks up

This commit is contained in:
someone2639
2022-07-26 20:56:17 -04:00
parent 98958df324
commit 93fd414035

View File

@@ -7,6 +7,7 @@
#include "sm64.h"
#include "audio/external.h"
#include "game/game_init.h"
#include "game/debug.h"
#include "game/memory.h"
#include "game/sound_init.h"
#include "buffers/buffers.h"
@@ -32,6 +33,7 @@ enum MessageIDs {
MESG_VI_VBLANK,
MESG_START_GFX_SPTASK,
MESG_NMI_REQUEST,
MESG_RCP_HUNG,
};
// OSThread gUnkThread; // unused?
@@ -303,6 +305,19 @@ void handle_dp_complete(void) {
sCurrentDisplaySPTask = NULL;
}
OSTimer RCPHangTimer;
void start_rcp_hang_timer(void) {
osSetTimer(&RCPHangTimer, OS_USEC_TO_CYCLES(3000000), (OSTime) 0, &gIntrMesgQueue, MESG_RCP_HUNG);
}
void stop_rcp_hang_timer(void) {
osStopTimer(&RCPHangTimer);
}
void alert_rcp_hung_up(void) {
assert(0, "RCP is HUNG UP!! Oh! MY GOD!!");
}
void check_cache_emulation() {
// Disable interrupts to ensure that nothing evicts the variable from cache while we're using it.
u32 saved = __osDisableInt();
@@ -369,14 +384,19 @@ void thread3_main(UNUSED void *arg) {
handle_sp_complete();
break;
case MESG_DP_COMPLETE:
stop_rcp_hang_timer();
handle_dp_complete();
break;
case MESG_START_GFX_SPTASK:
start_rcp_hang_timer();
start_gfx_sptask();
break;
case MESG_NMI_REQUEST:
handle_nmi_request();
break;
case MESG_RCP_HUNG:
alert_rcp_hung_up();
break;
}
}
}