提交 67fff44f 编写于 作者: B bernard

[DFS] Fix the UFFS compiling issue.

上级 5bc69033
...@@ -109,6 +109,33 @@ if RT_USING_DFS ...@@ -109,6 +109,33 @@ if RT_USING_DFS
select RT_USING_MTD_NAND select RT_USING_MTD_NAND
default n default n
if RT_USING_DFS_UFFS
choice
prompt "UFFS ECC mode"
default RT_UFFS_ECC_MODE_1
config RT_UFFS_ECC_MODE_0
bool "0: Do not use ECC"
config RT_UFFS_ECC_MODE_1
bool "1: UFFS calculate the ECC"
config RT_UFFS_ECC_MODE_2
bool "2: Flash driver(or by hardware) calculate the ECC"
config RT_UFFS_ECC_MODE_3
bool "3: Hardware calculate the ECC and automatically write to spare."
endchoice
config RT_UFFS_ECC_MODE
int
default 0 if RT_UFFS_ECC_MODE_0
default 1 if RT_UFFS_ECC_MODE_1
default 2 if RT_UFFS_ECC_MODE_2
default 3 if RT_UFFS_ECC_MODE_3
endif
config RT_USING_DFS_NFS config RT_USING_DFS_NFS
bool "Using NFS v3 client file system" bool "Using NFS v3 client file system"
depends on RT_USING_LWIP depends on RT_USING_LWIP
......
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
#include <rtthread.h> #include <rtthread.h>
#include <dfs_fs.h> #include <dfs_fs.h>
#include <dfs_def.h> #include <dfs_file.h>
#include <rtdevice.h> #include <rtdevice.h>
#include "dfs_uffs.h" #include "dfs_uffs.h"
#include "uffs/uffs_fd.h" /* posix file api is here */ #include "uffs/uffs_fd.h" /* posix file api is here */
...@@ -213,7 +214,7 @@ static int dfs_uffs_unmount(struct dfs_filesystem* fs) ...@@ -213,7 +214,7 @@ static int dfs_uffs_unmount(struct dfs_filesystem* fs)
break; break;
result = uffs_UnRegisterMountTable(& nand_part[index].mount_table); result = uffs_UnRegisterMountTable(& nand_part[index].mount_table);
return (result == U_SUCC) ? DFS_STATUS_OK : -1; return (result == U_SUCC) ? RT_EOK : -1;
} }
} }
return -ENOENT; return -ENOENT;
...@@ -259,7 +260,7 @@ static int dfs_uffs_mkfs(rt_device_t dev_id) ...@@ -259,7 +260,7 @@ static int dfs_uffs_mkfs(rt_device_t dev_id)
{ {
return uffs_result_to_dfs(uffs_get_error()); return uffs_result_to_dfs(uffs_get_error());
} }
return DFS_STATUS_OK; return RT_EOK;
} }
static int dfs_uffs_statfs(struct dfs_filesystem* fs, static int dfs_uffs_statfs(struct dfs_filesystem* fs,
...@@ -325,7 +326,7 @@ static int dfs_uffs_open(struct dfs_fd* file) ...@@ -325,7 +326,7 @@ static int dfs_uffs_open(struct dfs_fd* file)
/* save this pointer,will used by dfs_uffs_getdents*/ /* save this pointer,will used by dfs_uffs_getdents*/
file->data = dir; file->data = dir;
rt_free(file_path); rt_free(file_path);
return DFS_STATUS_OK; return RT_EOK;
} }
/* regular file operations */ /* regular file operations */
/* int uffs_open(const char *name, int oflag, ...); what is this? /* int uffs_open(const char *name, int oflag, ...); what is this?
...@@ -390,7 +391,7 @@ static int dfs_uffs_ioctl(struct dfs_fd * file, int cmd, void* args) ...@@ -390,7 +391,7 @@ static int dfs_uffs_ioctl(struct dfs_fd * file, int cmd, void* args)
return -ENOSYS; return -ENOSYS;
} }
static int dfs_uffs_read(struct dfs_fd * file, void* buf, rt_size_t len) static int dfs_uffs_read(struct dfs_fd * file, void* buf, size_t len)
{ {
int fd; int fd;
int char_read; int char_read;
...@@ -407,7 +408,7 @@ static int dfs_uffs_read(struct dfs_fd * file, void* buf, rt_size_t len) ...@@ -407,7 +408,7 @@ static int dfs_uffs_read(struct dfs_fd * file, void* buf, rt_size_t len)
static int dfs_uffs_write(struct dfs_fd* file, static int dfs_uffs_write(struct dfs_fd* file,
const void* buf, const void* buf,
rt_size_t len) size_t len)
{ {
int fd; int fd;
int char_write; int char_write;
...@@ -524,16 +525,16 @@ static int dfs_uffs_getdents( ...@@ -524,16 +525,16 @@ static int dfs_uffs_getdents(
switch(s.st_mode & US_IFMT) /* file type mark */ switch(s.st_mode & US_IFMT) /* file type mark */
{ {
case US_IFREG: /* directory */ case US_IFREG: /* directory */
d->d_type = DFS_DT_REG; d->d_type = DT_REG;
break; break;
case US_IFDIR: /* regular file */ case US_IFDIR: /* regular file */
d->d_type = DFS_DT_DIR; d->d_type = DT_DIR;
break; break;
case US_IFLNK: /* symbolic link */ case US_IFLNK: /* symbolic link */
case US_IREAD: /* read permission */ case US_IREAD: /* read permission */
case US_IWRITE:/* write permission */ case US_IWRITE:/* write permission */
default: default:
d->d_type = DFS_DT_UNKNOWN; d->d_type = DT_UNKNOWN;
break; break;
} }
...@@ -605,7 +606,6 @@ static int dfs_uffs_stat(struct dfs_filesystem* fs, const char *path, struct sta ...@@ -605,7 +606,6 @@ static int dfs_uffs_stat(struct dfs_filesystem* fs, const char *path, struct sta
{ {
int result; int result;
struct uffs_stat s; struct uffs_stat s;
struct rt_mtd_nand_device * mtd;
result = uffs_stat(path, &s); result = uffs_stat(path, &s);
if (result < 0) if (result < 0)
...@@ -618,8 +618,6 @@ static int dfs_uffs_stat(struct dfs_filesystem* fs, const char *path, struct sta ...@@ -618,8 +618,6 @@ static int dfs_uffs_stat(struct dfs_filesystem* fs, const char *path, struct sta
st->st_size = s.st_size; st->st_size = s.st_size;
st->st_mtime = s.st_mtime; st->st_mtime = s.st_mtime;
mtd = RT_MTD_NAND_DEVICE(fs->dev_id);
return 0; return 0;
} }
...@@ -671,3 +669,4 @@ int dfs_uffs_init(void) ...@@ -671,3 +669,4 @@ int dfs_uffs_init(void)
return -RT_ERROR; return -RT_ERROR;
} }
INIT_FS_EXPORT(dfs_uffs_init); INIT_FS_EXPORT(dfs_uffs_init);
...@@ -29,6 +29,27 @@ ...@@ -29,6 +29,27 @@
#include "uffs/uffs_public.h" #include "uffs/uffs_public.h"
/* the UFFS ECC mode opitons */ /* the UFFS ECC mode opitons */
#ifndef RT_UFFS_ECC_MODE
#define RT_UFFS_ECC_MODE 1
#endif
/*
* RT_UFFS_ECC_MODE:
* 0, Do not use ECC
* 1, UFFS calculate the ECC
* 2, Flash driver(or by hardware) calculate the ECC
* 3, Hardware calculate the ECC and automatically write to spare.
*/
#if RT_UFFS_ECC_MODE == 0
#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_NONE
#elif RT_UFFS_ECC_MODE == 1
#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_SOFT
#elif RT_UFFS_ECC_MODE == 2
#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_HW
#elif RT_UFFS_ECC_MODE == 3
#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_HW_AUTO
#endif
/* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_HW_AUTO */ /* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_HW_AUTO */
/* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_SOFT */ /* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_SOFT */
/* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_NONE */ /* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_NONE */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册