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

Method read32

tests/ntrcard-probe-test.cpp:456–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454 }
455
456 std::uint32_t read32(NtrCard::RegisterOffset offset) const override
457 {
458 switch (offset) {
459 case NtrCard::RegisterOffset::RomControl: {
460 if (!started) {
461 return romControl;
462 }
463 const std::size_t expected = wordsForCommand();
464 if (expected == 0) {
465 return transferControl & ~busy;
466 }
467 if (behavior == Behavior::StatusNeverReady && currentCommand == 0xD6) {
468 // Answers, but never with the ready bit.
469 return wordsMoved < expected ? (transferControl | dataReady) : (transferControl & ~busy);
470 }
471 return wordsMoved < expected ? (transferControl | dataReady) : (transferControl & ~busy);
472 }
473 case NtrCard::RegisterOffset::CommandHigh:
474 return commandHigh;
475 case NtrCard::RegisterOffset::CommandLow:
476 return commandLow;
477 case NtrCard::RegisterOffset::Fifo: {
478 // Only 0xD6 hands anything back.
479 assert(currentCommand == 0xD6);
480 wordsMoved++;
481 if (behavior == Behavior::StatusNeverReady) {
482 return 0;
483 }
484 if (behavior == Behavior::StatusReadyLate && statusPolls < 2) {
485 statusPolls++;
486 return 0;
487 }
488 return 1u << 5;
489 }
490 default:
491 assert(false);
492 return 0;
493 }
494 }
495
496 std::array<std::uint8_t, 8> readCommand(void) const override
497 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected