4849889f8720789f58c20df82a4f49e70ec9f46b
[yaffs2.git] / direct / basic-test / yaffscfg2k.c
1 /*
2  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2011 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Charles Manning <charles@aleph1.co.uk>
8  *
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.
12  */
13
14 /*
15  * yaffscfg2k.c  The configuration for the "direct" use of yaffs.
16  *
17  * This file is intended to be modified to your requirements.
18  * There is no need to redistribute this file.
19  */
20
21 #include "yaffscfg.h"
22 #include "yaffs_guts.h"
23 #include "yaffsfs.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"
29
30
31 #include <errno.h>
32
33 unsigned yaffs_trace_mask =
34
35         YAFFS_TRACE_SCAN |
36         YAFFS_TRACE_GC |
37         YAFFS_TRACE_ERASE |
38         YAFFS_TRACE_ERROR |
39         YAFFS_TRACE_TRACING |
40         YAFFS_TRACE_ALLOCATE |
41         YAFFS_TRACE_BAD_BLOCKS |
42         YAFFS_TRACE_VERIFY |
43
44         0;
45
46
47
48 // Configuration
49
50 #include "yaffs_ramdisk.h"
51 #include "yaffs_flashif.h"
52 #include "yaffs_flashif2.h"
53 #include "yaffs_nandemul2k.h"
54
55 struct yaffs_dev ram1Dev;
56 struct yaffs_dev flashDev;
57 struct yaffs_dev m18_1Dev;
58
59 int yaffs_start_up(void)
60 {
61         static int start_up_called = 0;
62
63         if(start_up_called)
64                 return 0;
65         start_up_called = 1;
66
67         // Stuff to configure YAFFS
68         // Stuff to initialise anything special (eg lock semaphore).
69         yaffsfs_OSInitialisation();
70
71         // Set up devices
72
73         // /M18-1 yaffs1 on M18 nor sim
74         memset(&m18_1Dev,0,sizeof(m18_1Dev));
75         ynorif1_install_drv(&m18_1Dev);
76         m18_1Dev.param.name = "M18-1";
77         m18_1Dev.param.n_caches = 10; // Use caches
78         m18_1Dev.param.disable_soft_del = 1;
79         m18_1Dev.driver_context = (void *) 1;   // Used to identify the device in fstat.
80
81
82 //      m18_1Dev.param.disable_soft_del = 1;
83
84         yaffs_add_device(&m18_1Dev);
85
86         // /yaffs2  yaffs2 file emulation
87         // 2kpage/64chunk per block
88         //
89         memset(&flashDev,0,sizeof(flashDev));
90         yflash2_install_drv(&flashDev);
91         flashDev.param.name = "yaffs2";
92
93         flashDev.param.n_reserved_blocks = 5;
94         flashDev.param.wide_tnodes_disabled=0;
95         flashDev.param.refresh_period = 1000;
96         flashDev.param.n_caches = 10; // Use caches
97         flashDev.driver_context = (void *) 2;   // Used to identify the device in fstat.
98
99         flashDev.param.enable_xattr = 1;
100
101         yaffs_add_device(&flashDev);
102
103         return 0;
104 }
105
106
107