From 7160c9d26c8cf560bfa6c9f26ea22627cfc73b72 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Sun, 3 Oct 2021 16:35:51 -0400 Subject: [PATCH] Match __osSiRawStartDma --- lib/src/os/__osSiRawStartDma.c | 25 ++++++++++++++++++++++++ lib/src/os/{unknown_0CE200.c => siacs.c} | 4 ---- tools/python/generate_ld.py | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 lib/src/os/__osSiRawStartDma.c rename lib/src/os/{unknown_0CE200.c => siacs.c} (93%) diff --git a/lib/src/os/__osSiRawStartDma.c b/lib/src/os/__osSiRawStartDma.c new file mode 100644 index 00000000..08c8edff --- /dev/null +++ b/lib/src/os/__osSiRawStartDma.c @@ -0,0 +1,25 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800CD6C0 */ + +#include "libultra_internal.h" +#include "src/memory.h" + +s32 __osSiRawStartDma(s32 direction, void *dramAddr) { + if (__osSiDeviceBusy()) + return -1; + + if (direction == OS_WRITE) + osWritebackDCache(dramAddr, 64); + + IO_WRITE(SI_DRAM_ADDR_REG, osVirtualToPhysical(dramAddr)); + + if (direction == OS_READ) + IO_WRITE(SI_PIF_ADDR_RD64B_REG, 0x1FC007C0); + else + IO_WRITE(SI_PIF_ADDR_WR64B_REG, 0x1FC007C0); + + if (direction == OS_READ) + osInvalDCache(dramAddr, 64); + + return 0; +} diff --git a/lib/src/os/unknown_0CE200.c b/lib/src/os/siacs.c similarity index 93% rename from lib/src/os/unknown_0CE200.c rename to lib/src/os/siacs.c index 54ee0a5b..8e68c366 100644 --- a/lib/src/os/unknown_0CE200.c +++ b/lib/src/os/siacs.c @@ -1,8 +1,6 @@ /* The comment below is needed for this file to be picked up by generate_ld */ /* RAM_POS: 0x800CD600 */ -#include "types.h" -#include "macros.h" #include "libultra_internal.h" #include "controller.h" #include "src/memory.h" @@ -51,5 +49,3 @@ void __osSiGetAccess(void) { void __osSiRelAccess(void) { osSendMesg(&__osSiAccessQueue, NULL, OS_MESG_NOBLOCK); } - -GLOBAL_ASM("lib/asm/non_matchings/unknown_0CE200/__osSiRawStartDma.s") diff --git a/tools/python/generate_ld.py b/tools/python/generate_ld.py index 40ca0d77..9a4430b1 100644 --- a/tools/python/generate_ld.py +++ b/tools/python/generate_ld.py @@ -31,7 +31,7 @@ BSS_LIB_ORDER_FILES = [ BUILD_DIR + '/lib/src/os/osViMgr.o', BUILD_DIR + '/lib/src/os/osSetEventMesg.o', BUILD_DIR + '/lib/src/os/controller.o', - BUILD_DIR + '/lib/src/os/unknown_0CE200.o' + BUILD_DIR + '/lib/src/os/siacs.o' ] class GenerateLD: