From 5c5c1e8493e140eb581e28087b8967a3787e858b Mon Sep 17 00:00:00 2001
From: Patrick Robbe <robbe@lal.in2p3.fr>
Date: Sun, 20 Oct 2019 14:00:07 +0900
Subject: [PATCH] Fix resync function

---
 Pcie40Libraries/pcie40_b2ecs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Pcie40Libraries/pcie40_b2ecs.c b/Pcie40Libraries/pcie40_b2ecs.c
index 9ded776..4535a8b 100644
--- a/Pcie40Libraries/pcie40_b2ecs.c
+++ b/Pcie40Libraries/pcie40_b2ecs.c
@@ -22,14 +22,13 @@ int pcie40_resyncb2link(int dev , int fd ) {
   for ( i = 0 ; i<10 ; i++ ) {
     ret = ecs_write( dev , ECS_BAR , ECS_B2LINK_RESET_ADD , 0x0 ) ;
     if ( 0 != ret ) return 0 ;
-    return 0 ;
     ret = ecs_write( dev , ECS_BAR , ECS_B2LINK_RESET_ADD , 
 		     1 << ( ECS_B2LINK_RESET_BIT + fd ) ) ;
     if ( 0 != ret ) return 0 ;
     ret = ecs_write( dev , ECS_BAR , ECS_B2LINK_RESET_ADD , 0x0 ) ;
     if ( 0 != ret ) return 0 ;
-    //usleep( 1000000 );
-    //    ret = pcie40_b2linkstatus( fd , link ) ;
+    usleep( 1000000 );
+    ret = pcie40_b2linkstatus( dev , fd ) ;
     if ( 1 == ret ) return ret ;
   }    
 
-- 
GitLab