]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
added default address 0xfffb
authorhadaq <hadaq>
Fri, 23 Apr 2010 19:02:32 +0000 (19:02 +0000)
committerhadaq <hadaq>
Fri, 23 Apr 2010 19:02:32 +0000 (19:02 +0000)
trbrich/trbrichcmd.c

index ffdb1c5e29dedac8f00c3c182edde4d432f918fd..4a0e5122bb2e921ce6552686e0ed1e84521cff74 100644 (file)
@@ -13,7 +13,7 @@
 
 #define TEMP_RESOLUTION 0.0625
 
-static const char trbrichcmd_version[] = "$Revision: 1.6 $"; 
+static const char trbrichcmd_version[] = "$Revision: 1.7 $"; 
 
 static const uint16_t adcm_uid_register = 0xc000;
 
@@ -25,11 +25,13 @@ void usage(const char *progName)
   printf("  -V    Version number\n");
   printf("\nCommands:\n");
   printf("   uid <trb_address>      "
-         "-> read uids from APV-FrondEnds\n");
+         "-> read uids from APV-FrondEnds\n"
+         "                             (default-Address:0xfffb)\n");
   printf("   temp <trb_address>     "
-         "-> read temperatures from APV-FrondEnds\n");
+         "-> read temperatures from APV-FrondEnds\n"
+         "                             (default-Address:0xfffb)\n");
   printf("   adcsnoop <trb_address> "
-         "-> ADC Snifer Tool\n");
+         "-> ADC Sniffer Tool\n");
 }
 
 /* ------ MAIN ---------------------------------------------------------- */
@@ -79,15 +81,15 @@ int main(int argc, char** argv)
     uint32_t *buffer = NULL;
     uint32_t *tmp = NULL;
     uint32_t *end = NULL;
-    uint16_t trb_address = 0;
+    uint16_t trb_address = 0xfffb;
     int status = 0;
-    if (argc - optind != 2) {
+
+    if (argc - optind == 2) {
+      trb_address = (uint16_t)strtoul(argv[optind + 1], NULL, 0);
+    } else if (argc - optind > 2) {
       usage(argv[0]);
       exit(EXIT_FAILURE);
     }   
-
-    trb_address = (uint16_t)strtoul(argv[optind + 1], NULL, 0);
     
     if ((buffer = (uint32_t*)malloc(sizeof(uint32_t) * BUFFER_SIZE)) == NULL) {
       abort();
@@ -133,15 +135,15 @@ int main(int argc, char** argv)
     uint32_t *tmp = NULL;
     uint32_t *end = NULL;
     int status = 0;
-    uint16_t trb_address = 0;
+    uint16_t trb_address = 0xfffb;
     
-    if (argc - optind != 2) {
+    if (argc - optind == 2) {
+      trb_address = (uint16_t)strtoul(argv[optind + 1], NULL, 0);
+    } else if (argc - optind > 2) {
       usage(argv[0]);
       exit(EXIT_FAILURE);
     }   
-    
-    trb_address = (uint16_t)strtoul(argv[optind + 1], NULL, 0);
-    
+        
     if ((buffer = (uint32_t*)malloc(sizeof(uint32_t) * BUFFER_SIZE)) == NULL) {
       abort();
     }