1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - OS - include
3 File: ownerInfo.h
4
5 Copyright 2003-2008 Nintendo. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Date:: 2008-12-22#$
14 $Rev: 9714 $
15 $Author: okubata_ryoma $
16 *---------------------------------------------------------------------------*/
17
18 #ifndef NITRO_OS_COMMON_OWNERINFO_H_
19 #define NITRO_OS_COMMON_OWNERINFO_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /*===========================================================================*/
26
27 #include <nitro/types.h>
28 #include <nitro/spec.h>
29 #include <nitro/spi/common/config.h>
30 #ifdef SDK_NITRO
31 #include <nitro/hw/common/mmap_shared.h>
32 #else
33 #include <twl/hw/common/mmap_shared.h>
34 #endif
35 #include <nitro/mi/memory.h>
36
37 #include <nitro/gx/gxcommon.h>
38
39
40
41 /* DS information: Favorite color definition (0-15) */
42 #define OS_FAVORITE_COLOR_GRAY 0x00
43 #define OS_FAVORITE_COLOR_BROWN 0x01
44 #define OS_FAVORITE_COLOR_RED 0x02
45 #define OS_FAVORITE_COLOR_PINK 0x03
46 #define OS_FAVORITE_COLOR_ORANGE 0x04
47 #define OS_FAVORITE_COLOR_YELLOW 0x05
48 #define OS_FAVORITE_COLOR_LIME_GREEN 0x06
49 #define OS_FAVORITE_COLOR_GREEN 0x07
50 #define OS_FAVORITE_COLOR_DARK_GREEN 0x08
51 #define OS_FAVORITE_COLOR_SEA_GREEN 0x09
52 #define OS_FAVORITE_COLOR_TURQUOISE 0x0A
53 #define OS_FAVORITE_COLOR_BLUE 0x0B
54 #define OS_FAVORITE_COLOR_DARK_BLUE 0x0C
55 #define OS_FAVORITE_COLOR_PURPLE 0x0D
56 #define OS_FAVORITE_COLOR_VIOLET 0x0E
57 #define OS_FAVORITE_COLOR_MAGENTA 0x0F
58 #define OS_FAVORITE_COLOR_BITMASK 0x0F
59 #define OS_FAVORITE_COLOR_MAX 0x10
60
61 /* DS information: Favorite color constant (GXRgb) */
62 #define OS_FAVORITE_COLOR_VALUE_GRAY GX_RGB(12,16,19)
63 #define OS_FAVORITE_COLOR_VALUE_BROWN GX_RGB(23, 9, 0)
64 #define OS_FAVORITE_COLOR_VALUE_RED GX_RGB(31, 0, 3)
65 #define OS_FAVORITE_COLOR_VALUE_PINK GX_RGB(31,17,31)
66 #define OS_FAVORITE_COLOR_VALUE_ORANGE GX_RGB(31,18, 0)
67 #define OS_FAVORITE_COLOR_VALUE_YELLOW GX_RGB(30,28, 0)
68 #define OS_FAVORITE_COLOR_VALUE_LIME_GREEN GX_RGB(21,31, 0)
69 #define OS_FAVORITE_COLOR_VALUE_GREEN GX_RGB( 0,31, 0)
70 #define OS_FAVORITE_COLOR_VALUE_DARK_GREEN GX_RGB( 0,20, 7)
71 #define OS_FAVORITE_COLOR_VALUE_SEA_GREEN GX_RGB( 9,27,17)
72 #define OS_FAVORITE_COLOR_VALUE_TURQUOISE GX_RGB( 6,23,30)
73 #define OS_FAVORITE_COLOR_VALUE_BLUE GX_RGB( 0,11,30)
74 #define OS_FAVORITE_COLOR_VALUE_DARK_BLUE GX_RGB( 0, 0,18)
75 #define OS_FAVORITE_COLOR_VALUE_PURPLE GX_RGB(17, 0,26)
76 #define OS_FAVORITE_COLOR_VALUE_VIOLET GX_RGB(26, 0,29)
77 #define OS_FAVORITE_COLOR_VALUE_MAGENTA GX_RGB(31, 0,18)
78
79
80 /*---------------------------------------------------------------------------*
81 Constant Definitions
82 *---------------------------------------------------------------------------*/
83 // Language code
84 typedef enum OSLanguage
85 {
86 OS_LANGUAGE_JAPANESE = NVRAM_CONFIG_LANG_JAPANESE, // 0: Japanese
87 OS_LANGUAGE_ENGLISH = NVRAM_CONFIG_LANG_ENGLISH, // 1: English
88 OS_LANGUAGE_FRENCH = NVRAM_CONFIG_LANG_FRENCH, // 2: French
89 OS_LANGUAGE_GERMAN = NVRAM_CONFIG_LANG_GERMAN, // 3: German
90 OS_LANGUAGE_ITALIAN = NVRAM_CONFIG_LANG_ITALIAN, // 4: Italian
91 OS_LANGUAGE_SPANISH = NVRAM_CONFIG_LANG_SPANISH, // 5: Spanish
92 //#if ( SDK_NVRAM_FORMAT >= 300 )
93 OS_LANGUAGE_CHINESE = NVRAM_CONFIG_LANG_CHINESE, // 6: Chinese
94 OS_LANGUAGE_HANGUL = NVRAM_CONFIG_LANG_HANGUL, // 7: Korean
95 //#endif
96 OS_LANGUAGE_CODE_MAX = NVRAM_CONFIG_LANG_CODE_MAX
97 }
98 OSLanguage;
99
100
101 // Maximum character string lengths
102 #define OS_OWNERINFO_NICKNAME_MAX NVRAM_CONFIG_NICKNAME_LENGTH
103 #define OS_OWNERINFO_COMMENT_MAX NVRAM_CONFIG_COMMENT_LENGTH
104
105
106 /*---------------------------------------------------------------------------*
107 Structure Definitions
108 *---------------------------------------------------------------------------*/
109 // Birthday information
110 typedef struct OSBirthday
111 {
112 u8 month; // Month (1 to 12)
113 u8 day; // Day (1 to 31)
114
115 }
116 OSBirthday;
117
118 // Owner Information
119 typedef struct OSOwnerInfo
120 {
121 u8 language; // Language code
122 u8 favoriteColor; // Favorite color (0 to 15)
123 OSBirthday birthday; // Birthdate
124 u16 nickName[OS_OWNERINFO_NICKNAME_MAX + 1];
125 // Nickname (Max. 10 characters of Unicode (UTF16), no terminating code)
126 u16 nickNameLength; // Number of characters in nickname (0 to 10)
127 u16 comment[OS_OWNERINFO_COMMENT_MAX + 1];
128 // Comment (Max. 26 characters of Unicode (UTF16), no terminating code)
129 u16 commentLength; // Number of characters in comment (0 to 26)
130
131 }
132 OSOwnerInfo;
133
134
135 /*---------------------------------------------------------------------------*
136 Function Definitions
137 *---------------------------------------------------------------------------*/
138 /*---------------------------------------------------------------------------*
139 Name: OS_GetOwnerInfo
140
141 Description: Gets the owner information.
142
143 Arguments: info: Pointer to the buffer getting the owner information.
144 Data gets written to this buffer.
145
146 Returns: None.
147 *---------------------------------------------------------------------------*/
148 void OS_GetOwnerInfo(OSOwnerInfo *info);
149
150 /*---------------------------------------------------------------------------*
151 Name: OS_GetOwnerRtcOffset
152
153 Description: Gets the offset (in units of seconds) which fluctuates in response to the new value every time the owner changes the RTC setting.
154
155 If the RTC is pushed forward into the future relative to the RTC time prior to being reset, the pushed-forward time is added.
156 If the RTC is pushed back into the past, the pushed-back time is subtracted.
157
158 Arguments: None.
159
160 Returns: s64: Returns the offset value for RTC settings.
161 *---------------------------------------------------------------------------*/
162 s64 OS_GetOwnerRtcOffset(void);
163
164 /*---------------------------------------------------------------------------*
165 Name: OS_GetMacAddress
166
167 Description: Gets the MAC address of the wireless hardware.
168
169 Arguments: macAddress: Pointer to the buffer getting the MAC address.
170 Six bytes of data get written to this buffer.
171
172 Returns: None.
173 *---------------------------------------------------------------------------*/
174 void OS_GetMacAddress(u8 *macAddress);
175
176 /*---------------------------------------------------------------------------*
177 Name: OS_GetFavoriteColorTable
178
179 Description: Gets a pointer to the "Favorite Color" array that corresponds to the number of the favoriteColor member of the OSOwnerInfo structure.
180
181
182 Arguments: None.
183
184 Returns: Pointer to the GXRgb type constant array that stores corresponding color values.
185 *---------------------------------------------------------------------------*/
186 const GXRgb *OS_GetFavoriteColorTable(void);
187
188 /*---------------------------------------------------------------------------*
189 Name: OS_GetFavoriteColor
190
191 Description: Gets the "Favorite Color" that corresponds to the specified number.
192
193 Arguments: index: Number for "Favorite Color" to specify
194 This index is masked by 16 colors (4 bits) that are the total
195 number of "Favorite Colors."
196
197 Returns: GXRgb type color value that corresponds to the specified number.
198 *---------------------------------------------------------------------------*/
OS_GetFavoriteColor(int index)199 static inline GXRgb OS_GetFavoriteColor(int index)
200 {
201 return OS_GetFavoriteColorTable()[index & OS_FAVORITE_COLOR_BITMASK];
202 }
203
204 /*===========================================================================*/
205
206 #ifdef __cplusplus
207 } /* extern "C" */
208 #endif
209
210 #endif /* NITRO_OS_COMMON_OWNERINFO_H_ */
211
212 /*---------------------------------------------------------------------------*
213 End of file
214 *---------------------------------------------------------------------------*/
215