mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
* DiscImageChef.Devices/Structs.cs:
* DiscImageChef.Devices/DiscImageChef.Devices.csproj: Added structs with ATA registers. * DiscImageChef.Devices/Command.cs: * DiscImageChef.Devices/Device/Commands.cs: Added ATA commands. * DiscImageChef.Devices/Enums.cs: Added SCSI's ATA Command Pass-Through enumerations. * DiscImageChef.Devices/Linux/Command.cs: Added ATA commands using libATA's SATL.
This commit is contained in:
@@ -128,6 +128,102 @@ namespace DiscImageChef.Devices
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", ptID));
|
||||
}
|
||||
}
|
||||
|
||||
public static int SendAtaCommand(object fd, Structs.AtaRegistersCHS registers,
|
||||
out Structs.AtaErrorRegistersCHS errorRegisters, Enums.AtaProtocol protocol,
|
||||
Enums.AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
|
||||
|
||||
return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol,
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
public static int SendAtaCommand(Interop.PlatformID ptID, object fd, Structs.AtaRegistersCHS registers,
|
||||
out Structs.AtaErrorRegistersCHS errorRegisters, Enums.AtaProtocol protocol,
|
||||
Enums.AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
switch (ptID)
|
||||
{
|
||||
case Interop.PlatformID.Win32NT:
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
case Interop.PlatformID.Linux:
|
||||
{
|
||||
return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol,
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", ptID));
|
||||
}
|
||||
}
|
||||
|
||||
public static int SendAtaCommand(object fd, Structs.AtaRegistersLBA28 registers,
|
||||
out Structs.AtaErrorRegistersLBA28 errorRegisters, Enums.AtaProtocol protocol,
|
||||
Enums.AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
|
||||
|
||||
return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol,
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
public static int SendAtaCommand(Interop.PlatformID ptID, object fd, Structs.AtaRegistersLBA28 registers,
|
||||
out Structs.AtaErrorRegistersLBA28 errorRegisters, Enums.AtaProtocol protocol,
|
||||
Enums.AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
switch (ptID)
|
||||
{
|
||||
case Interop.PlatformID.Win32NT:
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
case Interop.PlatformID.Linux:
|
||||
{
|
||||
return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol,
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", ptID));
|
||||
}
|
||||
}
|
||||
|
||||
public static int SendAtaCommand(object fd, Structs.AtaRegistersLBA48 registers,
|
||||
out Structs.AtaErrorRegistersLBA48 errorRegisters, Enums.AtaProtocol protocol,
|
||||
Enums.AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
|
||||
|
||||
return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol,
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
|
||||
public static int SendAtaCommand(Interop.PlatformID ptID, object fd, Structs.AtaRegistersLBA48 registers,
|
||||
out Structs.AtaErrorRegistersLBA48 errorRegisters, Enums.AtaProtocol protocol,
|
||||
Enums.AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
|
||||
bool transferBlocks, out double duration, out bool sense)
|
||||
{
|
||||
switch (ptID)
|
||||
{
|
||||
case Interop.PlatformID.Win32NT:
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
case Interop.PlatformID.Linux:
|
||||
{
|
||||
return Linux.Command.SendAtaCommand((int)fd, registers, out errorRegisters, protocol,
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", ptID));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user