提交 ac850ef3 编写于 作者: B bernard

add device_open/close in mkfs

上级 914244f3
...@@ -224,6 +224,8 @@ int dfs_elm_mkfs(rt_device_t dev_id) ...@@ -224,6 +224,8 @@ int dfs_elm_mkfs(rt_device_t dev_id)
flag = FSM_STATUS_USE_TEMP_DRIVER; flag = FSM_STATUS_USE_TEMP_DRIVER;
disk[index] = dev_id; disk[index] = dev_id;
/* try to open device */
rt_device_open(dev_id, RT_DEVICE_OFLAG_RDWR);
/* just fill the FatFs[vol] in ff.c, or mkfs will failded! /* just fill the FatFs[vol] in ff.c, or mkfs will failded!
* consider this condition: you just umount the elm fat, * consider this condition: you just umount the elm fat,
...@@ -245,6 +247,8 @@ int dfs_elm_mkfs(rt_device_t dev_id) ...@@ -245,6 +247,8 @@ int dfs_elm_mkfs(rt_device_t dev_id)
rt_free(fat); rt_free(fat);
f_mount((BYTE)index, RT_NULL); f_mount((BYTE)index, RT_NULL);
disk[index] = RT_NULL; disk[index] = RT_NULL;
/* close device */
rt_device_close(dev_id);
} }
if (result != FR_OK) if (result != FR_OK)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册