Non libultra Boot Cleanup (#1370)

* reorganize

* math64

* rcp_utils

* osSyncPrintfUnused

* comment spacing
This commit is contained in:
Derek Hensley
2023-09-11 17:38:31 -07:00
committed by GitHub
parent 39523baf8c
commit 190b78549e
54 changed files with 366 additions and 241 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ s32 osAiSetNextBuffer(void* buf, u32 size) {
// Originally a call to __osAiDeviceBusy
status = HW_REG(AI_STATUS_REG, s32);
if (status & AI_STATUS_AI_FULL) {
if (status & AI_STATUS_FIFO_FULL) {
return -1;
}
+23
View File
@@ -0,0 +1,23 @@
#include "ultra64.h"
void RcpUtils_PrintRegisterStatus(void) {
u32 spStatus = __osSpGetStatus();
u32 dpStatus = osDpGetStatus();
if (spStatus) {
// stubbed debug prints
}
if (dpStatus) {
// stubbed debug prints
}
}
void RcpUtils_Reset(void) {
RcpUtils_PrintRegisterStatus();
// Flush the RDP pipeline and freeze clock counter
osDpSetStatus(DPC_SET_FREEZE | DPC_SET_FLUSH);
// Halt the RSP, disable interrupt on break and set "task done" signal
__osSpSetStatus(SP_SET_HALT | SP_SET_TASKDONE | SP_CLR_INTR_BREAK);
RcpUtils_PrintRegisterStatus();
}
@@ -1,7 +1,6 @@
#include "global.h"
// This isn't a vprintf since it doesn't take a va_list
void __osSyncVPrintf(const char* fmt, ...) {
void osSyncPrintfUnused(const char* fmt, ...) {
}
void osSyncPrintf(const char* fmt, ...) {
-15
View File
@@ -1,15 +0,0 @@
#include "global.h"
void func_80084940(void) {
u32 spStatus = __osSpGetStatus();
u32 dpStatus = osDpGetStatus();
if (spStatus && dpStatus) {} // stubbed debug prints
}
void func_80084968(void) {
func_80084940();
osDpSetStatus(0x28);
__osSpSetStatus(0x4082);
func_80084940();
}
+1 -1
View File
@@ -28,7 +28,7 @@ OSPiHandle* osCartRomInit(void) {
bzero(&CartRomHandle.transferInfo, sizeof(__OSTranxInfo));
/* Uses `status & PI_STATUS_ERROR` in OoT */
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) {
;
}
+1 -1
View File
@@ -51,7 +51,7 @@ void __osDevMgrMain(void* arg) {
__osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x1000000);
}
block->errStatus = 4;
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
HW_REG(PI_STATUS_REG, u32) = PI_CLR_INTR;
__osSetGlobalIntMask(0x00100C01);
}
osSendMesg(ioMesg->hdr.retQueue, (OSMesg)ioMesg, OS_MESG_NOBLOCK);
+1 -1
View File
@@ -4,7 +4,7 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, uintptr_t cartAddr, vo
s32 status;
OSPiHandle* curHandle;
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) {
;
}
+1 -1
View File
@@ -4,7 +4,7 @@ s32 __osEPiRawReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data) {
s32 status;
OSPiHandle* curHandle;
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) {
;
}
+1 -1
View File
@@ -4,7 +4,7 @@ s32 __osEPiRawWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data) {
s32 status;
OSPiHandle* curHandle;
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY)) {}
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) {}
if (__osCurrentHandle[handle->domain]->type != handle->type) {
curHandle = __osCurrentHandle[handle->domain];
+1 -1
View File
@@ -3,7 +3,7 @@
s32 __osPiRawStartDma(s32 direction, uintptr_t devAddr, void* dramAddr, size_t size) {
register int status = HW_REG(PI_STATUS_REG, u32);
while (status & (PI_STATUS_IOBUSY | PI_STATUS_BUSY)) {
while (status & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) {
status = HW_REG(PI_STATUS_REG, u32);
}
+2 -2
View File
@@ -6,7 +6,7 @@ s32 __osSiRawStartDma(s32 direction, void* dramAddr) {
}
if (direction == OS_WRITE) {
osWritebackDCache(dramAddr, PIF_RAM_SIZE);
osWritebackDCache(dramAddr, ALIGN16(PIF_RAM_END - PIF_RAM_START));
}
HW_REG(SI_DRAM_ADDR_REG, u32) = osVirtualToPhysical(dramAddr);
@@ -18,7 +18,7 @@ s32 __osSiRawStartDma(s32 direction, void* dramAddr) {
}
if (direction == OS_READ) {
osInvalDCache(dramAddr, PIF_RAM_SIZE);
osInvalDCache(dramAddr, ALIGN16(PIF_RAM_END - PIF_RAM_START));
}
return 0;
}