FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/services/ffs/cfgffs.c @ 270:d1388095ab27
doc/RVTMUX write-up
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 06 Feb 2014 09:54:02 +0000 |
parents | 4d706a4134b0 |
children | f22b34873ea5 |
rev | line source |
---|---|
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /****************************************************************************** |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * Flash File System (ffs) |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * FFS configuration |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * $Id: cfgffs.c 1.27 Fri, 19 Dec 2003 12:00:13 +0100 tsj $ |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 * |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 ******************************************************************************/ |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "../../include/config.h" |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "ffs.h" |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "drv.h" |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "ramffs.h" |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include <string.h> |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 #if FFS_IN_RAM |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 struct dev_s dev = { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 .base = _RAMFFS_area, |
218
fee45482aa2a
FFS: hopefully-correct initialization for the FFS_IN_RAM configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
210
diff
changeset
|
21 .manufact = MANUFACT_RAM, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 .blocksize = RAMFFS_BLKSIZE_BYTES, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 .blocksize_ld = RAMFFS_BLKSIZE_LOG2, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 .driver = FFS_DRIVER_RAM, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 .numblocks = RAMFFS_NBLOCKS, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 }; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 #elif CONFIG_MOKOFFS |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 struct dev_s dev = { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 .base = (char *) 0x380000, |
218
fee45482aa2a
FFS: hopefully-correct initialization for the FFS_IN_RAM configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
210
diff
changeset
|
32 .manufact = MANUFACT_SAMSUNG, |
fee45482aa2a
FFS: hopefully-correct initialization for the FFS_IN_RAM configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
210
diff
changeset
|
33 .device = 0x22A0, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 .blocksize = 0x10000, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 .blocksize_ld = 16, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 .driver = FFS_DRIVER_AMD, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 .numblocks = 7, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 }; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 #elif CONFIG_PIRHACK_FFS |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 /* see ../../cfgmagic/feature.pirhack-ffs */ |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 struct dev_s dev = { |
226
4d706a4134b0
FFS in gsm-fw: generate the legacy block info table at run time
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
218
diff
changeset
|
45 .base = (char *) FLASH2_BASE_ADDR + |
4d706a4134b0
FFS in gsm-fw: generate the legacy block info table at run time
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
218
diff
changeset
|
46 CONFIG_PIRHACK_FFS_START * 0x40000, |
218
fee45482aa2a
FFS: hopefully-correct initialization for the FFS_IN_RAM configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
210
diff
changeset
|
47 .manufact = MANUFACT_AMD, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 .blocksize = 0x40000, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 .blocksize_ld = 18, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 .driver = FFS_DRIVER_AMD, |
226
4d706a4134b0
FFS in gsm-fw: generate the legacy block info table at run time
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
218
diff
changeset
|
51 .numblocks = CONFIG_PIRHACK_FFS_NBLOCKS, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 }; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 #else |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 #error "No valid FFS configuration defined" |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 #endif |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 /****************************************************************************** |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 * ffs_is_modify_valid() |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 ******************************************************************************/ |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 // This is function to be implemented by the application programmer. It is |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 // called by ffs when a read-only object is about to be modified or |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 // removed. It should return zero if the operation should be |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 // disallowed. Returning non-zero means go ahead. |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 effs_t ffs_is_modifiable(const char *name) |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 // default is to allow any modification of read-only objects. |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 /* |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 * TI's original code (conditioned out below) disallowed changing the |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 * IMEI of a device. FreeCalypso follows a different philosophy: |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 * 100% user empowerment, hence no artificial obstacles to hacking. |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 */ |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 #if 0 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 // example of how to disallow modifying a specific object... |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 if (strcmp("IMEI", &name[strlen(name) - 4]) == 0) |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 return 0; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 #endif |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 return 1; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 } |