From: Jean THOMAS Date: Thu, 23 Jul 2020 13:25:35 +0000 (+0200) Subject: Parametric test size, add delay option between write and read X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5a95d5e68b2af22031b0f7bab95662d445f88e1;p=gram.git Parametric test size, add delay option between write and read --- diff --git a/examples/headless/main.c b/examples/headless/main.c index 14cbfb7..4c8c664 100644 --- a/examples/headless/main.c +++ b/examples/headless/main.c @@ -96,13 +96,15 @@ int main(int argc, char *argv[]) { struct gramCtx ctx; int serial_port, baudrate = 0; uint32_t read_value, expected_value; - uint32_t pattern[128]; + const size_t kPatternSize = 512; + uint32_t pattern[kPatternSize]; const int kDumpWidth = 8; size_t i; + int delay; struct gramProfile profile = {0,0}; - if (argc != 3) { + if (argc < 3) { fprintf(stderr, "Usage: %s port baudrate\n", argv[0]); return EXIT_FAILURE; } @@ -123,7 +125,7 @@ int main(int argc, char *argv[]) { printf("done\n"); srand(time(NULL)); - for (i = 0; i < 128; i++) { + for (i = 0; i < kPatternSize; i++) { pattern[i] = rand(); } @@ -131,13 +133,21 @@ int main(int argc, char *argv[]) { volatile uint32_t ddr_base = 0x10000000; printf("Writing data sequence..."); - for (i = 0; i < 128; i++) { + for (i = 0; i < kPatternSize; i++) { gram_write(&ctx, ddr_base+4*i, pattern[i]); } printf("done\n"); + if (argc >= 4) { + sscanf(argv[3], "%d", &delay); + printf("waiting for %d second(s)...", delay); + fflush(stdout); + sleep(delay); + printf("done\n"); + } + printf("Reading data sequence...\n"); - for (i = 0; i < 128; i++) { + for (i = 0; i < kPatternSize; i++) { if ((i % kDumpWidth) == 0) { printf("%08x | ", ddr_base+4*i); }