mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-24 22:56:52 +01:00
[SC64][SW] Added inverted own address SDRAM tests
This commit is contained in:
parent
9843a79a86
commit
6bbfee44e7
@ -33,7 +33,9 @@ static uint32_t r_buffer[TEST_BUFFER_SIZE / sizeof(uint32_t)] __attribute__((ali
|
|||||||
|
|
||||||
static void fill_own_address (uint32_t *buffer, int size, uint32_t pattern, uint32_t offset) {
|
static void fill_own_address (uint32_t *buffer, int size, uint32_t pattern, uint32_t offset) {
|
||||||
for (int i = 0; i < (size / sizeof(uint32_t)); i++) {
|
for (int i = 0; i < (size / sizeof(uint32_t)); i++) {
|
||||||
buffer[i] = offset + (i * sizeof(uint32_t));
|
uint32_t value = offset + (i * sizeof(uint32_t));
|
||||||
|
value ^= pattern;
|
||||||
|
buffer[i] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,13 +363,15 @@ static void test_sdram (void) {
|
|||||||
|
|
||||||
sdram_test_t phase_0_tests[] = {
|
sdram_test_t phase_0_tests[] = {
|
||||||
{ .name = "Own address: ", .fill = fill_own_address, .pattern = 0x00000000, .fade = 0 },
|
{ .name = "Own address: ", .fill = fill_own_address, .pattern = 0x00000000, .fade = 0 },
|
||||||
|
{ .name = "Own address~: ", .fill = fill_own_address, .pattern = 0xFFFFFFFF, .fade = 0 },
|
||||||
{ .name = "All zeros: ", .fill = fill_pattern, .pattern = 0x00000000, .fade = 0 },
|
{ .name = "All zeros: ", .fill = fill_pattern, .pattern = 0x00000000, .fade = 0 },
|
||||||
{ .name = "All ones: ", .fill = fill_pattern, .pattern = 0xFFFFFFFF, .fade = 0 },
|
{ .name = "All ones: ", .fill = fill_pattern, .pattern = 0xFFFFFFFF, .fade = 0 },
|
||||||
{ .name = "0xAAAA5555: ", .fill = fill_pattern, .pattern = 0xAAAA5555, .fade = 0 },
|
{ .name = "0xAAAA5555: ", .fill = fill_pattern, .pattern = 0xAAAA5555, .fade = 0 },
|
||||||
{ .name = "0x5555AAAA: ", .fill = fill_pattern, .pattern = 0x5555AAAA, .fade = 0 },
|
{ .name = "0x5555AAAA: ", .fill = fill_pattern, .pattern = 0x5555AAAA, .fade = 0 },
|
||||||
{ .name = "Random (1/3): ", .fill = fill_random, .pattern = 0x00000000, .fade = 0 },
|
{ .name = "Random (1/4): ", .fill = fill_random, .pattern = 0x00000000, .fade = 0 },
|
||||||
{ .name = "Random (2/3): ", .fill = fill_random, .pattern = 0x00000000, .fade = 0 },
|
{ .name = "Random (2/4): ", .fill = fill_random, .pattern = 0x00000000, .fade = 0 },
|
||||||
{ .name = "Random (3/3): ", .fill = fill_random, .pattern = 0x00000000, .fade = 0 },
|
{ .name = "Random (3/4): ", .fill = fill_random, .pattern = 0x00000000, .fade = 0 },
|
||||||
|
{ .name = "Random (4/4): ", .fill = fill_random, .pattern = 0x00000000, .fade = 0 },
|
||||||
{ .name = NULL },
|
{ .name = NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -887,13 +887,16 @@ fn handle_test_command(connection: Connection) -> Result<(), sc64::Error> {
|
|||||||
println!("{}: SDRAM (pattern)", "[SC64 Tests]".bold());
|
println!("{}: SDRAM (pattern)", "[SC64 Tests]".bold());
|
||||||
|
|
||||||
let sdram_pattern_tests = [
|
let sdram_pattern_tests = [
|
||||||
(sc64::MemoryTestPattern::OwnAddress, None),
|
(sc64::MemoryTestPattern::OwnAddress(false), None),
|
||||||
|
(sc64::MemoryTestPattern::OwnAddress(true), None),
|
||||||
(sc64::MemoryTestPattern::AllZeros, None),
|
(sc64::MemoryTestPattern::AllZeros, None),
|
||||||
(sc64::MemoryTestPattern::AllOnes, None),
|
(sc64::MemoryTestPattern::AllOnes, None),
|
||||||
(sc64::MemoryTestPattern::Custom(0xAAAA5555), None),
|
(sc64::MemoryTestPattern::Custom(0xAAAA5555), None),
|
||||||
(sc64::MemoryTestPattern::Custom(0x5555AAAA), None),
|
(sc64::MemoryTestPattern::Custom(0x5555AAAA), None),
|
||||||
(sc64::MemoryTestPattern::Random, None),
|
(sc64::MemoryTestPattern::Random, None),
|
||||||
(sc64::MemoryTestPattern::Random, None),
|
(sc64::MemoryTestPattern::Random, None),
|
||||||
|
(sc64::MemoryTestPattern::Random, None),
|
||||||
|
(sc64::MemoryTestPattern::Random, None),
|
||||||
(sc64::MemoryTestPattern::Custom(0x00010001), None),
|
(sc64::MemoryTestPattern::Custom(0x00010001), None),
|
||||||
(sc64::MemoryTestPattern::Custom(0xFFFEFFFE), None),
|
(sc64::MemoryTestPattern::Custom(0xFFFEFFFE), None),
|
||||||
(sc64::MemoryTestPattern::Custom(0x00020002), None),
|
(sc64::MemoryTestPattern::Custom(0x00020002), None),
|
||||||
|
@ -759,9 +759,13 @@ impl SC64 {
|
|||||||
let mut test_data = vec![0u32; SDRAM_LENGTH / item_size];
|
let mut test_data = vec![0u32; SDRAM_LENGTH / item_size];
|
||||||
|
|
||||||
match pattern {
|
match pattern {
|
||||||
MemoryTestPattern::OwnAddress => {
|
MemoryTestPattern::OwnAddress(inverted) => {
|
||||||
for (index, item) in test_data.iter_mut().enumerate() {
|
for (index, item) in test_data.iter_mut().enumerate() {
|
||||||
*item = (index * item_size) as u32;
|
let mut value = (index * item_size) as u32;
|
||||||
|
if inverted {
|
||||||
|
value ^= 0xFFFFFFFFu32;
|
||||||
|
}
|
||||||
|
*item = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemoryTestPattern::AllZeros => test_data.fill(0x00000000u32),
|
MemoryTestPattern::AllZeros => test_data.fill(0x00000000u32),
|
||||||
|
@ -984,7 +984,7 @@ impl Display for DiagnosticData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub enum MemoryTestPattern {
|
pub enum MemoryTestPattern {
|
||||||
OwnAddress,
|
OwnAddress(bool),
|
||||||
AllZeros,
|
AllZeros,
|
||||||
AllOnes,
|
AllOnes,
|
||||||
Random,
|
Random,
|
||||||
@ -999,7 +999,10 @@ pub struct MemoryTestPatternResult {
|
|||||||
impl Display for MemoryTestPattern {
|
impl Display for MemoryTestPattern {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
MemoryTestPattern::OwnAddress => f.write_str("Own address"),
|
MemoryTestPattern::OwnAddress(inverted) => f.write_fmt(format_args!(
|
||||||
|
"Own address{}",
|
||||||
|
if *inverted { "~" } else { "" }
|
||||||
|
)),
|
||||||
MemoryTestPattern::AllZeros => f.write_str("All zeros"),
|
MemoryTestPattern::AllZeros => f.write_str("All zeros"),
|
||||||
MemoryTestPattern::AllOnes => f.write_str("All ones"),
|
MemoryTestPattern::AllOnes => f.write_str("All ones"),
|
||||||
MemoryTestPattern::Random => f.write_str("Random"),
|
MemoryTestPattern::Random => f.write_str("Random"),
|
||||||
|
Loading…
Reference in New Issue
Block a user