Add a parameter to load_configmodule API to allow an exec to specify that it may be run with only command line options

This commit is contained in:
frtabu
2018-11-05 17:28:00 +01:00
parent df6030540a
commit d151ce6feb
7 changed files with 15 additions and 14 deletions
+3 -3
View File
@@ -651,9 +651,9 @@ function main() {
compilations \ compilations \
lte-simulators coding \ lte-simulators coding \
libcoding.so $dbin/libcoding.so libcoding.so $dbin/libcoding.so
compilations \ # compilations \
lte-simulators $config_libconfig_shlib \ # lte-simulators $config_libconfig_shlib \
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so # lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
fi fi
# Core simulators # Core simulators
+4 -4
View File
@@ -169,7 +169,7 @@ int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
return numdefvals; return numdefvals;
} }
configmodule_interface_t *load_configmodule(int argc, char **argv) configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags)
{ {
char *cfgparam=NULL; char *cfgparam=NULL;
char *modeparams=NULL; char *modeparams=NULL;
@@ -208,10 +208,10 @@ int OoptIdx=-1;
/* oad_configmodule function */ /* oad_configmodule function */
if (cfgparam == NULL) { if (cfgparam == NULL) {
tmpflags = tmpflags | CONFIG_NOOOPT; tmpflags = tmpflags | CONFIG_NOOOPT;
if (strstr(argv[0],"uesoftmodem") == NULL || strstr(argv[0],"lsim") == NULL) { if ( initflags & CONFIG_ENABLECMDLINEONLY) {
cfgparam = CONFIG_LIBCONFIGFILE ":" DEFAULT_CFGFILENAME; cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ;
} else { } else {
cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ; cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ;cfgparam = CONFIG_LIBCONFIGFILE ":" DEFAULT_CFGFILENAME;
} }
} }
+3 -2
View File
@@ -106,8 +106,9 @@ extern configmodule_interface_t *cfgptr;
#define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); } #define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); }
#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); } #define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
#define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); } #define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); }
extern configmodule_interface_t *load_configmodule(int argc, char **argv); #define CONFIG_ENABLECMDLINEONLY (1<<1)
extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
extern void end_configmodule(void); extern void end_configmodule(void);
#endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */ #endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */
+1 -1
View File
@@ -988,7 +988,7 @@ int main(int argc, char **argv)
if (transmission_mode>1) pa=dBm3; if (transmission_mode>1) pa=dBm3;
printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa); printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa);
AssertFatal(load_configmodule(argc,argv) != NULL, AssertFatal(load_configmodule(argc,argv, CONFIG_ENABLECMDLINEONLY) != NULL,
"cannot load configuration module, exiting\n"); "cannot load configuration module, exiting\n");
logInit(); logInit();
set_glog_onlinelog(true); set_glog_onlinelog(true);
+1 -1
View File
@@ -429,7 +429,7 @@ int main(int argc, char **argv) {
cpu_freq_GHz = (double)get_cpu_freq_GHz(); cpu_freq_GHz = (double)get_cpu_freq_GHz();
cpuf = cpu_freq_GHz; cpuf = cpu_freq_GHz;
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz); printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
AssertFatal(load_configmodule(argc,argv) != NULL, AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL,
"cannot load configuration module, exiting\n"); "cannot load configuration module, exiting\n");
logInit(); logInit();
// enable these lines if you need debug info // enable these lines if you need debug info
+1 -1
View File
@@ -695,7 +695,7 @@ int main( int argc, char **argv )
#if defined (XFORMS) #if defined (XFORMS)
int ret; int ret;
#endif #endif
if ( load_configmodule(argc,argv) == NULL) { if ( load_configmodule(argc,argv,0) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
} }
+2 -2
View File
@@ -761,7 +761,7 @@ int main( int argc, char **argv )
#endif #endif
start_background_system(); start_background_system();
if ( load_configmodule(argc,argv) == NULL) { if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
} }
@@ -887,7 +887,7 @@ int main( int argc, char **argv )
if (simL1flag==1) { if (simL1flag==1) {
AssertFatal(NULL!=load_configmodule(argc,argv), AssertFatal(NULL!=load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY),
"[SOFTMODEM] Error, configuration module init failed\n"); "[SOFTMODEM] Error, configuration module init failed\n");
RCConfig_sim(); RCConfig_sim();