Commit 5d2a1ace authored by Robert Schmidt's avatar Robert Schmidt

nr-{ue,}softmodem: Check for correct modes

THere are four possibilities, for the three options (phy_test, do_ra,
nsa):

- None is set -> SA
- Only one is set of each -> corresponding mode

Introduce a function softmodem_verify_mode() to check for these.
parent e0e1ca65
......@@ -605,11 +605,7 @@ int main( int argc, char **argv ) {
LOG_W(UTIL,
"no SYS_NICE capability: cannot set thread priority and affinity, consider running with sudo for optimum performance\n");
if (get_softmodem_params()->do_ra)
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
if (get_softmodem_params()->sa)
AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n");
softmodem_verify_mode(get_softmodem_params());
#if T_TRACER
T_Config_Init();
......
......@@ -407,6 +407,9 @@ int main(int argc, char **argv)
get_common_options(uniqCfg, SOFTMODEM_5GUE_BIT);
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
softmodem_verify_mode(get_softmodem_params());
#if T_TRACER
T_Config_Init();
#endif
......@@ -461,12 +464,6 @@ int main(int argc, char **argv)
get_channel_model_mode(uniqCfg);
}
if (get_softmodem_params()->do_ra)
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
if (get_softmodem_params()->sa)
AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n");
if (!get_softmodem_params()->nsa && get_softmodem_params()->emulate_l1)
start_oai_nrue_threads();
......
......@@ -174,6 +174,24 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask)
if (stats_disabled)
set_softmodem_optmask(SOFTMODEM_NOSTATS_BIT);
}
void softmodem_verify_mode(const softmodem_params_t *p)
{
if (IS_SA_MODE(p)) {
LOG_I(UTIL, "running in SA mode (no --phy-test, --do-ra, --nsa option present)\n");
return;
}
if (p->phy_test)
LOG_I(UTIL, "running in phy-test mode (--phy-test)\n");
if (p->do_ra)
LOG_I(UTIL, "running in do-ra mode (--do-ra)\n");
if (p->nsa)
LOG_I(UTIL, "running in NSA mode (--nsa)\n");
int num_modes = p->phy_test + p->do_ra + p->nsa;
AssertFatal(num_modes == 1, "--phy-test, --do-ra, and --nsa are mutually exclusive\n");
}
void softmodem_printresources(int sig, telnet_printfunc_t pf) {
struct rusage usage;
struct timespec stop;
......
......@@ -330,6 +330,7 @@ typedef struct {
} softmodem_params_t;
#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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment