comparison src/cs/drivers/drv_app/ffs/board/cfgffs.c @ 0:92470e5d0b9e

src: partial import from FC Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 01:28:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92470e5d0b9e
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 #ifndef TARGET
12 #include "ffs.cfg"
13 #endif
14
15 #include "ffs/ffs.h"
16 #include "ffs/board/drv.h"
17
18 #include "config/board.cfg"
19
20 #if (BOARD == 34)
21 #include "ffs/board/ffspcm.h"
22 #endif
23
24 #include "config/rf.cfg"
25
26 #include <string.h>
27
28 /******************************************************************************
29 * Flash Device Configuration
30 ******************************************************************************/
31
32 #if (TARGET == 1)
33
34 // The absolutely easiest way to disable FFS altogether is to set
35 // ffs_flash_manufact = 0x99 and ffs_flash_device = 0x9999. Because this is
36 // (as of today at least) an undefined device, FFS will NOT initialize and
37 // every FFS function call will fail (with no side-effects).
38
39 // FFS will automatically detect the flash device if both ffs_flash_manufact
40 // and ffs_flash_device are zero. Note that this works *only* if the flash
41 // device is mapped at address zero. Otherwise you *have* to supply
42 // manufacturer and device IDs.
43
44 // FFS can be configured to run in ram only. In this case the
45 // 'ffs_flash_manufact' must be set to MANUFACT_RAM and an address to a
46 // static user allocated ram buffer must be applied to the variable
47 // 'ffs_flash_address'. In a ram configuration the 'ffs_flash_device' is an
48 // arbitrary value that must be in sync with the 'device code' value chosen
49 // in dev.c.
50
51 #if (BOARD == 34)
52 uint16 ffs_flash_manufact = MANUFACT_RAM;
53 uint16 ffs_flash_device = 0x0404; // RAM
54
55 int ffs_ram_image_address = FFS_BASE_ADDRESS;
56
57 #else
58
59 uint16 ffs_flash_manufact = 0x00; // autodetect device
60 //uint16 ffs_flash_manufact = MANUFACT_RAM;
61 //uint16 ffs_flash_manufact = 0x04; // Fujitsu
62 //uint16 ffs_flash_manufact = 0xBF; // SST
63
64 uint16 ffs_flash_device = 0x0000; // autodetect device
65 //uint16 ffs_flash_device = 0x0404; // RAM
66 //uint16 ffs_flash_device = 0xB496; // Fujitsu stacked device
67 //uint16 ffs_flash_device = 0x2761; // SST device 1601
68 //uint16 ffs_flash_device = 0x2259; // 8x8kB blocks
69
70 int ffs_ram_image_address = 0; // Dummy
71
72 //unsigned char ffs_image[8*8*1024];
73 //int ffs_ram_image_address = (int) &ffs_image;
74
75 #endif // BOARD == 34
76
77 #else
78
79 uint16 ffs_flash_manufact = 'T';
80 //uint16 ffs_flash_device = 0x0F12; // Test device: 128x64kB blocks
81 uint16 ffs_flash_device = 0x0F10; // Test device: 16x64kB blocks
82 //uint16 ffs_flash_device = 0x080D; // Test device: 8x8kB blocks
83 //uint16 ffs_flash_device = 0x0404; // Test device: 4x4kB blocks
84
85 int ffs_ram_image_address = 0; // Dummy
86 #endif
87
88
89 /******************************************************************************
90 * ffs_is_modify_valid()
91 ******************************************************************************/
92
93 // This is function to be implemented by the application programmer. It is
94 // called by ffs when a read-only object is about to be modified or
95 // removed. It should return zero if the operation should be
96 // disallowed. Returning non-zero means go ahead.
97 effs_t ffs_is_modifiable(const char *name)
98 {
99 // default is to allow any modification of read-only objects.
100
101 // example of how to disallow modifying a specific object...
102 if (strcmp("IMEI", &name[strlen(name) - 4]) == 0)
103 return 0;
104
105 return 1;
106 }