1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - TCL - include 3 File: types.h 4 5 Copyright 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:: 2009-03-05#$ 14 $Rev: 10166 $ 15 $Author: konoh $ 16 *---------------------------------------------------------------------------*/ 17 #ifndef TWL_TCL_TYPES_H_ 18 #define TWL_TCL_TYPES_H_ 19 20 #include <twl/misc.h> 21 #include <twl/types.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /*! 28 @brief Character Constants 29 */ 30 #define TCL_ARCHIVE_NAND "photo:" 31 32 #define TCL_DIR_SUFFIX "NIN02" 33 #define TCL_FILE_PREFIX "HNI_" 34 35 #define TCL_ROOT_DIR "DCIM" 36 #define TCL_PRIVATE_DIR "private/ds/app/484E494A" 37 #define TCL_FRAME_ROOT_DIR TCL_PRIVATE_DIR "/" TCL_ROOT_DIR 38 39 /*! 40 @brief Constants 41 */ 42 enum 43 { 44 TCL_MAX_NUM_NAND_PICTURES = 500 , 45 46 TCL_MAX_NUM_DIRS = 900 , 47 TCL_MAX_NUM_FILES_IN_A_DIR = 100 , 48 49 TCL_AVARAGE_SIZE = 80 * 1024 , // Average photo size 50 TCL_MARGIN_SIZE = 350 * 1024 , // Margin size for calculating the number of saved photos 51 TCL_MAX_JPEG_SIZE = 200 * 1024 , // Maximum JPEG size sought by the TCL library 52 53 TCL_DIR_OFFSET = 100 , 54 TCL_FILE_OFFSET = 1 , 55 56 TCL_JPEG_WIDTH = 640 , // Image width sought by the TCL library 57 TCL_JPEG_HEIGHT = 480 , // Image height sought by the TCL library 58 59 TCL_JPEG_DEFAULT_QUALITY = 80 , // Recommended quality value for SSP encoding 60 61 // How much the quality value is lowered at re-encoding if the file was too large in encoding result 62 TCL_JPEG_QUALITY_STEP = 10 , 63 64 TCL_PATH_LEN = 64 , // Path length 65 66 TCL_CONST_END 67 }; 68 69 /*! 70 @brief Target archive 71 */ 72 typedef enum 73 { 74 TCL_TARGET_ARCHIVE_NAND = 0 , 75 TCL_TARGET_ARCHIVE_SD , // Currently, SD Card cannot be used 76 TCL_TARGET_ARCHIVE_MAX 77 } TCLTargetArchive; 78 79 /*! 80 @brief Favorite type 81 */ 82 typedef enum 83 { 84 TCL_FAVORITE_TYPE_NONE = 0 , 85 TCL_FAVORITE_TYPE_1 , 86 TCL_FAVORITE_TYPE_2 , 87 TCL_FAVORITE_TYPE_3 , 88 TCL_FAVORITE_TYPE_ALL , 89 TCL_FAVORITE_TYPE_MAX = TCL_FAVORITE_TYPE_ALL 90 } TCLFavoriteType; 91 92 /*! 93 @brief Image type 94 */ 95 typedef enum 96 { 97 TCL_IMAGE_TYPE_PICTURE = 0 , 98 TCL_IMAGE_TYPE_FRAME , 99 TCL_IMAGE_TYPE_COMPOSITE , 100 TCL_IMAGE_TYPE_UNKNOWN , 101 TCL_IMAGE_TYPE_MAX 102 } TCLImageType; 103 104 /*! 105 @brief Key type 106 */ 107 typedef enum 108 { 109 TCL_KEY_TYPE_LAUNCHER = 0 , 110 TCL_KEY_TYPE_APPLICATION , 111 TCL_KEY_TYPE_UNKNOWN , 112 TCL_KEY_TYPE_MAX 113 } TCLKeyType; 114 115 /*! 116 @brief Search condition 117 */ 118 typedef enum 119 { 120 TCL_SEARCH_CONDITION_NONE = 0 , 121 TCL_SEARCH_CONDITION_PICTURE = 1 << 0x00 , 122 TCL_SEARCH_CONDITION_FRAME = 1 << 0x01 , 123 TCL_SEARCH_CONDITION_FAVORITE_NONE = 1 << 0x07 , 124 TCL_SEARCH_CONDITION_FAVORITE_1 = 1 << 0x08 , 125 TCL_SEARCH_CONDITION_FAVORITE_2 = 1 << 0x09 , 126 TCL_SEARCH_CONDITION_FAVORITE_3 = 1 << 0x0a , 127 TCL_SEARCH_CONDITION_FAVORITE_ALL = 1 << 0x0b , 128 TCL_SEARCH_CONDITION_LAUNCHER = 1 << 0x0c , 129 TCL_SEARCH_CONDITION_APPLICATION = 1 << 0x0d , 130 TCL_SEARCH_CONDITION_FREE = 1 << 0x10 , // The returning of a blank space is a somewhat unique condition and cannot therefore be combined 131 TCL_SEARCH_CONDITION_MAX 132 } TCLSearchCondition; 133 134 /*! 135 @brief Sort type 136 */ 137 typedef enum 138 { 139 TCL_SORT_TYPE_DATE = 0 , 140 TCL_SORT_TYPE_FAVORITE_1 , 141 TCL_SORT_TYPE_FAVORITE_2 , 142 TCL_SORT_TYPE_FAVORITE_3 , 143 TCL_SORT_TYPE_FAVORITE_ALL , 144 TCL_SORT_TYPE_FRAME , 145 TCL_SORT_TYPE_MAX 146 } TCLSortType; 147 148 /*! 149 @brief Return values for the different types of functions 150 */ 151 typedef enum 152 { 153 TCL_RESULT_SUCCESS = 0 , 154 TCL_RESULT_ERROR_FS_OPEN_FILE_EX , 155 TCL_RESULT_ERROR_FS_CLOSE_FILE , 156 TCL_RESULT_ERROR_FS_CREATE_FILE_AUTO , 157 TCL_RESULT_ERROR_FS_GET_FILE_LENGTH , 158 TCL_RESULT_ERROR_FS_READ_FILE , 159 TCL_RESULT_ERROR_FS_WRITE_FILE , 160 TCL_RESULT_ERROR_FS_DELETE_FILE , 161 TCL_RESULT_ERROR_FS_OPEN_DIRECTORY , 162 TCL_RESULT_ERROR_FS_CLOSE_DIRECTORY , 163 TCL_RESULT_ERROR_FS_GET_ARCHIVE_RESOURCE , 164 165 TCL_RESULT_ERROR_OVER_NUM_PICTURES , // The management table's save capacity has been exceeded 166 TCL_RESULT_ERROR_NO_TABLE_FILE , // The table was not found 167 TCL_RESULT_ERROR_BROKEN_TABLE_FILE , // Management file is corrupted 168 TCL_RESULT_ERROR_NO_NEXT_INDEX , // The next save location for a photo was not found 169 TCL_RESULT_ERROR_EXIST_OTHER_FILE , // Another file was in the next save location 170 TCL_RESULT_ERROR_ALREADY_MANAGED , // The specified index is already being managed 171 TCL_RESULT_ERROR_NO_FIND_PICTURE , // No photo was found in the specified index with a path search 172 173 TCL_RESULT_ERROR_SSP_START_JPEG_DECODER , // Decoding error 174 TCL_RESULT_ERROR_SSP_EXTRACT_JPEG_DECODER_EXIF , // exif loading error 175 176 TCL_RESULT_ERROR_OTHER , // Other errors: 177 TCL_RESULT_MAX 178 } TCLResult; 179 180 /*! 181 @brief Photo save location index maintained 182 */ 183 typedef struct 184 { 185 u16 dirIdx; 186 u16 fileIdx; 187 } TCLIndexInfo; 188 189 /*! 190 @brief Management file accessor 191 */ 192 typedef struct 193 { 194 void* tableBuffer; 195 u32 tableBufferSize; 196 void* workBuffer; 197 u32 workBufferSize; 198 } TCLAccessor; 199 200 /*! 201 @brief Management table header 202 */ 203 typedef struct 204 { 205 u32 signature; 206 u32 version; 207 u16 numElements; 208 u8 targetArchive; 209 u8 reserved0; 210 TCLIndexInfo picIdxInfo; 211 TCLIndexInfo frmIdxInfo; 212 u16 crc; 213 u16 offset; 214 } TCLTableHeader; 215 216 /*! 217 @brief Photo information structure 218 */ 219 typedef struct 220 { 221 s64 second; 222 int favoriteOrder; 223 224 union 225 { 226 u32 bitField; 227 struct 228 { 229 u32 validity : 1; 230 u32 dirIdx : 10; 231 u32 fileIdx : 7; 232 u32 favoriteType : 2; 233 u32 imageType : 2; 234 u32 keyType : 2; 235 u32 defaultFrame : 1; 236 u32 reserved : 7; 237 }; 238 }; 239 } TCLPictureInfo; 240 241 /*! 242 @brief Value to be stored in the manufacturer's notes 243 */ 244 typedef struct 245 { 246 union 247 { 248 u32 bitField; 249 struct 250 { 251 u32 imageType : 2; 252 u32 reserved0 : 30; 253 }; 254 }; 255 u32 reserved1; 256 } TCLMakerNote; 257 258 /*! 259 @brief Search object 260 */ 261 typedef struct 262 { 263 int startIdx; 264 u32 condition; 265 } TCLSearchObject; 266 267 #ifdef __cplusplus 268 } /* extern "C" */ 269 #endif 270 271 /* TWL_TCL_TYPES_H_ */ 272 #endif 273