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
This commit is contained in:
goprife@gmail.com 2012-05-30 13:39:39 +00:00
parent a512661b9f
commit 9b2ea9bc0f
4 changed files with 24 additions and 12 deletions

View File

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

View File

@ -24,7 +24,7 @@ int jffs2_flash_read(struct jffs2_sb_info * c, uint32_t offset,
uint32_t len; uint32_t len;
struct super_block *sb = OFNI_BS_2SFFJ(c); 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) if (len != size)
return -EIO; return -EIO;
@ -39,7 +39,7 @@ int jffs2_flash_write(struct jffs2_sb_info * c,
uint32_t len; uint32_t len;
struct super_block *sb = OFNI_BS_2SFFJ(c); 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) if (len != size)
return -EIO; return -EIO;
@ -53,7 +53,7 @@ int jffs2_flash_erase(struct jffs2_sb_info * c,
rt_err_t result; rt_err_t result;
struct super_block *sb = OFNI_BS_2SFFJ(c); 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) if (result != RT_EOK)
return -EIO; return -EIO;

View File

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

View File

@ -1,8 +1,20 @@
Import('RTT_ROOT')
Import('rtconfig')
from building import * from building import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = Glob('*.c') 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'] CPPPATH = [cwd + '/../include']
group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_MTD'], CPPPATH = CPPPATH) group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
Return('group') Return('group')