summaryrefslogtreecommitdiff
path: root/include/dolphin/os/OSRtc.h
blob: 2b8d74d8e3b9e97975419bd79d2ef5ed51660ff4 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef OSRTC_H
#define OSRTC_H

#include "dolphin/types.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef u32 OSSoundMode;

#define OS_SOUND_MODE_MONO 0
#define OS_SOUND_MODE_STEREO 1

#define RTC_CMD_READ 0x20000000
#define RTC_CMD_WRITE 0xa0000000

#define RTC_SRAM_ADDR 0x00000100
#define RTC_SRAM_SIZE 64

#define RTC_CHAN 0
#define RTC_DEV 1
#define RTC_FREQ 3  // EXI_FREQ_8M

typedef struct SramControlBlock {
    u8 sram[RTC_SRAM_SIZE];
    u32 offset;
    BOOL enabled;
    BOOL locked;
    BOOL sync;
    void (*callback)(void);
} SramControlBlock;

typedef struct OSSram {
    u16 checkSum;
    u16 checkSumInv;
    u32 ead0;
    u32 ead1;
    u32 counterBias;
    s8 displayOffsetH;
    u8 ntd;
    u8 language;
    u8 flags;
} OSSram;

typedef struct OSSramEx {
    u8 flashID[2][12];
    u32 wirelessKeyboardID;
    u16 wirelessPadID[4];
    u8 dvdErrorCode;
    u8 _padding0;
    u8 flashIDCheckSum[2];
    u16 gbs;
    u8 _padding1[2];
} OSSramEx;

void __OSInitSram(void);
OSSram* __OSLockSram(void);
OSSramEx* __OSLockSramEx(void);
BOOL __OSUnlockSram(BOOL commit);
BOOL __OSUnlockSramEx(BOOL commit);
BOOL __OSSyncSram(void);
u32 OSGetSoundMode(void);
void OSSetSoundMode(OSSoundMode mode);
u32 OSGetProgressiveMode(void);
void OSSetProgressiveMode(u32 mode);
u32 OSGetEuRgb60Mode();
void OSSetEuRgb60Mode(u32 mode);
u8 OSGetLanguage();
u16 OSGetWirelessID(s32 channel);
void OSSetWirelessID(s32 channel, u16 id);
static u16 OSGetGbsMode(void);
static void OSSetGbsMode(u16 mode);

#ifdef __cplusplus
};
#endif

#endif /* OSRTC_H */