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

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