mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Code cleanup.
This commit is contained in:
@@ -37,23 +37,24 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
{
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba,
|
||||
uint timeout, out double duration)
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersLba28 registers = new AtaRegistersLba28
|
||||
{
|
||||
Command = (byte)AtaCommands.TranslateSector,
|
||||
Command = (byte)AtaCommands.TranslateSector,
|
||||
DeviceHead = (byte)((lba & 0xF000000) / 0x1000000),
|
||||
LbaHigh = (byte)((lba & 0xFF0000) / 0x10000),
|
||||
LbaMid = (byte)((lba & 0xFF00) / 0x100),
|
||||
LbaLow = (byte)((lba & 0xFF) / 0x1)
|
||||
LbaHigh = (byte)((lba & 0xFF0000) / 0x10000),
|
||||
LbaMid = (byte)((lba & 0xFF00) / 0x100),
|
||||
LbaLow = (byte)((lba & 0xFF) / 0x1)
|
||||
};
|
||||
|
||||
registers.DeviceHead += 0x40;
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false,
|
||||
out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
@@ -63,20 +64,22 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersChs statusRegisters, ushort cylinder,
|
||||
byte head, byte sector, uint timeout, out double duration)
|
||||
byte head, byte sector, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = new byte[512];
|
||||
AtaRegistersChs registers = new AtaRegistersChs
|
||||
{
|
||||
Command = (byte)AtaCommands.TranslateSector,
|
||||
Command = (byte)AtaCommands.TranslateSector,
|
||||
CylinderHigh = (byte)((cylinder & 0xFF00) / 0x100),
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
Sector = sector,
|
||||
DeviceHead = (byte)(head & 0x0F)
|
||||
CylinderLow = (byte)((cylinder & 0xFF) / 0x1),
|
||||
Sector = sector,
|
||||
DeviceHead = (byte)(head & 0x0F)
|
||||
};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false,
|
||||
out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
@@ -86,13 +89,14 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
public bool RequestExtendedErrorCode(out byte errorCode, out AtaErrorRegistersLba28 statusRegisters,
|
||||
uint timeout, out double duration)
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
byte[] buffer = new byte[0];
|
||||
byte[] buffer = new byte[0];
|
||||
AtaRegistersLba28 registers = new AtaRegistersLba28 {Command = (byte)AtaCommands.RequestSense};
|
||||
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
|
||||
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
|
||||
AtaTransferRegister.NoTransfer, ref buffer, timeout, false,
|
||||
out duration,
|
||||
out bool sense);
|
||||
Error = LastError != 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user