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;
18 void yaffsfs_SetError(int err)
20 //Do whatever to set error
24 void yaffsfs_Lock(void)
28 void yaffsfs_Unlock(void)
32 __u32 yaffsfs_CurrentTime(void)
37 void yaffsfs_LocalInitialisation(void)
39 // Define locking semaphore.
44 // /boot 2MB boot disk (flash)
45 // /flash 14MB flash disk (flash)
46 // NB Though /boot and /flash occupy the same physical device they
47 // are still disticnt "yaffs_Devices. You may think of these as "partitions"
48 // using non-overlapping areas in the same device.
51 #include "yaffs_ramdisk.h"
52 #include "yaffs_flashif.h"
54 static yaffs_Device ramDev;
55 static yaffs_Device bootDev;
56 static yaffs_Device flashDev;
58 static yaffsfs_DeviceConfiguration yaffsfs_config[] = {
62 { "/flash", &flashDev},
67 int yaffs_StartUp(void)
69 // Stuff to configure YAFFS
70 // Stuff to initialise anything special (eg lock semaphore).
71 yaffsfs_LocalInitialisation();
76 ramDev.nBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
77 ramDev.nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
78 ramDev.nReservedBlocks = 2; // Set this smaller for RAM
79 ramDev.startBlock = 0; // Can now use block zero
80 ramDev.endBlock = 127; // Last block in 2MB.
81 ramDev.useNANDECC = 1;
82 ramDev.nShortOpCaches = 0; // Disable caching on this device.
83 ramDev.genericDevice = (void *) 0; // Used to identify the device in fstat.
84 ramDev.writeChunkToNAND = yramdisk_WriteChunkToNAND;
85 ramDev.readChunkFromNAND = yramdisk_ReadChunkFromNAND;
86 ramDev.eraseBlockInNAND = yramdisk_EraseBlockInNAND;
87 ramDev.initialiseNAND = yramdisk_InitialiseNAND;
90 bootDev.nBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
91 bootDev.nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
92 bootDev.nReservedBlocks = 5;
93 bootDev.startBlock = 0; // Can now use block zero
94 bootDev.endBlock = 127; // Last block in 2MB.
95 bootDev.useNANDECC = 0; // use YAFFS's ECC
96 bootDev.nShortOpCaches = 10; // Use caches
97 bootDev.genericDevice = (void *) 1; // Used to identify the device in fstat.
98 bootDev.writeChunkToNAND = yflash_WriteChunkToNAND;
99 bootDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
100 bootDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
101 bootDev.initialiseNAND = yflash_InitialiseNAND;
104 flashDev.nBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
105 flashDev.nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
106 flashDev.nReservedBlocks = 5;
107 flashDev.startBlock = 128; // First block after 2MB
108 flashDev.endBlock = 1023; // Last block in 16MB
109 flashDev.useNANDECC = 0; // use YAFFS's ECC
110 flashDev.nShortOpCaches = 10; // Use caches
111 flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat.
112 flashDev.writeChunkToNAND = yflash_WriteChunkToNAND;
113 flashDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
114 flashDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
115 flashDev.initialiseNAND = yflash_InitialiseNAND;
117 yaffs_initialise(yaffsfs_config);