mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add packets for SCSI, ATA and SDHCI commands.
This commit is contained in:
@@ -30,8 +30,11 @@
|
|||||||
// Copyright © 2011-2019 Natalia Portillo
|
// Copyright © 2011-2019 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace DiscImageChef.Decoders.ATA
|
namespace DiscImageChef.Decoders.ATA
|
||||||
{
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
public struct AtaRegistersChs
|
public struct AtaRegistersChs
|
||||||
{
|
{
|
||||||
public byte Feature;
|
public byte Feature;
|
||||||
@@ -43,6 +46,7 @@ namespace DiscImageChef.Decoders.ATA
|
|||||||
public byte Command;
|
public byte Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
public struct AtaRegistersLba28
|
public struct AtaRegistersLba28
|
||||||
{
|
{
|
||||||
public byte Feature;
|
public byte Feature;
|
||||||
@@ -54,6 +58,7 @@ namespace DiscImageChef.Decoders.ATA
|
|||||||
public byte Command;
|
public byte Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
public struct AtaRegistersLba48
|
public struct AtaRegistersLba48
|
||||||
{
|
{
|
||||||
public ushort Feature;
|
public ushort Feature;
|
||||||
@@ -61,10 +66,11 @@ namespace DiscImageChef.Decoders.ATA
|
|||||||
public ushort LbaLow;
|
public ushort LbaLow;
|
||||||
public ushort LbaMid;
|
public ushort LbaMid;
|
||||||
public ushort LbaHigh;
|
public ushort LbaHigh;
|
||||||
public byte DeviceHead;
|
public byte DeviceHead;
|
||||||
public byte Command;
|
public byte Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
public struct AtaErrorRegistersChs
|
public struct AtaErrorRegistersChs
|
||||||
{
|
{
|
||||||
public byte Status;
|
public byte Status;
|
||||||
@@ -76,6 +82,7 @@ namespace DiscImageChef.Decoders.ATA
|
|||||||
public byte DeviceHead;
|
public byte DeviceHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
public struct AtaErrorRegistersLba28
|
public struct AtaErrorRegistersLba28
|
||||||
{
|
{
|
||||||
public byte Status;
|
public byte Status;
|
||||||
@@ -87,14 +94,15 @@ namespace DiscImageChef.Decoders.ATA
|
|||||||
public byte DeviceHead;
|
public byte DeviceHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
public struct AtaErrorRegistersLba48
|
public struct AtaErrorRegistersLba48
|
||||||
{
|
{
|
||||||
public byte Status;
|
public byte Status;
|
||||||
public byte Error;
|
public byte Error;
|
||||||
public ushort SectorCount;
|
public ushort SectorCount;
|
||||||
public ushort LbaLow;
|
public ushort LbaLow;
|
||||||
public ushort LbaMid;
|
public ushort LbaMid;
|
||||||
public ushort LbaHigh;
|
public ushort LbaHigh;
|
||||||
public byte DeviceHead;
|
public byte DeviceHead;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,17 @@ namespace DiscImageChef.Devices.Remote
|
|||||||
Hello = 1,
|
Hello = 1,
|
||||||
CommandListDevices = 2,
|
CommandListDevices = 2,
|
||||||
ResponseListDevices = 3,
|
ResponseListDevices = 3,
|
||||||
CommandOpen = 4
|
CommandOpen = 4,
|
||||||
|
CommandScsi = 5,
|
||||||
|
ResponseScsi = 6,
|
||||||
|
CommandAtaChs = 7,
|
||||||
|
ResponseAtaChs = 8,
|
||||||
|
CommandAtaLba28 = 9,
|
||||||
|
ResponseAtaLba28 = 10,
|
||||||
|
CommandAtaLba48 = 11,
|
||||||
|
ResponseAtaLba48 = 12,
|
||||||
|
CommandSdhci = 13,
|
||||||
|
ResponseSdhci = 14
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DicNopReason : byte
|
public enum DicNopReason : byte
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using DiscImageChef.Decoders.ATA;
|
||||||
|
|
||||||
namespace DiscImageChef.Devices.Remote
|
namespace DiscImageChef.Devices.Remote
|
||||||
{
|
{
|
||||||
@@ -77,4 +78,127 @@ namespace DiscImageChef.Devices.Remote
|
|||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
|
||||||
public string device_path;
|
public string device_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketCmdScsi
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint cdb_len;
|
||||||
|
public uint buf_len;
|
||||||
|
public int direction;
|
||||||
|
public uint timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketResScsi
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint sense_len;
|
||||||
|
public uint buf_len;
|
||||||
|
public uint duration;
|
||||||
|
public uint sense;
|
||||||
|
public uint errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketCmdAtaChs
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint buf_len;
|
||||||
|
public AtaRegistersChs registers;
|
||||||
|
public byte protocol;
|
||||||
|
public byte transferRegister;
|
||||||
|
public byte transferBlocks;
|
||||||
|
public byte spare;
|
||||||
|
public uint timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketResAtaChs
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint buf_len;
|
||||||
|
public AtaErrorRegistersChs registers;
|
||||||
|
public uint duration;
|
||||||
|
public uint sense;
|
||||||
|
public uint errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketCmdAtaLba28
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint buf_len;
|
||||||
|
public AtaRegistersLba28 registers;
|
||||||
|
public byte protocol;
|
||||||
|
public byte transferRegister;
|
||||||
|
public byte transferBlocks;
|
||||||
|
public byte spare;
|
||||||
|
public uint timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketResAtaLba28
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint buf_len;
|
||||||
|
public AtaErrorRegistersLba28 registers;
|
||||||
|
public uint duration;
|
||||||
|
public uint sense;
|
||||||
|
public uint errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketCmdAtaLba48
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint buf_len;
|
||||||
|
public AtaRegistersLba48 registers;
|
||||||
|
public byte protocol;
|
||||||
|
public byte transferRegister;
|
||||||
|
public byte transferBlocks;
|
||||||
|
public byte spare;
|
||||||
|
public uint timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketResAtaLba48
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint buf_len;
|
||||||
|
public AtaErrorRegistersLba48 registers;
|
||||||
|
public uint duration;
|
||||||
|
public uint sense;
|
||||||
|
public uint errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketCmdSdhci
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public MmcCommands command;
|
||||||
|
[MarshalAs(UnmanagedType.U1)] public bool write;
|
||||||
|
[MarshalAs(UnmanagedType.U1)] public bool application;
|
||||||
|
public MmcFlags flags;
|
||||||
|
public uint argument;
|
||||||
|
public uint block_size;
|
||||||
|
public uint blocks;
|
||||||
|
public uint buf_len;
|
||||||
|
public uint timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||||
|
public struct DicPacketResSdhci
|
||||||
|
{
|
||||||
|
public DicPacketHeader hdr;
|
||||||
|
public uint buf_len;
|
||||||
|
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||||
|
public uint[] response;
|
||||||
|
|
||||||
|
public uint duration;
|
||||||
|
public uint sense;
|
||||||
|
public uint errno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user