From e79a71642524583ce1bcd252fd5675bcafb78124 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 26 Mar 2015 22:16:31 +0100 Subject: [PATCH] software/bios/sdram: select the type of data we want to generate for memtest with TEST_RANDOM_DATA (debugging hardware is easier with a simple counter) --- software/bios/sdram.c | 25 +++++++++++++++++-------- software/bios/sdram.h | 1 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/software/bios/sdram.c b/software/bios/sdram.c index d374e9d3..f3dca3e4 100644 --- a/software/bios/sdram.c +++ b/software/bios/sdram.c @@ -423,15 +423,24 @@ int sdrlevel(void) #endif /* CSR_DDRPHY_BASE */ #define TEST_SIZE (2*1024*1024) +#define TEST_RANDOM_DATA 1 #define ONEZERO 0xAAAAAAAA #define ZEROONE 0x55555555 +unsigned int seed_to_data(unsigned int seed, int random) +{ + if (random) + return 1664525*seed + 1013904223; + else + return seed + 1; +} + int memtest_silent(void) { volatile unsigned int *array = (unsigned int *)MAIN_RAM_BASE; int i; - unsigned int prv; + unsigned int seed; unsigned int error_cnt; /* test data bus */ @@ -453,18 +462,18 @@ int memtest_silent(void) error_cnt++; } - /* test random data */ - prv = 0; + /* test counter or random data */ + seed = 0; for(i=0;i