From cc289f63c33bacff62eeed5f796191cdddc53b96 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Thu, 12 Feb 2015 16:53:46 +0000
Subject: [PATCH] some cleanup for UE on USRP, OPENAIR2=0 flag works again and
 on USRP, UE TX on USRP still to be added

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6539 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair1/PHY/LTE_ESTIMATION/lte_sync_time.c | 18 +++++++++++++++---
 openair1/PHY/LTE_TRANSPORT/initial_sync.c   |  5 ++++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index 3627486ca2..342642d226 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -263,6 +263,10 @@ static inline int abs32(int x) {
   return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
 }
 
+#ifdef DEBUG_PHY
+  int debug_cnt=0;
+#endif
+
 int lte_sync_time(int **rxdata, ///rx data in time domain
 		  LTE_DL_FRAME_PARMS *frame_parms,
 		  int *eNB_id) {
@@ -295,6 +299,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
   peak_pos = 0;
   sync_source = 0;
 
+
   for (n=0; n<length; n+=4) {
 
 #ifdef RTAI_ENABLED
@@ -396,9 +401,16 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
 
   
 #ifdef USER_MODE
-  write_output("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
-  write_output("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
-  write_output("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2);
+  if (debug_cnt == 5) {
+    write_output("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
+    write_output("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2);
+    write_output("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2);
+    write_output("rxdata0.m","rxd0",rxdata[0],length<<1,1,1);
+    exit(-1);
+  }
+  else {
+    debug_cnt++;
+  }
 #endif
 #endif
 
diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c
index 4419e549e4..4541b91eb5 100644
--- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c
+++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c
@@ -468,8 +468,11 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) {
     generate_pcfich_reg_mapping(frame_parms);
     generate_phich_reg_mapping(frame_parms);
     //    init_prach625(frame_parms);
-   
+#ifndef OPENAIR2
+    phy_vars_ue->UE_mode[0] = PUSCH;
+#else   
     phy_vars_ue->UE_mode[0] = PRACH;
+#endif
     //phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors=0;
     phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_conseq=0;
     //phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_last=0;
-- 
GitLab