1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - SPI - include
3   File:     userInfo_ts_200.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-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 #ifndef NITRO_SPI_COMMON_USERINFO_TS_200_H_
18 #define NITRO_SPI_COMMON_USERINFO_TS_200_H_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /*===========================================================================*/
25 
26 /*---------------------------------------------------------------------------*
27     Constant Definitions
28  *---------------------------------------------------------------------------*/
29 // Configuration setting data format version
30 #define NVRAM_CONFIG_DATA_VERSION           5
31 
32 // Various setting values within config
33 #define NVRAM_CONFIG_NICKNAME_LENGTH        10  // Nickname Length
34 #define NVRAM_CONFIG_COMMENT_LENGTH         26  // Comment Length
35 #define NVRAM_CONFIG_FAVORITE_COLOR_MAX     16  // Maximum number of favorite colors
36 
37 // Language setting code
38 #define NVRAM_CONFIG_LANG_JAPANESE          0   // Japanese
39 #define NVRAM_CONFIG_LANG_ENGLISH           1   // English
40 #define NVRAM_CONFIG_LANG_FRENCH            2   // French
41 #define NVRAM_CONFIG_LANG_GERMAN            3   // German
42 #define NVRAM_CONFIG_LANG_ITALIAN           4   // Italian
43 #define NVRAM_CONFIG_LANG_SPANISH           5   // Spanish
44 #define NVRAM_CONFIG_LANG_CODE_MAX          6   // Number of types of language setting codes
45 
46 /*---------------------------------------------------------------------------*
47     Structure Definitions
48  *---------------------------------------------------------------------------*/
49 // Birthday data (2 byte)
50 typedef struct NVRAMConfigDate
51 {
52     u8      month;                     // Month: 01 - 12
53     u8      day;                       // Day: 01 - 31
54 
55 }
56 NVRAMConfigDate;
57 
58 // Nickname (22 byte)
59 typedef struct NVRAMConfigNickname
60 {
61     u16     str[NVRAM_CONFIG_NICKNAME_LENGTH];  // Nickname  (Maximum of 10 characters in Unicode (UTF16), no terminal code)
62     u8      length;                    // Number of characters
63     u8      rsv;
64 
65 }
66 NVRAMConfigNickname;
67 
68 // Comment (54 byte)
69 typedef struct NVRAMConfigComment
70 {
71     u16     str[NVRAM_CONFIG_COMMENT_LENGTH];   //Comment (a maximum of 26 characters in Unicode (UTF16), no terminal code)
72     u8      length;                    // Number of characters
73     u8      rsv;
74 
75 }
76 NVRAMConfigComment;
77 
78 // Owner Information (80 byte)
79 typedef struct NVRAMConfigOwnerInfo
80 {
81     u8      favoriteColor:4;           // Favorite color
82     u8      rsv:4;                     // Reserved
83     NVRAMConfigDate birthday;          // Birthdate
84     u8      pad;
85     NVRAMConfigNickname nickname;      // Nickname
86     NVRAMConfigComment comment;        // Comment
87 
88 }
89 NVRAMConfigOwnerInfo;
90 
91 
92 // Alarm clock data for IPL (6 byte)
93 typedef struct NVRAMConfigAlarm
94 {
95     u8      hour;                      // Alarm Hour: 00 - 23
96     u8      minute;                    // Alarm Minute: 00 - 59
97     u8      second;                    // Alarm Seconds: 00 - 59
98     u8      pad;
99     u16     enableWeek:7;              // Flag for which days of the week the alarm is enabled (bit0: Sunday, bit1: Monday, etc..."1" means "enabled")
100     u16     alarmOn:1;                 // Alarm ON/OFF (0: OFF, 1: ON)
101     u16     rsv:8;                     // Reserved
102 
103 }
104 NVRAMConfigAlarm;
105 
106 // Touch Panel Calibration Data (12 byte)
107 typedef struct NVRAMConfigTpCalibData
108 {
109     u16     raw_x1;                    // TP-obtained x value of the first calibration point
110     u16     raw_y1;                    // TP-obtained y value of the first calibration point
111     u8      dx1;                       // LCD x coordinate of the first calibration point
112     u8      dy1;                       // LCD y coordinate of the first calibration point
113     u16     raw_x2;                    // TP-obtained x value of the second calibration point
114     u16     raw_y2;                    // TP-obtained y value of the second calibration point
115     u8      dx2;                       // LCD x coordinate of the second calibration point
116     u8      dy2;                       // LCD y coordinate of the second calibration point
117 
118 }
119 NVRAMConfigTpCalibData;
120 
121 // Option information (12 byte)
122 typedef struct NVRAMConfigOption
123 {
124     u16     language:3;                // Language code
125     u16     agbLcd:1;                  // Start up on which LCD when booting in AGB mode? (0: TOP, 1: BOTTOM)
126     u16     detectPullOutCardFlag:1;   // Flag that indicates that the card has been pulled out
127     u16     detectPullOutCtrdgFlag:1;  // Flag that indicates that the Game Pak has been pulled out
128     u16     autoBootFlag:1;            // Whether or not to automatically start up without stopping at the menu in the startup sequence.
129     u16     rsv:4;                     // Reserved
130     u16     input_favoriteColor:1;     // Was a favorite color input?
131     u16     input_tp:1;                // Has the Touch Screen been calibrated? ( " )
132     u16     input_language:1;          // Was a language input?         (0: Not configured, 1: Configured)
133     u16     input_rtc:1;               // Was the RTC configured?          (       "       )
134     u16     input_nickname:1;          // Was a nickname input? (       "        )
135     u8      timezone;                  // Time Zone (currently reserved)
136     u8      rtcClockAdjust;            // RTC Clock adjustment value
137     s64     rtcOffset;                 // Offset value when configuring the RTC (each time the user changes the configuration of the RTC, this fluctuates in response to that value)
138 
139 }
140 NVRAMConfigOption;
141 
142 
143 // Various types of configuration data (112 byte)
144 typedef struct NVRAMConfigData
145 {
146     u8      version;                   // Flash storage data format version
147     u8      pad;
148     NVRAMConfigOwnerInfo owner;        // Owner Information
149     NVRAMConfigAlarm alarm;            // Alarm clock data for IPL
150     NVRAMConfigTpCalibData tp;         // Touch Panel Calibration Data
151     NVRAMConfigOption option;          // Options
152 
153 }
154 NVRAMConfigData;
155 
156 // Format when saving the NVRAM for each type of configuration data (116 byte)
157 typedef struct NVRAMConfig
158 {
159     NVRAMConfigData ncd;               // Various types of configuration data
160     u16     saveCount;                 // Counts 0x00-0x7f by looping; valid if the count is new data
161     u16     crc16;                     // 16-bit CRC of various types of configuration data
162 
163 }
164 NVRAMConfig;
165 
166 
167 /*===========================================================================*/
168 
169 #ifdef  __cplusplus
170 }       /* extern "C" */
171 #endif
172 
173 #endif /* NITRO_SPI_COMMON_USERINFO_TS_200_H_ */
174 
175 /*---------------------------------------------------------------------------*
176   End of file
177  *---------------------------------------------------------------------------*/
178