distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::devices::SdMmcCardLowLevel Class Referenceabstract

#include "distortos/devices/memory/SdMmcCardLowLevel.hpp"

Classes

struct  ReadTransfer
 read transfer associated with transaction More...
 
class  Response
 command response More...
 
class  Transfer
 transfer associated with transaction More...
 
struct  WriteTransfer
 write transfer associated with transaction More...
 

Public Types

enum  BusMode : uint8_t { BusMode::_1Bit, BusMode::_4Bit, BusMode::_8Bit }
 bus mode More...
 

Public Member Functions

virtual ~SdMmcCardLowLevel ()=default
 SdMmcCardLowLevel's destructor. More...
 
virtual void configure (BusMode busMode, uint32_t clockFrequency)=0
 Configures parameters of low-level SD/MMC card driver. More...
 
virtual int start ()=0
 Starts low-level SD/MMC card driver. More...
 
virtual void startTransaction (SdMmcCardBase &sdMmcCardBase, uint8_t command, uint32_t argument, Response response, Transfer transfer)=0
 Starts asynchronous transaction. More...
 
virtual void stop ()=0
 Stops low-level SD/MMC card driver. More...
 

Static Public Attributes

static constexpr uint8_t maxCommand {(1 << 6) - 1}
 maximum allowed command More...
 

Detailed Description

SdMmcCardLowLevel class is an interface for low-level SD/MMC card driver.

Member Enumeration Documentation

◆ BusMode

bus mode

Enumerator
_1Bit 

1-bit bus mode

_4Bit 

4-bit bus mode

_8Bit 

8-bit bus mode

Constructor & Destructor Documentation

◆ ~SdMmcCardLowLevel()

virtual distortos::devices::SdMmcCardLowLevel::~SdMmcCardLowLevel ( )
virtualdefault

SdMmcCardLowLevel's destructor.

Precondition
Driver is stopped.

Member Function Documentation

◆ configure()

virtual void distortos::devices::SdMmcCardLowLevel::configure ( BusMode  busMode,
uint32_t  clockFrequency 
)
pure virtual

Configures parameters of low-level SD/MMC card driver.

Precondition
Driver is started.
No transaction is in progress.
clockFrequency is valid.
Parameters
[in]busModeis the desired bus mode
[in]clockFrequencyis the desired clock frequency, Hz, must be greater than or equal to 400 kHz
Here is the caller graph for this function:

◆ start()

virtual int distortos::devices::SdMmcCardLowLevel::start ( )
pure virtual

Starts low-level SD/MMC card driver.

Precondition
Driver is stopped.
Returns
0 on success, error code otherwise
Here is the caller graph for this function:

◆ startTransaction()

virtual void distortos::devices::SdMmcCardLowLevel::startTransaction ( SdMmcCardBase sdMmcCardBase,
uint8_t  command,
uint32_t  argument,
Response  response,
Transfer  transfer 
)
pure virtual

Starts asynchronous transaction.

This function returns immediately. When the transaction is physically finished (either command, its argument, response and associated transfer were sent/received or an error was detected), SdMmcCardBase::transactionCompleteEvent() will be executed.

Precondition
Driver is started.
No transaction is in progress.
command is valid.
When there is an associated transfer:
  • either short or long response is expected;
  • transfer's read buffer (for read transfers) or write buffer (for write transfers) is valid and its address is aligned to DISTORTOS_SDMMCCARD_BUFFER_ALIGNMENT;
  • transfer's block size is a power of two, greater than or equal to 4 and less than or equal to 2^14;
  • transfer's size is an integer multiple of block size and less than or equal to 2^25 - 1;
  • transfer's timeout converted to clock cycles must be less than or equal to 2^32 - 1;
Postcondition
Transaction is in progress.
Parameters
[in]sdMmcCardBaseis a reference to SdMmcCardBase object that will be notified about completed transaction
[in]commandis the command associated with the transaction, [0; maxCommand]
[in]argumentis the argument for command
[out]responseis the buffer into which the command response will be read, it's size determines what type of response is expected (none, short or long)
[in,out]transferis the transfer associated with transaction
Here is the caller graph for this function:

◆ stop()

virtual void distortos::devices::SdMmcCardLowLevel::stop ( )
pure virtual

Stops low-level SD/MMC card driver.

Precondition
Driver is started.
No transaction is in progress.
Postcondition
Driver is stopped.
Here is the caller graph for this function:

Member Data Documentation

◆ maxCommand

constexpr uint8_t distortos::devices::SdMmcCardLowLevel::maxCommand {(1 << 6) - 1}
static

maximum allowed command


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