fix data align bug

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1039 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
qiuyiuestc 2010-11-05 15:08:51 +00:00
parent 6e4a697d0c
commit ac812f693d
1 changed files with 6 additions and 4 deletions

View File

@ -243,7 +243,7 @@ RECMD3:
rt_uint8_t sd_readblock(rt_uint32_t address, rt_uint8_t* buf)
{
int status;
rt_uint32_t status, tmp;
rd_cnt=0;
SDIFSTA = SDIFSTA | (1<<16);
@ -271,7 +271,8 @@ RERDCMD:
status = SDIFSTA;
if((status & 0x1000) == 0x1000)
{
*(rt_uint32_t *)buf = SDIDAT;
tmp = SDIDAT;
rt_memcpy(buf, &tmp, sizeof(rt_uint32_t));
rd_cnt++;
buf += 4;
}
@ -291,7 +292,7 @@ RERDCMD:
rt_uint8_t sd_writeblock(rt_uint32_t address, rt_uint8_t* buf)
{
int status;
rt_uint32_t status, tmp;
wt_cnt=0;
SDIFSTA = SDIFSTA | (1 << 16);
@ -311,7 +312,8 @@ REWTCMD:
status = SDIFSTA;
if((status & 0x2000) == 0x2000)
{
SDIDAT=*(rt_uint32_t*)buf;
rt_memcpy(&tmp, buf, sizeof(rt_uint32_t));
SDIDAT = tmp;
wt_cnt++;
buf += 4;
}