Implement Test Unit Ready command

This commit is contained in:
Eric Helgeson 2022-04-19 20:42:39 -05:00
parent f7799fb225
commit 408e155a63
2 changed files with 17 additions and 1 deletions

View File

@ -1352,6 +1352,20 @@ byte onModeSelectCommand(byte scsi_cmd, byte flags, uint32_t len)
return SCSI_STATUS_GOOD;
}
/*
* Test Unit Ready command processing.
*/
byte onTestUnitReady()
{
// Check that image file is present
if(!m_img) {
m_senseKey = SCSI_SENSE_NOT_READY;
m_addition_sense = SCSI_ASC_MEDIUM_NOT_PRESENT;
return SCSI_STATUS_CHECK_CONDITION;
}
return SCSI_STATUS_GOOD;
}
/*
* MsgIn2.
*/
@ -1516,6 +1530,7 @@ void loop()
switch(cmd[0]) {
case SCSI_TEST_UNIT_READY: // TODO: Implement me!
LOGN("[Test Unit Ready]");
m_sts |= onTestUnitReady();
break;
case SCSI_REZERO_UNIT: // TODO: Implement me!
LOGN("[Rezero Unit]");

View File

@ -27,5 +27,6 @@
#define SCSI_ASC_WRITE_PROTECTED 0x2700
#define SCSI_ASC_CANNOT_READ_MEDIUM_UNKNOWN_FORMAT 0x3001
#define SCSI_ASC_CANNOT_READ_MEDIUM_INCOMPATIBLE_FORMAT 0x3002
#define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3A00
#define SCSI_ASC_LUN_NOT_READY_MANUAL_INTERVENTION_REQUIRED 0x0403
#endif