Skip to content

Commit 8a2a091

Browse files
committed
替换所有的mnt.c
1 parent f1c8165 commit 8a2a091

File tree

5 files changed

+150
-30
lines changed
  • projects
    • Edgi-Talk_Audio/Edgi_Talk_M33_Audio/board/ports/filesystem
    • Edgi-Talk_LVGL/Edgi_Talk_M55_LVGL/board/ports/filesystem
    • Edgi-Talk_MIPI_LCD/Edgi_Talk_M55_MIPI_LCD/board/ports/filesystem
    • Edgi-Talk_WIFI/Edgi_Talk_M55_WIFI/board/ports/filesystem
    • Edgi-Talk_XiaoZhi/Edgi_Talk_M55_XiaoZhi/board/ports/filesystem

5 files changed

+150
-30
lines changed

projects/Edgi-Talk_Audio/Edgi_Talk_M33_Audio/board/ports/filesystem/mnt.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,42 @@
55

66
int mnt_init(void)
77
{
8-
rt_err_t ret;
8+
rt_device_t device;
99

10-
rt_thread_mdelay(200);
10+
rt_thread_mdelay(500);
1111

12-
if (dfs_mount("sd0", "/", "elm", 0, 0) != 0)
12+
/* 检测sd0设备是否存在 */
13+
device = rt_device_find("sd0");
14+
if (device == RT_NULL)
1315
{
14-
rt_kprintf("Dir / mount failed!\n");
16+
rt_kprintf("SD card device 'sd0' not found!\n");
1517
return -1;
1618
}
1719

18-
return 0;
20+
/* 尝试挂载SD卡 */
21+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
22+
{
23+
rt_kprintf("SD card mount to '/' success!\n");
24+
return 0;
25+
}
26+
27+
/* 挂载失败,尝试格式化 */
28+
rt_kprintf("SD card mount failed, try to mkfs...\n");
29+
if (dfs_mkfs("elm", "sd0") == 0)
30+
{
31+
rt_kprintf("SD card mkfs success!\n");
32+
33+
/* 格式化成功后再次尝试挂载 */
34+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
35+
{
36+
rt_kprintf("SD card mount to '/' success!\n");
37+
return 0;
38+
}
39+
}
40+
41+
rt_kprintf("SD card mount to '/' failed!\n");
42+
return -1;
1943
}
20-
INIT_ENV_EXPORT(mnt_init);
44+
INIT_APP_EXPORT(mnt_init);
2145

2246
#endif

projects/Edgi-Talk_LVGL/Edgi_Talk_M55_LVGL/board/ports/filesystem/mnt.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,42 @@
55

66
int mnt_init(void)
77
{
8-
rt_err_t ret;
8+
rt_device_t device;
99

10-
rt_thread_mdelay(200);
10+
rt_thread_mdelay(500);
1111

12-
if (dfs_mount("sd0", "/", "elm", 0, 0) != 0)
12+
/* 检测sd0设备是否存在 */
13+
device = rt_device_find("sd0");
14+
if (device == RT_NULL)
1315
{
14-
rt_kprintf("Dir / mount failed!\n");
16+
rt_kprintf("SD card device 'sd0' not found!\n");
1517
return -1;
1618
}
1719

18-
return 0;
20+
/* 尝试挂载SD卡 */
21+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
22+
{
23+
rt_kprintf("SD card mount to '/' success!\n");
24+
return 0;
25+
}
26+
27+
/* 挂载失败,尝试格式化 */
28+
rt_kprintf("SD card mount failed, try to mkfs...\n");
29+
if (dfs_mkfs("elm", "sd0") == 0)
30+
{
31+
rt_kprintf("SD card mkfs success!\n");
32+
33+
/* 格式化成功后再次尝试挂载 */
34+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
35+
{
36+
rt_kprintf("SD card mount to '/' success!\n");
37+
return 0;
38+
}
39+
}
40+
41+
rt_kprintf("SD card mount to '/' failed!\n");
42+
return -1;
1943
}
20-
INIT_ENV_EXPORT(mnt_init);
44+
INIT_APP_EXPORT(mnt_init);
2145

2246
#endif

projects/Edgi-Talk_MIPI_LCD/Edgi_Talk_M55_MIPI_LCD/board/ports/filesystem/mnt.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,42 @@
55

