diff --git a/components/dfs/filesystems/jffs2/dfs_jffs2.c b/components/dfs/filesystems/jffs2/dfs_jffs2.c index aa802adf9..4c6c208cd 100644 --- a/components/dfs/filesystems/jffs2/dfs_jffs2.c +++ b/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) diff --git a/components/dfs/filesystems/jffs2/src/flashio.c b/components/dfs/filesystems/jffs2/src/flashio.c index 0bd3743f5..65fd7b8aa 100644 --- a/components/dfs/filesystems/jffs2/src/flashio.c +++ b/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; diff --git a/components/dfs/filesystems/jffs2/src/fs-ecos.c b/components/dfs/filesystems/jffs2/src/fs-ecos.c index 31047ec0d..cadef8557 100644 --- a/components/dfs/filesystems/jffs2/src/fs-ecos.c +++ b/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); diff --git a/components/drivers/mtd/SConscript b/components/drivers/mtd/SConscript index e456017a6..d798f8d63 100644 --- a/components/drivers/mtd/SConscript +++ b/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')