From f216bacb1142dccda5a6df7b1340958c6895ca6c Mon Sep 17 00:00:00 2001
From: Xiwen JIANG <xiwen.jiang@eureocm.fr>
Date: Wed, 23 Nov 2016 17:01:22 +0100
Subject: [PATCH] fix the dlsim for TM7

---
 openair1/PHY/INIT/lte_init.c            |  2 +-
 openair1/SCHED/phy_procedures_lte_ue.c  |  2 +-
 openair1/SIMULATION/LTE_PHY/dlsim.c     | 20 --------------------
 openair1/SIMULATION/LTE_PHY/dlsim_tm7.c |  3 ++-
 4 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index 0a212db27b..16a608f4e9 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -1251,7 +1251,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
         common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(fp->nb_antennas_tx*sizeof(int32_t*));
         for (j=0; j<fp->nb_antennas_tx; j++) {
           common_vars->beam_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
-	  if (i==j) 
+	  if (((i<=4) && (i==j)) || (i>=5))
 	    for (re=0; re<fp->ofdm_symbol_size; re++) 
 	      common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff; 
 #ifdef DEBUG_PHY
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index 6dfdc7297d..bcf6507e20 100644
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -2354,7 +2354,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC
       //TM7 UE specific channel estimation here!!!
       if (ue->transmission_mode[eNB_id]==7) {
         if (ue->frame_parms.Ncp==0) {
-          if ((m==3) || (m==6) || (m==8) || (m==11)) 
+          if ((m==3) || (m==6) || (m==9) || (m==12))
             //LOG_D(PHY,"[UE %d] dlsch->active in subframe %d => %d, l=%d\n",phy_vars_ue->Mod_id,subframe_rx,phy_vars_ue->dlsch_ue[eNB_id][0]->active, l);
             lte_dl_bf_channel_estimation(ue,eNB_id,0,subframe_rx*2+(m>6?1:0),5,m);
         } else {
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index b94b757adf..c657069e46 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -1808,26 +1808,6 @@ int main(int argc, char **argv)
 		 osf,
 		 perfect_ce);
 
-  /* Check if really needed */
-  /*cell_spec_bf_weights = eNB->common_vars.beam_weights[0][0];
-  for(aa=0;aa<n_tx_phy;aa++) {
-    for(re=0;re<frame_parms->ofdm_symbol_size;re++) {
-      if (n_tx_phy==1 || n_tx_phy==2)
-        cell_spec_bf_weights[aa][re] = 0x00007fff;
-      else if (n_tx_phy==4 || n_tx_phy==8)
-        cell_spec_bf_weights[aa][re] = 0x00007fff>>1;
-      else if (n_tx_phy==16)
-        cell_spec_bf_weights[aa][re] = 0x00007fff>>2;
-      else if (n_tx_phy==64)
-        cell_spec_bf_weights[aa][re] = 0x00007fff>>4;
-    }
-  } 
-
-  if (transmission_mode==7) {
-    lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti);
-    lte_gold_ue_spec_port5(UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti);
-  }*/
-
   eNB->mac_enabled=1;
   if (two_thread_flag == 0) {
     eNB->te = dlsch_encoding;
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
index 0d5dcd63ce..66dea185de 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
@@ -636,6 +636,7 @@ int main(int argc, char **argv)
 
   frame_parms = &eNB->frame_parms;
 
+  /*
   cell_spec_bf_weights = eNB->common_vars.beam_weights[0][0];
   for(aa=0;aa<n_tx_phy;aa++) {
     for(re=0;re<frame_parms->ofdm_symbol_size;re++) {
@@ -653,7 +654,7 @@ int main(int argc, char **argv)
   if (transmission_mode==7){
     lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti);
     lte_gold_ue_spec_port5(UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti);
-  }
+  }*/
 
     
   eNB_id_i = UE->n_connected_eNB;
-- 
GitLab