2016-07-15 10:51:11 +00:00
|
|
|
//
|
|
|
|
// DiskDrive.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 14/07/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef DiskDrive_hpp
|
|
|
|
#define DiskDrive_hpp
|
|
|
|
|
|
|
|
#include "Disk.hpp"
|
2016-07-15 12:28:34 +00:00
|
|
|
#include "DigitalPhaseLockedLoop.hpp"
|
2016-07-15 10:51:11 +00:00
|
|
|
|
|
|
|
namespace Storage {
|
|
|
|
|
2016-07-15 12:28:34 +00:00
|
|
|
class DiskDrive: public DigitalPhaseLockedLoop::Delegate {
|
2016-07-15 10:51:11 +00:00
|
|
|
public:
|
2016-07-15 12:28:34 +00:00
|
|
|
DiskDrive(unsigned int clock_rate, unsigned int revolutions_per_minute);
|
|
|
|
|
|
|
|
void set_expected_bit_length(Time bit_length);
|
2016-07-15 10:51:11 +00:00
|
|
|
|
|
|
|
void set_disk(std::shared_ptr<Disk> disk);
|
|
|
|
bool has_disk();
|
|
|
|
|
|
|
|
void run_for_cycles(unsigned int number_of_cycles);
|
|
|
|
|
|
|
|
bool get_is_track_zero();
|
|
|
|
void step(int direction);
|
|
|
|
void set_motor_on(bool motor_on);
|
|
|
|
|
2016-07-15 12:28:34 +00:00
|
|
|
// to satisfy DigitalPhaseLockedLoop::Delegate
|
|
|
|
void digital_phase_locked_loop_output_bit(int value);
|
|
|
|
|
2016-07-15 10:51:11 +00:00
|
|
|
protected:
|
2016-07-15 12:28:34 +00:00
|
|
|
virtual void process_input_bit(int value, unsigned int cycles_since_index_hole) = 0;
|
|
|
|
virtual void process_index_hole() = 0;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Time _bit_length;
|
|
|
|
unsigned int _clock_rate;
|
|
|
|
unsigned int _revolutions_per_minute;
|
2016-07-15 10:51:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* DiskDrive_hpp */
|