提交 034166df 编写于 作者: B bernard.xiong

use ELM FatFs as FAT file system.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@406 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 c53033b8
......@@ -24,67 +24,38 @@
#include <dfs_init.h>
/* dfs filesystem:EFS filesystem init */
#include <dfs_efs.h>
/* dfs filesystem:ELM FatFs filesystem init */
#include <dfs_elm.h>
/* dfs Filesystem APIs */
#include <dfs_fs.h>
#endif
/* filesystem test */
#include <dfs_posix.h>
static char fullpath[256 + 1];
void ls_root()
{
DIR *dir;
dir = opendir("/");
if (dir != RT_NULL)
{
struct dfs_dirent* dirent;
struct dfs_stat s;
do
{
dirent = readdir(dir);
if (dirent == RT_NULL) break;
rt_memset(&s, 0, sizeof(struct dfs_stat));
/* build full path for each file */
rt_sprintf(fullpath, "/%s", dirent->d_name);
stat(fullpath, &s);
if ( s.st_mode & DFS_S_IFDIR )
{
rt_kprintf("%s\t\t<DIR>\n", dirent->d_name);
}
else
{
rt_kprintf("%s\t\t%lu\n", dirent->d_name, s.st_size);
}
} while (dirent != RT_NULL);
closedir(dir);
}
else rt_kprintf("open root directory failed\n");
}
void rt_init_thread_entry(void* parameter)
{
/* Filesystem Initialization */
#ifdef RT_USING_DFS
{
/* init the device filesystem */
dfs_init();
/* init the efsl filesystam*/
efsl_init();
/* mount sd card fat partition 1 as root directory */
if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
{
rt_kprintf("File System initialized!\n");
ls_root();
}
else
rt_kprintf("File System init failed!\n");
/* init the device filesystem */
dfs_init();
#ifdef RT_USING_DFS_EFSL
/* init the efsl filesystam*/
efsl_init();
/* mount sd card fat partition 1 as root directory */
if (dfs_mount("sd0", "/", "efs", 0, 0) == 0)
rt_kprintf("File System initialized!\n");
else
rt_kprintf("File System init failed!\n");
#elif defined(RT_USING_DFS_ELMFAT)
/* init the elm FAT filesystam*/
elm_init();
/* mount sd card fat partition 1 as root directory */
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
rt_kprintf("File System initialized!\n");
else
rt_kprintf("File System init failed!\n");
#endif
}
#endif
}
......
......@@ -66,22 +66,12 @@ File 5,2,<..\..\libcpu\arm\stm32\fault_rvds.S><fault_rvds.S>
File 5,2,<..\..\libcpu\arm\stm32\start_rvds.s><start_rvds.s>
File 5,1,<..\..\libcpu\arm\stm32\serial.c><serial.c>
File 6,1,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
File 6,1,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
File 6,1,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
File 6,1,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
File 6,1,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
File 6,1,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
File 6,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
File 6,1,<..\..\filesystem\dfs\filesystems\elmfat\ff.c><ff.c>
Options 1,0,0 // Target 'RT-Thread STM32'
......@@ -142,7 +132,7 @@ Options 1,0,0 // Target 'RT-Thread STM32'
ADSCMISC ()
ADSCDEFN (USE_STDPERIPH_DRIVER, STM32F10X_HD,)
ADSCUDEF ()
ADSCINCD (.\Libraries\STM32F10x_StdPeriph_Driver\inc;.\Libraries\CMSIS\Core\CM3;..\..\include;.;..\..\libcpu\arm\stm32;..\..\filesystem\dfs;..\..\filesystem\dfs\include;..\..\filesystem\dfs\filesystems\efsl\src\include;..\..\filesystem\dfs\filesystems\efsl\src\base\include;..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include)
ADSCINCD (.\Libraries\STM32F10x_StdPeriph_Driver\inc;.\Libraries\CMSIS\Core\CM3;..\..\include;.;..\..\libcpu\arm\stm32;..\..\filesystem\dfs;..\..\filesystem\dfs\include;..\..\finsh)
ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
ADSAMISC ()
ADSADEFN ()
......
......@@ -287,9 +287,6 @@
<state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs\include</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\include</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\include</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include</state>
</option>
<option>
<name>CCStdIncCheck</name>
......@@ -1086,9 +1083,6 @@
<state>$PROJ_DIR$\..\..\libcpu\arm\stm32</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs\include</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\include</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\include</state>
<state>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include</state>
</option>
<option>
<name>CCStdIncCheck</name>
......@@ -1611,7 +1605,7 @@
<group>
<name>Filesystem</name>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_cache.c</name>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_fs.c</name>
......@@ -1629,37 +1623,7 @@
<name>$PROJ_DIR$\..\..\filesystem\dfs\src\dfs_util.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c</name>
<name>$PROJ_DIR$\..\..\filesystem\dfs\filesystems\elmfat\ff.c</name>
</file>
</group>
<group>
......
......@@ -65,10 +65,18 @@
/* the buffer size of console*/
#define RT_CONSOLEBUF_SIZE 128
/* SECTION: FinSH shell options */
/* Using FinSH as Shell*/
/* #define RT_USING_FINSH */
/* Using symbol table */
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
/* SECTION: device filesystem */
#define RT_USING_DFS
#define RT_USING_DFS_EFSL
/* #define RT_USING_DFS_ELMFAT */
/* #define RT_USING_DFS_EFSL */
#define RT_USING_DFS_ELMFAT
#define RT_DFS_ELM_WORD_ACCESS
/* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册