1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - SPI - include
3   File:     userInfo_teg.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_TEG_H_
18 #define NITRO_SPI_COMMON_USERINFO_TEG_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           0
31 
32 // Various setting values within config
33 #define NVRAM_CONFIG_BOOT_GAME_LOG_NUM      8   // Number of saved boot game logs
34 #define NVRAM_CONFIG_NICKNAME_LENGTH        8   // Nickname Length
35 
36 // Language setting code
37 #define NVRAM_CONFIG_LANG_JAPANESE          0   // Japanese
38 #define NVRAM_CONFIG_LANG_ENGLISH           1   // English
39 #define NVRAM_CONFIG_LANG_FRENCH            2   // French
40 #define NVRAM_CONFIG_LANG_GERMAN            3   // German
41 #define NVRAM_CONFIG_LANG_ITALIAN           4   // Italian
42 #define NVRAM_CONFIG_LANG_SPANISH           5   // Spanish
43 #define NVRAM_CONFIG_LANG_CODE_MAX          6   // Number of types of language setting codes
44 
45 /*---------------------------------------------------------------------------*
46     Structure Definitions
47  *---------------------------------------------------------------------------*/
48 // Nickname (20 bytes)
49 typedef struct NVRAMConfigNickname
50 {
51     u16     name[NVRAM_CONFIG_NICKNAME_LENGTH]; // Nickname (Maximum of 8 characters in UNICODE, no terminating code)
52     u16     length;                    // Number of characters
53     u16     padding;
54 
55 }
56 NVRAMConfigNickname;
57 
58 // Gender Code (4 bytes)
59 typedef enum NVRAMConfigSexCode
60 {
61     NVRAM_CONFIG_SEX_MALE = 0,         // Male
62     NVRAM_CONFIG_SEX_FEMALE,           // Female
63     NVRAM_CONFIG_SEX_CODE_MAX
64 }
65 NVRAMConfigSexCode;
66 
67 // Blood type code (4 bytes)
68 typedef enum NVRAMConfigBloodType
69 {
70     NVRAM_CONFIG_BLOOD_A = 0,          // Type A
71     NVRAM_CONFIG_BLOOD_B,              // Type B
72     NVRAM_CONFIG_BLOOD_AB,             // Type AB
73     NVRAM_CONFIG_BLOOD_O,              // Type O
74     NVRAM_CONFIG_BLOOD_TYPE_MAX
75 }
76 NVRAMConfigBloodType;
77 
78 // Date data (4 bytes)
79 typedef struct NVRAMConfigDate
80 {
81     u16     year;                      //Year: 1800 - 2100
82     u8      month;                     //Month: 01 - 12
83     u8      day;                       //Day: 01 - 31
84 
85 }
86 NVRAMConfigDate;
87 
88 // Owner Information (32 bytes)
89 typedef struct NVRAMConfigOwnerInfo
90 {
91     NVRAMConfigNickname nickname;      // Nickname
92     NVRAMConfigSexCode sex;            // Gender
93     NVRAMConfigBloodType bloodType;    // Blood type
94     NVRAMConfigDate birthday;          // Birthdate
95 
96 }
97 NVRAMConfigOwnerInfo;
98 
99 
100 // Boot game log data (36 bytes)
101 typedef struct NVRAMConfigBootGameLog
102 {
103     u32     gameCode[NVRAM_CONFIG_BOOT_GAME_LOG_NUM];   // List of game abbreviation codes for the games started up in the past (Ring Buffer)
104     u16     top;                       // Index number of the last log
105     u16     num;                       // Number of logs
106 
107 }
108 NVRAMConfigBootGameLog;                // 36 bytes
109 
110 // Touch Panel Calibration Data (12 bytes)
111 typedef struct NVRAMConfigTpCData
112 {
113     u16     calib_data[6];             // Calibration Information
114 
115 }
116 NVRAMConfigTpCData;
117 
118 
119 // Various types of configuration data (96 bytes)
120 typedef struct NVRAMConfigData
121 {
122     u8      version;                   // Flash storage data format version
123     u8      timezone;                  // Time zone
124     u16     agbLcd;                    // Start up on which LCD when booting in AGB mode? (0:TOP,1:BOTTOM)
125     u32     rtcOffset;                 // Offset value when configuring the RTC (each time the user changes the configuration of the RTC, this fluctuates in response to that value)
126     u32     language;                  // Language code
127     NVRAMConfigOwnerInfo owner;        // Owner Information
128     NVRAMConfigTpCData tp;             // Touch Panel Calibration Data
129     NVRAMConfigBootGameLog bootGameLog; // Boot Game Log
130 
131 }
132 NVRAMConfigData;
133 
134 // Format when saving NVRAM for various types of configuration data (100 bytes)
135 typedef struct NVRAMConfig
136 {
137     NVRAMConfigData ncd;               // Various types of configuration data
138     u16     saveCount;                 // Counts 0x00-0x7f by looping; valid if the count is new data
139     u16     crc16;                     // 16-bit CRC of various types of configuration data
140 
141 }
142 NVRAMConfig;
143 
144 
145 /*===========================================================================*/
146 
147 #ifdef  __cplusplus
148 }       /* extern "C" */
149 #endif
150 
151 #endif /* NITRO_SPI_COMMON_USERINFO_TEG_H_ */
152 
153 /*---------------------------------------------------------------------------*
154   End of file
155  *---------------------------------------------------------------------------*/
156