MCPcopy Create free account
hub / github.com/DISTORTEC/distortos / executeCmd9

Function executeCmd9

source/devices/memory/SdCardSpiBased.cpp:801–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

799 */
800
801std::tuple<int, uint8_t, std::array<uint8_t, 16>> executeCmd9(const SpiMasterHandle& spiMasterHandle)
802{
803 {
804 const auto ret = writeCmdReadR1(spiMasterHandle, 9);
805 if (ret.first != 0 || ret.second != 0)
806 return decltype(executeCmd9(spiMasterHandle)){ret.first, ret.second, {}};
807 }
808 std::array<uint8_t, 16> csdBuffer;
809 // "7.2.6 Read CID/CSD Registers" of Physical Layer Simplified Specification Version 6.00 - use fixed read timeout
810 const auto ret =
811 readDataBlock(spiMasterHandle, csdBuffer.begin(), csdBuffer.size(), std::chrono::milliseconds{100});
812 return decltype(executeCmd9(spiMasterHandle)){ret, {}, csdBuffer};
813}
814
815/**
816 * \brief Executes CMD12 command on SD card connected via SPI.

Callers 1

initializeMethod · 0.70

Calls 4

writeCmdReadR1Function · 0.85
readDataBlockFunction · 0.85
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected