]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
fgpa_read/write pexor ready (32-bit address)
authorhadaq <hadaq>
Wed, 2 Feb 2011 12:28:12 +0000 (12:28 +0000)
committerhadaq <hadaq>
Wed, 2 Feb 2011 12:28:12 +0000 (12:28 +0000)
libtrbnet/trbcmd.c

index a1657a6f6a7d64be09e768a08fbc0f26beae623a..a1d381f6fec4a7bfa0256c1257e126c0b32dc820 100644 (file)
@@ -25,7 +25,7 @@
                                          
 static int hexMode = HEXMODE;
 
-static const char trbcmd_version[] = "$Revision: 2.64 $";
+static const char trbcmd_version[] = "$Revision: 2.65 $";
 
 #define BACKLOG 10
 static uint16_t tcp_port = 55555;
@@ -1049,8 +1049,11 @@ int start(int argc, char **argv)
         /*******************************************/
 
         uint32_t value = 0;
+#ifndef PEXOR
         uint16_t reg_address = 0;
-
+#else
+        uint32_t reg_address = 0;
+#endif
         if (cmdLen != 2) {
           logError(ERROR, "Invalid command, try -h option\n");
           return -1;
@@ -1060,8 +1063,13 @@ int start(int argc, char **argv)
 
         if (trb_debug > 0) {
           fprintf(stderr,
-                  "Command: READ_FIFO_REGISTER:"
-                  "reg_address: 0x%04x\n", reg_address);
+                  "Command: READ_FIFO_REGISTER: reg_address: "
+#ifndef PEXOR    
+                  "0x%04x "
+#else
+                  "0x%08x ",
+#endif 
+                  "\n", reg_address);
         }
 
         if (fpga_register_read(reg_address, &value) == -1) {
@@ -1069,7 +1077,14 @@ int start(int argc, char **argv)
                    trb_strerror());
           return -1;
         } else {
-          fprintf(stdout, "0x%04x  0x%08x\n", reg_address, value);
+
+          fprintf(stdout,
+#ifndef PEXOR 
+                  "0x%04x " 
+#else
+                  "0x%08x "
+#endif
+                  "0x%08x\n", reg_address, value);
         }
 
       } else if (strncmp(cmd[0], "W", CMD_SIZE) == 0) {
@@ -1079,23 +1094,33 @@ int start(int argc, char **argv)
         /*******************************************/
 
         uint32_t value = 0;
+#ifndef PEXOR
         uint16_t reg_address = 0;
-
+#else
+        uint32_t reg_address = 0;
+#endif
+        
         if (cmdLen != 3) {
           logError(ERROR, "Invalid command, try -h option\n");
           return -1;
         }
-
+        
         reg_address = strtoul(cmd[1], NULL, hexMode == 1 ? 16 : 0);
         value = strtoul(cmd[2], NULL, hexMode == 1 ? 16 : 0);
 
         if (trb_debug > 0) {
+
           fprintf(stderr,
                   "Command: WRITE_FIFO_REGISTER:"
-                  "reg_address: 0x%04x, "
+                  "reg_address: "
+#ifndef PEXOR
+                  "0x%04x, "
+#else
+                  "0x%08x, "
+#endif
                   "value: 0x%08x\n", reg_address, value);
         }
-
+        
         if (fpga_register_write(reg_address, value) == -1) {
           logError(ERROR, "fpga_register_write failed\n");
           return -1;