distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::devices::SynchronousSdMmcCardLowLevel Class Reference

SynchronousSdMmcCardLowLevel is a synchronous wrapper for SdMmcCardLowLevel which implements SdMmcCardBase interface. More...

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

Inheritance diagram for distortos::devices::SynchronousSdMmcCardLowLevel:
[legend]
Collaboration diagram for distortos::devices::SynchronousSdMmcCardLowLevel:
[legend]

Public Member Functions

constexpr SynchronousSdMmcCardLowLevel (SdMmcCardLowLevel &sdMmcCard)
 SynchronousSdMmcCardLowLevel's constructor. More...
 
void configure (const SdMmcCardLowLevel::BusMode busMode, const uint32_t clockFrequency) const
 Configures parameters of low-level SD/MMC card driver. More...
 
Result executeTransaction (const uint8_t command, const uint32_t argument, const SdMmcCardLowLevel::Response response, const SdMmcCardLowLevel::Transfer transfer)
 Executes transaction. More...
 
int start () const
 Starts low-level SD/MMC card driver. More...
 
void stop () const
 Stops low-level SD/MMC card driver. More...
 

Private Member Functions

void transactionCompleteEvent (Result result) override
 "Transaction complete" event More...
 
- Private Member Functions inherited from distortos::devices::SdMmcCardBase
virtual ~SdMmcCardBase ()=default
 SdMmcCardBase's destructor. More...
 

Private Attributes

Semaphore semaphore_
 semaphore used to notify waiting thread about completion of transaction More...
 
SdMmcCardLowLevelsdMmcCard_
 reference to asynchronous low-level implementation of SdMmcCardLowLevel interface More...
 
Result result_
 result of transaction passed to transactionCompleteEvent() More...
 

Additional Inherited Members

- Private Types inherited from distortos::devices::SdMmcCardBase
enum  Result : uint8_t {
  Result::success, Result::responseTimeout, Result::responseCrcMismatch, Result::dataTimeout,
  Result::dataCrcMismatch, Result::transmitUnderrun, Result::receiveOverrun
}
 result of transaction More...
 

Detailed Description

SynchronousSdMmcCardLowLevel is a synchronous wrapper for SdMmcCardLowLevel which implements SdMmcCardBase interface.

Constructor & Destructor Documentation

◆ SynchronousSdMmcCardLowLevel()

constexpr distortos::devices::SynchronousSdMmcCardLowLevel::SynchronousSdMmcCardLowLevel ( SdMmcCardLowLevel sdMmcCard)
inlineexplicit

SynchronousSdMmcCardLowLevel's constructor.

Parameters
[in]sdMmcCardis a reference to asynchronous low-level implementation of SdMmcCardLowLevel interface

Member Function Documentation

◆ configure()

void distortos::devices::SynchronousSdMmcCardLowLevel::configure ( const SdMmcCardLowLevel::BusMode  busMode,
const uint32_t  clockFrequency 
) const
inline

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 call graph for this function:
Here is the caller graph for this function:

◆ executeTransaction()

Result distortos::devices::SynchronousSdMmcCardLowLevel::executeTransaction ( const uint8_t  command,
const uint32_t  argument,
const SdMmcCardLowLevel::Response  response,
const SdMmcCardLowLevel::Transfer  transfer 
)
inline

Executes transaction.

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
No transaction is in progress.
Parameters
[in]commandis the command associated with the transaction, [0; SdMmcCardLowLevel::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
Returns
result of transaction
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

int distortos::devices::SynchronousSdMmcCardLowLevel::start ( ) const
inline

Starts low-level SD/MMC card driver.

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

◆ stop()

void distortos::devices::SynchronousSdMmcCardLowLevel::stop ( ) const
inline

Stops low-level SD/MMC card driver.

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

◆ transactionCompleteEvent()

void distortos::devices::SynchronousSdMmcCardLowLevel::transactionCompleteEvent ( Result  result)
overrideprivatevirtual

"Transaction complete" event

Called by low-level SD/MMC card driver when the transaction is physically finished.

Parameters
[in]resultis the result of transaction

Implements distortos::devices::SdMmcCardBase.

Here is the call graph for this function:

Member Data Documentation

◆ result_

Result distortos::devices::SynchronousSdMmcCardLowLevel::result_
private

result of transaction passed to transactionCompleteEvent()

◆ sdMmcCard_

SdMmcCardLowLevel& distortos::devices::SynchronousSdMmcCardLowLevel::sdMmcCard_
private

reference to asynchronous low-level implementation of SdMmcCardLowLevel interface

◆ semaphore_

Semaphore distortos::devices::SynchronousSdMmcCardLowLevel::semaphore_
private

semaphore used to notify waiting thread about completion of transaction


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