2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
4 * Copyright (C) 2002-2007 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Charles Manning <charles@aleph1.co.uk>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
16 * yaffscfg.c The configuration for the "direct" use of yaffs.
18 * This file is intended to be modified to your requirements.
19 * There is no need to redistribute this file.
26 unsigned yaffs_traceMask = 0xFFFFFFFF;
29 void yaffsfs_SetError(int err)
31 //Do whatever to set error
35 void yaffsfs_Lock(void)
39 void yaffsfs_Unlock(void)
43 __u32 yaffsfs_CurrentTime(void)
48 void yaffsfs_LocalInitialisation(void)
50 // Define locking semaphore.
55 // /boot 2MB boot disk (flash)
56 // /flash 14MB flash disk (flash)
57 // NB Though /boot and /flash occupy the same physical device they
58 // are still disticnt "yaffs_Devices. You may think of these as "partitions"
59 // using non-overlapping areas in the same device.
62 #include "yaffs_ramdisk.h"
63 #include "yaffs_flashif.h"
65 static yaffs_Device ramDev;
66 static yaffs_Device bootDev;
67 static yaffs_Device flashDev;
69 static yaffsfs_DeviceConfiguration yaffsfs_config[] = {
73 { "/flash", &flashDev},
78 int yaffs_StartUp(void)
80 // Stuff to configure YAFFS
81 // Stuff to initialise anything special (eg lock semaphore).
82 yaffsfs_LocalInitialisation();
87 ramDev.nBytesPerChunk = 512;
88 ramDev.nChunksPerBlock = 32;
89 ramDev.nReservedBlocks = 2; // Set this smaller for RAM
90 ramDev.startBlock = 1; // Can't use block 0
91 ramDev.endBlock = 127; // Last block in 2MB.
92 ramDev.useNANDECC = 1;
93 ramDev.nShortOpCaches = 0; // Disable caching on this device.
94 ramDev.genericDevice = (void *) 0; // Used to identify the device in fstat.
95 ramDev.writeChunkWithTagsToNAND = yramdisk_WriteChunkWithTagsToNAND;
96 ramDev.readChunkWithTagsFromNAND = yramdisk_ReadChunkWithTagsFromNAND;
97 ramDev.eraseBlockInNAND = yramdisk_EraseBlockInNAND;
98 ramDev.initialiseNAND = yramdisk_InitialiseNAND;
101 bootDev.nBytesPerChunk = 612;
102 bootDev.nChunksPerBlock = 32;
103 bootDev.nReservedBlocks = 5;
104 bootDev.startBlock = 1; // Can't use block 0
105 bootDev.endBlock = 127; // Last block in 2MB.
106 bootDev.useNANDECC = 0; // use YAFFS's ECC
107 bootDev.nShortOpCaches = 10; // Use caches
108 bootDev.genericDevice = (void *) 1; // Used to identify the device in fstat.
109 bootDev.writeChunkToNAND = yflash_WriteChunkToNAND;
110 bootDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
111 bootDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
112 bootDev.initialiseNAND = yflash_InitialiseNAND;
115 flashDev.nBytesPerChunk = 512;
116 flashDev.nChunksPerBlock = 32;
117 flashDev.nReservedBlocks = 5;
118 flashDev.startBlock = 128; // First block after 2MB
119 flashDev.endBlock = 1023; // Last block in 16MB
120 flashDev.useNANDECC = 0; // use YAFFS's ECC
121 flashDev.nShortOpCaches = 10; // Use caches
122 flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat.
123 flashDev.writeChunkToNAND = yflash_WriteChunkToNAND;
124 flashDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
125 flashDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
126 flashDev.initialiseNAND = yflash_InitialiseNAND;
128 yaffs_initialise(yaffsfs_config);