Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
048ffb48
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
048ffb48
编写于
4月 05, 2016
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[DeviceDrivers] Add umount operations in SDCard block device.
上级
80431860
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
8 deletion
+32
-8
components/drivers/sdio/block_dev.c
components/drivers/sdio/block_dev.c
+32
-8
未找到文件。
components/drivers/sdio/block_dev.c
浏览文件 @
048ffb48
...
...
@@ -27,7 +27,7 @@
#include <drivers/mmcsd_core.h>
static
rt_list_t
blk_devices
;
static
rt_list_t
blk_devices
=
RT_LIST_OBJECT_INIT
(
blk_devices
)
;
struct
mmcsd_blk_device
{
...
...
@@ -336,6 +336,8 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
return
err
;
}
rt_kprintf
(
"probe mmcsd block device!
\n
"
);
/* get the first sector to read partition table */
sector
=
(
rt_uint8_t
*
)
rt_malloc
(
SECTOR_SIZE
);
if
(
sector
==
RT_NULL
)
...
...
@@ -350,13 +352,13 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
{
for
(
i
=
0
;
i
<
RT_MMCSD_MAX_PARTITION
;
i
++
)
{
blk_dev
=
rt_
malloc
(
sizeof
(
struct
mmcsd_blk_device
));
blk_dev
=
rt_
calloc
(
1
,
sizeof
(
struct
mmcsd_blk_device
));
if
(
!
blk_dev
)
{
rt_kprintf
(
"mmcsd:malloc mem
failde
\n
"
);
rt_kprintf
(
"mmcsd:malloc mem
ory failed!
\n
"
);
break
;
}
rt_memset
((
void
*
)
blk_dev
,
0
,
sizeof
(
struct
mmcsd_blk_device
));
/* get the first partition */
status
=
dfs_filesystem_get_partition
(
&
blk_dev
->
part
,
sector
,
i
);
if
(
status
==
RT_EOK
)
...
...
@@ -424,6 +426,15 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
break
;
}
}
#ifdef RT_USING_DFS_MNTTABLE
if
(
0
)
// if (blk_dev)
{
rt_kprintf
(
"try to mount file system!
\n
"
);
/* try to mount file system on this block device */
dfs_mount_device
(
&
(
blk_dev
->
dev
));
}
#endif
}
}
else
...
...
@@ -440,14 +451,21 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
void
rt_mmcsd_blk_remove
(
struct
rt_mmcsd_card
*
card
)
{
rt_list_t
*
l
;
rt_list_t
*
l
,
*
n
;
struct
mmcsd_blk_device
*
blk_dev
;
for
(
l
=
(
&
blk_devices
)
->
next
;
l
!=
&
blk_devices
;
l
=
l
->
next
)
for
(
l
=
(
&
blk_devices
)
->
next
,
n
=
l
->
next
;
l
!=
&
blk_devices
;
l
=
n
)
{
blk_dev
=
(
struct
mmcsd_blk_device
*
)
rt_list_entry
(
l
,
struct
mmcsd_blk_device
,
list
);
if
(
blk_dev
->
card
==
card
)
{
/* unmount file system */
const
char
*
mounted_path
=
dfs_filesystem_get_mounted_path
(
&
(
blk_dev
->
dev
));
if
(
mounted_path
)
{
dfs_unmount
(
mounted_path
);
}
rt_device_unregister
(
&
blk_dev
->
dev
);
rt_list_remove
(
&
blk_dev
->
list
);
rt_free
(
blk_dev
);
...
...
@@ -455,7 +473,13 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card)
}
}
/*
* This function will initialize block device on the mmc/sd.
*
* @deprecated since 2.1.0, this function does not need to be invoked
* in the system initialization.
*/
void
rt_mmcsd_blk_init
(
void
)
{
rt_list_init
(
&
blk_devices
);
/* nothing */
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录