提交 ada0e8f1 编写于 作者: mysterywolf's avatar mysterywolf 提交者: guo

[simulator] improve init process

上级 80825913
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2017-04-03 Urey the first version * 2017-04-03 Urey the first version
* 2022-06-01 Meco Man improve the init process
*/ */
#include <rtthread.h> #include <rtthread.h>
#include <rtdevice.h> #include <rtdevice.h>
...@@ -36,6 +37,9 @@ static int mnt_init(void) ...@@ -36,6 +37,9 @@ static int mnt_init(void)
} }
if (dfs_mount("sd0", "/sd", "elm", 0, 0) == 0) if (dfs_mount("sd0", "/sd", "elm", 0, 0) == 0)
#else
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
#endif /* RT_USING_DFS_WINSHAREDIR */
{ {
LOG_I("[sd0] File System on SD ('sd0') initialized!"); LOG_I("[sd0] File System on SD ('sd0') initialized!");
} }
...@@ -45,7 +49,11 @@ static int mnt_init(void) ...@@ -45,7 +49,11 @@ static int mnt_init(void)
LOG_W("[sd0] Try to format and re-mount..."); LOG_W("[sd0] Try to format and re-mount...");
if (dfs_mkfs("elm", "sd0") == 0) if (dfs_mkfs("elm", "sd0") == 0)
{ {
#ifdef RT_USING_DFS_WINSHAREDIR
if (dfs_mount("sd0", "/sd", "elm", 0, 0) == 0) if (dfs_mount("sd0", "/sd", "elm", 0, 0) == 0)
#else
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
#endif /* RT_USING_DFS_WINSHAREDIR */
{ {
LOG_I("[sd0] File System on SD ('sd0') initialized!"); LOG_I("[sd0] File System on SD ('sd0') initialized!");
return 0; return 0;
...@@ -54,18 +62,7 @@ static int mnt_init(void) ...@@ -54,18 +62,7 @@ static int mnt_init(void)
LOG_E("[sd0] File System on SD ('sd0') initialization failed!"); LOG_E("[sd0] File System on SD ('sd0') initialization failed!");
} }
#else
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
{
LOG_I("[sd0] File System on sd initialized!");
}
else
{
LOG_E("[sd0] File System on sd initialization failed!");
}
#endif
return 0; return 0;
} }
INIT_ENV_EXPORT(mnt_init); INIT_ENV_EXPORT(mnt_init);
#endif #endif /* RT_USING_DFS */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册