C
BYTE MDD_SDSPI_SectorRead( DWORD sector_addr, BYTE* buffer );
Description
The MDD_SDSPI_SectorRead function reads a sector of data bytes (512 bytes) of data from the SD card starting at the sector address and stores them in the location pointed to by 'buffer.'
Preconditions
The MDD_SectorRead function pointer must be pointing towards this function.
Parameters
Parameters |
Description |
sector_addr |
The address of the sector on the card. |
buffer |
The buffer where the retrieved data will be stored. If buffer is NULL, do not store the data anywhere. |
Return Values
Return Values |
Description |
TRUE |
The sector was read successfully |
FALSE |
The sector could not be read |
Side Effects
None
Remarks
The card expects the address field in the command packet to be a byte address. The sector_addr value is converted to a byte address by shifting it left nine times (multiplying by 512).
This function performs a synchronous read operation. In other words, this function is a blocking function, and will not return until either the data has fully been read, or, a timeout or other error occurred.