SdFat
|
Raw SDIO access to SD and SDHC flash memory cards. More...
#include <SdioCard.h>
Public Member Functions | |
bool | begin () |
uint32_t | cardSize () |
bool | erase (uint32_t firstBlock, uint32_t lastBlock) |
uint8_t | errorCode () |
uint32_t | errorData () |
uint32_t | errorLine () |
bool | isBusy () |
uint32_t | kHzSdClk () |
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 | readData (uint8_t *dst) |
bool | readOCR (uint32_t *ocr) |
bool | readStart (uint32_t lba) |
bool | readStart (uint32_t lba, uint32_t count) |
bool | readStop () |
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) |
bool | writeData (const uint8_t *src) |
bool | writeStart (uint32_t lba) |
bool | writeStart (uint32_t lba, uint32_t count) |
bool | writeStop () |
Raw SDIO access to SD and SDHC flash memory cards.
Copyright (c) 2011-2018 Bill Greiman This file is part of the SdFat library for SD memory cards.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
bool SdioCard::begin | ( | ) |
Initialize the SD card.
uint32_t SdioCard::cardSize | ( | ) |
Determine the size of an SD flash memory card.
bool SdioCard::erase | ( | uint32_t | firstBlock, |
uint32_t | lastBlock | ||
) |
Erase a range of blocks.
[in] | firstBlock | The address of the first block in the range. |
[in] | lastBlock | The address of the last block in the range. |
uint8_t SdioCard::errorCode | ( | ) |
uint32_t SdioCard::errorData | ( | ) |
uint32_t SdioCard::errorLine | ( | ) |
bool SdioCard::isBusy | ( | ) |
Check for busy with CMD13.
uint32_t SdioCard::kHzSdClk | ( | ) |
|
virtual |
Read a 512 byte block from an SD card.
[in] | lba | Logical block to be read. |
[out] | dst | Pointer to the location that will receive the data. |
Implements BaseBlockDriver.
Reimplemented in SdioCardEX.
|
virtual |
Read multiple 512 byte blocks from an SD card.
[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. |
Implements BaseBlockDriver.
Reimplemented in SdioCardEX.
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.
[out] | cid | pointer to area for returned data. |
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.
[out] | csd | pointer to area for returned data. |
bool SdioCard::readData | ( | uint8_t * | dst | ) |
Read one data block in a multiple block read sequence
[out] | dst | Pointer to the location for the data to be read. |
bool SdioCard::readOCR | ( | uint32_t * | ocr | ) |
Read OCR register.
[out] | ocr | Value of OCR register. |
bool SdioCard::readStart | ( | uint32_t | lba | ) |
Start a read multiple blocks sequence.
[in] | lba | Address of first block in sequence. |
bool SdioCard::readStart | ( | uint32_t | lba, |
uint32_t | count | ||
) |
Start a read multiple blocks sequence.
[in] | lba | Address of first block in sequence. |
[in] | count | Maximum block count. |
bool SdioCard::readStop | ( | ) |
End a read multiple blocks sequence.
|
virtual |
Implements BaseBlockDriver.
Reimplemented in SdioCardEX.
uint8_t SdioCard::type | ( | ) |
Return the card type: SD V1, SD V2 or SDHC
|
virtual |
Writes a 512 byte block to an SD card.
[in] | lba | Logical block to be written. |
[in] | src | Pointer to the location of the data to be written. |
Implements BaseBlockDriver.
Reimplemented in SdioCardEX.
|
virtual |
Write multiple 512 byte blocks to an SD card.
[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. |
Implements BaseBlockDriver.
Reimplemented in SdioCardEX.
bool SdioCard::writeData | ( | const uint8_t * | src | ) |
Write one data block in a multiple block write sequence.
[in] | src | Pointer to the location of the data to be written. |
bool SdioCard::writeStart | ( | uint32_t | lba | ) |
Start a write multiple blocks sequence.
[in] | lba | Address of first block in sequence. |
bool SdioCard::writeStart | ( | uint32_t | lba, |
uint32_t | count | ||
) |
Start a write multiple blocks sequence.
[in] | lba | Address of first block in sequence. |
[in] | count | Maximum block count. |
bool SdioCard::writeStop | ( | ) |
End a write multiple blocks sequence.