From 02784c186529d0329a0cf2cff526cab000fc4d0a Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Wed, 18 Oct 2023 10:38:09 -0300 Subject: [PATCH] move to header --- include/PR/ultratypes.h | 2 ++ include/hardware.h | 9 +++++++++ src/libultra/io/ai.c | 8 +------- 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 include/hardware.h diff --git a/include/PR/ultratypes.h b/include/PR/ultratypes.h index 6bc4c650..ad665164 100644 --- a/include/PR/ultratypes.h +++ b/include/PR/ultratypes.h @@ -59,6 +59,8 @@ typedef double f64; /* double prec floating point */ typedef u32 size_t; +typedef unsigned long int uintptr_t; + typedef float Matrix[4][4]; #endif /* _LANGUAGE_C */ diff --git a/include/hardware.h b/include/hardware.h new file mode 100644 index 00000000..f36bd8cb --- /dev/null +++ b/include/hardware.h @@ -0,0 +1,9 @@ +#ifndef _HARDWARE_H_ +#define _HARDWARE_H_ + +#define HW_REG(reg, type) *(volatile type *)(uintptr_t)((reg) | 0xa0000000) + +#define AI_STATUS_REG 0x0450000C +#define AI_STATUS_AI_FULL (1 << 31) + +#endif \ No newline at end of file diff --git a/src/libultra/io/ai.c b/src/libultra/io/ai.c index c3e6bbdc..41491008 100644 --- a/src/libultra/io/ai.c +++ b/src/libultra/io/ai.c @@ -1,12 +1,6 @@ #include "global.h" #include "PR/rcp.h" - -// TODO: Put in proper header: -typedef unsigned long int uintptr_t; - -#define HW_REG(reg, type) *(volatile type*)(uintptr_t)((reg) | 0xa0000000) -#define AI_STATUS_REG 0x0450000C -#define AI_STATUS_AI_FULL (1 << 31) +#include "hardware.h" s32 __osAiDeviceBusy(void) { register s32 status = HW_REG(AI_STATUS_REG, u32);