From b036b18afe5093b0cbb45d0f9b2012eb2cf8e182 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Mon, 28 May 2018 11:09:38 -0700
Subject: [PATCH] moved sidlink L1 functions to LTE_UE_TRANSPORT, corrected
 issue related to "find_dlsch" which is needed to compile UE and creates
 problem for unitary simulations (moved to lte-ue.c application)

---
 cmake_targets/CMakeLists.txt                         | 12 ++++++------
 openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c         |  8 --------
 .../PHY/{LTE_TRANSPORT => LTE_UE_TRANSPORT}/sldch.c  |  0
 .../PHY/{LTE_TRANSPORT => LTE_UE_TRANSPORT}/slsch.c  |  0
 .../PHY/{LTE_TRANSPORT => LTE_UE_TRANSPORT}/slss.c   |  0
 openair1/SIMULATION/LTE_PHY/dummy_functions.c        |  8 ++++++++
 targets/RT/USER/lte-ue.c                             | 11 +++++++++++
 7 files changed, 25 insertions(+), 14 deletions(-)
 rename openair1/PHY/{LTE_TRANSPORT => LTE_UE_TRANSPORT}/sldch.c (100%)
 rename openair1/PHY/{LTE_TRANSPORT => LTE_UE_TRANSPORT}/slsch.c (100%)
 rename openair1/PHY/{LTE_TRANSPORT => LTE_UE_TRANSPORT}/slss.c (100%)

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index f75bc26b7d..d112660f18 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -1082,9 +1082,9 @@ set(PHY_SRC_COMMON
   # actual source
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools_common.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
-  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slss.c
-  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sldch.c
-  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slsch.c
+#  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slss.c
+#  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sldch.c
+#  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slsch.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich_common.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich_common.c
@@ -1144,9 +1144,6 @@ set(PHY_SRC
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c
-  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slss.c
-  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sldch.c
-  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/slsch.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c
@@ -1187,6 +1184,9 @@ set(PHY_SRC_UE
   ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/prach_ue.c
   ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pmch_ue.c
   ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pch_ue.c
+  ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/slss.c
+  ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/sldch.c
+  ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/slsch.c
   ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/drs_modulation.c
   ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c
   ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
index 6aa275acae..82dedd9bc9 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
@@ -5158,11 +5158,3 @@ main()
 
 #endif
 
-/* HACK: this function is needed to compile the UE
- * fix it somehow
- */
-int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
-{
-  printf("you cannot read this\n");
-  abort();
-}
diff --git a/openair1/PHY/LTE_TRANSPORT/sldch.c b/openair1/PHY/LTE_UE_TRANSPORT/sldch.c
similarity index 100%
rename from openair1/PHY/LTE_TRANSPORT/sldch.c
rename to openair1/PHY/LTE_UE_TRANSPORT/sldch.c
diff --git a/openair1/PHY/LTE_TRANSPORT/slsch.c b/openair1/PHY/LTE_UE_TRANSPORT/slsch.c
similarity index 100%
rename from openair1/PHY/LTE_TRANSPORT/slsch.c
rename to openair1/PHY/LTE_UE_TRANSPORT/slsch.c
diff --git a/openair1/PHY/LTE_TRANSPORT/slss.c b/openair1/PHY/LTE_UE_TRANSPORT/slss.c
similarity index 100%
rename from openair1/PHY/LTE_TRANSPORT/slss.c
rename to openair1/PHY/LTE_UE_TRANSPORT/slss.c
diff --git a/openair1/SIMULATION/LTE_PHY/dummy_functions.c b/openair1/SIMULATION/LTE_PHY/dummy_functions.c
index dc86e76113..ac96d53b0f 100644
--- a/openair1/SIMULATION/LTE_PHY/dummy_functions.c
+++ b/openair1/SIMULATION/LTE_PHY/dummy_functions.c
@@ -38,6 +38,14 @@ void ue_send_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frame,
 		 sub_frame_t subframe, uint8_t * sdu, uint16_t sdu_len,
 		 uint8_t CH_index){}
 
+SLSS_t *ue_get_slss(module_id_t module_idP, int CC_id,frame_t frameP, sub_frame_t subframe) {return(NULL);}
+
+SLDCH_t *ue_get_sldch(module_id_t module_idP, int CC_id,frame_t frameP, sub_frame_t subframe) {return(NULL);}
+
+SLSCH_t *ue_get_slsch(module_id_t module_idP, int CC_id,frame_t frameP, sub_frame_t subframe) {return(NULL);}
+
+void multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP) {}
+
 uint16_t
 ue_process_rar(const module_id_t module_idP,
 	       const int CC_id,
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 492a17a365..a0174ea332 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -2355,3 +2355,14 @@ int init_timer_thread(void) {
   pthread_create(&phy_stub_ticking->pthread_timer, NULL, &timer_thread, NULL);
   return 0;
 }
+
+
+/* HACK: this function is needed to compile the UE
+ * fix it somehow
+ */
+int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
+{
+  printf("you cannot read this\n");
+  abort();
+}
+
-- 
GitLab