Move to file scoped namespaces.

This commit is contained in:
2022-03-06 13:29:38 +00:00
parent b6c3a54955
commit 0bc819feab
1322 changed files with 268651 additions and 270003 deletions

View File

@@ -4,78 +4,77 @@ using NUnit.Framework;
// ReSharper disable InconsistentNaming
namespace Aaru.Tests.Devices.MultiMediaCard
namespace Aaru.Tests.Devices.MultiMediaCard;
[TestFixture]
public class CID
{
[TestFixture]
public class CID
readonly string[] cards =
{
readonly string[] cards =
{
"mmc_6600_32mb", "mmc_pretec_32mb", "mmc_takems_256mb"
};
"mmc_6600_32mb", "mmc_pretec_32mb", "mmc_takems_256mb"
};
readonly string[] cids =
{
"15000030303030303007b20212909701", "06000033324d202020011923a457c601", "2c0000414620484d5010a9000b1a6801"
};
readonly string[] cids =
{
"15000030303030303007b20212909701", "06000033324d202020011923a457c601", "2c0000414620484d5010a9000b1a6801"
};
readonly byte[] manufacturers =
{
0x15, 0x06, 0x2c
};
readonly byte[] manufacturers =
{
0x15, 0x06, 0x2c
};
readonly ushort[] applications =
{
0, 0, 0
};
readonly ushort[] applications =
{
0, 0, 0
};
readonly string[] names =
{
"000000", "32M ", "AF HMP"
};
readonly string[] names =
{
"000000", "32M ", "AF HMP"
};
readonly byte[] revisions =
{
0x07, 0x01, 0x10
};
readonly byte[] revisions =
{
0x07, 0x01, 0x10
};
readonly uint[] serials =
{
0xb2021290, 0x1923a457, 0xa9000b1a
};
readonly uint[] serials =
{
0xb2021290, 0x1923a457, 0xa9000b1a
};
readonly byte[] dates =
{
0x97, 0xc6, 0x68
};
readonly byte[] dates =
{
0x97, 0xc6, 0x68
};
readonly byte[] crcs =
{
0x00, 0x00, 0x00
};
readonly byte[] crcs =
{
0x00, 0x00, 0x00
};
[Test]
public void Test()
[Test]
public void Test()
{
for(int i = 0; i < cards.Length; i++)
{
for(int i = 0; i < cards.Length; i++)
using(new AssertionScope())
{
using(new AssertionScope())
Assert.Multiple(() =>
{
Assert.Multiple(() =>
{
int count = Marshal.ConvertFromHexAscii(cids[i], out byte[] response);
Assert.AreEqual(16, count, $"Size - {cards[i]}");
Decoders.MMC.CID cid = Decoders.MMC.Decoders.DecodeCID(response);
Assert.IsNotNull(cid, $"Decoded - {cards[i]}");
Assert.AreEqual(manufacturers[i], cid.Manufacturer, $"Manufacturer - {cards[i]}");
Assert.AreEqual(applications[i], cid.ApplicationID, $"Application ID - {cards[i]}");
Assert.AreEqual(names[i], cid.ProductName, $"Product name - {cards[i]}");
Assert.AreEqual(revisions[i], cid.ProductRevision, $"Product revision - {cards[i]}");
Assert.AreEqual(serials[i], cid.ProductSerialNumber, $"Serial number - {cards[i]}");
Assert.AreEqual(dates[i], cid.ManufacturingDate, $"Manufacturing date - {cards[i]}");
Assert.AreEqual(crcs[i], cid.CRC, $"CRC - {cards[i]}");
});
}
int count = Marshal.ConvertFromHexAscii(cids[i], out byte[] response);
Assert.AreEqual(16, count, $"Size - {cards[i]}");
Decoders.MMC.CID cid = Decoders.MMC.Decoders.DecodeCID(response);
Assert.IsNotNull(cid, $"Decoded - {cards[i]}");
Assert.AreEqual(manufacturers[i], cid.Manufacturer, $"Manufacturer - {cards[i]}");
Assert.AreEqual(applications[i], cid.ApplicationID, $"Application ID - {cards[i]}");
Assert.AreEqual(names[i], cid.ProductName, $"Product name - {cards[i]}");
Assert.AreEqual(revisions[i], cid.ProductRevision, $"Product revision - {cards[i]}");
Assert.AreEqual(serials[i], cid.ProductSerialNumber, $"Serial number - {cards[i]}");
Assert.AreEqual(dates[i], cid.ManufacturingDate, $"Manufacturing date - {cards[i]}");
Assert.AreEqual(crcs[i], cid.CRC, $"CRC - {cards[i]}");
});
}
}
}

