Merge pull request #117 from erichelgeson/eric/reordercmds

Move read/write command earlier, few kb/sec faster read/write
This commit is contained in:
Eric Helgeson
2022-05-30 16:16:33 +00:00
committed by GitHub

View File

@@ -1651,6 +1651,23 @@ void loop()
LOGN(""); LOGN("");
switch(cmd[0]) { switch(cmd[0]) {
case SCSI_READ6:
LOGN("[Read6]");
m_sts |= onReadCommand((((uint32_t)cmd[1] & 0x1F) << 16) | ((uint32_t)cmd[2] << 8) | cmd[3], (cmd[4] == 0) ? 0x100 : cmd[4]);
break;
case SCSI_WRITE6:
LOGN("[Write6]");
m_sts |= onWriteCommand((((uint32_t)cmd[1] & 0x1F) << 16) | ((uint32_t)cmd[2] << 8) | cmd[3], (cmd[4] == 0) ? 0x100 : cmd[4]);
break;
case SCSI_READ10:
LOGN("[Read10]");
m_sts |= onReadCommand(((uint32_t)cmd[2] << 24) | ((uint32_t)cmd[3] << 16) | ((uint32_t)cmd[4] << 8) | cmd[5], ((uint32_t)cmd[7] << 8) | cmd[8]);
break;
case SCSI_WRITE10:
case SCSI_WRITE_AND_VERIFY:
LOGN("[Write10]");
m_sts |= onWriteCommand(((uint32_t)cmd[2] << 24) | ((uint32_t)cmd[3] << 16) | ((uint32_t)cmd[4] << 8) | cmd[5], ((uint32_t)cmd[7] << 8) | cmd[8]);
break;
case SCSI_TEST_UNIT_READY: case SCSI_TEST_UNIT_READY:
LOGN("[Test Unit Ready]"); LOGN("[Test Unit Ready]");
m_sts |= onTestUnitReady(); m_sts |= onTestUnitReady();
@@ -1672,17 +1689,6 @@ void loop()
case SCSI_REASSIGN_BLOCKS: // TODO: Implement me! case SCSI_REASSIGN_BLOCKS: // TODO: Implement me!
LOGN("[ReassignBlocks]"); LOGN("[ReassignBlocks]");
break; break;
case SCSI_READ6:
LOGN("[Read6]");
m_sts |= onReadCommand((((uint32_t)cmd[1] & 0x1F) << 16) | ((uint32_t)cmd[2] << 8) | cmd[3], (cmd[4] == 0) ? 0x100 : cmd[4]);
break;
case SCSI_WRITE6:
LOGN("[Write6]");
m_sts |= onWriteCommand((((uint32_t)cmd[1] & 0x1F) << 16) | ((uint32_t)cmd[2] << 8) | cmd[3], (cmd[4] == 0) ? 0x100 : cmd[4]);
break;
case SCSI_SEEK6: // TODO: Implement me!
LOGN("[Seek6]");
break;
case SCSI_INQUIRY: case SCSI_INQUIRY:
LOGN("[Inquiry]"); LOGN("[Inquiry]");
m_sts |= onInquiryCommand(cmd[4]); m_sts |= onInquiryCommand(cmd[4]);
@@ -1702,18 +1708,6 @@ void loop()
LOGN("[ReadCapacity]"); LOGN("[ReadCapacity]");
m_sts |= onReadCapacityCommand(cmd[8]); m_sts |= onReadCapacityCommand(cmd[8]);
break; break;
case SCSI_READ10:
LOGN("[Read10]");
m_sts |= onReadCommand(((uint32_t)cmd[2] << 24) | ((uint32_t)cmd[3] << 16) | ((uint32_t)cmd[4] << 8) | cmd[5], ((uint32_t)cmd[7] << 8) | cmd[8]);
break;
case SCSI_WRITE10:
case SCSI_WRITE_AND_VERIFY:
LOGN("[Write10]");
m_sts |= onWriteCommand(((uint32_t)cmd[2] << 24) | ((uint32_t)cmd[3] << 16) | ((uint32_t)cmd[4] << 8) | cmd[5], ((uint32_t)cmd[7] << 8) | cmd[8]);
break;
case SCSI_SEEK10: // TODO: Implement me!
LOGN("[Seek10]");
break;
case SCSI_VERIFY10: case SCSI_VERIFY10:
LOGN("[Verify10]"); LOGN("[Verify10]");
m_sts |= onVerifyCommand(cmd[1], ((uint32_t)cmd[2] << 24) | ((uint32_t)cmd[3] << 16) | ((uint32_t)cmd[4] << 8) | cmd[5], ((uint32_t)cmd[7] << 8) | cmd[8]); m_sts |= onVerifyCommand(cmd[1], ((uint32_t)cmd[2] << 24) | ((uint32_t)cmd[3] << 16) | ((uint32_t)cmd[4] << 8) | cmd[5], ((uint32_t)cmd[7] << 8) | cmd[8]);
@@ -1743,6 +1737,8 @@ void loop()
case SCSI_LOCK_UNLOCK_CACHE: // Commands we dont have anything to do but can safely respond GOOD. case SCSI_LOCK_UNLOCK_CACHE: // Commands we dont have anything to do but can safely respond GOOD.
case SCSI_PREFETCH: // In the future we could implement something to mimic these. case SCSI_PREFETCH: // In the future we could implement something to mimic these.
case SCSI_PREVENT_ALLOW_REMOVAL: case SCSI_PREVENT_ALLOW_REMOVAL:
case SCSI_SEEK6:
case SCSI_SEEK10:
m_sts |= SCSI_STATUS_GOOD; m_sts |= SCSI_STATUS_GOOD;
break; break;
default: default: