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.
This commit is contained in:
Robert Schmidt
2024-11-12 13:55:49 +01:00
parent e0e1ca6583
commit 5d2a1ace17
4 changed files with 23 additions and 11 deletions
+18
View File
@@ -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;