Skip to content

Commit

Permalink
Implement Send Diagnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
erichelgeson committed May 24, 2022
1 parent 3c25845 commit 0451d13
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/BlueSCSI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,24 @@ byte onReadBuffer(byte mode, uint32_t allocLength)
}
}

/*
* On Send Diagnostic
*/
byte onSendDiagnostic(byte flags)
{
int self_test = flags & 0x4;
LOGN("-SendDiagnostic");
LOGHEXN(flags);
if(self_test) {
// Don't actually do a test, we're good.
return SCSI_STATUS_GOOD;
} else {
m_senseKey = SCSI_SENSE_ILLEGAL_REQUEST;
m_addition_sense = SCSI_ASC_INVALID_FIELD_IN_CDB;
return SCSI_STATUS_CHECK_CONDITION;
}
}

/*
* MsgIn2.
*/
Expand Down Expand Up @@ -1718,6 +1736,9 @@ void loop()
LOGN("[ReadBuffer]");
m_sts |= onReadBuffer(cmd[1] & 7, ((uint32_t)cmd[6] << 16) | ((uint32_t)cmd[7] << 8) | cmd[8]);
break;
case SCSI_SEND_DIAG:
m_sts |= onSendDiagnostic(cmd[1]);
break;
default:
LOGN("[*Unknown]");
m_sts |= SCSI_STATUS_CHECK_CONDITION;
Expand Down

0 comments on commit 0451d13

Please sign in to comment.