Skip to content

Commit

Permalink
Merge pull request #64 from ZuluSCSI/rp2040_latency
Browse files Browse the repository at this point in the history
RP2040: Fix SCSI2 mode not getting enabled due to ATN handling
  • Loading branch information
Alex Perez authored Sep 15, 2022
2 parents 98e30d3 + 18f10b1 commit 628e36e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/ZuluSCSI_platform_RP2040/scsiPhy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ void scsi_bsy_deassert_interrupt()

if (sel_id >= 0)
{
uint8_t atn_flag = SCSI_IN(ATN) ? SCSI_STS_SELECTION_ATN : 0;
g_scsi_sts_selection = SCSI_STS_SELECTION_SUCCEEDED | atn_flag | sel_id;
// Set ATN flag here unconditionally, real value is only known after
// OUT_BSY is enabled in scsiStatusSEL() below.
g_scsi_sts_selection = SCSI_STS_SELECTION_SUCCEEDED | SCSI_STS_SELECTION_ATN | sel_id;
}

// selFlag is required for Philips P2000C which releases it after 600ns
Expand All @@ -80,7 +81,13 @@ extern "C" bool scsiStatusSEL()
// On RP2040 hardware the ATN signal is only available after OUT_BSY enables
// the IO buffer U105, so check the signal status here.
delay_100ns();
scsiDev.atnFlag |= scsiStatusATN();
if (!scsiStatusATN())
{
// This is a SCSI1 host that does send IDENTIFY message
scsiDev.atnFlag = 0;
scsiDev.target->unitAttention = 0;
scsiDev.compatMode = COMPAT_SCSI1;
}
}

return SCSI_IN(SEL);
Expand Down

0 comments on commit 628e36e

Please sign in to comment.