Commit 32786cc7 authored by Francois TABURET's avatar Francois TABURET

Integration of configuration module. Temporarily keep the legacy mode.

lte-softmodem -O <config file> will trigger legacy config mode
ltesoftmodem  -O libconfig:<config file> will trigger configuration module usage.
parent 293bcf13
......@@ -37,43 +37,73 @@
int processoption(paramdef_t *cfgoptions, char *value)
{
int ret = 0;
int optisset=0;
int noarg=0;
if ((cfgoptions->paramflags &PARAMFLAG_BOOL) == 0) {
if (value == NULL) {
noarg=1;
} else if ( value[0] == '-') {
noarg = 1;
}
if (noarg == 1) {
fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
return 0;
}
}
switch(cfgoptions->type)
{
case TYPE_STRING:
check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
check_valptr(cfgoptions, cfgoptions->strptr, strlen(value+1));
config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *));
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(value+1));
sprintf(*(cfgoptions->strptr), "%s",value);
printf_cmdl("[LIBCONFIG] %s set to %s from command line\n", cfgoptions->optname, value);
ret++;
break;
case TYPE_STRINGLIST:
break;
printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, value);
optisset=1;
break;
case TYPE_UINT:
case TYPE_INT:
case TYPE_STRINGLIST:
break;
case TYPE_UINT32:
case TYPE_INT32:
case TYPE_UINT16:
case TYPE_INT16:
case TYPE_UINT8:
case TYPE_INT8:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(value,NULL,0));
optisset=1;
break;
case TYPE_UINT64:
case TYPE_INT64:
check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
*(cfgoptions->uptr) =strtol(value,NULL,0);
printf_cmdl("[LIBCONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
ret++;
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
*(cfgoptions->i64ptr)=strtoll(value,NULL,0);
printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
optisset=1;
break;
case TYPE_UINTARRAY:
case TYPE_INTARRAY:
break;
case TYPE_DOUBLE:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
*(cfgoptions->dblptr) = strtof(value,NULL);
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
optisset=1;
break;
case TYPE_IPV4ADDR:
break;
default:
fprintf(stderr,"[LIBCONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
break;
} /* switch on param type */
return ret;
if (optisset == 1) {
cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET;
}
return optisset;
}
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
......@@ -101,9 +131,13 @@ char *cfgpath;
if ( ( cfgoptions[i].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) {
continue;
}
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname);
if ( strcmp(*p + 1,cfgoptions[i].shortopt) == 0 ||
strcmp(*p + 2,cfgpath ) == 0 ) {
if (prefix != NULL) {
sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname);
} else {
sprintf(cfgpath,"%s",cfgoptions[i].optname);
}
if ( ((strlen(*p) > 1) && (strcmp(*p + 1,cfgoptions[i].shortopt) == 0)) ||
((strlen(*p) > 2) && (strcmp(*p + 2,cfgpath ) == 0 )) ) {
p++;
j =+ processoption(&(cfgoptions[i]), *p);
c--;
......
......@@ -42,7 +42,7 @@
#include "config_userapi.h"
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
int load_config_sharedlib(char *cfgmode, char *cfgP[], int numP, configmodule_interface_t *cfgptr)
int load_config_sharedlib(configmodule_interface_t *cfgptr)
{
void *lib_handle;
char fname[128];
......@@ -50,46 +50,46 @@ char libname[FILENAME_MAX];
int st;
st=0;
sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgmode);
sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode);
lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
if (!lib_handle) {
fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror());
st = -1;
} else {
sprintf (fname,"config_%s_init",cfgmode);
sprintf (fname,"config_%s_init",cfgptr->cfgmode);
cfgptr->init = dlsym(lib_handle,fname);
if (cfgptr->init == NULL ) {
printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgmode);
__FILE__, __LINE__,fname, cfgptr->cfgmode);
} else {
st=cfgptr->init(cfgP,numP);
st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP);
printf("[CONFIG] function %s returned %i\n",
fname, st);
}
sprintf (fname,"config_%s_get",cfgmode);
sprintf (fname,"config_%s_get",cfgptr->cfgmode);
cfgptr->get = dlsym(lib_handle,fname);
if (cfgptr->get == NULL ) {
printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgmode);
__FILE__, __LINE__,fname, cfgptr->cfgmode);
st = -1;
}
sprintf (fname,"config_%s_getlist",cfgmode);
sprintf (fname,"config_%s_getlist",cfgptr->cfgmode);
cfgptr->getlist = dlsym(lib_handle,fname);
if (cfgptr->getlist == NULL ) {
printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgmode);
__FILE__, __LINE__,fname, cfgptr->cfgmode);
st = -1;
}
sprintf (fname,"config_%s_end",cfgmode);
sprintf (fname,"config_%s_end",cfgptr->cfgmode);
cfgptr->end = dlsym(lib_handle,fname);
if (cfgptr->getlist == NULL ) {
printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgmode);
__FILE__, __LINE__,fname, cfgptr->cfgmode);
}
}
......@@ -105,16 +105,11 @@ char *cfgparam=NULL;
char *modeparams=NULL;
char *cfgmode=NULL;
char *strtokctx=NULL;
char *cfgP[CONFIG_MAX_OOPT_PARAMS];
int i;
int p;
char *atoken;
int i;
for(i=0; i<CONFIG_MAX_OOPT_PARAMS ; i++) {
cfgP[i]=NULL;
}
/* first parse the command line to look for the -O option */
opterr=0;
while ((i = getopt(argc, argv, "O:")) != -1) {
......@@ -122,6 +117,8 @@ int p;
cfgparam = optarg;
}
}
optind=1;
/* look for the OAI_CONFIGMODULE environement variable */
if ( cfgparam == NULL ) {
cfgparam = getenv("OAI_CONFIGMODULE");
......@@ -138,36 +135,47 @@ int p;
return NULL;
}
else if ( i == 1 ) {
/* -O argument doesn't contain ":" separator, legacy -O <conf file> option, default cfgmode to libconfig
with one parameter, the path to the configuration file */
modeparams=cfgmode;
cfgmode=strdup("libconfig");
}
cfgptr = malloc(sizeof(configmodule_interface_t));
p=0;
cfgP[p]=strtok_r(modeparams,":",&strtokctx);
while ( p< CONFIG_MAX_OOPT_PARAMS && cfgP[p] != NULL) {
memset(cfgptr,0,sizeof(configmodule_interface_t));
/* temporary, legacy mode */
if (i==1) cfgptr->rtflags = cfgptr->rtflags | CONFIG_LEGACY;
/*--*/
cfgptr->argc = argc;
cfgptr->argv = argv;
cfgptr->cfgmode=strdup(cfgmode);
cfgptr->num_cfgP=0;
atoken=strtok_r(modeparams,":",&strtokctx);
while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) {
/* look for debug level in the config parameters, it is commom to all config mode
and will be removed frome the parameter array passed to the shared module */
char *aptr;
aptr=strcasestr(cfgP[p],"dbgl");
aptr=strcasestr(atoken,"dbgl");
if (aptr != NULL) {
cfgptr->rtflags = strtol(aptr+4,NULL,0);
Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].paramflags = Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].paramflags | PARAMFLAG_DONOTREAD;
for (int j=p; j<(CONFIG_MAX_OOPT_PARAMS-1); j++) cfgP[j] = cfgP[j+1];
p--;
cfgptr->rtflags = cfgptr->rtflags | strtol(aptr+4,NULL,0);
} else {
cfgptr->cfgP[cfgptr->num_cfgP] = strdup(atoken);
cfgptr->num_cfgP++;
}
p++;
cfgP[p] = strtok_r(NULL,":",&strtokctx);
atoken = strtok_r(NULL,":",&strtokctx);
}
printf("[CONFIG] get parameters from %s ",cfgmode);
for (i=0;i<p; i++) {
printf("%s ",cfgP[i]);
for (i=0;i<cfgptr->num_cfgP; i++) {
printf("%s ",cfgptr->cfgP[i]);
}
printf("\n");
i=load_config_sharedlib(cfgmode, cfgP,p,cfgptr);
i=load_config_sharedlib(cfgptr);
if (i< 0) {
fprintf(stderr,"[CONFIG] %s %d config module %s couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
return NULL;
......@@ -180,26 +188,30 @@ int p;
if (modeparams != NULL) free(modeparams);
if (cfgmode != NULL) free(cfgmode);
optind=1;
cfgptr->argc = argc;
cfgptr->argv = argv;
return cfgptr;
}
void end_configmodule()
{
if (cfgptr != NULL) {
printf ("[CONFIG] free %u pointers\n",cfgptr->numptrs);
if (cfgptr->end != NULL) {
printf ("[CONFIG] calling config module end function...\n");
cfgptr->end();
}
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
for (int i=0; i<cfgptr->num_cfgP; i++) {
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
}
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
for(int i=0; i<cfgptr->numptrs ; i++) {
if (cfgptr->ptrs[i] != NULL) {
free(cfgptr->ptrs[i]);
}
cfgptr->ptrs[i]=NULL;
}
if (cfgptr->end != NULL) {
printf ("[CONFIG] calling config module end function...\n");
cfgptr->end();
}
free(cfgptr);
cfgptr=NULL;
}
......
......@@ -38,28 +38,34 @@
#include <stdlib.h>
#include "common/config/config_paramdesc.h"
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly alloted in the config module
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
/* rtflags bit position definitions */
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR 2 // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE 4 // print command line processing messages
/* temporary flag to be able to use legacy config mechanism */
#define CONFIG_LEGACY (1 << 10)
typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
typedef void(*configmodule_endfunc_t)(void);
typedef struct configmodule_interface
{
int argc;
char **argv;
int argc;
char **argv;
char *cfgmode;
int num_cfgP;
char *cfgP[CONFIG_MAX_OOPT_PARAMS];
configmodule_initfunc_t init;
configmodule_getfunc_t get;
configmodule_getlistfunc_t getlist;
configmodule_endfunc_t end;
uint32_t numptrs;
uint32_t rtflags;
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
uint32_t numptrs;
uint32_t rtflags;
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
} configmodule_interface_t;
#ifdef CONFIG_LOADCONFIG_MAIN
......@@ -75,7 +81,7 @@ static char config_helpstr [] =" \
#define CONFIGPARAM_DEBUGFLAGS_IDX 0
static paramdef_t Config_Params[] = {
{"debugflags", "", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_UINT, 0},
{"debugflags", "", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0},
};
#else
......
......@@ -42,51 +42,64 @@
/* parameter flags definitions */
/* Flags to be used by calling modules in their parameters definitions: */
#define PARAMFLAG_DISABLECMDLINE (1 << 0) // parameter can bet set from comand line
/* Flags to be used by calling modules in their parameters definitions to modify config module behavior*/
#define PARAMFLAG_MANDATORY (1 << 0) // parameter must be explicitely set, default value ignored
#define PARAMFLAG_DISABLECMDLINE (1 << 1) // parameter cannot bet set from comand line
#define PARAMFLAG_DONOTREAD (1 << 2) // parameter must be ignored in get function
#define PARAMFLAG_NOFREE (1 << 3) // don't free parameter in end function
#define PARAMFLAG_BOOL (1 << 4) // integer param can be 0 or 1
/* Flags used by config modules: */
/* flags to be used by caller modules when defining parameters */
#define PARAMFLAG_MANDATORY (1 << 1) // parameter must be explicitely set, default value ignored
/* flags used by config modules, at runtime to manage memory allocations */
#define PARAMFLAG_MALLOCINCONFIG (1 << 15) // parameter allocated in config module
#define PARAMFLAG_NOFREE (1 << 14) // don't free parameter in end function
/* flags to be used by caller modules to modify get behavior */
#define PARAMFLAG_DONOTREAD (1 << 20) // parameter must be ignored in get function
/* Flags used by config modules to return info to calling modules and/or to for internal usage*/
#define PARAMFLAG_MALLOCINCONFIG (1 << 15) // parameter allocated in config module
#define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions
#define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions
typedef struct paramdef
{
char optname[MAX_OPTNAME_SIZE];
char shortopt[MAX_SHORTOPT_SIZE];
char *helpstr;
unsigned int paramflags;
union {
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
char shortopt[MAX_SHORTOPT_SIZE]; /* short command line option */
char *helpstr; /* help string */
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
union { /* pointer to the parameter value, completed by the config module */
char **strptr;
char **strlistptr;
uint32_t *uptr;
int32_t *iptr;
uint64_t *u64ptr;
int64_t *i64ptr;
uint8_t *u8ptr;
char *i8ptr;
uint16_t *u16ptr;
int16_t *i16ptr;
uint32_t *uptr;
int32_t *iptr;
uint64_t *u64ptr;
int64_t *i64ptr;
double *dblptr;
} ;
union {
union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
char *defstrval;
char **defstrlistval;
uint32_t defuintval;
int defintval;
uint64_t defint64val;
int *defintarrayval;
double defdblval;
} ;
char type;
int numelt;
char type; /* parameter value type, as listed below as TYPE_XXXX macro */
int numelt; /* number of elements in a list or array parameters or max size of string value */
} paramdef_t;
#define TYPE_INT TYPE_INT32
#define TYPE_UINT TYPE_UINT32
#define TYPE_STRING 1
#define TYPE_INT 2
#define TYPE_UINT 3
#define TYPE_INT64 4
#define TYPE_UINT64 5
#define TYPE_INT8 2
#define TYPE_UINT8 3
#define TYPE_INT16 4
#define TYPE_UINT16 5
#define TYPE_INT32 6
#define TYPE_UINT32 7
#define TYPE_INT64 8
#define TYPE_UINT64 9
#define TYPE_MASK 10
#define TYPE_DOUBLE 16
#define TYPE_IPV4ADDR 20
......@@ -94,7 +107,7 @@ typedef struct paramdef
#define TYPE_INTARRAY 51
#define TYPE_UINTARRAY 52
#define TYPE_LIST 55
#define NO_UINTDEFAULT ((int)(-1))
#define ANY_IPV4ADDR_STRING "0.0.0.0"
typedef struct paramlist_def {
......
......@@ -47,7 +47,7 @@ configmodule_interface_t *config_get_if(void)
return cfgptr;
}
char * check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
{
printf_ptrs("-- %s 0x%08lx %i\n",cfgoptions->optname,(uintptr_t)(*ptr),length);
......@@ -60,13 +60,54 @@ char * check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
config_get_if()->numptrs++;
}
} else {
fprintf (stderr,"[LIBCONFIG] %s %d malloc error\n",__FILE__, __LINE__);
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
exit(-1);
}
}
return *ptr;
}
void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val)
{
int tmpval=val;
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >1) {
tmpval =1;
}
switch (cfgoptions->type) {
case TYPE_UINT8:
*(cfgoptions->u8ptr) = (uint8_t)tmpval;
printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
break;
case TYPE_INT8:
*(cfgoptions->i8ptr) = (int8_t)tmpval;
printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
break;
case TYPE_UINT16:
*(cfgoptions->u16ptr) = (uint16_t)tmpval;
printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
break;
case TYPE_INT16:
*(cfgoptions->i16ptr) = (int16_t)tmpval;
printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
break;
case TYPE_UINT32:
*(cfgoptions->uptr) = (uint32_t)tmpval;
printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
break;
case TYPE_MASK:
*(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
break;
case TYPE_INT32:
*(cfgoptions->iptr) = (int32_t)tmpval;
printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
break;
default:
fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
break;
}
}
void config_printhelp(paramdef_t *params,int numparams)
{
for (int i=0 ; i<numparams ; i++) {
......@@ -80,12 +121,21 @@ int config_get(paramdef_t *params,int numparams, char *prefix)
{
int ret= -1;
configmodule_interface_t *cfgif = config_get_if();
if (cfgif != NULL) {
ret = config_get_if()->get(params, numparams,prefix);
if (ret >= 0) {
config_process_cmdline(params,numparams,prefix);
}
if (cfgif != NULL) {
ret = config_get_if()->get(params, numparams,prefix);
if (ret >= 0) {
config_process_cmdline(params,numparams,prefix);
}
return ret;
}
return ret;
}
return ret;
int config_isparamset(paramdef_t *params,int paramidx)
{
if ((params[paramidx].paramflags & PARAMFLAG_PARAMSET) != 0) {
return 1;
} else {
return 0;
}
}
......@@ -38,12 +38,19 @@
extern "C"
{
#endif
#define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode )
#define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP )
#define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] )
#define CONFIG_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0 : !!(config_get_if()->rtflags & P))
extern configmodule_interface_t *config_get_if(void);
extern char * check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
extern char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
extern void config_printhelp(paramdef_t *,int numparams);
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
extern int config_get(paramdef_t *params,int numparams, char *prefix);
extern int config_isparamset(paramdef_t *params,int paramidx);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
extern int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix);
#define config_getlist config_get_if()->getlist
......
......@@ -58,16 +58,18 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_setting_t *setting;
const char *str;
char *str;
int i,u;
long long int llu;
double dbl;
int rst;
int status=0;
int notfound;
int defval;
int fatalerror=0;
char *cfgpath; /* listname.[listindex].paramname */
int defvals=0;
int numdefvals=0;
i = (prefix ==NULL) ? 0 : strlen(prefix);
cfgpath = malloc( i+ MAX_OPTNAME_SIZE +1);
if (cfgpath == NULL) {
......@@ -87,20 +89,26 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
continue;
}
notfound=0;
defval=0;
switch(cfgoptions[i].type)
{
case TYPE_STRING:
if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, &str)) {
check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) {
fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n",
cfgpath,str,cfgoptions[i].numelt);
str[strlen(str)-1] = 0;
}
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
sprintf( *(cfgoptions[i].strptr) , "%s", str);
printf_params("[LIBCONFIG] %s: %s\n", cfgpath,*(cfgoptions[i].strptr) );
} else {
if( cfgoptions[i].defstrval != NULL) {
defvals++;
check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1);
defval=1;
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1);
sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, *(cfgoptions[i].strptr));
} else {
......@@ -114,8 +122,8 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
read_strlist(&cfgoptions[i],setting,cfgpath);
} else {
if( cfgoptions[i].defstrlistval != NULL) {
cfgoptions[i].strlistptr=cfgoptions[i].defstrlistval;
defvals++;
cfgoptions[i].strlistptr=cfgoptions[i].defstrlistval;
defval=1;
for(int j=0; j<cfgoptions[i].numelt; j++)
printf_params("[LIBCONFIG] %s%i set to default value %s\n", cfgpath,j, cfgoptions[i].strlistptr[j]);
} else {
......@@ -123,23 +131,21 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
}
}
break;
case TYPE_UINT:
case TYPE_INT:
check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int));
case TYPE_UINT8:
case TYPE_INT8:
case TYPE_UINT16:
case TYPE_INT16:
case TYPE_UINT32:
case TYPE_INT32:
case TYPE_MASK:
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t));
if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
if(cfgoptions[i].type==TYPE_UINT) {
*(cfgoptions[i].uptr) = (unsigned int)u;
printf_params("[LIBCONFIG] %s: %u\n", cfgpath,*(cfgoptions[i].uptr) );
} else {
*(cfgoptions[i].iptr) = u;
printf_params("[LIBCONFIG] %s: %i\n", cfgpath,*(cfgoptions[i].iptr) );
}
config_assign_int(&(cfgoptions[i]),cfgpath,u);
} else {
if( cfgoptions[i].defuintval != NO_UINTDEFAULT) {
*(cfgoptions[i].uptr)=cfgoptions[i].defuintval;
defvals++;
printf_params("[LIBCONFIG] %s set to default value %i\n", cfgpath, (int32_t)(*(cfgoptions[i].uptr)));
if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
config_assign_int(&(cfgoptions[i]),cfgpath,cfgoptions[i].defintval);
defval=1;
printf_params("[LIBCONFIG] %s set to default value\n", cfgpath);
} else {
notfound=1;
}
......@@ -147,7 +153,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
break;
case TYPE_UINT64:
case TYPE_INT64:
check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long));
if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
if(cfgoptions[i].type==TYPE_UINT64) {
*(cfgoptions[i].u64ptr) = (uint64_t)llu;
......@@ -157,9 +163,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
printf_params("[LIBCONFIG] %s: %lli\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) );
}
} else {
if( cfgoptions[i].defuintval != NO_UINTDEFAULT) {
if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions[i].u64ptr)=cfgoptions[i].defuintval;
defvals++;
defval=1;
printf_params("[LIBCONFIG] %s set to default value %llu\n", cfgpath, (long long unsigned)(*(cfgoptions[i].u64ptr)));
} else {
notfound=1;
......@@ -173,9 +179,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
read_intarray(&cfgoptions[i],setting,cfgpath);
} else {
if( cfgoptions[i].defintarrayval != NULL) {
check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t));
config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t));
cfgoptions[i].iptr=cfgoptions[i].defintarrayval;
defvals++;
defval=1;
for (int j=0; j<cfgoptions[i].numelt ; j++) {
printf_params("[LIBCONFIG] %s[%i] set to default value %i\n", cfgpath,j,(int)cfgoptions[i].iptr[j]);
}
......@@ -184,11 +190,26 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
}
}
break;
case TYPE_DOUBLE:
config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double));
if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
*(cfgoptions[i].dblptr) = dbl;
printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
} else {
if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions[i].u64ptr)=cfgoptions[i].defdblval;
defval=1;
printf_params("[LIBCONFIG] %s set to default value %lf\n", cfgpath, *(cfgoptions[i].dblptr));
} else {
notfound=1;
}
}
break;
case TYPE_IPV4ADDR:
check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].uptr), sizeof(int));
if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, &str)) {
config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].uptr), sizeof(int));
if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
str=cfgoptions[i].defstrval;
defvals++;
defval=1;
printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, str);
}
if (str != NULL) {
......@@ -231,12 +252,18 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
printf("\n");
}
} else {
if (defval == 1) {
numdefvals++;
cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF;
} else {
cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSET;
}
status++;
}
} /* for loop on options */
printf("[LIBCONFIG] %s: %i/%i parameters successfully set, (%i to default value)\n",
((prefix == NULL)?"(root)":prefix),
status,numoptions,defvals );
status,numoptions,numdefvals );
if (fatalerror == 1) {
fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile );
config_libconfig_end();
......@@ -310,13 +337,13 @@ int config_libconfig_init(char *cfgP[], int numP)
config_init(&(libconfig_privdata.cfg));
libconfig_privdata.configfile = strdup((char *)cfgP[0]);
config_get_if()->numptrs=0;
memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS);
/* Read the file. If there is an error, report it and exit. */
if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
fprintf(stderr,"[LIBCONFIG] %s:%d - %s\n", config_error_file(&(libconfig_privdata.cfg)),
config_error_line(&(libconfig_privdata.cfg)), config_error_text(&(libconfig_privdata.cfg)));
fprintf(stderr,"[LIBCONFIG] %s %d file %s - %d - %s\n",__FILE__, __LINE__,
libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)),
config_error_text(&(libconfig_privdata.cfg)));
config_destroy(&(libconfig_privdata.cfg));
printf( "\n");
return -1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -30,7 +30,7 @@
* \warning
*/
#include "lte-softmodem.h"
#include "T.h"
......@@ -46,6 +46,7 @@
#include "PHY/defs.h"
#include "common/ran_context.h"
#include "common/config/config_userapi.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
......@@ -95,7 +96,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "PHY/TOOLS/lte_phy_scope.h"
#include "stats.h"
#endif
#include "lte-softmodem.h"
#ifdef XFORMS
......@@ -623,14 +624,125 @@ void *l2l1_task(void *arg) {
}
#endif
static void get_options(void) {
int CC_id;
int clock_src;
int tddflag;
char *loopfile=NULL;
int dumpframe;
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
if (tddflag > 0) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
frame_parms[CC_id]->frame_type = TDD;
}
if (strlen(in_path) > 0) {
opt_type = OPT_PCAP;
opt_enabled=1;
printf("Enabling OPT for PCAP with the following file %s \n",in_path);
}
if (strlen(in_ip) > 0) {
opt_enabled=1;
opt_type = OPT_WIRESHARK;
printf("Enabling OPT for wireshark for local interface");
}
if (UE_flag > 0) {
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
if (loopfile != NULL) {
printf("Input file for hardware emulation: %s",loopfile);
mode=loop_through_memory;
input_fd = fopen(loopfile,"r");
AssertFatal(input_fd != NULL,"Please provide a valid input file\n");
}
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med;
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp;
if ( *(cmdline_uemodeparams[CMDLINE_DEBUGUEPRACH_IDX].uptr) > 0) mode = debug_prach;
if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0) mode = no_L2_connect;
if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx;
if (dumpframe > 0) mode = rx_dump_frame;
if ( downlink_frequency[0][0] > 0) {
for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
downlink_frequency[CC_id][1] = downlink_frequency[0][0];
downlink_frequency[CC_id][2] = downlink_frequency[0][0];
downlink_frequency[CC_id][3] = downlink_frequency[0][0];
printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
}
UE_scan=0;
}
if (frame_parms[0]->N_RB_DL !=0) {
if ( frame_parms[0]->N_RB_DL < 6 ) {
frame_parms[0]->N_RB_DL = 6;
printf ( "%i: Invalid number of ressource blocks, adjusted to 6\n",frame_parms[0]->N_RB_DL);
}
if ( frame_parms[0]->N_RB_DL > 100 ) {
frame_parms[0]->N_RB_DL = 100;
printf ( "%i: Invalid number of ressource blocks, adjusted to 100\n",frame_parms[0]->N_RB_DL);
}
if ( frame_parms[0]->N_RB_DL > 50 && frame_parms[0]->N_RB_DL < 100 ) {
frame_parms[0]->N_RB_DL = 50;
printf ( "%i: Invalid number of ressource blocks, adjusted to 50\n",frame_parms[0]->N_RB_DL);
}
if ( frame_parms[0]->N_RB_DL > 25 && frame_parms[0]->N_RB_DL < 50 ) {
frame_parms[0]->N_RB_DL = 25;
printf ( "%i: Invalid number of ressource blocks, adjusted to 25\n",frame_parms[0]->N_RB_DL);
}
UE_scan = 0;
frame_parms[0]->N_RB_UL=frame_parms[0]->N_RB_DL;
for (CC_id=1; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms[CC_id]->N_RB_DL=frame_parms[0]->N_RB_DL;
frame_parms[CC_id]->N_RB_UL=frame_parms[0]->N_RB_UL;
}
}
for (CC_id=1;CC_id<MAX_NUM_CCs;CC_id++) {
tx_max_power[CC_id]=tx_max_power[0];
rx_gain[0][CC_id] = rx_gain[0][0];
tx_gain[0][CC_id] = tx_gain[0][0];
}
} /* UE_flag > 0 */
#if T_TRACER
paramdef_t cmdline_ttraceparams[] =CMDLINE_TTRACEPARAMS_DESC ;
config_process_cmdline( cmdline_ttraceparams,sizeof(cmdline_ttraceparams)/sizeof(paramdef_t),NULL);
#endif
if (UE_flag == 0) {
memset((void*)&RC,0,sizeof(RC));
/* Read RC configuration file */
RCConfig(NULL);
NB_eNB_INST = RC.nb_inst;
NB_RU = RC.nb_RU;
printf("Configuration: nb_inst %d, nb_ru %d\n",NB_eNB_INST,NB_RU);
} else if (UE_flag == 1) {
if (conf_config_file_name != NULL) {
// Here the configuration file is the XER encoded UE capabilities
// Read it in and store in asn1c data structures
strcpy(uecap_xer,conf_config_file_name);
uecap_xer_in=1;
static void get_options (int argc, char **argv) {
}
}
}
static void old_get_options (int argc, char **argv) {
int c;
// char line[1000];
// int l;
int k,i;//,j,k;
int i;
#if defined(OAI_USRP) || defined(CPRIGW)
int clock_src;
#endif
......@@ -1233,7 +1345,7 @@ void init_openair0() {
}
void wait_RUs() {
void wait_RUs(void) {
LOG_I(PHY,"Waiting for RUs to be configured ...\n");
......@@ -1249,7 +1361,7 @@ void wait_RUs() {
LOG_I(PHY,"RUs configured\n");
}
void wait_eNBs() {
void wait_eNBs(void) {
int i,j;
int waiting=1;
......@@ -1271,12 +1383,11 @@ void wait_eNBs() {
int main( int argc, char **argv )
{
int i,j,k,aa,re;
int i;
#if defined (XFORMS)
void *status;
#endif
int inst;
int CC_id;
int ru_id;
uint8_t abstraction_flag=0;
......@@ -1287,7 +1398,11 @@ int main( int argc, char **argv )
#endif
start_background_system();
if ( load_configmodule(argc,argv) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
}
#ifdef DEBUG_CONSOLE
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
......@@ -1310,8 +1425,15 @@ int main( int argc, char **argv )
printf("Reading in command-line options\n");
// get options and fill parameters from configuration file
get_options (argc, argv); //Command-line options, enb_properties
// temporary test to allow legacy config or config module */
if ( CONFIG_ISFLAGSET(CONFIG_LEGACY) == 0) {
printf("configuration via the configuration module \n");
get_options (); //Command-line options, enb_properties
} else {
printf("Legacy configuration mode \n");
old_get_options (argc,argv);
}
#if T_TRACER
......@@ -1738,7 +1860,7 @@ int main( int argc, char **argv )
sync_var=0;
pthread_cond_broadcast(&sync_cond);
pthread_mutex_unlock(&sync_mutex);
end_configmodule();
// wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n");
......
......@@ -40,6 +40,131 @@
#endif
#endif
/* help strings definition for command line options */
#define CONFIG_HLP_RFCFGF "Configuration file for front-end (e.g. LMS7002M)\n"
#define CONFIG_HLP_ULMAXE "set the eNodeB max ULSCH erros\n"
#define CONFIG_HLP_CALUER "set UE RX calibration\n"
#define CONFIG_HLP_CALUERM ""
#define CONFIG_HLP_CALUERB ""
#define CONFIG_HLP_DBGUEPR "UE run normal prach power ramping, but don't continue random-access\n"
#define CONFIG_HLP_CALPRACH "UE run normal prach with maximum power, but don't continue random-access\n"
#define CONFIG_HLP_NOL2CN "bypass L2 and upper layers\n"
#define CONFIG_HLP_UERXG "set UE RX gain\n"
#define CONFIG_HLP_UERXGOFF "external UE amplifier offset\n"
#define CONFIG_HLP_UETXG "set UE TX gain\n"
#define CONFIG_HLP_UENANTR "set UE number of rx antennas\n"
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
#define CONFIG_HLP_UESCAN "set UE to scan around carrier\n"
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
#define CONFIG_HLP_EXCCLK "tells hardware to use an external clock reference\n"
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\n"
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
#define CONFIG_HLP_CHOFF "Channel id offset"
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
#define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n"
#define CONFIG_HLP_LOGV "Set the global log verbosity \n"
#define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
#define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n"
#define CONFIG_HLP_VCD "Enable VCD (generated file will is named openair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n"
#define CONFIG_HLP_FLOG "Enable PDCP RCP online log file\n"
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
#define CONFIG_HLP_TPORT "tracer port\n"
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
/* command line options definitions */
#define CMDLINE_CALIBUERX_IDX 0
#define CMDLINE_CALIBUERXMED_IDX 1
#define CMDLINE_CALIBUERXBYP_IDX 2
#define CMDLINE_DEBUGUEPRACH_IDX 3
#define CMDLINE_NOL2CONNECT_IDX 4
#define CMDLINE_CALIBPRACHTX_IDX 5
#define CMDLINE_MEMLOOP_IDX 6
#define CMDLINE_UEMODEPARAMS_DESC { \
{"calib-ue-rx", "", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{"calib-ue-rx-med", "", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{"calib-ue-rx-byp", "", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{"debug-ue-prach", "", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"no-L2-connect", "", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"calib-prach-tx", "", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"loop-memory", "", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
{"ue-dump-frame", "", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
}
#define CMDLINE_UEPARAMS_DESC { \
{"ue-rxgain", "", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
{"ue-rxgain-off", "", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
{"ue-txgain", "", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
{"ue-nb-ant-rx", "", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
{"ue-nb-ant-tx", "", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
{"ue-scan-carrier", "", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
{"ue-max-power", "", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
{"" , "r", CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:0, TYPE_UINT8, 0}, \
}
extern int16_t dlsch_demod_shift;
#define CMDLINE_PARAMS_DESC { \
{"rf-config-file", "", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&rf_config_file, defstrval:NULL, TYPE_STRING, sizeof(rf_config_file)}, \
{"ulsch-max-errors", "", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
{"phy-test", "", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"usim-test", "", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"mmapped-dma", "", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"external-clock", "", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"wait-for-sync", "", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable","", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"threadIQ", "", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
{"threadOddSubframe", "", NULL, 0, iptr:&(threads.odd), defintval:1, TYPE_INT, 0}, \
{"threadEvenSubframe", "", NULL, 0, iptr:&(threads.even), defintval:1, TYPE_INT, 0}, \
{"dlsch-demod-shift", "", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"" , "A", CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"" , "C", CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
{"" , "a", CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"" , "d", CONFIG_HLP_SOFTS, 0, i8ptr:&do_forms, defintval:0, TYPE_INT8, 0}, \
{"" , "E", CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
{"" , "K", CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"" , "U", CONFIG_HLP_UE, PARAMFLAG_BOOL, i8ptr:&UE_flag, defintval:0, TYPE_INT8, 0}, \
{"" , "m", CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
{"" , "t", CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
{"" , "W", CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \
{"" , "P", CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \
{"" , "V", CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&ouput_vcd, defintval:0, TYPE_INT, 0}, \
{"" , "q", CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
{"" , "R", CONFIG_HLP_FLOG, PARAMFLAG_BOOL, iptr:&online_log_messages, defintval:0, TYPE_INT, 0}, \
{"" , "g", CONFIG_HLP_LOGL, 0, i16ptr:&glog_level, defintval:1, TYPE_INT16, 0}, \
{"" , "G", CONFIG_HLP_LOGV, 0, i16ptr:&glog_verbosity, defintval:0, TYPE_INT16, 0}, \
{"" , "S", CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
{"" , "T", CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0} \
}
extern int T_port;
extern int T_wait;
extern int T_dont_fork;
#define CMDLINE_TTRACEPARAMS_DESC { \
{"T_port", "", CONFIG_HLP_TPORT, 0, uptr:&T_port, defuintval:0, TYPE_UINT, 0}, \
{"T_nowait", "", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, uptr:&T_nowait, defuintval:0, TYPE_UINT, 0}, \
{"T_dont_fork", "", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, uptr:&T_dont_fork, defuintval:1, TYPE_UINT, 0}, \
}
/* */
extern pthread_cond_t sync_cond;
extern pthread_mutex_t sync_mutex;
extern int sync_var;
......
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