1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2019-04-11     ZYH          first version
9  */
10 #include <rtthread.h>
11 #if defined(RT_USING_FAL)
12 #include <fal.h>
13 #include <dfs_fs.h>
14 
mnt_init(void)15 int mnt_init(void)
16 {
17     fal_init();
18 #if defined(BSP_MOUNT_QSPI_WITH_LFS)
19     fal_mtd_nor_device_create("qspiflash");
20     if (dfs_mount("qspiflash", "/", "lfs", 0, 0) == 0)
21     {
22         rt_kprintf("Mount \"qspiflash\" on \"/\" success\n");
23     }
24     else
25     {
26         dfs_mkfs("lfs","qspiflash");
27         if (dfs_mount("qspiflash", "/", "lfs", 0, 0) == 0)
28         {
29             rt_kprintf("Mount \"qspiflash\" on \"/\" success\n");
30         }
31         else
32         {
33             rt_kprintf("Mount \"qspiflash\" on \"/\" fail\n");
34             return -1;
35         }
36     }
37 #endif
38     return 0;
39 }
40 INIT_ENV_EXPORT(mnt_init);
41 #endif
42