From 40ec8a9fc05e68a866e542c482603eac6740b769 Mon Sep 17 00:00:00 2001 From: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Date: Thu, 11 Nov 2021 21:25:53 +0000 Subject: [PATCH] epiwrite.c OK (#411) * epiwrite.c OK * uintptr_t * Reintroduce bad code rather than start rearranging headers --- src/libultra/io/epirawwrite.c | 6 ++---- src/libultra/io/epiwrite.c | 10 +++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/libultra/io/epirawwrite.c b/src/libultra/io/epirawwrite.c index dc169ecf71..1e0e694a7e 100644 --- a/src/libultra/io/epirawwrite.c +++ b/src/libultra/io/epirawwrite.c @@ -1,12 +1,10 @@ #include "global.h" -s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) { +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_BUSY | PI_STATUS_IOBUSY)) {} if (__osCurrentHandle[handle->domain]->type != handle->type) { curHandle = __osCurrentHandle[handle->domain]; diff --git a/src/libultra/io/epiwrite.c b/src/libultra/io/epiwrite.c index a44fd169d8..2132507413 100644 --- a/src/libultra/io/epiwrite.c +++ b/src/libultra/io/epiwrite.c @@ -1,3 +1,11 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/boot/epiwrite/osEPiWriteIo.s") +s32 osEPiWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data) { + register s32 ret; + + __osPiGetAccess(); + ret = __osEPiRawWriteIo(handle, devAddr, data); + __osPiRelAccess(); + + return ret; +}