X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/0f3b947bda5f34662a611272b9f12199e0da9aca..976db69ffa80c4d499e53f6f22c26d784fdac0a1:/fatfs/documents/doc/dioctl.html diff --git a/fatfs/documents/doc/dioctl.html b/fatfs/documents/doc/dioctl.html index 15b9c8a..b7ad0aa 100644 --- a/fatfs/documents/doc/dioctl.html +++ b/fatfs/documents/doc/dioctl.html @@ -57,35 +57,35 @@ DRESULT disk_ioctl ( - - - - - + + + + +
Standard ioctl command used by FatFs
CommandDescription
CTRL_SYNCMake sure that the device has finished pending write process. If the disk I/O module has a write back cache, the dirty buffers must be written back to the media immediately. Nothing to do for this command if each write operation to the media is completed within the disk_write function.
GET_SECTOR_COUNTReturns number of available sectors on the drive into the DWORD variable pointed by buff. This command is used by f_mkfs and f_fdisk function to determine the volume/partition size to be created. Required at FF_USE_MKFS == 1.
GET_SECTOR_SIZEReturns sector size of the device into the WORD variable pointed by buff. Valid return values for this command are 512, 1024, 2048 and 4096. This command is required only if FF_MAX_SS > FF_MIN_SS. When FF_MAX_SS == FF_MIN_SS, this command is never used and the device must work at that sector size.
GET_BLOCK_SIZEReturns erase block size of the flash memory media in unit of sector into the DWORD variable pointed by buff. The allowable value is 1 to 32768 in power of 2. Return 1 if the erase block size is unknown or non flash memory media. This command is used by only f_mkfs function and it attempts to align data area on the erase block boundary. Required at FF_USE_MKFS == 1.
CTRL_TRIMInforms the device the data on the block of sectors is no longer needed and it can be erased. The sector block is specified by a DWORD array {<start sector>, <end sector>} pointed by buff. This is an identical command to Trim of ATA device. Nothing to do for this command if this funcion is not supported or not a flash memory device. FatFs does not check the result code and the file function is not affected even if the sector block was not erased well. This command is called on remove a cluster chain and in the f_mkfs function. Required at FF_USE_TRIM == 1.
CTRL_SYNCMakes sure that the device has finished pending write process. If the disk I/O layer or storage device has a write-back cache, the dirty cache data must be committed to the medium immediately. Nothing to do for this command if each write operation to the medium is completed in the disk_write function.
GET_SECTOR_COUNTRetrieves number of available sectors, the largest allowable LBA + 1, on the drive into the LBA_t variable that pointed by buff. This command is used by f_mkfs and f_fdisk function to determine the size of volume/partition to be created.
GET_SECTOR_SIZERetrieves sector size, minimum data unit for generic read/write, into the WORD variable that pointed by buff. Valid sector sizes are 512, 1024, 2048 and 4096. This command is required only if FF_MAX_SS > FF_MIN_SS. When FF_MAX_SS == FF_MIN_SS, this command will never be used and the disk_read and disk_write function must work in FF_MAX_SS bytes/sector.
GET_BLOCK_SIZERetrieves erase block size in unit of sector of the flash memory media into the DWORD variable that pointed by buff. The allowable value is 1 to 32768 in power of 2. Return 1 if it is unknown or in non flash memory media. This command is used by f_mkfs function with block size not specified and it attempts to align the data area on the suggested block boundary. Note that FatFs does not have FTL (flash translation layer), so that either disk I/O layter or storage device must have an FTL in it.
CTRL_TRIMInforms the disk I/O layter or the storage device that the data on the block of sectors is no longer needed and it can be erased. The sector block is specified in an LBA_t array {<Start LBA>, <End LBA>} that pointed by buff. This is an identical command to Trim of ATA device. Nothing to do for this command if this funcion is not supported or not a flash memory device. FatFs does not check the result code and the file function is not affected even if the sector block was not erased well. This command is called on remove a cluster chain and in the f_mkfs function. It is required when FF_USE_TRIM == 1.
-

FatFs never uses any device dependent command nor user defined command. Following table shows an example of non-standard commands which may be useful for some applications.

+

FatFs will never use any device dependent command nor user defined command. Following table shows an example of non-standard commands which may be useful for some applications.

- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
Example of optional ioctl command
CommandDescription
CTRL_FORMATCreate a physical format on the media. If buff is not null, it is pointer to the call-back function for progress notification.
CTRL_POWER_IDLEPut the device idle state. STA_NOINIT in the current status flags may not be set if the device goes active state by generic read/write function.
CTRL_POWER_OFFPut the device off state. Shut-down the power to the device and deinitialize the device interface if needed. STA_NOINIT in the current status flags must be set. The device goes active state by disk_initialize function.
CTRL_LOCKLock media eject mechanism.
CTRL_UNLOCKUnlock media eject mechanism.
CTRL_EJECTEject media cartridge. STA_NOINIT and STA_NODISK in status flag are set after the function succeeded.
CTRL_GET_SMARTRead SMART information.
MMC_GET_TYPEGet card type. The type flags, bit0:MMCv3, bit1:SDv1, bit2:SDv2+ and bit3:LBA, is stored to a BYTE variable pointed by buff. (MMC/SDC specific command)
MMC_GET_CSDRead CSD register into a 16-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_CIDRead CID register into a 16-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_OCRRead OCR register into a 4-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_SDSTATRead SDSTATUS register into a 64-byte buffer pointed by buff. (SDC specific command)
ATA_GET_REVGet the revision string into a 16-byte buffer pointed by buff. (ATA/CFC specific command)
ATA_GET_MODELGet the model string into a 40-byte buffer pointed by buff. (ATA/CFC specific command)
ATA_GET_SNGet the serial number string into a 20-byte buffer pointed by buff. (ATA/CFC specific command)
ISDIO_READRead a block of iSDIO registers specified by command structure pointed by buff. (FlashAir specific command)
ISDIO_WRITEWrite a block of data to iSDIO registers specified by command structure pointed by buff. (FlashAir specific command)
ISDIO_MRITEChange bits in an iSDIO register specified by command structure pointed by buff. (FlashAir specific command)
CTRL_FORMATCreates a physical format on the media. If buff is not null, it is pointer to the call-back function for progress notification.
CTRL_POWER_IDLEPuts the device idle state. STA_NOINIT in the current status flags may not be set if the device goes active state by generic read/write function.
CTRL_POWER_OFFPuts the device off state. Shut-down the power to the device and deinitialize the device interface if needed. STA_NOINIT in the current status flags must be set. The device goes active state by disk_initialize function.
CTRL_LOCKLocks media eject mechanism.
CTRL_UNLOCKUnlocks media eject mechanism.
CTRL_EJECTEjects media cartridge. STA_NOINIT and STA_NODISK in status flag are set after the function succeeds.
CTRL_GET_SMARTReads SMART information.
MMC_GET_TYPEGets card type. The type flags, bit0:MMCv3, bit1:SDv1, bit2:SDv2+ and bit3:LBA, is stored to a BYTE variable pointed by buff. (MMC/SDC specific command)
MMC_GET_CSDReads CSD register and sets it into a 16-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_CIDReads CID register and sets it into a 16-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_OCRReads OCR register and sets it into a 4-byte buffer pointed by buff. (MMC/SDC specific command)
MMC_GET_SDSTATReads SDSTATUS register and sets it into a 64-byte buffer pointed by buff. (SDC specific command)
ATA_GET_REVReads the revision string and sets it into a 16-byte buffer pointed by buff. (ATA/CFC specific command)
ATA_GET_MODELReads the model string and sets it into a 40-byte buffer pointed by buff. (ATA/CFC specific command)
ATA_GET_SNReads the serial number string and sets it into a 20-byte buffer pointed by buff. (ATA/CFC specific command)
ISDIO_READReads a block of iSDIO registers specified by command structure pointed by buff. (FlashAir specific command)
ISDIO_WRITEWrites a block of data to iSDIO registers specified by command structure pointed by buff. (FlashAir specific command)
ISDIO_MRITEChanges bits in an iSDIO register specified by command structure pointed by buff. (FlashAir specific command)