distortos
v0.7.0
object-oriented C++ RTOS for microcontrollers
|
Classes | |
struct | Csd |
CSD. More... | |
struct | CsdV1 |
fields unique to CSD version 1.0 More... | |
struct | CsdV2 |
fields unique to CSD version 2.0 More... | |
struct | R2Response |
R2 response. More... | |
struct | R3Response |
R3 response. More... | |
struct | R7Response |
R7 response. More... | |
struct | SdStatus |
SD Status. More... | |
class | SelectGuard |
select guard for SD card connected via SPI More... | |
Typedefs | |
using | Uint8Range = estd::ContiguousRange< uint8_t > |
range of uint8_t elements More... | |
using | ConstUint8Range = estd::ContiguousRange< const uint8_t > |
range of const uint8_t elements More... | |
Functions | |
uint32_t | extractBits (const ConstUint8Range range, const size_t index, const size_t size) |
Extracts up to 32 bits from data range. More... | |
Csd | decodeCsd (const std::array< uint8_t, 16 > &buffer) |
Decodes raw data into CSD. More... | |
SdStatus | decodeSdStatus (const std::array< uint8_t, 64 > &buffer) |
Decodes raw data into SD Status. More... | |
template<typename Functor > | |
std::pair< int, uint8_t > | waitWhile (const SpiMasterHandle &spiMasterHandle, const distortos::TickClock::duration duration, Functor functor) |
Waits while byte received via SPI satisfies predicate. More... | |
int | waitWhileBusy (const SpiMasterHandle &spiMasterHandle, const distortos::TickClock::duration duration) |
Waits while SD card connected via SPI is busy. More... | |
int | readDataBlock (const SpiMasterHandle &spiMasterHandle, void *const buffer, const size_t size, const distortos::TickClock::duration duration) |
Reads data block from SD card connected via SPI. More... | |
int | writeDataBlock (const SpiMasterHandle &spiMasterHandle, const uint8_t token, const void *const buffer, const size_t size, const distortos::TickClock::duration duration) |
Writes data block to SD card connected via SPI. More... | |
int | readResponse (const SpiMasterHandle &spiMasterHandle, const Uint8Range buffer) |
Reads response from SD card connected via SPI. More... | |
std::pair< int, uint8_t > | readR1 (const SpiMasterHandle &spiMasterHandle) |
Reads R1 response from SD card connected via SPI. More... | |
std::pair< int, R2Response > | readR2 (const SpiMasterHandle &spiMasterHandle) |
Reads R2 response from SD card connected via SPI. More... | |
std::pair< int, R3Response > | readR3 (const SpiMasterHandle &spiMasterHandle) |
Reads R3 response from SD card connected via SPI. More... | |
std::pair< int, R7Response > | readR7 (const SpiMasterHandle &spiMasterHandle) |
Reads R7 response from SD card connected via SPI. More... | |
int | writeCmd (const SpiMasterHandle &spiMasterHandle, const uint8_t command, const uint32_t argument={}, const uint8_t crc7={}, const bool stuffByte={}) |
Writes regular (CMD) command to SD card connected via SPI. More... | |
std::pair< int, uint8_t > | writeCmdReadR1 (const SpiMasterHandle &spiMasterHandle, const uint8_t command, const uint32_t argument={}, const uint8_t crc7={}, const bool stuffByte={}) |
Writes regular (CMD) command and reads R1 response to/from SD card connected via SPI. More... | |
std::pair< int, R3Response > | writeCmdReadR3 (const SpiMasterHandle &spiMasterHandle, const uint8_t command, const uint32_t argument={}, const uint8_t crc7={}, const bool stuffByte={}) |
Writes regular (CMD) command and reads R3 response to/from SD card connected via SPI. More... | |
std::pair< int, R7Response > | writeCmdReadR7 (const SpiMasterHandle &spiMasterHandle, const uint8_t command, const uint32_t argument={}, const uint8_t crc7={}, const bool stuffByte={}) |
Writes regular (CMD) command and reads R7 response to/from SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd0 (const SpiMasterHandle &spiMasterHandle) |
Executes CMD0 command on SD card connected via SPI. More... | |
std::tuple< int, uint8_t, bool > | executeCmd8 (const SpiMasterHandle &spiMasterHandle) |
Executes CMD8 command on SD card connected via SPI. More... | |
std::tuple< int, uint8_t, std::array< uint8_t, 16 > > | executeCmd9 (const SpiMasterHandle &spiMasterHandle) |
Executes CMD9 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd12 (const SpiMasterHandle &spiMasterHandle, const distortos::TickClock::duration duration) |
Executes CMD12 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd16 (const SpiMasterHandle &spiMasterHandle, const uint32_t blockLength) |
Executes CMD16 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd17 (const SpiMasterHandle &spiMasterHandle, const uint32_t address) |
Executes CMD17 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd18 (const SpiMasterHandle &spiMasterHandle, const uint32_t address) |
Executes CMD18 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd24 (const SpiMasterHandle &spiMasterHandle, const uint32_t address) |
Executes CMD24 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd25 (const SpiMasterHandle &spiMasterHandle, const uint32_t address) |
Executes CMD25 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd32 (const SpiMasterHandle &spiMasterHandle, const uint32_t address) |
Executes CMD32 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd33 (const SpiMasterHandle &spiMasterHandle, const uint32_t address) |
Executes CMD33 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd38 (const SpiMasterHandle &spiMasterHandle, const distortos::TickClock::duration duration) |
Executes CMD38 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeCmd55 (const SpiMasterHandle &spiMasterHandle) |
Executes CMD55 command on SD card connected via SPI. More... | |
std::pair< int, R3Response > | executeCmd58 (const SpiMasterHandle &spiMasterHandle) |
Executes CMD58 command on SD card connected via SPI. More... | |
int | writeAcmd (const SpiMasterHandle &spiMasterHandle, const uint8_t command, const uint32_t argument={}, const uint8_t crc7={}, const bool stuffByte={}) |
Writes application (ACMD) command to SD card connected via SPI. More... | |
std::pair< int, uint8_t > | writeAcmdReadR1 (const SpiMasterHandle &spiMasterHandle, const uint8_t command, const uint32_t argument={}, const uint8_t crc7={}, const bool stuffByte={}) |
Writes application (ACMD) command and reads R1 response to/from SD card connected via SPI. More... | |
std::pair< int, R2Response > | writeAcmdReadR2 (const SpiMasterHandle &spiMasterHandle, const uint8_t command, const uint32_t argument={}, const uint8_t crc7={}, const bool stuffByte={}) |
Writes application (ACMD) command and reads R2 response to/from SD card connected via SPI. More... | |
std::tuple< int, R2Response, std::array< uint8_t, 64 > > | executeAcmd13 (const SpiMasterHandle &spiMasterHandle, const distortos::TickClock::duration duration) |
Executes ACMD13 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeAcmd23 (const SpiMasterHandle &spiMasterHandle, const uint32_t blocksCount) |
Executes ACMD23 command on SD card connected via SPI. More... | |
std::pair< int, uint8_t > | executeAcmd41 (const SpiMasterHandle &spiMasterHandle, const bool hcs) |
Executes ACMD41 command on SD card connected via SPI. More... | |
Variables | |
constexpr uint8_t | dataResponseTokenMask {0b00011111} |
mask for data response token More... | |
constexpr uint8_t | dataResponseTokenDataAccepted {0b010 << 1 | 1} |
data response token - data accepted More... | |
constexpr uint8_t | startBlockToken {0b11111110} |
control token - start block More... | |
constexpr uint8_t | startBlockWriteToken {0b11111100} |
control token - start block for CMD25 More... | |
constexpr uint8_t | stopTranToken {0b11111101} |
control token - stop tran More... | |
constexpr uint8_t | r1InIdleStateMask {1 << 0} |
R1 - in idle state. More... | |
constexpr uint32_t | ocrCcsMask {1 << 30} |
OCR - CCS bit mask. More... | |
constexpr uint8_t | acmd41HcsPosition {30} |
ACMD41 argument - HCS bit position. More... | |
using distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::ConstUint8Range = typedef estd::ContiguousRange<const uint8_t> |
range of const uint8_t elements
using distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::Uint8Range = typedef estd::ContiguousRange<uint8_t> |
range of uint8_t elements
Csd distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::decodeCsd | ( | const std::array< uint8_t, 16 > & | buffer | ) |
Decodes raw data into CSD.
[in] | buffer | is a reference to array with raw data containing CSD |
SdStatus distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::decodeSdStatus | ( | const std::array< uint8_t, 64 > & | buffer | ) |
Decodes raw data into SD Status.
[in] | buffer | is a reference to array with raw data containing SD Status |
std::tuple<int, R2Response, std::array<uint8_t, 64> > distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeAcmd13 | ( | const SpiMasterHandle & | spiMasterHandle, |
const distortos::TickClock::duration | duration | ||
) |
Executes ACMD13 command on SD card connected via SPI.
This is SD_STATUS command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | duration | is the duration of wait before giving up |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeAcmd23 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint32_t | blocksCount | ||
) |
Executes ACMD23 command on SD card connected via SPI.
This is SET_WR_BLK_ERASE_COUNT command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | blocksCount | is the number of blocks to pre-erase with next multi-block write command |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeAcmd41 | ( | const SpiMasterHandle & | spiMasterHandle, |
const bool | hcs | ||
) |
Executes ACMD41 command on SD card connected via SPI.
This is SD_SEND_OP_COND command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | hcs | is the value of HCS (Host Capacity Support) bit sent to the SD card, which selects whether host supports SDHC or SDXC cards |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd0 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Executes CMD0 command on SD card connected via SPI.
This is GO_IDLE_STATE command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd12 | ( | const SpiMasterHandle & | spiMasterHandle, |
const distortos::TickClock::duration | duration | ||
) |
Executes CMD12 command on SD card connected via SPI.
This is STOP_TRANSMISSION command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | duration | is the duration of wait before giving up |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd16 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint32_t | blockLength | ||
) |
Executes CMD16 command on SD card connected via SPI.
This is SET_BLOCKLEN command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | blockLength | is the length of read/write block, bytes |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd17 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint32_t | address | ||
) |
Executes CMD17 command on SD card connected via SPI.
This is READ_SINGLE_BLOCK command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | address | is the address from which data will be read, bytes or blocks |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd18 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint32_t | address | ||
) |
Executes CMD18 command on SD card connected via SPI.
This is READ_MULTIPLE_BLOCK command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | address | is the address from which data will be read, bytes or blocks |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd24 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint32_t | address | ||
) |
Executes CMD24 command on SD card connected via SPI.
This is WRITE_BLOCK command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | address | is the address to which data will be written, bytes or blocks |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd25 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint32_t | address | ||
) |
Executes CMD25 command on SD card connected via SPI.
This is WRITE_MULTIPLE_BLOCK command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | address | is the address to which data will be written, bytes or blocks |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd32 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint32_t | address | ||
) |
Executes CMD32 command on SD card connected via SPI.
This is ERASE_WR_BLK_START_ADDR command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | address | is the address of first block marked for erase, bytes or blocks |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd33 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint32_t | address | ||
) |
Executes CMD33 command on SD card connected via SPI.
This is ERASE_WR_BLK_END_ADDR command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | address | is the address of last block marked for erase, bytes or blocks |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd38 | ( | const SpiMasterHandle & | spiMasterHandle, |
const distortos::TickClock::duration | duration | ||
) |
Executes CMD38 command on SD card connected via SPI.
This is ERASE command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | duration | is the duration of wait before giving up |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd55 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Executes CMD55 command on SD card connected via SPI.
This is APP_CMD command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
std::pair<int, R3Response> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd58 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Executes CMD58 command on SD card connected via SPI.
This is READ_OCR command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
std::tuple<int, uint8_t, bool> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd8 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Executes CMD8 command on SD card connected via SPI.
This is SEND_IF_COND command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
std::tuple<int, uint8_t, std::array<uint8_t, 16> > distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::executeCmd9 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Executes CMD9 command on SD card connected via SPI.
This is SEND_CSD command.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
uint32_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::extractBits | ( | const ConstUint8Range | range, |
const size_t | index, | ||
const size_t | size | ||
) |
Extracts up to 32 bits from data range.
Bits are numbered just like in the CSD.
[in] | range | is the data range from which bits will be extracted |
[in] | index | is the index of starting bit, 0 - LSB of last element in data range |
[in] | size | is the number of bits to extract |
int distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::readDataBlock | ( | const SpiMasterHandle & | spiMasterHandle, |
void *const | buffer, | ||
const size_t | size, | ||
const distortos::TickClock::duration | duration | ||
) |
Reads data block from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[out] | buffer | is a pointer to buffer for received data |
[in] | size | is the size of data block that should be read, bytes |
[in] | duration | is the duration of wait before giving up |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::readR1 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Reads R1 response from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
std::pair<int, R2Response> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::readR2 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Reads R2 response from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
std::pair<int, R3Response> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::readR3 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Reads R3 response from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
std::pair<int, R7Response> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::readR7 | ( | const SpiMasterHandle & | spiMasterHandle | ) |
Reads R7 response from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
int distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::readResponse | ( | const SpiMasterHandle & | spiMasterHandle, |
const Uint8Range | buffer | ||
) |
Reads response from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | buffer | is a buffer for received response |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::waitWhile | ( | const SpiMasterHandle & | spiMasterHandle, |
const distortos::TickClock::duration | duration, | ||
Functor | functor | ||
) |
Waits while byte received via SPI satisfies predicate.
Functor | is the type of functor, should be callable as bool(const uint8_t&) |
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | duration | is the duration of wait before giving up |
[in] | functor | is the functor used to check predicate |
int distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::waitWhileBusy | ( | const SpiMasterHandle & | spiMasterHandle, |
const distortos::TickClock::duration | duration | ||
) |
Waits while SD card connected via SPI is busy.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | duration | is the duration of wait before giving up |
int distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::writeAcmd | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint8_t | command, | ||
const uint32_t | argument = {} , |
||
const uint8_t | crc7 = {} , |
||
const bool | stuffByte = {} |
||
) |
Writes application (ACMD) command to SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | command | is the command that will be written |
[in] | argument | is the argument for command, default - 0 |
[in] | crc7 | is the value of CRC-7 appended to the transferred block, default - 0 |
[in] | stuffByte | selects whether stuff byte will be appended to the transferred block, default - false |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::writeAcmdReadR1 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint8_t | command, | ||
const uint32_t | argument = {} , |
||
const uint8_t | crc7 = {} , |
||
const bool | stuffByte = {} |
||
) |
Writes application (ACMD) command and reads R1 response to/from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | command | is the command that will be written |
[in] | argument | is the argument for command, default - 0 |
[in] | crc7 | is the value of CRC-7 appended to the transferred block, default - 0 |
[in] | stuffByte | selects whether stuff byte will be appended to the transferred block, default - false |
std::pair<int, R2Response> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::writeAcmdReadR2 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint8_t | command, | ||
const uint32_t | argument = {} , |
||
const uint8_t | crc7 = {} , |
||
const bool | stuffByte = {} |
||
) |
Writes application (ACMD) command and reads R2 response to/from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | command | is the command that will be written |
[in] | argument | is the argument for command, default - 0 |
[in] | crc7 | is the value of CRC-7 appended to the transferred block, default - 0 |
[in] | stuffByte | selects whether stuff byte will be appended to the transferred block, default - false |
int distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::writeCmd | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint8_t | command, | ||
const uint32_t | argument = {} , |
||
const uint8_t | crc7 = {} , |
||
const bool | stuffByte = {} |
||
) |
Writes regular (CMD) command to SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | command | is the command that will be written |
[in] | argument | is the argument for command, default - 0 |
[in] | crc7 | is the value of CRC-7 appended to the transferred block, default - 0 |
[in] | stuffByte | selects whether stuff byte will be appended to the transferred block, default - false |
std::pair<int, uint8_t> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::writeCmdReadR1 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint8_t | command, | ||
const uint32_t | argument = {} , |
||
const uint8_t | crc7 = {} , |
||
const bool | stuffByte = {} |
||
) |
Writes regular (CMD) command and reads R1 response to/from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | command | is the command that will be written |
[in] | argument | is the argument for command, default - 0 |
[in] | crc7 | is the value of CRC-7 appended to the transferred block, default - 0 |
[in] | stuffByte | selects whether stuff byte will be appended to the transferred block, default - false |
std::pair<int, R3Response> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::writeCmdReadR3 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint8_t | command, | ||
const uint32_t | argument = {} , |
||
const uint8_t | crc7 = {} , |
||
const bool | stuffByte = {} |
||
) |
Writes regular (CMD) command and reads R3 response to/from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | command | is the command that will be written |
[in] | argument | is the argument for command, default - 0 |
[in] | crc7 | is the value of CRC-7 appended to the transferred block, default - 0 |
[in] | stuffByte | selects whether stuff byte will be appended to the transferred block, default - false |
std::pair<int, R7Response> distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::writeCmdReadR7 | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint8_t | command, | ||
const uint32_t | argument = {} , |
||
const uint8_t | crc7 = {} , |
||
const bool | stuffByte = {} |
||
) |
Writes regular (CMD) command and reads R7 response to/from SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | command | is the command that will be written |
[in] | argument | is the argument for command, default - 0 |
[in] | crc7 | is the value of CRC-7 appended to the transferred block, default - 0 |
[in] | stuffByte | selects whether stuff byte will be appended to the transferred block, default - false |
int distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::writeDataBlock | ( | const SpiMasterHandle & | spiMasterHandle, |
const uint8_t | token, | ||
const void *const | buffer, | ||
const size_t | size, | ||
const distortos::TickClock::duration | duration | ||
) |
Writes data block to SD card connected via SPI.
[in] | spiMasterHandle | is a reference to SpiMasterHandle object used for communication |
[in] | token | is the token which will be used to start data block |
[in] | buffer | is a pointer to buffer with written data |
[in] | size | is the size of data block that should be written, bytes |
[in] | duration | is the duration of wait before giving up |
constexpr uint8_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::acmd41HcsPosition {30} |
ACMD41 argument - HCS bit position.
constexpr uint8_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::dataResponseTokenDataAccepted {0b010 << 1 | 1} |
data response token - data accepted
constexpr uint8_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::dataResponseTokenMask {0b00011111} |
mask for data response token
constexpr uint32_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::ocrCcsMask {1 << 30} |
OCR - CCS bit mask.
constexpr uint8_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::r1InIdleStateMask {1 << 0} |
R1 - in idle state.
constexpr uint8_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::startBlockToken {0b11111110} |
control token - start block
constexpr uint8_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::startBlockWriteToken {0b11111100} |
control token - start block for CMD25
constexpr uint8_t distortos::devices::anonymous_namespace{SdCardSpiBased.cpp}::stopTranToken {0b11111101} |
control token - stop tran