MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / SPIWaitWriteEnd

Function SPIWaitWriteEnd

3ds/source/spi.cpp:69–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69Result SPIWaitWriteEnd(CardType type)
70{
71 u8 cmd = SPI_CMD_RDSR, statusReg = 0;
72 Result res = 0;
73 int panic = 0;
74 do {
75 panic++;
76 res = SPIWriteRead(type, &cmd, 1, &statusReg, 1, 0, 0);
77 if (res)
78 return res;
79 } while (statusReg & SPI_FLG_WIP && panic < 1000);
80
81 return panic >= 1000 ? 1 : 0;
82}
83
84Result SPIEnableWriting(CardType type)
85{

Callers 4

SPIWriteSaveDataFunction · 0.85
SPIReadSaveDataFunction · 0.85
SPIEraseSectorFunction · 0.85

Calls 1

SPIWriteReadFunction · 0.85

Tested by

no test coverage detected