Use DMA for SCSI and SD card transfers for a massive performance boost.
[SCSI2SD-V6.git] / software / SCSI2SD / src / diagnostic.c
index f6899cd7476278fe21c3d2e170072ba59d9755cf..17721c2bac22fa1b04b229c820bcacd32fa0a64c 100755 (executable)
@@ -132,3 +132,28 @@ void scsiReceiveDiagnostic()
        }\r
 }\r
 \r
+void scsiReadBuffer()\r
+{\r
+       // READ BUFFER\r
+       // Used for testing the speed of the SCSI interface.\r
+       uint8 mode = scsiDev.data[1] & 7;\r
+       \r
+       int allocLength =\r
+               (((uint32) scsiDev.cdb[6]) << 16) +\r
+               (((uint32) scsiDev.cdb[7]) << 8) +\r
+               scsiDev.cdb[8];\r
+\r
+       if (mode == 0)\r
+       {\r
+               uint32_t maxSize = MAX_SECTOR_SIZE - 4;\r
+               // 4 byte header\r
+               scsiDev.data[0] = 0;\r
+               scsiDev.data[1] = (maxSize >> 16) & 0xff;\r
+               scsiDev.data[2] = (maxSize >> 8) & 0xff;\r
+               scsiDev.data[3] = maxSize & 0xff;\r
+               \r
+               scsiDev.dataLen =\r
+                       (allocLength > MAX_SECTOR_SIZE) ? MAX_SECTOR_SIZE : allocLength;\r
+               scsiDev.phase = DATA_IN;\r
+       }\r
+}\r