summaryrefslogtreecommitdiff
path: root/components/drivers
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-01-29 08:11:21 +0000
committer[email protected] <[email protected]>2012-01-29 08:11:21 +0000
commit2f9cd34325b3151651b145498eb2f2e369ccad79 (patch)
tree5d8d3b48c8e7f8fb123d2d225c7a10d65a636a71 /components/drivers
parentbf553dccf1dc277e89047cb4640eb7aaf00dbd41 (diff)
merge 1.0.x to 1.1.x for SD driver.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1926 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/drivers')
-rw-r--r--components/drivers/sdio/SConscript2
-rw-r--r--components/drivers/sdio/mmcsd_core.c15
-rw-r--r--components/drivers/sdio/mmcsd_core.h10
-rw-r--r--components/drivers/sdio/sd.c2
-rw-r--r--components/drivers/spi/SConscript2
5 files changed, 26 insertions, 5 deletions
diff --git a/components/drivers/sdio/SConscript b/components/drivers/sdio/SConscript
index 55aac473ed..dfe7075a5e 100644
--- a/components/drivers/sdio/SConscript
+++ b/components/drivers/sdio/SConscript
@@ -12,6 +12,6 @@ sd.c
# The set of source files associated with this SConscript file.
path = [cwd]
-group = DefineGroup('Drivers', src, depend = ['RT_USING_MMCSD'], CPPPATH = path)
+group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_MMCSD'], CPPPATH = path)
Return('group')
diff --git a/components/drivers/sdio/mmcsd_core.c b/components/drivers/sdio/mmcsd_core.c
index b301233318..620a26fd30 100644
--- a/components/drivers/sdio/mmcsd_core.c
+++ b/components/drivers/sdio/mmcsd_core.c
@@ -48,7 +48,20 @@ void mmcsd_req_complete(struct rt_mmcsd_host *host)
void mmcsd_send_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req)
{
- req->cmd->data = req->data;
+ req->cmd->err = 0;
+ req->cmd->mrq = req;
+ if (req->data)
+ {
+ req->cmd->data = req->data;
+ req->data->err = 0;
+ req->data->mrq = req;
+ if (req->stop)
+ {
+ req->data->stop = req->stop;
+ req->stop->err = 0;
+ req->stop->mrq = req;
+ }
+ }
host->ops->request(host, req);
rt_sem_take(&host->sem_ack, RT_WAITING_FOREVER);
}
diff --git a/components/drivers/sdio/mmcsd_core.h b/components/drivers/sdio/mmcsd_core.h
index 078a0edf94..1e2c9f08b6 100644
--- a/components/drivers/sdio/mmcsd_core.h
+++ b/components/drivers/sdio/mmcsd_core.h
@@ -39,6 +39,12 @@ struct rt_mmcsd_data {
#define DATA_DIR_WRITE (1 << 0)
#define DATA_DIR_READ (1 << 1)
#define DATA_STREAM (1 << 2)
+
+ unsigned int bytes_xfered;
+
+ struct rt_mmcsd_cmd *stop; /* stop command */
+ struct rt_mmcsd_req *mrq; /* associated request */
+
rt_uint32_t timeout_ns;
rt_uint32_t timeout_clks;
};
@@ -89,9 +95,11 @@ struct rt_mmcsd_cmd {
*/
#define cmd_type(cmd) ((cmd)->flags & CMD_MASK)
+ rt_int32_t retries; /* max number of retries */
rt_int32_t err;
struct rt_mmcsd_data *data;
+ struct rt_mmcsd_req *mrq; /* associated request */
};
struct rt_mmcsd_req {
@@ -190,7 +198,7 @@ rt_inline rt_uint32_t fls(rt_uint32_t val)
return bit;
}
-#if !defined(__GNUC__)
+#if !defined(__GNUC__) || defined(__CC_ARM)
rt_inline rt_uint32_t ffs(rt_uint32_t x)
{
int r = 1;
diff --git a/components/drivers/sdio/sd.c b/components/drivers/sdio/sd.c
index 67fd39287d..f454b81080 100644
--- a/components/drivers/sdio/sd.c
+++ b/components/drivers/sdio/sd.c
@@ -281,7 +281,7 @@ err1:
static rt_err_t mmcsd_app_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_card *card)
{
rt_err_t err;
- struct rt_mmcsd_cmd cmd;
+ struct rt_mmcsd_cmd cmd = {0};
cmd.cmd_code = APP_CMD;
diff --git a/components/drivers/spi/SConscript b/components/drivers/spi/SConscript
index 930ebbee84..666545250a 100644
--- a/components/drivers/spi/SConscript
+++ b/components/drivers/spi/SConscript
@@ -3,6 +3,6 @@ from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd + '/../include']
-group = DefineGroup('Drivers', src, depend = ['RT_USING_SPI'], CPPPATH = CPPPATH)
+group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SPI'], CPPPATH = CPPPATH)
Return('group')