diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gba/io_reg.h (renamed from include/io_regs.h) | 6 | ||||
-rw-r--r-- | include/gba/macro.h | 15 | ||||
-rw-r--r-- | include/gba/syscall.h | 10 | ||||
-rw-r--r-- | include/global.h | 9 |
4 files changed, 31 insertions, 9 deletions
diff --git a/include/io_regs.h b/include/gba/io_reg.h index 3a9290feb..e01b13c4e 100644 --- a/include/io_regs.h +++ b/include/gba/io_reg.h @@ -1,5 +1,5 @@ -#ifndef GUARD_IO_REGS_H -#define GUARD_IO_REGS_H +#ifndef GUARD_GBA_IO_REG_H +#define GUARD_GBA_IO_REG_H #define REG_BASE 0x4000000 // I/O register base address @@ -385,4 +385,4 @@ #define INTR_FLAG_KEYPAD (1 << 12) #define INTR_FLAG_GAMEPAK (1 << 13) -#endif // GUARD_IO_REGS_H +#endif // GUARD_GBA_IO_REG_H diff --git a/include/gba/macro.h b/include/gba/macro.h new file mode 100644 index 000000000..5578f90ba --- /dev/null +++ b/include/gba/macro.h @@ -0,0 +1,15 @@ +#ifndef GUARD_GBA_MACRO_H +#define GUARD_GBA_MACRO_H + +#define CPU_FILL(dest, value, size, bit) \ +do { \ + vu##bit tmp = (vu##bit)(value); \ + CpuSet((void *)&tmp, \ + dest, \ + CPU_SET_##bit##BIT | CPU_SET_SRC_FIXED | ((size)/(bit/8) & 0x1FFFFF)); \ +} while (0) + +#define CpuFill16(dest, value, size) CPU_FILL(dest, value, size, 16) +#define CpuFill32(dest, value, size) CPU_FILL(dest, value, size, 32) + +#endif // GUARD_GBA_MACRO_H diff --git a/include/gba/syscall.h b/include/gba/syscall.h new file mode 100644 index 000000000..0f4198b44 --- /dev/null +++ b/include/gba/syscall.h @@ -0,0 +1,10 @@ +#ifndef GUARD_GBA_SYSCALL_H +#define GUARD_GBA_SYSCALL_H + +#define CPU_SET_SRC_FIXED 0x01000000 +#define CPU_SET_16BIT 0x00000000 +#define CPU_SET_32BIT 0x04000000 + +extern void CpuSet(void *src, void *dest, u32 controlData); + +#endif // GUARD_GBA_SYSCALL_H diff --git a/include/global.h b/include/global.h index d04d4a614..37473afc8 100644 --- a/include/global.h +++ b/include/global.h @@ -27,11 +27,8 @@ typedef u32 bool32; #define TRUE 1 #define FALSE 0 -#include "io_regs.h" - -#define CPU_SET_SRC_FIX (1 << 24) -#define CPU_SET_32BIT (1 << 26) - -extern void CpuSet(void *src, void *dest, u32 controlData); +#include "gba/io_reg.h" +#include "gba/syscall.h" +#include "gba/macro.h" #endif // GUARD_GLOBAL_H |