diff --git a/ATA/Errors.cs b/ATA/Errors.cs new file mode 100644 index 0000000..877a463 --- /dev/null +++ b/ATA/Errors.cs @@ -0,0 +1,111 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Errors.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System; + +namespace DiscImageChef.Decoders.ATA +{ + public struct AtaRegistersCHS + { + public byte feature; + public byte sectorCount; + public byte sector; + public byte cylinderLow; + public byte cylinderHigh; + public byte deviceHead; + public byte command; + } + + public struct AtaRegistersLBA28 + { + public byte feature; + public byte sectorCount; + public byte lbaLow; + public byte lbaMid; + public byte lbaHigh; + public byte deviceHead; + public byte command; + } + + public struct AtaRegistersLBA48 + { + public ushort feature; + public ushort sectorCount; + public ushort lbaLow; + public ushort lbaMid; + public ushort lbaHigh; + public byte deviceHead; + public byte command; + } + + public struct AtaErrorRegistersCHS + { + public byte status; + public byte error; + public byte sectorCount; + public byte sector; + public byte cylinderLow; + public byte cylinderHigh; + public byte deviceHead; + public byte command; + } + + public struct AtaErrorRegistersLBA28 + { + public byte status; + public byte error; + public byte sectorCount; + public byte lbaLow; + public byte lbaMid; + public byte lbaHigh; + public byte deviceHead; + public byte command; + } + + public struct AtaErrorRegistersLBA48 + { + public byte status; + public byte error; + public ushort sectorCount; + public ushort lbaLow; + public ushort lbaMid; + public ushort lbaHigh; + public byte deviceHead; + public byte command; + } +} + diff --git a/ChangeLog b/ChangeLog index cd18e98..f8ea336 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2015-11-23 Natalia Portillo + + * ATA/Errors.cs: + * DiscImageChef.Decoders.csproj: + Moved ATA register definition to a more common place. + + * SCSI/Sense.cs: + Added information from SAT-4. + 2015-11-23 Natalia Portillo * SCSI/Sense.cs: diff --git a/DiscImageChef.Decoders.csproj b/DiscImageChef.Decoders.csproj index eddc45f..2cf746d 100644 --- a/DiscImageChef.Decoders.csproj +++ b/DiscImageChef.Decoders.csproj @@ -83,6 +83,7 @@ + diff --git a/SCSI/Sense.cs b/SCSI/Sense.cs index 13cb54b..ca92205 100644 --- a/SCSI/Sense.cs +++ b/SCSI/Sense.cs @@ -38,6 +38,7 @@ using System; using System.Text; using System.Collections.Generic; +using DiscImageChef.Decoders.ATA; namespace DiscImageChef.Decoders.SCSI { @@ -621,9 +622,19 @@ namespace DiscImageChef.Decoders.SCSI throw new NotImplementedException("Check OSD"); } - public static void DecodeDescriptor09(byte[] descriptor) + public static AtaErrorRegistersLBA48 DecodeDescriptor09(byte[] descriptor) { - throw new NotImplementedException("Check SAT-3"); + AtaErrorRegistersLBA48 errorRegisters = new AtaErrorRegistersLBA48(); + + errorRegisters.error = descriptor[3]; + errorRegisters.sectorCount = (ushort)((descriptor[4] << 8) + descriptor[5]); + errorRegisters.lbaLow = (ushort)((descriptor[6] << 8) + descriptor[7]); + errorRegisters.lbaMid = (ushort)((descriptor[8] << 8) + descriptor[9]); + errorRegisters.lbaHigh = (ushort)((descriptor[10] << 8) + descriptor[11]); + errorRegisters.deviceHead = descriptor[12]; + errorRegisters.status = descriptor[13]; + + return errorRegisters; } public static void DecodeDescriptor0B(byte[] descriptor)