REFACTOR: All refactor in DiscImageChef.Decoders.

This commit is contained in:
2017-12-22 02:04:18 +00:00
parent 7f829422a8
commit 49144eeb01
148 changed files with 2606 additions and 1939 deletions

View File

@@ -166,12 +166,12 @@ namespace DiscImageChef.Core.Devices.Dumping
foreach(FullTOC.TrackDataDescriptor track in toc.Value.TrackDescriptors)
{
if(track.TNO == 1 && ((TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrack ||
(TOC_CONTROL)(track.CONTROL & 0x0D) ==
TOC_CONTROL.DataTrackIncremental)) allFirstSessionTracksAreAudio &= firstTrackLastSession != 1;
if(track.TNO == 1 && ((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack ||
(TocControl)(track.CONTROL & 0x0D) ==
TocControl.DataTrackIncremental)) allFirstSessionTracksAreAudio &= firstTrackLastSession != 1;
if((TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrack ||
(TOC_CONTROL)(track.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental)
if((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack ||
(TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrackIncremental)
{
hasDataTrack = true;
allFirstSessionTracksAreAudio &= track.TNO >= firstTrackLastSession;
@@ -265,8 +265,8 @@ namespace DiscImageChef.Core.Devices.Dumping
{
Sequence = new TrackSequenceType {Session = trk.SessionNumber, TrackNumber = trk.POINT}
};
if((TOC_CONTROL)(trk.CONTROL & 0x0D) == TOC_CONTROL.DataTrack ||
(TOC_CONTROL)(trk.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental)
if((TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack ||
(TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental)
track.TrackType1 = TrackTypeTrackType.mode1;
else track.TrackType1 = TrackTypeTrackType.audio;
if(trk.PHOUR > 0)

View File

@@ -103,33 +103,33 @@ namespace DiscImageChef.Core.Devices
bool AtaFindReadCommand()
{
bool sense = dev.Read(out byte[] cmdBuf, out AtaErrorRegistersCHS errorChs, false, 0, 0, 1, 1, timeout, out _);
ataRead = !sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && cmdBuf.Length > 0;
bool sense = dev.Read(out byte[] cmdBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, timeout, out _);
ataRead = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
sense = dev.Read(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
ataReadRetry = !sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && cmdBuf.Length > 0;
ataReadRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
sense = dev.ReadDma(out cmdBuf, out errorChs, false, 0, 0, 1, 1, timeout, out _);
ataReadDma = !sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && cmdBuf.Length > 0;
ataReadDma = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
sense = dev.ReadDma(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
ataReadDmaRetry = !sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && cmdBuf.Length > 0;
ataReadDmaRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLBA28 errorLba, false, 0, 1, timeout, out _);
ataReadLba = !sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0;
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, timeout, out _);
ataReadLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
sense = dev.Read(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
ataReadRetryLba = !sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0;
ataReadRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, 1, timeout, out _);
ataReadDmaLba = !sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0;
ataReadDmaLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
ataReadDmaRetryLba = !sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0;
ataReadDmaRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLBA48 errorLba48, 0, 1, timeout, out _);
ataReadLba48 = !sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0;
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, timeout, out _);
ataReadLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0;
sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, 1, timeout, out _);
ataReadDmaLba48 = !sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0;
ataReadDmaLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0;
sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out _);
ataSeek = !sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0;
ataSeek = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0;
sense = dev.Seek(out errorLba, 0, timeout, out _);
ataSeekLba = !sense && (errorLba.status & 0x27) == 0 && errorChs.error == 0;
ataSeekLba = !sense && (errorLba.Status & 0x27) == 0 && errorChs.Error == 0;
if(IsLba)
{
@@ -216,39 +216,39 @@ namespace DiscImageChef.Core.Devices
{
byte[] cmdBuf;
bool sense;
AtaErrorRegistersLBA48 errorLba48;
AtaErrorRegistersLba48 errorLba48;
if(ataReadDmaLba48)
{
sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, (byte)BlocksToRead, timeout, out _);
error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0);
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0);
}
else if(ataReadLba48)
{
sense = dev.Read(out cmdBuf, out errorLba48, 0, (byte)BlocksToRead, timeout, out _);
error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0);
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0);
}
else
{
AtaErrorRegistersLBA28 errorLba;
AtaErrorRegistersLba28 errorLba;
if(ataReadDmaRetryLba)
{
sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, (byte)BlocksToRead, timeout, out _);
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0);
}
else if(ataReadDmaLba)
{
sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, (byte)BlocksToRead, timeout, out _);
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0);
}
else if(ataReadRetryLba)
{
sense = dev.Read(out cmdBuf, out errorLba, true, 0, (byte)BlocksToRead, timeout, out _);
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0);
}
else if(ataReadLba)
{
sense = dev.Read(out cmdBuf, out errorLba, false, 0, (byte)BlocksToRead, timeout, out _);
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0);
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0);
}
}
@@ -268,8 +268,8 @@ namespace DiscImageChef.Core.Devices
{
bool error = true;
bool sense;
AtaErrorRegistersLBA28 errorLba;
AtaErrorRegistersLBA48 errorLba48;
AtaErrorRegistersLba28 errorLba;
AtaErrorRegistersLba48 errorLba48;
byte status = 0, errorByte = 0;
buffer = null;
duration = 0;
@@ -277,44 +277,44 @@ namespace DiscImageChef.Core.Devices
if(ataReadDmaLba48)
{
sense = dev.ReadDma(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && buffer.Length > 0);
status = errorLba48.status;
errorByte = errorLba48.error;
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
status = errorLba48.Status;
errorByte = errorLba48.Error;
}
else if(ataReadLba48)
{
sense = dev.Read(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && buffer.Length > 0);
status = errorLba48.status;
errorByte = errorLba48.error;
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
status = errorLba48.Status;
errorByte = errorLba48.Error;
}
else if(ataReadDmaRetryLba)
{
sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && buffer.Length > 0);
status = errorLba.status;
errorByte = errorLba.error;
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
status = errorLba.Status;
errorByte = errorLba.Error;
}
else if(ataReadDmaLba)
{
sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && buffer.Length > 0);
status = errorLba.status;
errorByte = errorLba.error;
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
status = errorLba.Status;
errorByte = errorLba.Error;
}
else if(ataReadRetryLba)
{
sense = dev.Read(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && buffer.Length > 0);
status = errorLba.status;
errorByte = errorLba.error;
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
status = errorLba.Status;
errorByte = errorLba.Error;
}
else if(ataReadLba)
{
sense = dev.Read(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && buffer.Length > 0);
status = errorLba.status;
errorByte = errorLba.error;
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
status = errorLba.Status;
errorByte = errorLba.Error;
}
if(error) DicConsole.DebugWriteLine("ATA Reader", "ATA ERROR: {0} STATUS: {1}", errorByte, status);
@@ -326,7 +326,7 @@ namespace DiscImageChef.Core.Devices
{
bool error = true;
bool sense;
AtaErrorRegistersCHS errorChs;
AtaErrorRegistersChs errorChs;
byte status = 0, errorByte = 0;
buffer = null;
duration = 0;
@@ -334,30 +334,30 @@ namespace DiscImageChef.Core.Devices
if(ataReadDmaRetry)
{
sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
error = !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && buffer.Length > 0);
status = errorChs.status;
errorByte = errorChs.error;
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
status = errorChs.Status;
errorByte = errorChs.Error;
}
else if(ataReadDma)
{
sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
error = !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && buffer.Length > 0);
status = errorChs.status;
errorByte = errorChs.error;
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
status = errorChs.Status;
errorByte = errorChs.Error;
}
else if(ataReadRetry)
{
sense = dev.Read(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
error = !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && buffer.Length > 0);
status = errorChs.status;
errorByte = errorChs.error;
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
status = errorChs.Status;
errorByte = errorChs.Error;
}
else if(ataRead)
{
sense = dev.Read(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
error = !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && buffer.Length > 0);
status = errorChs.status;
errorByte = errorChs.error;
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
status = errorChs.Status;
errorByte = errorChs.Error;
}
if(error) DicConsole.DebugWriteLine("ATA Reader", "ATA ERROR: {0} STATUS: {1}", errorByte, status);
@@ -367,14 +367,14 @@ namespace DiscImageChef.Core.Devices
bool AtaSeek(ulong block, out double duration)
{
bool sense = dev.Seek(out AtaErrorRegistersLBA28 errorLba, (uint)block, timeout, out duration);
return !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0);
bool sense = dev.Seek(out AtaErrorRegistersLba28 errorLba, (uint)block, timeout, out duration);
return !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0);
}
bool AtaSeekChs(ushort cylinder, byte head, byte sector, out double duration)
{
bool sense = dev.Seek(out AtaErrorRegistersCHS errorChs, cylinder, head, sector, timeout, out duration);
return !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0);
bool sense = dev.Seek(out AtaErrorRegistersChs errorChs, cylinder, head, sector, timeout, out duration);
return !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0);
}
}
}

