SdFat
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TeensySdioCard Class Reference

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

#include <TeensySdioCard.h>

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

Public Member Functions

bool begin (TeensySdioConfig config)
 
bool cardCMD6 (uint32_t arg, uint8_t *status) final
 
void end () final
 
bool erase (Sector_t firstSector, Sector_t lastSector) final
 
uint8_t errorCode () const final
 
uint32_t errorData () const final
 
uint32_t errorLine () const
 
virtual bool hasDedicatedSpi ()
 
bool isBusy () final
 
virtual bool isDedicatedSpi ()
 
virtual bool isSpi ()
 
uint32_t kHzSdClk ()
 
bool readCID (cid_t *cid) final
 
bool readCSD (csd_t *csd) final
 
bool readData (uint8_t *dst)
 
bool readOCR (uint32_t *ocr) final
 
bool readSCR (scr_t *scr) final
 
bool readSDS (sds_t *sds) final
 
bool readSector (Sector_t sector, uint8_t *dst) final
 
bool readSectors (Sector_t sector, uint8_t *dst, size_t ns) final
 
bool readStart (Sector_t sector)
 
bool readStop ()
 
Sector_t sectorCount () final
 
virtual bool setDedicatedSpi (bool value)
 
uint32_t status () final
 
bool stopTransmission (bool blocking)
 
bool syncDevice () final
 
uint8_t type () const final
 
bool writeData (const uint8_t *src)
 
bool writeSector (Sector_t sector, const uint8_t *src) final
 
bool writeSectors (Sector_t sector, const uint8_t *src, size_t ns) final
 
bool writeStart (Sector_t sector)
 
bool writeStop ()
 

Detailed Description

Raw SDIO access to SD and SDHC flash memory cards.

Member Function Documentation

◆ begin()

bool TeensySdioCard::begin ( TeensySdioConfig config)

Initialize the SD card.

Parameters
[in]configSDIO card configuration.
Returns
true for success or false for failure.

◆ cardCMD6()

bool TeensySdioCard::cardCMD6 ( uint32_t arg,
uint8_t * status )
finalvirtual

CMD6 Switch mode: Check Function Set Function.

Parameters
[in]argCMD6 argument.
[out]statusreturn status data.
Returns
true for success or false for failure.

Implements SdCardInterface.

◆ end()

void TeensySdioCard::end ( )
finalvirtual

Disable an SDIO card. not implemented.

Reimplemented from FsBlockDeviceInterface.

◆ erase()

bool TeensySdioCard::erase ( Sector_t firstSector,
Sector_t lastSector )
finalvirtual

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.
Note
This function requests the SD card to do a flash erase for a range of sectors. The data on the card after an erase operation is either 0 or 1, depends on the card vendor. The card must support single sector erase.
Returns
true for success or false for failure.

Implements SdCardInterface.

◆ errorCode()

uint8_t TeensySdioCard::errorCode ( ) const
finalvirtual
Returns
code for the last error. See SdCardInfo.h for a list of error codes.

Implements SdCardInterface.

◆ errorData()

uint32_t TeensySdioCard::errorData ( ) const
finalvirtual
Returns
error data for last error.

Implements SdCardInterface.

◆ errorLine()

uint32_t TeensySdioCard::errorLine ( ) const
Returns
error line for last error. Tmp function for debug.

◆ hasDedicatedSpi()

virtual bool SdCardInterface::hasDedicatedSpi ( )
inlinevirtualinherited
Returns
false by default

◆ isBusy()

bool TeensySdioCard::isBusy ( )
finalvirtual

Check for busy with CMD13.

Returns
true if busy else false.

Implements FsBlockDeviceInterface.

◆ isDedicatedSpi()

virtual bool SdCardInterface::isDedicatedSpi ( )
inlinevirtualinherited
Returns
false by default

◆ isSpi()

virtual bool SdCardInterface::isSpi ( )
inlinevirtualinherited
Returns
false by default

◆ kHzSdClk()

uint32_t TeensySdioCard::kHzSdClk ( )
Returns
the SD clock frequency in kHz.

◆ readCID()

