From 6c3d5cf02d6a419a5f004bd10036a05d7bacc2a2 Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Fri, 10 Jan 2020 13:27:02 +0100
Subject: [PATCH] Making the basic-sim on UE side able to synch!

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/runTestOnVM.sh |  2 +-
 targets/RT/USER/lte-ue.c  | 32 ++++++++++++++++++++++----------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index 32a16527839..1f9d945a637 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -522,7 +522,7 @@ function install_epc_on_vm {
         echo "############################################################"
         echo "Install EPC on EPC VM ($LOC_EPC_VM_NAME)"
         echo "############################################################"
-        echo "sudo [ -f 01proxy ] && cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS
+        echo "[ -f 01proxy ] && sudo cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS
         echo "touch /home/ubuntu/.hushlogin" >> $LOC_EPC_VM_CMDS
         echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $LOC_EPC_VM_CMDS
         echo "sudo apt-get update > zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 3dd13a0f229..5a8afc23588 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -1582,18 +1582,30 @@ void *UE_thread(void *arg)
     if (is_synchronized == 0) {
       if (instance_cnt_synch < 0) {  // we can invoke the synch
         // grab 10 ms of signal and wakeup synch thread
-        if (UE->mode != loop_through_memory) {
-          for(int sf=0; sf<10; sf++) {
-            for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
-              rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf];
 
-            AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice,
-                            &timestamp,
-                            rxp,
-                            UE->frame_parms.samples_per_tti,
-                            UE->frame_parms.nb_antennas_rx), "");
-            if (IS_SOFTMODEM_RFSIM )
+        if (UE->mode != loop_through_memory) {
+          if (IS_SOFTMODEM_RFSIM) {
+            for(int sf=0; sf<10; sf++) {
+              for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
+                rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf];
+
+              AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice,
+                              &timestamp,
+                              rxp,
+                              UE->frame_parms.samples_per_tti,
+                              UE->frame_parms.nb_antennas_rx), "");
               write_dummy(UE, timestamp);
+            }
+          } else {
+            for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
+              rxp[i] = (void *)&UE->common_vars.rxdata[i][0];
+
+            AssertFatal( UE->frame_parms.samples_per_tti*10 ==
+                         UE->rfdevice.trx_read_func(&UE->rfdevice,
+                                                    &timestamp,
+                                                    rxp,
+                                                    UE->frame_parms.samples_per_tti*10,
+                                                    UE->frame_parms.nb_antennas_rx), "");
           }
         }
 
-- 
GitLab