提交 731711f7 编写于 作者: B bernard.xiong@gmail.com

the unit of read/write offset and buffer size is changed to the block size in...

the unit of read/write offset and buffer size is changed to the block size in block device driver read/write interface.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@795 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 b669237a
......@@ -374,11 +374,10 @@ static rt_err_t rt_sdcard_close(rt_device_t dev)
static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
{
bool status;
rt_uint32_t nr = size / SD_SECTOR_SIZE;
status = LPC17xx_SD_ReadSector(part.offset + pos/SECTOR_SIZE, buffer, nr);
status = LPC17xx_SD_ReadSector(part.offset + pos, buffer, size);
if (status == true) return nr * SECTOR_SIZE;
if (status == true) return size;
rt_kprintf("read failed: %d, pos 0x%08x, size %d\n", status, pos, size);
return 0;
......@@ -387,11 +386,10 @@ static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_
static rt_size_t rt_sdcard_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
{
bool status;
rt_uint32_t nr = size / SD_SECTOR_SIZE;
status = LPC17xx_SD_WriteSector(part.offset + pos/SECTOR_SIZE, buffer, nr);
status = LPC17xx_SD_WriteSector(part.offset + pos, buffer, size);
if (status == true) return nr * SECTOR_SIZE;
if (status == true) return size;
rt_kprintf("write failed: %d, pos 0x%08x, size %d\n", status, pos, size);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册