66
int mnt_init(void)
77
{
8-
rt_err_t ret;
8+
rt_device_t device;
99

10-
rt_thread_mdelay(200);
10+
rt_thread_mdelay(500);
1111

12-
if (dfs_mount("sd0", "/", "elm", 0, 0) != 0)
12+
/* 检测sd0设备是否存在 */
13+
device = rt_device_find("sd0");
14+
if (device == RT_NULL)
1315
{
14-
rt_kprintf("Dir / mount failed!\n");
16+
rt_kprintf("SD card device 'sd0' not found!\n");
1517
return -1;
1618
}
1719

18-
return 0;
20+
/* 尝试挂载SD卡 */
21+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
22+
{
23+
rt_kprintf("SD card mount to '/' success!\n");
24+
return 0;
25+
}
26+
27+
/* 挂载失败,尝试格式化 */
28+
rt_kprintf("SD card mount failed, try to mkfs...\n");
29+
if (dfs_mkfs("elm", "sd0") == 0)
30+
{
31+
rt_kprintf("SD card mkfs success!\n");
32+
33+
/* 格式化成功后再次尝试挂载 */
34+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
35+
{
36+
rt_kprintf("SD card mount to '/' success!\n");
37+
return 0;
38+
}
39+
}
40+
41+
rt_kprintf("SD card mount to '/' failed!\n");
42+
return -1;
1943
}
20-
INIT_ENV_EXPORT(mnt_init);
44+
INIT_APP_EXPORT(mnt_init);
2145

2246
#endif

projects/Edgi-Talk_WIFI/Edgi_Talk_M55_WIFI/board/ports/filesystem/mnt.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,42 @@
55

66
int mnt_init(void)
77
{
8-
rt_err_t ret;
8+
rt_device_t device;
99

10-
rt_thread_mdelay(200);
10+
rt_thread_mdelay(500);
1111

12-
if (dfs_mount("sd0", "/", "elm", 0, 0) != 0)
12+
/* 检测sd0设备是否存在 */
13+
device = rt_device_find("sd0");
14+
if (device == RT_NULL)
1315
{
14-
rt_kprintf("Dir / mount failed!\n");
16+
rt_kprintf("SD card device 'sd0' not found!\n");
1517
return -1;
1618
}
1719

18-
return 0;
20+
/* 尝试挂载SD卡 */
21+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
22+
{
23+
rt_kprintf("SD card mount to '/' success!\n");
24+
return 0;
25+
}
26+
27+
/* 挂载失败,尝试格式化 */
28+
rt_kprintf("SD card mount failed, try to mkfs...\n");
29+
if (dfs_mkfs("elm", "sd0") == 0)
30+
{
31+
rt_kprintf("SD card mkfs success!\n");
32+
33+
/* 格式化成功后再次尝试挂载 */
34+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
35+
{
36+
rt_kprintf("SD card mount to '/' success!\n");
37+
return 0;
38+
}
39+
}
40+
41+
rt_kprintf("SD card mount to '/' failed!\n");
42+
return -1;
1943
}
20-
INIT_ENV_EXPORT(mnt_init);
44+
INIT_APP_EXPORT(mnt_init);
2145

2246
#endif

projects/Edgi-Talk_XiaoZhi/Edgi_Talk_M55_XiaoZhi/board/ports/filesystem/mnt.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,42 @@
55

66
int mnt_init(void)
77
{
8-
rt_err_t ret;
8+
rt_device_t device;
99

10-
rt_thread_mdelay(200);
10+
rt_thread_mdelay(500);
1111

12-
if (dfs_mount("sd0", "/", "elm", 0, 0) != 0)
12+
/* 检测sd0设备是否存在 */
13+
device = rt_device_find("sd0");
14+
if (device == RT_NULL)
1315
{
14-
rt_kprintf("Dir / mount failed!\n");
16+
rt_kprintf("SD card device 'sd0' not found!\n");
1517
return -1;
1618
}
1719

18-
return 0;
20+
/* 尝试挂载SD卡 */
21+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
22+
{
23+
rt_kprintf("SD card mount to '/' success!\n");
24+
return 0;
25+
}
26+
27+
/* 挂载失败,尝试格式化 */
28+
rt_kprintf("SD card mount failed, try to mkfs...\n");
29+
if (dfs_mkfs("elm", "sd0") == 0)
30+
{
31+
rt_kprintf("SD card mkfs success!\n");
32+
33+
/* 格式化成功后再次尝试挂载 */
34+
if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
35+
{
36+
rt_kprintf("SD card mount to '/' success!\n");
37+
return 0;
38+
}
39+
}
40+
41+
rt_kprintf("SD card mount to '/' failed!\n");
42+
return -1;
1943
}
20-
INIT_ENV_EXPORT(mnt_init);
44+
INIT_APP_EXPORT(mnt_init);
2145

2246
#endif

0 commit comments

Comments
 (0)