mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-09 21:29:53 +00:00
Implements the real hardware ready test for Drives — motor on plus two index holes.
This commit is contained in:
parent
9ac831b09c
commit
82b13e98f2
@ -26,9 +26,6 @@ void Drive::set_disk(const std::shared_ptr<Disk> &disk) {
|
|||||||
|
|
||||||
invalidate_track();
|
invalidate_track();
|
||||||
update_sleep_observer();
|
update_sleep_observer();
|
||||||
|
|
||||||
// TODO: implement ready properly.
|
|
||||||
is_ready_ = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Drive::has_disk() {
|
bool Drive::has_disk() {
|
||||||
@ -76,11 +73,14 @@ bool Drive::get_is_read_only() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Drive::get_is_ready() {
|
bool Drive::get_is_ready() {
|
||||||
return is_ready_;
|
return ready_index_count_ == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Drive::set_motor_on(bool motor_is_on) {
|
void Drive::set_motor_on(bool motor_is_on) {
|
||||||
motor_is_on_ = motor_is_on;
|
motor_is_on_ = motor_is_on;
|
||||||
|
if(!motor_is_on) {
|
||||||
|
ready_index_count_ = 0;
|
||||||
|
}
|
||||||
update_sleep_observer();
|
update_sleep_observer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +160,7 @@ void Drive::process_next_event() {
|
|||||||
// TODO: ready test here.
|
// TODO: ready test here.
|
||||||
if(current_event_.type == Track::Event::IndexHole) {
|
if(current_event_.type == Track::Event::IndexHole) {
|
||||||
assert(get_time_into_track() == Time(1) || get_time_into_track() == Time(0));
|
assert(get_time_into_track() == Time(1) || get_time_into_track() == Time(0));
|
||||||
|
if(ready_index_count_ < 2) ready_index_count_++;
|
||||||
cycles_since_index_hole_ = 0;
|
cycles_since_index_hole_ = 0;
|
||||||
}
|
}
|
||||||
if(event_delegate_) event_delegate_->process_event(current_event_);
|
if(event_delegate_) event_delegate_->process_event(current_event_);
|
||||||
|
@ -155,8 +155,8 @@ class Drive: public Sleeper, public TimedEventLoop {
|
|||||||
PCMSegment write_segment_;
|
PCMSegment write_segment_;
|
||||||
Time write_start_time_;
|
Time write_start_time_;
|
||||||
|
|
||||||
// Indicates drive ready state.
|
// Indicates progress towards drive ready state.
|
||||||
bool is_ready_ = false;
|
int ready_index_count_ = 0;
|
||||||
|
|
||||||
// Maintains appropriate counting to know when to indicate that writing
|
// Maintains appropriate counting to know when to indicate that writing
|
||||||
// is complete.
|
// is complete.
|
||||||
|
Loading…
Reference in New Issue
Block a user