bool TeensySdioCard::readCID ( cid_t * cid)
finalvirtual

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]cidpointer to area for returned data.
Returns
true for success or false for failure.

Implements SdCardInterface.

◆ readCSD()

bool TeensySdioCard::readCSD ( csd_t * csd)
finalvirtual

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

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

Implements SdCardInterface.

◆ readData()

bool TeensySdioCard::readData ( uint8_t * dst)

Read one data sector in a multiple sector read sequence

Parameters
[out]dstPointer to the location for the data to be read.
Returns
true for success or false for failure.

◆ readOCR()

bool TeensySdioCard::readOCR ( uint32_t * ocr)
finalvirtual

Read OCR register.

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

Implements SdCardInterface.

◆ readSCR()

bool TeensySdioCard::readSCR ( scr_t * scr)
finalvirtual

Read SCR register.

Parameters
[out]scrValue of SCR register.
Returns
true for success or false for failure.

Implements SdCardInterface.

◆ readSDS()

bool TeensySdioCard::readSDS ( sds_t * sds)
finalvirtual

Return the 64 byte SD Status register.

Parameters
[out]sdslocation for 64 status bytes.
Returns
true for success or false for failure.

Implements SdCardInterface.

◆ readSector()

bool TeensySdioCard::readSector ( Sector_t sector,
uint8_t * dst )
finalvirtual

Read a 512 byte sector from an SD card.

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.

Implements FsBlockDeviceInterface.

◆ readSectors()

bool TeensySdioCard::readSectors ( Sector_t sector,
uint8_t * dst,
size_t ns )
finalvirtual

Read multiple 512 byte sectors from an SD card.

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.

Implements FsBlockDeviceInterface.

◆ readStart()

bool TeensySdioCard::readStart ( Sector_t sector)

Start a read multiple sectors sequence.

Parameters
[in]sectorAddress of first sector in sequence.
Note
This function is used with readData() and readStop() for optimized multiple sector reads.
Returns
true for success or false for failure.

◆ readStop()

bool TeensySdioCard::readStop ( )

End a read multiple sectors sequence.

Returns
true for success or false for failure.

◆ sectorCount()

Sector_t TeensySdioCard::sectorCount ( )
finalvirtual

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 FsBlockDeviceInterface.

◆ setDedicatedSpi()

virtual bool SdCardInterface::setDedicatedSpi ( bool value)
inlinevirtualinherited

Set SPI sharing state

Parameters
[in]valuedesired state.
Returns
false by default.

◆ status()

uint32_t TeensySdioCard::status ( )
finalvirtual
Returns
SDIO card status.

Reimplemented from SdCardInterface.

◆ stopTransmission()

bool TeensySdioCard::stopTransmission ( bool blocking)

Send CMD12 to stop read or write.

Parameters
[in]blockingIf true, wait for command complete.
Returns
true for success or false for failure.

◆ syncDevice()

bool TeensySdioCard::syncDevice ( )
finalvirtual
Returns
success if sync successful. Not for user apps.

Implements FsBlockDeviceInterface.

◆ type()

uint8_t TeensySdioCard::type ( ) const
finalvirtual

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

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

Implements SdCardInterface.

◆ writeData()

bool TeensySdioCard::writeData ( const uint8_t * src)

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.

◆ writeSector()

bool TeensySdioCard::writeSector ( Sector_t sector,
const uint8_t * src )
finalvirtual

Writes a 512 byte sector to an SD card.

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.

Implements FsBlockDeviceInterface.

◆ writeSectors()

bool TeensySdioCard::writeSectors ( Sector_t sector,
const uint8_t * src,
size_t ns )
finalvirtual

Write multiple 512 byte sectors to an SD card.

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.

Implements FsBlockDeviceInterface.

◆ writeStart()

bool TeensySdioCard::writeStart ( Sector_t sector)

Start a write multiple sectors sequence.

Parameters
[in]sectorAddress of first sector in sequence.
Note
This function is used with writeData() and writeStop() for optimized multiple sector writes.
Returns
true for success or false for failure.

◆ writeStop()

bool TeensySdioCard::writeStop ( )

End a write multiple sectors sequence.

Returns
true for success or false for failure.

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