1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - TCL - include 3 File: api.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_API_H_ 18 #define TWL_TCL_API_H_ 19 20 #include <twl/misc.h> 21 #include <twl/types.h> 22 #include <nitro/fs.h> 23 #include <twl/tcl/ARM9/types.h> 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 /*-------------------------------------------------------------------------* 30 Name: TCL_GetTableBufferSize 31 32 Description: Buffer size needed to load the management file. 33 34 Arguments: 35 36 Returns: Buffer size. 37 *-------------------------------------------------------------------------*/ 38 extern u32 TCL_GetTableBufferSize( void ); 39 40 /*-------------------------------------------------------------------------* 41 Name: TCL_GetWorkBufferSize 42 43 Description: Working buffer size needed to use the management file. 44 45 Arguments: 46 47 Returns: Buffer size. 48 *-------------------------------------------------------------------------*/ 49 extern u32 TCL_GetWorkBufferSize( void ); 50 51 /*-------------------------------------------------------------------------* 52 Name: TCL_LoadTable 53 54 Description: Loads the management table. 55 Allocate a 32-byte aligned buffer. 56 57 Arguments: pAccessor: Accessor 58 tableBuffer: Loading buffer 59 tableBufferSize: Buffer size. 60 (The size provided by the TCL_GetTableBufferSize function.) 61 workBuffer: Working buffer 62 workBufferSize: Working buffer size. 63 (The size provided by the TCL_GetWorkBufferSize function.) 64 pFSResult: Where the FSResult is stored when an error is generated by an FS function. 65 66 Returns: TCLResult. 67 *-------------------------------------------------------------------------*/ 68 extern TCLResult TCL_LoadTable( TCLAccessor* pAccessor , 69 void* tableBuffer , 70 u32 tableBufferSize , 71 void* workBuffer , 72 u32 workBufferSize , 73 FSResult* pFSResult ); 74 75 /*-------------------------------------------------------------------------* 76 Name: TCL_CreateTable 77 78 Description: Creates management table. 79 Allocate a 32-byte aligned buffer. 80 81 Arguments: pAccessor: Accessor 82 tableBuffer: Loading buffer 83 tableBufferSize: Buffer size. 84 (The size provided by the TCL_GetTableBufferSize function.) 85 workBuffer: Working buffer 86 workBufferSize: Working buffer size. 87 (The size provided by the TCL_GetWorkBufferSize function.) 88 pFSResult: Where the FSResult is stored when an error is generated by an FS function. 89 90 Returns: TCLResult. 91 *-------------------------------------------------------------------------*/ 92 extern TCLResult TCL_CreateTable( TCLAccessor* pAccessor , 93 void* tableBuffer , 94 u32 tableBufferSize , 95 void* workBuffer , 96 u32 workBufferSize , 97 FSResult* pFSResult ); 98 99 /*-------------------------------------------------------------------------* 100 Name: TCL_RepairTable 101 102 Description: Restores management table. 103 104 Arguments: pAccessor: Accessor 105 pFSResult: Where the FSResult is stored when an error is generated by an FS function. 106 107 Returns: TCLResult. 108 *-------------------------------------------------------------------------*/ 109 extern TCLResult TCL_RepairTable( TCLAccessor* pAccessor , FSResult* pFSResult ); 110 111 /*-------------------------------------------------------------------------* 112 Name: TCL_SortTable 113 114 Description: Sorts management table. 115 116 Arguments: pAccessor: Accessor 117 sortType: Sort type 118 119 Returns: None. 120 *-------------------------------------------------------------------------*/ 121 extern void TCL_SortTable( TCLAccessor* pAccessor , TCLSortType sortType ); 122 123 /*-------------------------------------------------------------------------* 124 Name: TCL_InitSearchObject 125 126 Description: Initializes search object. 127 128 Arguments: pSearchObj: Search object 129 condition: Search condition 130 131 Returns: None. 132 *-------------------------------------------------------------------------*/ 133 extern void TCL_InitSearchObject( TCLSearchObject* pSearchObj , u32 condition ); 134 135 /*-------------------------------------------------------------------------* 136 Name: TCL_GetNumPictures 137 138 Description: How many photos match the search conditions? 139 140 Arguments: pAccessor: Accessor 141 pSearchObj: Search object 142 143 Returns: Number of photos. 144 *-------------------------------------------------------------------------*/ 145 extern int TCL_GetNumPictures( const TCLAccessor* pAccessor , const TCLSearchObject* pSearchObj ); 146 147 /*-------------------------------------------------------------------------* 148 Name: TCL_SearchNextPictureInfo 149 150 Description: Gets the next piece of photo information that matches the search conditions. 151 152 Arguments: pAccessor: Accessor 153 ppPicInfo: Photo information storage location 154 pSearchObj: Search object 155 156 Returns: TCLResult. 157 *-------------------------------------------------------------------------*/ 158 extern TCLResult TCL_SearchNextPictureInfo( const TCLAccessor* pAccessor , 159 const TCLPictureInfo** ppPicInfo , 160 TCLSearchObject* pSearchObj ); 161 162 /*-------------------------------------------------------------------------* 163 Name: TCL_SearchPictureInfoByIndex 164 165 Description: Gets the photo information specified by the Index that matches the search conditions. 166 167 168 Arguments: pAccessor: Accessor 169 ppPicInfo: Photo information storage location 170 pSearchObj: Search object 171 index: Index 172 173 Returns: TCLResult. 174 *-------------------------------------------------------------------------*/ 175 extern TCLResult TCL_SearchPictureInfoByIndex( const TCLAccessor* pAccessor , 176 const TCLPictureInfo** ppPicInfo , 177 const TCLSearchObject* pSearchObj , 178 int index ); 179 180 /*-------------------------------------------------------------------------* 181 Name: TCL_DecodePicture 182 183 Description: Performs JPEG decoding. 184 185 Arguments: fileBuffer: File buffer 186 fileBufferSize: File buffer size 187 imageBuffer: Image buffer 188 width: Decode image width 189 height: Decode image height 190 decodeOption: Decode option 191 192 Returns: TCLResult. 193 *-------------------------------------------------------------------------*/ 194 extern TCLResult TCL_DecodePicture( u8* fileBuffer , 195 u32 fileBufferSize , 196 void* imageBuffer , 197 s16 width , 198 s16 height , 199 u32 decodeOption ); 200 201 /*-------------------------------------------------------------------------* 202 Name: TCL_SearchNextPicturePath 203 204 Description: Gets the next photo path that matches the search conditions. 205 206 Arguments: pAccessor: Accessor 207 path: Path storage location 208 len: Path length 209 pSearchObj: Search object 210 211 Returns: TCLResult. 212 *-------------------------------------------------------------------------*/ 213 extern TCLResult TCL_SearchNextPicturePath( const TCLAccessor* pAccessor , 214 char* path , 215 size_t len , 216 TCLSearchObject* pSearchObj ); 217 218 /*-------------------------------------------------------------------------* 219 Name: TCL_SearchPicturePathByIndex 220 221 Description: Gets the path of the photo specified by the Index that matches the search conditions. 222 223 224 Arguments: pAccessor: Accessor 225 path: Path storage location 226 len: Path length 227 pSearchObj: Search object 228 index: Index 229 230 Returns: TCLResult. 231 *-------------------------------------------------------------------------*/ 232 extern TCLResult TCL_SearchPicturePathByIndex( const TCLAccessor* pAccessor , 233 char* path , 234 size_t len , 235 const TCLSearchObject* pSearchObj , 236 int index ); 237 238 /*-------------------------------------------------------------------------* 239 Name: TCL_PrintPicturePath 240 241 Description: Gets photo path. 242 243 Arguments: path: Path storage location 244 len: Path length 245 pPicInfo: Photo information 246 247 Returns: STD_TSNPrintf return value. 248 *-------------------------------------------------------------------------*/ 249 extern int TCL_PrintPicturePath( char* path , 250 size_t len , 251 const TCLPictureInfo* pPicInfo ); 252 253 /*-------------------------------------------------------------------------* 254 Name: TCL_CalcNumEnableToTakePictures 255 256 Description: Calculates how many photos can be taken. 257 258 Arguments: pAccessor: Accessor 259 260 Returns: Number of photos that can be taken. (A negative number indicates some kind of failure.) 261 *-------------------------------------------------------------------------*/ 262 extern int TCL_CalcNumEnableToTakePictures( const TCLAccessor* pAccessor ); 263 264 /*-------------------------------------------------------------------------* 265 Name: TCL_GetJpegEncoderBufferSize 266 267 Description: Returns the buffer size required for JPEG encoding. 268 Calls the SSP_GetJpegEncoderBufferSize function internally. 269 270 Arguments: option: Option to pass to the SSP_GetJpegEncoderBufferSize function. 271 272 Returns: Return value of the SSP_GetJpegEncoderBufferSize function. 273 *-------------------------------------------------------------------------*/ 274 extern u32 TCL_GetJpegEncoderBufferSize( u32 option ); 275 276 /*-------------------------------------------------------------------------* 277 Name: TCL_EncodeAndWritePicture 278 279 Description: Performs JPEG encoding of image and saves it. Also updates the management file. 280 Calls the TCL_GetCurrentSecond function internally. 281 282 Arguments: pAccessor: Accessor 283 imageBuffer: Image buffer 284 jpegBuffer: JPEG buffer 285 jpegBufferSize: JPEG buffer size 286 workBuffer: Work buffer necessary for JPEG encoding 287 quality: JPEG encoding quality 288 option: JPEG encoding options 289 pFSResult: Where the FSResult is stored when an error is generated by an FS function. 290 291 Returns: TCLResult. 292 *-------------------------------------------------------------------------*/ 293 extern TCLResult TCL_EncodeAndWritePicture( TCLAccessor* pAccessor , 294 const void* imageBuffer , 295 u8* jpegBuffer , 296 u32 jpegBufferSize , 297 u8* workBuffer , 298 u32 quality , 299 u32 option , 300 FSResult* pFSResult ); 301 302 /*-------------------------------------------------------------------------* 303 Name: TCL_EncodeAndWritePictureEx 304 305 Description: Performs JPEG encoding (user maker note settings) of image and saves it. Also updates the management file. 306 Calls the TCL_GetCurrentSecond function internally. 307 308 Arguments: pAccessor: Accessor 309 imageBuffer: Image buffer 310 jpegBuffer: JPEG buffer 311 jpegBufferSize: JPEG buffer size 312 workBuffer: Work buffer necessary for JPEG encoding 313 quality: JPEG encoding quality 314 option: JPEG encoding options 315 makerNoteBuffer: User maker note buffer 316 makerNoteBufferSize: User maker note buffer size 317 pFSResult: Where the FSResult is stored when an error is generated by an FS function. 318 319 Returns: TCLResult. 320 *-------------------------------------------------------------------------*/ 321 extern TCLResult TCL_EncodeAndWritePictureEx( TCLAccessor* pAccessor , 322 const void* imageBuffer , 323 u8* jpegBuffer , 324 u32 jpegBufferSize , 325 u8* workBuffer , 326 u32 quality , 327 u32 option , 328 u8* makerNoteBuffer , 329 u16 makerNoteBufferSize , 330 FSResult* pFSResult ); 331 332 /*-------------------------------------------------------------------------* 333 Name: TCL_GetLastWrittenPicturePath 334 335 Description: Returns path of image written last. 336 337 Arguments: 338 339 Returns: Path of image last written. 340 *-------------------------------------------------------------------------*/ 341 extern const char* TCL_GetLastWrittenPicturePath( void ); 342 343 /*-------------------------------------------------------------------------* 344 Name: TCL_IsSameImageType 345 346 Description: Whether recognized as same image type. 347 348 Arguments: pPicInfo: Photo information 349 pMakerNote: Manufacturer's notes 350 351 Returns: TRUE when recognized as same. 352 *-------------------------------------------------------------------------*/ 353 extern BOOL TCL_IsSameImageType( const TCLPictureInfo* pPicInfo , const TCLMakerNote* pMakerNote ); 354 355 /*-------------------------------------------------------------------------* 356 Name: TCL_GetCurrentSecond 357 358 Description: Gets the current time (in seconds). 359 Calls the RTC_GetDateTime function internally. 360 This function is defined with a weak symbol. 361 Redefine when exclusive processing for RTC is needed. 362 363 Arguments: 364 365 Returns: Current time (in seconds). 366 *-------------------------------------------------------------------------*/ 367 extern s64 TCL_GetCurrentSecond( void ); 368 369 #ifdef __cplusplus 370 } /* extern "C" */ 371 #endif 372 373 /* TWL_TCL_API_H_ */ 374 #endif 375