From 40b52195fcc4b3dd9a2b192f4e366774bfc7a4e2 Mon Sep 17 00:00:00 2001
From: Florian Kaltenberger <florian.kaltenberger@eurecom.fr>
Date: Tue, 26 Mar 2019 16:16:34 +0100
Subject: [PATCH] redefining max number of UEs for memory allocation. Using the
 PHYSIM macro, different allocations are used for phy_simulators and real-time
 modem.

---
 .gitignore                                 | 1 -
 cmake_targets/CMakeLists.txt               | 2 +-
 openair2/LAYER2/MAC/mac_extern.h           | 4 ----
 openair2/RRC/LTE/rrc_extern.h              | 6 ------
 openair2/RRC/NR/nr_rrc_extern.h            | 6 ------
 targets/COMMON/openairinterface5g_limits.h | 9 ++++++++-
 6 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/.gitignore b/.gitignore
index 61d9558916f..2adc5d457c6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
 cmake_targets/log/
-cmake_targets/ran_build/
 cmake_targets/*/build/
 targets/bin/
 
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 79f057c29ec..7899c71a7bf 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -671,7 +671,7 @@ add_boolean_option(EXMIMO_IOT              True "????")
 add_boolean_option(LOCALIZATION            False "???")
 add_integer_option(MAX_NUM_CCs             1     "????")
 add_boolean_option(MU_RECEIVER             False "????")
-add_boolean_option(PHYSIM                  True  "for L1 simulators (dlsim, ulsim, ...)")
+add_boolean_option(PHYSIM                  False  "for L1 simulators (dlsim, ulsim, ...)")
 add_boolean_option(PHY_CONTEXT             True "not clear: must remain False for dlsim")
 add_boolean_option(PHY_EMUL                False "not clear: must remain False for dlsim")
 add_boolean_option(SMBV                    False "Rohde&Schwarz SMBV100A vector signal generator")
diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h
index ca72882471f..825756a0956 100644
--- a/openair2/LAYER2/MAC/mac_extern.h
+++ b/openair2/LAYER2/MAC/mac_extern.h
@@ -58,11 +58,7 @@ extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES
 
 
 
-#ifndef PHYSIM
-#define NB_INST 1
-#else
 extern unsigned char NB_INST;
-#endif
 extern unsigned char NB_eNB_INST;
 extern unsigned char NB_UE_INST;
 extern unsigned char NB_RN_INST;
diff --git a/openair2/RRC/LTE/rrc_extern.h b/openair2/RRC/LTE/rrc_extern.h
index 59200fb9cc4..68c805dffe6 100644
--- a/openair2/RRC/LTE/rrc_extern.h
+++ b/openair2/RRC/LTE/rrc_extern.h
@@ -44,17 +44,11 @@ extern LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue;
 extern LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue;
 
 
-#ifndef PHY_EMUL
-#ifndef PHYSIM
-//#define NB_INST 1
-#else
 extern unsigned char NB_INST;
-#endif
 extern unsigned char NB_eNB_INST;
 extern unsigned char NB_UE_INST;
 extern unsigned short NODE_ID[1];
 extern void* bigphys_malloc(int);
-#endif
 
 
 //CONSTANTS
diff --git a/openair2/RRC/NR/nr_rrc_extern.h b/openair2/RRC/NR/nr_rrc_extern.h
index 7509dfc7276..a9af422f02d 100644
--- a/openair2/RRC/NR/nr_rrc_extern.h
+++ b/openair2/RRC/NR/nr_rrc_extern.h
@@ -43,17 +43,11 @@ extern LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue;
 extern LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue;
 
 
-#ifndef PHY_EMUL
-#ifndef PHYSIM
-//#define NB_INST 1
-#else
 extern unsigned char NB_INST;
-#endif
 extern unsigned char NB_eNB_INST;
 extern unsigned char NB_UE_INST;
 extern unsigned short NODE_ID[1];
 extern void* bigphys_malloc(int);
-#endif
 
 
 //CONSTANTS
diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h
index d44f0c56011..9645acf4ddb 100644
--- a/targets/COMMON/openairinterface5g_limits.h
+++ b/targets/COMMON/openairinterface5g_limits.h
@@ -1,11 +1,12 @@
 #ifndef OPENAIRINTERFACE5G_LIMITS_H_
 #define OPENAIRINTERFACE5G_LIMITS_H_
 
-#if defined(CBMIMO1) || defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
+#if 1 /*defined(CBMIMO1) || defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)*/
 #        define NUMBER_OF_eNB_MAX 1
 #        define NUMBER_OF_gNB_MAX 1
 #        define NUMBER_OF_RU_MAX 2
 #        define NUMBER_OF_NR_RU_MAX 2
+#        ifndef PHYSIM
 #        ifndef UE_EXPANSION
 #                define NUMBER_OF_UE_MAX 16
 #                define NUMBER_OF_NR_UE_MAX 16
@@ -17,6 +18,12 @@
 #                define NUMBER_OF_CONNECTED_eNB_MAX 1
 #                define NUMBER_OF_CONNECTED_gNB_MAX 1
 #        endif
+#        else
+#                define NUMBER_OF_UE_MAX 1
+#                define NUMBER_OF_NR_UE_MAX 1
+#                define NUMBER_OF_CONNECTED_eNB_MAX 1
+#                define NUMBER_OF_CONNECTED_gNB_MAX 1
+#        endif
 #else
 #        define NUMBER_OF_eNB_MAX 7
 #        define NUMBER_OF_gNB_MAX 7
-- 
GitLab