From 6decb357f1fad4e5fac453d0bfab9a28283d91a9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 1 Sep 2014 15:23:37 +0800 Subject: [PATCH] bios: add sdrrderr --- software/bios/main.c | 1 + software/bios/sdram.c | 45 +++++++++++++++++++++++++++++++++++++++++++ software/bios/sdram.h | 1 + 3 files changed, 47 insertions(+) diff --git a/software/bios/main.c b/software/bios/main.c index 603f0085..dfefe01b 100644 --- a/software/bios/main.c +++ b/software/bios/main.c @@ -380,6 +380,7 @@ static void do_command(char *c) else if(strcmp(token, "sdrhw") == 0) sdrhw(); else if(strcmp(token, "sdrrdbuf") == 0) sdrrdbuf(-1); else if(strcmp(token, "sdrrd") == 0) sdrrd(get_token(&c), get_token(&c)); + else if(strcmp(token, "sdrrderr") == 0) sdrrderr(get_token(&c)); else if(strcmp(token, "sdrwr") == 0) sdrwr(get_token(&c)); else if(strcmp(token, "memtest") == 0) memtest(); else if(strcmp(token, "sdrinit") == 0) sdrinit(); diff --git a/software/bios/sdram.c b/software/bios/sdram.c index 25b93f22..59215c36 100644 --- a/software/bios/sdram.c +++ b/software/bios/sdram.c @@ -112,6 +112,51 @@ void sdrrd(char *startaddr, char *dq) sdrrdbuf(_dq); } +void sdrrderr(char *count) +{ + char *c; + int _count; + int i, j, p; + unsigned char prev_data[DFII_NPHASES*DFII_PIX_RDDATA_SIZE]; + unsigned char errs[DFII_PIX_RDDATA_SIZE/2]; + + if(*count == 0) { + printf("sdrrderr \n"); + return; + } + _count = strtoul(count, &c, 0); + if(*c != 0) { + printf("incorrect count\n"); + return; + } + + dfii_pird_address_write(0); + dfii_pird_baddress_write(0); + command_prd(DFII_COMMAND_CAS|DFII_COMMAND_CS|DFII_COMMAND_RDDATA); + cdelay(15); + for(p=0;p