FreeCalypso > hg > fc-tourmaline
comparison src/ui/mfw/mfw_ffs.c @ 188:92abb46dc1ba
src/ui/mfw/*.[ch]: rm trailing white space
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 19 Jan 2021 06:10:27 +0000 |
parents | 67bfe9f274f6 |
children |
comparison
equal
deleted
inserted
replaced
187:a33dd8a5dcc9 | 188:92abb46dc1ba |
---|---|
16 Description:Can't access Fileviewer when too many pictures has been taken | 16 Description:Can't access Fileviewer when too many pictures has been taken |
17 (no space in FFS). After taking maximum snapshot(up to out of memory) cant access | 17 (no space in FFS). After taking maximum snapshot(up to out of memory) cant access |
18 ETM . ETM shows error "Maximum open file reached" | 18 ETM . ETM shows error "Maximum open file reached" |
19 Solution: As the relience flag is enabled, to solve this issue, function Flash_formatted() | 19 Solution: As the relience flag is enabled, to solve this issue, function Flash_formatted() |
20 is now checking the return value of ffs_opendir() to close the mmi/ directory properly. | 20 is now checking the return value of ffs_opendir() to close the mmi/ directory properly. |
21 Also MMI is calling mfw_close_dir() to close mmi/jpeg/ directory while exiting from camera | 21 Also MMI is calling mfw_close_dir() to close mmi/jpeg/ directory while exiting from camera |
22 application. | 22 application. |
23 | 23 |
24 | 24 |
25 Jan 10, 2007 DR: OMAPS00110568 x0039928 | 25 Jan 10, 2007 DR: OMAPS00110568 x0039928 |
26 Description: Remove duplication of FFS.Flashdata from GDI | 26 Description: Remove duplication of FFS.Flashdata from GDI |
27 Solution: Added two new functions get_ffs_tty_status() and get_ffs_ttypftype() | 27 Solution: Added two new functions get_ffs_tty_status() and get_ffs_ttypftype() |
28 | 28 |
29 Nov 07, 2006 ER: OMAPS00102732 x0pleela | 29 Nov 07, 2006 ER: OMAPS00102732 x0pleela |
30 Description: FFS Support for Intel Sibley Flash - Intel 256+64 non-ADMUX (PF38F4050M0Y0C0Q) | 30 Description: FFS Support for Intel Sibley Flash - Intel 256+64 non-ADMUX (PF38F4050M0Y0C0Q) |
31 Solution: Closing the opened directory if readdir is not successful and the new code | 31 Solution: Closing the opened directory if readdir is not successful and the new code |
32 is under the compilation flag FF_MMI_RELIANCE_FFS | 32 is under the compilation flag FF_MMI_RELIANCE_FFS |
33 | 33 |
34 Sep 08, 2006 DR: OMAPS00091250 x0pleela | 34 Sep 08, 2006 DR: OMAPS00091250 x0pleela |
35 Description:The phone resets if no MEPD data is presented | 35 Description:The phone resets if no MEPD data is presented |
36 Solution: Added new function ffs_flash_write() which writes a string into FFS | 36 Solution: Added new function ffs_flash_write() which writes a string into FFS |
37 | 37 |
38 xrashmic 22 Aug, 2004 MMI-SPR-32798 | 38 xrashmic 22 Aug, 2004 MMI-SPR-32798 |
39 Adding the support for screen capture using a dynamically assigned key. | 39 Adding the support for screen capture using a dynamically assigned key. |
40 | 40 |
41 Apr 14, 2005 REF: CRR 29991 xpradipg | 41 Apr 14, 2005 REF: CRR 29991 xpradipg |
42 Description: Optimisation 5: Remove the static allocation and use dynamic | 42 Description: Optimisation 5: Remove the static allocation and use dynamic |
43 allocation/ deallocation for pb_list and black_list | 43 allocation/ deallocation for pb_list and black_list |
44 Solution: The static definition is removed and replaced with the dynamic | 44 Solution: The static definition is removed and replaced with the dynamic |
45 allocation | 45 allocation |
46 | 46 |
47 Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu | 47 Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu |
48 Issue description: Golite booting problem. | 48 Issue description: Golite booting problem. |
49 Solution: If the FFS is not formatted, prevent writing into FFS. | 49 Solution: If the FFS is not formatted, prevent writing into FFS. |
50 | 50 |
51 Aug 25, 2004 REF: CRR 20655 xnkulkar | 51 Aug 25, 2004 REF: CRR 20655 xnkulkar |
52 Description: Voice Memo functionality not working | 52 Description: Voice Memo functionality not working |
53 Solution: The voice recording functionality was failing because | 53 Solution: The voice recording functionality was failing because |
54 " mmi" folder is not present. As a solution, we create the | 54 " mmi" folder is not present. As a solution, we create the |
55 "mmi" folder and then proceed with recording. | 55 "mmi" folder and then proceed with recording. |
56 */ | 56 */ |
57 | 57 |
58 #define ENTITY_MFW | 58 #define ENTITY_MFW |
59 | 59 |
130 #define T_PSPDF_SMS 20 | 130 #define T_PSPDF_SMS 20 |
131 #define MAX_NO_SMS 20 | 131 #define MAX_NO_SMS 20 |
132 #endif | 132 #endif |
133 #endif | 133 #endif |
134 | 134 |
135 // Apr 14, 2005 REF: CRR 29991 xpradipg | 135 // Apr 14, 2005 REF: CRR 29991 xpradipg |
136 // New file added for the blacklist. The total length along with the path aand | 136 // New file added for the blacklist. The total length along with the path aand |
137 // file name should not exceed 20 characters | 137 // file name should not exceed 20 characters |
138 #ifdef FF_MMI_OPTIM | 138 #ifdef FF_MMI_OPTIM |
139 #define BLACK_LIST_PATH_AND_FILE "/mmi/blacklist" | 139 #define BLACK_LIST_PATH_AND_FILE "/mmi/blacklist" |
140 #endif | 140 #endif |
144 #else | 144 #else |
145 EXTERN T_VSI_CHANDLE hCommACI; | 145 EXTERN T_VSI_CHANDLE hCommACI; |
146 #endif | 146 #endif |
147 #ifdef TI_PS_HCOMM_CHANGE | 147 #ifdef TI_PS_HCOMM_CHANGE |
148 #define _hCommMMI hCommACI | 148 #define _hCommMMI hCommACI |
149 #else | 149 #else |
150 #define hCommMMI hCommACI | 150 #define hCommMMI hCommACI |
151 #endif | 151 #endif |
152 | 152 |
153 typedef enum | 153 typedef enum |
154 { | 154 { |
183 PURPOSE : To write a string into FFS. | 183 PURPOSE : To write a string into FFS. |
184 | 184 |
185 */ | 185 */ |
186 //x0pleela 08 Sep, 2006 DR: OMAPS00091250 | 186 //x0pleela 08 Sep, 2006 DR: OMAPS00091250 |
187 void mfw_flash_write(char *Msg,...) | 187 void mfw_flash_write(char *Msg,...) |
188 { | 188 { |
189 fd_t fd= -1; | 189 fd_t fd= -1; |
190 char log_ffs_buf[256]; | 190 char log_ffs_buf[256]; |
191 va_list varpars; | 191 va_list varpars; |
192 va_start (varpars, Msg); | 192 va_start (varpars, Msg); |
193 vsprintf(log_ffs_buf,Msg,varpars); | 193 vsprintf(log_ffs_buf,Msg,varpars); |
194 va_end (varpars); | 194 va_end (varpars); |
195 | 195 |
196 fd = ffs_open((const char*)"/mmiMEPD", FFS_O_APPEND | FFS_O_WRONLY ); | 196 fd = ffs_open((const char*)"/mmiMEPD", FFS_O_APPEND | FFS_O_WRONLY ); |
197 if(fd < 0) | 197 if(fd < 0) |
198 fd=ffs_open((const char*)"/mmiMEPD", FFS_O_CREATE |FFS_O_WRONLY ); | 198 fd=ffs_open((const char*)"/mmiMEPD", FFS_O_CREATE |FFS_O_WRONLY ); |
199 if(fd > 0) | 199 if(fd > 0) |
200 { | 200 { |
201 ffs_write(fd, log_ffs_buf, strlen(log_ffs_buf)); | 201 ffs_write(fd, log_ffs_buf, strlen(log_ffs_buf)); |
202 ffs_close(fd); | 202 ffs_close(fd); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 effs_t flash_write(void) | 206 effs_t flash_write(void) |
207 { | 207 { |
208 | 208 |
209 // Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu | 209 // Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu |
210 // Issue description: Golite booting problem. | 210 // Issue description: Golite booting problem. |
211 // Solution: If the FFS is not formatted, dont write into the FFS. | 211 // Solution: If the FFS is not formatted, dont write into the FFS. |
212 | 212 |
213 if ( flash_formatted() == TRUE) | 213 if ( flash_formatted() == TRUE) |
214 { | 214 { |
215 return (flash_data_write("/mmi","mmidata", &FFS_flashData, sizeof(FFS_flashData))); | 215 return (flash_data_write("/mmi","mmidata", &FFS_flashData, sizeof(FFS_flashData))); |
216 } | 216 } |
217 else | 217 else |
218 { | 218 { |
219 TRACE_EVENT("ERROR flash_data_write(): NOT FORMATTED!"); | 219 TRACE_EVENT("ERROR flash_data_write(): NOT FORMATTED!"); |
220 // Return NOT formatted message. | 220 // Return NOT formatted message. |
221 return EFFS_NOFORMAT; | 221 return EFFS_NOFORMAT; |
222 } | 222 } |
252 { | 252 { |
253 TRACE_ERROR("The FFS data could not be read!"); | 253 TRACE_ERROR("The FFS data could not be read!"); |
254 TRACE_EVENT_P1("val = %d", val); | 254 TRACE_EVENT_P1("val = %d", val); |
255 /* Error, presumably -ve as in FFS_ERRORS, or the actual number of bytes read */ | 255 /* Error, presumably -ve as in FFS_ERRORS, or the actual number of bytes read */ |
256 } | 256 } |
257 return val; | 257 return val; |
258 } | 258 } |
259 #else | 259 #else |
260 int flash_read() | 260 int flash_read() |
261 {FFS_flashData.settings_status|= SettingsAnyKeyAnswerOn; | 261 {FFS_flashData.settings_status|= SettingsAnyKeyAnswerOn; |
262 FFS_flashData.settings_status &= ~SettingsKeyPadLockOn; | 262 FFS_flashData.settings_status &= ~SettingsKeyPadLockOn; |
268 | 268 |
269 } | 269 } |
270 #endif | 270 #endif |
271 | 271 |
272 effs_t flash_data_write(const char* dir_name, const char* file_name, void* data_pointer, int data_size) | 272 effs_t flash_data_write(const char* dir_name, const char* file_name, void* data_pointer, int data_size) |
273 { | 273 { |
274 T_FFS_DIR dir; | 274 T_FFS_DIR dir; |
275 int val; | 275 int val; |
276 char file[200]; | 276 char file[200]; |
277 | 277 |
278 /* SPR#2487 - DS - If FFS is not formatted, return from function */ | 278 /* SPR#2487 - DS - If FFS is not formatted, return from function */ |
280 { | 280 { |
281 TRACE_EVENT("ERROR flash_data_write(): NOT FORMATTED!"); | 281 TRACE_EVENT("ERROR flash_data_write(): NOT FORMATTED!"); |
282 return EFFS_NOFORMAT; | 282 return EFFS_NOFORMAT; |
283 } | 283 } |
284 | 284 |
285 #ifndef PCM_2_FFS | 285 #ifndef PCM_2_FFS |
286 val = FFS_opendir(dir_name, &dir); | 286 val = FFS_opendir(dir_name, &dir); |
287 #else | 287 #else |
288 val = ffs_opendir((const signed char *)dir_name, &dir); | 288 val = ffs_opendir((const signed char *)dir_name, &dir); |
289 #endif | 289 #endif |
290 | 290 |
291 if(val < 0) | 291 if(val < 0) |
292 { | 292 { |
293 | 293 |
294 #ifndef PCM_2_FFS | 294 #ifndef PCM_2_FFS |
295 val = FFS_mkdir(dir_name); | 295 val = FFS_mkdir(dir_name); |
296 #else | 296 #else |
297 val = ffs_mkdir(dir_name); | 297 val = ffs_mkdir(dir_name); |
298 #endif | 298 #endif |
299 | 299 |
303 case EFFS_EXISTS: | 303 case EFFS_EXISTS: |
304 break; | 304 break; |
305 default: | 305 default: |
306 TRACE_ERROR("The FFS directory could not be created!"); | 306 TRACE_ERROR("The FFS directory could not be created!"); |
307 TRACE_EVENT_P2("val = %d dir name = %s", val, dir_name); | 307 TRACE_EVENT_P2("val = %d dir name = %s", val, dir_name); |
308 return (effs_t)val; | 308 return (effs_t)val; |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 sprintf(file, "%s/%s", dir_name, file_name); | 312 sprintf(file, "%s/%s", dir_name, file_name); |
313 | 313 |
314 #ifdef PCM_2_FFS | 314 #ifdef PCM_2_FFS |
315 val = ffs_fwrite( (const S8 *) file, data_pointer, data_size); | 315 val = ffs_fwrite( (const S8 *) file, data_pointer, data_size); |
316 #else | 316 #else |
317 val = FFS_fwrite( file, data_pointer, data_size); | 317 val = FFS_fwrite( file, data_pointer, data_size); |
318 #endif | 318 #endif |
319 | 319 |
320 if(val NEQ EFFS_OK) | 320 if(val NEQ EFFS_OK) |
321 { | 321 { |
322 TRACE_ERROR("The FFS file could not be created"); | 322 TRACE_ERROR("The FFS file could not be created"); |
323 TRACE_EVENT_P2("val = %d file name = %s", val, file); | 323 TRACE_EVENT_P2("val = %d file name = %s", val, file); |
324 } | 324 } |
325 | 325 |
326 | 326 |
327 //x0pleela 07 Nov, 2006 DVT: OMAPS00102732 | 327 //x0pleela 07 Nov, 2006 DVT: OMAPS00102732 |
328 //Adding the MMI compilation flag FF_MMI_RELIANCE_FFS | 328 //Adding the MMI compilation flag FF_MMI_RELIANCE_FFS |
329 #if defined ( PCM_2_FFS ) || defined( FF_MMI_RELIANCE_FFS) | 329 #if defined ( PCM_2_FFS ) || defined( FF_MMI_RELIANCE_FFS) |
330 ffs_closedir( &dir ); | 330 ffs_closedir( &dir ); |
331 #endif | 331 #endif |
332 | 332 |
333 return (effs_t)val; | 333 return (effs_t)val; |
334 } | 334 } |
335 | 335 |
336 /* Marcus: Issue 1719: 11/02/2003: Changed return value from effs_t to int */ | 336 /* Marcus: Issue 1719: 11/02/2003: Changed return value from effs_t to int */ |
337 int flash_data_read(const char* dir_name, const char* file_name, void* data_pointer, int data_size) | 337 int flash_data_read(const char* dir_name, const char* file_name, void* data_pointer, int data_size) |
338 { | 338 { |
339 int val; | 339 int val; |
340 char file[200]; | 340 char file[200]; |
341 | 341 |
342 sprintf(file, "%s/%s", dir_name, file_name); | 342 sprintf(file, "%s/%s", dir_name, file_name); |
343 | 343 |
344 #ifdef PCM_2_FFS | 344 #ifdef PCM_2_FFS |
345 val = ffs_fread((const S8 *) file, data_pointer, data_size); | 345 val = ffs_fread((const S8 *) file, data_pointer, data_size); |
346 #else | 346 #else |
347 val = FFS_fread( file, data_pointer, data_size); | 347 val = FFS_fread( file, data_pointer, data_size); |
348 #endif | 348 #endif |
349 | 349 |
350 if (val NEQ data_size) | 350 if (val NEQ data_size) |
351 { | 351 { |
352 TRACE_ERROR("The FFS data could not be read!"); | 352 TRACE_ERROR("The FFS data could not be read!"); |
353 TRACE_EVENT_P1("val = %d", val); | 353 TRACE_EVENT_P1("val = %d", val); |
354 /* Error, presumably -ve as in FFS_ERRORS, or the actual number of bytes read */ | 354 /* Error, presumably -ve as in FFS_ERRORS, or the actual number of bytes read */ |
362 T_FFS_DIR dir; | 362 T_FFS_DIR dir; |
363 int val; | 363 int val; |
364 char sFileName[100]; | 364 char sFileName[100]; |
365 | 365 |
366 /* Attempt to open "/mmi" directory */ | 366 /* Attempt to open "/mmi" directory */ |
367 #ifndef PCM_2_FFS | 367 #ifndef PCM_2_FFS |
368 val = FFS_opendir("/mmi", &dir); | 368 val = FFS_opendir("/mmi", &dir); |
369 #else | 369 #else |
370 val = ffs_opendir("/mmi", &dir); | 370 val = ffs_opendir("/mmi", &dir); |
371 #endif | 371 #endif |
372 | 372 |
373 | 373 |
374 /* If return val is not EFFS_NOFORMAT then | 374 /* If return val is not EFFS_NOFORMAT then |
375 * assume that FFS is formatted. | 375 * assume that FFS is formatted. |
376 */ | 376 */ |
377 if (val == EFFS_NOFORMAT) | 377 if (val == EFFS_NOFORMAT) |
378 return FALSE; | 378 return FALSE; |
379 else | 379 else |
382 if (val >= 0) | 382 if (val >= 0) |
383 { | 383 { |
384 while (ffs_readdir (&dir, sFileName, 100) > 0x0 ); | 384 while (ffs_readdir (&dir, sFileName, 100) > 0x0 ); |
385 | 385 |
386 //x0pleela 07 Nov, 2006 DVT: OMAPS00102732 | 386 //x0pleela 07 Nov, 2006 DVT: OMAPS00102732 |
387 //Adding the MMI compilation flag FF_MMI_RELIANCE_FFS | 387 //Adding the MMI compilation flag FF_MMI_RELIANCE_FFS |
388 //x0pleela 31 Oct, 2006 | 388 //x0pleela 31 Oct, 2006 |
389 //Closing the directory aa per the new FFS logic | 389 //Closing the directory aa per the new FFS logic |
390 #ifdef FF_MMI_RELIANCE_FFS | 390 #ifdef FF_MMI_RELIANCE_FFS |
391 ffs_closedir(&dir); | 391 ffs_closedir(&dir); |
392 #endif | 392 #endif |
393 return TRUE; | 393 return TRUE; |
394 | 394 |
395 } | 395 } |
396 else if (EFFS_NOTFOUND == val) | 396 else if (EFFS_NOTFOUND == val) |
397 { | 397 { |
398 /* if the mmi directory was not found, but the FFS was formatted, */ | 398 /* if the mmi directory was not found, but the FFS was formatted, */ |
399 /* create the mmi dir.*/ | 399 /* create the mmi dir.*/ |
400 | 400 |
401 #ifndef PCM_2_FFS | 401 #ifndef PCM_2_FFS |
402 val = FFS_mkdir("/mmi"); | 402 val = FFS_mkdir("/mmi"); |
403 #else | 403 #else |
404 val = ffs_mkdir("/mmi"); | 404 val = ffs_mkdir("/mmi"); |
405 #endif | 405 #endif |
406 switch(val) | 406 switch(val) |
414 } | 414 } |
415 } | 415 } |
416 } | 416 } |
417 return TRUE; | 417 return TRUE; |
418 } | 418 } |
419 | 419 |
420 /* | 420 /* |
421 Aug 25, 2004 REF: CRR 20655 xnkulkar | 421 Aug 25, 2004 REF: CRR 20655 xnkulkar |
422 | 422 |
423 +--------------------------------------------------------------------+ | 423 +--------------------------------------------------------------------+ |
424 | PROJECT: MMI-Framework (8417) MODULE: MFW_FFS | | 424 | PROJECT: MMI-Framework (8417) MODULE: MFW_FFS | |
428 PURPOSE : Creates a directory if not present | 428 PURPOSE : Creates a directory if not present |
429 */ | 429 */ |
430 void flash_makedir(char * dir_name) | 430 void flash_makedir(char * dir_name) |
431 { | 431 { |
432 T_FFS_DIR dir; | 432 T_FFS_DIR dir; |
433 #ifndef PCM_2_FFS | 433 #ifndef PCM_2_FFS |
434 int val = FFS_opendir(dir_name , &dir); | 434 int val = FFS_opendir(dir_name , &dir); |
435 #else | 435 #else |
436 int val = ffs_opendir(dir_name , &dir); | 436 int val = ffs_opendir(dir_name , &dir); |
437 #endif | 437 #endif |
438 | 438 |
439 | 439 |
440 if(val < 0) | 440 if(val < 0) |
441 { | 441 { |
442 | 442 |
443 #ifndef PCM_2_FFS | 443 #ifndef PCM_2_FFS |
444 val = FFS_mkdir(dir_name); | 444 val = FFS_mkdir(dir_name); |
445 #else | 445 #else |
446 val = ffs_mkdir(dir_name); | 446 val = ffs_mkdir(dir_name); |
447 #endif | 447 #endif |
448 switch(val) | 448 switch(val) |
451 case EFFS_EXISTS: | 451 case EFFS_EXISTS: |
452 break; | 452 break; |
453 default: | 453 default: |
454 TRACE_ERROR("The FFS directory could not be created!"); | 454 TRACE_ERROR("The FFS directory could not be created!"); |
455 TRACE_EVENT_P2("val = %d dir name = %s", val, dir_name); | 455 TRACE_EVENT_P2("val = %d dir name = %s", val, dir_name); |
456 return; | 456 return; |
457 } | 457 } |
458 } | 458 } |
459 | 459 |
460 //x0pleela 07 Nov, 2006 DVT: OMAPS00102732 | 460 //x0pleela 07 Nov, 2006 DVT: OMAPS00102732 |
461 //Adding the MMI compilation flag FF_MMI_RELIANCE_FFS | 461 //Adding the MMI compilation flag FF_MMI_RELIANCE_FFS |
462 #if defined( PCM_2_FFS) || defined (FF_MMI_RELIANCE_FFS) | 462 #if defined( PCM_2_FFS) || defined (FF_MMI_RELIANCE_FFS) |
463 ffs_closedir( &dir ); | 463 ffs_closedir( &dir ); |
464 #endif | 464 #endif |
465 | 465 |
466 } | 466 } |
467 | 467 |
468 #ifdef MMI_EM_ENABLED | 468 #ifdef MMI_EM_ENABLED |
469 #ifndef NEPTUNE_BOARD | 469 #ifndef NEPTUNE_BOARD |
470 /* This portion is not valid for Neptune, hence excluding it.*/ | 470 /* This portion is not valid for Neptune, hence excluding it.*/ |
471 U32 get_screen_size(void); | 471 U32 get_screen_size(void); |
516 } | 516 } |
517 #endif /* ifndef NEPTUNE_BOARD*/ | 517 #endif /* ifndef NEPTUNE_BOARD*/ |
518 #endif | 518 #endif |
519 | 519 |
520 | 520 |
521 // Apr 14, 2005 REF: CRR 29991 xpradipg | 521 // Apr 14, 2005 REF: CRR 29991 xpradipg |
522 #ifdef FF_MMI_OPTIM | 522 #ifdef FF_MMI_OPTIM |
523 /******************************************************************************* | 523 /******************************************************************************* |
524 | 524 |
525 $Function: flash_MMI_blackList_open | 525 $Function: flash_MMI_blackList_open |
526 | 526 |
527 $Description: This opens the blacklist file | 527 $Description: This opens the blacklist file |
528 | 528 |
529 $Returns: value of the open result | 529 $Returns: value of the open result |
530 | 530 |
531 $Arguments: none | 531 $Arguments: none |
532 | 532 |
533 *******************************************************************************/ | 533 *******************************************************************************/ |
534 int8 flash_MMI_blackList_open( ) | 534 int8 flash_MMI_blackList_open( ) |
535 { | 535 { |
536 T_FFS_FD file=EFFS_NOFORMAT; | 536 T_FFS_FD file=EFFS_NOFORMAT; |
537 /*a0393213 compiler warnings removal - variable status removed*/ | 537 /*a0393213 compiler warnings removal - variable status removed*/ |
538 if(flash_formatted()) | 538 if(flash_formatted()) |
539 { | 539 { |
540 file = FFS_open(BLACK_LIST_PATH_AND_FILE, FFS_O_RDWR); | 540 file = FFS_open(BLACK_LIST_PATH_AND_FILE, FFS_O_RDWR); |
541 if(file == EFFS_NOTFOUND) | 541 if(file == EFFS_NOTFOUND) |
542 { | 542 { |
543 TRACE_FUNCTION("the file does not exist and is created"); | 543 TRACE_FUNCTION("the file does not exist and is created"); |
544 file = FFS_open(BLACK_LIST_PATH_AND_FILE, FFS_O_RDWR | FFS_O_CREATE); | 544 file = FFS_open(BLACK_LIST_PATH_AND_FILE, FFS_O_RDWR | FFS_O_CREATE); |
545 if(file < 0 ) | 545 if(file < 0 ) |
546 { | 546 { |
547 TRACE_FUNCTION("file creation failed"); | 547 TRACE_FUNCTION("file creation failed"); |
548 return file; | 548 return file; |
549 } | 549 } |
550 return file; | 550 return file; |
555 /******************************************************************************* | 555 /******************************************************************************* |
556 | 556 |
557 $Function: flash_MMI_blackList_close | 557 $Function: flash_MMI_blackList_close |
558 | 558 |
559 $Description: This closes the file opened for read operation | 559 $Description: This closes the file opened for read operation |
560 | 560 |
561 $Returns: zero for success and -1 for failure | 561 $Returns: zero for success and -1 for failure |
562 | 562 |
563 $Arguments: handle - handle of the file to be closed | 563 $Arguments: handle - handle of the file to be closed |
564 | 564 |
565 *******************************************************************************/ | 565 *******************************************************************************/ |
566 void flash_MMI_blackList_close(int8 handle) | 566 void flash_MMI_blackList_close(int8 handle) |
567 { | 567 { |
568 FFS_close((T_FFS_FD)handle); | 568 FFS_close((T_FFS_FD)handle); |
569 } | 569 } |
570 | 570 |
571 /******************************************************************************* | 571 /******************************************************************************* |
572 | 572 |
573 $Function: flash_MMI_blackList_write | 573 $Function: flash_MMI_blackList_write |
574 | 574 |
575 $Description: This writes the blacklisted numbers onto the blacklist file | 575 $Description: This writes the blacklisted numbers onto the blacklist file |
581 | 581 |
582 *******************************************************************************/ | 582 *******************************************************************************/ |
583 int flash_MMI_blackList_write(U8 *data, SHORT len, SHORT offset) | 583 int flash_MMI_blackList_write(U8 *data, SHORT len, SHORT offset) |
584 { | 584 { |
585 | 585 |
586 T_FFS_FD file; | 586 T_FFS_FD file; |
587 /*a0393213 compiler warnings removal - variable status removed*/ | 587 /*a0393213 compiler warnings removal - variable status removed*/ |
588 TRACE_FUNCTION("flash_MMI_blackList_write()"); | 588 TRACE_FUNCTION("flash_MMI_blackList_write()"); |
589 if(flash_formatted()) | 589 if(flash_formatted()) |
590 { | 590 { |
591 file = FFS_open(BLACK_LIST_PATH_AND_FILE, FFS_O_RDWR); | 591 file = FFS_open(BLACK_LIST_PATH_AND_FILE, FFS_O_RDWR); |
592 | 592 |
593 if(file == EFFS_NOTFOUND) | 593 if(file == EFFS_NOTFOUND) |
594 { | 594 { |
595 TRACE_FUNCTION("the file does not exist and is created"); | 595 TRACE_FUNCTION("the file does not exist and is created"); |
596 file = FFS_open(BLACK_LIST_PATH_AND_FILE, FFS_O_RDWR | FFS_O_CREATE); | 596 file = FFS_open(BLACK_LIST_PATH_AND_FILE, FFS_O_RDWR | FFS_O_CREATE); |
597 if(file < 0 ) | 597 if(file < 0 ) |
598 { | 598 { |
599 TRACE_FUNCTION("file creation failed"); | 599 TRACE_FUNCTION("file creation failed"); |
600 return file; | 600 return file; |
601 } | 601 } |
602 } | 602 } |
603 TRACE_FUNCTION("the file exist and is opened"); | 603 TRACE_FUNCTION("the file exist and is opened"); |
604 #ifdef PCM_2_FFS | 604 #ifdef PCM_2_FFS |
605 ffs_seek(file, offset, FFS_SEEK_SET); | 605 ffs_seek(file, offset, FFS_SEEK_SET); |
606 ffs_write(file, (void*)data, len); | 606 ffs_write(file, (void*)data, len); |
607 ffs_close(file); | 607 ffs_close(file); |
608 #else | 608 #else |
609 FFS_seek(file, offset, FFS_SEEK_SET); | 609 FFS_seek(file, offset, FFS_SEEK_SET); |
610 FFS_write(file, (void*)data, len); | 610 FFS_write(file, (void*)data, len); |
611 FFS_close(file); | 611 FFS_close(file); |
612 #endif | 612 #endif |
613 | 613 |
614 return 0; | 614 return 0; |
615 } | 615 } |
616 else | 616 else |
617 return -1; | 617 return -1; |
618 | 618 |
619 } | 619 } |
620 /******************************************************************************* | 620 /******************************************************************************* |
621 | 621 |
622 $Function: flash_MMI_blackList_read | 622 $Function: flash_MMI_blackList_read |
623 | 623 |
624 $Description: This reads the blacklisted numbers onto the data buffer | 624 $Description: This reads the blacklisted numbers onto the data buffer |
625 | 625 |
626 $Returns: zero for success and -1 for failure | 626 $Returns: zero for success and -1 for failure |
627 | 627 |
628 $Arguments: data - buffer into which data is retrieved from the file | 628 $Arguments: data - buffer into which data is retrieved from the file |
629 len - length of the data to be retrieved from the file | 629 len - length of the data to be retrieved from the file |
630 | 630 |
651 T_FFS_STAT stat; | 651 T_FFS_STAT stat; |
652 char buf[T_PSPDF_SMS*MAX_NO_SMS]; | 652 char buf[T_PSPDF_SMS*MAX_NO_SMS]; |
653 | 653 |
654 ffs_stat((const signed char *)name, &stat); | 654 ffs_stat((const signed char *)name, &stat); |
655 n = stat.size / recsize; | 655 n = stat.size / recsize; |
656 | 656 |
657 if (index > n) | 657 if (index > n) |
658 return EFFS_NOTFOUND; | 658 return EFFS_NOTFOUND; |
659 | 659 |
660 if (stat.size <= (T_PSPDF_SMS*MAX_NO_SMS)) | 660 if (stat.size <= (T_PSPDF_SMS*MAX_NO_SMS)) |
661 { | 661 { |
662 result = ffs_file_read((const signed char *)name, &buf, stat.size); | 662 result = ffs_file_read((const signed char *)name, &buf, stat.size); |
663 if (result == stat.size) | 663 if (result == stat.size) |
664 { | 664 { |
665 memcpy(addr, &buf[(index-1)*recsize], recsize); | 665 memcpy(addr, &buf[(index-1)*recsize], recsize); |
666 result = recsize; | 666 result = recsize; |
667 } | 667 } |
668 } | 668 } |
669 | 669 |
670 return result; | 670 return result; |
671 } | 671 } |
681 n = stat.size / recsize; | 681 n = stat.size / recsize; |
682 | 682 |
683 if (index > n) | 683 if (index > n) |
684 return EFFS_NOTFOUND; | 684 return EFFS_NOTFOUND; |
685 | 685 |
686 if (stat.size <= (T_PSPDF_SMS*MAX_NO_SMS)) | 686 if (stat.size <= (T_PSPDF_SMS*MAX_NO_SMS)) |
687 { | 687 { |
688 result = ffs_file_read((const signed char *)name, &buf, stat.size); | 688 result = ffs_file_read((const signed char *)name, &buf, stat.size); |
689 if (result == stat.size) | 689 if (result == stat.size) |
690 { | 690 { |
691 memcpy(&buf[(index-1)*recsize], addr, recsize); | 691 memcpy(&buf[(index-1)*recsize], addr, recsize); |
692 result = ffs_file_write((const signed char *)name, &buf, stat.size, (FFS_O_CREATE|FFS_O_TRUNC)); | 692 result = ffs_file_write((const signed char *)name, &buf, stat.size, (FFS_O_CREATE|FFS_O_TRUNC)); |
693 } | 693 } |
694 } | 694 } |
703 /******************************************************************************* | 703 /******************************************************************************* |
704 | 704 |
705 $Function: get_ffs_tty_status | 705 $Function: get_ffs_tty_status |
706 | 706 |
707 $Description: Gives the status of tty in Flash | 707 $Description: Gives the status of tty in Flash |
708 | 708 |
709 $Returns: tty status | 709 $Returns: tty status |
710 | 710 |
711 $Arguments: None | 711 $Arguments: None |
712 | 712 |
713 *******************************************************************************/ | 713 *******************************************************************************/ |
719 /******************************************************************************* | 719 /******************************************************************************* |
720 | 720 |
721 $Function: get_ffs_tty_pftype | 721 $Function: get_ffs_tty_pftype |
722 | 722 |
723 $Description: This gives the tty profile type to be loaded | 723 $Description: This gives the tty profile type to be loaded |
724 | 724 |
725 $Returns: tty profile type | 725 $Returns: tty profile type |
726 | 726 |
727 $Arguments: None | 727 $Arguments: None |
728 | 728 |
729 *******************************************************************************/ | 729 *******************************************************************************/ |