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

Method readData

external/floppybridge/src/GreaseWeazleBridge.cpp:271–284  ·  view source on GitHub ↗

Called when data should be read from the drive. rotationExtractor: 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 rotati

Source from the content-addressed store, hash-verified

269// 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
270// Returns: ReadResponse, explains its self
271CommonBridgeTemplate::ReadResponse GreaseWeazleDiskBridge::readData(PLL::BridgePLL& pll, const unsigned int maxBufferSize, RotationExtractor::MFMSample* buffer, RotationExtractor::IndexSequenceMarker& indexMarker,
272 std::function<bool(RotationExtractor::MFMSample* mfmData, const unsigned int dataLengthInBits)> onRotation) {
273 GWResponse result = m_io.readRotation(pll, maxBufferSize, buffer, indexMarker,
274 [&onRotation](RotationExtractor::MFMSample** mfmData, const unsigned int dataLengthInBits) -> bool {
275 return onRotation(*mfmData, dataLengthInBits);
276 });
277 m_motorTurnOnTime = std::chrono::steady_clock::now();
278
279 switch (result) {
280 case GWResponse::drOK: return ReadResponse::rrOK;
281 case GWResponse::drNoDiskInDrive: return ReadResponse::rrNoDiskInDrive;
282 default: return ReadResponse::rrError;
283 }
284}
285
286// Called for a direct read. This does not match up a rotation and should be used with the pll initialized with the LinearExtractor
287// pll: required

Callers 1

readLinearDataMethod · 0.45

Calls 1

readRotationMethod · 0.45

Tested by

no test coverage detected