summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorred031000 <rubenru09@aol.com>2020-05-05 23:23:02 +0100
committerred031000 <rubenru09@aol.com>2020-05-05 23:24:22 +0100
commitec58acee764ca6cd64b499ca0bb2b0626fee9cd0 (patch)
tree4a0c80a87708a8468e2d46b14813d5fd6a5e304e
parent962b4e0e9505bdf1eafc7679b428977658726042 (diff)
OS_tcm.c
-rw-r--r--arm9/asm/OS_tcm.s13
-rw-r--r--arm9/lib/include/OS_init.h1
-rw-r--r--arm9/lib/include/OS_tcm.h12
-rw-r--r--arm9/lib/include/consts.h2
-rw-r--r--arm9/lib/src/OS_tcm.c13
5 files changed, 28 insertions, 13 deletions
diff --git a/arm9/asm/OS_tcm.s b/arm9/asm/OS_tcm.s
deleted file mode 100644
index 9c7196ae..00000000
--- a/arm9/asm/OS_tcm.s
+++ /dev/null
@@ -1,13 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .text
-
- arm_func_start OS_GetDTCMAddress
-OS_GetDTCMAddress: ; 0x020CC9A4
- mrc p15, 0x0, r0, c9, c1, 0x0
- ldr r1, _020CC9B4 ; =0xFFFFF000
- and r0, r0, r1
- bx lr
- .balign 4
-_020CC9B4: .word 0xFFFFF000
diff --git a/arm9/lib/include/OS_init.h b/arm9/lib/include/OS_init.h
index d2497836..6fbfc826 100644
--- a/arm9/lib/include/OS_init.h
+++ b/arm9/lib/include/OS_init.h
@@ -7,6 +7,7 @@
#include "types.h"
#include "consts.h"
+#include "OS_tcm.h"
#include "OS_spinLock.h"
#include "OS_thread.h"
#include "OS_protectionRegion.h"
diff --git a/arm9/lib/include/OS_tcm.h b/arm9/lib/include/OS_tcm.h
new file mode 100644
index 00000000..7112ca0e
--- /dev/null
+++ b/arm9/lib/include/OS_tcm.h
@@ -0,0 +1,12 @@
+//
+// Created by red031000 on 2020-05-05.
+//
+
+#ifndef POKEDIAMOND_OS_TCM_H
+#define POKEDIAMOND_OS_TCM_H
+
+#include "consts.h"
+
+u32 OS_GetDTCMAddress();
+
+#endif //POKEDIAMOND_OS_TCM_H
diff --git a/arm9/lib/include/consts.h b/arm9/lib/include/consts.h
index 81330924..0e5066de 100644
--- a/arm9/lib/include/consts.h
+++ b/arm9/lib/include/consts.h
@@ -55,6 +55,8 @@
#define OS_CONSOLE_SIZE_MASK 0x00000003
#define OS_CONSOLE_SIZE_4MB 0x00000001
+#define OSi_TCM_REGION_BASE_MASK 0xfffff000
+
#define OSi_GetArenaInfo() (*(OSArenaInfo*)HW_ARENA_INFO_BUF)
#define OSi_TRUNC(n, a) (((u32) (n)) & ~((a) - 1))
#define OSi_ROUND(n, a) (((u32) (n) + (a) - 1) & ~((a) - 1))
diff --git a/arm9/lib/src/OS_tcm.c b/arm9/lib/src/OS_tcm.c
new file mode 100644
index 00000000..5a168c58
--- /dev/null
+++ b/arm9/lib/src/OS_tcm.c
@@ -0,0 +1,13 @@
+//
+// Created by red031000 on 2020-05-05.
+//
+
+#include "OS_tcm.h"
+#include "function_target.h"
+
+ARM_FUNC asm u32 OS_GetDTCMAddress() {
+ mrc p15, 0x0, r0, c9, c1, 0x0
+ ldr r1, =OSi_TCM_REGION_BASE_MASK
+ and r0, r0, r1
+ bx lr
+}