mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-19 23:32:28 +00:00
Switches to proper SCSI terminology and better attempts a command phase.
This commit is contained in:
parent
0e0c789b02
commit
8339e2044c
@ -25,26 +25,30 @@ void DirectAccessDevice::scsi_bus_did_change(Bus *, BusState new_state) {
|
||||
time."
|
||||
*/
|
||||
|
||||
switch(state_) {
|
||||
case State::Inactive:
|
||||
switch(phase_) {
|
||||
case Phase::AwaitingSelection:
|
||||
if(
|
||||
(new_state & scsi_id_mask_) &&
|
||||
((new_state & (Line::SelectTarget | Line::Busy | Line::Input)) == Line::SelectTarget)
|
||||
) {
|
||||
state_ = State::Selected;
|
||||
bus_state_ |= Line::Busy | Line::Request;
|
||||
phase_ = Phase::Command;
|
||||
bus_state_ |= Line::Busy | Line::Request | Line::Control; // Initiate the command phase: request a command byte.
|
||||
bus_.set_device_output(scsi_bus_device_id_, bus_state_);
|
||||
}
|
||||
break;
|
||||
|
||||
case State::Selected:
|
||||
case Phase::Command:
|
||||
switch(new_state & (Line::Request | Line::Acknowledge)) {
|
||||
// If request and acknowledge are both enabled, grab a byte and cancel the request.
|
||||
case Line::Request | Line::Acknowledge:
|
||||
bus_state_ &= ~Line::Request;
|
||||
printf("Got %02x maybe?\n", bus_state_ & 0xff);
|
||||
|
||||
// TODO: is the command phase over?
|
||||
break;
|
||||
|
||||
case Line::Acknowledge:
|
||||
// The reset of request has caused the initiator to reset acknowledge, so it is now
|
||||
// safe to request the next byte.
|
||||
case 0:
|
||||
bus_state_ |= Line::Request;
|
||||
break;
|
||||
|
@ -32,10 +32,10 @@ class DirectAccessDevice: public Bus::Observer {
|
||||
const BusState scsi_id_mask_;
|
||||
const size_t scsi_bus_device_id_;
|
||||
|
||||
enum class State {
|
||||
Inactive,
|
||||
Selected
|
||||
} state_ = State::Inactive;
|
||||
enum class Phase {
|
||||
AwaitingSelection,
|
||||
Command
|
||||
} phase_ = Phase::AwaitingSelection;
|
||||
BusState bus_state_ = DefaultBusState;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user