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 = 512;
75 ramDev.nChunksPerBlock = 32;
76 ramDev.nReservedBlocks = 2; // Set this smaller for RAM
77 ramDev.startBlock = 1; // Can't use block 0
78 ramDev.endBlock = 127; // Last block in 2MB.
79 ramDev.useNANDECC = 1;
80 ramDev.nShortOpCaches = 0; // Disable caching on this device.
81 ramDev.genericDevice = (void *) 0; // Used to identify the device in fstat.
82 ramDev.writeChunkWithTagsToNAND = yramdisk_WriteChunkWithTagsToNAND;
83 ramDev.readChunkWithTagsFromNAND = yramdisk_ReadChunkWithTagsFromNAND;
84 ramDev.eraseBlockInNAND = yramdisk_EraseBlockInNAND;
85 ramDev.initialiseNAND = yramdisk_InitialiseNAND;
88 bootDev.nBytesPerChunk = 612;
89 bootDev.nChunksPerBlock = 32;
90 bootDev.nReservedBlocks = 5;
91 bootDev.startBlock = 1; // Can't use block 0
92 bootDev.endBlock = 127; // Last block in 2MB.
93 bootDev.useNANDECC = 0; // use YAFFS's ECC
94 bootDev.nShortOpCaches = 10; // Use caches
95 bootDev.genericDevice = (void *) 1; // Used to identify the device in fstat.
96 bootDev.writeChunkToNAND = yflash_WriteChunkToNAND;
97 bootDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
98 bootDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
99 bootDev.initialiseNAND = yflash_InitialiseNAND;
102 flashDev.nBytesPerChunk = 512;
103 flashDev.nChunksPerBlock = 32;
104 flashDev.nReservedBlocks = 5;
105 flashDev.startBlock = 128; // First block after 2MB
106 flashDev.endBlock = 1023; // Last block in 16MB
107 flashDev.useNANDECC = 0; // use YAFFS's ECC
108 flashDev.nShortOpCaches = 10; // Use caches
109 flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat.
110 flashDev.writeChunkToNAND = yflash_WriteChunkToNAND;
111 flashDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
112 flashDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
113 flashDev.initialiseNAND = yflash_InitialiseNAND;
115 yaffs_initialise(yaffsfs_config);