Add XML comments to public entities.

This commit is contained in:
2021-08-17 13:55:59 +01:00
parent 433bed2145
commit fb6e3cf361
47 changed files with 852 additions and 31 deletions

View File

@@ -106,15 +106,19 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
/// <summary>MUST NOT be set</summary>
MustBeClear = 0x8000,
/// <summary>MUST be set</summary>
MustBeSet = 0x4000, Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
MustBeSet = 0x4000,
#pragma warning disable 1591
Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
Reserved10 = 0x0400, Reserved09 = 0x0200, Reserved08 = 0x0100,
Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020,
Reserved04 = 0x0010, Reserved03 = 0x0008, Reserved02 = 0x0004,
Reserved01 = 0x0002,
#pragma warning restore 1591
/// <summary>Indicates a device specific minimum standby timer value</summary>
SpecificStandbyTimer = 0x0001
}
/// <summary>Even more capabilities flag bits.</summary>
[Flags]
public enum CapabilitiesBit3 : byte
{
@@ -129,12 +133,15 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
/// <summary>If unset, sanitize commands are specified by ACS-2</summary>
SanitizeCommands = 0x0008,
/// <summary>SANITIZE ANTIFREEZE LOCK EXT is supported</summary>
SanitizeAntifreeze = 0x0004, Reserved01 = 0x0002,
SanitizeAntifreeze = 0x0004,
#pragma warning disable 1591
Reserved01 = 0x0002,
#pragma warning restore 1591
/// <summary>Multiple logical sector setting is valid</summary>
MultipleValid = 0x0001
}
/// <summary>More capabilities flag bits.</summary>
/// <summary>Command set flag bits.</summary>
[Flags]
public enum CommandSetBit : ushort
{
@@ -172,7 +179,7 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
SMART = 0x0001
}
/// <summary>More capabilities flag bits.</summary>
/// <summary>More command set flag bits.</summary>
[Flags]
public enum CommandSetBit2 : ushort
{
@@ -210,7 +217,7 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
DownloadMicrocode = 0x0001
}
/// <summary>More capabilities flag bits.</summary>
/// <summary>Even more command set flag bits.</summary>
[Flags]
public enum CommandSetBit3 : ushort
{
@@ -248,15 +255,18 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
SMARTLog = 0x0001
}
/// <summary>More capabilities flag bits.</summary>
/// <summary>Yet more command set flag bits.</summary>
[Flags]
public enum CommandSetBit4 : ushort
{
/// <summary>MUST NOT be set</summary>
MustBeClear = 0x8000,
/// <summary>MUST be set</summary>
MustBeSet = 0x4000, Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
MustBeSet = 0x4000,
#pragma warning disable 1591
Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
Reserved10 = 0x0400,
#pragma warning restore 1591
/// <summary>DSN feature set is supported</summary>
DSN = 0x0200,
/// <summary>Accessible Max Address Configuration is supported</summary>
@@ -279,6 +289,7 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
DT1825 = 0x0001
}
/// <summary>Yet again more command set flag bits.</summary>
[Flags]
public enum CommandSetBit5 : ushort
{
@@ -316,18 +327,26 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
ZonedBit0 = 0x0001
}
/// <summary>
/// Data set management flag bits.
/// </summary>
[Flags]
public enum DataSetMgmtBit : ushort
{
#pragma warning disable 1591
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080,
Reserved06 = 0x0040, Reserved05 = 0x0020, Reserved04 = 0x0010,
Reserved03 = 0x0008, Reserved02 = 0x0004, Reserved01 = 0x0002,
#pragma warning restore 1591
/// <summary>TRIM is supported</summary>
Trim = 0x0001
}
/// <summary>
/// Device form factor
/// </summary>
public enum DeviceFormFactorEnum : ushort
{
/// <summary>Size not reported</summary>
@@ -410,8 +429,10 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
[Flags]
public enum MajorVersionBit : ushort
{
#pragma warning disable 1591
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
Reserved12 = 0x1000,
#pragma warning restore 1591
/// <summary>ACS-4</summary>
ACS4 = 0x0800,
/// <summary>ACS-3</summary>
@@ -433,9 +454,15 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
/// <summary>ATA-2</summary>
Ata2 = 0x0004,
/// <summary>ATA-1</summary>
Ata1 = 0x0002, Reserved00 = 0x0001
Ata1 = 0x0002,
#pragma warning disable 1591
Reserved00 = 0x0001
#pragma warning restore 1591
}
/// <summary>
/// SATA capabilities flags
/// </summary>
[Flags]
public enum SATACapabilitiesBit : ushort
{
@@ -454,8 +481,11 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
/// <summary>Supports receipt of host initiated power management requests</summary>
PowerReceipt = 0x0200,
/// <summary>Supports NCQ</summary>
NCQ = 0x0100, Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020,
NCQ = 0x0100,
#pragma warning disable 1591
Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020,
Reserved04 = 0x0010,
#pragma warning restore 1591
/// <summary>Supports SATA Gen. 3 Signaling Speed (6.0Gb/s)</summary>
Gen3Speed = 0x0008,
/// <summary>Supports SATA Gen. 2 Signaling Speed (3.0Gb/s)</summary>
@@ -466,12 +496,17 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
Clear = 0x0001
}
/// <summary>
/// More SATA capabilities flags
/// </summary>
[Flags]
public enum SATACapabilitiesBit2 : ushort
{
#pragma warning disable 1591
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080,
#pragma warning restore 1591
/// <summary>Supports RECEIVE FPDMA QUEUED and SEND FPDMA QUEUED</summary>
FPDMAQ = 0x0040,
/// <summary>Supports NCQ Queue Management</summary>
@@ -492,12 +527,17 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
Clear = 0x0001
}
/// <summary>
/// SATA features flags
/// </summary>
[Flags]
public enum SATAFeaturesBit : ushort
{
#pragma warning disable 1591
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
Reserved09 = 0x0200, Reserved08 = 0x0100,
#pragma warning restore 1591
/// <summary>Supports NCQ autosense</summary>
NCQAutoSense = 0x0080,
/// <summary>Automatic Partial to Slumber transitions are enabled</summary>
@@ -520,13 +560,18 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
Clear = 0x0001
}
/// <summary>
/// SCT Command Transport flags
/// </summary>
[Flags]
public enum SCTCommandTransportBit : ushort
{
#pragma warning disable 1591
Vendor15 = 0x8000, Vendor14 = 0x4000, Vendor13 = 0x2000,
Vendor12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080,
Reserved06 = 0x0040,
#pragma warning restore 1591
/// <summary>SCT Command Transport Data Tables supported</summary>
DataTables = 0x0020,
/// <summary>SCT Command Transport Features Control supported</summary>
@@ -541,15 +586,20 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
Supported = 0x0001
}
/// <summary>More capabilities flag bits.</summary>
/// <summary>Security status flag bits.</summary>
[Flags]
public enum SecurityStatusBit : ushort
{
#pragma warning disable 1591
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
Reserved09 = 0x0200,
#pragma warning restore 1591
/// <summary>Maximum security level</summary>
Maximum = 0x0100, Reserved07 = 0x0080, Reserved06 = 0x0040,
Maximum = 0x0100,
#pragma warning disable 1591
Reserved07 = 0x0080, Reserved06 = 0x0040,
#pragma warning restore 1591
/// <summary>Supports enhanced security erase</summary>
Enhanced = 0x0020,
/// <summary>Security count expired</summary>
@@ -564,6 +614,9 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
Supported = 0x0001
}
/// <summary>
/// Specific configuration flags
/// </summary>
public enum SpecificConfigurationEnum : ushort
{
/// <summary>Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete</summary>
@@ -576,29 +629,43 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
NotRequiresSetCompleteResponse = 0xC837
}
/// <summary>
/// Transfer mode flags
/// </summary>
[Flags]
public enum TransferMode : byte
{
#pragma warning disable 1591
Mode7 = 0x80, Mode6 = 0x40, Mode5 = 0x20,
Mode4 = 0x10, Mode3 = 0x08, Mode2 = 0x04,
Mode1 = 0x02, Mode0 = 0x01
#pragma warning restore 1591
}
/// <summary>
/// Trusted Computing flags
/// </summary>
[Flags]
public enum TrustedComputingBit : ushort
{
/// <summary>MUST NOT be set</summary>
Clear = 0x8000,
/// <summary>MUST be set</summary>
Set = 0x4000, Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
Set = 0x4000,
#pragma warning disable 1591
Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
Reserved10 = 0x0400, Reserved09 = 0x0200, Reserved08 = 0x0100,
Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020,
Reserved04 = 0x0010, Reserved03 = 0x0008, Reserved02 = 0x0004,
Reserved01 = 0x0002,
#pragma warning restore 1591
/// <summary>Trusted Computing feature set is supported</summary>
TrustedComputing = 0x0001
}
/// <summary>
/// IDENTIFY DEVICE decoded response
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)]
public struct IdentifyDevice
{
@@ -950,6 +1017,11 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
public byte Checksum;
}
/// <summary>
/// Decodes a raw IDENTIFY DEVICE response
/// </summary>
/// <param name="IdentifyDeviceResponse">Raw IDENTIFY DEVICE response</param>
/// <returns>Decoded IDENTIFY DEVICE</returns>
public static IdentifyDevice? Decode(byte[] IdentifyDeviceResponse)
{
if(IdentifyDeviceResponse == null)
@@ -978,6 +1050,11 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
return ATAID;
}
/// <summary>
/// Encodes a raw IDENTIFY DEVICE response
/// </summary>
/// <param name="identify">Decoded IDENTIFY DEVICE</param>
/// <returns>Raw IDENTIFY DEVICE response</returns>
public static byte[] Encode(IdentifyDevice? identify)
{
if(identify is null)

View File

@@ -34,6 +34,9 @@ using System.Diagnostics.CodeAnalysis;
namespace Aaru.CommonTypes.Structs.Devices.SCSI
{
/// <summary>
/// List of known SCSI peripheral qualifiers
/// </summary>
public enum PeripheralQualifiers : byte
{
/// <summary>Peripheral qualifier: Device is connected and supported</summary>
@@ -48,6 +51,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
VendorMask = 0x04
}
/// <summary>
/// List of known peripheral device types
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum PeripheralDeviceTypes : byte
{
@@ -99,6 +105,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
UnknownDevice = 0x1F
}
/// <summary>
/// List of known ANSI SCSI standards
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ANSIVersions : byte
{
@@ -118,6 +127,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
ANSI2008Version = 0x06
}
/// <summary>
/// List of known ECMA SCSI standards
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ECMAVersions : byte
{
@@ -127,6 +139,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
ECMA111 = 0x01
}
/// <summary>
/// List of known ISO SCSI standards
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ISOVersions : byte
{
@@ -136,6 +151,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
ISO1995Version = 0x02
}
/// <summary>
/// List of known SCSI Parallel Interface clocking types
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum SPIClocking : byte
{
@@ -149,6 +167,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
STandDT = 0x03
}
/// <summary>
/// List of known TGPS values
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum TGPSValues : byte
{
@@ -162,6 +183,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
Both = 0x03
}
/// <summary>
/// List of known SCSI protocols
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ProtocolIdentifiers : byte
{
@@ -193,13 +217,37 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
NoProtocol = 15
}
/// <summary>
/// List of known SCSI definitions
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ScsiDefinitions : byte
{
Current = 0, SCSI1 = 1, CCS = 2,
SCSI2 = 3, SCSI3 = 4
/// <summary>
/// Unknown
/// </summary>
Current = 0,
/// <summary>
/// SCSI-1
/// </summary>
SCSI1 = 1,
/// <summary>
/// Unknown
/// </summary>
CCS = 2,
/// <summary>
/// SCSI-2
/// </summary>
SCSI2 = 3,
/// <summary>
/// SCSI-3
/// </summary>
SCSI3 = 4
}
/// <summary>
/// List of known SCSI physical interfaces
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum PhysicalInterfaces : uint
{

View File

@@ -251,6 +251,11 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
0x48, 0x69, 0x2D, 0x4D, 0x44, 0x20, 0x20, 0x20
};
/// <summary>
/// Decodes a SCSI INQUIRY response
/// </summary>
/// <param name="SCSIInquiryResponse">INQUIRY raw response data</param>
/// <returns>Decoded SCSI INQUIRY</returns>
#region Public methods
public static Inquiry? Decode(byte[] SCSIInquiryResponse)
{
@@ -508,6 +513,11 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
return decoded;
}
/// <summary>
/// Encodes a SCSI INQUIRY response
/// </summary>
/// <param name="inq">Decoded SCSI INQUIRY</param>
/// <returns>Raw SCSI INQUIRY response</returns>
public static byte[] Encode(Inquiry? inq)
{
if(inq is null)

View File

@@ -46,6 +46,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public class ModePage_2A
{
/// <summary>
/// Write speed performance descriptors
/// </summary>
public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors;
/// <summary>Parameters can be saved</summary>
public bool PS { get; set; }
@@ -94,43 +97,135 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
/// <summary>Current drive speed in Kbytes/second</summary>
public ushort CurrentSpeed { get; set; }
/// <summary>
/// Can read packet media
/// </summary>
public bool Method2 { get; set; }
/// <summary>
/// Can read CD-RW
/// </summary>
public bool ReadCDRW { get; set; }
/// <summary>
/// Can read CD-R
/// </summary>
public bool ReadCDR { get; set; }
/// <summary>
/// Can write CD-RW
/// </summary>
public bool WriteCDRW { get; set; }
/// <summary>
/// Can write CD-R
/// </summary>
public bool WriteCDR { get; set; }
/// <summary>
/// Supports IEC-958 digital output on port 2
/// </summary>
public bool DigitalPort2 { get; set; }
/// <summary>
/// Supports IEC-958 digital output on port 1
/// </summary>
public bool DigitalPort1 { get; set; }
/// <summary>
/// Can deliver a composite audio and video data stream
/// </summary>
public bool Composite { get; set; }
/// <summary>
/// This bit controls the behavior of the LOAD/UNLOAD command when trying to load a Slot with no Disc present
/// </summary>
public bool SSS { get; set; }
/// <summary>
/// Contains a changer that can report the exact contents of the slots
/// </summary>
public bool SDP { get; set; }
/// <summary>
/// Page length
/// </summary>
public byte Length { get; set; }
/// <summary>
/// Set if LSB comes first
/// </summary>
public bool LSBF { get; set; }
/// <summary>
/// Set if HIGH on LRCK indicates left channel. Clear if HIGH on LRCK indicates right channel.
/// </summary>
public bool RCK { get; set; }
/// <summary>
/// Set if data valid on the falling edge of the BCK signal. Clear if data valid on the rising edge of the BCK signal
/// </summary>
public bool BCK { get; set; }
/// <summary>
/// Can do a test write
/// </summary>
public bool TestWrite { get; set; }
/// <summary>
/// Maximum write speed
/// </summary>
public ushort MaxWriteSpeed { get; set; }
/// <summary>
/// Current write speed
/// </summary>
public ushort CurrentWriteSpeed { get; set; }
/// <summary>
/// Can read disc's barcode
/// </summary>
public bool ReadBarcode { get; set; }
/// <summary>
/// Can read DVD-RAM
/// </summary>
public bool ReadDVDRAM { get; set; }
/// <summary>
/// Can read DVD-R
/// </summary>
public bool ReadDVDR { get; set; }
/// <summary>
/// Can read DVD-ROM
/// </summary>
public bool ReadDVDROM { get; set; }
/// <summary>
/// Can write DVD-RAM
/// </summary>
public bool WriteDVDRAM { get; set; }
/// <summary>
/// Can write DVD-R
/// </summary>
public bool WriteDVDR { get; set; }
/// <summary>
/// Can read raw R-W subchannel from the Lead-In
/// </summary>
public bool LeadInPW { get; set; }
/// <summary>
/// Can read both sides of a disc
/// </summary>
public bool SCC { get; set; }
/// <summary>
/// Support copyright management
/// </summary>
public ushort CMRSupported { get; set; }
/// <summary>
/// Supports buffer under-run free recording
/// </summary>
public bool BUF { get; set; }
/// <summary>
/// Selected rotational control
/// </summary>
public byte RotationControlSelected { get; set; }
/// <summary>
/// Current write speed selected
/// </summary>
public ushort CurrentWriteSpeedSelected { get; set; }
/// <summary>
/// Database ID
/// </summary>
[JsonIgnore, Key]
public int Id { get; set; }
/// <summary>
/// Decodes the page 2Ah of a MODE SENSE response
/// </summary>
/// <param name="pageResponse">Raw page 2Ah</param>
/// <returns>Decoded page 2Ah</returns>
public static ModePage_2A Decode(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
@@ -242,6 +337,11 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
return decoded;
}
/// <summary>
/// Encodes a page 2Ah of a MODE SENSE response
/// </summary>
/// <param name="decoded">Decoded page 2Ah</param>
/// <returns>Raw page 2Ah</returns>
public static byte[] Encode(ModePage_2A decoded)
{
byte[] pageResponse = new byte[512];
@@ -464,10 +564,19 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
}
}
/// <summary>
/// Page 2Ah write descriptor
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public struct ModePage_2A_WriteDescriptor
{
/// <summary>
/// Rotational control
/// </summary>
public byte RotationControl;
/// <summary>
/// Write speed
/// </summary>
public ushort WriteSpeed;
}
#endregion Mode Page 0x2A: CD-ROM capabilities page