bios: add DQ filtering to sdrrd, add sdrrdbuf command
authorSebastien Bourdeauducq <sb@m-labs.hk>
Mon, 1 Sep 2014 06:58:58 +0000 (14:58 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Mon, 1 Sep 2014 06:58:58 +0000 (14:58 +0800)
software/bios/main.c
software/bios/sdram.c
software/bios/sdram.h

index 01c2e0ec520c409ca3a73d9d2bd3e74eed348cf0..603f00850fd439215d448d1f6a1e0482fca8fecf 100644 (file)
@@ -378,7 +378,8 @@ static void do_command(char *c)
        else if(strcmp(token, "sdrrow") == 0) sdrrow(get_token(&c));
        else if(strcmp(token, "sdrsw") == 0) sdrsw();
        else if(strcmp(token, "sdrhw") == 0) sdrhw();
-       else if(strcmp(token, "sdrrd") == 0) sdrrd(get_token(&c));
+       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, "sdrwr") == 0) sdrwr(get_token(&c));
        else if(strcmp(token, "memtest") == 0) memtest();
        else if(strcmp(token, "sdrinit") == 0) sdrinit();
index 6185487d33b02269f6b53b0ec3e6d836c5b5a4f4..25b93f2231c4eb665ac229567007c2906afa1a40 100644 (file)
@@ -61,12 +61,30 @@ void sdrrow(char *_row)
        }
 }
 
-void sdrrd(char *startaddr)
+void sdrrdbuf(int dq)
+{
+       int i, p;
+       int first_byte, step;
+
+       if(dq < 0) {
+               first_byte = 0;
+               step = 1;
+       } else {
+               first_byte = DFII_PIX_RDDATA_SIZE/2 - 1 - dq;
+               step = DFII_PIX_RDDATA_SIZE/2;
+       }
+
+       for(p=0;p<DFII_NPHASES;p++)
+               for(i=first_byte;i<DFII_PIX_RDDATA_SIZE;i+=step)
+                       printf("%02x", MMPTR(dfii_pix_rddata_addr[p]+4*i));
+       printf("\n");
+}
+
+void sdrrd(char *startaddr, char *dq)
 {
        char *c;
        unsigned int addr;
-       int i;
-       int p;
+       int _dq;
 
        if(*startaddr == 0) {
                printf("sdrrd <address>\n");
@@ -77,16 +95,21 @@ void sdrrd(char *startaddr)
                printf("incorrect address\n");
                return;
        }
+       if(*dq == 0)
+               _dq = -1;
+       else {
+               _dq = strtoul(dq, &c, 0);
+               if(*c != 0) {
+                       printf("incorrect DQ\n");
+                       return;
+               }
+       }
        
        dfii_pird_address_write(addr);
        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++)
-                       printf("%02x", MMPTR(dfii_pix_rddata_addr[p]+4*i));
-       printf("\n");
+       sdrrdbuf(_dq);
 }
 
 void sdrwr(char *startaddr)
index e2fa919f6e5b9a827ad12857d05daf20721c7dcf..ebca4efe319fa7315a3c53c00271166d2e6aff78 100644 (file)
@@ -4,7 +4,8 @@
 void sdrsw(void);
 void sdrhw(void);
 void sdrrow(char *_row);
-void sdrrd(char *startaddr);
+void sdrrdbuf(int dq);
+void sdrrd(char *startaddr, char *dq);
 void sdrwr(char *startaddr);
 int memtest_silent(void);
 int memtest(void);