Kaynağa Gözat

Add two more LUN for more drives with Xebec

Per Mårtensson 1 ay önce
ebeveyn
işleme
896903fa1f
1 değiştirilmiş dosya ile 22 ekleme ve 2 silme
  1. 22 2
      lib/SCSI2SD/src/firmware/scsi.c

+ 22 - 2
lib/SCSI2SD/src/firmware/scsi.c

@@ -202,14 +202,34 @@ void process_Status()
 		// 00 d 000 err 0
 		// d == disk number
 		// ERR = 1 if error.
+		uint8_t xebec_status;
 		if (scsiDev.status == GOOD)
 		{
-			scsiWriteByte(scsiDev.cdb[1] & 0x20);
+			xebec_status = scsiDev.cdb[1] & 0x20;
 		}
 		else
 		{
-			scsiWriteByte((scsiDev.cdb[1] & 0x20) | 0x2);
+			xebec_status = (scsiDev.cdb[1] & 0x20) | 0x2;
 		}
+
+		if (scsiDev.lun >= 1 && scsiDev.lun <= 3)
+		{
+			// Set the appropriate drive bits based on LUN
+			// LUN 1 = bit 5 (0x20), LUN 2 = bit 6 (0x40), LUN 3 = both (0x60)
+			switch (scsiDev.lun)
+			{
+				case 1:
+					xebec_status |= 0x20;
+					break;
+				case 2:
+					xebec_status |= 0x40;
+					break;
+				case 3:
+					xebec_status |= 0x60;
+					break;
+			}
+		}
+		scsiWriteByte(xebec_status);
 		s2s_delay_us(10); // Seems to need a delay before changing phase bits.
 	}
 	else if (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_OMTI)