FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/services/ffs/cfgffs.c @ 993:d92e4aadeeb3
target-utils/c139explore: a cleaner way of setting the fixed UART base address
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Wed, 30 Dec 2015 22:12:35 +0000 |
parents | f22b34873ea5 |
children | 4c80a6e6723f |
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 |
943
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
40 #elif CONFIG_AFTERMARKET_FFS |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
41 |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
42 /* see ../../cfgmagic/feature.aftermarket-ffs */ |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
43 |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
44 #if CONFIG_TARGET_COMPAL |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 |
943
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
46 struct dev_s dev = { |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
47 .base = (char *) (CONFIG_AFTERMARKET_FFS_START * 0x10000), |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
48 .manufact = MANUFACT_INTEL, |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
49 .blocksize = 0x10000, |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
50 .blocksize_ld = 16, |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
51 .driver = FFS_DRIVER_INTEL_SB, |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
52 .numblocks = CONFIG_AFTERMARKET_FFS_NBLOCKS, |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
53 }; |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
54 |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
55 #elif CONFIG_TARGET_PIRELLI |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 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
|
58 .base = (char *) FLASH2_BASE_ADDR + |
943
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
59 CONFIG_AFTERMARKET_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
|
60 .manufact = MANUFACT_AMD, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 .blocksize = 0x40000, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 .blocksize_ld = 18, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 .driver = FFS_DRIVER_AMD, |
943
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
64 .numblocks = CONFIG_AFTERMARKET_FFS_NBLOCKS, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 }; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 #else |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 |
943
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
69 #error "Unknown target for CONFIG_AFTERMARKET_FFS" |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
70 |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
71 #endif |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
72 |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
73 #else |
f22b34873ea5
gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs,
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
226
diff
changeset
|
74 |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 #error "No valid FFS configuration defined" |
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 #endif |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 /****************************************************************************** |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 * ffs_is_modify_valid() |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 ******************************************************************************/ |
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 // 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
|
84 // 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
|
85 // 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
|
86 // disallowed. Returning non-zero means go ahead. |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 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
|
88 { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 // 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
|
90 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 /* |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 * 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
|
93 * 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
|
94 * 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
|
95 */ |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 #if 0 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 // 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
|
98 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
|
99 return 0; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 #endif |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 return 1; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 } |