2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
3 * yaffscfg.c The configuration for the "direct" use of yaffs.
5 * This file is intended to be modified to your requirements.
6 * There is no need to redistribute this file.
13 unsigned yaffs_traceMask = 0xFFFFFFFF;
16 void yaffsfs_SetError(int err)
18 //Do whatever to set error
22 void yaffsfs_Lock(void)
26 void yaffsfs_Unlock(void)
30 __u32 yaffsfs_CurrentTime(void)
35 void yaffsfs_LocalInitialisation(void)
37 // Define locking semaphore.
42 // /boot 2MB boot disk (flash)
43 // /flash 14MB flash disk (flash)
44 // NB Though /boot and /flash occupy the same physical device they
45 // are still disticnt "yaffs_Devices. You may think of these as "partitions"
46 // using non-overlapping areas in the same device.
49 #include "yaffs_ramdisk.h"
50 #include "yaffs_flashif.h"
52 static yaffs_Device ramDev;
53 static yaffs_Device bootDev;
54 static yaffs_Device flashDev;
56 static yaffsfs_DeviceConfiguration yaffsfs_config[] = {
60 { "/flash", &flashDev},
65 int yaffs_StartUp(void)
67 // Stuff to configure YAFFS
68 // Stuff to initialise anything special (eg lock semaphore).
69 yaffsfs_LocalInitialisation();
74 ramDev.nBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
75 ramDev.nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
76 ramDev.startBlock = 1; // Can't use block 0
77 ramDev.endBlock = 127; // Last block in 2MB.
78 ramDev.useNANDECC = 1;
79 ramDev.nShortOpCaches = 0; // Disable caching on this device.
80 ramDev.genericDevice = (void *) 0; // Used to identify the device in fstat.
81 ramDev.writeChunkToNAND = yramdisk_WriteChunkToNAND;
82 ramDev.readChunkFromNAND = yramdisk_ReadChunkFromNAND;
83 ramDev.eraseBlockInNAND = yramdisk_EraseBlockInNAND;
84 ramDev.initialiseNAND = yramdisk_InitialiseNAND;
87 bootDev.nBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
88 bootDev.nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
89 bootDev.startBlock = 1; // Can't use block 0
90 bootDev.endBlock = 127; // Last block in 2MB.
91 bootDev.useNANDECC = 0; // use YAFFS's ECC
92 bootDev.nShortOpCaches = 10; // Use caches
93 bootDev.genericDevice = (void *) 1; // Used to identify the device in fstat.
94 bootDev.writeChunkToNAND = yflash_WriteChunkToNAND;
95 bootDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
96 bootDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
97 bootDev.initialiseNAND = yflash_InitialiseNAND;
100 flashDev.nBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
101 flashDev.nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
102 flashDev.startBlock = 128; // First block after 2MB
103 flashDev.endBlock = 1023; // Last block in 16MB
104 flashDev.useNANDECC = 0; // use YAFFS's ECC
105 flashDev.nShortOpCaches = 10; // Use caches
106 flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat.
107 flashDev.writeChunkToNAND = yflash_WriteChunkToNAND;
108 flashDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
109 flashDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
110 flashDev.initialiseNAND = yflash_InitialiseNAND;
112 yaffs_initialise(yaffsfs_config);