diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index 7a3d299139..43a84e4b8f 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -26,6 +26,7 @@ #include #include "assertions.h" #include "SIMULATION/TOOLS/sim.h" +#include "common/config/config_userapi.h" #include "common/utils/load_module_shlib.h" #include "PHY/CODING/nrLDPC_extern.h" //#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" @@ -402,7 +403,7 @@ int main(int argc, char *argv[]) { short block_length=8448; // decoder supports length: 1201 -> 1280, 2401 -> 2560 // default to check output inside ldpc, the NR version checks the outer CRC defined by 3GPP - char *ldpc_version = ""; + char *ldpc_version = NULL; /* version of the ldpc decoder library to use (XXX suffix to use when loading libldpc_XXX.so */ short max_iterations=5; int n_segments=1; @@ -424,7 +425,19 @@ int main(int argc, char *argv[]) short BG = 0, Zc; - while ((c = getopt (argc, argv, "q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1) + if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) { + exit_fun("[LDPCTEST] Error, configuration module init failed\n"); + } + logInit(); + + while ((c = getopt (argc, argv, "--:q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1) { + + /* ignore long options starting with '--' and their arguments that are handled by configmodule */ + /* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */ + if (c == 1 || c == '-') + continue; + + printf("handling optarg %c\n",c); switch (c) { case 'q': qbits = atoi(optarg); @@ -494,6 +507,7 @@ int main(int argc, char *argv[]) exit(1); break; } + } //printf("the decoder supports BG2, Kb=10, Z=128 & 256\n"); //printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n"); printf("block length %d: \n", block_length); diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index 100df821d2..78b44599fb 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -11,6 +11,7 @@ #include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h" #include "PHY/CODING/coding_defs.h" #include "SIMULATION/TOOLS/sim.h" +#include "common/config/config_userapi.h" //#include "common/utils/LOG/log.h" #include "coding_unitary_defs.h" //#define DEBUG_DCI_POLAR_PARAMS @@ -32,7 +33,19 @@ int main(int argc, char *argv[]) uint8_t aggregation_level = 8, decoderListSize = 8, logFlag = 0; uint16_t rnti=0; - while ((arguments = getopt (argc, argv, "s:d:f:m:i:l:a:p:hqgFL:k:")) != -1) { + if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) { + exit_fun("[POLARTEST] Error, configuration module init failed\n"); + } + logInit(); + + while ((arguments = getopt (argc, argv, "--:s:d:f:m:i:l:a:p:hqgFL:k:")) != -1) { + + /* ignore long options starting with '--' and their arguments that are handled by configmodule */ + /* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */ + if (arguments == 1 || arguments == '-') + continue; + + printf("handling optarg %c\n",arguments); switch (arguments) { case 's': SNRstart = atof(optarg); diff --git a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c index 36e71b2a32..d6306495a7 100644 --- a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c +++ b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c @@ -1,4 +1,5 @@ #include +#include "common/config/config_userapi.h" #include "SIMULATION/TOOLS/sim.h" #include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h" #include "coding_unitary_defs.h" @@ -26,7 +27,19 @@ int main(int argc, char *argv[]) int8_t channelOutput_int8[NR_SMALL_BLOCK_CODED_BITS]; unsigned char qbits = 8; - while ((arguments = getopt(argc, argv, "s:d:f:l:i:mhg")) != -1) + if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == 0) { + exit_fun("[SMALLBLOCKTEST] Error, configuration module init failed\n"); + } + logInit(); + + while ((arguments = getopt(argc, argv, "--:s:d:f:l:i:mhg")) != -1) { + + /* ignore long options starting with '--' and their arguments that are handled by configmodule */ + /* with this opstring getopt returns 1 for non-option arguments, refer to 'man 3 getopt' */ + if (arguments == 1 || arguments == '-') + continue; + + printf("handling optarg %c\n",arguments); switch (arguments) { case 's': SNRstart = atof(optarg); @@ -69,6 +82,7 @@ int main(int argc, char *argv[]) perror("[smallblocktest.c] Problem at argument parsing with getopt"); exit(-1); } + } uint16_t mask = 0x07ff >> (11 - messageLength); for (SNR = SNRstart; SNR <= SNRstop; SNR += SNRinc) {