disk_readp

The disk_readp function reads a partial sector of the device.

DRESULT disk_readp (
  BYTE* buff,    /* [OUT] Pointer to the read buffer */
  DWORD sector,  /* [IN]  Sector number to read */
  UINT offset,   /* [IN]  Byte offset in the sector to start to read */
  UINT count     /* [IN]  Number of bytes to read */
);

Parameters

buff
Pointer to the buffer to store the read data. If a null pointer is given, read data bytes are to be forwarded to the outgoing stream instead of the memory. How the streamimg data is dealed depends on each project.
sector
Specifies the sector number to be read in logical block address (LBA).
offset
Specifies the byte offset in the sector to start to read. The value can be 0 to 511.
count
Specifies number of bytes to read. The value can be 0 to 512 and offset + count must not exceed 512.

Return Value

RES_OK (0)
The function succeeded.
RES_ERROR
A hard error occured during the disk read operation and could not recover it.
RES_PARERR
Invalid parameter.
RES_NOTRDY
The device has not been initialized.

Return