View File

@@ -681,13 +681,13 @@ namespace DiscImageChef.Core.Devices.Report
bool sense;
DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode...");
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersCHS errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
mediaTest.SupportsRead =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 &&
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectorschs",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -696,11 +696,11 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode...");
sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
mediaTest.SupportsReadRetry =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 &&
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectorsretrychs",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -710,11 +710,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT,
out _);
mediaTest.SupportsReadDma =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 &&
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdmachs",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -723,11 +723,11 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode...");
sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
mediaTest.SupportsReadDmaRetry =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 &&
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdmaretrychs",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -736,19 +736,19 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying SEEK in CHS mode...");
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
mediaTest.SupportsSeek =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0;
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
errorChs.status, errorChs.error);
errorChs.Status, errorChs.Error);
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
sense = dev.Read(out readBuf, out AtaErrorRegistersLBA28 errorLba, false, 0, 1, TIMEOUT, out _);
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
mediaTest.SupportsReadLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 &&
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectors",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -757,11 +757,11 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode...");
sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
mediaTest.SupportsReadRetryLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 &&
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectorsretry",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -770,11 +770,11 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA in LBA mode...");
sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
mediaTest.SupportsReadDmaLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 &&
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdma",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -783,11 +783,11 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
mediaTest.SupportsReadDmaRetryLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 &&
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdmaretry",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -796,19 +796,19 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying SEEK in LBA mode...");
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
mediaTest.SupportsSeekLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0;
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
errorChs.status, errorChs.error);
errorChs.Status, errorChs.Error);
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
sense = dev.Read(out readBuf, out AtaErrorRegistersLBA48 errorLba48, 0, 1, TIMEOUT, out _);
sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
mediaTest.SupportsReadLba48 =
!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 &&
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectors48",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -817,11 +817,11 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA in LBA48 mode...");
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
mediaTest.SupportsReadDmaLba48 =
!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 &&
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 &&
readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdma48",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -831,11 +831,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1, mediaTest.LongBlockSize,
TIMEOUT, out _);
mediaTest.SupportsReadLong =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 &&
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readlongchs",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -845,11 +845,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1, mediaTest.LongBlockSize,
TIMEOUT, out _);
mediaTest.SupportsReadLongRetry =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 &&
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readlongretrychs",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -859,11 +859,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadLong(out readBuf, out errorLba, false, 0, mediaTest.LongBlockSize,
TIMEOUT, out _);
mediaTest.SupportsReadLongLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 &&
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readlong",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -873,11 +873,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadLong(out readBuf, out errorLba, true, 0, mediaTest.LongBlockSize,
TIMEOUT, out _);
mediaTest.SupportsReadLongRetryLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 &&
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
readBuf.Length > 0 && BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
sense, errorChs.status, errorChs.error, readBuf.Length);
sense, errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readlongretry",
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
@@ -1048,12 +1048,12 @@ namespace DiscImageChef.Core.Devices.Report
bool sense;
DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode...");
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersCHS errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
sense = dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsRead =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0;
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorChs.status, errorChs.error, readBuf.Length);
errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectorschs", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1061,10 +1061,10 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode...");
sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadRetry =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0;
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorChs.status, errorChs.error, readBuf.Length);
errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectorsretrychs", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1072,10 +1072,10 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA in CHS mode...");
sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadDma =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0;
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorChs.status, errorChs.error, readBuf.Length);
errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdmachs", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1083,10 +1083,10 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode...");
sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadDmaRetry =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0;
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorChs.status, errorChs.error, readBuf.Length);
errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdmaretrychs", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1094,17 +1094,17 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying SEEK in CHS mode...");
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsSeek =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0;
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
errorChs.status, errorChs.error);
errorChs.Status, errorChs.Error);
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
sense = dev.Read(out readBuf, out AtaErrorRegistersLBA28 errorLba, false, 0, 1, TIMEOUT, out _);
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0;
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorLba.status, errorLba.error, readBuf.Length);
errorLba.Status, errorLba.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectors", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1112,10 +1112,10 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode...");
sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadRetryLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0;
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorLba.status, errorLba.error, readBuf.Length);
errorLba.Status, errorLba.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectorsretry", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1123,10 +1123,10 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA in LBA mode...");
sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadDmaLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0;
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorLba.status, errorLba.error, readBuf.Length);
errorLba.Status, errorLba.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdma", "_debug_" + report.ATA.Model + ".bin", "read results",
readBuf);
@@ -1134,10 +1134,10 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadDmaRetryLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0;
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorLba.status, errorLba.error, readBuf.Length);
errorLba.Status, errorLba.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdmaretry", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1145,17 +1145,17 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying SEEK in LBA mode...");
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsSeekLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0;
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
errorLba.status, errorLba.error);
errorLba.Status, errorLba.Error);
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
sense = dev.Read(out readBuf, out AtaErrorRegistersLBA48 errorLba48, 0, 1, TIMEOUT, out _);
sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadLba48 =
!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && readBuf.Length > 0;
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorLba48.status, errorLba48.error, readBuf.Length);
errorLba48.Status, errorLba48.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readsectors48", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1163,10 +1163,10 @@ namespace DiscImageChef.Core.Devices.Report
DicConsole.WriteLine("Trying READ DMA in LBA48 mode...");
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadDmaLba48 =
!sense && (errorLba48.status & 0x01) != 0x01 && errorLba48.error == 0 && readBuf.Length > 0;
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorLba48.status, errorLba48.error, readBuf.Length);
errorLba48.Status, errorLba48.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readdma48", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1175,11 +1175,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadLong(out readBuf, out errorChs, false, 0, 0, 1,
report.ATA.ReadCapabilities.LongBlockSize, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadLong =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0 &&
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 &&
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorChs.status, errorChs.error, readBuf.Length);
errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readlongchs", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1188,11 +1188,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadLong(out readBuf, out errorChs, true, 0, 0, 1,
report.ATA.ReadCapabilities.LongBlockSize, TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadLongRetry =
!sense && (errorChs.status & 0x01) != 0x01 && errorChs.error == 0 && readBuf.Length > 0 &&
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0 &&
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorChs.status, errorChs.error, readBuf.Length);
errorChs.Status, errorChs.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readlongretrychs", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1201,11 +1201,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadLong(out readBuf, out errorLba, false, 0, report.ATA.ReadCapabilities.LongBlockSize,
TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadLongLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0 &&
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 &&
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorLba.status, errorLba.error, readBuf.Length);
errorLba.Status, errorLba.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readlong", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);
@@ -1214,11 +1214,11 @@ namespace DiscImageChef.Core.Devices.Report
sense = dev.ReadLong(out readBuf, out errorLba, true, 0, report.ATA.ReadCapabilities.LongBlockSize,
TIMEOUT, out _);
report.ATA.ReadCapabilities.SupportsReadLongRetryLba =
!sense && (errorLba.status & 0x01) != 0x01 && errorLba.error == 0 && readBuf.Length > 0 &&
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0 &&
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
DicConsole.DebugWriteLine("ATA Report",
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
errorLba.status, errorLba.error, readBuf.Length);
errorLba.Status, errorLba.Error, readBuf.Length);
if(debug)
DataFile.WriteTo("ATA Report", "readlongretry", "_debug_" + report.ATA.Model + ".bin",
"read results", readBuf);