初级会员

- 积分
- 93
- 金钱
- 93
- 注册时间
- 2012-9-11
- 在线时间
- 6 小时
|
原子兄,我现在做的一个项目需要检测sd卡的剩余容量,但是用fatfs自带的 getfree不知道为什么不能获取容量,连总容量也不能获取。不知道哪里出了问题,我想咨询下,getfree除了
#define _FS_READONLY 0
#define _FS_MINIMIZE 0
设置为0外还有其他需要注意的吗?
DRESULT disk_ioctl (
BYTE drv, /* Physical drive nmuber (0..) */
BYTE ctrl, /* Control code */
void *buff /* Buffer to send/receive control data */
)
{
DRESULT res;
if(drv==SD_CARD)//SD卡
{
switch(ctrl)
{
case CTRL_SYNC:
SD_CS=0;
if(SD_WaitReady()==0)res = RES_OK;
else res = RES_ERROR;
SD_CS=1;
break;
case GET_SECTOR_SIZE:
*(WORD*)buff = 512;
res = RES_OK;
break;
case GET_BLOCK_SIZE:
*(WORD*)buff = 8;
res = RES_OK;
break;
case GET_SECTOR_COUNT:
*(DWORD*)buff = SD_GetSectorCount();
res = RES_OK;
break;
default:
res = RES_PARERR;
break;
}
}else if(drv==EX_FLASH) //外部FLASH
{
res = RES_OK;
}
}else res=RES_ERROR;//其他的不支持
return res;
}
已经解决,原来是我尚未f_mount... - -!
|
|