From 4fc66a3879d0d00de26acf84813f951484931b3f Mon Sep 17 00:00:00 2001
From: guptar <guptar@mycompany.com>
Date: Mon, 21 Sep 2015 17:35:11 +0000
Subject: [PATCH] updated cmake with extra phy layer build defines for extra
 debugging

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7831 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 cmake_targets/CMakeLists.txt                            | 3 +++
 cmake_targets/build_oai                                 | 7 +++++++
 cmake_targets/oaisim_noS1_build_oai/CMakeLists.template | 3 +++
 cmake_targets/tools/build_helper                        | 2 +-
 openair1/SCHED/phy_procedures_lte_eNb.c                 | 5 ++++-
 openair1/SCHED/phy_procedures_lte_ue.c                  | 6 +++---
 6 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index e4aa519f8..e81051171 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -476,6 +476,9 @@ add_boolean_option(PHY_EMUL                False "not clear: must remain False f
 add_boolean_option(PUCCH                   True "????")
 add_boolean_option(RANDOM_BF               False "????")
 add_boolean_option(SMBV                    False "Rohde&Schwarz SMBV100A vector signal generator")
+add_boolean_option(DEBUG_PHY               True "Enable PHY layer debugging options")
+add_boolean_option(DEBUG_PHY_PROC          True "Enable debugging of PHY layer procedures")
+add_boolean_option(DEBUG_DLSCH             True "Enable debugging of DLSCH physical layer channel")
 
 ##########################
 # 802.21 options
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 73924cee2..77cf24d8e 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -46,6 +46,7 @@ VCD_TIMING="False"
 REL="Rel10"
 HW="EXMIMO"
 EPC=0
+VERBOSE_COMPILE=0
 
 function print_help() {
   echo_info '
@@ -100,6 +101,8 @@ Options
    (will ask root password)
 --noS1 
    Compiles oaisim or lte-softmodem without S1 interface, using direct link to IP instead
+--verbose-compile
+   Shows detailed compilation instructions in makefile
 Usage (first build):
  oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files
  Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files
@@ -202,6 +205,10 @@ function main() {
 	    NOS1=1
             echo_info "Will compile without S1 interface"
             shift;;
+       --verbose-compile)
+	    VERBOSE_COMPILE=1
+            echo_info "Will compile with verbose instructions"
+            shift;;
         -h | --help)
             print_help
             exit 1;;
diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
index 1ccd57fff..a90551015 100644
--- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
@@ -80,3 +80,6 @@ set (  USE_3GPP_ADDR_AS_LINK_ADDR False )
 set (  USE_MME "R10" )
 set (  USER_MODE True )
 set (  XER_PRINT False )
+set (  DEBUG_PHY False )
+set (  DEBUG_PHY_PROC False)
+set (  DEBUG_DLSCH False)
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 5d5be1a1b..100effd87 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -112,7 +112,7 @@ compilations() {
   cd $OPENAIR_DIR/cmake_targets/$1/build
   {
     rm -f $3
-    make -j`nproc` $2
+    make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE
   } > $dlog/$2.$REL.txt 2>&1
   echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt"
   if [ -s $3 ] ; then
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 2db9023ec..fcddd63e1 100755
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -49,7 +49,7 @@
 #include "SCHED/phy_procedures_emos.h"
 #endif
 
-#define DEBUG_PHY_PROC
+//#define DEBUG_PHY_PROC (Already defined in cmake)
 //#define DEBUG_ULSCH
 
 //#ifdef OPENAIR2
@@ -2192,6 +2192,8 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
 
 #ifdef DEBUG_PHY_PROC
 #ifdef DEBUG_DLSCH
+   //FIXME: The code below is commented as next_slot is not defined which results in failed compilation
+   /*
     LOG_D(PHY,"[eNB %"PRIu8"][SI] Frame %d, slot %d: Calling generate_dlsch (SI) with input size = %"PRIu16", num_pdcch_symbols %"PRIu8"\n",
           phy_vars_eNB->Mod_id,phy_vars_eNB->proc[sched_subframe].frame_tx, next_slot, input_buffer_length,num_pdcch_symbols); // FIXME this code is broken (next_slot?)
 
@@ -2199,6 +2201,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
       LOG_T(PHY,"%x.",i,DLSCH_pdu[i]);// FIXME this code is broken (number of arguments)
 
     LOG_T(PHY,"\n");
+    */
 #endif
 #endif
 
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index 22a38904d..99ce31e44 100755
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -2824,7 +2824,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
 
 #ifdef DEBUG_PHY_PROC
 
-            for (i=0; i<11; i++)
+            for (int i=0; i<11; i++)
               LOG_D(PHY,"dlsch_output_buffer[%d]=%x\n",i,phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->c[0][i]);
 
 #endif
@@ -3377,7 +3377,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
           dump_mch(phy_vars_ue,0,phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G,subframe_rx);
 #ifdef DEBUG_DLSCH
 
-          for (i=0; i<phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3; i++) {
+          for (int i=0; i<phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3; i++) {
             LOG_T(PHY,"%02x.",phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->c[0][i]);
           }
 
@@ -3432,7 +3432,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
                   phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->TBS>>3);
 #ifdef DEBUG_PHY
 
-            for (i=0; i<phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->TBS>>3; i++)
+            for (int i=0; i<phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->TBS>>3; i++)
               msg("%02x ",phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->b[i]);
 
             msg("\n");
-- 
GitLab