From 5f0e15a4b854643c03f9e8ca7c0a38afbdb841f4 Mon Sep 17 00:00:00 2001
From: Sandeep Kumar <ee13b1025@iith.ac.in>
Date: Thu, 7 Jul 2016 19:05:14 +0200
Subject: [PATCH] save for switching pc

---
 openair1/PHY/LTE_TRANSPORT/if4_tools.c | 16 ++++++++--------
 targets/RT/USER/lte-enb.c              | 15 +++++++++++++++
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
index a0e4d2e3f71..e7c3294ce80 100644
--- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
@@ -210,8 +210,11 @@ void recv_IF4(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_typ
   *subframe = ((packet_header->frame_status)>>22)&0x000f; 
   
   if (*packet_type == IF4_PDLFFT) {          
+    // Find and return symbol_number		 		
+    *symbol_number = ((packet_header->frame_status)>>26)&0x000f;         
+
     // Calculate from received packet
-    slotoffsetF = (*subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
+    slotoffsetF = (*symbol_number)*(fp->ofdm_symbol_size) + (*subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
     blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength; 
     
     // Do decompression of the two parts and generate txdataF			
@@ -222,13 +225,13 @@ void recv_IF4(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_typ
       txdataF[0][slotoffsetF+element_id]  = alaw2lin[ (data_block[element_id+db_halflength] & 0xff) ];
       txdataF[0][slotoffsetF+element_id] |= alaw2lin[ (data_block[element_id+db_halflength]>>8) ]<<16;
     }
-		
+		        
+  } else if (*packet_type == IF4_PULFFT) {         
     // Find and return symbol_number		 		
     *symbol_number = ((packet_header->frame_status)>>26)&0x000f;         
-        
-  } else if (*packet_type == IF4_PULFFT) {         
+
     // Calculate from received packet
-    slotoffsetF = (*subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
+    slotoffsetF = (*symbol_number)*(fp->ofdm_symbol_size) + (*subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
     blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength; 
     
     // Do decompression of the two parts and generate rxdataF
@@ -240,9 +243,6 @@ void recv_IF4(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_typ
       rxdataF[0][slotoffsetF+element_id] |= alaw2lin[ (data_block[element_id+db_halflength]>>8) ]<<16;
     }
 		
-    // Find and return symbol_number		 		
-    *symbol_number = ((packet_header->frame_status)>>26)&0x000f;         
-    
   } else if (*packet_type == IF4_PRACH) {    
     // FIX: hard coded prach samples length
     db_fulllength = 839*2;
diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c
index ce4504ff0d2..29122757b01 100644
--- a/targets/RT/USER/lte-enb.c
+++ b/targets/RT/USER/lte-enb.c
@@ -501,6 +501,14 @@ static void* eNB_thread_rxtx( void* param ) {
         do { 
           recv_IF4(PHY_vars_eNB_g[0][proc->CC_id], &proc->frame_tx, &proc->subframe_tx, &packet_type, &symbol_number);
         } while (symbol_number < PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.symbols_per_tti-1); 
+        
+        if (proc->subframe_tx == 0 && proc->frame_tx == 0) {
+          write_output("eNBtxsigF.m","txF",PHY_vars_eNB_g[0][proc->CC_id]->common_vars.txdataF[0][0], 
+          PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.symbols_per_tti * PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.ofdm_symbol_size,
+          1,1);        
+          exit(1);
+        }
+
         VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4, 0 );   
         
       } else if (PHY_vars_eNB_g[0][proc->CC_id]->node_function == NGFI_RRU_IF5) {
@@ -570,6 +578,13 @@ static void* eNB_thread_rxtx( void* param ) {
       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 );   
       send_IF4(PHY_vars_eNB_g[0][proc->CC_id], proc->frame_tx, proc->subframe_tx, IF4_PDLFFT, 0);
       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 0 );
+      
+      if (proc->subframe_tx == 0 && proc->frame_tx == 0) {
+        write_output("fr_bf_comp.m","txF",PHY_vars_eNB_g[0][proc->CC_id]->common_vars.txdataF[0][0],  
+        PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.symbols_per_tti * PHY_vars_eNB_g[0][proc->CC_id]->frame_parms.ofdm_symbol_size,
+        1,1);
+        exit(1);
+      }
 
     }
 
-- 
GitLab