View File

@@ -4,255 +4,254 @@ using NUnit.Framework;
// ReSharper disable InconsistentNaming
namespace Aaru.Tests.Devices.MultiMediaCard
namespace Aaru.Tests.Devices.MultiMediaCard;
[TestFixture]
public class CSD
{
[TestFixture]
public class CSD
readonly string[] cards =
{
readonly string[] cards =
{
"mmc_6600_32mb", "mmc_pretec_32mb", "mmc_takems_256mb"
};
"mmc_6600_32mb", "mmc_pretec_32mb", "mmc_takems_256mb"
};
readonly string[] csds =
{
"8c26012a0f5901e9f6d983e392404001", "8c0e012a0ff981e9f6d981e18a400001", "905e002a1f5983d3edb683ff96400001"
};
readonly string[] csds =
{
"8c26012a0f5901e9f6d983e392404001", "8c0e012a0ff981e9f6d981e18a400001", "905e002a1f5983d3edb683ff96400001"
};
readonly byte[] structure_versions =
{
2, 2, 2
};
readonly byte[] structure_versions =
{
2, 2, 2
};
readonly byte[] spec_versions =
{
3, 3, 4
};
readonly byte[] spec_versions =
{
3, 3, 4
};
readonly byte[] taacs =
{
38, 14, 94
};
readonly byte[] taacs =
{
38, 14, 94
};
readonly byte[] nsacs =
{
1, 1, 0
};
readonly byte[] nsacs =
{
1, 1, 0
};
readonly byte[] speeds =
{
42, 42, 42
};
readonly byte[] speeds =
{
42, 42, 42
};
readonly ushort[] classes =
{
245, 255, 501
};
readonly ushort[] classes =
{
245, 255, 501
};
readonly byte[] read_block_lengths =
{
9, 9, 9
};
readonly byte[] read_block_lengths =
{
9, 9, 9
};
readonly bool[] read_partial_blocks =
{
false, true, true
};
readonly bool[] read_partial_blocks =
{
false, true, true
};
readonly bool[] write_misaligned_block =
{
false, false, false
};
readonly bool[] write_misaligned_block =
{
false, false, false
};
readonly bool[] read_misaligned_block =
{
false, false, false
};
readonly bool[] read_misaligned_block =
{
false, false, false
};
readonly bool[] dsr_implemented =
{
false, false, false
};
readonly bool[] dsr_implemented =
{
false, false, false
};
readonly uint[] card_sizes =
{
1959, 1959, 3919
};
readonly uint[] card_sizes =
{
1959, 1959, 3919
};
readonly byte[] min_read_current =
{
6, 6, 5
};
readonly byte[] min_read_current =
{
6, 6, 5
};
readonly byte[] max_read_current =
{
6, 6, 5
};
readonly byte[] max_read_current =
{
6, 6, 5
};
readonly byte[] min_write_current =
{
6, 6, 5
};
readonly byte[] min_write_current =
{
6, 6, 5
};
readonly byte[] max_write_current =
{
6, 6, 5
};
readonly byte[] max_write_current =
{
6, 6, 5
};
readonly byte[] size_multiplier =
{
3, 3, 5
};
readonly byte[] size_multiplier =
{
3, 3, 5
};
readonly byte[] sector_sizes =
{
0, 0, 0
};
readonly byte[] sector_sizes =
{
0, 0, 0
};
readonly byte[] erase_sector_sizes =
{
31, 15, 31
};
readonly byte[] erase_sector_sizes =
{
31, 15, 31
};
readonly byte[] write_protect_group_size =
{
3, 1, 31
};
readonly byte[] write_protect_group_size =
{
3, 1, 31
};
readonly bool[] write_protect_group_enable =
{
true, true, true
};
readonly bool[] write_protect_group_enable =
{
true, true, true
};
readonly byte[] default_eccs =
{
0, 0, 0
};
readonly byte[] default_eccs =
{
0, 0, 0
};
readonly byte[] r2w_factors =
{
4, 2, 5
};
readonly byte[] r2w_factors =
{
4, 2, 5
};
readonly byte[] write_block_lengths =
{
9, 9, 9
};
readonly byte[] write_block_lengths =
{
9, 9, 9
};
readonly bool[] write_partial_blocks =
{
false, false, false
};
readonly bool[] write_partial_blocks =
{
false, false, false
};
readonly bool[] file_format_group =
{
false, false, false
};
readonly bool[] file_format_group =
{
false, false, false
};
readonly bool[] copy =
{
true, false, false
};
readonly bool[] copy =
{
true, false, false
};
readonly bool[] permanent_write_protect =
{
false, false, false
};
readonly bool[] permanent_write_protect =
{
false, false, false
};
readonly bool[] temporary_write_protect =
{
false, false, false
};
readonly bool[] temporary_write_protect =
{
false, false, false
};
readonly byte[] file_format =
{
0, 0, 0
};
readonly byte[] file_format =
{
0, 0, 0
};
readonly byte[] ecc =
{
0, 0, 0
};
readonly byte[] ecc =
{
0, 0, 0
};
[Test]
public void Test()
[Test]
public void Test()
{
for(int i = 0; i < cards.Length; i++)
{
for(int i = 0; i < cards.Length; i++)
using(new AssertionScope())
{
using(new AssertionScope())
Assert.Multiple(() =>
{
Assert.Multiple(() =>
{
int count = Marshal.ConvertFromHexAscii(csds[i], out byte[] response);
Assert.AreEqual(16, count, $"Size - {cards[i]}");
Decoders.MMC.CSD csd = Decoders.MMC.Decoders.DecodeCSD(response);
Assert.IsNotNull(csd, $"Decoded - {cards[i]}");
Assert.AreEqual(structure_versions[i], csd.Structure, $"Structure version - {cards[i]}");
Assert.AreEqual(spec_versions[i], csd.Version, $"Specification version - {cards[i]}");
Assert.AreEqual(taacs[i], csd.TAAC, $"TAAC - {cards[i]}");
Assert.AreEqual(nsacs[i], csd.NSAC, $"NSAC - {cards[i]}");
Assert.AreEqual(speeds[i], csd.Speed, $"Transfer speed - {cards[i]}");
Assert.AreEqual(classes[i], csd.Classes, $"Classes - {cards[i]}");
Assert.AreEqual(read_block_lengths[i], csd.ReadBlockLength, $"Read block length - {cards[i]}");
int count = Marshal.ConvertFromHexAscii(csds[i], out byte[] response);
Assert.AreEqual(16, count, $"Size - {cards[i]}");
Decoders.MMC.CSD csd = Decoders.MMC.Decoders.DecodeCSD(response);
Assert.IsNotNull(csd, $"Decoded - {cards[i]}");
Assert.AreEqual(structure_versions[i], csd.Structure, $"Structure version - {cards[i]}");
Assert.AreEqual(spec_versions[i], csd.Version, $"Specification version - {cards[i]}");
Assert.AreEqual(taacs[i], csd.TAAC, $"TAAC - {cards[i]}");
Assert.AreEqual(nsacs[i], csd.NSAC, $"NSAC - {cards[i]}");
Assert.AreEqual(speeds[i], csd.Speed, $"Transfer speed - {cards[i]}");
Assert.AreEqual(classes[i], csd.Classes, $"Classes - {cards[i]}");
Assert.AreEqual(read_block_lengths[i], csd.ReadBlockLength, $"Read block length - {cards[i]}");
Assert.AreEqual(read_partial_blocks[i], csd.ReadsPartialBlocks,
$"Reads partial blocks - {cards[i]}");
Assert.AreEqual(read_partial_blocks[i], csd.ReadsPartialBlocks,
$"Reads partial blocks - {cards[i]}");
Assert.AreEqual(write_misaligned_block[i], csd.WriteMisalignment,
$"Writes misaligned blocks - {cards[i]}");
Assert.AreEqual(write_misaligned_block[i], csd.WriteMisalignment,
$"Writes misaligned blocks - {cards[i]}");
Assert.AreEqual(read_misaligned_block[i], csd.ReadMisalignment,
$"Reads misaligned blocks - {cards[i]}");
Assert.AreEqual(read_misaligned_block[i], csd.ReadMisalignment,
$"Reads misaligned blocks - {cards[i]}");
Assert.AreEqual(dsr_implemented[i], csd.DSRImplemented, $"DSR implemented - {cards[i]}");
Assert.AreEqual(card_sizes[i], csd.Size, $"Card size - {cards[i]}");
Assert.AreEqual(dsr_implemented[i], csd.DSRImplemented, $"DSR implemented - {cards[i]}");
Assert.AreEqual(card_sizes[i], csd.Size, $"Card size - {cards[i]}");
Assert.AreEqual(min_read_current[i], csd.ReadCurrentAtVddMin,
$"Reading current at minimum Vdd - {cards[i]}");
Assert.AreEqual(min_read_current[i], csd.ReadCurrentAtVddMin,
$"Reading current at minimum Vdd - {cards[i]}");
Assert.AreEqual(max_read_current[i], csd.ReadCurrentAtVddMax,
$"Reading current at maximum Vdd - {cards[i]}");
Assert.AreEqual(max_read_current[i], csd.ReadCurrentAtVddMax,
$"Reading current at maximum Vdd - {cards[i]}");
Assert.AreEqual(min_write_current[i], csd.WriteCurrentAtVddMin,
$"Writing current at minimum Vdd - {cards[i]}");
Assert.AreEqual(min_write_current[i], csd.WriteCurrentAtVddMin,
$"Writing current at minimum Vdd - {cards[i]}");
Assert.AreEqual(max_write_current[i], csd.WriteCurrentAtVddMax,
$"Writing current at maximum Vdd - {cards[i]}");
Assert.AreEqual(max_write_current[i], csd.WriteCurrentAtVddMax,
$"Writing current at maximum Vdd - {cards[i]}");
Assert.AreEqual(size_multiplier[i], csd.SizeMultiplier, $"Card size multiplier - {cards[i]}");
Assert.AreEqual(sector_sizes[i], csd.EraseGroupSize, $"Erase sector size - {cards[i]}");
Assert.AreEqual(size_multiplier[i], csd.SizeMultiplier, $"Card size multiplier - {cards[i]}");
Assert.AreEqual(sector_sizes[i], csd.EraseGroupSize, $"Erase sector size - {cards[i]}");
Assert.AreEqual(erase_sector_sizes[i], csd.EraseGroupSizeMultiplier,
$"Erase group size - {cards[i]}");
Assert.AreEqual(erase_sector_sizes[i], csd.EraseGroupSizeMultiplier,
$"Erase group size - {cards[i]}");
Assert.AreEqual(write_protect_group_size[i], csd.WriteProtectGroupSize,
$"Write protect group size - {cards[i]}");
Assert.AreEqual(write_protect_group_size[i], csd.WriteProtectGroupSize,
$"Write protect group size - {cards[i]}");
Assert.AreEqual(write_protect_group_enable[i], csd.WriteProtectGroupEnable,
$"Write protect group enable - {cards[i]}");
Assert.AreEqual(write_protect_group_enable[i], csd.WriteProtectGroupEnable,
$"Write protect group enable - {cards[i]}");
Assert.AreEqual(default_eccs[i], csd.DefaultECC, $"Default ECC - {cards[i]}");
Assert.AreEqual(r2w_factors[i], csd.WriteSpeedFactor, $"Read to write factor - {cards[i]}");
Assert.AreEqual(default_eccs[i], csd.DefaultECC, $"Default ECC - {cards[i]}");
Assert.AreEqual(r2w_factors[i], csd.WriteSpeedFactor, $"Read to write factor - {cards[i]}");
Assert.AreEqual(write_block_lengths[i], csd.WriteBlockLength,
$"write block length - {cards[i]}");
Assert.AreEqual(write_block_lengths[i], csd.WriteBlockLength,
$"write block length - {cards[i]}");
Assert.AreEqual(write_partial_blocks[i], csd.WritesPartialBlocks,
$"Writes partial blocks - {cards[i]}");
Assert.AreEqual(write_partial_blocks[i], csd.WritesPartialBlocks,
$"Writes partial blocks - {cards[i]}");
Assert.AreEqual(file_format_group[i], csd.FileFormatGroup, $"File format group - {cards[i]}");
Assert.AreEqual(copy[i], csd.Copy, $"Copy - {cards[i]}");
Assert.AreEqual(file_format_group[i], csd.FileFormatGroup, $"File format group - {cards[i]}");
Assert.AreEqual(copy[i], csd.Copy, $"Copy - {cards[i]}");
Assert.AreEqual(permanent_write_protect[i], csd.PermanentWriteProtect,
$"Permanent write protect - {cards[i]}");
Assert.AreEqual(permanent_write_protect[i], csd.PermanentWriteProtect,
$"Permanent write protect - {cards[i]}");
Assert.AreEqual(temporary_write_protect[i], csd.TemporaryWriteProtect,
$"Temporary write protect - {cards[i]}");
Assert.AreEqual(temporary_write_protect[i], csd.TemporaryWriteProtect,
$"Temporary write protect - {cards[i]}");
Assert.AreEqual(file_format[i], csd.FileFormat, $"File format - {cards[i]}");
Assert.AreEqual(ecc[i], csd.ECC, $"ECC - {cards[i]}");
});
}
Assert.AreEqual(file_format[i], csd.FileFormat, $"File format - {cards[i]}");
Assert.AreEqual(ecc[i], csd.ECC, $"ECC - {cards[i]}");
});
}
}
}

