From 70dd524e2b0ffcea1f516cb04ef64cc903bd5289 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 4 Sep 2024 15:26:09 +0200 Subject: [PATCH] Define softmodem bits in a separate header for either C and C++ --- executables/softmodem-bits.h | 61 ++++++++++++++++++++++++++ executables/softmodem-common.h | 17 +------ openair1/PHY/TOOLS/imscope/imscope.cpp | 5 +-- 3 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 executables/softmodem-bits.h diff --git a/executables/softmodem-bits.h b/executables/softmodem-bits.h new file mode 100644 index 0000000000..6d527148cd --- /dev/null +++ b/executables/softmodem-bits.h @@ -0,0 +1,61 @@ +/* + * 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.h b/executables/softmodem-common.h index a336a77d50..141afa1a37 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -32,6 +32,7 @@ #ifndef SOFTMODEM_COMMON_H #define SOFTMODEM_COMMON_H #include "openair1/PHY/defs_common.h" +#include "softmodem-bits.h" #ifdef __cplusplus extern "C" { @@ -277,22 +278,6 @@ extern int usrp_tx_thread; /***************************************************************************************************************************************/ -#define SOFTMODEM_NOS1_BIT (1<<0) -#define SOFTMODEM_NONBIOT_BIT (1<<2) -#define SOFTMODEM_RFSIM_BIT (1<<10) -#define SOFTMODEM_SIML1_BIT (1<<12) -#define SOFTMODEM_DLSIM_BIT (1<<13) -#define SOFTMODEM_DOSCOPE_BIT (1<<15) -#define SOFTMODEM_RECPLAY_BIT (1<<16) -#define SOFTMODEM_TELNETCLT_BIT (1<<17) -#define SOFTMODEM_RECRECORD_BIT (1<<18) -#define SOFTMODEM_ENB_BIT (1<<20) -#define SOFTMODEM_GNB_BIT (1<<21) -#define SOFTMODEM_4GUE_BIT (1<<22) -#define SOFTMODEM_5GUE_BIT (1<<23) -#define SOFTMODEM_NOSTATS_BIT (1<<24) -#define SOFTMODEM_IMSCOPE_BIT (1<<25) - #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}} diff --git a/openair1/PHY/TOOLS/imscope/imscope.cpp b/openair1/PHY/TOOLS/imscope/imscope.cpp index 591e611be9..687226940f 100644 --- a/openair1/PHY/TOOLS/imscope/imscope.cpp +++ b/openair1/PHY/TOOLS/imscope/imscope.cpp @@ -42,6 +42,7 @@ uint64_t get_softmodem_optmask(void); #include #include #include +#include "executables/softmodem-bits.h" #define MAX_OFFSETS 14 #define NR_MAX_RB 273 @@ -617,7 +618,6 @@ void *imscope_thread(void *data_void_ptr) static double last_frame_time = glfwGetTime(); static int target_fps = 24; - const int SOFTMODEM_5GUE_BIT = 1 << 23; bool is_ue = (get_softmodem_optmask() & SOFTMODEM_5GUE_BIT) > 0; while (!glfwWindowShouldClose(window)) { // Poll and handle events (inputs, window resize, etc.) @@ -704,9 +704,6 @@ void *imscope_thread(void *data_void_ptr) extern "C" void imscope_autoinit(void *dataptr) { - // Copied here due to issues with headers - const int SOFTMODEM_GNB_BIT = 1 << 21; - const int SOFTMODEM_5GUE_BIT = 1 << 23; AssertFatal((get_softmodem_optmask() & SOFTMODEM_5GUE_BIT) || (get_softmodem_optmask() & SOFTMODEM_GNB_BIT), "Scope cannot find NRUE or GNB context");