MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / mount_init

Function mount_init

bsp/bouffalo_lab/libraries/rt_drivers/port/mnt.c:54–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54int mount_init(void)
55{
56 if(dfs_mount(RT_NULL, "/", "rom", 0, &romfs_root) != 0)
57 {
58 LOG_E("rom mount to '/' failed!");
59 }
60
61#ifdef BSP_USING_ON_CHIP_FLASH_FS
62 struct rt_device *flash_dev = RT_NULL;
63
64 /* 使用 filesystem 分区创建块设备,块设备名称为 filesystem */
65 flash_dev = fal_blk_device_create("filesystem");
66 if(flash_dev == RT_NULL)
67 {
68 LOG_E("Failed to create device.\n");
69 return -RT_ERROR;
70 }
71
72 if (dfs_mount("filesystem", "/flash", "lfs", 0, 0) != 0)
73 {
74 LOG_I("file system initialization failed!\n");
75 if(dfs_mkfs("lfs", "filesystem") == 0)
76 {
77 if (dfs_mount("filesystem", "/flash", "lfs", 0, 0) == 0)
78 {
79 LOG_I("mount to '/flash' success!");
80 }
81 }
82 }
83 else
84 {
85 LOG_I("mount to '/flash' success!");
86 }
87#endif
88
89#ifdef BSP_USING_SDH
90 rt_thread_t tid;
91
92 tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
93 2048, RT_THREAD_PRIORITY_MAX - 2, 20);
94 if (tid != RT_NULL)
95 {
96 rt_thread_startup(tid);
97 }
98 else
99 {
100 LOG_E("create sd_mount thread err!");
101 }
102#endif
103
104 return RT_EOK;
105}
106INIT_APP_EXPORT(mount_init);
107
108#endif /* RT_USING_DFS */

Callers

nothing calls this directly

Calls 5

fal_blk_device_createFunction · 0.85
rt_thread_createFunction · 0.85
rt_thread_startupFunction · 0.85
dfs_mountFunction · 0.50
dfs_mkfsFunction · 0.50

Tested by

no test coverage detected