summaryrefslogtreecommitdiff
path: root/arm9/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/lib')
-rw-r--r--arm9/lib/include/RTC_internal.h11
-rw-r--r--arm9/lib/src/RTC_internal.c31
2 files changed, 42 insertions, 0 deletions
diff --git a/arm9/lib/include/RTC_internal.h b/arm9/lib/include/RTC_internal.h
new file mode 100644
index 00000000..440d8b95
--- /dev/null
+++ b/arm9/lib/include/RTC_internal.h
@@ -0,0 +1,11 @@
+#ifndef NITRO_RTC_INTERNAL_H_
+#define NITRO_RTC_INTERNAL_H_
+
+#include "nitro/types.h"
+
+BOOL RTCi_WriteRawStatus2Async(void);
+BOOL RTCi_ReadRawTimeAsync(void);
+BOOL RTCi_ReadRawDateAsync(void);
+BOOL RTCi_ReadRawDateTimeAsync(void);
+
+#endif //NITRO_RTC_INTERNAL_H_
diff --git a/arm9/lib/src/RTC_internal.c b/arm9/lib/src/RTC_internal.c
new file mode 100644
index 00000000..c7a5f2aa
--- /dev/null
+++ b/arm9/lib/src/RTC_internal.c
@@ -0,0 +1,31 @@
+#include "function_target.h"
+#include "PXI_fifo.h"
+#include "RTC_internal.h"
+
+static BOOL RtcSendPxiCommand(u8 command);
+
+ARM_FUNC BOOL RTCi_ReadRawDateTimeAsync(void)
+{
+ return RtcSendPxiCommand(16);
+}
+
+ARM_FUNC BOOL RTCi_ReadRawDateAsync(void)
+{
+ return RtcSendPxiCommand(17);
+}
+
+ARM_FUNC BOOL RTCi_ReadRawTimeAsync(void)
+{
+ return RtcSendPxiCommand(18);
+}
+
+ARM_FUNC BOOL RTCi_WriteRawStatus2Async(void)
+{
+ return RtcSendPxiCommand(39);
+}
+
+ARM_FUNC static BOOL RtcSendPxiCommand(u8 command)
+{
+ s32 data = command << 8 & 0x7f00;
+ return PXI_SendWordByFifo(PXI_FIFO_TAG_RTC, data, FALSE) >= 0;
+}