Browse Source

Reset watchdog while data transfer is progressing

Previously a long and slow SCSI transfer could exceed the 15 second
timeout, resulting in early termination.
Petteri Aimonen 1 year ago
parent
commit
5396143174
2 changed files with 18 additions and 0 deletions
  1. 6 0
      src/BlueSCSI_cdrom.cpp
  2. 12 0
      src/BlueSCSI_disk.cpp

+ 6 - 0
src/BlueSCSI_cdrom.cpp

@@ -1663,6 +1663,12 @@ static void doReadCD(uint32_t lba, uint32_t length, uint8_t sector_type,
 
         assert(buf == bufstart + result_length);
         scsiStartWrite(bufstart, result_length);
+
+        // Reset the watchdog while the transfer is progressing.
+        // If the host stops transferring, the watchdog will eventually expire.
+        // This is needed to avoid hitting the watchdog if the host performs
+        // a large transfer compared to its transfer speed.
+        platform_reset_watchdog();
     }
 
     scsiFinishWrite();

+ 12 - 0
src/BlueSCSI_disk.cpp

@@ -1695,6 +1695,12 @@ void diskDataOut()
             }
             platform_set_sd_callback(NULL, NULL);
             g_disk_transfer.bytes_sd += len;
+
+            // Reset the watchdog while the transfer is progressing.
+            // If the host stops transferring, the watchdog will eventually expire.
+            // This is needed to avoid hitting the watchdog if the host performs
+            // a large transfer compared to its transfer speed.
+            platform_reset_watchdog();
         }
     }
 
@@ -1868,6 +1874,12 @@ static void start_dataInTransfer(uint8_t *buffer, uint32_t count)
 
     platform_poll();
     diskEjectButtonUpdate(false);
+
+    // Reset the watchdog while the transfer is progressing.
+    // If the host stops transferring, the watchdog will eventually expire.
+    // This is needed to avoid hitting the watchdog if the host performs
+    // a large transfer compared to its transfer speed.
+    platform_reset_watchdog();
 }
 
 static void diskDataIn()