Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
宁楠萍
rt-thread
提交
02a5cebc
R
rt-thread
项目概览
宁楠萍
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
02a5cebc
编写于
5月 20, 2016
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[DeviceDrivers] Add MMC/SD change support.
Add MMC/SD change support, which patched by FH.
上级
4d45dc45
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
2 deletion
+32
-2
components/drivers/include/drivers/mmcsd_core.h
components/drivers/include/drivers/mmcsd_core.h
+4
-0
components/drivers/sdio/mmcsd_core.c
components/drivers/sdio/mmcsd_core.c
+28
-2
未找到文件。
components/drivers/include/drivers/mmcsd_core.h
浏览文件 @
02a5cebc
...
...
@@ -220,6 +220,10 @@ rt_inline rt_uint32_t fls(rt_uint32_t val)
return
bit
;
}
#define MMCSD_HOST_PLUGED 0
#define MMCSD_HOST_UNPLUGED 1
int
mmcsd_wait_cd_changed
(
rt_int32_t
timeout
);
void
mmcsd_host_lock
(
struct
rt_mmcsd_host
*
host
);
void
mmcsd_host_unlock
(
struct
rt_mmcsd_host
*
host
);
void
mmcsd_req_complete
(
struct
rt_mmcsd_host
*
host
);
...
...
components/drivers/sdio/mmcsd_core.c
浏览文件 @
02a5cebc
...
...
@@ -44,6 +44,8 @@ static struct rt_thread mmcsd_detect_thread;
static
rt_uint8_t
mmcsd_stack
[
RT_MMCSD_STACK_SIZE
];
static
struct
rt_mailbox
mmcsd_detect_mb
;
static
rt_uint32_t
mmcsd_detect_mb_pool
[
4
];
static
struct
rt_mailbox
mmcsd_hotpluge_mb
;
static
rt_uint32_t
mmcsd_hotpluge_mb_pool
[
4
];
void
mmcsd_host_lock
(
struct
rt_mmcsd_host
*
host
)
{
...
...
@@ -594,6 +596,24 @@ static void mmcsd_power_off(struct rt_mmcsd_host *host)
mmcsd_set_iocfg
(
host
);
}
int
mmcsd_wait_cd_changed
(
rt_int32_t
timeout
)
{
struct
rt_mmcsd_host
*
host
;
if
(
rt_mb_recv
(
&
mmcsd_hotpluge_mb
,
(
rt_uint32_t
*
)
&
host
,
timeout
)
==
RT_EOK
)
{
if
(
host
->
card
==
RT_NULL
)
{
return
MMCSD_HOST_UNPLUGED
;
}
else
{
return
MMCSD_HOST_PLUGED
;
}
}
return
-
RT_ETIMEOUT
;
}
RTM_EXPORT
(
mmcsd_wait_cd_changed
);
void
mmcsd_change
(
struct
rt_mmcsd_host
*
host
)
{
rt_mb_send
(
&
mmcsd_detect_mb
,
(
rt_uint32_t
)
host
);
...
...
@@ -647,6 +667,7 @@ void mmcsd_detect(void *param)
if
(
init_mmc
(
host
,
ocr
))
mmcsd_power_off
(
host
);
mmcsd_host_unlock
(
host
);
rt_mb_send
(
&
mmcsd_hotpluge_mb
,
(
rt_uint32_t
)
host
);
continue
;
}
mmcsd_host_unlock
(
host
);
...
...
@@ -667,6 +688,7 @@ void mmcsd_detect(void *param)
host
->
card
=
RT_NULL
;
}
mmcsd_host_unlock
(
host
);
rt_mb_send
(
&
mmcsd_hotpluge_mb
,
(
rt_uint32_t
)
host
);
}
}
}
...
...
@@ -711,11 +733,15 @@ void rt_mmcsd_core_init(void)
/* initialize detect SD cart thread */
/* initialize mailbox and create detect SD card thread */
ret
=
rt_mb_init
(
&
mmcsd_detect_mb
,
"mmcsdmb"
,
&
mmcsd_detect_mb_pool
[
0
],
sizeof
(
mmcsd_detect_mb_pool
),
&
mmcsd_detect_mb_pool
[
0
],
sizeof
(
mmcsd_detect_mb_pool
)
/
sizeof
(
mmcsd_detect_mb_pool
[
0
])
,
RT_IPC_FLAG_FIFO
);
RT_ASSERT
(
ret
==
RT_EOK
);
ret
=
rt_thread_init
(
&
mmcsd_detect_thread
,
"mmcsd_detect"
,
mmcsd_detect
,
RT_NULL
,
ret
=
rt_mb_init
(
&
mmcsd_hotpluge_mb
,
"mmcsdhotplugmb"
,
&
mmcsd_hotpluge_mb_pool
[
0
],
sizeof
(
mmcsd_hotpluge_mb_pool
)
/
sizeof
(
mmcsd_hotpluge_mb_pool
[
0
]),
RT_IPC_FLAG_FIFO
);
RT_ASSERT
(
ret
==
RT_EOK
);
ret
=
rt_thread_init
(
&
mmcsd_detect_thread
,
"mmcsd_detect"
,
mmcsd_detect
,
RT_NULL
,
&
mmcsd_stack
[
0
],
RT_MMCSD_STACK_SIZE
,
RT_MMCSD_THREAD_PREORITY
,
20
);
if
(
ret
==
RT_EOK
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录