|  | @@ -1550,6 +1550,8 @@ void diskDataOut()
 | 
											
												
													
														|  |             && scsiDev.phase == DATA_OUT
 |  |             && scsiDev.phase == DATA_OUT
 | 
											
												
													
														|  |             && !scsiDev.resetFlag)
 |  |             && !scsiDev.resetFlag)
 | 
											
												
													
														|  |      {
 |  |      {
 | 
											
												
													
														|  | 
 |  | +        platform_poll();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          // Figure out how many contiguous bytes are available for writing to SD card.
 |  |          // Figure out how many contiguous bytes are available for writing to SD card.
 | 
											
												
													
														|  |          uint32_t bufsize = sizeof(scsiDev.data);
 |  |          uint32_t bufsize = sizeof(scsiDev.data);
 | 
											
												
													
														|  |          uint32_t start = g_disk_transfer.bytes_sd % bufsize;
 |  |          uint32_t start = g_disk_transfer.bytes_sd % bufsize;
 | 
											
										
											
												
													
														|  | @@ -1713,6 +1715,11 @@ static void doRead(uint32_t lba, uint32_t blocks)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          if (transfer.currentBlock == transfer.blocks)
 |  |          if (transfer.currentBlock == transfer.blocks)
 | 
											
												
													
														|  |          {
 |  |          {
 | 
											
												
													
														|  | 
 |  | +            while (!scsiIsWriteFinished(NULL))
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                platform_poll();
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |              scsiFinishWrite();
 |  |              scsiFinishWrite();
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  #endif
 |  |  #endif
 | 
											
										
											
												
													
														|  | @@ -1781,6 +1788,8 @@ static void start_dataInTransfer(uint8_t *buffer, uint32_t count)
 | 
											
												
													
														|  |              log("start_dataInTransfer() timeout waiting for previous to finish");
 |  |              log("start_dataInTransfer() timeout waiting for previous to finish");
 | 
											
												
													
														|  |              scsiDev.resetFlag = 1;
 |  |              scsiDev.resetFlag = 1;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        platform_poll();
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      if (scsiDev.resetFlag) return;
 |  |      if (scsiDev.resetFlag) return;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -1799,6 +1808,8 @@ static void start_dataInTransfer(uint8_t *buffer, uint32_t count)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      diskDataIn_callback(count);
 |  |      diskDataIn_callback(count);
 | 
											
												
													
														|  |      platform_set_sd_callback(NULL, NULL);
 |  |      platform_set_sd_callback(NULL, NULL);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    platform_poll();
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  static void diskDataIn()
 |  |  static void diskDataIn()
 | 
											
										
											
												
													
														|  | @@ -1852,6 +1863,8 @@ static void diskDataIn()
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          while (!scsiIsWriteFinished(NULL) && prefetch_sectors > 0 && !scsiDev.resetFlag)
 |  |          while (!scsiIsWriteFinished(NULL) && prefetch_sectors > 0 && !scsiDev.resetFlag)
 | 
											
												
													
														|  |          {
 |  |          {
 | 
											
												
													
														|  | 
 |  | +            platform_poll();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |              // Check if prefetch buffer is free
 |  |              // Check if prefetch buffer is free
 | 
											
												
													
														|  |              g_disk_transfer.buffer = g_scsi_prefetch.buffer + g_scsi_prefetch.bytes;
 |  |              g_disk_transfer.buffer = g_scsi_prefetch.buffer + g_scsi_prefetch.bytes;
 | 
											
												
													
														|  |              if (!scsiIsWriteFinished(g_disk_transfer.buffer) ||
 |  |              if (!scsiIsWriteFinished(g_disk_transfer.buffer) ||
 | 
											
										
											
												
													
														|  | @@ -1878,6 +1891,11 @@ static void diskDataIn()
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  #endif
 |  |  #endif
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        while (!scsiIsWriteFinished(NULL))
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            platform_poll();
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          scsiFinishWrite();
 |  |          scsiFinishWrite();
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  }
 |  |  }
 |