]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
added skip verify option
authorhadaq <hadaq>
Thu, 29 Jul 2010 15:42:59 +0000 (15:42 +0000)
committerhadaq <hadaq>
Thu, 29 Jul 2010 15:42:59 +0000 (15:42 +0000)
libtrbnet/trbflash.c

index e54bb60a1b45877793674c00d9d5df0be4a23a3a..facb4e884e69c7ad2d77537c27fb97d7cf57be2f 100644 (file)
@@ -97,7 +97,7 @@ static const char FlashTypeStr[16][32] =
 
 static FlashType flashType = FLASH_INVALID; 
 static uint32_t manId = 0;
-static const char trbflash_version[] = "$Revision: 2.21 $"; 
+static const char trbflash_version[] = "$Revision: 2.22 $"; 
 
 static uint32_t mdcFlashSelect = 1;
 
@@ -105,7 +105,7 @@ static int yesToAll = 0;
 
 static int skipFirmwareIdCheck = 0;
 
-static int skipHwIdCheck = 0;
+static int skipVerify = 0;
 
 /* ------ Local Functions ----------------------------------------------- */
 
@@ -138,7 +138,7 @@ static int writeSetupRegister(uint16_t trb_address, uint8_t value)
     if ((status = trb_register_write(trb_address, SetupReg,
                                      (uint32_t)(value << 24))) == -1) {
       fprintf(logFile, "Error > writeSetupRegister: TRBNet %s\n",
-              trb_strerrorf());
+              trb_strerror());
       return -1;
     }
     
@@ -153,7 +153,7 @@ static int writeSetupRegister(uint16_t trb_address, uint8_t value)
   if (trb_term.status_channel != 0) {
     fprintf(logFile,
             "Error > writeSetupRegister: invalid Status returned %s\n",
-            trb_strerrorf());
+            trb_strerror());
     return -1;
   }
 
@@ -173,7 +173,7 @@ static int readCtrlRegister(uint16_t trb_address,
     if ((status = trb_register_read(trb_address, CtrlReg,
                                     trbBuffer, TRB_BUFFER_SIZE)) == -1) {
       fprintf(logFile, "Error > readCtrlRegister: TRBNet %s\n",
-              trb_strerrorf());
+              trb_strerror());
       return -1;
     }
     
@@ -209,7 +209,7 @@ static int writeCtrlRegister(uint16_t trb_address, uint32_t value)
     if ((status = trb_register_write(trb_address, CtrlReg,
                                      value)) == -1) {
       fprintf(logFile, "Error > writeCtrlRegister: TRBNet %s\n",
-              trb_strerrorf());
+              trb_strerror());
       return -1;
     }
     
@@ -256,7 +256,7 @@ static int checkStatus(uint16_t trb_address)
        trb_register_read(trb_address, BlockRam, trbBuffer, 
                          TRB_BUFFER_SIZE)) == -1) {
     fprintf(logFile, "Error > checkStatus: TRBNet %s\n",
-            trb_strerrorf());
+            trb_strerror());
     return -1;
   }
   
@@ -295,7 +295,7 @@ static int writeStatusRegister(uint16_t trb_address, uint8_t value)
     
   if (trb_register_write(trb_address, BlockRam, (uint32_t)value) == -1) {
     fprintf(logFile, "Error > writeStatusRegister: TRBNet %s\n",
-            trb_strerrorf());
+            trb_strerror());
     return -1;
   }
   if (sendCommand(trb_address, 0x01 << 24, 0) == -1) {
@@ -327,7 +327,7 @@ static int initTransfer(uint16_t trb_address)
        trb_register_read(trb_address, HardwareId, trbBuffer, 
                          TRB_BUFFER_SIZE)) == -1) {
     fprintf(logFile, "Error > initTransfer, read HardwareIds: TRBNet %s\n",
-            trb_strerrorf());
+            trb_strerror());
     return -1;
   }
   
@@ -416,7 +416,7 @@ static int initTransfer(uint16_t trb_address)
        trb_register_read(trb_address, BlockRam, trbBuffer, 
                          TRB_BUFFER_SIZE)) == -1) {
     fprintf(logFile, "Error > initTransfer, read ManIds: TRBNet %s\n",
-            trb_strerrorf());
+            trb_strerror());
     return -1;
   }
   
