rt-thread-official/bsp/nxp/lpc/lpc54608-LPCXpresso/applications/mnt.c

58 lines
1.1 KiB
C
Raw Normal View History

2017-08-08 11:56:50 +08:00
/*
2021-03-17 02:26:35 +08:00
* Copyright (c) 2006-2021, RT-Thread Development Team
2017-08-08 11:56:50 +08:00
*
* SPDX-License-Identifier: Apache-2.0
2017-08-08 11:56:50 +08:00
*
* Change Logs:
* Date Author Notes
* 2017-08-08 Yang the first version
*/
#include <rtthread.h>
2017-10-31 16:20:02 +08:00
#include <dfs.h>
2017-08-08 11:56:50 +08:00
#include <dfs_fs.h>
#ifdef RT_USING_DFS_ROMFS
#include <dfs_romfs.h>
#endif
#include "drv_sd.h"
#ifdef RT_USING_DFS_ROMFS
#define SD_ROOT "/sdcard"
#else
#define SD_ROOT "/"
#endif
int mnt_init(void)
{
#ifdef RT_USING_DFS_ROMFS
/* initialize the device filesystem */
dfs_init();
dfs_romfs_init();
/* mount rom file system */
2021-03-17 02:26:35 +08:00
if (dfs_mount(RT_NULL, "/", "rom", 0, &(romfs_root)) == 0)
2017-08-08 11:56:50 +08:00
{
rt_kprintf("ROM file system initializated!\n");
}
#endif
2017-11-13 15:11:41 +08:00
#ifdef BSP_DRV_SDCARD
2017-08-08 11:56:50 +08:00
/* initilize sd card */
2017-11-10 20:10:45 +08:00
mci_hw_init("sd0");
2017-11-13 15:11:41 +08:00
#endif
2017-11-10 20:10:45 +08:00
2021-03-17 02:26:35 +08:00
#ifdef RT_DFS_ELM_REENTRANT
2017-08-08 11:56:50 +08:00
/* mount sd card fat partition 1 as root directory */
if (dfs_mount("sd0", SD_ROOT, "elm", 0, 0) == 0)
rt_kprintf("File System initialized!\n");
else
rt_kprintf("File System init failed!\n");
2017-11-10 20:10:45 +08:00
#endif
2021-03-17 02:26:35 +08:00
2017-08-08 11:56:50 +08:00
return 0;
}
INIT_ENV_EXPORT(mnt_init);