From ccfe5a04722212d6f1332c15b3b206d2349f08fe Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Tue, 17 Oct 2017 09:41:27 +0200
Subject: [PATCH] removed "short_offset" code from normal_prefix_mod. removed
 static declaration in PHY_ofdm_mod which was a cause for problems when
 parallelizing FFTs for FEP TX.

---
 openair1/PHY/MODULATION/ofdm_mod.c | 50 ++++++++++--------------------
 targets/RT/USER/lte-ru.c           |  4 +--
 2 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c
index dd83eb1803..369a63355c 100644
--- a/openair1/PHY/MODULATION/ofdm_mod.c
+++ b/openair1/PHY/MODULATION/ofdm_mod.c
@@ -33,47 +33,29 @@ This section deals with basic functions for OFDM Modulation.
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 
-//static short temp2[2048*4] __attribute__((aligned(16)));
-
 //#define DEBUG_OFDM_MOD
 
 
 void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms)
 {
 
-  uint8_t i;
-  int short_offset=0;
-
-  if ((2*nsymb) < frame_parms->symbols_per_tti)
-    short_offset = 1;
-
-  //  printf("nsymb %d\n",nsymb);
-  for (i=0; i<((short_offset)+2*nsymb/frame_parms->symbols_per_tti); i++) {
-
-#ifdef DEBUG_OFDM_MOD
-    printf("slot i %d (txdata offset %d, txoutput %p)\n",i,(i*(frame_parms->samples_per_tti>>1)),
-           txdata+(i*(frame_parms->samples_per_tti>>1)));
-#endif
-
-    PHY_ofdm_mod(txdataF+(i*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti>>1),        // input
-                 txdata+(i*frame_parms->samples_per_tti>>1),         // output
-                 frame_parms->ofdm_symbol_size,                
-                 1,                 // number of symbols
-                 frame_parms->nb_prefix_samples0,               // number of prefix samples
-                 CYCLIC_PREFIX);
-#ifdef DEBUG_OFDM_MOD
-    printf("slot i %d (txdata offset %d)\n",i,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(i*frame_parms->samples_per_tti>>1));
-#endif
-
-    PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size+(i*frame_parms->ofdm_symbol_size*(frame_parms->symbols_per_tti>>1)),        // input
-                 txdata+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(i*(frame_parms->samples_per_tti>>1)),         // output
-                 frame_parms->ofdm_symbol_size,                
-                 (short_offset==1) ? 1 :(frame_parms->symbols_per_tti>>1)-1,//6,                 // number of symbols
-                 frame_parms->nb_prefix_samples,               // number of prefix samples
-                 CYCLIC_PREFIX);
 
+  
+  PHY_ofdm_mod(txdataF,        // input
+	       txdata,         // output
+	       frame_parms->ofdm_symbol_size,                
+	       1,                 // number of symbols
+	       frame_parms->nb_prefix_samples0,               // number of prefix samples
+	       CYCLIC_PREFIX);
+  PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size,        // input
+	       txdata+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0,         // output
+	       frame_parms->ofdm_symbol_size,                
+	       nsymb-1,
+	       frame_parms->nb_prefix_samples,               // number of prefix samples
+	       CYCLIC_PREFIX);
+  
 
-  }
+  
 }
 
 void PHY_ofdm_mod(int *input,                       /// pointer to complex input
@@ -85,7 +67,7 @@ void PHY_ofdm_mod(int *input,                       /// pointer to complex input
                  )
 {
 
-  static short temp[2048*4] __attribute__((aligned(32)));
+  short temp[2048*4] __attribute__((aligned(32)));
   unsigned short i,j;
   short k;
 
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index 900dbe12cf..21804817d6 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -1945,8 +1945,8 @@ void init_RU(char *rf_config_file) {
       }
       else if (ru->function == eNodeB_3GPP) {  
 	ru->do_prach             = 0;                       // no prach processing in RU            
-	ru->feprx                = (get_nprocs()<=4) ? fep_full : ru_fep_full_2thread;                // RX DFTs
-	ru->feptx_ofdm           = (get_nprocs()<=4) ? feptx_ofdm : feptx_ofdm_2thread;              // this is fep with idft and precoding
+	ru->feprx                = (get_nprocs()<=2) ? fep_full : ru_fep_full_2thread;                // RX DFTs
+	ru->feptx_ofdm           = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread;              // this is fep with idft and precoding
 	ru->feptx_prec           = feptx_prec;              // this is fep with idft and precoding
 	ru->fh_north_in          = NULL;                    // no incoming fronthaul from north
 	ru->fh_north_out         = NULL;                    // no outgoing fronthaul to north
-- 
GitLab