comparison gsm-fw/services/ffs/cfgffs.c @ 210:1d87b335fc50

gsm-fw/services/ffs: cfgffs.c integrated
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 26 Dec 2013 04:37:10 +0000
parents
children fee45482aa2a
comparison
equal deleted inserted replaced
209:6f4a12b4582f 210:1d87b335fc50
1 /******************************************************************************
2 * Flash File System (ffs)
3 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com
4 *
5 * FFS configuration
6 *
7 * $Id: cfgffs.c 1.27 Fri, 19 Dec 2003 12:00:13 +0100 tsj $
8 *
9 ******************************************************************************/
10
11 #include "../../include/config.h"
12 #include "ffs.h"
13 #include "drv.h"
14 #include "ramffs.h"
15 #include <string.h>
16
17 #if FFS_IN_RAM
18
19 extern struct block_info_s ramffs_block_info[RAMFFS_NBLOCKS];
20
21 struct dev_s dev = {
22 .base = _RAMFFS_area,
23 .binfo = ramffs_block_info,
24 .blocksize = RAMFFS_BLKSIZE_BYTES,
25 .blocksize_ld = RAMFFS_BLKSIZE_LOG2,
26 .driver = FFS_DRIVER_RAM,
27 .numblocks = RAMFFS_NBLOCKS,
28 };
29
30 #elif CONFIG_MOKOFFS
31
32 static struct block_info_s mokoffs_blocks[7] = {
33 { 0x00000, 16 },
34 { 0x10000, 16 },
35 { 0x20000, 16 },
36 { 0x30000, 16 },
37 { 0x40000, 16 },
38 { 0x50000, 16 },
39 { 0x60000, 16 }
40 };
41
42 struct dev_s dev = {
43 .base = (char *) 0x380000,
44 .binfo = mokoffs_blocks,
45 .blocksize = 0x10000,
46 .blocksize_ld = 16,
47 .driver = FFS_DRIVER_AMD,
48 .numblocks = 7,
49 };
50
51 #elif CONFIG_PIRHACK_FFS
52
53 /* see ../../cfgmagic/feature.pirhack-ffs */
54
55 static struct block_info_s pirhack_ffs_blocks[7] = {
56 { 0x600000, 18 },
57 { 0x640000, 18 },
58 { 0x680000, 18 },
59 { 0x6C0000, 18 },
60 { 0x700000, 18 },
61 { 0x740000, 18 },
62 { 0x780000, 18 }
63 };
64
65 struct dev_s dev = {
66 .base = (char *) FLASH2_BASE_ADDR,
67 .binfo = pirhack_ffs_blocks,
68 .blocksize = 0x40000,
69 .blocksize_ld = 18,
70 .driver = FFS_DRIVER_AMD,
71 .numblocks = 7,
72 };
73
74 #else
75
76 #error "No valid FFS configuration defined"
77
78 #endif
79
80 /******************************************************************************
81 * ffs_is_modify_valid()
82 ******************************************************************************/
83
84 // This is function to be implemented by the application programmer. It is
85 // called by ffs when a read-only object is about to be modified or
86 // removed. It should return zero if the operation should be
87 // disallowed. Returning non-zero means go ahead.
88 effs_t ffs_is_modifiable(const char *name)
89 {
90 // default is to allow any modification of read-only objects.
91
92 /*
93 * TI's original code (conditioned out below) disallowed changing the
94 * IMEI of a device. FreeCalypso follows a different philosophy:
95 * 100% user empowerment, hence no artificial obstacles to hacking.
96 */
97 #if 0
98 // example of how to disallow modifying a specific object...
99 if (strcmp("IMEI", &name[strlen(name) - 4]) == 0)
100 return 0;
101 #endif
102
103 return 1;
104 }