mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Merge pull request #647 from TomHarte/SCSIActivity
Adds the SCSI bus as an Activity::Source.
This commit is contained in:
commit
5a82df837d
@ -500,6 +500,10 @@ template <Analyser::Static::Macintosh::Target::Model model> 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:
|
||||
|
@ -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_;
|
||||
}
|
||||
|
@ -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<BusState> device_states_;
|
||||
BusState state_ = DefaultBusState;
|
||||
std::vector<Observer *> observers_;
|
||||
|
||||
Activity::Observer *activity_observer_ = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user