修复sdio读写块的地址偏移问题 (#6082)

* 修复sdio读写块的地址偏移问题
This commit is contained in:
woody 2022-06-16 18:31:07 +08:00 committed by GitHub
parent b1fab8942a
commit 1c81a6d220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -534,13 +534,17 @@ static rt_err_t swm_sdio_rxconfig(struct sdio_pkg *pkg, rt_uint32_t *buff, int s
{
struct rt_mmcsd_cmd *cmd = pkg->cmd;
struct rt_mmcsd_data *data = cmd->data;
int offset = 0;
for (uint32_t i = 0; i < data->blks; i++)
{
offset = i* data->blksize / 4;
while ((SDIO->IF & SDIO_IF_BUFRDRDY_Msk) == 0)
__NOP();
SDIO->IF = SDIO_IF_BUFRDRDY_Msk;
for (uint32_t j = 0; j < data->blksize / 4; j++)
buff[j] = SDIO->DATA;
{
buff[offset + j] = SDIO->DATA;
}
}
return RT_EOK;
}
@ -549,13 +553,15 @@ static rt_err_t swm_sdio_txconfig(struct sdio_pkg *pkg, rt_uint32_t *buff, int s
{
struct rt_mmcsd_cmd *cmd = pkg->cmd;
struct rt_mmcsd_data *data = cmd->data;
int offset = 0;
for (uint32_t i = 0; i < data->blks; i++)
{
offset = i* data->blksize / 4;
while ((SDIO->IF & SDIO_IF_BUFWRRDY_Msk) == 0)
__NOP();
SDIO->IF = SDIO_IF_BUFWRRDY_Msk;
for (uint32_t j = 0; j < data->blksize / 4; j++)
SDIO->DATA = buff[j];
SDIO->DATA = buff[offset + j];
}
return RT_EOK;
}