@@ -506,7 +506,7 @@ static int readPage(uint16_t trb_address, uint32_t pageNumber,
                                       trbBuffer, TRB_BUFFER_SIZE)) 
       == -1) {
     fprintf(logFile, "Error > readPage: TRBNet %s\n",
-            trb_strerrorf());
+            trb_strerror());
     return -1;
   }
   
@@ -573,7 +573,7 @@ static int writePage(uint16_t trb_address, uint32_t pageNumber,
                                        trbBuffer, size)) 
       == -1) {
     fprintf(logFile, "Error > writePage: TRBNet %s\n",
-            trb_strerrorf());
+            trb_strerror());
     return -1;
   }
  
@@ -1059,7 +1059,7 @@ static int selectMdcFlashRom(uint16_t trb_address, uint8_t number) {
   if (trb_register_write(trb_address, MDCFlashRomSelect, 
                          (uint32_t)number) == -1) {
     fprintf(logFile, "\nError > selcetMdcFlashRom: TRBNet %s\n",
-            trb_strerrorf());
+            trb_strerror());
     return -1;
   }
   
@@ -1070,7 +1070,7 @@ static int selectMdcFlashRom(uint16_t trb_address, uint8_t number) {
 
 void usage(const char *progName)
 {
-  printf("Usage: %s [-s str] [-g] [-y] [-f] [-h] [-V] <COMMAND>\n",
+  printf("Usage: %s [-s str] [-g] [-y] [-f] [-v] [-h] [-V] <COMMAND>\n",
          progName);
   printf("Options:\n");
   printf("  -s    set user-string of info page (default: empty string)\n");
@@ -1079,8 +1079,7 @@ void usage(const char *progName)
   printf("  -y    assume yes to all questions which might will be asked\n");
   printf("  -f    do not validate FirmwareId of ImageFile (DON'T USE, for "
          "EXPERTS ONLY)\n");
-  /*  printf("  -F    do not crosscheck HardwareIDs of Endpoints "
-      "(DON'T USE, for EXPERTS ONLY)\n"); */
+  printf("  -v    skip verifying after programming\n");
   printf("  -h    give this help\n");
   printf("  -V    Version number\n");
   printf("\nCommands:\n");
@@ -1108,10 +1107,10 @@ int main(int argc, char ** argv)
   mdcFlashSelect = 1;
   yesToAll = 0;
   skipFirmwareIdCheck = 0;
-  skipHwIdCheck = 0;
-  
+  skipVerify = 0;
+
   /* Parse Arguments */
-  while ((i = getopt(argc, argv, "+hd:s:gyVf")) != -1) {
+  while ((i = getopt(argc, argv, "+hd:s:gyvVf")) != -1) {
     switch (i) {
     case '?':
       usage(basename(argv[0]));
@@ -1134,8 +1133,8 @@ int main(int argc, char ** argv)
     case 'f':
       skipFirmwareIdCheck = 1;
       break;
-    case 'F':
-      skipHwIdCheck = 2;
+    case 'v':
+      skipVerify = 1;
       break;
     case 'V':
       printf("%s %s, using libtrbnet %s\n",
@@ -1248,8 +1247,10 @@ int main(int argc, char ** argv)
       exit(EXIT_FAILURE);
     }
 
-    if (programImageBuffer(trb_address, size, PMODE_VERIFY, 1) == -1) {
-      exit(EXIT_FAILURE);
+    if (skipVerify == 0) {
+      if (programImageBuffer(trb_address, size, PMODE_VERIFY, 1) == -1) {
+        exit(EXIT_FAILURE);
+      }
     }
     
   } else if (strcmp(argv[optind], "verify") == 0) {
@@ -1437,9 +1438,11 @@ int main(int argc, char ** argv)
     if (programImageBuffer(trb_address, size, PMODE_PROGRAM_FULL, 0) == -1) {
       exit(EXIT_FAILURE);
     }
-  
-    if (programImageBuffer(trb_address, size, PMODE_VERIFY, 0) == -1) {
-      exit(EXIT_FAILURE);
+    
+    if (skipVerify == 0) {
+      if (programImageBuffer(trb_address, size, PMODE_VERIFY, 0) == -1) {
+        exit(EXIT_FAILURE);
+      }
     }
     
   } else if (strcmp(argv[optind], "info") == 0) {