diff --git a/common/ran_context.h b/common/ran_context.h index 244e6fd30d..e009d0987f 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -32,7 +32,9 @@ #ifndef __RAN_CONTEXT_H__ #define __RAN_CONTEXT_H__ - +#ifdef __cplusplus +extern "C" { +#endif #include #include @@ -111,6 +113,8 @@ typedef struct { } RAN_CONTEXT_t; extern RAN_CONTEXT_t RC; - #define NB_eNB_INST RC.nb_inst +#ifdef __cplusplus +} +#endif #endif diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 3da25380dd..64d67e13d1 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -657,7 +657,7 @@ void run_telnetsrv(void) { fprintf(stderr,"[TELNETSRV] Error %s on listen call\n",strerror(errno)); using_history(); - int plen=sprintf(prompt,"%s_%s> ",TELNET_PROMPT_PREFIX,get_softmodem_function(NULL)); + int plen = sprintf(prompt, "%s_%s> ", TELNET_PROMPT_PREFIX, get_softmodem_function()); TELNET_LOG("\nInitializing telnet server...\n"); while( (telnetparams.new_socket = accept(sock, &cli_addr, &cli_len)) ) { @@ -746,7 +746,7 @@ void run_telnetclt(void) { pthread_setname_np(pthread_self(), "telnetclt"); set_sched(pthread_self(),0,telnetparams.priority); char prompt[sizeof(TELNET_PROMPT_PREFIX)+10]; - sprintf(prompt,"%s_%s> ",TELNET_PROMPT_PREFIX,get_softmodem_function(NULL)); + sprintf(prompt, "%s_%s> ", TELNET_PROMPT_PREFIX, get_softmodem_function()); name.sin_family = AF_INET; struct in_addr addr; inet_aton("127.0.0.1", &addr) ; @@ -883,7 +883,7 @@ int telnetsrv_autoinit(void) { memset(&telnetparams,0,sizeof(telnetparams)); config_get(config_get_if(), telnetoptions, sizeofArray(telnetoptions), "telnetsrv"); /* possibly load a exec specific shared lib */ - char *execfunc=get_softmodem_function(NULL); + char *execfunc = get_softmodem_function(); char libname[64]; sprintf(libname,"telnetsrv_%s",execfunc); load_module_shlib(libname,NULL,0,NULL); diff --git a/common/utils/websrv/websrv.c b/common/utils/websrv/websrv.c index f6fb898104..4c8bea0c31 100644 --- a/common/utils/websrv/websrv.c +++ b/common/utils/websrv/websrv.c @@ -736,7 +736,7 @@ int websrv_callback_get_softmodemstatus(const struct _u_request *request, struct inet_ntop(AF_INET, &(websrvparams.instance.bind_address->sin_addr), ipstr, INET_ADDRSTRLEN); else sprintf(ipstr, "%s", "0.0.0.0"); - snprintf(srvinfo, sizeof(srvinfo) - 1, "%s:%hu %s", ipstr, websrvparams.instance.port, get_softmodem_function(NULL)); + snprintf(srvinfo, sizeof(srvinfo) - 1, "%s:%hu %s", ipstr, websrvparams.instance.port, get_softmodem_function()); json_t *modemvars = json_array(); websrv_add_modeminfo(modemvars, "connected to", srvinfo, "string"); websrv_add_modeminfo(modemvars, "config_file", CONFIG_GETCONFFILE, "configfile"); diff --git a/common/utils/websrv/websrv_scope.c b/common/utils/websrv/websrv_scope.c index 63e3c27b7c..8e3d9e4740 100644 --- a/common/utils/websrv/websrv_scope.c +++ b/common/utils/websrv/websrv_scope.c @@ -107,10 +107,10 @@ int websrv_scope_manager(uint64_t lcount, websrv_params_t *websrvparams) websrv_websocket_send_scopemessage(SCOPEMSG_TYPE_TIME, strtime, websrvparams_ptr->wm); } if ((lcount % scope_params.refrate) == 0) { - if (IS_SOFTMODEM_GNB_BIT && (scope_params.statusmask & SCOPE_STATUSMASK_STARTED)) { + if (IS_SOFTMODEM_GNB && (scope_params.statusmask & SCOPE_STATUSMASK_STARTED)) { phy_scope_gNB(scope_params.scopeform, scope_params.scopedata, scope_params.selectedTarget + 1 /* ue id, +1 as used in loop < limit */); } - if (IS_SOFTMODEM_5GUE_BIT && (scope_params.statusmask & SCOPE_STATUSMASK_STARTED)) { + if (IS_SOFTMODEM_5GUE && (scope_params.statusmask & SCOPE_STATUSMASK_STARTED)) { phy_scope_nrUE(((scopeData_t *)((PHY_VARS_NR_UE *)(scope_params.scopedata))->scopeData)->liveData, scope_params.scopeform, (PHY_VARS_NR_UE *)scope_params.scopedata, @@ -124,7 +124,7 @@ int websrv_scope_manager(uint64_t lcount, websrv_params_t *websrvparams) /* free scope resources, as websrv scope interface can be stopped and started */ void websrv_scope_stop(void) { - clear_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); + IS_SOFTMODEM_DOSCOPE = false; scope_params.statusmask &= ~SCOPE_STATUSMASK_STARTED; OAI_phy_scope_t *sp = (OAI_phy_scope_t *)scope_params.scopeform; if (sp != NULL) @@ -138,7 +138,7 @@ void websrv_scope_stop(void) char *websrv_scope_initdata(void) { scope_params.num_datamsg_max = 200; - if (IS_SOFTMODEM_GNB_BIT) { + if (IS_SOFTMODEM_GNB) { scopeParms_t p; p.ru = RC.ru[0]; p.gNB = RC.gNB[0]; @@ -147,7 +147,7 @@ char *websrv_scope_initdata(void) scope_params.scopeform = create_phy_scope_gnb(); scope_params.statusmask |= SCOPE_STATUSMASK_AVAILABLE; return "gNB"; - } else if (IS_SOFTMODEM_5GUE_BIT) { + } else if (IS_SOFTMODEM_5GUE) { scope_params.scopedata = PHY_vars_UE_g[0][0]; nrUEinitScope(PHY_vars_UE_g[0][0]); scope_params.scopeform = create_phy_scope_nrue(scope_params.selectedTarget); @@ -188,12 +188,12 @@ int websrv_scope_callback_set_params(const struct _u_request *request, struct _u websrv_scope_initdata(); scope_params.statusmask |= SCOPE_STATUSMASK_STARTED; scope_params.selectedTarget = 1; // 1 UE to be received from GUI (for xNB scope's - set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); // to trigger data copy in scope buffers + IS_SOFTMODEM_DOSCOPE = true; // to trigger data copy in scope buffers } httpstatus = 200; } else if (strcmp(vval, "stop") == 0) { scope_params.statusmask &= ~SCOPE_STATUSMASK_STARTED; - clear_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); + IS_SOFTMODEM_DOSCOPE = false; httpstatus = 200; } else { LOG_W(UTIL, "invalid startstop command value: %s\n", vval); @@ -232,11 +232,11 @@ int websrv_scope_callback_set_params(const struct _u_request *request, struct _u httpstatus = 200; } else if (strcmp(vname, "TargetSelect") == 0) { scope_params.selectedTarget = strtol(vval, NULL, 10); - if (IS_SOFTMODEM_GNB_BIT && scope_params.selectedTarget > NUMBER_OF_UE_MAX) { + if (IS_SOFTMODEM_GNB && scope_params.selectedTarget > NUMBER_OF_UE_MAX) { snprintf(errmsg, sizeof(errmsg) - 1, "max UE index is %d for this gNB", NUMBER_OF_UE_MAX); httpstatus = 500; scope_params.selectedTarget = 1; - } else if (IS_SOFTMODEM_5GUE_BIT && scope_params.selectedTarget > 0) { + } else if (IS_SOFTMODEM_5GUE && scope_params.selectedTarget > 0) { snprintf(errmsg, sizeof(errmsg) - 1, "UE currently supports only one gNB"); httpstatus = 500; scope_params.selectedTarget = 0; @@ -276,7 +276,7 @@ int websrv_scope_callback_get_desc(const struct _u_request *request, struct _u_r char stitle[64]; websrv_scope_stop(); // in case it's not the first connection - if (IS_SOFTMODEM_DOSCOPE | IS_SOFTMODEM_ENB_BIT | IS_SOFTMODEM_4GUE_BIT) { + if (IS_SOFTMODEM_DOSCOPE | IS_SOFTMODEM_ENB | IS_SOFTMODEM_4GUE) { strcpy(stitle, "none"); } else { strcpy(stitle, websrv_scope_initdata()); diff --git a/executables/lte-enb.c b/executables/lte-enb.c index 42c97e8913..477ff5cd68 100644 --- a/executables/lte-enb.c +++ b/executables/lte-enb.c @@ -44,28 +44,17 @@ #define _GNU_SOURCE #include - - -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all - #include "assertions.h" - #include "PHY/types.h" - #include "PHY/INIT/phy_init.h" #include "PHY/defs_eNB.h" #include "SCHED/sched_eNB.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" #include "nfapi/oai_integration/vendor_ext.h" -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include "radio/COMMON/common_lib.h" -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" @@ -102,8 +91,6 @@ struct timing_info_t { // Fix per CC openair rf/if device update -extern int oai_exit; - extern int transmission_mode; #include "executables/thread-common.h" @@ -927,7 +914,7 @@ void init_eNB_proc(int inst) { if (cpu_meas_enabled) threadCreate(&proc->process_stats_thread, process_stats_thread, (void *)eNB, "opp stats", -1, sched_get_priority_min(SCHED_OAI)); - if (!IS_SOFTMODEM_NOSTATS_BIT) + if (!IS_SOFTMODEM_NOSTATS) threadCreate(&proc->L1_stats_thread, L1_stats_thread, (void *)eNB, "L1 stats", -1, sched_get_priority_min(SCHED_OAI)); } diff --git a/executables/lte-ru.c b/executables/lte-ru.c index aadf1ca9b0..326e55b288 100644 --- a/executables/lte-ru.c +++ b/executables/lte-ru.c @@ -45,8 +45,6 @@ #include #include -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all - #include "assertions.h" #include "PHY/defs_common.h" #include "PHY/types.h" @@ -78,7 +76,6 @@ static int DEFRUTPCORES[] = {2,4,6,8}; #define MBMS_EXPERIMENTAL -extern int oai_exit; extern clock_source_t clock_source; #include "executables/thread-common.h" //extern PARALLEL_CONF_t get_thread_parallel_conf(void); diff --git a/executables/lte-softmodem.c b/executables/lte-softmodem.c index 3511ae0a04..2a0b73c019 100644 --- a/executables/lte-softmodem.c +++ b/executables/lte-softmodem.c @@ -33,9 +33,6 @@ #define _GNU_SOURCE /* See feature_test_macros(7) */ #include - -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all - #include "assertions.h" #include "common/oai_version.h" @@ -45,14 +42,9 @@ #include "common/ran_context.h" #include "common/config/config_userapi.h" #include "common/utils/load_module_shlib.h" -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include "radio/COMMON/common_lib.h" #include "radio/ETHERNET/if_defs.h" -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include #include "PHY/phy_vars.h" @@ -297,7 +289,8 @@ void exit_function(const char *file, const char *function, const int line, const static void get_options(configmodule_interface_t *cfg) { CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); - get_common_options(cfg, SOFTMODEM_ENB_BIT); + IS_SOFTMODEM_ENB = true; + get_common_options(cfg); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) { diff --git a/executables/lte-softmodem.h b/executables/lte-softmodem.h index 8a1149d581..8c55f0dc65 100644 --- a/executables/lte-softmodem.h +++ b/executables/lte-softmodem.h @@ -20,7 +20,6 @@ #include #include #include "radio/COMMON/common_lib.h" -//#undef MALLOC #include "assertions.h" #include "PHY/types.h" #include "PHY/defs_eNB.h" @@ -121,9 +120,6 @@ extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; extern int rx_input_level_dBm; - -extern int oai_exit; - extern openair0_config_t openair0_cfg[MAX_CARDS]; extern pthread_cond_t sync_cond; extern pthread_mutex_t sync_mutex; diff --git a/executables/lte-ue.c b/executables/lte-ue.c index 8e05aae489..74a2fa240b 100644 --- a/executables/lte-ue.c +++ b/executables/lte-ue.c @@ -41,9 +41,6 @@ #include "PHY/MODULATION/modulation_UE.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include "PHY/phy_extern_ue.h" #include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac_proto.h" diff --git a/executables/lte-uesoftmodem.c b/executables/lte-uesoftmodem.c index 35fb4d4246..f039bc4479 100644 --- a/executables/lte-uesoftmodem.c +++ b/executables/lte-uesoftmodem.c @@ -33,9 +33,6 @@ #define _GNU_SOURCE /* See feature_test_macros(7) */ #include - -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all - #include "assertions.h" #include "PHY/types.h" @@ -46,14 +43,9 @@ #include "common/ran_context.h" #include "common/config/config_userapi.h" #include "common/utils/load_module_shlib.h" -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include "radio/COMMON/common_lib.h" #include "radio/ETHERNET/if_defs.h" -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include "PHY/phy_vars_ue.h" #include "PHY/LTE_TRANSPORT/transport_vars.h" @@ -274,7 +266,8 @@ static void get_options(configmodule_interface_t *cfg) CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); /* unknown parameters on command line will be checked in main after all init have been performed */ - get_common_options(cfg, SOFTMODEM_4GUE_BIT); + IS_SOFTMODEM_4GUE = true; + get_common_options(cfg); paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC; paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC; config_process_cmdline(cfg, cmdline_uemodeparams, sizeofArray(cmdline_uemodeparams), NULL); diff --git a/executables/main_ru.c b/executables/main_ru.c index 68a3e49a0e..92db896cc3 100644 --- a/executables/main_ru.c +++ b/executables/main_ru.c @@ -119,7 +119,8 @@ void exit_function(const char *file, const char *function, const int line, const static void get_options(configmodule_interface_t *cfg) { CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); - get_common_options(cfg, SOFTMODEM_ENB_BIT); + IS_SOFTMODEM_ENB = true; + get_common_options(cfg); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); // RCConfig(); diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 8098b75a56..e5f2a13664 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -33,8 +33,6 @@ #define _GNU_SOURCE #include -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all - #include "assertions.h" #include #include @@ -54,13 +52,7 @@ #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include "radio/COMMON/common_lib.h" - -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/phy_extern.h" @@ -376,9 +368,9 @@ void init_gNB_Tpool(int inst) { // this will be removed when the msgDataTx is not necessary anymore gNB->msgDataTx = msgDataTx; - if ((!get_softmodem_params()->emulate_l1) && (!IS_SOFTMODEM_NOSTATS_BIT) && (NFAPI_MODE!=NFAPI_MODE_VNF) && (NFAPI_MODE != NFAPI_MODE_AERIAL)) - threadCreate(&proc->L1_stats_thread,nrL1_stats_thread,(void*)gNB,"L1_stats",-1,OAI_PRIORITY_RT_LOW); - + if ((!get_softmodem_params()->emulate_l1) && (!IS_SOFTMODEM_NOSTATS) && (NFAPI_MODE != NFAPI_MODE_VNF) + && (NFAPI_MODE != NFAPI_MODE_AERIAL)) + threadCreate(&proc->L1_stats_thread, nrL1_stats_thread, (void *)gNB, "L1_stats", -1, OAI_PRIORITY_RT_LOW); } void term_gNB_Tpool(int inst) { diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 37e520431c..6d0a2044ba 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -29,8 +29,6 @@ #include #include -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all - #include "common/utils/nr/nr_common.h" #include "common/utils/assertions.h" #include "common/utils/system.h" diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 9bec61f2a0..b7fc576845 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -25,7 +25,6 @@ #include #include "radio/COMMON/common_lib.h" -#undef MALLOC #include "assertions.h" #include "PHY/types.h" diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 96527fb303..a200b1e8a4 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -82,7 +82,6 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "radio/COMMON/common_lib.h" #include "s1ap_eNB.h" #include "sctp_eNB_task.h" -#include "softmodem-bits.h" #include "system.h" #include "time_meas.h" #include "utils.h" @@ -350,7 +349,8 @@ static void get_options(configmodule_interface_t *cfg) { paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ; CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); - get_common_options(cfg, SOFTMODEM_GNB_BIT); + IS_SOFTMODEM_GNB = true; + get_common_options(cfg); config_process_cmdline(cfg, cmdline_params, sizeofArray(cmdline_params), NULL); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); } diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 78abb7b081..c18a6647dd 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -1133,7 +1133,7 @@ void init_NR_UE_threads(PHY_VARS_NR_UE *UE) { char thread_name[16]; sprintf(thread_name, "UEthread_%d", UE->Mod_id); threadCreate(&thread, UE_thread, (void *)UE, thread_name, -1, OAI_PRIORITY_RT_MAX); - if (!IS_SOFTMODEM_NOSTATS_BIT) { + if (!IS_SOFTMODEM_NOSTATS) { pthread_t stat_pthread; sprintf(thread_name, "L1_UE_stats_%d", UE->Mod_id); threadCreate(&stat_pthread, nrL1_UE_stats_thread, UE, thread_name, -1, OAI_PRIORITY_RT_LOW); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 158cc293ef..503fcc0a76 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -403,8 +403,8 @@ int main(int argc, char **argv) // get options and fill parameters from configuration file get_options(uniqCfg); // Command-line options specific for NRUE - - get_common_options(uniqCfg, SOFTMODEM_5GUE_BIT); + IS_SOFTMODEM_5GUE = true; + get_common_options(uniqCfg); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); softmodem_verify_mode(get_softmodem_params()); diff --git a/executables/ru_control.c b/executables/ru_control.c index 2136e5ff53..8345007f0b 100644 --- a/executables/ru_control.c +++ b/executables/ru_control.c @@ -43,16 +43,11 @@ #include #include -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all - #include "assertions.h" #include "PHY/types.h" #include "PHY/defs_common.h" -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all - - #include "radio/COMMON/common_lib.h" #include "radio/ETHERNET/ethernet_lib.h" @@ -79,7 +74,6 @@ const char rru_format_options[4][20] = {"OAI_IF5_only","OAI_IF4p5_only","OAI_IF5 const char rru_formats[3][20] = {"OAI_IF5","MBP_IF5","OAI_IF4p5"}; const char ru_if_formats[4][20] = {"LOCAL_RF","REMOTE_OAI_IF5","REMOTE_MBP_IF5","REMOTE_OAI_IF4p5"}; -extern int oai_exit; extern void wait_eNBs(void); int send_tick(RU_t *ru) diff --git a/executables/softmodem-bits.h b/executables/softmodem-bits.h deleted file mode 100644 index 6d527148cd..0000000000 --- a/executables/softmodem-bits.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 - */ - -#ifndef SOFTMODEM_BITS_H -#define SOFTMODEM_BITS_H - -// clang-format off -#define BIT_0 (1 << 0) -#define BIT_1 (1 << 1) -#define BIT_2 (1 << 2) -#define BIT_10 (1 << 10) -#define BIT_12 (1 << 12) -#define BIT_13 (1 << 13) -#define BIT_15 (1 << 15) -#define BIT_16 (1 << 16) -#define BIT_17 (1 << 17) -#define BIT_18 (1 << 18) -#define BIT_20 (1 << 20) -#define BIT_21 (1 << 21) -#define BIT_22 (1 << 22) -#define BIT_23 (1 << 23) -#define BIT_24 (1 << 24) -#define BIT_25 (1 << 25) - -#define SOFTMODEM_NOS1_BIT BIT_0 -#define SOFTMODEM_NOKRNMOD_BIT BIT_1 -#define SOFTMODEM_NONBIOT_BIT BIT_2 -#define SOFTMODEM_RFSIM_BIT BIT_10 -#define SOFTMODEM_SIML1_BIT BIT_12 -#define SOFTMODEM_DLSIM_BIT BIT_13 -#define SOFTMODEM_DOSCOPE_BIT BIT_15 -#define SOFTMODEM_RECPLAY_BIT BIT_16 -#define SOFTMODEM_TELNETCLT_BIT BIT_17 -#define SOFTMODEM_RECRECORD_BIT BIT_18 -#define SOFTMODEM_ENB_BIT BIT_20 -#define SOFTMODEM_GNB_BIT BIT_21 -#define SOFTMODEM_4GUE_BIT BIT_22 -#define SOFTMODEM_5GUE_BIT BIT_23 -#define SOFTMODEM_NOSTATS_BIT BIT_24 -#define SOFTMODEM_IMSCOPE_BIT BIT_25 -// clang-format on - -#endif // SOFTMODEM_BITS_H diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 2fed359d82..92c913c88e 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -41,55 +41,33 @@ #include "softmodem-common.h" #include "nfapi/oai_integration/vendor_ext.h" - -static softmodem_params_t softmodem_params; char *parallel_config=NULL; char *worker_config=NULL; int usrp_tx_thread = 0; uint8_t nfapi_mode=0; -static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS; static struct timespec start; -uint64_t get_softmodem_optmask(void) { - return softmodem_params.optmask; -} - -uint64_t set_softmodem_optmask(uint64_t bitmask) { - softmodem_params.optmask = softmodem_params.optmask | bitmask; - return softmodem_params.optmask; -} - -uint64_t clear_softmodem_optmask(uint64_t bitmask) -{ - softmodem_params.optmask = softmodem_params.optmask & (~bitmask); - return softmodem_params.optmask; -} - +static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) { return &softmodem_params; } -int32_t check_execmask(uint64_t execmask) { - char *softmodemfunc=map_int_to_str(softmodem_funcs, execmask); - if (softmodemfunc != NULL) { - set_softmodem_optmask(execmask); - return 0; - } - return -1; -} -char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) { - uint64_t fmask=(get_softmodem_optmask()&SOFTMODEM_FUNC_BITS); - char *softmodemfunc=map_int_to_str(softmodem_funcs, fmask); - if (sofmodemfunc_mask_ptr != NULL) - *sofmodemfunc_mask_ptr=fmask; - if (softmodemfunc != NULL) { - return softmodemfunc; - } +char *get_softmodem_function(void) +{ + optmask_t fmask = *get_softmodem_optmask(); + if (fmask.bit.SOFTMODEM_ENB_BIT) + return "enb"; + if (fmask.bit.SOFTMODEM_GNB_BIT) + return "gnb"; + if (fmask.bit.SOFTMODEM_4GUE_BIT) + return "4Gue"; + if (fmask.bit.SOFTMODEM_5GUE_BIT) + return "5Gue"; return "???"; } -void get_common_options(configmodule_interface_t *cfg, uint32_t execmask) +void get_common_options(configmodule_interface_t *cfg) { int32_t stats_disabled = 0; uint32_t online_log_messages=0; @@ -101,7 +79,6 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask) uint32_t enable_imscope = 0; int nfapi_index = 0; char *logmem_filename = NULL; - check_execmask(execmask); paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC; checkedparam_t cmdline_CheckParams[] = CMDLINE_PARAMS_CHECK_DESC; @@ -136,7 +113,7 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask) } if (start_telnetclt) { - set_softmodem_optmask(SOFTMODEM_TELNETCLT_BIT); + IS_SOFTMODEM_TELNETCLT = true; } if (logmem_filename != NULL && strlen(logmem_filename) > 0) { @@ -145,23 +122,23 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask) } if (noS1) { - set_softmodem_optmask(SOFTMODEM_NOS1_BIT); + IS_SOFTMODEM_NOS1 = true; } if (nonbiot) { - set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT); + IS_SOFTMODEM_NONBIOT = true; } if (rfsim) { - set_softmodem_optmask(SOFTMODEM_RFSIM_BIT); + IS_SOFTMODEM_RFSIM = true; } if (do_forms) { - set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); + IS_SOFTMODEM_DOSCOPE = true; } if (enable_imscope) { - set_softmodem_optmask(SOFTMODEM_IMSCOPE_BIT); + IS_SOFTMODEM_IMSCOPE_ENABLED = true; } if (start_websrv) { @@ -173,7 +150,7 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask) if(worker_config != NULL) set_worker_conf(worker_config); nfapi_setmode(nfapi_mode); if (stats_disabled) - set_softmodem_optmask(SOFTMODEM_NOSTATS_BIT); + IS_SOFTMODEM_NOSTATS = true; } void softmodem_verify_mode(const softmodem_params_t *p) diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index dfeded92ba..19d2f4f76f 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -32,7 +32,6 @@ #ifndef SOFTMODEM_COMMON_H #define SOFTMODEM_COMMON_H #include "openair1/PHY/defs_common.h" -#include "softmodem-bits.h" #ifdef __cplusplus extern "C" { @@ -268,28 +267,46 @@ extern int usrp_tx_thread; /***************************************************************************************************************************************/ -#define SOFTMODEM_FUNC_BITS (SOFTMODEM_ENB_BIT | SOFTMODEM_GNB_BIT | SOFTMODEM_5GUE_BIT | SOFTMODEM_4GUE_BIT) -#define MAPPING_SOFTMODEM_FUNCTIONS {{"enb",SOFTMODEM_ENB_BIT},{"gnb",SOFTMODEM_GNB_BIT},{"4Gue",SOFTMODEM_4GUE_BIT},{"5Gue",SOFTMODEM_5GUE_BIT}} - - -#define IS_SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT) -#define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT) -#define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT) -#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) -#define IS_SOFTMODEM_DLSIM ( get_softmodem_optmask() & SOFTMODEM_DLSIM_BIT) -#define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT) -#define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) -#define IS_SOFTMODEM_IQRECORDER ( get_softmodem_optmask() & SOFTMODEM_RECRECORD_BIT) -#define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT) -#define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT) -#define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT) -#define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT) -#define IS_SOFTMODEM_5GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_5GUE_BIT) -#define IS_SOFTMODEM_NOSTATS_BIT ( get_softmodem_optmask() & SOFTMODEM_NOSTATS_BIT) -#define IS_SOFTMODEM_IMSCOPE_ENABLED ( get_softmodem_optmask() & SOFTMODEM_IMSCOPE_BIT) - +#define IS_SOFTMODEM_NOS1 (get_softmodem_optmask()->bit.SOFTMODEM_NOS1_BIT) +#define IS_SOFTMODEM_NONBIOT (get_softmodem_optmask()->bit.SOFTMODEM_NONBIOT_BIT) +#define IS_SOFTMODEM_RFSIM (get_softmodem_optmask()->bit.SOFTMODEM_RFSIM_BIT) +#define IS_SOFTMODEM_SIML1 (get_softmodem_optmask()->bit.SOFTMODEM_SIML1_BIT) +#define IS_SOFTMODEM_DLSIM (get_softmodem_optmask()->bit.SOFTMODEM_DLSIM_BIT) +#define IS_SOFTMODEM_DOSCOPE (get_softmodem_optmask()->bit.SOFTMODEM_DOSCOPE_BIT) +#define IS_SOFTMODEM_IQPLAYER (get_softmodem_optmask()->bit.SOFTMODEM_RECPLAY_BIT) +#define IS_SOFTMODEM_IQRECORDER (get_softmodem_optmask()->bit.SOFTMODEM_RECRECORD_BIT) +#define IS_SOFTMODEM_TELNETCLT (get_softmodem_optmask()->bit.SOFTMODEM_TELNETCLT_BIT) +#define IS_SOFTMODEM_ENB (get_softmodem_optmask()->bit.SOFTMODEM_ENB_BIT) +#define IS_SOFTMODEM_GNB (get_softmodem_optmask()->bit.SOFTMODEM_GNB_BIT) +#define IS_SOFTMODEM_4GUE (get_softmodem_optmask()->bit.SOFTMODEM_4GUE_BIT) +#define IS_SOFTMODEM_5GUE (get_softmodem_optmask()->bit.SOFTMODEM_5GUE_BIT) +#define IS_SOFTMODEM_NOSTATS (get_softmodem_optmask()->bit.SOFTMODEM_NOSTATS_BIT) +#define IS_SOFTMODEM_IMSCOPE_ENABLED (get_softmodem_optmask()->bit.SOFTMODEM_IMSCOPE_BIT) +typedef struct optmask_s { + union { + struct { + uint64_t SOFTMODEM_NOS1_BIT: 1; + uint64_t SOFTMODEM_NOKRNMOD_BIT: 1; + uint64_t SOFTMODEM_NONBIOT_BIT: 1; + uint64_t SOFTMODEM_RFSIM_BIT: 1; + uint64_t SOFTMODEM_SIML1_BIT: 1; + uint64_t SOFTMODEM_DLSIM_BIT: 1; + uint64_t SOFTMODEM_DOSCOPE_BIT: 1; + uint64_t SOFTMODEM_RECPLAY_BIT: 1; + uint64_t SOFTMODEM_TELNETCLT_BIT: 1; + uint64_t SOFTMODEM_RECRECORD_BIT: 1; + uint64_t SOFTMODEM_ENB_BIT: 1; + uint64_t SOFTMODEM_GNB_BIT: 1; + uint64_t SOFTMODEM_4GUE_BIT: 1; + uint64_t SOFTMODEM_5GUE_BIT: 1; + uint64_t SOFTMODEM_NOSTATS_BIT: 1; + uint64_t SOFTMODEM_IMSCOPE_BIT: 1; + } bit; + uint64_t v; // allow to export entire bit set, force to 64 bit processor atomic size + }; +} optmask_t; typedef struct { - uint64_t optmask; + optmask_t optmask; //THREAD_STRUCT thread_struct; char *rf_config_file; char *threadPoolConfig; @@ -323,12 +340,10 @@ typedef struct { #define IS_SA_MODE(sM_params) (!(sM_params)->phy_test && !(sM_params)->do_ra && !(sM_params)->nsa) void softmodem_verify_mode(const softmodem_params_t *p); -uint64_t get_softmodem_optmask(void); -uint64_t set_softmodem_optmask(uint64_t bitmask); -uint64_t clear_softmodem_optmask(uint64_t bitmask); +#define get_softmodem_optmask() (&(get_softmodem_params()->optmask)) softmodem_params_t *get_softmodem_params(void); -void get_common_options(configmodule_interface_t *cfg, uint32_t execmask); -char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr); +void get_common_options(configmodule_interface_t *cfg); +char *get_softmodem_function(void); #define SOFTMODEM_RTSIGNAL (SIGRTMIN+1) void set_softmodem_sighandler(void); extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; @@ -336,7 +351,6 @@ extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; extern int usrp_tx_thread; extern uint16_t sl_ahead; extern uint16_t sf_ahead; -extern int oai_exit; void ru_tx_func(void *param); void configure_ru(void *, void *arg); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h index 5210dbec6d..14d0e9fb2d 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h @@ -295,12 +295,12 @@ static inline void nr_polar_deinterleaver(uint8_t *input, uint8_t *output, uint1 static inline void nr_polar_rm_deinterleaving_lut(uint16_t *out, const uint E) { int16_t in[E]; - for (int i = 0; i < E; i++) + for (uint i = 0; i < E; i++) in[i] = i; int T = ceil((sqrt(8 * E + 1) - 1) / 2); int v_tab[T][T]; memset(v_tab, 0, sizeof(v_tab)); - int k = 0; + uint k = 0; for (int i = 0; i < T; i++) { for (int j = 0; j < T - i; j++) { if (k < E) { diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index dc3c98c4f1..52905cfaf9 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -58,8 +58,6 @@ uint64_t deadline, uint64_t period);*/ -extern int oai_exit; - void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) { int i, r, aa, layer; diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index be998beb44..9755455762 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -42,8 +42,6 @@ #include "PHY_INTERFACE/phy_interface.h" #include "transport_proto.h" -extern int oai_exit; - static const int8_t wACK_RX[5][4] = {{-1, -1, -1, -1}, {-1, 1, -1, 1}, {-1, -1, 1, 1}, {-1, 1, 1, -1}, {1, 1, 1, 1}}; void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch) { diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c index f3c1e8fef3..f69e468e7b 100644 --- a/openair1/PHY/TOOLS/calibration_test.c +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -41,7 +41,7 @@ int main(int argc, char **argv) { paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ; CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); - get_common_options(uniqCfg, SOFTMODEM_GNB_BIT); + get_common_options(uniqCfg); config_process_cmdline(uniqCfg, cmdline_params, sizeofArray(cmdline_params), NULL); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); lock_memory_to_ram(); diff --git a/openair1/PHY/TOOLS/imscope/imscope.cpp b/openair1/PHY/TOOLS/imscope/imscope.cpp index 84ae7d85f4..9b025a8843 100644 --- a/openair1/PHY/TOOLS/imscope/imscope.cpp +++ b/openair1/PHY/TOOLS/imscope/imscope.cpp @@ -33,7 +33,7 @@ #include "openair1/PHY/defs_nr_UE.h" extern "C" { #include "openair1/PHY/TOOLS/phy_scope_interface.h" -uint64_t get_softmodem_optmask(void); +#include "executables/softmodem-common.h" } #include #include @@ -42,7 +42,6 @@ uint64_t get_softmodem_optmask(void); #include #include #include -#include "executables/softmodem-bits.h" #define MAX_OFFSETS 14 #define NR_MAX_RB 273 @@ -678,7 +677,7 @@ void *imscope_thread(void *data_void_ptr) static double last_frame_time = glfwGetTime(); static int target_fps = 24; - bool is_ue = (get_softmodem_optmask() & SOFTMODEM_5GUE_BIT) > 0; + bool is_ue = IS_SOFTMODEM_5GUE; bool close_window = false; while (!glfwWindowShouldClose(window) && close_window == false) { // Poll and handle events (inputs, window resize, etc.) @@ -795,8 +794,7 @@ void *imscope_thread(void *data_void_ptr) extern "C" void imscope_autoinit(void *dataptr) { - AssertFatal((get_softmodem_optmask() & SOFTMODEM_5GUE_BIT) || (get_softmodem_optmask() & SOFTMODEM_GNB_BIT), - "Scope cannot find NRUE or GNB context"); + AssertFatal(IS_SOFTMODEM_5GUE || IS_SOFTMODEM_GNB, "Scope cannot find NRUE or GNB context"); for (auto i = 0U; i < EXTRA_SCOPE_TYPES; i++) { scope_array[i].is_data_ready = false; @@ -804,7 +802,7 @@ extern "C" void imscope_autoinit(void *dataptr) scope_array[i].meta = {-1, -1}; } - if (SOFTMODEM_GNB_BIT & get_softmodem_optmask()) { + if (IS_SOFTMODEM_GNB) { scopeParms_t *scope_params = (scopeParms_t *)dataptr; scopeData_t *scope = (scopeData_t *)calloc(1, sizeof(scopeData_t)); scope->copyData = copyDataThreadSafe; diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index a661fb892b..da89b41960 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -1165,9 +1165,9 @@ STATICFORXSCOPE void nrUEinitScope(PHY_VARS_NR_UE *ue) } void nrscope_autoinit(void *dataptr) { - AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context"); + AssertFatal((IS_SOFTMODEM_GNB || IS_SOFTMODEM_5GUE), "Scope cannot find NRUE or GNB context"); - if (IS_SOFTMODEM_GNB_BIT) + if (IS_SOFTMODEM_GNB) gNBinitScope(dataptr); else nrUEinitScope(dataptr); diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index cd3202eeb9..02eff79320 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -60,6 +60,8 @@ //#include #include "time_meas.h" #include "common/platform_types.h" +#include "common/ran_context.h" +#include "nr-softmodem-common.h" #define MAX_NUM_RU_PER_eNB 64 #include @@ -1048,8 +1050,6 @@ typedef uint8_t(encoder_if_t)(uint8_t *input, uint8_t *output, uint8_t F); -extern int oai_exit; - static inline void wait_sync(char *thread_name) { int rc; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index db68730c33..2bde391979 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1429,8 +1429,6 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { stop_meas(&eNB->ulsch_decoding_stats); } -extern int oai_exit; - void fill_rx_indication(PHY_VARS_eNB *eNB, int ULSCH_id, int frame, diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 7a0b21ace7..b385a1b540 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -45,12 +45,7 @@ #include - // RU OFDM Modulator gNodeB - - -extern int oai_exit; - // OFDM modulation core routine, generates a first_symbol to first_symbol+num_symbols on a particular slot and TX antenna port void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 75a8028df7..40d35c4a00 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -56,6 +56,7 @@ #include "dummy_functions.c" #include "executables/thread-common.h" #include "common/ran_context.h" +#include "executables/softmodem-common.h" void feptx_ofdm(RU_t *ru, int frame, int subframe); void feptx_prec(RU_t *ru, int frame, int subframe); @@ -2121,7 +2122,8 @@ int main(int argc, char **argv) { else return(0); } -/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ -uint64_t get_softmodem_optmask(void) { - return 0; +static softmodem_params_t softmodem_params; +softmodem_params_t *get_softmodem_params(void) +{ + return &softmodem_params; } diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index e9b7d99e5c..14e3c69696 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -1518,8 +1518,8 @@ int main(int argc, char **argv) { return(0); } - -/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ -uint64_t get_softmodem_optmask(void) { - return 0; +static softmodem_params_t softmodem_params; +softmodem_params_t *get_softmodem_params(void) +{ + return &softmodem_params; } diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index cac4c6604a..1730c91816 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -72,8 +72,6 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; - -uint64_t get_softmodem_optmask(void) {return 0;} static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) { return &softmodem_params; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 99ab0c82b1..b34042a771 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -88,7 +88,6 @@ #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" #include "openair1/SIMULATION/TOOLS/sim.h" #include "openair2/RRC/LTE/rrc_vars.h" -#include "softmodem-bits.h" #include "thread-pool.h" #include "time_meas.h" #include "utils.h" @@ -623,7 +622,7 @@ int main(int argc, char **argv) get_softmodem_params()->phy_test = 1; get_softmodem_params()->usim_test = 1; get_softmodem_params()->do_ra = 0; - set_softmodem_optmask(SOFTMODEM_DLSIM_BIT); + IS_SOFTMODEM_DLSIM = true; if (snr1set==0) snr1 = snr0+10; diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 4489c3e7bb..b6d92b9b81 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -77,8 +77,6 @@ void deref_sched_response(int _) LOG_E(PHY, "fatal\n"); exit(1); } - -uint64_t get_softmodem_optmask(void) {return 0;} static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) { return &softmodem_params; diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index de69fb6c16..b61de2082e 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -91,7 +91,6 @@ nfapi_mode_t nfapi_getmode(void) { return NFAPI_MODE_UNKNOWN; } void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) { } /* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ -uint64_t get_softmodem_optmask(void) {return 0;} static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) { return &softmodem_params; diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 45bc2aaa42..81d6fff9b3 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -65,9 +65,7 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 3, 1}; const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; // needed for some functions -PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}}; - -uint64_t get_softmodem_optmask(void) {return 0;} +PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = {{NULL}}; static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) { return &softmodem_params; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index e2802feffd..a353d1f90c 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -59,7 +59,6 @@ RAN_CONTEXT_t RC; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4]; -uint64_t get_softmodem_optmask(void) {return 0;} static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) { return &softmodem_params; diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index 71366105fc..9fdf0cb75a 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -44,7 +44,6 @@ #include "common/utils/system.h" extern RAN_CONTEXT_t RC; -extern int oai_exit; void lte_dump_mac_stats(eNB_MAC_INST *mac, FILE *fd) { diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 10d982442f..4e9acbf355 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -33,7 +33,6 @@ //#include "defs.h" #include "mac_proto.h" #include "radio/COMMON/common_lib.h" -//#undef MALLOC #include "assertions.h" #include "executables/nr-uesoftmodem.h" #include "nr_rlc/nr_rlc_oai_api.h" diff --git a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp index 760de0df3d..ac7ed2f73a 100644 --- a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp +++ b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_power_procedures.cpp @@ -23,10 +23,6 @@ extern "C" { #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "executables/softmodem-common.h" -uint64_t get_softmodem_optmask(void) -{ - return 0; -} static softmodem_params_t softmodem_params; softmodem_params_t* get_softmodem_params(void) { diff --git a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp index 12502b9065..af8e140824 100644 --- a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp +++ b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp @@ -23,10 +23,7 @@ extern "C" { #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "executables/softmodem-common.h" -uint64_t get_softmodem_optmask(void) -{ - return 0; -} + static softmodem_params_t softmodem_params; softmodem_params_t *get_softmodem_params(void) { diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index f8e6d120de..fad97ac2cb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -297,8 +297,13 @@ void mac_top_init_gNB(ngran_node_t node_type, RC.nrmac[i]->pre_processor_dl = nr_init_fr1_dlsch_preprocessor(0); RC.nrmac[i]->pre_processor_ul = nr_init_fr1_ulsch_preprocessor(0); } - if (!IS_SOFTMODEM_NOSTATS_BIT) - threadCreate(&RC.nrmac[i]->stats_thread, nrmac_stats_thread, (void*)RC.nrmac[i], "MAC_STATS", -1, sched_get_priority_min(SCHED_OAI)+1 ); + if (!IS_SOFTMODEM_NOSTATS) + threadCreate(&RC.nrmac[i]->stats_thread, + nrmac_stats_thread, + (void *)RC.nrmac[i], + "MAC_STATS", + -1, + sched_get_priority_min(SCHED_OAI) + 1); mac_rrc_init(RC.nrmac[i], node_type); }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index e8042abd80..3c3ef5367f 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -129,10 +129,6 @@ static sdu_size_t pdcp_output_sdu_bytes_to_write; notifiedFIFO_t pdcp_sdu_list; pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; - - -extern int oai_exit; - pthread_t pdcp_stats_thread_desc; /*! \fn bool pdcp_config_req_asn1 (const protocol_ctxt_t* const ctxt_pP, srb_flag_t srb_flagP, uint32_t action, rb_id_t rb_id, * uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode) \brief Function for RRC to diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 44118704a4..9cf81fbbe3 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -844,7 +844,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea { case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: { - nfapi_nr_dl_tti_request_t *dl_tti_request = MALLOC(sizeof(*dl_tti_request)); + nfapi_nr_dl_tti_request_t *dl_tti_request = malloc16(sizeof(*dl_tti_request)); if (nfapi_nr_p7_message_unpack(buffer, len, dl_tti_request, sizeof(*dl_tti_request), NULL) < 0) { @@ -868,7 +868,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: { - nfapi_nr_tx_data_request_t *tx_data_request = MALLOC(sizeof(*tx_data_request)); + nfapi_nr_tx_data_request_t *tx_data_request = malloc16(sizeof(*tx_data_request)); if (nfapi_nr_p7_message_unpack(buffer, len, tx_data_request, sizeof(*tx_data_request), NULL) < 0) { @@ -888,7 +888,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: { - nfapi_nr_ul_dci_request_t *ul_dci_request = MALLOC(sizeof(*ul_dci_request)); + nfapi_nr_ul_dci_request_t *ul_dci_request = malloc16(sizeof(*ul_dci_request)); if (nfapi_nr_p7_message_unpack(buffer, len, ul_dci_request, sizeof(*ul_dci_request), NULL) < 0) { @@ -908,7 +908,7 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: { - nfapi_nr_ul_tti_request_t *ul_tti_request = MALLOC(sizeof(*ul_tti_request)); + nfapi_nr_ul_tti_request_t *ul_tti_request = malloc16(sizeof(*ul_tti_request)); if (nfapi_nr_p7_message_unpack(buffer, len, ul_tti_request, sizeof(*ul_tti_request), NULL) < 0) { diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 9e552eaa2f..2456a851de 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2477,11 +2477,11 @@ void *rrc_gnb_task(void *args_p) { int result; long stats_timer_id = 1; - if (!IS_SOFTMODEM_NOSTATS_BIT) { + if (!IS_SOFTMODEM_NOSTATS) { /* timer to write stats to file */ timer_setup(1, 0, TASK_RRC_GNB, 0, TIMER_PERIODIC, NULL, &stats_timer_id); } - + itti_mark_task_ready(TASK_RRC_GNB); LOG_I(NR_RRC,"Entering main loop of NR_RRC message task\n"); diff --git a/radio/COMMON/common_lib.c b/radio/COMMON/common_lib.c index a386d3a9bd..87bae83f62 100644 --- a/radio/COMMON/common_lib.c +++ b/radio/COMMON/common_lib.c @@ -101,12 +101,12 @@ int load_lib(openair0_device *device, openair0_cfg->recplay_mode = read_recplayconfig(&(openair0_cfg->recplay_conf),&(device->recplay_state)); if (openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) { - set_softmodem_optmask(SOFTMODEM_RECRECORD_BIT); // softmodem has to know we use the iqrecorder to workaround randomized algorithms + IS_SOFTMODEM_IQRECORDER = true; // softmodem has to know we use the iqrecorder to workaround randomized algorithms } if (openair0_cfg->recplay_mode == RECPLAY_REPLAYMODE) { deflibname=OAI_IQPLAYER_LIBNAME; shlib_fdesc[0].fname="device_init"; - set_softmodem_optmask(SOFTMODEM_RECPLAY_BIT); // softmodem has to know we use the iqplayer to workaround randomized algorithms + IS_SOFTMODEM_IQPLAYER = true; // softmodem has to know we use the iqplayer to workaround randomized algorithms } else if (IS_SOFTMODEM_RFSIM && flag == RAU_LOCAL_RADIO_HEAD) { deflibname=OAI_RFSIM_LIBNAME; shlib_fdesc[0].fname="device_init"; diff --git a/radio/ETHERNET/eth_udp.c b/radio/ETHERNET/eth_udp.c index 2f937eaabf..ea290f21cb 100644 --- a/radio/ETHERNET/eth_udp.c +++ b/radio/ETHERNET/eth_udp.c @@ -404,8 +404,6 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi (unsigned long long)timestamp,nsamps,nant,udptxelem->buff[0],udptxelem->buff[1]); return(0); } -extern int oai_exit; - void *udp_write_thread(void *arg) { udp_ctx_t *utx = (udp_ctx_t *)arg;