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 * yaffscfg2k.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.
22 #include "yaffs_guts.h"
24 #include "yaffs_fileem2k.h"
25 #include "yaffs_nandemul2k.h"
26 #include "yaffs_norif1.h"
27 #include "yaffs_trace.h"
28 #include "yaffs_osglue.h"
33 unsigned yaffs_trace_mask =
40 YAFFS_TRACE_ALLOCATE |
41 YAFFS_TRACE_BAD_BLOCKS |
50 #include "yaffs_ramdisk.h"
51 #include "yaffs_flashif.h"
52 #include "yaffs_flashif2.h"
53 #include "yaffs_nandemul2k.h"
55 struct yaffs_dev ram1Dev;
56 struct yaffs_dev flashDev;
57 struct yaffs_dev m18_1Dev;
59 int yaffs_start_up(void)
61 // Stuff to configure YAFFS
62 // Stuff to initialise anything special (eg lock semaphore).
63 yaffsfs_OSInitialisation();
67 memset(&ram1Dev,0,sizeof(ram1Dev));
68 ram1Dev.param.name = "ram1";
69 ram1Dev.param.total_bytes_per_chunk = 512;
70 ram1Dev.param.chunks_per_block = 32;
71 ram1Dev.param.n_reserved_blocks = 2; // Set this smaller for RAM
72 ram1Dev.param.start_block = 0; // Can use block 0
73 ram1Dev.param.end_block = 127; // Last block in 2MB.
74 //ram1Dev.param.use_nand_ecc = 1;
75 ram1Dev.param.n_caches = 0; // Disable caching on this device.
76 ram1Dev.driver_context = (void *) 0; // Used to identify the device in fstat.
77 ram1Dev.param.write_chunk_tags_fn = yramdisk_wr_chunk;
78 ram1Dev.param.read_chunk_tags_fn = yramdisk_rd_chunk;
79 ram1Dev.param.erase_fn = yramdisk_erase;
80 ram1Dev.param.initialise_flash_fn = yramdisk_initialise;
82 yaffs_add_device(&ram1Dev);
84 // /M18-1 yaffs1 on M18 nor sim
85 memset(&m18_1Dev,0,sizeof(m18_1Dev));
86 m18_1Dev.param.name = "M18-1";
87 m18_1Dev.param.total_bytes_per_chunk = 1024;
88 m18_1Dev.param.chunks_per_block =248;
89 m18_1Dev.param.n_reserved_blocks = 2;
90 m18_1Dev.param.start_block = 0; // Can use block 0
91 m18_1Dev.param.end_block = 31; // Last block
92 m18_1Dev.param.use_nand_ecc = 0; // use YAFFS's ECC
93 m18_1Dev.param.n_caches = 10; // Use caches
94 m18_1Dev.driver_context = (void *) 1; // Used to identify the device in fstat.
95 m18_1Dev.param.write_chunk_fn = ynorif1_WriteChunkToNAND;
96 m18_1Dev.param.read_chunk_fn = ynorif1_ReadChunkFromNAND;
97 m18_1Dev.param.erase_fn = ynorif1_EraseBlockInNAND;
98 m18_1Dev.param.initialise_flash_fn = ynorif1_InitialiseNAND;
99 m18_1Dev.param.deinitialise_flash_fn = ynorif1_Deinitialise_flash_fn;
101 // m18_1Dev.param.disable_soft_del = 1;
103 yaffs_add_device(&m18_1Dev);
105 // /yaffs2 yaffs2 file emulation
106 // 2kpage/64chunk per block
108 memset(&flashDev,0,sizeof(flashDev));
109 flashDev.param.name = "yaffs2";
110 flashDev.param.total_bytes_per_chunk = 2048;
111 flashDev.param.chunks_per_block = 64;
112 flashDev.param.n_reserved_blocks = 5;
113 flashDev.param.inband_tags = 0;
114 flashDev.param.start_block = 0;
115 flashDev.param.end_block = yflash2_GetNumberOfBlocks()-1;
116 flashDev.param.is_yaffs2 = 1;
117 flashDev.param.use_nand_ecc=1;
118 flashDev.param.wide_tnodes_disabled=0;
119 flashDev.param.refresh_period = 1000;
120 flashDev.param.n_caches = 10; // Use caches
121 flashDev.driver_context = (void *) 2; // Used to identify the device in fstat.
122 flashDev.param.write_chunk_tags_fn = yflash2_WriteChunkWithTagsToNAND;
123 flashDev.param.read_chunk_tags_fn = yflash2_ReadChunkWithTagsFromNAND;
124 flashDev.param.erase_fn = yflash2_EraseBlockInNAND;
125 flashDev.param.initialise_flash_fn = yflash2_InitialiseNAND;
126 flashDev.param.bad_block_fn = yflash2_MarkNANDBlockBad;
127 flashDev.param.query_block_fn = yflash2_QueryNANDBlock;
128 flashDev.param.enable_xattr = 1;
130 yaffs_add_device(&flashDev);
132 // todo yaffs_initialise(yaffsfs_config);