2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
4 * Copyright (C) 2002-2010 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.
28 unsigned yaffs_traceMask = 0xFFFFFFFF;
31 void yaffsfs_SetError(int err)
33 //Do whatever to set error
37 void yaffsfs_Lock(void)
41 void yaffsfs_Unlock(void)
45 __u32 yaffsfs_CurrentTime(void)
50 void *yaffs_malloc(size_t size)
55 void yaffs_free(void *ptr)
60 void yaffsfs_LocalInitialisation(void)
62 // Define locking semaphore.
67 // /boot 2MB boot disk (flash)
68 // /flash 14MB flash disk (flash)
69 // NB Though /boot and /flash occupy the same physical device they
70 // are still disticnt "yaffs_Devices. You may think of these as "partitions"
71 // using non-overlapping areas in the same device.
74 #include "yaffs_ramdisk.h"
75 #include "yaffs_flashif.h"
77 static yaffs_Device ramDev;
78 static yaffs_Device bootDev;
79 static yaffs_Device flashDev;
81 static yaffsfs_DeviceConfiguration yaffsfs_config[] = {
85 { "/flash", &flashDev},
90 int yaffs_StartUp(void)
92 // Stuff to configure YAFFS
93 // Stuff to initialise anything special (eg lock semaphore).
94 yaffsfs_LocalInitialisation();
97 yramsim_CreateSim("yaffs2");
102 ramDev.nDataBytesPerChunk = 512;
103 ramDev.nChunksPerBlock = 32;
104 ramDev.nReservedBlocks = 2; // Set this smaller for RAM
105 ramDev.startBlock = 1; // Can't use block 0
106 ramDev.endBlock = 127; // Last block in 2MB.
107 ramDev.useNANDECC = 1;
108 ramDev.nShortOpCaches = 0; // Disable caching on this device.
109 ramDev.genericDevice = (void *) 0; // Used to identify the device in fstat.
110 ramDev.writeChunkWithTagsToNAND = yramdisk_WriteChunkWithTagsToNAND;
111 ramDev.readChunkWithTagsFromNAND = yramdisk_ReadChunkWithTagsFromNAND;
112 ramDev.eraseBlockInNAND = yramdisk_EraseBlockInNAND;
113 ramDev.initialiseNAND = yramdisk_InitialiseNAND;
116 bootDev.nDataBytesPerChunk = 512;
117 bootDev.nChunksPerBlock = 32;
118 bootDev.nReservedBlocks = 5;
119 bootDev.startBlock = 1; // Can't use block 0
120 bootDev.endBlock = 127; // Last block in 2MB.
121 bootDev.useNANDECC = 0; // use YAFFS's ECC
122 bootDev.nShortOpCaches = 10; // Use caches
123 bootDev.genericDevice = (void *) 1; // Used to identify the device in fstat.
124 bootDev.writeChunkToNAND = yflash_WriteChunkToNAND;
125 bootDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
126 bootDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
127 bootDev.initialiseNAND = yflash_InitialiseNAND;
130 flashDev.nDataBytesPerChunk = 512;
131 flashDev.nChunksPerBlock = 32;
132 flashDev.nReservedBlocks = 5;
133 flashDev.startBlock = 128; // First block after 2MB
134 flashDev.endBlock = 1023; // Last block in 16MB
135 flashDev.useNANDECC = 0; // use YAFFS's ECC
136 flashDev.nShortOpCaches = 10; // Use caches
137 flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat.
138 flashDev.writeChunkToNAND = yflash_WriteChunkToNAND;
139 flashDev.readChunkFromNAND = yflash_ReadChunkFromNAND;
140 flashDev.eraseBlockInNAND = yflash_EraseBlockInNAND;
141 flashDev.initialiseNAND = yflash_InitialiseNAND;
143 yaffs_initialise(yaffsfs_config);