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
This commit is contained in:
bernard.xiong@gmail.com 2012-01-29 08:11:21 +00:00
parent bf553dccf1
commit 2f9cd34325
5 changed files with 26 additions and 5 deletions

View File

@ -12,6 +12,6 @@ sd.c
# The set of source files associated with this SConscript file. # The set of source files associated with this SConscript file.
path = [cwd] path = [cwd]
group = DefineGroup('Drivers', src, depend = ['RT_USING_MMCSD'], CPPPATH = path) group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_MMCSD'], CPPPATH = path)
Return('group') Return('group')

View File

@ -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) 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); host->ops->request(host, req);
rt_sem_take(&host->sem_ack, RT_WAITING_FOREVER); rt_sem_take(&host->sem_ack, RT_WAITING_FOREVER);
} }

View File

@ -39,6 +39,12 @@ struct rt_mmcsd_data {
#define DATA_DIR_WRITE (1 << 0) #define DATA_DIR_WRITE (1 << 0)
#define DATA_DIR_READ (1 << 1) #define DATA_DIR_READ (1 << 1)
#define DATA_STREAM (1 << 2) #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_ns;
rt_uint32_t timeout_clks; rt_uint32_t timeout_clks;
}; };
@ -89,9 +95,11 @@ struct rt_mmcsd_cmd {
*/ */
#define cmd_type(cmd) ((cmd)->flags & CMD_MASK) #define cmd_type(cmd) ((cmd)->flags & CMD_MASK)
rt_int32_t retries; /* max number of retries */
rt_int32_t err; rt_int32_t err;
struct rt_mmcsd_data *data; struct rt_mmcsd_data *data;
struct rt_mmcsd_req *mrq; /* associated request */
}; };
struct rt_mmcsd_req { struct rt_mmcsd_req {
@ -190,7 +198,7 @@ rt_inline rt_uint32_t fls(rt_uint32_t val)
return bit; return bit;
} }
#if !defined(__GNUC__) #if !defined(__GNUC__) || defined(__CC_ARM)
rt_inline rt_uint32_t ffs(rt_uint32_t x) rt_inline rt_uint32_t ffs(rt_uint32_t x)
{ {
int r = 1; int r = 1;

View File

@ -281,7 +281,7 @@ err1:
static rt_err_t mmcsd_app_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_card *card) static rt_err_t mmcsd_app_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_card *card)
{ {
rt_err_t err; rt_err_t err;
struct rt_mmcsd_cmd cmd; struct rt_mmcsd_cmd cmd = {0};
cmd.cmd_code = APP_CMD; cmd.cmd_code = APP_CMD;

View File

@ -3,6 +3,6 @@ from building import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
src = Glob('*.c') src = Glob('*.c')
CPPPATH = [cwd + '/../include'] 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') Return('group')