X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/289f6a146c0b2087607d8d8659531ea90142779a..976db69ffa80c4d499e53f6f22c26d784fdac0a1:/fatfs/documents/doc/dread.html diff --git a/fatfs/documents/doc/dread.html b/fatfs/documents/doc/dread.html index 75b52c0..1be191b 100644 --- a/fatfs/documents/doc/dread.html +++ b/fatfs/documents/doc/dread.html @@ -13,12 +13,12 @@

disk_read

-

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

+

The disk_read function is called to read data from the storage device.

 DRESULT disk_read (
   BYTE pdrv,     /* [IN] Physical drive number */
   BYTE* buff,    /* [OUT] Pointer to the read data buffer */
-  DWORD sector,  /* [IN] Start sector number */
+  LBA_t sector,  /* [IN] Start sector number */
   UINT count     /* [IN] Number of sectros to read */
 );
 
@@ -32,7 +32,7 @@ DRESULT disk_read (
buff
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.
+
Start sector number in LBA. The data type LBA_t is an alias of DWORD or QWORD depends on the configuration option.
count
Number of sectors to read.
@@ -56,13 +56,14 @@ DRESULT disk_read (

Description

-

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.

+

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 generic read/write function must work at this sector size only. 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 after disk_initialize function succeeds.

+

There are some considerations about the memory addres passed via buff. It is not that always aligned with the word boundary, because the argument is defined as BYTE*. The unaligned transfer 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. If it is the case, there are some workarounds described below to avoid this issue.

+

Also the memory area may be out of reach in DMA. This is the case if it is located on the tightly coupled memory which is usually used for stack. Use double buffered transfer, or avoid to define file I/O buffer, FATFS and FIL structure as local variables where on the stack.

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