From 030a345258a11a6f3d93a0042b9fd5622d30bea4 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Mon, 31 Jul 2017 16:32:07 +0200
Subject: [PATCH] bugfix: fix sync for oaisim

With the current implementation of oaisim
(rxdata and channel simulation), we cannot
call trx_read_func on a dummy buffer. The
code will actually modify the rxdata buffers
of the UE.

This is has to be rewritten properly. In the
meantime, let's introduce a simple hack. The
idea of the read at this point is to wait for
the synch to finish and not lose samples from
the hardware in the real UE. In the simulator,
as it is today, we can simply sleep until the
synch code has finished its work.
---
 targets/RT/USER/lte-ue.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index a88aebd0c0..0002c42605 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -698,6 +698,9 @@ void *UE_thread(void *arg) {
                 }
 		AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
             } else {
+#if OAISIM
+              usleep(500);
+#else
                 // grab 10 ms of signal into dummy buffer
                 if (UE->mode != loop_through_memory) {
                     for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
@@ -710,6 +713,7 @@ void *UE_thread(void *arg) {
                                               UE->frame_parms.samples_per_tti,
                                               UE->frame_parms.nb_antennas_rx);
                 }
+#endif
             }
 
         } // UE->is_synchronized==0
-- 
GitLab