SdFat
Public Member Functions | List of all members
SdCardInterface Class Referenceabstract

Abstract interface for an SD card. More...

#include <SdCardInterface.h>

Inheritance diagram for SdCardInterface:
Inheritance graph
[legend]
Collaboration diagram for SdCardInterface:
Collaboration graph
[legend]

Public Member Functions

virtual bool erase (uint32_t firstSector, uint32_t lastSector)=0
 
virtual uint8_t errorCode () const =0
 
virtual uint32_t errorData () const =0
 
virtual bool isBusy ()=0
 
virtual bool readCID (cid_t *cid)=0
 
virtual bool readCSD (csd_t *csd)=0
 
virtual bool readOCR (uint32_t *ocr)=0
 
virtual bool readSector (uint32_t sector, uint8_t *dst)=0
 
virtual bool readSectors (uint32_t sector, uint8_t *dst, size_t ns)=0
 
virtual uint32_t sectorCount ()=0
 
virtual uint32_t status ()
 
virtual bool syncDevice ()=0
 
virtual uint8_t type () const =0
 
virtual bool writeData (const uint8_t *src)=0
 
virtual bool writeSector (uint32_t sector, const uint8_t *src)=0
 
virtual bool writeSectors (uint32_t sector, const uint8_t *src, size_t ns)=0
 
virtual bool writeStart (uint32_t sector)=0
 
virtual bool writeStop ()=0
 

Detailed Description

Abstract interface for an SD card.

Copyright (c) 2011-2019 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.

Member Function Documentation

◆ erase()

virtual bool SdCardInterface::erase ( uint32_t  firstSector,
uint32_t  lastSector 
)
pure virtual

Erase a range of sectors.

Parameters
[in]firstSectorThe address of the first sector in the range.
[in]lastSectorThe address of the last sector in the range.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ errorCode()

virtual uint8_t SdCardInterface::errorCode ( ) const
pure virtual
Returns
error code.

Implemented in SdioCard.

◆ errorData()

virtual uint32_t SdCardInterface::errorData ( ) const
pure virtual
Returns
error data.

Implemented in SdioCard.

◆ isBusy()

virtual bool SdCardInterface::isBusy ( )
pure virtual
Returns
true if card is busy.

Implemented in SdioCard.

◆ readCID()

virtual bool SdCardInterface::readCID ( cid_t cid)
pure virtual

Read a card's CID register.

Parameters
[out]cidpointer to area for returned data.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ readCSD()

virtual bool SdCardInterface::readCSD ( csd_t *  csd)
pure virtual

Read a card's CSD register.

Parameters
[out]csdpointer to area for returned data.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ readOCR()

virtual bool SdCardInterface::readOCR ( uint32_t *  ocr)
pure virtual

Read OCR register.

Parameters
[out]ocrValue of OCR register.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ readSector()

virtual bool BlockDeviceInterface::readSector ( uint32_t  sector,
uint8_t *  dst 
)
pure virtualinherited

Read a 512 byte sector.

Parameters
[in]sectorLogical sector to be read.
[out]dstPointer to the location that will receive the data.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ readSectors()

virtual bool BlockDeviceInterface::readSectors ( uint32_t  sector,
uint8_t *  dst,
size_t  ns 
)
pure virtualinherited

Read multiple 512 byte sectors.

Parameters
[in]sectorLogical sector to be read.
[in]nsNumber of sectors to be read.
[out]dstPointer to the location that will receive the data.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ sectorCount()

virtual uint32_t SdCardInterface::sectorCount ( )
pure virtual

Determine the size of an SD flash memory card.

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

Implements BlockDeviceInterface.

Implemented in SdioCard.

◆ status()

virtual uint32_t SdCardInterface::status ( )
inlinevirtual
Returns
card status.

Reimplemented in SdioCard.

◆ syncDevice()

virtual bool BlockDeviceInterface::syncDevice ( )
pure virtualinherited

End multi-sector transfer and go to idle state.

Returns
true for success or false for failure.

Implemented in SdioCard.

◆ type()

virtual uint8_t SdCardInterface::type ( ) const
pure virtual

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

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

Implemented in SdioCard.

◆ writeData()

virtual bool SdCardInterface::writeData ( const uint8_t *  src)
pure virtual

Write one data sector in a multiple sector write sequence.

Parameters
[in]srcPointer to the location of the data to be written.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ writeSector()

virtual bool BlockDeviceInterface::writeSector ( uint32_t  sector,
const uint8_t *  src 
)
pure virtualinherited

Writes a 512 byte sector.

Parameters
[in]sectorLogical sector to be written.
[in]srcPointer to the location of the data to be written.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ writeSectors()

virtual bool BlockDeviceInterface::writeSectors ( uint32_t  sector,
const uint8_t *  src,
size_t  ns 
)
pure virtualinherited

Write multiple 512 byte sectors.

Parameters
[in]sectorLogical sector to be written.
[in]nsNumber of sectors to be written.
[in]srcPointer to the location of the data to be written.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ writeStart()

virtual bool SdCardInterface::writeStart ( uint32_t  sector)
pure virtual

Start a write multiple sectors sequence.

Parameters
[in]sectorAddress of first sector in sequence.
Returns
true for success or false for failure.

Implemented in SdioCard.

◆ writeStop()

virtual bool SdCardInterface::writeStop ( )
pure virtual

End a write multiple sectors sequence.

Returns
true for success or false for failure.

Implemented in SdioCard.


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