1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - OS - include
3   File:     ownerInfoEx_private.h
4 
5   Copyright 2003-2009 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:: 2010-07-10#$
14   $Rev: 11355 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef TWL_OS_COMMON_OWNERINFO_PRIVATE_H_
19 #define TWL_OS_COMMON_OWNERINFO_PRIVATE_H_
20 
21 #ifdef  __cplusplus
22 extern "C" {
23 #endif
24 
25 /*---------------------------------------------------------------------------*
26     Declarations that general developers should not be aware of have been taken out of ownerInfoEx.h.
27     Applications should not directly use the items defined here.
28  *---------------------------------------------------------------------------*/
29 
30 /*===========================================================================*/
31 
32 #include    <twl/types.h>
33 #include    <twl/spec.h>
34 #ifndef SDK_TWL
35 #include    <nitro/hw/common/mmap_shared.h>
36 #else
37 #include    <twl/hw/common/mmap_shared.h>
38 #endif
39 
40 #include <twl/os/common/ownerInfoEx.h>
41 
42 
43 /*---------------------------------------------------------------------------*
44     Formats that will be saved in main memory
45  *---------------------------------------------------------------------------*/
46 
47 
48 // Structure that is compatible with TWL timestamp data
49 typedef struct OSTWLDate{
50     u8              month;                      // Month: 01 to 12
51     u8              day;                        // Day: 01 to 31
52 } OSTWLDate;          // 2 bytes
53 
54 // Structure that is compatible with TWL owner information
55 typedef struct OSTWLOwnerInfo
56 {
57     u8              userColor : 4;              // Favorite color
58     u8              rsv : 4;                    // Reserved
59     u8              pad;                        // Padding
60     OSTWLDate       birthday;                   // Birthdate
61     u16             nickname[ OS_TWL_NICKNAME_LENGTH + 1 ];   // Nickname (with terminating character)
62     u16             comment[ OS_TWL_COMMENT_LENGTH + 1 ];     // Comment (with terminating character)
63 } OSTWLOwnerInfo;     // 80 bytes
64 
65 
66 // Structure that is compatible with TWL settings data
67 typedef struct OSTWLSettingsData
68 {
69     union {
70         struct {
71             u32     isFinishedInitialSetting : 1;       // Initial settings complete?
72             u32     isFinishedInitialSetting_Launcher : 1;  // Initial launcher settings complete?
73             u32     isSetLanguage : 1;                  // Language code set?
74             u32     isAvailableWireless : 1;            // Enabling/disabling the wireless module's RF unit
75             u32     rsv : 20;                           // Reserved
76             u32     isAgreeEULAFlagList : 8;            // List of EULA acceptance flags
77             // Wi-Fi settings are separate data; do not prepare the flags set here.
78         };
79         u32         raw;
80     } flags;
81     u8                      rsv[ 1 ];               // Reserved
82     u8                      country;                // Country code
83     u8                      language;               // Language (the 8-bit data size differs from NTR systems)
84     u8                      rtcLastSetYear;         // The year previously set with the RTC
85     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)�j
86                                                     //   The parameter size up to this point is 16 bytes
87     u8                      agreeEulaVersion[ 8 ];  //    8 bytes: The accepted EULA version
88     u8                      pad1[2];
89     u8                      pad2[6];                //    6 bytes
90     u8                      pad3[16];               //   16bytes
91     u8                      pad4[20];               //   20 bytes
92     OSTWLOwnerInfo          owner;                  //   80 bytes: Owner information
93     OSTWLParentalControl    parentalControl;        //  148 bytes: Parental Controls information
94 } OSTWLSettingsData;  // 296 bytes
95 
96 
97 // Structure that is compatible with configuration data for normal TWL hardware information
98 typedef struct OSTWLHWNormalInfo
99 {
100     u8              rtcAdjust;                                  // RTC adjustment value
101     u8              rsv[ 3 ];
102     u8              movableUniqueID[ OS_TWL_HWINFO_MOVABLE_UNIQUE_ID_LEN ]; // A unique ID that can be moved
103 } OSTWLHWNormalInfo;  // 20 bytes
104 
105 
106 // Structure that is compatible with configuration data for secure TWL hardware information
107 typedef struct OSTWLHWSecureInfo
108 {
109     u32             validLanguageBitmap;                            // A bitmap of language codes valid on this system
110     struct {
111         u8          forceDisableWireless :1;
112         u8          :7;
113     }flags;
114     u8              pad[ 3 ];
115     u8              region;                                         // Region
116     u8              serialNo[ OS_TWL_HWINFO_SERIALNO_LEN_MAX ];   // Serial number (an ASCII string with a terminating character)
117 } OSTWLHWSecureInfo;  // 24 bytes
118 
119 
120 typedef struct OSTWLWirelessFirmwareData
121 {
122     u8              data;
123     u8              rsv[ 3 ];
124 } OSTWLWirelessFirmwareData;
125 
126 /*---------------------------------------------------------------------------*
127     Function Declarations
128  *---------------------------------------------------------------------------*/
129 /*---------------------------------------------------------------------------*
130   Name:         OS_GetWirelessWirmwareData
131 
132   Description:  Gets pointer to data for wireless firmware.
133 
134   Arguments:    None.
135   Returns:      Returns a pointer to data for the wireless firmware.
136                 Return NULL when not running in TWL.
137  *---------------------------------------------------------------------------*/
138 OSTWLWirelessFirmwareData *OS_GetWirelessFirmwareData(void);
139 
140 /*---------------------------------------------------------------------------*
141   Name:         OS_GetValidLanguageBitmap
142 
143   Description:  Gets the bitmap for the corresponding language
144 
145   Arguments:    None.
146   Returns:      Returns the bitmap for the corresponding language
147                 Return 0 when not running in TWL
148  *---------------------------------------------------------------------------*/
149 u32 OS_GetValidLanguageBitmap(void);
150 
151 /*---------------------------------------------------------------------------*
152   Name:         OS_GetSerialNo
153 
154   Description:  Gets the serial number.
155 
156   Arguments:    serialNo: Storage destination
157                            Stores OS_TWL_HWINFO_SERIALNO_LEN_MAX bytes, including the terminating character.
158                            When not running in TWL, always fill with 0
159 
160   Returns:      None.
161  *---------------------------------------------------------------------------*/
162 void    OS_GetSerialNo(u8 *serialNo);
163 
164 /*---------------------------------------------------------------------------*
165   Name:         OS_IsRestrictDSDownloadBoot
166 
167   Description:  Determines whether a Parental Controls setting has been applied to restrict DS Download Play from starting.
168 
169 
170   Arguments:    None.
171 
172   Returns:      TRUE if restrictions have been applied and FALSE otherwise.
173  *---------------------------------------------------------------------------*/
OS_IsRestrictDSDownloadBoot(void)174 static inline BOOL OS_IsRestrictDSDownloadBoot( void )
175 {
176     return (BOOL)OS_GetParentalControlInfoPtr()->flags.isSetParentalControl && (BOOL)OS_GetParentalControlInfoPtr()->flags.dsDownload;
177 }
178 
179 /*===========================================================================*/
180 
181 #ifdef  __cplusplus
182 }       /* extern "C" */
183 #endif
184 
185 #endif /* TWL_OS_COMMON_OWNERINFO_EX_PRIVATE_H_ */
186 
187 /*---------------------------------------------------------------------------*
188   End of file
189  *---------------------------------------------------------------------------*/
190