View File

@@ -2,224 +2,223 @@ using Aaru.Decoders.MMC;
using FluentAssertions;
using NUnit.Framework;
namespace Aaru.Tests.Devices.MultiMediaCard
namespace Aaru.Tests.Devices.MultiMediaCard;
[TestFixture]
public class ExtendedCSD
{
[TestFixture]
public class ExtendedCSD
readonly byte[][] ecsd =
{
readonly byte[][] ecsd =
new byte[]
{
new byte[]
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0x13, 0x00, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x15, 0x1F, 0x20, 0x00,
0x00, 0x00, 0x00, 0x11, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x57, 0x01, 0x05, 0x0A, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xC0, 0x33, 0x07, 0x10, 0x16, 0x00, 0x07, 0x07,
0x08, 0x01, 0x05, 0x01, 0x06, 0x20, 0x00, 0x07, 0x11, 0x1B, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0A, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1B,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x03, 0x07, 0x05, 0x00, 0x03, 0x01, 0x3F, 0x3F, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
}
};
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x34, 0x13, 0x00, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x15, 0x1F, 0x20, 0x00,
0x00, 0x00, 0x00, 0x11, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x57, 0x01, 0x05, 0x0A, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xC0, 0x33, 0x07, 0x10, 0x16, 0x00, 0x07, 0x07,
0x08, 0x01, 0x05, 0x01, 0x06, 0x20, 0x00, 0x07, 0x11, 0x1B, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0A, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1B,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x03, 0x07, 0x05, 0x00, 0x03, 0x01, 0x3F, 0x3F, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
}
};
readonly Decoders.MMC.ExtendedCSD[] decoded =
readonly Decoders.MMC.ExtendedCSD[] decoded =
{
new Decoders.MMC.ExtendedCSD
{
new Decoders.MMC.ExtendedCSD
Reserved0 = new byte[15],
CommandQueueModeEnable = 0,
SecureRemovalType = 9,
ProductStateAwarenessEnablement = 0,
MaxPreLoadingDataSize = 0,
FFUStatus = 0,
Reserved1 = 0,
ModeOperationCodes = 0,
ModeConfig = 0,
BarrierControl = 0,
CacheFlushing = 0,
CacheControl = 1,
PowerOffNotification = 1,
PackedCommandFailureIndex = 0,
PackedCommandStatus = 0,
ContextConfiguration = new byte[15],
ExtendedPartitionsAttribute = 0,
ExceptionEventsStatus = 0,
ExceptionEventsControl = 0,
DyncapNeeded = 0,
Class6CommandsControl = 0,
InitializationTimeoutAfterEmulationChange = 0,
SectorSize = 0,
SectorSizeEmulation = 0,
NativeSectorSize = 0,
VendorSpecific = new byte[64],
Reserved2 = 0,
SupportsProgramCxDInDDR = 1,
PeriodicWakeUp = 0,
PackageCaseTemperatureControl = 0,
ProductionStateAwareness = 0,
BadBlockManagementMode = 0,
Reserved3 = 0,
EnhancedUserDataStartAddress = 0,
EnhancedUserDataAreaSize = new byte[3],
GeneralPurposePartitionSize = new byte[12],
PartitioningSetting = 0,
PartitionsAttribute = 0,
MaxEnhancedAreaSize = new byte[]
{
Reserved0 = new byte[15],
CommandQueueModeEnable = 0,
SecureRemovalType = 9,
ProductStateAwarenessEnablement = 0,
MaxPreLoadingDataSize = 0,
FFUStatus = 0,
Reserved1 = 0,
ModeOperationCodes = 0,
ModeConfig = 0,
BarrierControl = 0,
CacheFlushing = 0,
CacheControl = 1,
PowerOffNotification = 1,
PackedCommandFailureIndex = 0,
PackedCommandStatus = 0,
ContextConfiguration = new byte[15],
ExtendedPartitionsAttribute = 0,
ExceptionEventsStatus = 0,
ExceptionEventsControl = 0,
DyncapNeeded = 0,
Class6CommandsControl = 0,
InitializationTimeoutAfterEmulationChange = 0,
SectorSize = 0,
SectorSizeEmulation = 0,
NativeSectorSize = 0,
VendorSpecific = new byte[64],
Reserved2 = 0,
SupportsProgramCxDInDDR = 1,
PeriodicWakeUp = 0,
PackageCaseTemperatureControl = 0,
ProductionStateAwareness = 0,
BadBlockManagementMode = 0,
Reserved3 = 0,
EnhancedUserDataStartAddress = 0,
EnhancedUserDataAreaSize = new byte[3],
GeneralPurposePartitionSize = new byte[12],
PartitioningSetting = 0,
PartitionsAttribute = 0,
MaxEnhancedAreaSize = new byte[]
{
52, 19, 0
},
PartitioningSupport = (PartitioningSupport)7,
HPIManagement = 1,
HWResetFunction = 1,
EnableBackgroundOperationsHandshake = 0,
ManuallyStartBackgroundOperations = 0,
StartSanitizeOperation = 0,
WriteReliabilityParameterRegister = 21,
WriteReliabilitySettingRegister = 31,
RPMBSize = 32,
FirmwareConfiguration = 0,
Reserved4 = 0,
UserAreaWriteProtectionRegister = 0,
Reserved5 = 0,
BootAreaWriteProtectionRegister = (BootAreaWriteProtectionRegister)17,
BootWriteProtectionStatus = 5,
HighCapacityEraseGroupDefinition = (HighCapacityEraseGroupDefinition)1,
Reserved6 = 0,
BootBusConditions = 0,
BootConfigProtection = 0,
PartitionConfiguration = 0,
Reserved7 = 0,
ErasedMemoryContent = 0,
Reserved8 = 0,
BusWidth = 0,
StrobeSupport = 1,
HighSpeedInterfaceTiming = 3,
Reserved9 = 0,
PowerClass = 0,
Reserved10 = 0,
CommandSetRevision = 0,
Reserved11 = 0,
CommandSet = 0,
Revision = 8,
Reserved12 = 0,
Structure = 2,
Reserved13 = 0,
DeviceType = (DeviceType)87,
DriverStrength = (DriverStrength)1,
OutOfInterruptBusyTiming = 5,
PartitionSwitchingTime = 10,
PowerClass52_195 = 0,
PowerClass26_195 = 0,
PowerClass52 = 0,
PowerClass26 = 0,
Reserved14 = 0,
MinimumReadPerformance26_4 = 0,
MinimumWritePerformance26_4 = 0,
MinimumReadPerformance26 = 0,
MinimumWritePerformance26 = 0,
MinimumReadPerformance52 = 0,
MinimumWritePerformance52 = 0,
SecureWriteProtectInformation = (SecureWriteProtectInformation)1,
SectorCount = 120832000,
SleepNotificationTimeout = 16,
SleepAwakeTimeout = 22,
ProductionStateAwarenessTimeout = 0,
SleepCurrentVccQ = 7,
SleepCurrentVcc = 7,
HighCapacityWriteProtectGroupSize = 8,
ReliableWriteSectorCount = 1,
HighCapacityEraseTimeout = 5,
HighCapacityEraseUnitSize = 1,
AccessSize = 6,
BootPartitionSize = 32,
Reserved15 = 0,
BootInformation = (BootInformation)7,
SecureTRIMMultiplier = 17,
SecureEraseMultiplier = 27,
SecureFeatureSupport = (SecureFeatureSupport)85,
TRIMMultiplier = 5,
Reserved16 = 0,
MinimumReadPerformanceDDR52 = 0,
MinimumWritePerformanceDDR52 = 0,
PowerClassDDR200_130 = 0,
PowerClassDDR200_195 = 0,
PowerClassDDR52_195 = 0,
PowerClassDDR52 = 0,
CacheFlushingPolicy = 0,
InitializationTimeAfterPartition = 30,
CorrectlyProgrammedSectors = 0,
BackgroundOperationsStatus = 0,
PowerOffNotificationTimeout = 60,
GenericCMD6Timeout = 10,
CacheSize = 65536,
PowerClassDDR200 = 0,
FirmwareVersion = 283,
DeviceVersion = 0,
OptimalTrimUnitSize = 1,
OptimalWriteSize = 32,
OptimalReadSize = 0,
PreEOLInformation = 1,
DeviceLifeEstimationTypeA = 1,
DeviceLifeEstimationTypeB = 1,
VendorHealthReport = new byte[32],
NumberOfFWSectorsCorrectlyProgrammed = 0,
Reserved17 = 0,
CMDQueuingDepth = 31,
CMDQueuingSupport = (CMDQueuingSupport)1,
Reserved18 = new byte[177],
BarrierSupport = 0,
FFUArgument = 0,
OperationCodesTimeout = 0,
FFUFeatures = 0,
SupportedModes = (SupportedModes)3,
ExtendedPartitionsSupport = (ExtendedPartitionsSupport)3,
LargeUnitSize = 7,
ContextManagementCaps = 5,
TagResourcesSize = 0,
TagUnitSize = 3,
DataTagSupport = (DataTagSupport)1,
MaxPackedWriteCommands = 63,
MaxPackedReadCommands = 63,
BackgroundOperationsSupport = (BackgroundOperationsSupport)1,
HPIFeatures = (HPIFeatures)1,
SupportedCommandSets = (DeviceSupportedCommandSets)1,
ExtendedSecurityCommandsError = 0,
Reserved19 = new byte[6]
}
};
52, 19, 0
},
PartitioningSupport = (PartitioningSupport)7,
HPIManagement = 1,
HWResetFunction = 1,
EnableBackgroundOperationsHandshake = 0,
ManuallyStartBackgroundOperations = 0,
StartSanitizeOperation = 0,
WriteReliabilityParameterRegister = 21,
WriteReliabilitySettingRegister = 31,
RPMBSize = 32,
FirmwareConfiguration = 0,
Reserved4 = 0,
UserAreaWriteProtectionRegister = 0,
Reserved5 = 0,
BootAreaWriteProtectionRegister = (BootAreaWriteProtectionRegister)17,
BootWriteProtectionStatus = 5,
HighCapacityEraseGroupDefinition = (HighCapacityEraseGroupDefinition)1,
Reserved6 = 0,
BootBusConditions = 0,
BootConfigProtection = 0,
PartitionConfiguration = 0,
Reserved7 = 0,
ErasedMemoryContent = 0,
Reserved8 = 0,
BusWidth = 0,
StrobeSupport = 1,
HighSpeedInterfaceTiming = 3,
Reserved9 = 0,
PowerClass = 0,
Reserved10 = 0,
CommandSetRevision = 0,
Reserved11 = 0,
CommandSet = 0,
Revision = 8,
Reserved12 = 0,
Structure = 2,
Reserved13 = 0,
DeviceType = (DeviceType)87,
DriverStrength = (DriverStrength)1,
OutOfInterruptBusyTiming = 5,
PartitionSwitchingTime = 10,
PowerClass52_195 = 0,
PowerClass26_195 = 0,
PowerClass52 = 0,
PowerClass26 = 0,
Reserved14 = 0,
MinimumReadPerformance26_4 = 0,
MinimumWritePerformance26_4 = 0,
MinimumReadPerformance26 = 0,
MinimumWritePerformance26 = 0,
MinimumReadPerformance52 = 0,
MinimumWritePerformance52 = 0,
SecureWriteProtectInformation = (SecureWriteProtectInformation)1,
SectorCount = 120832000,
SleepNotificationTimeout = 16,
SleepAwakeTimeout = 22,
ProductionStateAwarenessTimeout = 0,
SleepCurrentVccQ = 7,
SleepCurrentVcc = 7,
HighCapacityWriteProtectGroupSize = 8,
ReliableWriteSectorCount = 1,
HighCapacityEraseTimeout = 5,
HighCapacityEraseUnitSize = 1,
AccessSize = 6,
BootPartitionSize = 32,
Reserved15 = 0,
BootInformation = (BootInformation)7,
SecureTRIMMultiplier = 17,
SecureEraseMultiplier = 27,
SecureFeatureSupport = (SecureFeatureSupport)85,
TRIMMultiplier = 5,
Reserved16 = 0,
MinimumReadPerformanceDDR52 = 0,
MinimumWritePerformanceDDR52 = 0,
PowerClassDDR200_130 = 0,
PowerClassDDR200_195 = 0,
PowerClassDDR52_195 = 0,
PowerClassDDR52 = 0,
CacheFlushingPolicy = 0,
InitializationTimeAfterPartition = 30,
CorrectlyProgrammedSectors = 0,
BackgroundOperationsStatus = 0,
PowerOffNotificationTimeout = 60,
GenericCMD6Timeout = 10,
CacheSize = 65536,
PowerClassDDR200 = 0,
FirmwareVersion = 283,
DeviceVersion = 0,
OptimalTrimUnitSize = 1,
OptimalWriteSize = 32,
OptimalReadSize = 0,
PreEOLInformation = 1,
DeviceLifeEstimationTypeA = 1,
DeviceLifeEstimationTypeB = 1,
VendorHealthReport = new byte[32],
NumberOfFWSectorsCorrectlyProgrammed = 0,
Reserved17 = 0,
CMDQueuingDepth = 31,
CMDQueuingSupport = (CMDQueuingSupport)1,
Reserved18 = new byte[177],
BarrierSupport = 0,
FFUArgument = 0,
OperationCodesTimeout = 0,
FFUFeatures = 0,
SupportedModes = (SupportedModes)3,
ExtendedPartitionsSupport = (ExtendedPartitionsSupport)3,
LargeUnitSize = 7,
ContextManagementCaps = 5,
TagResourcesSize = 0,
TagUnitSize = 3,
DataTagSupport = (DataTagSupport)1,
MaxPackedWriteCommands = 63,
MaxPackedReadCommands = 63,
BackgroundOperationsSupport = (BackgroundOperationsSupport)1,
HPIFeatures = (HPIFeatures)1,
SupportedCommandSets = (DeviceSupportedCommandSets)1,
ExtendedSecurityCommandsError = 0,
Reserved19 = new byte[6]
}
};
[Test]
public void Test()
[Test]
public void Test()
{
for(int i = 0; i < ecsd.Length; i++)
{
for(int i = 0; i < ecsd.Length; i++)
{
Decoders.MMC.ExtendedCSD csd = Decoders.MMC.Decoders.DecodeExtendedCSD(ecsd[i]);
Assert.IsNotNull(csd, $"Not decoded - {i}");
csd.Should().BeEquivalentTo(decoded[i]);
}
Decoders.MMC.ExtendedCSD csd = Decoders.MMC.Decoders.DecodeExtendedCSD(ecsd[i]);
Assert.IsNotNull(csd, $"Not decoded - {i}");
csd.Should().BeEquivalentTo(decoded[i]);
}
}
}