diff options
author | William Juul <william.juul@datarespons.no> | 2007-11-15 11:13:05 +0100 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2008-08-12 11:31:18 -0500 |
commit | 0e8cc8bd92257da2e1df88cbc985e166e472ce61 (patch) | |
tree | d5a8e0f4263a58eeb6cecc423b02b019a15eb56d /fs/yaffs2/direct/yaffscfg.c | |
parent | 3043c045d5a9897faba7d5c7218c2f4d06cd0038 (diff) | |
download | u-boot-imx-0e8cc8bd92257da2e1df88cbc985e166e472ce61.zip u-boot-imx-0e8cc8bd92257da2e1df88cbc985e166e472ce61.tar.gz u-boot-imx-0e8cc8bd92257da2e1df88cbc985e166e472ce61.tar.bz2 |
YAFFS2 import
Direct import of yaffs as a tarball as of 20071113 from their public
CVS-web at http://www.aleph1.co.uk/cgi-bin/viewcvs.cgi/yaffs2/
The code can also be imported on the command line with:
export CVSROOT=:pserver:anonymous@cvs.aleph1.co.uk:/home/aleph1/cvs cvs logon
(Hit return when asked for a password)
cvs checkout yaffs2
Signed-off-by: William Juul <william.juul@tandberg.com>
Signed-off-by: Stig Olsen <stig.olsen@tandberg.com>
Diffstat (limited to 'fs/yaffs2/direct/yaffscfg.c')
-rw-r--r-- | fs/yaffs2/direct/yaffscfg.c | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/fs/yaffs2/direct/yaffscfg.c b/fs/yaffs2/direct/yaffscfg.c new file mode 100644 index 0000000..b1d311e --- /dev/null +++ b/fs/yaffs2/direct/yaffscfg.c @@ -0,0 +1,144 @@ +/* + * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. + * + * Copyright (C) 2002-2007 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Charles Manning <charles@aleph1.co.uk> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * yaffscfg.c The configuration for the "direct" use of yaffs. + * + * This file is intended to be modified to your requirements. + * There is no need to redistribute this file. + */ + +#include "yaffscfg.h" +#include "yaffsfs.h" +#include <errno.h> + +unsigned yaffs_traceMask = 0xFFFFFFFF; + + +void yaffsfs_SetError(int err) +{ + //Do whatever to set error + errno = err; +} + +void yaffsfs_Lock(void) +{ +} + +void yaffsfs_Unlock(void) +{ +} + +__u32 yaffsfs_CurrentTime(void) +{ + return 0; +} + +void *yaffs_malloc(size_t size) +{ + return malloc(size); +} + +void yaffs_free(void *ptr) +{ + free(ptr); +} + +void yaffsfs_LocalInitialisation(void) +{ + // Define locking semaphore. +} + +// Configuration for: +// /ram 2MB ramdisk +// /boot 2MB boot disk (flash) +// /flash 14MB flash disk (flash) +// NB Though /boot and /flash occupy the same physical device they +// are still disticnt "yaffs_Devices. You may think of these as "partitions" +// using non-overlapping areas in the same device. +// + +#include "yaffs_ramdisk.h" +#include "yaffs_flashif.h" + +static yaffs_Device ramDev; +static yaffs_Device bootDev; +static yaffs_Device flashDev; + +static yaffsfs_DeviceConfiguration yaffsfs_config[] = { + + { "/ram", &ramDev}, + { "/boot", &bootDev}, + { "/flash", &flashDev}, + {(void *)0,(void *)0} +}; + + +int yaffs_StartUp(void) +{ + // Stuff to configure YAFFS + // Stuff to initialise anything special (eg lock semaphore). + yaffsfs_LocalInitialisation(); + + // Set up devices + + // /ram + ramDev.nBytesPerChunk = 512; + ramDev.nChunksPerBlock = 32; + ramDev.nReservedBlocks = 2; // Set this smaller for RAM + ramDev.startBlock = 1; // Can't use block 0 + ramDev.endBlock = 127; // Last block in 2MB. + ramDev.useNANDECC = 1; + ramDev.nShortOpCaches = 0; // Disable caching on this device. + ramDev.genericDevice = (void *) 0; // Used to identify the device in fstat. + ramDev.writeChunkWithTagsToNAND = yramdisk_WriteChunkWithTagsToNAND; + ramDev.readChunkWithTagsFromNAND = yramdisk_ReadChunkWithTagsFromNAND; + ramDev.eraseBlockInNAND = yramdisk_EraseBlockInNAND; + ramDev.initialiseNAND = yramdisk_InitialiseNAND; + + // /boot + bootDev.nBytesPerChunk = 612; + bootDev.nChunksPerBlock = 32; + bootDev.nReservedBlocks = 5; + bootDev.startBlock = 1; // Can't use block 0 + bootDev.endBlock = 127; // Last block in 2MB. + bootDev.useNANDECC = 0; // use YAFFS's ECC + bootDev.nShortOpCaches = 10; // Use caches + bootDev.genericDevice = (void *) 1; // Used to identify the device in fstat. + bootDev.writeChunkToNAND = yflash_WriteChunkToNAND; + bootDev.readChunkFromNAND = yflash_ReadChunkFromNAND; + bootDev.eraseBlockInNAND = yflash_EraseBlockInNAND; + bootDev.initialiseNAND = yflash_InitialiseNAND; + + // /flash + flashDev.nBytesPerChunk = 512; + flashDev.nChunksPerBlock = 32; + flashDev.nReservedBlocks = 5; + flashDev.startBlock = 128; // First block after 2MB + flashDev.endBlock = 1023; // Last block in 16MB + flashDev.useNANDECC = 0; // use YAFFS's ECC + flashDev.nShortOpCaches = 10; // Use caches + flashDev.genericDevice = (void *) 2; // Used to identify the device in fstat. + flashDev.writeChunkToNAND = yflash_WriteChunkToNAND; + flashDev.readChunkFromNAND = yflash_ReadChunkFromNAND; + flashDev.eraseBlockInNAND = yflash_EraseBlockInNAND; + flashDev.initialiseNAND = yflash_InitialiseNAND; + + yaffs_initialise(yaffsfs_config); + + return 0; +} + + + + |