summaryrefslogtreecommitdiff
path: root/bsp/nxp/imx/imx6ull-smart/applications/mnt.c
blob: 90ebfead6a7657bc4e080b0c7e1f63c24137fc4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 */

#include <rtthread.h>

#ifdef RT_USING_DFS

#include <dfs_fs.h>
#include <dfs_romfs.h>

int mnt_init(void)
{
#ifdef RT_USING_SDIO2
    rt_thread_mdelay(500);

    int part_id = 0;
    if (dfs_mount("emmc0", "/", "elm", 0, (void *)part_id) != 0)
    {
        if (dfs_mount("sd0", "/", "elm", 0, (void *)part_id) != 0)
        {
            rt_kprintf("Dir / mount failed!\n");
            return -1;
        }
        else
        {
            rt_kprintf("sd0 file system initialization done!\n");
        }
    }
    else
    {
        rt_kprintf("emmc file system initialization done!\n");
    }
#else
    rt_thread_mdelay(500);
    if (dfs_mount(NULL, "/", "rom", 0, &romfs_root) != 0)
    {
        rt_kprintf("Dir / mount failed!\n");
        return -1;
    }

    rt_kprintf("file system initialization done!\n");
#endif
    return 0;
}
INIT_ENV_EXPORT(mnt_init);

#endif