Quellcode durchsuchen

1. change mtd to mtd_nor, 2. update jffs2

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2140 bbd45198-f89e-11dd-88c7-29a3b14d5316
goprife@gmail.com vor 13 Jahren
Ursprung
Commit
9b2ea9bc0f

+ 4 - 4
components/dfs/filesystems/jffs2/dfs_jffs2.c

@@ -35,7 +35,7 @@
 struct device_part 
 {
 	struct cyg_mtab_entry * mte;
-	struct rt_mtd_device *dev;
+	struct rt_mtd_nor_device *dev;
 };
 static struct device_part device_partition[DEVICE_PART_MAX] = {0};
 
@@ -172,7 +172,7 @@ static int dfs_jffs2_mount(struct dfs_filesystem* fs,
 	 */
 	mte->data = (CYG_ADDRWORD)fs->dev_id;
 
-	device_partition[index].dev = RT_MTD_DEVICE(fs->dev_id);
+	device_partition[index].dev = RT_MTD_NOR_DEVICE(fs->dev_id);
 	/* after jffs2_mount, mte->data will not be dev_id any more */
 	result = jffs2_mount(NULL, mte);
 	if (result != 0)
@@ -190,7 +190,7 @@ static int _find_fs(struct cyg_mtab_entry ** mte, rt_device_t dev_id)
 	/* find device index */
 	for (index = 0; index < DEVICE_PART_MAX; index++)
 	{
-		if (device_partition[index].dev == RT_MTD_DEVICE(dev_id))
+		if (device_partition[index].dev == RT_MTD_NOR_DEVICE(dev_id))
 		{
 			*mte = device_partition[index].mte;
 			return 0;
@@ -207,7 +207,7 @@ static int dfs_jffs2_unmount(struct dfs_filesystem* fs)
 	/* find device index, then umount it */
 	for (index = 0; index < DEVICE_PART_MAX; index++)
 	{
-		if (device_partition[index].dev == RT_MTD_DEVICE(fs->dev_id))
+		if (device_partition[index].dev == RT_MTD_NOR_DEVICE(fs->dev_id))
 		{
 			result = jffs2_umount(device_partition[index].mte);
 			if (result)

+ 3 - 3
components/dfs/filesystems/jffs2/src/flashio.c

@@ -24,7 +24,7 @@ int jffs2_flash_read(struct jffs2_sb_info * c, uint32_t offset,
 	uint32_t len;
 	struct super_block *sb = OFNI_BS_2SFFJ(c);
 
-	len = rt_mtd_read(RT_MTD_DEVICE(sb->s_dev), offset, buffer, size);
+	len = rt_mtd_nor_read(RT_MTD_NOR_DEVICE(sb->s_dev), offset, buffer, size);
 	if (len != size)
 		return -EIO;
 
@@ -39,7 +39,7 @@ int jffs2_flash_write(struct jffs2_sb_info * c,
 	uint32_t len;
 	struct super_block *sb = OFNI_BS_2SFFJ(c);
 
-	len = rt_mtd_write(RT_MTD_DEVICE(sb->s_dev), offset, buffer, size);
+	len = rt_mtd_nor_write(RT_MTD_NOR_DEVICE(sb->s_dev), offset, buffer, size);
 	if (len != size)
 		return -EIO;
 
@@ -53,7 +53,7 @@ int jffs2_flash_erase(struct jffs2_sb_info * c,
 	rt_err_t result;
 	struct super_block *sb = OFNI_BS_2SFFJ(c);
 
-	result = rt_mtd_erase_block(RT_MTD_DEVICE(sb->s_dev), jeb->offset);
+	result = rt_mtd_nor_erase_block(RT_MTD_NOR_DEVICE(sb->s_dev), jeb->offset, c->sector_size);
 	if (result != RT_EOK)
 		return -EIO;
 

+ 2 - 2
components/dfs/filesystems/jffs2/src/fs-ecos.c

@@ -449,10 +449,10 @@ static int jffs2_read_super(struct super_block *sb)
 {
 	Cyg_ErrNo err;
 	struct jffs2_sb_info *c;
-	struct rt_mtd_device *device;
+	struct rt_mtd_nor_device *device;
 	
 	c = JFFS2_SB_INFO(sb);
-	device = RT_MTD_DEVICE(sb->s_dev);
+	device = RT_MTD_NOR_DEVICE(sb->s_dev);
 
 	/* initialize mutex lock */
 	init_MUTEX(&c->alloc_sem);

+ 15 - 3
components/drivers/mtd/SConscript

@@ -1,8 +1,20 @@
+Import('RTT_ROOT')
+Import('rtconfig')
 from building import *
 
-cwd     = GetCurrentDir()
-src	= Glob('*.c')
+cwd = GetCurrentDir()
+src = [] 
+
+mtd_nor = ['mtd_nor.c']
+
+mtd_nand = ['mtd_nand.c']
+
+if GetDepend(['RT_USING_MTD_NOR']):
+    src = src + mtd_nor
+if GetDepend(['RT_USING_MTD_NAND']):
+    src = src + mtd_nand
+
 CPPPATH = [cwd + '/../include']
-group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_MTD'], CPPPATH = CPPPATH)
+group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
 
 Return('group')