diff --git a/Makefile b/Makefile index e786b458..32e5cb0a 100755 --- a/Makefile +++ b/Makefile @@ -263,9 +263,7 @@ $(BUILD_DIR)/lib/src/os/osCreatePiManager.o: OPT_FLAGS := -O2 $(BUILD_DIR)/lib/src/printf.o : OPT_FLAGS := -O3 $(BUILD_DIR)/lib/src/unknown_0C91A0.o : OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0D29F0.o: OPT_FLAGS := -O1 -$(BUILD_DIR)/lib/src/unknown_0D3160.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0D3360.o: OPT_FLAGS := -O1 -$(BUILD_DIR)/lib/src/unknown_0D5EC0.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0C9C90.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 $(BUILD_DIR)/lib/%.o: MIPSISET := -mips2 diff --git a/lib/src/os/osEpiRawStartDma.c b/lib/src/os/osEpiRawStartDma.c new file mode 100644 index 00000000..246bac2a --- /dev/null +++ b/lib/src/os/osEpiRawStartDma.c @@ -0,0 +1,34 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D2680 */ + +#include "types.h" +#include "macros.h" +#include "libultra_internal.h" +#include "PR/rcp.h" +#include "osVirtualToPhysical.h" + +s32 osEPiRawStartDma(OSPiHandle *pihandle, s32 dir, u32 cart_addr, void *dram_addr, u32 size) { + register int status; + + status = IO_READ(PI_STATUS_REG); + + while (status & PI_STATUS_ERROR) { + status = IO_READ(PI_STATUS_REG); + } + + IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dram_addr)); + IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS(pihandle->baseAddress | cart_addr)); + + switch (dir) { + case OS_READ: + IO_WRITE(PI_WR_LEN_REG, size - 1); + break; + case OS_WRITE: + IO_WRITE(PI_RD_LEN_REG, size - 1); + break; + default: + return -1; + } + + return 0; +} diff --git a/lib/src/os/osInterrupts.c b/lib/src/os/osInterrupts.c new file mode 100644 index 00000000..40669692 --- /dev/null +++ b/lib/src/os/osInterrupts.c @@ -0,0 +1,8 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800D2560 */ + +#include "macros.h" + +//To the best of my knowledge these files can never actually be decompiled +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDisableInt.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osRestoreInt.s") diff --git a/lib/src/unknown_0D3160.c b/lib/src/os/osPiRawStartDma.c similarity index 50% rename from lib/src/unknown_0D3160.c rename to lib/src/os/osPiRawStartDma.c index 659ac3dc..bced171d 100644 --- a/lib/src/unknown_0D3160.c +++ b/lib/src/os/osPiRawStartDma.c @@ -1,14 +1,11 @@ /* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800D2560 */ +/* RAM_POS: 0x800D25a0 */ #include "types.h" #include "macros.h" #include "libultra_internal.h" #include "PR/rcp.h" -#include "os/osVirtualToPhysical.h" - -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osDisableInt.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3160/__osRestoreInt.s") +#include "osVirtualToPhysical.h" s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size) { register int status; @@ -33,29 +30,3 @@ s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size) { } return 0; } - -s32 osEPiRawStartDma(OSPiHandle *pihandle, s32 dir, u32 cart_addr, void *dram_addr, u32 size) { - register int status; - - status = IO_READ(PI_STATUS_REG); - - while (status & PI_STATUS_ERROR) { - status = IO_READ(PI_STATUS_REG); - } - - IO_WRITE(PI_DRAM_ADDR_REG, osVirtualToPhysical(dram_addr)); - IO_WRITE(PI_CART_ADDR_REG, K1_TO_PHYS(pihandle->baseAddress | cart_addr)); - - switch (dir) { - case OS_READ: - IO_WRITE(PI_WR_LEN_REG, size - 1); - break; - case OS_WRITE: - IO_WRITE(PI_RD_LEN_REG, size - 1); - break; - default: - return -1; - } - - return 0; -} diff --git a/lib/src/os/osViMgr.c b/lib/src/os/osViMgr.c index 48a8b5c3..320e31b2 100644 --- a/lib/src/os/osViMgr.c +++ b/lib/src/os/osViMgr.c @@ -118,4 +118,4 @@ void viMgrMain(void *arg) { } #else GLOBAL_ASM("lib/asm/non_matchings/osViMgr_0D2590/viMgrMain.s") -#endif \ No newline at end of file +#endif diff --git a/lib/src/unknown_0D5EC0.c b/lib/src/os/unknown_0D5EC0.c similarity index 100% rename from lib/src/unknown_0D5EC0.c rename to lib/src/os/unknown_0D5EC0.c diff --git a/lib/src/unknown_0D29F0.c b/lib/src/unknown_0D29F0.c index daad706c..8d32f1e6 100644 --- a/lib/src/unknown_0D29F0.c +++ b/lib/src/unknown_0D29F0.c @@ -127,7 +127,7 @@ void osSpTaskLoad(OSTask *intp){ ; } -void osSpTaskStartGo(OSTask *tp){ +void osSpTaskStartGo(OSTask *tp) { while (__osSpDeviceBusy()); __osSpSetStatus(SP_SET_INTR_BREAK | SP_CLR_SSTEP | SP_CLR_BROKE | SP_CLR_HALT);