MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / readData

Method readData

external/floppybridge/src/SuperCardProBridge.cpp:223–236  ·  view source on GitHub ↗

Called when data should be read from the drive. pll: supplied if you use it maxBufferSize: Maximum number of RotationExtractor::MFMSample in the buffer. If we're trying to detect a disk, this might be set VERY LOW buffer: Where to save to. When a buffer is saved, position 0 MUST be where the INDEX pulse is. RevolutionExtractor will do this for you indexMarker: Used by rotationEx

Source from the content-addressed store, hash-verified

221// onRotation: A function you should call for each complete revolution received. If the function returns FALSE then you should abort reading, else keep sending revolutions
222// Returns: ReadResponse, explains its self
223CommonBridgeTemplate::ReadResponse SupercardProDiskBridge::readData(PLL::BridgePLL& pll, const unsigned int maxBufferSize, RotationExtractor::MFMSample* buffer, RotationExtractor::IndexSequenceMarker& indexMarker,
224 std::function<bool(RotationExtractor::MFMSample* mfmData, const unsigned int dataLengthInBits)> onRotation) {
225 SCPErr result = m_io.readRotation(pll, maxBufferSize, buffer, indexMarker,
226 [&onRotation](RotationExtractor::MFMSample** mfmData, const unsigned int dataLengthInBits) -> bool {
227 return onRotation(*mfmData, dataLengthInBits);
228 });
229 m_motorTurnOnTime = std::chrono::steady_clock::now();
230
231 switch (result) {
232 case SCPErr::scpOK: return ReadResponse::rrOK;
233 case SCPErr::scpNoDiskInDrive: return ReadResponse::rrNoDiskInDrive;
234 default: return ReadResponse::rrError;
235 }
236}
237
238
239// Called for a direct read. This does not match up a rotation and should be used with the pll initialized with the LinearExtractor

Callers 1

readLinearDataMethod · 0.45

Calls 1

readRotationMethod · 0.45

Tested by

no test coverage detected