Author: titmuss
Date: Thu Jan 24 06:57:31 2008
New Revision: 1605

URL: http://svn.slimdevices.com?rev=1605&root=Jive&view=rev
Log:
Bug: N/A
Description:
Added nandc command to print crc32 of each flash block. For example:

   JIVE# nandc 0 28000
   Block 0 (0x0) = 0xcfc19b7c
   Block 1 (0x1) = 0x2faf1899
   Block 2 (0x2) = 0x84c2f57a
   Block 3 (0x3) = 0x292eee9c
   Block 4 (0x4) = 0x6bac5e1
   Block 5 (0x5) = 0xcf7dfe8e
   Block 6 (0x6) = 0x571c22a
   Block 7 (0x7) = 0x41b0b63c
   Block 8 (0x8) = 0x690b37d3  ERASED
   Block 9 (0x9) = 0x690b37d3  ERASED


Modified:
    trunk/squeezeboxJive/src/bootloader/s3c24x0_uboot/common/cmd_nand_s3c2413.c

Modified: 
trunk/squeezeboxJive/src/bootloader/s3c24x0_uboot/common/cmd_nand_s3c2413.c
URL: 
http://svn.slimdevices.com/trunk/squeezeboxJive/src/bootloader/s3c24x0_uboot/common/cmd_nand_s3c2413.c?rev=1605&root=Jive&r1=1604&r2=1605&view=diff
==============================================================================
--- trunk/squeezeboxJive/src/bootloader/s3c24x0_uboot/common/cmd_nand_s3c2413.c 
(original)
+++ trunk/squeezeboxJive/src/bootloader/s3c24x0_uboot/common/cmd_nand_s3c2413.c 
Thu Jan 24 06:57:31 2008
@@ -464,6 +464,41 @@
        return 0;
 }
 
+// nand checksum per block
+int do_nandc    (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       ulong   startblk,size;
+       ulong crc;
+       char *buf;
+       int numblocks, i, j;
+
+       if (argc !=  3) {
+               printf ("Usage:\n%s\n", cmdtp->usage);
+               return 1;
+       }
+
+       //startblk = cblock_size*simple_strtoul(argv[1], NULL, 16);
+       startblk = simple_strtoul(argv[1], NULL, 16);
+       size  = simple_strtoul(argv[2], NULL, 16);
+
+       buf = malloc(cblock_size);
+       numblocks = size / cblock_size;
+
+       NF_Init();
+       NF_Reset();
+       for ( i=0 ; i < numblocks;  i++) {
+               if(NF_IsBadBlock(startblk + i)) {       // 1:bad 0:good
+                       printf("Block %d (0x%x) = BAD\n", startblk + 1, 
startblk + 1);
+               }
+               else {
+                       s3c24x0_nand_read(startblk + i,cblock_size,(ulong)buf);
+                       crc = crc32(0, (const uchar *) buf, cblock_size);
+                       printf("Block %d (0x%x) = 0x%0lx %s\n", startblk + i, 
startblk + i, crc, (crc==0x690b37d3)?" ERASED":"");
+               }
+       }
+       return 0;
+}
+
 U_BOOT_CMD(
        nandbb, 4,      1,      do_nandbb,
        "nandbb HEX: targetblock numblocks \n",
@@ -511,7 +546,14 @@
         nandr, 4,      1,      do_nandr,
         "nandr - HEX: targetblock targetsize mem_adr \n",
         "\n    -SMDK24X0 NAND Flash Read Program\n"    \
-        "nandw targetblock, targetsize memory addr \n" \
+        "nandr targetblock, targetsize memory addr \n" \
+);
+
+U_BOOT_CMD(
+        nandc, 4,      1,      do_nandc,
+        "nandc - HEX: targetblock targetsize_adr \n",
+        "\n    -SMDK24X0 NAND Flash Checksum\n"        \
+        "nandc targetblock, targetsize \n"     \
 );
 
 static u8 seBuf[64]=

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to