replace a set of #define by a C bit array, remove duplicated extern global variable declaration

This commit is contained in:
Laurent THOMAS
2025-01-09 15:28:25 +01:00
committed by Robert Schmidt
parent f9bff3d6a0
commit e0ca70c36d
48 changed files with 135 additions and 284 deletions
@@ -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) {
@@ -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;
@@ -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) {
+1 -1
View File
@@ -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();
+4 -6
View File
@@ -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 <iostream>
#include <vector>
@@ -42,7 +42,6 @@ uint64_t get_softmodem_optmask(void);
#include <sstream>
#include <mutex>
#include <thread>
#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;
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -60,6 +60,8 @@
//#include <complex.h>
#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 <pthread.h>
@@ -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;
-2
View File
@@ -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,
-5
View File
@@ -45,12 +45,7 @@
#include <time.h>
// 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)
{
+5 -3
View File
@@ -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;
}
+4 -4
View File
@@ -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;
}
-2
View File
@@ -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;
+1 -2
View File
@@ -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;
-2
View File
@@ -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;
-1
View File
@@ -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;
+1 -3
View File
@@ -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;
-1
View File
@@ -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;