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.
15 * yaffscfg.c The configuration for the "direct" use of yaffs.
17 * This file is intended to be modified to your requirements.
18 * There is no need to redistribute this file.
25 unsigned yaffs_traceMask = 0xFFFFFFFF;
28 void yaffsfs_SetError(int err)
30 //Do whatever to set error
34 void yaffsfs_Lock(void)
38 void yaffsfs_Unlock(void)
42 __u32 yaffsfs_CurrentTime(void)
47 void yaffsfs_LocalInitialisation(void)
49 // Define locking semaphore.
54 // /boot 2MB boot disk (flash)
55 // /flash 14MB flash disk (flash)
56 // NB Though /boot and /flash occupy the same physical device they
57 // are still disticnt "yaffs_Devices. You may think of these as "partitions"
58 // using non-overlapping areas in the same device.
61 #include "yaffs_ramdisk.h"
62 #include "yaffs_flashif.h"
64 static yaffs_Device ramDev;
65 static yaffs_Device bootDev;
66 static yaffs_Device flashDev;
68 static yaffsfs_DeviceConfiguration yaffsfs_config[] = {
72 { "/flash", &flashDev},
77 int yaffs_StartUp(void)
79 // Stuff to configure YAFFS
80 // Stuff to initialise anything special (eg lock semaphore).
81 yaffsfs_LocalInitialisation();
86 ramDev.nBytesPerChunk = 512;
87 ramDev.nChunksPerBlock = 32;
88 ramDev.nReservedBlocks = 2; // Set this smaller for RAM
89 ramDev.startBlock = 1; // Can't use block 0
90 ramDev.endBlock = 127; // Last block in 2MB.
91 ramDev.useNANDECC = 1;
92 ramDev.nShortOpCaches = 0; // Disable caching on this device.
93 ramDev.genericDevice = (void *) 0; // Used to identify the device in fstat.
94 ramDev.writeChunkWithTagsToNAND = yramdisk_WriteChunkWithTagsToNAND;
95 ramDev.readChunkWithTagsFromNAND = yramdisk_ReadChunkWithTagsFromNAND;
96 ramDev.eraseBlockInNAND = yramdisk_EraseBlockInNAND;
97 ramDev.initialiseNAND = yramdisk_InitialiseNAND;
100 bootDev.nBytesPerChunk = 612;
101 bootDev.nChunksPerBlock = 32;
102 bootDev.nReservedBlocks = 5;
103 bootDev.startBlock = 1; // Can't use block 0
104 bootDev.endBlock = 127; // Last block in 2MB.
105 bootDev.useNANDECC = 0; // use YAFFS's ECC
106 bootDev.nShortOpCaches = 10; // Use caches
107 bootDev.genericDevice = (void *) 1; // Used to identify the device in fstat.
108 bootDev.writeChunkToNAND = yflash_WriteChunkToNAND;
109 bootDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
110 bootDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
111 bootDev.initialiseNAND = yflash_InitialiseNAND;
114 flashDev.nBytesPerChunk = 512;
115 flashDev.nChunksPerBlock = 32;
116 flashDev.nReservedBlocks = 5;
117 flashDev.startBlock = 128; // First block after 2MB
118 flashDev.endBlock = 1023; // Last block in 16MB
119 flashDev.useNANDECC = 0; // use YAFFS's ECC
120 flashDev.nShortOpCaches = 10; // Use caches
121 flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat.
122 flashDev.writeChunkToNAND = yflash_WriteChunkToNAND;
123 flashDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
124 flashDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
125 flashDev.initialiseNAND = yflash_InitialiseNAND;
127 yaffs_initialise(yaffsfs_config);