bios: add sdrrderr
authorSebastien Bourdeauducq <sb@m-labs.hk>
Mon, 1 Sep 2014 07:23:37 +0000 (15:23 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Mon, 1 Sep 2014 07:23:37 +0000 (15:23 +0800)
software/bios/main.c
software/bios/sdram.c
software/bios/sdram.h

index 603f00850fd439215d448d1f6a1e0482fca8fecf..dfefe01b8e12897f8f9aa6f48c1be6774c369346 100644 (file)
@@ -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();
index 25b93f2231c4eb665ac229567007c2906afa1a40..59215c3645969f9c45b2e99f443b72dc0945b82a 100644 (file)
@@ -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 <count>\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<DFII_NPHASES;p++)
+               for(i=0;i<DFII_PIX_RDDATA_SIZE;i++)
+                       prev_data[p*DFII_PIX_RDDATA_SIZE+i] = MMPTR(dfii_pix_rddata_addr[p]+4*i);
+       for(i=0;i<DFII_PIX_RDDATA_SIZE/2;i++)
+               errs[i] = 0;
+
+       for(j=0;j<_count;j++) {
+               command_prd(DFII_COMMAND_CAS|DFII_COMMAND_CS|DFII_COMMAND_RDDATA);
+               cdelay(15);
+               for(p=0;p<DFII_NPHASES;p++)
+                       for(i=0;i<DFII_PIX_RDDATA_SIZE;i++) {
+                               unsigned char new_data;
+
+                               new_data = MMPTR(dfii_pix_rddata_addr[p]+4*i);
+                               errs[i%(DFII_PIX_RDDATA_SIZE/2)] |= prev_data[p*DFII_PIX_RDDATA_SIZE+i] ^ new_data;
+                               prev_data[p*DFII_PIX_RDDATA_SIZE+i] = new_data;
+                       }
+       }
+       for(i=0;i<DFII_PIX_RDDATA_SIZE/2;i++)
+               printf("%02x ", errs[i]);
+       printf("\n");
+}
+
 void sdrwr(char *startaddr)
 {
        char *c;
index ebca4efe319fa7315a3c53c00271166d2e6aff78..45c9adb7f836483137bf3421396c342e842ef772 100644 (file)
@@ -6,6 +6,7 @@ void sdrhw(void);
 void sdrrow(char *_row);
 void sdrrdbuf(int dq);
 void sdrrd(char *startaddr, char *dq);
+void sdrrderr(char *count);
 void sdrwr(char *startaddr);
 int memtest_silent(void);
 int memtest(void);