From 776b819a5a09575e157f5b4f7e4e43547f0d044c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 19 Sep 2019 19:31:22 -0400 Subject: [PATCH] Adds the SCSI bus as an Activity::Source. --- Machines/Apple/Macintosh/Macintosh.cpp | 4 ++++ Storage/MassStorage/SCSI/SCSI.cpp | 9 +++++++++ Storage/MassStorage/SCSI/SCSI.hpp | 10 ++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Machines/Apple/Macintosh/Macintosh.cpp b/Machines/Apple/Macintosh/Macintosh.cpp index e0053ccb1..4db65ca4e 100644 --- a/Machines/Apple/Macintosh/Macintosh.cpp +++ b/Machines/Apple/Macintosh/Macintosh.cpp @@ -500,6 +500,10 @@ template class ConcreteMachin // MARK: - Activity Source void set_activity_observer(Activity::Observer *observer) override { iwm_->set_activity_observer(observer); + + if(model == Analyser::Static::Macintosh::Target::Model::MacPlus) { + scsi_bus_.set_activity_observer(observer); + } } private: diff --git a/Storage/MassStorage/SCSI/SCSI.cpp b/Storage/MassStorage/SCSI/SCSI.cpp index 446f14875..da3667b75 100644 --- a/Storage/MassStorage/SCSI/SCSI.cpp +++ b/Storage/MassStorage/SCSI/SCSI.cpp @@ -44,6 +44,10 @@ void Bus::set_device_output(size_t device, BusState output) { } if(state_ == previous_state) return; + if(activity_observer_ && (state_^previous_state)&SCSI::Line::Busy) { + activity_observer_->set_led_status("SCSI", state_&SCSI::Line::Busy); + } + // printf("SCSI bus: %02x %c%c%c%c%c%c%c%c%c%c\n", // state_ & 0xff, // (state_ & Line::Parity) ? 'p' : '-', @@ -64,6 +68,11 @@ void Bus::set_device_output(size_t device, BusState output) { if(was_asleep) update_clocking_observer(); } +void Bus::set_activity_observer(Activity::Observer *observer) { + activity_observer_ = observer; + activity_observer_->register_led("SCSI"); +} + BusState Bus::get_state() { return state_; } diff --git a/Storage/MassStorage/SCSI/SCSI.hpp b/Storage/MassStorage/SCSI/SCSI.hpp index ddc8703d6..c1502fa1f 100644 --- a/Storage/MassStorage/SCSI/SCSI.hpp +++ b/Storage/MassStorage/SCSI/SCSI.hpp @@ -15,6 +15,7 @@ #include "../../../ClockReceiver/ClockReceiver.hpp" #include "../../../ClockReceiver/ClockingHintSource.hpp" +#include "../../../Activity/Source.hpp" namespace SCSI { @@ -92,7 +93,7 @@ constexpr double CableSkew = ns(10.0); #undef ns #undef us -class Bus: public ClockingHint::Source { +class Bus: public ClockingHint::Source, public Activity::Source { public: Bus(HalfCycles clock_rate); @@ -137,9 +138,12 @@ class Bus: public ClockingHint::Source { */ void update_observers(); - /// As per ClockingHint::Source. + // As per ClockingHint::Source. ClockingHint::Preference preferred_clocking() final; + // Fulfilling public Activity::Source. + void set_activity_observer(Activity::Observer *observer) final; + private: HalfCycles time_in_state_; double cycles_to_time_ = 1.0; @@ -149,6 +153,8 @@ class Bus: public ClockingHint::Source { std::vector device_states_; BusState state_ = DefaultBusState; std::vector observers_; + + Activity::Observer *activity_observer_ = nullptr; }; }