| 52 | } |
| 53 | |
| 54 | int 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 | } |
| 106 | INIT_APP_EXPORT(mount_init); |
| 107 | |
| 108 | #endif /* RT_USING_DFS */ |
nothing calls this directly
no test coverage detected