DRESULT disk_ioctl ( BYTE pdrv, /* Physical drive nmuber (0..) */ BYTE cmd, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { DRESULT res; int result; switch (pdrv) { case ATA : // Process of the command for the ATA drive result = ATA_disk_ioctl(cmd, buff); return res; case MMC : // Process of the command for the MMC/SD card return MMC_disk_ioctl(pdrv, cmd, buff); case USB : // Process of the command the USB drive result = USB_disk_ioctl(cmd, buff); return res; } return RES_PARERR; }
DRESULT disk_ioctl(BYTE drv, /* Physical drive number (0..) */ BYTE ctrl, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { DRESULT res; int result; (void) result; switch (drv) { case ATA: // pre-process here // result = ATA_disk_ioctl(ctrl, buff); res = RES_PARERR; // post-process here return res; case MMC: res = MMC_disk_ioctl(ctrl, buff); return res; case USB: #if ( WITH_USB_MS == 1 ) //The FatFs module uses only device independent commands described below. Any device dependent function is not used. //Command Description //CTRL_SYNC Make sure that the disk drive has finished pending write process. When the disk I/O module has a write back cache, flush the dirty sector immediately. This command is not required in read-only configuration. //GET_SECTOR_SIZE Returns sector size of the drive into the WORD variable pointed by Buffer. This command is not required in single sector size configuration, _MAX_SS is 512. //GET_SECTOR_COUNT Returns total sectors on the drive into the DWORD variable pointed by Buffer. This command is used by only f_mkfs function to determine the volume size to be created. //GET_BLOCK_SIZE Returns erase block size of the flash memory in unit of sector into the DWORD variable pointed by Buffer. This command is used by only f_mkfs function and it attempts to align data area to the erase block boundary. The allowable value is 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or disk devices. if (usb_status & STA_NOINIT) return RES_NOTRDY; res = RES_OK; switch(ctrl) { case CTRL_SYNC: // TODO break; case GET_SECTOR_SIZE: *(WORD*)buff = blkSize; break; case GET_SECTOR_COUNT: *(DWORD*)buff = numBlks; break; case GET_BLOCK_SIZE: *(DWORD*)buff = 1; break; default: res = RES_PARERR; break; } #else res = RES_PARERR; #endif return res; } return RES_PARERR; }
DRESULT disk_ioctl ( BYTE drv, /* Physical drive nmuber (0..) */ BYTE ctrl, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { if (drv == RAM) return RAM_disk_ioctl(ctrl, buff); if (drv == MMC) return MMC_disk_ioctl(ctrl, buff); return RES_PARERR; }
DRESULT disk_ioctl ( BYTE pdrv, /* Physical drive nmuber (0..) */ BYTE cmd, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { DRESULT res; int result; result = MMC_disk_ioctl(cmd, buff); return res; }
DRESULT disk_ioctl ( BYTE drv, /* Physical drive nmuber (0..) */ BYTE ctrl, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { DRESULT res; int result; switch (drv) { #ifdef PAKAI_ATA case ATA : // pre-process here result = ATA_disk_ioctl(ctrl, buff); // post-process here return res; #endif #ifdef PAKAI_MMC case MMC : // pre-process here result = MMC_disk_ioctl(ctrl, buff); // post-process here return res; #endif #ifdef PAKAI_USB_STORAGE case USB : // pre-process here result = USB_disk_ioctl(ctrl, buff); // post-process here return res; #endif case SDC : return res; case ROM : return res; } return RES_PARERR; }
DRESULT disk_ioctl ( BYTE drv, /* Physical drive nmuber (0..) */ BYTE ctrl, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { DRESULT result; switch (drv) { case ATA :result = ATA_disk_ioctl(ctrl, buff);return result; case MMC :result = MMC_disk_ioctl(ctrl, buff);return result; case USB :result = USB_disk_ioctl(ctrl, buff);return result; } return RES_PARERR; }
DRESULT disk_ioctl( BYTE pdrv, /* Physical drive nmuber (0..) */ BYTE cmd, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { int result; // pre-process here MMC_get_volume_info(); result = MMC_disk_ioctl(cmd, buff); // if (result) SpiStringWrite("\r\n disk_ioctl "); // post-process here return result; }
DRESULT disk_ioctl ( BYTE pdrv, /* Physical drive nmuber (0..) */ BYTE cmd, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { #ifndef CONFIG_ALLWINNER DRESULT res; int result; switch (pdrv) { case ATA : // pre-process here result = ATA_disk_ioctl(cmd, buff); // post-process here return res; case MMC : // pre-process here result = MMC_disk_ioctl(cmd, buff); // post-process here return res; case USB : // pre-process here result = USB_disk_ioctl(cmd, buff); // post-process here return res; } return RES_PARERR; #else 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 */ ) { DRESULT res = 0; int result; result = MMC_disk_ioctl(ctrl, buff); // post-process here res = RES_OK; return res; //return RES_PARERR; }
DRESULT disk_ioctl ( BYTE drv, /* Physical drive nmuber (0..) */ BYTE ctrl, /* Control code */ void *buff /* Buffer to send/receive control data */ ) { DRESULT res; switch (drv) { case ATA : // pre-process here //result = ATA_disk_ioctl(ctrl, buff); // post-process here return res; case MMC : // pre-process here //result = MMC_disk_ioctl(ctrl, buff); res = MMC_disk_ioctl ( 0, /* Physical drive number (0) */ ctrl, /* Control code */ buff /* Buffer to send/receive control data */ ); // post-process here return res; case USB : // pre-process here res = USB_disk_ioctl(ctrl, buff); // post-process here return res; } return RES_PARERR; }