1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Adds some additional commentary as this takes shape.

This commit is contained in:
Thomas Harte 2019-08-25 17:46:05 -04:00
parent eafbc12cc1
commit 081316c071
2 changed files with 13 additions and 1 deletions

View File

@ -72,7 +72,9 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableAddressSanitizer = "YES"
enableASanStackUseAfterReturn = "YES" enableASanStackUseAfterReturn = "YES"
enableUBSanitizer = "YES"
disableMainThreadChecker = "YES" disableMainThreadChecker = "YES"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"

View File

@ -30,6 +30,11 @@ template <typename Executor> void Target<Executor>::scsi_bus_did_change(Bus *, B
} }
switch(phase_) { switch(phase_) {
/*
While awaiting selection the SCSI target is passively watching the bus waiting for its ID
to be set during a target selection. It will segue automatically from there to the command
phase regardless of its executor.
*/
case Phase::AwaitingSelection: case Phase::AwaitingSelection:
if( if(
(new_state & scsi_id_mask_) && (new_state & scsi_id_mask_) &&
@ -43,6 +48,12 @@ template <typename Executor> void Target<Executor>::scsi_bus_did_change(Bus *, B
} }
break; break;
/*
In the command phase, the target will stream an appropriate number of bytes for the command
it is being offered, before giving the executor a chance to handle the command. If the target
supports this command, it becomes responsible for the appropriate next phase transition. If it
reports that it doesn't support that command, a suitable response is automatically dispatched.
*/
case Phase::Command: case Phase::Command:
// Wait for select to be disabled before beginning the control phase proper. // Wait for select to be disabled before beginning the control phase proper.
if((new_state & Line::SelectTarget)) return; if((new_state & Line::SelectTarget)) return;
@ -62,7 +73,6 @@ template <typename Executor> void Target<Executor>::scsi_bus_did_change(Bus *, B
command_[command_pointer_] = uint8_t(new_state); command_[command_pointer_] = uint8_t(new_state);
++command_pointer_; ++command_pointer_;
if(command_pointer_ == command_.size()) { if(command_pointer_ == command_.size()) {
printf("Dispatching command\n");
dispatch_command(); dispatch_command();
// TODO: if(!dispatch_command()) signal_error_somehow(); // TODO: if(!dispatch_command()) signal_error_somehow();