Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
e47515d8
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看板
提交
e47515d8
编写于
7月 04, 2017
作者:
B
Bernard Xiong
提交者:
GitHub
7月 04, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #758 from JianRuiqian/master
[DeviceDrivers] improve sdio
上级
315a6164
465fdfc2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
13 deletion
+35
-13
components/drivers/include/drivers/mmcsd_card.h
components/drivers/include/drivers/mmcsd_card.h
+2
-0
components/drivers/include/drivers/mmcsd_host.h
components/drivers/include/drivers/mmcsd_host.h
+1
-1
components/drivers/include/drivers/sdio.h
components/drivers/include/drivers/sdio.h
+2
-0
components/drivers/sdio/mmcsd_core.c
components/drivers/sdio/mmcsd_core.c
+4
-4
components/drivers/sdio/sdio.c
components/drivers/sdio/sdio.c
+26
-8
未找到文件。
components/drivers/include/drivers/mmcsd_card.h
浏览文件 @
e47515d8
...
...
@@ -135,6 +135,8 @@ struct rt_sdio_function {
rt_uint32_t
enable_timeout_val
;
/* max enable timeout in msec */
struct
rt_sdio_function_tuple
*
tuples
;
void
*
priv
;
};
#define SDIO_MAX_FUNCTIONS 7
...
...
components/drivers/include/drivers/mmcsd_host.h
浏览文件 @
e47515d8
...
...
@@ -111,7 +111,7 @@ struct rt_mmcsd_host {
rt_uint32_t
max_blk_count
;
/* maximum block count */
rt_uint32_t
spi_use_crc
;
struct
rt_
semaphore
bus_lock
;
struct
rt_
mutex
bus_lock
;
struct
rt_semaphore
sem_ack
;
rt_uint32_t
sdio_irq_num
;
...
...
components/drivers/include/drivers/sdio.h
浏览文件 @
e47515d8
...
...
@@ -229,6 +229,8 @@ rt_int32_t sdio_detach_irq(struct rt_sdio_function *func);
void
sdio_irq_wakeup
(
struct
rt_mmcsd_host
*
host
);
rt_int32_t
sdio_enable_func
(
struct
rt_sdio_function
*
func
);
rt_int32_t
sdio_disable_func
(
struct
rt_sdio_function
*
func
);
void
sdio_set_drvdata
(
struct
rt_sdio_function
*
func
,
void
*
data
);
void
*
sdio_get_drvdata
(
struct
rt_sdio_function
*
func
);
rt_int32_t
sdio_set_block_size
(
struct
rt_sdio_function
*
func
,
rt_uint32_t
blksize
);
rt_int32_t
sdio_register_driver
(
struct
rt_sdio_driver
*
driver
);
...
...
components/drivers/sdio/mmcsd_core.c
浏览文件 @
e47515d8
...
...
@@ -49,12 +49,12 @@ static rt_uint32_t mmcsd_hotpluge_mb_pool[4];
void
mmcsd_host_lock
(
struct
rt_mmcsd_host
*
host
)
{
rt_
sem
_take
(
&
host
->
bus_lock
,
RT_WAITING_FOREVER
);
rt_
mutex
_take
(
&
host
->
bus_lock
,
RT_WAITING_FOREVER
);
}
void
mmcsd_host_unlock
(
struct
rt_mmcsd_host
*
host
)
{
rt_
sem
_release
(
&
host
->
bus_lock
);
rt_
mutex
_release
(
&
host
->
bus_lock
);
}
void
mmcsd_req_complete
(
struct
rt_mmcsd_host
*
host
)
...
...
@@ -713,7 +713,7 @@ struct rt_mmcsd_host *mmcsd_alloc_host(void)
host
->
max_blk_size
=
512
;
host
->
max_blk_count
=
4096
;
rt_
sem_init
(
&
host
->
bus_lock
,
"sd_bus_lock"
,
1
,
RT_IPC_FLAG_FIFO
);
rt_
mutex_init
(
&
host
->
bus_lock
,
"sd_bus_lock"
,
RT_IPC_FLAG_FIFO
);
rt_sem_init
(
&
host
->
sem_ack
,
"sd_ack"
,
0
,
RT_IPC_FLAG_FIFO
);
return
host
;
...
...
@@ -721,7 +721,7 @@ struct rt_mmcsd_host *mmcsd_alloc_host(void)
void
mmcsd_free_host
(
struct
rt_mmcsd_host
*
host
)
{
rt_
sem
_detach
(
&
host
->
bus_lock
);
rt_
mutex
_detach
(
&
host
->
bus_lock
);
rt_sem_detach
(
&
host
->
sem_ack
);
rt_free
(
host
);
}
...
...
components/drivers/sdio/sdio.c
浏览文件 @
e47515d8
...
...
@@ -29,8 +29,8 @@
#ifndef RT_SDIO_STACK_SIZE
#define RT_SDIO_STACK_SIZE 512
#endif
#ifndef RT_SDIO_THREAD_PR
E
ORITY
#define RT_SDIO_THREAD_PR
E
ORITY 0x40
#ifndef RT_SDIO_THREAD_PR
I
ORITY
#define RT_SDIO_THREAD_PR
I
ORITY 0x40
#endif
static
rt_list_t
sdio_cards
;
...
...
@@ -1059,7 +1059,7 @@ static rt_int32_t sdio_irq_thread_create(struct rt_mmcsd_card *card)
RT_ASSERT
(
host
->
sdio_irq_sem
!=
RT_NULL
);
host
->
sdio_irq_thread
=
rt_thread_create
(
"sdio_irq"
,
sdio_irq_thread
,
host
,
RT_SDIO_STACK_SIZE
,
RT_SDIO_THREAD_PR
E
ORITY
,
20
);
RT_SDIO_STACK_SIZE
,
RT_SDIO_THREAD_PR
I
ORITY
,
20
);
if
(
host
->
sdio_irq_thread
!=
RT_NULL
)
{
rt_thread_startup
(
host
->
sdio_irq_thread
);
...
...
@@ -1079,7 +1079,7 @@ static rt_int32_t sdio_irq_thread_delete(struct rt_mmcsd_card *card)
if
(
!
host
->
sdio_irq_num
)
{
if
(
host
->
flags
&
MMCSD_SUP_SDIO_IRQ
)
host
->
ops
->
enable_sdio_irq
(
host
,
0
);
host
->
ops
->
enable_sdio_irq
(
host
,
0
);
rt_sem_delete
(
host
->
sdio_irq_sem
);
host
->
sdio_irq_sem
=
RT_NULL
;
rt_thread_delete
(
host
->
sdio_irq_thread
);
...
...
@@ -1253,6 +1253,16 @@ err:
return
-
RT_EIO
;
}
void
sdio_set_drvdata
(
struct
rt_sdio_function
*
func
,
void
*
data
)
{
func
->
priv
=
data
;
}
void
*
sdio_get_drvdata
(
struct
rt_sdio_function
*
func
)
{
return
func
->
priv
;
}
rt_int32_t
sdio_set_block_size
(
struct
rt_sdio_function
*
func
,
rt_uint32_t
blksize
)
{
...
...
@@ -1284,16 +1294,24 @@ rt_int32_t sdio_set_block_size(struct rt_sdio_function *func,
rt_inline
rt_int32_t
sdio_match_card
(
struct
rt_mmcsd_card
*
card
,
const
struct
rt_sdio_device_id
*
id
)
{
rt_uint8_t
num
=
1
;
if
((
id
->
manufacturer
!=
SDIO_ANY_MAN_ID
)
&&
(
id
->
manufacturer
!=
card
->
cis
.
manufacturer
))
return
0
;
if
((
id
->
product
!=
SDIO_ANY_PROD_ID
)
&&
(
id
->
product
!=
(
card
->
cis
.
product
|
1
)))
return
0
;
while
(
num
<=
card
->
sdio_function_num
)
{
if
((
id
->
product
!=
SDIO_ANY_PROD_ID
)
&&
(
id
->
product
==
card
->
sdio_function
[
num
]
->
product
))
return
1
;
num
++
;
}
return
1
;
return
0
;
}
static
struct
rt_mmcsd_card
*
sdio_match_driver
(
struct
rt_sdio_device_id
*
id
)
{
rt_list_t
*
l
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录