]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
reset update
authorhadaq <hadaq>
Tue, 27 Jul 2010 14:01:17 +0000 (14:01 +0000)
committerhadaq <hadaq>
Tue, 27 Jul 2010 14:01:17 +0000 (14:01 +0000)
libtrbnet/trbnet.c

index 4173d3a9cab3ab5d1209131fa1cba35d750ec830..eca0a7e74e78b34e090cbab15befa7cf8c6d8929 100644 (file)
@@ -1,4 +1,4 @@
-const char trbnet_version[] = "$Revision: 2.72 $";
+const char trbnet_version[] = "$Revision: 2.73 $";
 
 #include <stdlib.h>
 #include <signal.h>
@@ -434,7 +434,9 @@ static int trb_init_transfer(uint8_t channel)
   }
 
   /* Check for TX not Busy, wait MAX_TIMEOUT */
-  if (trb_wait_tx_not_busy(3) == -1) {
+  read32_from_FPGA(CHANNEL_N_SENDER_STATUS | ((channel * 2 + 1) << 4), &tmp);
+  if ((tmp & MASK_TX_RUNNING) != 0) {
+    trb_errno = TRB_TX_BUSY;
     return -1;
   }
 
@@ -1682,19 +1684,21 @@ int network_reset()
 {
   trb_errno = TRB_NONE;
   
-  if (lockPorts(0) == -1) return -1;
+  if (lockPorts(1) == -1) return -1;
 
   /* DEBUG INFO */
   if (trb_debug > 0) {
     fprintf(stderr, "network_reset started.\n");
   }
 
+  com_reset();
+
   write32_to_FPGA(0x10, 0x0000);  
   usleep(1000);
   write32_to_FPGA(0x10, 0x8000);  
   sleep(7);
   
-  if (unlockPorts(0) == -1) return -1;
+  if (unlockPorts(1) == -1) return -1;
   
   return 0;
 }