Commit d268378f authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/fix_phy_simulators_configmodule' into integration_2024_w21c

parents 1465fed8 b51a144d
......@@ -26,6 +26,7 @@
#include <stdint.h>
#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);
......
......@@ -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);
......
#include <getopt.h>
#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) {
......
......@@ -662,7 +662,15 @@ int main(int argc, char **argv) {
int option_index;
int res;
while ((res=getopt_long_only(argc, argv, "", long_options, &option_index)) == 0) {
/* disable error messages from getopt_long_only */
opterr = 0;
while ((res=getopt_long_only(argc, argv, "-", long_options, &option_index)) >= 0) {
/* ignore configmodule options and their arguments*/
/* with these opstring and long_options getopt returns 1 for non-option arguments and '?' for unrecognized long options, refer to 'man 3 getopt' */
if (res == 1 || res == '?')
continue;
if (options[option_index].voidptr != NULL ) {
if (long_options[option_index].has_arg==no_argument)
*(bool *)options[option_index].iptr=1;
......@@ -877,8 +885,8 @@ int main(int argc, char **argv) {
if (transmission_mode>1) pa=dBm3;
printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa);
AssertFatal((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) != NULL,
"Cannot load configuration module, exiting\n");
uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY);
AssertFatal(uniqCfg != NULL, "Cannot load configuration module, exiting\n");
logInit();
set_glog_onlinelog(true);
// enable these lines if you need debug info
......
......@@ -395,8 +395,8 @@ int main(int argc, char **argv) {
cpuf = cpu_freq_GHz;
set_parallel_conf("PARALLEL_SINGLE_THREAD");
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
AssertFatal((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) != NULL,
"Cannot load configuration module, exiting\n");
uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY);
AssertFatal(uniqCfg != NULL, "Cannot load configuration module, exiting\n");
logInit();
set_glog(OAILOG_INFO);
// enable these lines if you need debug info
......@@ -447,7 +447,15 @@ int main(int argc, char **argv) {
int option_index;
int res;
while ((res=getopt_long_only(argc, argv, "", long_options, &option_index)) == 0) {
/* disable error messages from getopt_long_only */
opterr = 0;
while ((res=getopt_long_only(argc, argv, "-", long_options, &option_index)) >= 0) {
/* ignore configmodule options and their arguments*/
/* with these opstring and long_options getopt returns 1 for non-option arguments and '?' for unrecognized long options, refer to 'man 3 getopt' */
if (res == 1 || res == '?')
continue;
if (options[option_index].voidptr != NULL ) {
if (long_options[option_index].has_arg==no_argument)
*(bool *)options[option_index].iptr=1;
......
......@@ -146,7 +146,14 @@ int main(int argc, char **argv)
// logInit();
randominit(0);
while ((c = getopt(argc, argv, "df:hpVg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:L:X:")) != -1) {
while ((c = getopt(argc, argv, "--:df:hpVg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:L:X:")) != -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 'f':
write_output_file = 1;
......
......@@ -336,7 +336,14 @@ int main(int argc, char **argv)
FILE *scg_fd=NULL;
while ((c = getopt(argc, argv, "f:hA:p:f:g:i:n:s:S:t:v:x:y:z:o:M:N:F:GR:d:PI:L:a:b:e:m:w:T:U:q:X:Y:Z:c")) != -1) {
while ((c = getopt(argc, argv, "--:f:hA:p:f:g:i:n:s:S:t:v:x:y:z:o:M:N:F:GR:d:PI:L:a:b:e:m:w:T:U:q:X:Y:Z:c")) != -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 'f':
scg_fd = fopen(optarg,"r");
......
......@@ -243,7 +243,14 @@ int main(int argc, char **argv)
exit_fun("[NR_PBCHSIM] Error, configuration module init failed\n");
}
while ((c = getopt (argc, argv, "F:g:hIL:m:M:n:N:o:O:P:r:R:s:S:x:y:z:")) != -1) {
while ((c = getopt (argc, argv, "--:F:g:hIL:m:M:n:N:o:O:P:r:R:s:S:x:y:z:")) != -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 'f':
write_output_file=1;
......
......@@ -164,7 +164,14 @@ int main(int argc, char **argv){
randominit(0);
while ((c = getopt (argc, argv, "hHaA:Cc:l:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) {
while ((c = getopt (argc, argv, "--:hHaA:Cc:l:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -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 'a':
printf("Running AWGN simulation\n");
......
......@@ -313,7 +313,13 @@ int main(int argc, char **argv)
randominit(0);
while ((c = getopt(argc, argv, "c:hn:o:s:FIL:N:R:S:T:")) != -1) {
while ((c = getopt(argc, argv, "--:c:hn:o:s:FIL:N:R:S:T:")) != -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("SIDELINK PSBCH SIM: handling optarg %c\n", c);
switch (c) {
case 'c':
......
......@@ -155,7 +155,14 @@ int main(int argc, char **argv)
randominit(0);
logInit();
while ((c = getopt (argc, argv, "f:hA:f:g:i:I:P:B:b:t:T:m:n:r:o:s:S:x:y:z:N:F:GR:IL:q:cd:")) != -1) {
while ((c = getopt (argc, argv, "--:f:hA:f:g:i:I:P:B:b:t:T:m:n:r:o:s:S:x:y:z:N:F:GR:IL:q:cd:")) != -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 'f':
//write_output_file=1;
......
......@@ -165,8 +165,15 @@ int main(int argc, char **argv)
//logInit();
randominit(0);
//while ((c = getopt(argc, argv, "df:hpg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:")) != -1) {
while ((c = getopt(argc, argv, "hg:n:s:S:py:z:M:N:R:F:m:l:q:r:W:")) != -1) {
//while ((c = getopt(argc, argv, "--:df:hpg:i:j:n:l:m:r:s:S:y:z:M:N:F:R:P:")) != -1) {
while ((c = getopt(argc, argv, "--:hg:n:s:S:py:z:M:N:R:F:m:l:q:r:W:")) != -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 'f':
write_output_file = 1;
......
......@@ -223,7 +223,13 @@ int main(int argc, char *argv[])
/* initialize the sin-cos table */
InitSinLUT();
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:k:m:n:op:q:r:s:t:u:v:w:y:z:C:F:G:H:I:M:N:PR:S:T:U:L:ZW:E:X:")) != -1) {
while ((c = getopt(argc, argv, "--:a:b:c:d:ef:g:h:i:k:m:n:op:q:r:s:t:u:v:w:y:z:C:F:G:H:I:M:N:PR:S:T:U:L:ZW:E:X:")) != -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) {
......
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