From ce69c4b2cccacb1099c0709535751be45692caac Mon Sep 17 00:00:00 2001 From: laokz Date: Wed, 16 Dec 2020 21:51:25 +0800 Subject: [PATCH] add QEMU CFI flash support Change-Id: I0c56f87733ee40191d08282187f1b594250d4678 --- components/dfs/filesystems/jffs2/jffs2_config.h | 2 ++ components/dfs/filesystems/jffs2/src/fs-ecos.c | 8 ++++++++ components/dfs/filesystems/jffs2/src/os-ecos.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/components/dfs/filesystems/jffs2/jffs2_config.h b/components/dfs/filesystems/jffs2/jffs2_config.h index 6807730e..ef5e44a9 100755 --- a/components/dfs/filesystems/jffs2/jffs2_config.h +++ b/components/dfs/filesystems/jffs2/jffs2_config.h @@ -1,7 +1,9 @@ #ifndef JFFS2_CONFIG_H #define JFFS2_CONFIG_H +#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 #include "spinor.h" +#endif #include "mtd_partition.h" #ifdef __cplusplus diff --git a/components/dfs/filesystems/jffs2/src/fs-ecos.c b/components/dfs/filesystems/jffs2/src/fs-ecos.c index 970c52c3..45ba8f00 100755 --- a/components/dfs/filesystems/jffs2/src/fs-ecos.c +++ b/components/dfs/filesystems/jffs2/src/fs-ecos.c @@ -24,7 +24,9 @@ #include "jffs2/compr.h" #include "port/fcntl.h" #include "porting.h" +#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 #include "spinor.h" +#endif #include "limits.h" #include "los_process_pri.h" #include "capability_type.h" @@ -354,7 +356,11 @@ static int jffs2_mount(cyg_mtab_entry *mte, int partition_num) if (current_node->patitionnum == partition_num) break; } +#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 spinor_mtd = GetMtd("spinor"); +#else + spinor_mtd = (struct MtdDev *)LOS_DL_LIST_ENTRY(patition_head->pstNext, mtd_partition, node_info)->mtd_info; +#endif if (spinor_mtd == NULL) { free(jffs2_sb); return EPERM; @@ -362,7 +368,9 @@ static int jffs2_mount(cyg_mtab_entry *mte, int partition_num) jffs_part[partition_num].blockEnd = current_node->end_block; jffs_part[partition_num].blockSize = spinor_mtd->eraseSize; jffs_part[partition_num].blockStart = current_node->start_block; +#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 (void)FreeMtd(spinor_mtd); +#endif jffs2_sb->jffs2_sb.mtd = current_node->mtd_info; jffs2_sb->s_dev = (cyg_io_handle_t)(&jffs_part[partition_num]); diff --git a/components/dfs/filesystems/jffs2/src/os-ecos.h b/components/dfs/filesystems/jffs2/src/os-ecos.h index 6a5eeac9..04892c52 100755 --- a/components/dfs/filesystems/jffs2/src/os-ecos.h +++ b/components/dfs/filesystems/jffs2/src/os-ecos.h @@ -24,7 +24,9 @@ #include "errno.h" #include "jffs2_fs_i.h" #include "jffs2_fs_sb.h" +#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 #include "spinor.h" +#endif #include "fileio.h" #include "sys/uio.h" -- Gitee