大学生
最后登录1970-1-1
在线时间 小时
注册时间2014-1-7
|
楼主 |
发表于 2014-1-20 15:02:17
|
显示全部楼层
#include "diskio.h"
#include "sdcard.h"
#define BLOCK_SIZE 512 /* Block Size in Bytes */
DSTATUS disk_initialize(BYTE drv)
{
SD_Error Status;
/* Supports only single drive */
if (drv)
{
return STA_NOINIT;
}
/*-------------------------- SD Init ----------------------------- */
Status = SD_Init();
if (Status != SD_OK )
{
return STA_NOINIT;
}
else
{
return RES_OK;
}
}
DSTATUS disk_status(BYTE drv)
{
return RES_OK;
}
DRESULT disk_read(
BYTE drv,
BYTE *buff,
DWORD sector,
BYTE count
)
{
if(count==1)
{
SD_ReadBlock(sector*BLOCK_SIZE,(uint8_t *)buff,BLOCK_SIZE);
}
else
{
SD_ReadMultiBlocks(sector*BLOCK_SIZE,(uint8_t *)buff,BLOCK_SIZE,count);
}
return RES_OK;
}
#if _READONLY == 0
DRESULT disk_write (
BYTE drv, /* Physical drive nmuber (0..) */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address (LBA) */
BYTE count /* Number of sectors to write (1..255) */
)
{
if(count==1)
{
SD_WriteBlock(sector*BLOCK_SIZE,(uint8_t *)buff,BLOCK_SIZE);
}
else
{
SD_WriteMultiBlocks(sector*BLOCK_SIZE,(uint8_t *)buff,BLOCK_SIZE,count);
}
return RES_OK;
}
#endif
DRESULT disk_ioctl (
BYTE drv, /* Physical drive nmuber (0..) */
BYTE ctrl, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
return RES_OK;
}
/*-----------------------------------------------------------------------*/
/* Get current time */
/*-----------------------------------------------------------------------*/
DWORD get_fattime(void)
{
return 0;
} |
|