mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix linear memory mapping structure.
This commit is contained in:
116
Enums/Images.cs
116
Enums/Images.cs
@@ -42,11 +42,11 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
namespace Aaru.CommonTypes.Enums
|
||||
namespace Aaru.CommonTypes.Enums;
|
||||
|
||||
/// <summary>Track (as partitioning element) types.</summary>
|
||||
public enum TrackType : byte
|
||||
{
|
||||
/// <summary>Track (as partitioning element) types.</summary>
|
||||
public enum TrackType : byte
|
||||
{
|
||||
/// <summary>Audio track</summary>
|
||||
Audio = 0,
|
||||
/// <summary>Data track (not any of the below defined ones)</summary>
|
||||
@@ -59,11 +59,11 @@ namespace Aaru.CommonTypes.Enums
|
||||
CdMode2Form1 = 4,
|
||||
/// <summary>Data track, compact disc mode 2, form 2</summary>
|
||||
CdMode2Form2 = 5
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Type of subchannel in track</summary>
|
||||
public enum TrackSubchannelType : byte
|
||||
{
|
||||
/// <summary>Type of subchannel in track</summary>
|
||||
public enum TrackSubchannelType : byte
|
||||
{
|
||||
/// <summary>Track does not has subchannel dumped, or it's not a CD</summary>
|
||||
None = 0,
|
||||
/// <summary>Subchannel is packed and error corrected</summary>
|
||||
@@ -78,11 +78,11 @@ namespace Aaru.CommonTypes.Enums
|
||||
Q16 = 5,
|
||||
/// <summary>Only Q subchannel is stored as 16 bytes and comes interleaved with main channel in same file</summary>
|
||||
Q16Interleaved = 6
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Metadata present for each sector (aka, "tag").</summary>
|
||||
public enum SectorTagType
|
||||
{
|
||||
/// <summary>Metadata present for each sector (aka, "tag").</summary>
|
||||
public enum SectorTagType
|
||||
{
|
||||
/// <summary>Apple's GCR sector tags, 12 bytes</summary>
|
||||
AppleSectorTag = 0,
|
||||
/// <summary>Sync frame from CD sector, 12 bytes</summary>
|
||||
@@ -115,12 +115,12 @@ namespace Aaru.CommonTypes.Enums
|
||||
DvdTitleKey = 14,
|
||||
/// <summary>Decrypted DVD sector title key, 5 bytes</summary>
|
||||
DvdTitleKeyDecrypted = 15
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Metadata present for each media.</summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum MediaTagType
|
||||
{
|
||||
/// <summary>Metadata present for each media.</summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum MediaTagType
|
||||
{
|
||||
/// <summary>CD table of contents</summary>
|
||||
CD_TOC = 0,
|
||||
/// <summary>CD session information</summary>
|
||||
@@ -272,11 +272,11 @@ namespace Aaru.CommonTypes.Enums
|
||||
MiniDiscDTOC = 72,
|
||||
/// <summary>Decrypted DVD disc key</summary>
|
||||
DVD_DiscKey_Decrypted = 73
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Enumeration of media types defined in CICM metadata</summary>
|
||||
public enum XmlMediaType : byte
|
||||
{
|
||||
/// <summary>Enumeration of media types defined in CICM metadata</summary>
|
||||
public enum XmlMediaType : byte
|
||||
{
|
||||
/// <summary>Purely optical discs</summary>
|
||||
OpticalDisc = 0,
|
||||
/// <summary>Media that is physically block-based or abstracted like that</summary>
|
||||
@@ -285,12 +285,12 @@ namespace Aaru.CommonTypes.Enums
|
||||
LinearMedia = 2,
|
||||
/// <summary>Media that can only store data when it is modulated to audio</summary>
|
||||
AudioMedia = 3
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> CD flags bitmask</summary>
|
||||
[Flags]
|
||||
public enum CdFlags : byte
|
||||
{
|
||||
/// <summary> CD flags bitmask</summary>
|
||||
[Flags]
|
||||
public enum CdFlags : byte
|
||||
{
|
||||
/// <summary>Track is quadraphonic.</summary>
|
||||
FourChannel = 0x08,
|
||||
/// <summary>Track is non-audio (data).</summary>
|
||||
@@ -299,12 +299,12 @@ namespace Aaru.CommonTypes.Enums
|
||||
CopyPermitted = 0x02,
|
||||
/// <summary>Track has pre-emphasis.</summary>
|
||||
PreEmphasis = 0x01
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Status of a requested floppy sector</summary>
|
||||
[Flags]
|
||||
public enum FloppySectorStatus : byte
|
||||
{
|
||||
/// <summary>Status of a requested floppy sector</summary>
|
||||
[Flags]
|
||||
public enum FloppySectorStatus : byte
|
||||
{
|
||||
/// <summary>Both address mark and data checksums are correct.</summary>
|
||||
Correct = 0x01,
|
||||
/// <summary>Data checksum is incorrect.</summary>
|
||||
@@ -319,11 +319,11 @@ namespace Aaru.CommonTypes.Enums
|
||||
Hole = 0x20,
|
||||
/// <summary>There is no address mark containing the requested sector id in the track/head.</summary>
|
||||
NotFound = 0x40
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Types of floppy disks</summary>
|
||||
public enum FloppyTypes : byte
|
||||
{
|
||||
/// <summary>Types of floppy disks</summary>
|
||||
public enum FloppyTypes : byte
|
||||
{
|
||||
/// <summary>8" floppy</summary>
|
||||
Floppy,
|
||||
/// <summary>5.25" floppy</summary>
|
||||
@@ -336,11 +336,11 @@ namespace Aaru.CommonTypes.Enums
|
||||
FileWare,
|
||||
/// <summary>2.5" quickdisk</summary>
|
||||
QuickDisk
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Enumeration of floppy densities</summary>
|
||||
public enum FloppyDensities : byte
|
||||
{
|
||||
/// <summary>Enumeration of floppy densities</summary>
|
||||
public enum FloppyDensities : byte
|
||||
{
|
||||
/// <summary>Standard coercivity (about 300Oe as found in 8" and 5.25"-double-density disks).</summary>
|
||||
Standard,
|
||||
/// <summary>Double density coercivity (about 600Oe as found in 5.25" HD and 3.5" DD disks).</summary>
|
||||
@@ -349,12 +349,12 @@ namespace Aaru.CommonTypes.Enums
|
||||
High,
|
||||
/// <summary>Extended density coercivity (about 750Oe as found in 3.5" ED disks).</summary>
|
||||
Extended
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Capabilities for optical media image formats</summary>
|
||||
[Flags]
|
||||
public enum OpticalImageCapabilities : ulong
|
||||
{
|
||||
/// <summary>Capabilities for optical media image formats</summary>
|
||||
[Flags]
|
||||
public enum OpticalImageCapabilities : ulong
|
||||
{
|
||||
/// <summary>Can store Red Book audio tracks?</summary>
|
||||
CanStoreAudioTracks = 0x01,
|
||||
/// <summary>Can store CD-V analogue video tracks?</summary>
|
||||
@@ -389,5 +389,31 @@ namespace Aaru.CommonTypes.Enums
|
||||
CanStoreCookedData = 0x800,
|
||||
/// <summary>Can store more than 1 track?</summary>
|
||||
CanStoreMultipleTracks = 0x1000
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Enumeration of linear memory device types</summary>
|
||||
public enum LinearMemoryType
|
||||
{
|
||||
/// <summary>Unknown device type</summary>
|
||||
Unknown = 0,
|
||||
/// <summary>Read-only memory</summary>
|
||||
ROM = 1,
|
||||
/// <summary>Read-write memory, power-off persistent, used to save data</summary>
|
||||
SaveRAM = 2,
|
||||
/// <summary>Read-write volatile memory</summary>
|
||||
WorkRAM = 3,
|
||||
/// <summary>NOR flash memory</summary>
|
||||
NOR = 4,
|
||||
/// <summary>NAND flash memory</summary>
|
||||
NAND = 5,
|
||||
/// <summary>Memory mapper device</summary>
|
||||
Mapper = 6,
|
||||
/// <summary>Processor, CPU, DSP, etc</summary>
|
||||
Processor = 7,
|
||||
/// <summary>Programmable Array Logic</summary>
|
||||
PAL = 8,
|
||||
/// <summary>Generic Array Logic</summary>
|
||||
GAL = 9,
|
||||
/// <summary>Electronically Erasable Programmable Read Only Memory</summary>
|
||||
EEPROM = 10
|
||||
}
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces;
|
||||
|
||||
@@ -63,7 +64,7 @@ public interface IByteAddressableImage : IBaseWritableImage
|
||||
/// <summary>Gets the linear memory mappings, e.g. interleaving, starting address, etc.</summary>
|
||||
/// <param name="mappings">Format still not decided</param>
|
||||
/// <returns>Error number</returns>
|
||||
ErrorNumber GetMappings(out object mappings);
|
||||
ErrorNumber GetMappings(out LinearMemoryMap mappings);
|
||||
|
||||
/// <summary>Reads a byte from the image</summary>
|
||||
/// <param name="b">The byte read</param>
|
||||
@@ -106,7 +107,7 @@ public interface IByteAddressableImage : IBaseWritableImage
|
||||
/// <summary>Sets the linear memory mappings, e.g. interleaving, starting address, etc.</summary>
|
||||
/// <param name="mappings">Format still not decided</param>
|
||||
/// <returns>Error number</returns>
|
||||
ErrorNumber SetMappings(object mappings);
|
||||
ErrorNumber SetMappings(LinearMemoryMap mappings);
|
||||
|
||||
/// <summary>Writes a byte to the image</summary>
|
||||
/// <param name="b">The byte to be written</param>
|
||||
|
||||
@@ -38,14 +38,15 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.CommonTypes.Structs
|
||||
namespace Aaru.CommonTypes.Structs;
|
||||
|
||||
/// <summary>Contains information about a dump image and its contents</summary>
|
||||
public struct ImageInfo
|
||||
{
|
||||
/// <summary>Contains information about a dump image and its contents</summary>
|
||||
public struct ImageInfo
|
||||
{
|
||||
/// <summary>Image contains partitions (or tracks for optical media)</summary>
|
||||
public bool HasPartitions;
|
||||
/// <summary>Image contains sessions (optical media only)</summary>
|
||||
@@ -110,11 +111,11 @@ namespace Aaru.CommonTypes.Structs
|
||||
public uint Heads;
|
||||
/// <summary>Sectors per track of the media represented by the image (for variable image, the smallest)</summary>
|
||||
public uint SectorsPerTrack;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Session defining structure.</summary>
|
||||
public struct Session
|
||||
{
|
||||
/// <summary>Session defining structure.</summary>
|
||||
public struct Session
|
||||
{
|
||||
/// <summary>Session number, 1-started</summary>
|
||||
public ushort Sequence;
|
||||
/// <summary>First track present on this session</summary>
|
||||
@@ -125,11 +126,11 @@ namespace Aaru.CommonTypes.Structs
|
||||
public ulong StartSector;
|
||||
/// <summary>Last sector present on this session</summary>
|
||||
public ulong EndSector;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Track defining structure.</summary>
|
||||
public class Track
|
||||
{
|
||||
/// <summary>Track defining structure.</summary>
|
||||
public class Track
|
||||
{
|
||||
/// <summary>How many main channel / user data bytes are per sector in this track</summary>
|
||||
public int BytesPerSector;
|
||||
/// <summary>Information that does not find space in this struct</summary>
|
||||
@@ -169,11 +170,11 @@ namespace Aaru.CommonTypes.Structs
|
||||
|
||||
/// <summary>Initializes an empty instance of this structure</summary>
|
||||
public Track() => Indexes = new Dictionary<ushort, int>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Floppy physical characteristics structure.</summary>
|
||||
public struct FloppyInfo
|
||||
{
|
||||
/// <summary>Floppy physical characteristics structure.</summary>
|
||||
public struct FloppyInfo
|
||||
{
|
||||
/// <summary>Physical floppy type.</summary>
|
||||
public FloppyTypes Type;
|
||||
/// <summary>Bitrate in bits per second used to write the floppy, 0 if unknown or track-variable.</summary>
|
||||
@@ -186,5 +187,59 @@ namespace Aaru.CommonTypes.Structs
|
||||
public byte Heads;
|
||||
/// <summary>How many tracks per inch are actually written in the floppy image.</summary>
|
||||
public ushort TrackDensity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Provides a map for linear memory structure</summary>
|
||||
public struct LinearMemoryMap
|
||||
{
|
||||
/// <summary>List of devices that are mapped to linear memory</summary>
|
||||
[NotNull]
|
||||
public LinearMemoryDevice[] Devices { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Provides information about a linear memory device</summary>
|
||||
public struct LinearMemoryDevice
|
||||
{
|
||||
/// <summary>Device manufacturer</summary>
|
||||
public string Manufacturer { get; set; }
|
||||
/// <summary>Device model</summary>
|
||||
public string Model { get; set; }
|
||||
/// <summary>Device package, e.g. DIP28</summary>
|
||||
public string Package { get; set; }
|
||||
/// <summary>Device location marking in PCB, e.g. U28</summary>
|
||||
public string Location { get; set; }
|
||||
/// <summary>Device functional type</summary>
|
||||
public LinearMemoryType Type { get; set; }
|
||||
/// <summary>Arbitrary device information</summary>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// Physical addressing is the address considering all devices in the linear memory media, starting at the lowest
|
||||
/// marking in PCB and going up incrementally. This is the view of the memory inside Aaru.
|
||||
/// </summary>
|
||||
public LinearMemoryAddressing PhysicalAddress { get; set; }
|
||||
/// <summary>
|
||||
/// Virtual addressing is the address as seen by the hardware directly accessing the linear memory media. This
|
||||
/// allows devices to be overlapped or banked.
|
||||
/// </summary>
|
||||
public LinearMemoryAddressing VirtualAddress { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Maps the addressing of a linear memory device</summary>
|
||||
public class LinearMemoryAddressing
|
||||
{
|
||||
/// <summary>Start in memory where the device is mapped</summary>
|
||||
public ulong Start { get; set; }
|
||||
/// <summary>Length in bytes of the device, not including interleaving</summary>
|
||||
public ulong Length { get; set; }
|
||||
/// <summary>Interleaving information</summary>
|
||||
public LinearMemoryInterleave Interleave { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>Provides information about a device interleaving</summary>
|
||||
public class LinearMemoryInterleave
|
||||
{
|
||||
/// <summary>How many bytes to skip from start of map before device first byte starts</summary>
|
||||
public uint Offset { get; set; }
|
||||
/// <summary>How many bytes in memory to skip every device byte</summary>
|
||||
public uint Value { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user