summaryrefslogtreecommitdiff
path: root/arm9/lib/NitroSDK/src/RTC_internal.c
blob: e3a132abf4581a18476a9aadc464deac1af458ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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, (u32)data, FALSE) >= 0;
}