X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/b4e3fab85fcd9f5b1502ec991c81302b910492d3:/fatfs/doc/en/dread.html..0f3b947bda5f34662a611272b9f12199e0da9aca:/fatfs/documents/doc/dread.html diff --git a/fatfs/doc/en/dread.html b/fatfs/documents/doc/dread.html similarity index 59% rename from fatfs/doc/en/dread.html rename to fatfs/documents/doc/dread.html index e7c2d7d..75b52c0 100644 --- a/fatfs/doc/en/dread.html +++ b/fatfs/documents/doc/dread.html @@ -1,7 +1,7 @@ - + @@ -13,7 +13,7 @@

disk_read

-

The disk_read function reads sector(s) from the storage device.

+

The disk_read function is called to read data from the sector(s) of storage device.

 DRESULT disk_read (
   BYTE pdrv,     /* [IN] Physical drive number */
@@ -30,7 +30,7 @@ DRESULT disk_read (
 
pdrv
Physical drive number to identify the target device.
buff
-
Pointer to the first item of the byte array to store read data.
+
Pointer to the first item of the byte array to store read data. Size of read data will be the sector size * count bytes.
sector
Start sector number in 32-bit LBA.
count
@@ -45,7 +45,7 @@ DRESULT disk_read (
RES_OK (0)
The function succeeded.
RES_ERROR
-
Any hard error occured during the read operation and could not recover it.
+
An unrecoverable hard error occured during the read operation.
RES_PARERR
Invalid parameter.
RES_NOTRDY
@@ -56,14 +56,14 @@ DRESULT disk_read (

Description

-

The data read/write operation to the storage devices is done in unit of sector. FatFs supports the sector size in range of from 512 to 4096 bytes. When FatFs is configured to fixed sector size (_MIN_SS == MAX_SS, this will be the most case), the read/write function must work at that sector size. When FatFs is configured to variable sector size (_MIN_SS != MAX_SS), sector size is inquired with disk_ioctl function following disk_initialize function.

+

Read/write operation to the generic storage devices, such as memory card, hadddisk and optical disk, is done in unit of block of data bytes called sector. FatFs supports the sector size in range of 512 to 4096 bytes. When FatFs is configured for fixed sector size (FF_MIN_SS == FF_MAX_SS, this is the most case), the read/write function must work at that sector size. When FatFs is configured for variable sector size (FF_MIN_SS < FF_MAX_SS), the sector size of medium is inquired with disk_ioctl function immediately following disk_initialize function succeeded.

The memory address specified by buff is not that always aligned to word boundary because the argument is defined as BYTE*. The unaligned read/write request can occure at direct transfer. If the bus architecture, especially DMA controller, does not allow unaligned memory access, it should be solved in this function. There are some workarounds described below to avoid this issue.

  • Convert word transfer to byte transfer in this function if needed. - Recommended.
  • -
  • On the f_read calls, avoid long read request that includes a whole of sector. - Any direct transfer never occures.
  • -
  • On the f_read calls, make sure that (((UINT)data & 3) == (f_tell(fp) & 3)) is true. - Word alignment of buff is guaranteed.
  • +
  • On the f_read() calls, avoid long read request that includes a whole of sector. - Any direct transfer never occures.
  • +
  • On the f_read(fp, dat, btw, bw) calls, make sure that (((UINT)dat & 3) == (f_tell(fp) & 3)) is true. - Word alignment of buff is guaranteed no matter dat is not word aligned.
-

Generally, a multiple sector transfer request must not be split into single sector transactions to the storage device, or you will not get good read throughput.

+

Generally, a multiple sector read request must not be split into single sector transactions to the storage device, or read throughput gets worse.