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
|
// 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>
|
/// <summary>Audio track</summary>
|
||||||
Audio = 0,
|
Audio = 0,
|
||||||
/// <summary>Data track (not any of the below defined ones)</summary>
|
/// <summary>Data track (not any of the below defined ones)</summary>
|
||||||
@@ -59,11 +59,11 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
CdMode2Form1 = 4,
|
CdMode2Form1 = 4,
|
||||||
/// <summary>Data track, compact disc mode 2, form 2</summary>
|
/// <summary>Data track, compact disc mode 2, form 2</summary>
|
||||||
CdMode2Form2 = 5
|
CdMode2Form2 = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Type of subchannel in track</summary>
|
/// <summary>Type of subchannel in track</summary>
|
||||||
public enum TrackSubchannelType : byte
|
public enum TrackSubchannelType : byte
|
||||||
{
|
{
|
||||||
/// <summary>Track does not has subchannel dumped, or it's not a CD</summary>
|
/// <summary>Track does not has subchannel dumped, or it's not a CD</summary>
|
||||||
None = 0,
|
None = 0,
|
||||||
/// <summary>Subchannel is packed and error corrected</summary>
|
/// <summary>Subchannel is packed and error corrected</summary>
|
||||||
@@ -78,11 +78,11 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
Q16 = 5,
|
Q16 = 5,
|
||||||
/// <summary>Only Q subchannel is stored as 16 bytes and comes interleaved with main channel in same file</summary>
|
/// <summary>Only Q subchannel is stored as 16 bytes and comes interleaved with main channel in same file</summary>
|
||||||
Q16Interleaved = 6
|
Q16Interleaved = 6
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Metadata present for each sector (aka, "tag").</summary>
|
/// <summary>Metadata present for each sector (aka, "tag").</summary>
|
||||||
public enum SectorTagType
|
public enum SectorTagType
|
||||||
{
|
{
|
||||||
/// <summary>Apple's GCR sector tags, 12 bytes</summary>
|
/// <summary>Apple's GCR sector tags, 12 bytes</summary>
|
||||||
AppleSectorTag = 0,
|
AppleSectorTag = 0,
|
||||||
/// <summary>Sync frame from CD sector, 12 bytes</summary>
|
/// <summary>Sync frame from CD sector, 12 bytes</summary>
|
||||||
@@ -115,12 +115,12 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
DvdTitleKey = 14,
|
DvdTitleKey = 14,
|
||||||
/// <summary>Decrypted DVD sector title key, 5 bytes</summary>
|
/// <summary>Decrypted DVD sector title key, 5 bytes</summary>
|
||||||
DvdTitleKeyDecrypted = 15
|
DvdTitleKeyDecrypted = 15
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Metadata present for each media.</summary>
|
/// <summary>Metadata present for each media.</summary>
|
||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public enum MediaTagType
|
public enum MediaTagType
|
||||||
{
|
{
|
||||||
/// <summary>CD table of contents</summary>
|
/// <summary>CD table of contents</summary>
|
||||||
CD_TOC = 0,
|
CD_TOC = 0,
|
||||||
/// <summary>CD session information</summary>
|
/// <summary>CD session information</summary>
|
||||||
@@ -272,11 +272,11 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
MiniDiscDTOC = 72,
|
MiniDiscDTOC = 72,
|
||||||
/// <summary>Decrypted DVD disc key</summary>
|
/// <summary>Decrypted DVD disc key</summary>
|
||||||
DVD_DiscKey_Decrypted = 73
|
DVD_DiscKey_Decrypted = 73
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Enumeration of media types defined in CICM metadata</summary>
|
/// <summary>Enumeration of media types defined in CICM metadata</summary>
|
||||||
public enum XmlMediaType : byte
|
public enum XmlMediaType : byte
|
||||||
{
|
{
|
||||||
/// <summary>Purely optical discs</summary>
|
/// <summary>Purely optical discs</summary>
|
||||||
OpticalDisc = 0,
|
OpticalDisc = 0,
|
||||||
/// <summary>Media that is physically block-based or abstracted like that</summary>
|
/// <summary>Media that is physically block-based or abstracted like that</summary>
|
||||||
@@ -285,12 +285,12 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
LinearMedia = 2,
|
LinearMedia = 2,
|
||||||
/// <summary>Media that can only store data when it is modulated to audio</summary>
|
/// <summary>Media that can only store data when it is modulated to audio</summary>
|
||||||
AudioMedia = 3
|
AudioMedia = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> CD flags bitmask</summary>
|
/// <summary> CD flags bitmask</summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum CdFlags : byte
|
public enum CdFlags : byte
|
||||||
{
|
{
|
||||||
/// <summary>Track is quadraphonic.</summary>
|
/// <summary>Track is quadraphonic.</summary>
|
||||||
FourChannel = 0x08,
|
FourChannel = 0x08,
|
||||||
/// <summary>Track is non-audio (data).</summary>
|
/// <summary>Track is non-audio (data).</summary>
|
||||||
@@ -299,12 +299,12 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
CopyPermitted = 0x02,
|
CopyPermitted = 0x02,
|
||||||
/// <summary>Track has pre-emphasis.</summary>
|
/// <summary>Track has pre-emphasis.</summary>
|
||||||
PreEmphasis = 0x01
|
PreEmphasis = 0x01
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Status of a requested floppy sector</summary>
|
/// <summary>Status of a requested floppy sector</summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum FloppySectorStatus : byte
|
public enum FloppySectorStatus : byte
|
||||||
{
|
{
|
||||||
/// <summary>Both address mark and data checksums are correct.</summary>
|
/// <summary>Both address mark and data checksums are correct.</summary>
|
||||||
Correct = 0x01,
|
Correct = 0x01,
|
||||||
/// <summary>Data checksum is incorrect.</summary>
|
/// <summary>Data checksum is incorrect.</summary>
|
||||||
@@ -319,11 +319,11 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
Hole = 0x20,
|
Hole = 0x20,
|
||||||
/// <summary>There is no address mark containing the requested sector id in the track/head.</summary>
|
/// <summary>There is no address mark containing the requested sector id in the track/head.</summary>
|
||||||
NotFound = 0x40
|
NotFound = 0x40
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Types of floppy disks</summary>
|
/// <summary>Types of floppy disks</summary>
|
||||||
public enum FloppyTypes : byte
|
public enum FloppyTypes : byte
|
||||||
{
|
{
|
||||||
/// <summary>8" floppy</summary>
|
/// <summary>8" floppy</summary>
|
||||||
Floppy,
|
Floppy,
|
||||||
/// <summary>5.25" floppy</summary>
|
/// <summary>5.25" floppy</summary>
|
||||||
@@ -336,11 +336,11 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
FileWare,
|
FileWare,
|
||||||
/// <summary>2.5" quickdisk</summary>
|
/// <summary>2.5" quickdisk</summary>
|
||||||
QuickDisk
|
QuickDisk
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Enumeration of floppy densities</summary>
|
/// <summary>Enumeration of floppy densities</summary>
|
||||||
public enum FloppyDensities : byte
|
public enum FloppyDensities : byte
|
||||||
{
|
{
|
||||||
/// <summary>Standard coercivity (about 300Oe as found in 8" and 5.25"-double-density disks).</summary>
|
/// <summary>Standard coercivity (about 300Oe as found in 8" and 5.25"-double-density disks).</summary>
|
||||||
Standard,
|
Standard,
|
||||||
/// <summary>Double density coercivity (about 600Oe as found in 5.25" HD and 3.5" DD disks).</summary>
|
/// <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,
|
High,
|
||||||
/// <summary>Extended density coercivity (about 750Oe as found in 3.5" ED disks).</summary>
|
/// <summary>Extended density coercivity (about 750Oe as found in 3.5" ED disks).</summary>
|
||||||
Extended
|
Extended
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Capabilities for optical media image formats</summary>
|
/// <summary>Capabilities for optical media image formats</summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum OpticalImageCapabilities : ulong
|
public enum OpticalImageCapabilities : ulong
|
||||||
{
|
{
|
||||||
/// <summary>Can store Red Book audio tracks?</summary>
|
/// <summary>Can store Red Book audio tracks?</summary>
|
||||||
CanStoreAudioTracks = 0x01,
|
CanStoreAudioTracks = 0x01,
|
||||||
/// <summary>Can store CD-V analogue video tracks?</summary>
|
/// <summary>Can store CD-V analogue video tracks?</summary>
|
||||||
@@ -389,5 +389,31 @@ namespace Aaru.CommonTypes.Enums
|
|||||||
CanStoreCookedData = 0x800,
|
CanStoreCookedData = 0x800,
|
||||||
/// <summary>Can store more than 1 track?</summary>
|
/// <summary>Can store more than 1 track?</summary>
|
||||||
CanStoreMultipleTracks = 0x1000
|
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 System.Collections.Generic;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
|
using Aaru.CommonTypes.Structs;
|
||||||
|
|
||||||
namespace Aaru.CommonTypes.Interfaces;
|
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>
|
/// <summary>Gets the linear memory mappings, e.g. interleaving, starting address, etc.</summary>
|
||||||
/// <param name="mappings">Format still not decided</param>
|
/// <param name="mappings">Format still not decided</param>
|
||||||
/// <returns>Error number</returns>
|
/// <returns>Error number</returns>
|
||||||
ErrorNumber GetMappings(out object mappings);
|
ErrorNumber GetMappings(out LinearMemoryMap mappings);
|
||||||
|
|
||||||
/// <summary>Reads a byte from the image</summary>
|
/// <summary>Reads a byte from the image</summary>
|
||||||
/// <param name="b">The byte read</param>
|
/// <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>
|
/// <summary>Sets the linear memory mappings, e.g. interleaving, starting address, etc.</summary>
|
||||||
/// <param name="mappings">Format still not decided</param>
|
/// <param name="mappings">Format still not decided</param>
|
||||||
/// <returns>Error number</returns>
|
/// <returns>Error number</returns>
|
||||||
ErrorNumber SetMappings(object mappings);
|
ErrorNumber SetMappings(LinearMemoryMap mappings);
|
||||||
|
|
||||||
/// <summary>Writes a byte to the image</summary>
|
/// <summary>Writes a byte to the image</summary>
|
||||||
/// <param name="b">The byte to be written</param>
|
/// <param name="b">The byte to be written</param>
|
||||||
|
|||||||
@@ -38,14 +38,15 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Aaru.CommonTypes.Enums;
|
using Aaru.CommonTypes.Enums;
|
||||||
using Aaru.CommonTypes.Interfaces;
|
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>
|
/// <summary>Image contains partitions (or tracks for optical media)</summary>
|
||||||
public bool HasPartitions;
|
public bool HasPartitions;
|
||||||
/// <summary>Image contains sessions (optical media only)</summary>
|
/// <summary>Image contains sessions (optical media only)</summary>
|
||||||
@@ -110,11 +111,11 @@ namespace Aaru.CommonTypes.Structs
|
|||||||
public uint Heads;
|
public uint Heads;
|
||||||
/// <summary>Sectors per track of the media represented by the image (for variable image, the smallest)</summary>
|
/// <summary>Sectors per track of the media represented by the image (for variable image, the smallest)</summary>
|
||||||
public uint SectorsPerTrack;
|
public uint SectorsPerTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Session defining structure.</summary>
|
/// <summary>Session defining structure.</summary>
|
||||||
public struct Session
|
public struct Session
|
||||||
{
|
{
|
||||||
/// <summary>Session number, 1-started</summary>
|
/// <summary>Session number, 1-started</summary>
|
||||||
public ushort Sequence;
|
public ushort Sequence;
|
||||||
/// <summary>First track present on this session</summary>
|
/// <summary>First track present on this session</summary>
|
||||||
@@ -125,11 +126,11 @@ namespace Aaru.CommonTypes.Structs
|
|||||||
public ulong StartSector;
|
public ulong StartSector;
|
||||||
/// <summary>Last sector present on this session</summary>
|
/// <summary>Last sector present on this session</summary>
|
||||||
public ulong EndSector;
|
public ulong EndSector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Track defining structure.</summary>
|
/// <summary>Track defining structure.</summary>
|
||||||
public class Track
|
public class Track
|
||||||
{
|
{
|
||||||
/// <summary>How many main channel / user data bytes are per sector in this track</summary>
|
/// <summary>How many main channel / user data bytes are per sector in this track</summary>
|
||||||
public int BytesPerSector;
|
public int BytesPerSector;
|
||||||
/// <summary>Information that does not find space in this struct</summary>
|
/// <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>
|
/// <summary>Initializes an empty instance of this structure</summary>
|
||||||
public Track() => Indexes = new Dictionary<ushort, int>();
|
public Track() => Indexes = new Dictionary<ushort, int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Floppy physical characteristics structure.</summary>
|
/// <summary>Floppy physical characteristics structure.</summary>
|
||||||
public struct FloppyInfo
|
public struct FloppyInfo
|
||||||
{
|
{
|
||||||
/// <summary>Physical floppy type.</summary>
|
/// <summary>Physical floppy type.</summary>
|
||||||
public FloppyTypes Type;
|
public FloppyTypes Type;
|
||||||
/// <summary>Bitrate in bits per second used to write the floppy, 0 if unknown or track-variable.</summary>
|
/// <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;
|
public byte Heads;
|
||||||
/// <summary>How many tracks per inch are actually written in the floppy image.</summary>
|
/// <summary>How many tracks per inch are actually written in the floppy image.</summary>
|
||||||
public ushort TrackDensity;
|
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