Arduino-FatFs
Arduino-FatFs copied to clipboard
disk_ioctl not actually implemented?
Currently, the disk_ioctl() function is
DRESULT disk_ioctl( BYTE pdrv, // Physical drive nmuber (0..)
BYTE cmd, // Control code
void *buff ) // Buffer to send/receive control data
{
return sd_disk_ioctl( cmd );
}
While sd_disk_ioctl()seems to be actually "broken" (no return, no cmd handling, ...)
extern "C" int sd_disk_ioctl( uint8_t cmd )
{
DRESULT res = RES_ERROR;
switch( cmd )
{
case CTRL_SYNC : // Make sure that data has been written
res = RES_OK;
// res = spiRec() == 0XFF ? RES_OK : RES_NOTRDY ;
// res = card.waitNotBusy( SD_WRITE_TIMEOUT ) ? RES_OK : RES_NOTRDY ;
break;
default:
res = RES_PARERR;
}
}
So this function actually does not work. Is it expected?
Hi Alessandro Yes, without a doubt, we should add “return res;" at the end of the sd_disk_ioctl () function. And modify the first line, too
extern "C" DRESULT sd_disk_ioctl( uint8_t cmd )
{
DRESULT res = RES_ERROR;
switch( cmd )
{
case CTRL_SYNC : // Make sure that data has been written
res = RES_OK;
// res = spiRec() == 0XFF ? RES_OK : RES_NOTRDY ;
// res = card.waitNotBusy( SD_WRITE_TIMEOUT ) ? RES_OK : RES_NOTRDY ;
break;
default:
res = RES_PARERR;
}
return res;
}
Currently I don't have time to check, especially the consequences when the cmd parameter is different from CTRL_SYNC