Explorar el Código

Merge pull request #564 from ZuluSCSI/dev_fix_scsi_phase

RP2MCU: Ensure that SCSI phase is properly reset between requests
Alex Perez hace 6 meses
padre
commit
bbe5da54c6
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      lib/ZuluSCSI_platform_RP2MCU/scsiPhy.cpp

+ 5 - 2
lib/ZuluSCSI_platform_RP2MCU/scsiPhy.cpp

@@ -56,6 +56,7 @@ extern "C" bool scsiStatusBSY()
 /* SCSI selection logic */
 /************************/
 
+static SCSI_PHASE g_scsi_phase;
 volatile uint8_t g_scsi_sts_selection;
 volatile uint8_t g_scsi_ctrl_bsy;
 
@@ -63,6 +64,8 @@ void scsi_bsy_deassert_interrupt()
 {
     if (SCSI_IN(SEL) && !SCSI_IN(BSY))
     {
+        g_scsi_phase = BUS_BUSY;
+
         // Check if any of the targets we simulate is selected
         uint8_t sel_bits = SCSI_IN_DATA();
         int sel_id = -1;
@@ -171,6 +174,8 @@ extern "C" void scsiPhyReset(void)
     SCSI_RELEASE_OUTPUTS();
     g_scsi_sts_selection = 0;
     g_scsi_ctrl_bsy = 0;
+    g_scsi_phase = BUS_FREE;
+
 
     scsi_accel_rp2040_init();
 
@@ -190,8 +195,6 @@ extern "C" void scsiPhyReset(void)
 /* SCSI bus phase logic */
 /************************/
 
-static SCSI_PHASE g_scsi_phase;
-
 extern "C" void scsiEnterPhase(int phase)
 {
     int delay = scsiEnterPhaseImmediate(phase);