2019-08-23 03:16:58 +00:00
|
|
|
//
|
|
|
|
// DirectAccessDevice.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 22/08/2019.
|
|
|
|
// Copyright © 2019 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "DirectAccessDevice.hpp"
|
|
|
|
|
|
|
|
using namespace SCSI;
|
|
|
|
|
2019-08-25 21:03:41 +00:00
|
|
|
|
|
|
|
void DirectAccessDevice::set_storage(const std::shared_ptr<Storage::MassStorage::MassStorageDevice> &device) {
|
|
|
|
device_ = device;
|
|
|
|
}
|
|
|
|
|
2019-08-23 03:16:58 +00:00
|
|
|
bool DirectAccessDevice::read(const Target::CommandState &state, Target::Responder &responder) {
|
2019-08-25 21:03:41 +00:00
|
|
|
if(!device_) return false;
|
2019-08-23 03:16:58 +00:00
|
|
|
|
2019-08-25 21:03:41 +00:00
|
|
|
responder.send_data(device_->get_block(state.address()), [] (const Target::CommandState &state, Target::Responder &responder) {
|
2019-09-04 02:40:18 +00:00
|
|
|
responder.terminate_command(Target::Responder::Status::Good);
|
2019-08-23 03:16:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-09-08 02:04:44 +00:00
|
|
|
|
2019-09-09 01:59:56 +00:00
|
|
|
Target::Executor::Inquiry DirectAccessDevice::inquiry_values() {
|
|
|
|
return Inquiry("Apple", "ProFile", "1"); // All just guesses.
|
2019-09-08 02:04:44 +00:00
|
|
|
}
|