FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/services/ffs/cfgffs.c @ 223:0848c7f419fd
gsm-fw/configs: checking some configurations into source control,
now that we have some selectable features
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 07 Jan 2014 05:58:11 +0000 |
parents | fee45482aa2a |
children | 4d706a4134b0 |
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 extern struct block_info_s ramffs_block_info[RAMFFS_NBLOCKS]; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 struct dev_s dev = { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 .base = _RAMFFS_area, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 .binfo = ramffs_block_info, |
218
fee45482aa2a
FFS: hopefully-correct initialization for the FFS_IN_RAM configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
210
diff
changeset
|
24 .manufact = MANUFACT_RAM, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 .blocksize = RAMFFS_BLKSIZE_BYTES, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 .blocksize_ld = RAMFFS_BLKSIZE_LOG2, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 .driver = FFS_DRIVER_RAM, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 .numblocks = RAMFFS_NBLOCKS, |
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 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 #elif CONFIG_MOKOFFS |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 static struct block_info_s mokoffs_blocks[7] = { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 { 0x00000, 16 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 { 0x10000, 16 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 { 0x20000, 16 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 { 0x30000, 16 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 { 0x40000, 16 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 { 0x50000, 16 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 { 0x60000, 16 } |
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 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 struct dev_s dev = { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 .base = (char *) 0x380000, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 .binfo = mokoffs_blocks, |
218
fee45482aa2a
FFS: hopefully-correct initialization for the FFS_IN_RAM configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
210
diff
changeset
|
46 .manufact = MANUFACT_SAMSUNG, |
fee45482aa2a
FFS: hopefully-correct initialization for the FFS_IN_RAM configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
210
diff
changeset
|
47 .device = 0x22A0, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 .blocksize = 0x10000, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 .blocksize_ld = 16, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 .driver = FFS_DRIVER_AMD, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 .numblocks = 7, |
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 #elif CONFIG_PIRHACK_FFS |
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 /* see ../../cfgmagic/feature.pirhack-ffs */ |
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 static struct block_info_s pirhack_ffs_blocks[7] = { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 { 0x600000, 18 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 { 0x640000, 18 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 { 0x680000, 18 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 { 0x6C0000, 18 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 { 0x700000, 18 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 { 0x740000, 18 }, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 { 0x780000, 18 } |
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 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 struct dev_s dev = { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 .base = (char *) FLASH2_BASE_ADDR, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 .binfo = pirhack_ffs_blocks, |
218
fee45482aa2a
FFS: hopefully-correct initialization for the FFS_IN_RAM configuration
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
210
diff
changeset
|
71 .manufact = MANUFACT_AMD, |
210
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 .blocksize = 0x40000, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 .blocksize_ld = 18, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 .driver = FFS_DRIVER_AMD, |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 .numblocks = 7, |
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 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 #else |
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 #error "No valid FFS configuration defined" |
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 #endif |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 /****************************************************************************** |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 * ffs_is_modify_valid() |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 ******************************************************************************/ |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 // 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
|
89 // 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
|
90 // 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
|
91 // disallowed. Returning non-zero means go ahead. |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 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
|
93 { |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 // 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
|
95 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 /* |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 * 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
|
98 * 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
|
99 * 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
|
100 */ |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 #if 0 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 // 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
|
103 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
|
104 return 0; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 #endif |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 return 1; |
1d87b335fc50
gsm-fw/services/ffs: cfgffs.c integrated
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 } |