SdFat

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
SdioCard Class Reference

Raw SDIO access to SD and SDHC flash memory cards. More...

`#include <SdioCard.h>`

Inheritance diagram for SdioCard:
[legend]
Collaboration diagram for SdioCard:
[legend]

## Public Member Functions
bool | begin ()
uint32_t | cardSize ()
bool | dmaBusy ()
bool | erase (uint32_t firstBlock, uint32_t lastBlock)
uint8_t | errorCode ()
uint32_t | errorData ()
uint32_t | errorLine ()
bool | readBlock (uint32_t lba, uint8_t *dst)
bool | readBlocks (uint32_t lba, uint8_t *dst, size_t nb)
bool | readCID (void *cid)
bool | readCSD (void *csd)
bool | readOCR (uint32_t *ocr)
bool | syncBlocks ()
uint8_t | type ()
bool | writeBlock (uint32_t lba, const uint8_t *src)
bool | writeBlocks (uint32_t lba, const uint8_t *src, size_t nb)

## Detailed Description

Raw SDIO access to SD and SDHC flash memory cards.

## Member Function Documentation

bool SdioCard::begin | ( |  | ) |

Initialize the SD card.

Returns
  true for success else false.

uint32_t SdioCard::cardSize | ( |  | ) |

Determine the size of an SD flash memory card.

Returns
  The number of 512 byte data blocks in the card or zero if an error occurs.

bool SdioCard::dmaBusy | ( |  | ) |

Returns
  DMA transfer status.

bool SdioCard::erase | ( | uint32_t | firstBlock,
|  | uint32_t | lastBlock
| ) |  |

Erase a range of blocks.

Parameters

  [in] | firstBlock | The address of the first block in the range.
  [in] | lastBlock | The address of the last block in the range.

Note
  This function requests the SD card to do a flash erase for a range of blocks. The data on the card after an erase operation is either 0 or 1, depends on the card vendor. The card must support single block erase.

Returns
  The value true is returned for success and the value false is returned for failure.

uint8_t SdioCard::errorCode | ( |  | ) |

Returns
  code for the last error. See SdInfo.h for a list of error codes.

uint32_t SdioCard::errorData | ( |  | ) |

Returns
  error data for last error.

uint32_t SdioCard::errorLine | ( |  | ) |

Returns
  error line for last error. Tmp function for debug.

bool SdioCard::readBlock | ( | uint32_t | lba,
|  | uint8_t * | dst
| ) |  |
| virtual

Read a 512 byte block from an SD card.

Parameters

  [in] | lba | Logical block to be read.
  [out] | dst | Pointer to the location that will receive the data.

Returns
  The value true is returned for success and the value false is returned for failure.

Implements BaseBlockDriver.

bool SdioCard::readBlocks | ( | uint32_t | lba,
|  | uint8_t * | dst,
|  | size_t | nb
| ) |  |
| virtual

Read multiple 512 byte blocks from an SD card.

Parameters

  [in] | lba | Logical block to be read.
  [in] | nb | Number of blocks to be read.
  [out] | dst | Pointer to the location that will receive the data.

Returns
  The value true is returned for success and the value false is returned for failure.

Implements BaseBlockDriver.

bool SdioCard::readCID | ( | void * | cid | ) |

Read a card's CID register. The CID contains card identification information such as Manufacturer ID, Product name, Product serial number and Manufacturing date.

Parameters

  [out] | cid | pointer to area for returned data.

Returns
  true for success or false for failure.

bool SdioCard::readCSD | ( | void * | csd | ) |

Read a card's CSD register. The CSD contains Card-Specific Data that provides information regarding access to the card's contents.

Parameters

  [out] | csd | pointer to area for returned data.

Returns
  true for success or false for failure.

bool SdioCard::readOCR | ( | uint32_t * | ocr | ) |

Read OCR register.

Parameters

  [out] | ocr | Value of OCR register.

Returns
  true for success else false.

bool SdioCard::syncBlocks | ( |  | ) |
| virtual

Returns
  success if sync successful. Not for user apps.

Implements BaseBlockDriver.

uint8_t SdioCard::type | ( |  | ) |

Return the card type: SD V1, SD V2 or SDHC

Returns
  0 - SD V1, 1 - SD V2, or 3 - SDHC.

bool SdioCard::writeBlock | ( | uint32_t | lba,
|  | const uint8_t * | src
| ) |  |
| virtual

Writes a 512 byte block to an SD card.

Parameters

  [in] | lba | Logical block to be written.
  [in] | src | Pointer to the location of the data to be written.

Returns
  The value true is returned for success and the value false is returned for failure.

Implements BaseBlockDriver.

bool SdioCard::writeBlocks | ( | uint32_t | lba,
|  | const uint8_t * | src,
|  | size_t | nb
| ) |  |
| virtual

Write multiple 512 byte blocks to an SD card.

Parameters

  [in] | lba | Logical block to be written.
  [in] | nb | Number of blocks to be written.
  [in] | src | Pointer to the location of the data to be written.

Returns
  The value true is returned for success and the value false is returned for failure.

Implements BaseBlockDriver.

The documentation for this class was generated from the following file:

- Arduino/libraries/SdFat/src/SdCard/SdioCard.h