diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f578fccb38..22a00f0867 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -241,7 +241,6 @@ add_boolean_option(DEBUG_MAC_INTERFACE False "print MAC-RLC PDU exchange to stdo add_boolean_option(TRACE_RLC_PAYLOAD False "print RLC PDU to stdout") # if true, make sure that global and PDCP log levels are trace add_boolean_option(TEST_OMG False "???") add_boolean_option(DEBUG_OMG False "???") -add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope") add_boolean_option(PRINT_STATS False "This adds the possibility to see the status") add_boolean_option(T_TRACER True "Activate the T tracer, a debugging/monitoring framework" ) add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs") @@ -1988,16 +1987,28 @@ endif() list(APPEND ATLAS_LIBRARIES lapack lapacke) -if (${XFORMS}) - include_directories ("/usr/include/X11") - set(XFORMS_SOURCE - ${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope.c - ) - set(XFORMS_SOURCE_SOFTMODEM - ${OPENAIR_TARGETS}/RT/USER/stats.c - ) - set(XFORMS_LIBRARIES "forms") -endif (${XFORMS}) +set(XFORMS_SOURCE + ${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope.c + ) +set(XFORMS_ENB_SOURCE + ${OPENAIR1_DIR}/PHY/TOOLS/lte_enb_scope.c + ) +set(XFORMS_UE_SOURCE + ${OPENAIR1_DIR}/PHY/TOOLS/lte_ue_scope.c + ) +set(XFORMS_SOURCE_SOFTMODEM + ${OPENAIR_TARGETS}/RT/USER/stats.c + ) +set(XFORMS_LIBRARIES "forms") + + +set (XFORMSINTERFACE_SOURCE + ${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c + ) +add_library(enbscope MODULE ${XFORMS_SOURCE} ${XFORMS_ENB_SOURCE}) +add_library(uescope MODULE ${XFORMS_SOURCE} ${XFORMS_UE_SOURCE}) +target_link_libraries(enbscope ${XFORMS_LIBRARIES}) +target_link_libraries(uescope ${XFORMS_LIBRARIES}) set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODULE_PATH}") @@ -2065,8 +2076,7 @@ add_executable(lte-softmodem ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c ${GTPU_need_ITTI} - ${XFORMS_SOURCE} - ${XFORMS_SOURCE_SOFTMODEM} + ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} ${SHLIB_LOADER_SOURCES} @@ -2109,7 +2119,7 @@ target_link_libraries(du_test ) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem ${T_LIB}) @@ -2134,8 +2144,7 @@ add_executable(lte-uesoftmodem ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${XFORMS_SOURCE} - ${XFORMS_SOURCE_SOFTMODEM} + ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} ${SHLIB_LOADER_SOURCES} @@ -2150,7 +2159,7 @@ target_link_libraries (lte-uesoftmodem -Wl,--end-group z dl) target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) +target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-uesoftmodem ${T_LIB}) @@ -2194,14 +2203,14 @@ add_executable(dlsim_tm4 ) target_link_libraries (dlsim_tm4 -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group - pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} + pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${T_LIB} ) foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) add_executable(${myExe} ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c - ${XFORMS_SOURCE} + ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} ${SHLIB_LOADER_SOURCES} @@ -2210,7 +2219,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr target_link_libraries (${myExe} -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group - pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl + pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${T_LIB} dl ) endforeach(myExe) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 65cc360056..5a0a8ed9b5 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -260,7 +260,7 @@ function main() { EXE_ARGUMENTS="$EXE_ARGUMENTS -V" shift;; -x | --xforms) - XFORMS="True" + XFORMS=1 EXE_ARGUMENTS="$EXE_ARGUMENTS -d" echo_info "Will generate the software oscilloscope features" shift;; @@ -475,7 +475,6 @@ function main() { echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file - echo "set ( XFORMS $XFORMS )" >> $cmake_file echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file # echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file @@ -658,7 +657,18 @@ function main() { $lte_build_dir msc \ libmsc.so $dbin/libmsc.so - fi + fi + # softsope compilations + ##################### + if [ "$XFORMS" = "1" ] ; then + compilations \ + $lte_build_dir enbscope \ + libenbscope.so $dbin/libenbscope.so + compilations \ + $lte_build_dir uescope \ + libuescope.so $dbin/libuescope.so + + fi # build RF device and transport protocol libraries ##################################### if [ "$eNB" = "1" -o "$UE" = "1" ] ; then diff --git a/openair1/PHY/TOOLS/lte_enb_scope.c b/openair1/PHY/TOOLS/lte_enb_scope.c new file mode 100644 index 0000000000..2918a6aa5c --- /dev/null +++ b/openair1/PHY/TOOLS/lte_enb_scope.c @@ -0,0 +1,173 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file lte_enb_scope.c + * \brief enb specific softsope implementation + * \author Nokia BellLabs France, francois Taburet + * \date 2019 + * \version 0.1 + * \company Nokia Bell-Labs France + * \email: francois.taburet@nokia-bell-labs.com + * \note + * \warning + */ + +#include "targets/RT/USER/lte-softmodem.h" +#include "UTIL/OPT/opt.h" +#include "common/config/config_userapi.h" +#include "PHY/TOOLS/lte_phy_scope.h" +#include "targets/RT/USER/stats.h" + +// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) +// at eNB 0, an UL scope for every UE +FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; +FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; +FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; +char title[255]; +unsigned char scope_enb_num_ue = 2; +static pthread_t forms_thread; //xforms +int otg_enabled=0; + +void reset_stats(FL_OBJECT *button, long arg) { + int i,j,k; + PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; + + for (i=0; idlsch[i][0]->Mlimit; j++) { + phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; + } + + phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0; + phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0; + phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0; + phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0; + phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0; + phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0; + } + } +} + + + + + +static void *scope_thread_eNB(void *arg) { +# ifdef ENABLE_XFORMS_WRITE_STATS + FILE *eNB_stats; +# endif + struct sched_param sched_param; + int UE_id, CC_id; + int ue_cnt=0; + sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1; + sched_setscheduler(0, SCHED_FIFO,&sched_param); + printf("Scope thread has priority %d\n",sched_param.sched_priority); +# ifdef ENABLE_XFORMS_WRITE_STATS + eNB_stats = fopen("eNB_stats.txt", "w"); +#endif + + while (!oai_exit) { + ue_cnt=0; + + for(UE_id=0; UE_idstats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats"); + form_stats = create_form_stats_form(); + fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); + + for(UE_id=0; UE_idlte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); + + if (otg_enabled) { + fl_set_button(form_enb[CC_id][UE_id]->button_0,1); + fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON"); + } else { + fl_set_button(form_enb[CC_id][UE_id]->button_0,0); + fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic OFF"); + } + } // CC_id + } // UE_id + + int ret = pthread_create(&forms_thread, NULL, scope_thread_eNB, NULL); + + if (ret == 0) + pthread_setname_np( forms_thread, "xforms" ); + + printf("Scope thread created, ret=%d\n",ret); + return 0; +} // start_forms_eNB + + + +void end_forms(void) { + printf("waiting for XFORMS thread\n"); + pthread_join(forms_thread,NULL); + fl_hide_form(form_stats->stats_form); + fl_free_form(form_stats->stats_form); + fl_hide_form(form_stats_l2->stats_form); + fl_free_form(form_stats_l2->stats_form); + + for(int UE_id=0; UE_idlte_phy_scope_enb); + fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb); + } + } +} // end_forms + diff --git a/openair1/PHY/TOOLS/lte_ue_scope.c b/openair1/PHY/TOOLS/lte_ue_scope.c new file mode 100644 index 0000000000..a5a5267cc5 --- /dev/null +++ b/openair1/PHY/TOOLS/lte_ue_scope.c @@ -0,0 +1,150 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + + +/*! \file lte_ue_scope.c + * \brief UE specific softsope implementation + * \author Nokia BellLabs France, francois Taburet + * \date 2019 + * \version 0.1 + * \company Nokia Bell-Labs France + * \email: francois.taburet@nokia-bell-labs.com + * \note + * \warning + */ + +#include "targets/RT/USER/lte-softmodem.h" +#include "UTIL/OPT/opt.h" +#include "common/config/config_userapi.h" +#include "PHY/TOOLS/lte_phy_scope.h" +#include "targets/RT/USER/stats.h" +#include "PHY/phy_vars_ue.h" +// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) +// at eNB 0, an UL scope for every UE +FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; +FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; +FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; +char title[255]; +unsigned char scope_enb_num_ue = 2; +static pthread_t forms_thread; //xforms + + +void reset_stats(FL_OBJECT *button, long arg) { + int i,j,k; + PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; + + for (i=0; idlsch[i][0]->Mlimit; j++) { + phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; + phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; + } + + phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0; + phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0; + phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0; + phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0; + phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0; + phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0; + } + } +} + + +static void *scope_thread_UE(void *arg) { + char stats_buffer[16384]; +# ifdef ENABLE_XFORMS_WRITE_STATS + FILE *UE_stats, *eNB_stats; +# endif + struct sched_param sched_param; + sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1; + sched_setscheduler(0, SCHED_FIFO,&sched_param); + printf("Scope thread has priority %d\n",sched_param.sched_priority); +# ifdef ENABLE_XFORMS_WRITE_STATS + UE_stats = fopen("UE_stats.txt", "w"); +#endif + + while (!oai_exit) { + // dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm); + //fl_set_object_label(form_stats->stats_text, stats_buffer); + fl_clear_browser(form_stats->stats_text); + fl_add_browser_line(form_stats->stats_text, stats_buffer); + phy_scope_UE(form_ue[0], + PHY_vars_UE_g[0][0], + 0, + 0,7); + // printf("%s",stats_buffer); + } + +# ifdef ENABLE_XFORMS_WRITE_STATS + + if (UE_stats) { + rewind (UE_stats); + fwrite (stats_buffer, 1, len, UE_stats); + fclose (UE_stats); + } + +# endif + pthread_exit((void *)arg); +} + + +int uescope_autoinit(void) { + int UE_id; + int argc; + char *argv; + printf("XFORMS\n"); + fl_initialize (&argc, &argv, NULL, 0, 0); + form_stats = create_form_stats_form(); + fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); + UE_id = 0; + form_ue[UE_id] = create_lte_phy_scope_ue(); + sprintf (title, "LTE DL SCOPE UE"); + fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); + /* + if (openair_daq_vars.use_ia_receiver) { + fl_set_button(form_ue[UE_id]->button_0,1); + fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON"); + } else { + fl_set_button(form_ue[UE_id]->button_0,0); + fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); + }*/ + fl_set_button(form_ue[UE_id]->button_0,0); + fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); + int ret = pthread_create(&forms_thread, NULL, scope_thread_UE, NULL); + + if (ret == 0) + pthread_setname_np( forms_thread, "xforms" ); + + printf("Scope thread created, ret=%d\n",ret); + return 0; +} // start_forms_UE + + +void end_forms(void) { + printf("waiting for XFORMS thread\n"); + pthread_join(forms_thread,NULL); + fl_hide_form(form_stats->stats_form); + fl_free_form(form_stats->stats_form); + fl_hide_form(form_ue[0]->lte_phy_scope_ue); + fl_free_form(form_ue[0]->lte_phy_scope_ue); +} // end_forms diff --git a/openair1/PHY/TOOLS/phy_scope_interface.c b/openair1/PHY/TOOLS/phy_scope_interface.c new file mode 100644 index 0000000000..835fb4ea7b --- /dev/null +++ b/openair1/PHY/TOOLS/phy_scope_interface.c @@ -0,0 +1,53 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file openair1/PHY/TOOLS/phy_scope_interface.c + * \brief soft scope API interface implementation + * \author Nokia BellLabs France, francois Taburet + * \date 2019 + * \version 0.1 + * \company Nokia BellLabs France + * \email: francois.taburet@nokia-bell-labs.com + * \note + * \warning + */ +#include +#include "common/config/config_userapi.h" +#include "common/utils/load_module_shlib.h" +#include "phy_scope_interface.h" + +#define SOFTSCOPE_ENDFUNC_IDX 0 +static loader_shlibfunc_t scope_fdesc[]= {{"end_forms",NULL}}; + +int load_softscope(char *exectype) { + char libname[64]; + sprintf(libname,"%.10sscope",exectype); + return load_module_shlib(libname,scope_fdesc,1,NULL); +} + +int end_forms(void) { + if (scope_fdesc[SOFTSCOPE_ENDFUNC_IDX].fptr) { + scope_fdesc[SOFTSCOPE_ENDFUNC_IDX].fptr(); + return 0; + } + + return -1; +} diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h new file mode 100644 index 0000000000..4081a9cd96 --- /dev/null +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -0,0 +1,37 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file phy_scope_interface.h + * \brief softscope interface API include file + * \author Nokia BellLabs France, francois Taburet + * \date 2019 + * \version 0.1 + * \company Nokia BellLabs France + * \email: francois.taburet@nokia-bell-labs.com + * \note + * \warning + */ + + +int load_softscope(char *exectype); +int end_forms(void) ; + + diff --git a/targets/RT/USER/lte-softmodem-common.c b/targets/RT/USER/lte-softmodem-common.c index 242d0b76d7..f152e7c83d 100644 --- a/targets/RT/USER/lte-softmodem-common.c +++ b/targets/RT/USER/lte-softmodem-common.c @@ -60,6 +60,7 @@ void get_common_options(void) { uint32_t nonbiot; uint32_t rfsim; uint32_t basicsim; + uint32_t do_forms; paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ; checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC; @@ -100,6 +101,10 @@ void get_common_options(void) { set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT); } + if (do_forms) { + set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT); + } + #if BASIC_SIMULATOR set_softmodem_optmask(SOFTMODEM_BASICSIM_BIT); #endif diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 80b9c3a3fd..998fb4ecfa 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -64,6 +64,7 @@ #include "LAYER2/MAC/mac_proto.h" #include "RRC/LTE/rrc_vars.h" #include "PHY_INTERFACE/phy_interface_vars.h" +#include "PHY/TOOLS/phy_scope_interface.h" #include "nfapi/oai_integration/vendor_ext.h" #ifdef SMBV #include "PHY/TOOLS/smbv.h" @@ -90,22 +91,9 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "system.h" -#ifdef XFORMS - #include "PHY/TOOLS/lte_phy_scope.h" - #include "stats.h" -#endif + #include "lte-softmodem.h" #include "NB_IoT_interface.h" -#ifdef XFORMS - // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) - // at eNB 0, an UL scope for every UE - FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; - FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; - char title[255]; - unsigned char scope_enb_num_ue = 2; - static pthread_t forms_thread; //xforms -#endif //XFORMS pthread_cond_t nfapi_sync_cond; @@ -163,12 +151,8 @@ char channels[128] = "0"; int rx_input_level_dBm; -#ifdef XFORMS - extern int otg_enabled; -#else - int otg_enabled; -#endif -//int number_of_cards = 1; + +int otg_enabled; uint8_t exit_missed_slots=1; @@ -301,75 +285,6 @@ void exit_function(const char *file, const char *function, const int line, const exit(1); } -#ifdef XFORMS - - -void reset_stats(FL_OBJECT *button, long arg) { - int i,j,k; - PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; - - for (i=0; idlsch[i][0]->Mlimit; j++) { - phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; - phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; - phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; - } - - phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0; - phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0; - phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0; - phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0; - phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0; - phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0; - } - } -} - -static void *scope_thread(void *arg) { -# ifdef ENABLE_XFORMS_WRITE_STATS - FILE *eNB_stats; -# endif - struct sched_param sched_param; - int UE_id, CC_id; - int ue_cnt=0; - sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1; - sched_setscheduler(0, SCHED_FIFO,&sched_param); - printf("Scope thread has priority %d\n",sched_param.sched_priority); -# ifdef ENABLE_XFORMS_WRITE_STATS - eNB_stats = fopen("eNB_stats.txt", "w"); -#endif - - while (!oai_exit) { - ue_cnt=0; - - for(UE_id=0; UE_idnode_type)) { pdcp_layer_init(); uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? - (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; + (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; + if (IS_SOFTMODEM_NOS1) pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ; + pdcp_module_init(pdcp_initmask); if (NODE_IS_CU(RC.rrc[0]->node_type)) { @@ -608,14 +525,8 @@ static void wait_nfapi_init(char *thread_name) { int main( int argc, char **argv ) { int i; -#if defined (XFORMS) - void *status; -#endif int CC_id = 0; int ru_id; -#if defined (XFORMS) - int ret; -#endif if ( load_configmodule(argc,argv,0) == NULL) { exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); @@ -675,9 +586,9 @@ int main( int argc, char **argv ) { /* Read configuration */ if (RC.nb_inst > 0) { read_config_and_init(); - /* Start the agent. If it is turned off in the configuration, it won't start */ RCconfig_flexran(); + for (i = 0; i < RC.nb_inst; i++) { flexran_agent_start(i); } @@ -718,42 +629,10 @@ int main( int argc, char **argv ) { mlockall(MCL_CURRENT | MCL_FUTURE); pthread_cond_init(&sync_cond,NULL); pthread_mutex_init(&sync_mutex, NULL); -#ifdef XFORMS - int UE_id; - printf("XFORMS\n"); - if (get_softmodem_params()->do_forms==1) { - fl_initialize (&argc, argv, NULL, 0, 0); - form_stats_l2 = create_form_stats_form(); - fl_show_form (form_stats_l2->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "l2 stats"); - form_stats = create_form_stats_form(); - fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); + if(IS_SOFTMODEM_DOFORMS) + load_softscope("enb"); - for(UE_id=0; UE_idlte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - - if (otg_enabled) { - fl_set_button(form_enb[CC_id][UE_id]->button_0,1); - fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON"); - } else { - fl_set_button(form_enb[CC_id][UE_id]->button_0,0); - fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic OFF"); - } - } // CC_id - } // UE_id - - ret = pthread_create(&forms_thread, NULL, scope_thread, NULL); - - if (ret == 0) - pthread_setname_np( forms_thread, "xforms" ); - - printf("Scope thread created, ret=%d\n",ret); - } - -#endif rt_sleep_ns(10*100000000ULL); if (NFAPI_MODE!=NFAPI_MONOLITHIC) { @@ -845,26 +724,9 @@ int main( int argc, char **argv ) { // stop threads if (RC.nb_inst == 0 || !NODE_IS_CU(RC.rrc[0]->node_type)) { - int UE_id; -#ifdef XFORMS - printf("waiting for XFORMS thread\n"); + if(IS_SOFTMODEM_DOFORMS) + end_forms(); - if (get_softmodem_params()->do_forms==1) { - pthread_join(forms_thread,&status); - fl_hide_form(form_stats->stats_form); - fl_free_form(form_stats->stats_form); - fl_hide_form(form_stats_l2->stats_form); - fl_free_form(form_stats_l2->stats_form); - - for(UE_id=0; UE_idlte_phy_scope_enb); - fl_free_form(form_enb[CC_id][UE_id]->lte_phy_scope_enb); - } - } - } - -#endif LOG_I(ENB_APP,"stopping MODEM threads\n"); stop_eNB(NB_eNB_INST); stop_RU(RC.nb_RU); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 5900889e6d..e25cbed0b7 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -179,7 +179,6 @@ #define WAIT_FOR_SYNC softmodem_params.wait_for_sync #define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag #define CHAIN_OFFSET softmodem_params.chain_offset -#define DO_FORMS softmodem_params.do_forms #define NUMEROLOGY softmodem_params.numerology #define EMULATE_RF softmodem_params.emulate_rf #define CLOCK_SOURCE softmodem_params.clock_source @@ -195,7 +194,7 @@ {"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \ {"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \ {"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \ - {"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&DO_FORMS, defintval:0, TYPE_INT8, 0}, \ + {"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \ {"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \ {"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \ {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \ @@ -245,6 +244,7 @@ #define SOFTMODEM_RFSIM_BIT (1<<10) #define SOFTMODEM_BASICSIM_BIT (1<<11) #define SOFTMODEM_SIML1_BIT (1<<12) +#define SOFTMODEM_DOFORMS_BIT (1<<15) typedef struct { uint64_t optmask; THREAD_STRUCT thread_struct; @@ -255,7 +255,6 @@ typedef struct { int wait_for_sync; //eNodeB only int single_thread_flag; //eNodeB only int chain_offset; - uint32_t do_forms; int numerology; unsigned int start_msc; uint32_t clock_source; @@ -268,6 +267,7 @@ typedef struct { #define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT) #define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT) #define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) +#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT) extern uint64_t get_softmodem_optmask(void); extern uint64_t set_softmodem_optmask(uint64_t bitmask); extern void get_common_options(void); diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index fdfdbfc1dd..74380913dd 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -66,7 +66,7 @@ #include "LAYER2/MAC/mac_proto.h" #include "RRC/LTE/rrc_vars.h" #include "PHY_INTERFACE/phy_interface_vars.h" - +#include "PHY/TOOLS/phy_scope_interface.h" #include "common/utils/LOG/log.h" #include "nfapi/oai_integration/vendor_ext.h" #include "UTIL/OTG/otg_tx.h" @@ -85,26 +85,14 @@ #include "system.h" -#ifdef XFORMS - #include "PHY/TOOLS/lte_phy_scope.h" - #include "stats.h" -#endif + #include "lte-softmodem.h" /* temporary compilation wokaround (UE/eNB split */ uint16_t sf_ahead; -#ifdef XFORMS - // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) - // at eNB 0, an UL scope for every UE - FD_lte_phy_scope_ue *form_ue[NUMBER_OF_UE_MAX]; - FD_lte_phy_scope_enb *form_enb[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - FD_stats_form *form_stats=NULL,*form_stats_l2=NULL; - char title[255]; - unsigned char scope_enb_num_ue = 2; - static pthread_t forms_thread; //xforms -#endif //XFORMS + pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; @@ -148,7 +136,7 @@ int snr_dB=25; runmode_t mode = normal_txrx; FILE *input_fd=NULL; - +int otg_enabled=0; #if MAX_NUM_CCs == 1 rx_gain_t rx_gain_mode[MAX_NUM_CCs][4] = {{max_gain,max_gain,max_gain,max_gain}}; @@ -179,10 +167,6 @@ char channels[128] = "0"; int rx_input_level_dBm; -#ifdef XFORMS - extern int otg_enabled; -#endif -//int number_of_cards = 1; static LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; @@ -329,68 +313,8 @@ void exit_function(const char *file, const char *function, const int line, const exit(1); } -#ifdef XFORMS -void reset_stats(FL_OBJECT *button, long arg) { - int i,j,k; - PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; - - for (i=0; idlsch[i][0]->Mlimit; j++) { - phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; - phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0; - phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0; - } - - phy_vars_eNB->UE_stats[i].dlsch_l2_errors[k]=0; - phy_vars_eNB->UE_stats[i].ulsch_errors[k]=0; - phy_vars_eNB->UE_stats[i].ulsch_consecutive_errors=0; - phy_vars_eNB->UE_stats[i].dlsch_sliding_cnt=0; - phy_vars_eNB->UE_stats[i].dlsch_NAK_round0=0; - phy_vars_eNB->UE_stats[i].dlsch_mcs_offset=0; - } - } -} - -static void *scope_thread(void *arg) { - char stats_buffer[16384]; -# ifdef ENABLE_XFORMS_WRITE_STATS - FILE *UE_stats, *eNB_stats; -# endif - struct sched_param sched_param; - sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1; - sched_setscheduler(0, SCHED_FIFO,&sched_param); - printf("Scope thread has priority %d\n",sched_param.sched_priority); -# ifdef ENABLE_XFORMS_WRITE_STATS - UE_stats = fopen("UE_stats.txt", "w"); -#endif - - while (!oai_exit) { - // dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm); - //fl_set_object_label(form_stats->stats_text, stats_buffer); - fl_clear_browser(form_stats->stats_text); - fl_add_browser_line(form_stats->stats_text, stats_buffer); - phy_scope_UE(form_ue[0], - PHY_vars_UE_g[0][0], - 0, - 0,7); - // printf("%s",stats_buffer); - } - -# ifdef ENABLE_XFORMS_WRITE_STATS - - if (UE_stats) { - rewind (UE_stats); - fwrite (stats_buffer, 1, len, UE_stats); - fclose (UE_stats); - } - -# endif - pthread_exit((void *)arg); -} -#endif @@ -675,9 +599,6 @@ void init_pdcp(void) { } int main( int argc, char **argv ) { -#if defined (XFORMS) - void *status; -#endif int CC_id; uint8_t abstraction_flag=0; #ifdef UESIM_EXPANSION @@ -687,9 +608,6 @@ int main( int argc, char **argv ) { // if not changed from the command line option --num-ues NB_UE_INST=1; NB_THREAD_INST=1; -#if defined (XFORMS) - int ret; -#endif configmodule_interface_t *config_mod; start_background_system(); config_mod = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY); @@ -749,9 +667,7 @@ int main( int argc, char **argv ) { MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); init_opt(); - init_pdcp(); - //TTN for D2D printf ("RRC control socket\n"); rrc_control_socket_init(); @@ -898,37 +814,9 @@ int main( int argc, char **argv ) { PHY_vars_UE_g[0][0]->no_timing_correction = 1; } -#ifdef XFORMS - int UE_id; - printf("XFORMS\n"); + if(IS_SOFTMODEM_DOFORMS) + load_softscope("ue"); - if (get_softmodem_params()->do_forms==1) { - fl_initialize (&argc, argv, NULL, 0, 0); - form_stats = create_form_stats_form(); - fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats"); - UE_id = 0; - form_ue[UE_id] = create_lte_phy_scope_ue(); - sprintf (title, "LTE DL SCOPE UE"); - fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - /* - if (openair_daq_vars.use_ia_receiver) { - fl_set_button(form_ue[UE_id]->button_0,1); - fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON"); - } else { - fl_set_button(form_ue[UE_id]->button_0,0); - fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); - }*/ - fl_set_button(form_ue[UE_id]->button_0,0); - fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF"); - ret = pthread_create(&forms_thread, NULL, scope_thread, NULL); - - if (ret == 0) - pthread_setname_np( forms_thread, "xforms" ); - - printf("Scope thread created, ret=%d\n",ret); - } - -#endif config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); printf("Sending sync to all threads (%p,%p,%p)\n",&sync_var,&sync_cond,&sync_mutex); pthread_mutex_lock(&sync_mutex); @@ -957,19 +845,11 @@ int main( int argc, char **argv ) { printf("Terminating application - oai_exit=%d\n",oai_exit); #endif + // stop threads -#ifdef XFORMS - printf("waiting for XFORMS thread\n"); + if(IS_SOFTMODEM_DOFORMS) + end_forms(); - if (get_softmodem_params()->do_forms==1) { - pthread_join(forms_thread,&status); - fl_hide_form(form_stats->stats_form); - fl_free_form(form_stats->stats_form); - fl_hide_form(form_ue[0]->lte_phy_scope_ue); - fl_free_form(form_ue[0]->lte_phy_scope_ue); - } - -#endif printf("stopping MODEM threads\n"); pthread_cond_destroy(&sync_cond); pthread_mutex_destroy(&sync_mutex);