1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Adds the SCSI bus as an Activity::Source.

This commit is contained in:
Thomas Harte 2019-09-19 19:31:22 -04:00
parent 55e003ccc1
commit 776b819a5a
3 changed files with 21 additions and 2 deletions

View File

@ -500,6 +500,10 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
// MARK: - Activity Source // MARK: - Activity Source
void set_activity_observer(Activity::Observer *observer) override { void set_activity_observer(Activity::Observer *observer) override {
iwm_->set_activity_observer(observer); iwm_->set_activity_observer(observer);
if(model == Analyser::Static::Macintosh::Target::Model::MacPlus) {
scsi_bus_.set_activity_observer(observer);
}
} }
private: private:

View File

@ -44,6 +44,10 @@ void Bus::set_device_output(size_t device, BusState output) {
} }
if(state_ == previous_state) return; 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", // printf("SCSI bus: %02x %c%c%c%c%c%c%c%c%c%c\n",
// state_ & 0xff, // state_ & 0xff,
// (state_ & Line::Parity) ? 'p' : '-', // (state_ & Line::Parity) ? 'p' : '-',
@ -64,6 +68,11 @@ void Bus::set_device_output(size_t device, BusState output) {
if(was_asleep) update_clocking_observer(); 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() { BusState Bus::get_state() {
return state_; return state_;
} }

View File

@ -15,6 +15,7 @@
#include "../../../ClockReceiver/ClockReceiver.hpp" #include "../../../ClockReceiver/ClockReceiver.hpp"
#include "../../../ClockReceiver/ClockingHintSource.hpp" #include "../../../ClockReceiver/ClockingHintSource.hpp"
#include "../../../Activity/Source.hpp"
namespace SCSI { namespace SCSI {
@ -92,7 +93,7 @@ constexpr double CableSkew = ns(10.0);
#undef ns #undef ns
#undef us #undef us
class Bus: public ClockingHint::Source { class Bus: public ClockingHint::Source, public Activity::Source {
public: public:
Bus(HalfCycles clock_rate); Bus(HalfCycles clock_rate);
@ -137,9 +138,12 @@ class Bus: public ClockingHint::Source {
*/ */
void update_observers(); void update_observers();
/// As per ClockingHint::Source. // As per ClockingHint::Source.
ClockingHint::Preference preferred_clocking() final; ClockingHint::Preference preferred_clocking() final;
// Fulfilling public Activity::Source.
void set_activity_observer(Activity::Observer *observer) final;
private: private:
HalfCycles time_in_state_; HalfCycles time_in_state_;
double cycles_to_time_ = 1.0; double cycles_to_time_ = 1.0;
@ -149,6 +153,8 @@ class Bus: public ClockingHint::Source {
std::vector<BusState> device_states_; std::vector<BusState> device_states_;
BusState state_ = DefaultBusState; BusState state_ = DefaultBusState;
std::vector<Observer *> observers_; std::vector<Observer *> observers_;
Activity::Observer *activity_observer_ = nullptr;
}; };
} }