From 32786cc7f7a5d8c97eff99443e146b566f7634e7 Mon Sep 17 00:00:00 2001 From: Francois TABURET <francois.taburet@nokia.com> Date: Thu, 21 Sep 2017 19:30:00 +0200 Subject: [PATCH] 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. --- common/config/config_cmdline.c | 74 +- common/config/config_load_configmodule.c | 94 +- common/config/config_load_configmodule.h | 20 +- common/config/config_paramdesc.h | 69 +- common/config/config_userapi.c | 66 +- common/config/config_userapi.h | 9 +- common/config/libconfig/config_libconfig.c | 103 +- openair2/ENB_APP/enb_config.c | 2598 +++++++++++++++++++- targets/RT/USER/lte-softmodem.c | 144 +- targets/RT/USER/lte-softmodem.h | 125 + 10 files changed, 3130 insertions(+), 172 deletions(-) diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index b7885ce456f..382aa64bc08 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -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--; diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index cec08b7e450..cd1876d375e 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.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; } diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h index 530470173fb..82a97f06749 100644 --- a/common/config/config_load_configmodule.h +++ b/common/config/config_load_configmodule.h @@ -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 diff --git a/common/config/config_paramdesc.h b/common/config/config_paramdesc.h index 978178eac4b..8f4282b4f19 100644 --- a/common/config/config_paramdesc.h +++ b/common/config/config_paramdesc.h @@ -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 { diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c index 3b0a0a2a56d..d7ee462c265 100644 --- a/common/config/config_userapi.c +++ b/common/config/config_userapi.c @@ -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; + } } diff --git a/common/config/config_userapi.h b/common/config/config_userapi.h index 06e531f56c3..e362db2bc6c 100644 --- a/common/config/config_userapi.h +++ b/common/config/config_userapi.h @@ -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 diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index 797666bf068..d4e75e42eff 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -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; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index e26cf54a1cc..59eb6a0b01c 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -54,6 +54,7 @@ #include "PHY/extern.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" #include "enb_paramdef.h" +#include "common/config/config_userapi.h" /* those macros are here to help diagnose problems in configuration files * if the lookup fails, a warning is printed * (yes we can use the function name for the macro itself, the C preprocessor @@ -76,7 +77,8 @@ (printf("WARNING: setting '%s' not found in configuration file\n", name), 0)) - +/* temporary code to switch to Eurecom config mechanism */ +static int donotuse_configmodule = 1; static int enb_check_band_frequencies(char* lib_config_file_name_pP, int ind, int16_t band, @@ -123,6 +125,14 @@ void RCconfig_macrlc(void); int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc); int RCconfig_S1(MessageDef *msg_p, uint32_t i); +void Eurecom_RCconfig_RU(void); +void Eurecom_RCconfig_L1(void); +void Eurecom_RCconfig_macrlc(void); +int Eurecom_RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc); +int Eurecom_RCconfig_S1(MessageDef *msg_p, uint32_t i); + + + int load_config_file(config_t *cfg) { @@ -140,7 +150,7 @@ int load_config_file(config_t *cfg) { } } -void RCconfig_RU() { +void Eurecom_RCconfig_RU() { config_t cfg; config_setting_t *setting = NULL; @@ -206,12 +216,12 @@ void RCconfig_RU() { config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_LOCAL_RF,(const char **)&local_rf) ) ) { - local_rf_flag = CONFIG_FALSE; + local_rf_flag = CONFIG_FALSE; } else { if (strcmp(local_rf, "no") == 0) local_rf_flag = CONFIG_FALSE; - } + } if (local_rf_flag == CONFIG_TRUE) { // eNB or RRU @@ -237,9 +247,9 @@ void RCconfig_RU() { band[i] = config_setting_get_int(setting_band_elem); printf("RU %d: band %d\n",j,band[i]); } - } // fronthaul_flag == CONFIG_FALSE + } // local_rf_flag == CONFIG_TRUE - if (fronthaul_flag == CONFIG_TRUE) { // fronthaul_flag == CONFIG_TRUE + if (fronthaul_flag == CONFIG_TRUE) { if ( !( config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_LOCAL_ADDRESS, (const char **)&ipv4) && config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_REMOTE_ADDRESS, (const char **)&ipv4_remote) @@ -256,7 +266,7 @@ void RCconfig_RU() { continue; } - } + } // fronthaul_flag == CONFIG_TRUE if (RC.nb_L1_inst>0) { AssertFatal((setting_eNB_list = config_setting_get_member(setting_ru, CONFIG_STRING_RU_ENB_LIST))!=NULL,"No RU<->eNB mappings\n"); @@ -337,7 +347,7 @@ void RCconfig_RU() { RC.ru[j]->max_rxgain = max_rxgain; RC.ru[j]->num_bands = num_bands; for (i=0;i<num_bands;i++) RC.ru[j]->band[i] = band[i]; - } + } //strcmp(local_rf, "yes") == 0 else { printf("RU %d: Transport %s\n",j,tr_preference); @@ -373,7 +383,7 @@ void RCconfig_RU() { } RC.ru[j]->att_tx = att_tx; RC.ru[j]->att_rx = att_rx; - } + }// strcmp(local_rf, "yes") != 0 RC.ru[j]->nb_tx = nb_tx; RC.ru[j]->nb_rx = nb_rx; @@ -387,7 +397,7 @@ void RCconfig_RU() { } -void RCconfig_L1() { +void Eurecom_RCconfig_L1() { int i,j; @@ -493,9 +503,9 @@ void RCconfig_L1() { return; } -void RCconfig_macrlc() { +void Eurecom_RCconfig_macrlc() { - int i,j; + int j; config_t cfg; config_setting_t *setting = NULL; @@ -624,7 +634,7 @@ void RCconfig_macrlc() { return; } -int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { +int Eurecom_RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { config_t cfg; config_setting_t *setting = NULL; config_setting_t *subsetting = NULL; @@ -1333,7 +1343,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_resource choice: ONESIXTH,HALF,ONE,TWO!\n", RC.config_file_name, i, phich_resource); - printf("phich.resource %d (%s), phich.duration %d (%s)\n", + printf("phich.resource %ld (%s), phich.duration %ld (%s)\n", RRC_CONFIGURATION_REQ (msg_p).phich_resource[j],phich_resource, RRC_CONFIGURATION_REQ (msg_p).phich_duration[j],phich_duration); @@ -2413,7 +2423,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { } } -int RCconfig_gtpu() { +int Eurecom_RCconfig_gtpu() { config_t cfg; config_setting_t *setting = NULL; config_setting_t *subsetting = NULL; @@ -2496,7 +2506,7 @@ int RCconfig_gtpu() { } -int RCconfig_S1(MessageDef *msg_p, uint32_t i) { +int Eurecom_RCconfig_S1(MessageDef *msg_p, uint32_t i) { config_t cfg; config_setting_t *setting = NULL; config_setting_t *subsetting = NULL; @@ -2760,15 +2770,17 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) { } } } - return; + return 0; } -void RCConfig(const char *config_file_name) { +void Eurecom_RCConfig(const char *config_file_name) { config_t cfg; config_setting_t *setting = NULL; config_setting_t *setting_enb = NULL; config_setting_t *setting_component_carriers = NULL; + + config_init(&cfg); if (config_file_name != NULL) { @@ -2815,3 +2827,2553 @@ void RCConfig(const char *config_file_name) { return; } +/* --------------------------------------------------------*/ +/* from here function to use configuration module */ +void RCconfig_RU() { + +/* temporary code to use Eurecom configuration mechanism */ + if ( donotuse_configmodule== 1){ + return Eurecom_RCconfig_RU(); + } +/*------------------------------------------*/ + + int j = 0; + int i = 0; + int num_bands = 0; + + + paramdef_t RUParams[] = RUPARAMS_DESC; + paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0}; + + + config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL); + + + if ( RUParamList.numelt > 0) { + + + RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*)); + + + + + RC.ru_mask=(1<<NB_RU) - 1; + printf("Set RU mask to %lx\n",RC.ru_mask); + + for (j = 0; j < RC.nb_RU; j++) { + + RC.ru[j] = (RU_t*)malloc(sizeof(RU_t)); + memset((void*)RC.ru[j],0,sizeof(RU_t)); + RC.ru[j]->idx = j; + + RC.ru[j]->if_timing = synch_to_ext_device; + RC.ru[j]->num_eNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt; + for (i=0;i<RC.ru[j]->num_eNB;i++) RC.ru[j]->eNB_list[i] = RC.eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0]; + + + if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) { + if (RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr == NULL) { + RC.ru[j]->if_south = LOCAL_RF; + RC.ru[j]->function = eNodeB_3GPP; + printf("Setting function for RU %d to eNodeB_3GPP\n",j); + } + else { + RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); + RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); + RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); + RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); + RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); + RC.ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr); + RC.ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr); + + if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) { + RC.ru[j]->if_south = LOCAL_RF; + RC.ru[j]->function = NGFI_RRU_IF5; + RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE; + printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j); + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) { + RC.ru[j]->if_south = LOCAL_RF; + RC.ru[j]->function = NGFI_RRU_IF5; + RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE; + printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j); + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) { + RC.ru[j]->if_south = LOCAL_RF; + RC.ru[j]->function = NGFI_RRU_IF4p5; + RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; + printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j); + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) { + RC.ru[j]->if_south = LOCAL_RF; + RC.ru[j]->function = NGFI_RRU_IF4p5; + RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; + printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j); + } + } + RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);; + RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr); + RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; + for (i=0;i<num_bands;i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; + } //strcmp(local_rf, "yes") == 0 + else { + printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr)); + + RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); + RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); + RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); + RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); + RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); + RC.ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr); + RC.ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr); + if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) { + RC.ru[j]->if_south = REMOTE_IF5; + RC.ru[j]->function = NGFI_RAU_IF5; + RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE; + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) { + RC.ru[j]->if_south = REMOTE_IF5; + RC.ru[j]->function = NGFI_RAU_IF5; + RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE; + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) { + RC.ru[j]->if_south = REMOTE_IF4p5; + RC.ru[j]->function = NGFI_RAU_IF4p5; + RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) { + RC.ru[j]->if_south = REMOTE_IF4p5; + RC.ru[j]->function = NGFI_RAU_IF4p5; + RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if5_mobipass") == 0) { + RC.ru[j]->if_south = REMOTE_IF5; + RC.ru[j]->function = NGFI_RAU_IF5; + RC.ru[j]->if_timing = synch_to_other; + RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS; + } + RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); + RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); + } /* strcmp(local_rf, "yes") != 0 */ + + RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr); + RC.ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr); + + }// j=0..num_rus + } else { + RC.nb_RU = 0; + } // setting != NULL + + return; + +} + +void RCconfig_L1() { +/* temporary code to use Eurecom configuration mechanism */ + if ( donotuse_configmodule== 1){ + return Eurecom_RCconfig_L1(); + } +/*------------------------------------------*/ + int i,j; + paramdef_t L1_Params[] = L1PARAMS_DESC; + paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0}; + + + config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL); + if (L1_ParamList.numelt > 0) { + + if (RC.eNB == NULL) { + RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***)); + LOG_I(PHY,"RC.eNB = %p\n",RC.eNB); + memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***)); + RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int)); + } + + for (j = 0; j < RC.nb_L1_inst; j++) { + RC.nb_L1_CC[j] = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr); + + + if (RC.eNB[j] == NULL) { + RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**)); + LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]); + memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***)); + } + + + for (i=0;i<RC.nb_L1_CC[j];i++) { + if (RC.eNB[j][i] == NULL) { + RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB)); + memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB)); + LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]); + RC.eNB[j][i]->Mod_id = j; + RC.eNB[j][i]->CC_id = i; + } + } + + if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) { + + } + else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) { + RC.eNB[j][0]->eth_params_n.local_if_name = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr)); + RC.eNB[j][0]->eth_params_n.my_addr = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr)); + RC.eNB[j][0]->eth_params_n.remote_addr = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr)); + RC.eNB[j][0]->eth_params_n.my_portc = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr); + RC.eNB[j][0]->eth_params_n.remote_portc = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr); + RC.eNB[j][0]->eth_params_n.my_portd = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr); + RC.eNB[j][0]->eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr); + RC.eNB[j][0]->eth_params_n.transp_preference = ETH_UDP_MODE; + } + + else { // other midhaul + } + }// j=0..num_inst + printf("Initializing northbound interface for L1\n"); + l1_north_init_eNB(); + } else { + AssertFatal (0, + "No " CONFIG_STRING_L1_LIST " configuration found"); + } +} + +void RCconfig_macrlc() { +/* temporary code to use Eurecom configuration mechanism */ + if ( donotuse_configmodule== 1){ + return Eurecom_RCconfig_macrlc(); + } +/*------------------------------------------*/ + int j; + + + paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC; + paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0}; + + config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL); + + + if ( MacRLC_ParamList.numelt > 0) { + + RC.nb_macrlc_inst=MacRLC_ParamList.numelt; + mac_top_init_eNB(); + for (j=0;j<RC.nb_macrlc_inst;j++) { + + if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) { + // check number of instances is same as RRC/PDCP + + } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) { + RC.mac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr)); + RC.mac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr)); + RC.mac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr)); + RC.mac[j]->eth_params_n.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr); + RC.mac[j]->eth_params_n.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr); + RC.mac[j]->eth_params_n.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr); + RC.mac[j]->eth_params_n.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);; + RC.mac[j]->eth_params_n.transp_preference = ETH_UDP_MODE; + } else { // other midhaul + AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr)); + } + + if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_L1") == 0) { + + + } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "nfapi") == 0) { + RC.mac[j]->eth_params_s.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_IF_NAME_IDX].strptr)); + RC.mac[j]->eth_params_s.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr)); + RC.mac[j]->eth_params_s.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr)); + RC.mac[j]->eth_params_s.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr); + RC.mac[j]->eth_params_s.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr); + RC.mac[j]->eth_params_s.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr); + RC.mac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr); + RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE; + } else { // other midhaul + AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr)); + } + }// j=0..num_inst + } else {// MacRLC_ParamList.numelt > 0 + AssertFatal (0, + "No " CONFIG_STRING_MACRLC_LIST " configuration found"); + } +} + +int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { +/* temporary code to use Eurecom configuration mechanism */ + if ( donotuse_configmodule== 1){ + return Eurecom_RCconfig_RRC(msg_p, i, rrc); + } +/*------------------------------------------*/ + int num_enbs = 0; + + int num_component_carriers = 0; + int j,k = 0; + int32_t enb_id = 0; + int nb_cc = 0; + + + char* frame_type = NULL; + int32_t tdd_config = 0; + int32_t tdd_config_s = 0; + + char* prefix_type = NULL; + char* pbch_repetition = NULL; + + int32_t eutra_band = 0; + long long int downlink_frequency = 0; + int32_t uplink_frequency_offset = 0; + int32_t Nid_cell = 0; + int32_t Nid_cell_mbsfn = 0; + int32_t N_RB_DL = 0; + int32_t nb_antenna_ports = 0; + + int32_t prach_root = 0; + int32_t prach_config_index = 0; + char* prach_high_speed = NULL; + int32_t prach_zero_correlation = 0; + int32_t prach_freq_offset = 0; + int32_t pucch_delta_shift = 0; + int32_t pucch_nRB_CQI = 0; + int32_t pucch_nCS_AN = 0; +//#if !defined(Rel10) && !defined(Rel14) + int32_t pucch_n1_AN = 0; +//#endif + int32_t pdsch_referenceSignalPower = 0; + int32_t pdsch_p_b = 0; + int32_t pusch_n_SB = 0; + char * pusch_hoppingMode = NULL; + int32_t pusch_hoppingOffset = 0; + char* pusch_enable64QAM = NULL; + char* pusch_groupHoppingEnabled = NULL; + int32_t pusch_groupAssignment = 0; + char* pusch_sequenceHoppingEnabled = NULL; + int32_t pusch_nDMRS1 = 0; + char* phich_duration = NULL; + char* phich_resource = NULL; + char* srs_enable = NULL; + int32_t srs_BandwidthConfig = 0; + int32_t srs_SubframeConfig = 0; + char* srs_ackNackST = NULL; + char* srs_MaxUpPts = NULL; + int32_t pusch_p0_Nominal = 0; + char* pusch_alpha = NULL; + int32_t pucch_p0_Nominal = 0; + int32_t msg3_delta_Preamble = 0; + //int32_t ul_CyclicPrefixLength = 0; + char* pucch_deltaF_Format1 = NULL; + //const char* pucch_deltaF_Format1a = NULL; + char* pucch_deltaF_Format1b = NULL; + char* pucch_deltaF_Format2 = NULL; + char* pucch_deltaF_Format2a = NULL; + char* pucch_deltaF_Format2b = NULL; + int32_t rach_numberOfRA_Preambles = 0; + char* rach_preamblesGroupAConfig = NULL; + int32_t rach_sizeOfRA_PreamblesGroupA = 0; + int32_t rach_messageSizeGroupA = 0; + char* rach_messagePowerOffsetGroupB = NULL; + int32_t rach_powerRampingStep = 0; + int32_t rach_preambleInitialReceivedTargetPower = 0; + int32_t rach_preambleTransMax = 0; + int32_t rach_raResponseWindowSize = 0; + int32_t rach_macContentionResolutionTimer = 0; + int32_t rach_maxHARQ_Msg3Tx = 0; + int32_t pcch_defaultPagingCycle = 0; + char* pcch_nB = NULL; + int32_t bcch_modificationPeriodCoeff = 0; + int32_t ue_TimersAndConstants_t300 = 0; + int32_t ue_TimersAndConstants_t301 = 0; + int32_t ue_TimersAndConstants_t310 = 0; + int32_t ue_TimersAndConstants_t311 = 0; + int32_t ue_TimersAndConstants_n310 = 0; + int32_t ue_TimersAndConstants_n311 = 0; + int32_t ue_TransmissionMode = 0; + + + int32_t srb1_timer_poll_retransmit = 0; + int32_t srb1_timer_reordering = 0; + int32_t srb1_timer_status_prohibit = 0; + int32_t srb1_poll_pdu = 0; + int32_t srb1_poll_byte = 0; + int32_t srb1_max_retx_threshold = 0; + + int32_t my_int; + + + +/* + char* flexran_agent_interface_name = NULL; + char* flexran_agent_ipv4_address = NULL; + int32_t flexran_agent_port = 0; + char* flexran_agent_cache = NULL; + int32_t otg_ue_id = 0; + char* otg_app_type = NULL; + char* otg_bg_traffic = NULL; + char* glog_level = NULL; + char* glog_verbosity = NULL; + char* hw_log_level = NULL; + char* hw_log_verbosity = NULL; + char* phy_log_level = NULL; + char* phy_log_verbosity = NULL; + char* mac_log_level = NULL; + char* mac_log_verbosity = NULL; + char* rlc_log_level = NULL; + char* rlc_log_verbosity = NULL; + char* pdcp_log_level = NULL; + char* pdcp_log_verbosity = NULL; + char* rrc_log_level = NULL; + char* rrc_log_verbosity = NULL; + char* udp_log_verbosity = NULL; + char* osa_log_level = NULL; + char* osa_log_verbosity = NULL; +*/ + + + // for no gcc warnings + (void)my_int; + paramdef_t ENBSParams[] = ENBSPARAMS_DESC; + + paramdef_t ENBParams[] = ENBPARAMS_DESC; + paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0}; + + paramdef_t CCsParams[] = CCPARAMS_DESC; + paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0}; + + paramdef_t SRB1Params[] = SRB1PARAMS_DESC; + + + + +/* get global parameters, defined outside any section in the config file */ + + config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); + num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; + AssertFatal (i<num_enbs, + "Failed to parse config file no %ith element in %s \n",i, ENB_CONFIG_STRING_ACTIVE_ENBS); + +#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) + + + if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) { + asn_debug = 0; + asn1_xer_print = 0; + } else if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0) { + asn_debug = 1; + asn1_xer_print = 1; + } else if (strcasecmp(*(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr) , ENB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING) == 0) { + asn_debug = 1; + asn1_xer_print = 2; + } else { + asn_debug = 0; + asn1_xer_print = 0; + } + + +#endif + + + + if (num_enbs>0) { + // Output a list of all eNBs. + config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL); + + + + + if (ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr == NULL) { + // Calculate a default eNB ID +# if defined(ENABLE_USE_MME) + uint32_t hash; + + hash = s1ap_generate_eNB_id (); + enb_id = i + (hash & 0xFFFF8); +# else + enb_id = i; +# endif + } else { + enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr); + } + + + printf("RRC %d: Southbound Transport %s\n",j,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr)); + + if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { + + + } + else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) { + rrc->eth_params_s.local_if_name = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_IF_NAME_IDX].strptr)); + rrc->eth_params_s.my_addr = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_ADDRESS_IDX].strptr)); + rrc->eth_params_s.remote_addr = strdup(*(ENBParamList.paramarray[i][ENB_REMOTE_S_ADDRESS_IDX].strptr)); + rrc->eth_params_s.my_portc = *(ENBParamList.paramarray[i][ENB_LOCAL_S_PORTC_IDX].uptr); + rrc->eth_params_s.remote_portc = *(ENBParamList.paramarray[i][ENB_REMOTE_S_PORTC_IDX].uptr); + rrc->eth_params_s.my_portd = *(ENBParamList.paramarray[i][ENB_LOCAL_S_PORTD_IDX].uptr); + rrc->eth_params_s.remote_portd = *(ENBParamList.paramarray[i][ENB_REMOTE_S_PORTD_IDX].uptr); + rrc->eth_params_s.transp_preference = ETH_UDP_MODE; + } + + else { // other midhaul + } + + // search if in active list + + + + + + + for (k=0; k <num_enbs ; k++) { + if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) { + char enbpath[MAX_OPTNAME_SIZE + 8]; + + + RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id; + + /* + if (strcmp(*(ENBParamList.paramarray[i][ENB_CELL_TYPE_IDX].strptr), "CELL_MACRO_ENB") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cell_type = CELL_MACRO_ENB; + } else if (strcmp(cell_type, "CELL_HOME_ENB") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cell_type = CELL_HOME_ENB; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_ENB or CELL_HOME_ENB !\n", + lib_config_file_name_pP, i, cell_type); + } + + enb_properties_loc.properties[enb_properties_loc_index]->eNB_name = strdup(enb_name); + */ + RRC_CONFIGURATION_REQ (msg_p).tac = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mcc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mnc = (uint16_t)atoi( *(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr) ); + RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length = strlen(*(ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + AssertFatal((RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 2) || + (RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length == 3), + "BAD MNC DIGIT LENGTH %d", + RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length); + + + // Parse optional physical parameters + sprintf(enbpath,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k), + config_getlist( &CCsParamList,NULL,0,enbpath); + + LOG_I(RRC,"num component carriers %d \n", num_component_carriers); + if ( CCsParamList.numelt> 0) { + char ccspath[MAX_OPTNAME_SIZE*2 + 16]; + + + + + + //enb_properties_loc.properties[enb_properties_loc_index]->nb_cc = num_component_carriers; + + + for (j = 0; j < CCsParamList.numelt ;j++) { + + sprintf(ccspath,"%s.%s.[%i]",enbpath,ENB_CONFIG_STRING_COMPONENT_CARRIERS,j); + config_get( CCsParams,sizeof(CCsParams)/sizeof(paramdef_t),ccspath); + + + //printf("Component carrier %d\n",component_carrier); + + + + nb_cc++; + /* + if (strcmp(cc_node_function, "eNodeB_3GPP") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = eNodeB_3GPP; + } else if (strcmp(cc_node_function, "eNodeB_3GPP_BBU") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = eNodeB_3GPP_BBU; + } else if (strcmp(cc_node_function, "NGFI_RCC_IF4p5") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = NGFI_RCC_IF4p5; + } else if (strcmp(cc_node_function, "NGFI_RAU_IF4p5") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = NGFI_RAU_IF4p5; + } else if (strcmp(cc_node_function, "NGFI_RRU_IF4p5") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = NGFI_RRU_IF4p5; + } else if (strcmp(cc_node_function, "NGFI_RRU_IF5") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_function[j] = NGFI_RRU_IF5; + } else { + AssertError (0, parse_errors ++, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for node_function choice: eNodeB_3GPP or eNodeB_3GPP_BBU or NGFI_IF4_RCC or NGFI_IF4_RRU or NGFI_IF5_RRU !\n", + lib_config_file_name_pP, i, cc_node_function); + } + + if (strcmp(cc_node_timing, "synch_to_ext_device") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_timing[j] = synch_to_ext_device; + } else if (strcmp(cc_node_timing, "synch_to_other") == 0) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_timing[j] = synch_to_other; + } else { + AssertError (0, parse_errors ++, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for node_function choice: SYNCH_TO_DEVICE or SYNCH_TO_OTHER !\n", + lib_config_file_name_pP, i, cc_node_timing); + } + + if ((cc_node_synch_ref >= -1) && (cc_node_synch_ref < num_component_carriers)) { + enb_properties_loc.properties[enb_properties_loc_index]->cc_node_synch_ref[j] = (int16_t) cc_node_synch_ref; + } else { + AssertError (0, parse_errors ++, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for node_synch_ref choice: valid CC_id or -1 !\n", + lib_config_file_name_pP, i, cc_node_synch_ref); + } + */ + + RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config; + + AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6, + "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!", + RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6); + + RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s; + AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, + "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!", + RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8); + + if (!prefix_type) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE); + else if (strcmp(prefix_type, "NORMAL") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; + } else if (strcmp(prefix_type, "EXTENDED") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, prefix_type); + } +#ifdef Rel14 + if (!pbch_repetition) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: TRUE,FALSE!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PBCH_REPETITION); + else if (strcmp(pbch_repetition, "TRUE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 1; + } else if (strcmp(pbch_repetition, "FALSE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 0; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pbch_repetition choice: TRUE or FALSE !\n", + RC.config_file_name, i, pbch_repetition); + } +#endif + + RRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band; + RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency; + RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset; + RRC_CONFIGURATION_REQ (msg_p).Nid_cell[j]= Nid_cell; + + if (Nid_cell>503) { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n", + RC.config_file_name, i, Nid_cell); + } + + RRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= N_RB_DL; + + if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n", + RC.config_file_name, i, N_RB_DL); + } + + if (strcmp(frame_type, "FDD") == 0) { + RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = FDD; + } else if (strcmp(frame_type, "TDD") == 0) { + RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = TDD; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n", + RC.config_file_name, i, frame_type); + } + + + RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config; + AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6, + "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!", + RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6); + + + RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s; + AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, + "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!", + RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8); + + + + if (!prefix_type) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE); + else if (strcmp(prefix_type, "NORMAL") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; + } else if (strcmp(prefix_type, "EXTENDED") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, prefix_type); + } + + + + RRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band; + // printf( "\teutra band:\t%d\n",RRC_CONFIGURATION_REQ (msg_p).eutra_band); + + + + RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency; + //printf( "\tdownlink freq:\t%u\n",RRC_CONFIGURATION_REQ (msg_p).downlink_frequency); + + + RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset; + + if (enb_check_band_frequencies(RC.config_file_name, + j, + RRC_CONFIGURATION_REQ (msg_p).eutra_band[j], + RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j], + RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j], + RRC_CONFIGURATION_REQ (msg_p).frame_type[j])) { + AssertFatal(0, "error calling enb_check_band_frequencies\n"); + } + + if ((nb_antenna_ports <1) || (nb_antenna_ports > 2)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n", + RC.config_file_name, i, nb_antenna_ports); + + RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = nb_antenna_ports; + + + RRC_CONFIGURATION_REQ (msg_p).prach_root[j] = prach_root; + + if ((prach_root <0) || (prach_root > 1023)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_root choice: 0..1023 !\n", + RC.config_file_name, i, prach_root); + + RRC_CONFIGURATION_REQ (msg_p).prach_config_index[j] = prach_config_index; + + if ((prach_config_index <0) || (prach_config_index > 63)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_config_index choice: 0..1023 !\n", + RC.config_file_name, i, prach_config_index); + + if (!prach_high_speed) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PRACH_HIGH_SPEED); + else if (strcmp(prach_high_speed, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[j] = TRUE; + } else if (strcmp(prach_high_speed, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prach_config choice: ENABLE,DISABLE !\n", + RC.config_file_name, i, prach_high_speed); + + RRC_CONFIGURATION_REQ (msg_p).prach_zero_correlation[j] =prach_zero_correlation; + + if ((prach_zero_correlation <0) || (prach_zero_correlation > 15)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n", + RC.config_file_name, i, prach_zero_correlation); + + RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[j] = prach_freq_offset; + + if ((prach_freq_offset <0) || (prach_freq_offset > 94)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n", + RC.config_file_name, i, prach_freq_offset); + + + RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[j] = pucch_delta_shift-1; + + if ((pucch_delta_shift <1) || (pucch_delta_shift > 3)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_delta_shift choice: 1..3!\n", + RC.config_file_name, i, pucch_delta_shift); + + RRC_CONFIGURATION_REQ (msg_p).pucch_nRB_CQI[j] = pucch_nRB_CQI; + + if ((pucch_nRB_CQI <0) || (pucch_nRB_CQI > 98)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nRB_CQI choice: 0..98!\n", + RC.config_file_name, i, pucch_nRB_CQI); + + RRC_CONFIGURATION_REQ (msg_p).pucch_nCS_AN[j] = pucch_nCS_AN; + + if ((pucch_nCS_AN <0) || (pucch_nCS_AN > 7)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n", + RC.config_file_name, i, pucch_nCS_AN); + +#if !defined(Rel10) && !defined(Rel14) + RRC_CONFIGURATION_REQ (msg_p).pucch_n1_AN[j] = pucch_n1_AN; + + if ((pucch_n1_AN <0) || (pucch_n1_AN > 2047)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_n1_AN choice: 0..2047!\n", + RC.config_file_name, i, pucch_n1_AN); + +#endif + RRC_CONFIGURATION_REQ (msg_p).pdsch_referenceSignalPower[j] = pdsch_referenceSignalPower; + + if ((pdsch_referenceSignalPower <-60) || (pdsch_referenceSignalPower > 50)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_referenceSignalPower choice:-60..50!\n", + RC.config_file_name, i, pdsch_referenceSignalPower); + + RRC_CONFIGURATION_REQ (msg_p).pdsch_p_b[j] = pdsch_p_b; + + if ((pdsch_p_b <0) || (pdsch_p_b > 3)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_p_b choice: 0..3!\n", + RC.config_file_name, i, pdsch_p_b); + + RRC_CONFIGURATION_REQ (msg_p).pusch_n_SB[j] = pusch_n_SB; + + if ((pusch_n_SB <1) || (pusch_n_SB > 4)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_n_SB choice: 1..4!\n", + RC.config_file_name, i, pusch_n_SB); + + if (!pusch_hoppingMode) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: interSubframe,intraAndInterSubframe!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_HOPPINGMODE); + else if (strcmp(pusch_hoppingMode,"interSubFrame")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; + } else if (strcmp(pusch_hoppingMode,"intraAndInterSubFrame")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_intraAndInterSubFrame; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingMode choice: interSubframe,intraAndInterSubframe!\n", + RC.config_file_name, i, pusch_hoppingMode); + + RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingOffset[j] = pusch_hoppingOffset; + + if ((pusch_hoppingOffset<0) || (pusch_hoppingOffset>98)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingOffset choice: 0..98!\n", + RC.config_file_name, i, pusch_hoppingMode); + + if (!pusch_enable64QAM) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_ENABLE64QAM); + else if (strcmp(pusch_enable64QAM, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_enable64QAM[j] = TRUE; + } else if (strcmp(pusch_enable64QAM, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_enable64QAM[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_enable64QAM choice: ENABLE,DISABLE!\n", + RC.config_file_name, i, pusch_enable64QAM); + + if (!pusch_groupHoppingEnabled) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_GROUP_HOPPING_EN); + else if (strcmp(pusch_groupHoppingEnabled, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_groupHoppingEnabled[j] = TRUE; + } else if (strcmp(pusch_groupHoppingEnabled, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_groupHoppingEnabled[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_groupHoppingEnabled choice: ENABLE,DISABLE!\n", + RC.config_file_name, i, pusch_groupHoppingEnabled); + + + RRC_CONFIGURATION_REQ (msg_p).pusch_groupAssignment[j] = pusch_groupAssignment; + + if ((pusch_groupAssignment<0)||(pusch_groupAssignment>29)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_groupAssignment choice: 0..29!\n", + RC.config_file_name, i, pusch_groupAssignment); + + if (!pusch_sequenceHoppingEnabled) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_SEQUENCE_HOPPING_EN); + else if (strcmp(pusch_sequenceHoppingEnabled, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_sequenceHoppingEnabled[j] = TRUE; + } else if (strcmp(pusch_sequenceHoppingEnabled, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_sequenceHoppingEnabled[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_sequenceHoppingEnabled choice: ENABLE,DISABLE!\n", + RC.config_file_name, i, pusch_sequenceHoppingEnabled); + + RRC_CONFIGURATION_REQ (msg_p).pusch_nDMRS1[j] = pusch_nDMRS1; //cyclic_shift in RRC! + + if ((pusch_nDMRS1 <0) || (pusch_nDMRS1>7)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_nDMRS1 choice: 0..7!\n", + RC.config_file_name, i, pusch_nDMRS1); + + if (strcmp(phich_duration,"NORMAL")==0) { + RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_normal; + } else if (strcmp(phich_duration,"EXTENDED")==0) { + RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_extended; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_duration choice: NORMAL,EXTENDED!\n", + RC.config_file_name, i, phich_duration); + + if (strcmp(phich_resource,"ONESIXTH")==0) { + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_oneSixth ; + } else if (strcmp(phich_resource,"HALF")==0) { + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_half; + } else if (strcmp(phich_resource,"ONE")==0) { + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_one; + } else if (strcmp(phich_resource,"TWO")==0) { + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_two; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_resource choice: ONESIXTH,HALF,ONE,TWO!\n", + RC.config_file_name, i, phich_resource); + + printf("phich.resource %ld (%s), phich.duration %ld (%s)\n", + RRC_CONFIGURATION_REQ (msg_p).phich_resource[j],phich_resource, + RRC_CONFIGURATION_REQ (msg_p).phich_duration[j],phich_duration); + + if (strcmp(srs_enable, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).srs_enable[j] = TRUE; + } else if (strcmp(srs_enable, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).srs_enable[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n", + RC.config_file_name, i, srs_enable); + + if (RRC_CONFIGURATION_REQ (msg_p).srs_enable[j] == TRUE) { + + RRC_CONFIGURATION_REQ (msg_p).srs_BandwidthConfig[j] = srs_BandwidthConfig; + + if ((srs_BandwidthConfig < 0) || (srs_BandwidthConfig >7)) + AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value %d for srs_BandwidthConfig choice: 0...7\n", + RC.config_file_name, i, srs_BandwidthConfig); + + RRC_CONFIGURATION_REQ (msg_p).srs_SubframeConfig[j] = srs_SubframeConfig; + + if ((srs_SubframeConfig<0) || (srs_SubframeConfig>15)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for srs_SubframeConfig choice: 0..15 !\n", + RC.config_file_name, i, srs_SubframeConfig); + + if (strcmp(srs_ackNackST, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).srs_ackNackST[j] = TRUE; + } else if (strcmp(srs_ackNackST, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).srs_ackNackST[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n", + RC.config_file_name, i, srs_ackNackST); + + if (strcmp(srs_MaxUpPts, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).srs_MaxUpPts[j] = TRUE; + } else if (strcmp(srs_MaxUpPts, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).srs_MaxUpPts[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_MaxUpPts choice: ENABLE,DISABLE !\n", + RC.config_file_name, i, srs_MaxUpPts); + } + + RRC_CONFIGURATION_REQ (msg_p).pusch_p0_Nominal[j] = pusch_p0_Nominal; + + if ((pusch_p0_Nominal<-126) || (pusch_p0_Nominal>24)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_p0_Nominal choice: -126..24 !\n", + RC.config_file_name, i, pusch_p0_Nominal); + +#ifndef Rel14 + if (strcmp(pusch_alpha,"AL0")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al0; + } else if (strcmp(pusch_alpha,"AL04")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al04; + } else if (strcmp(pusch_alpha,"AL05")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al05; + } else if (strcmp(pusch_alpha,"AL06")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al06; + } else if (strcmp(pusch_alpha,"AL07")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al07; + } else if (strcmp(pusch_alpha,"AL08")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al08; + } else if (strcmp(pusch_alpha,"AL09")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al09; + } else if (strcmp(pusch_alpha,"AL1")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al1; + } +#else + if (strcmp(pusch_alpha,"AL0")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al0; + } else if (strcmp(pusch_alpha,"AL04")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al04; + } else if (strcmp(pusch_alpha,"AL05")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al05; + } else if (strcmp(pusch_alpha,"AL06")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al06; + } else if (strcmp(pusch_alpha,"AL07")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al07; + } else if (strcmp(pusch_alpha,"AL08")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al08; + } else if (strcmp(pusch_alpha,"AL09")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al09; + } else if (strcmp(pusch_alpha,"AL1")==0) { + RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al1; + } +#endif + else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_Alpha choice: AL0,AL04,AL05,AL06,AL07,AL08,AL09,AL1!\n", + RC.config_file_name, i, pusch_alpha); + + RRC_CONFIGURATION_REQ (msg_p).pucch_p0_Nominal[j] = pucch_p0_Nominal; + + if ((pucch_p0_Nominal<-127) || (pucch_p0_Nominal>-96)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_p0_Nominal choice: -127..-96 !\n", + RC.config_file_name, i, pucch_p0_Nominal); + + RRC_CONFIGURATION_REQ (msg_p).msg3_delta_Preamble[j] = msg3_delta_Preamble; + + if ((msg3_delta_Preamble<-1) || (msg3_delta_Preamble>6)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for msg3_delta_Preamble choice: -1..6 !\n", + RC.config_file_name, i, msg3_delta_Preamble); + + + if (strcmp(pucch_deltaF_Format1,"deltaF_2")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF_2; + } else if (strcmp(pucch_deltaF_Format1,"deltaF0")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF0; + } else if (strcmp(pucch_deltaF_Format1,"deltaF2")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format1 choice: deltaF_2,dltaF0,deltaF2!\n", + RC.config_file_name, i, pucch_deltaF_Format1); + + if (strcmp(pucch_deltaF_Format1b,"deltaF1")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF1; + } else if (strcmp(pucch_deltaF_Format1b,"deltaF3")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3; + } else if (strcmp(pucch_deltaF_Format1b,"deltaF5")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF5; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format1b choice: deltaF1,dltaF3,deltaF5!\n", + RC.config_file_name, i, pucch_deltaF_Format1b); + + + if (strcmp(pucch_deltaF_Format2,"deltaF_2")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF_2; + } else if (strcmp(pucch_deltaF_Format2,"deltaF0")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0; + } else if (strcmp(pucch_deltaF_Format2,"deltaF1")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF1; + } else if (strcmp(pucch_deltaF_Format2,"deltaF2")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF2; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2 choice: deltaF_2,dltaF0,deltaF1,deltaF2!\n", + RC.config_file_name, i, pucch_deltaF_Format2); + + if (strcmp(pucch_deltaF_Format2a,"deltaF_2")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF_2; + } else if (strcmp(pucch_deltaF_Format2a,"deltaF0")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0; + } else if (strcmp(pucch_deltaF_Format2a,"deltaF2")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF2; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2a choice: deltaF_2,dltaF0,deltaF2!\n", + RC.config_file_name, i, pucch_deltaF_Format2a); + + if (strcmp(pucch_deltaF_Format2b,"deltaF_2")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF_2; + } else if (strcmp(pucch_deltaF_Format2b,"deltaF0")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0; + } else if (strcmp(pucch_deltaF_Format2b,"deltaF2")==0) { + RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF2; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2b choice: deltaF_2,dltaF0,deltaF2!\n", + RC.config_file_name, i, pucch_deltaF_Format2b); + + + + + RRC_CONFIGURATION_REQ (msg_p).rach_numberOfRA_Preambles[j] = (rach_numberOfRA_Preambles/4)-1; + + if ((rach_numberOfRA_Preambles <4) || (rach_numberOfRA_Preambles>64) || ((rach_numberOfRA_Preambles&3)!=0)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_numberOfRA_Preambles choice: 4,8,12,...,64!\n", + RC.config_file_name, i, rach_numberOfRA_Preambles); + + if (strcmp(rach_preamblesGroupAConfig, "ENABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).rach_preamblesGroupAConfig[j] = TRUE; + + + RRC_CONFIGURATION_REQ (msg_p).rach_sizeOfRA_PreamblesGroupA[j] = (rach_sizeOfRA_PreamblesGroupA/4)-1; + + if ((rach_numberOfRA_Preambles <4) || (rach_numberOfRA_Preambles>60) || ((rach_numberOfRA_Preambles&3)!=0)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_sizeOfRA_PreamblesGroupA choice: 4,8,12,...,60!\n", + RC.config_file_name, i, rach_sizeOfRA_PreamblesGroupA); + + + switch (rach_messageSizeGroupA) { + case 56: + RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b56; + break; + + case 144: + RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b144; + break; + + case 208: + RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b208; + break; + + case 256: + RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b256; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_messageSizeGroupA choice: 56,144,208,256!\n", + RC.config_file_name, i, rach_messageSizeGroupA); + break; + } + + if (strcmp(rach_messagePowerOffsetGroupB,"minusinfinity")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_minusinfinity; + } + + else if (strcmp(rach_messagePowerOffsetGroupB,"dB0")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB0; + } + + else if (strcmp(rach_messagePowerOffsetGroupB,"dB5")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB5; + } + + else if (strcmp(rach_messagePowerOffsetGroupB,"dB8")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB8; + } + + else if (strcmp(rach_messagePowerOffsetGroupB,"dB10")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB10; + } + + else if (strcmp(rach_messagePowerOffsetGroupB,"dB12")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB12; + } + + else if (strcmp(rach_messagePowerOffsetGroupB,"dB15")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB15; + } + + else if (strcmp(rach_messagePowerOffsetGroupB,"dB18")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB18; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_messagePowerOffsetGroupB choice: minusinfinity,dB0,dB5,dB8,dB10,dB12,dB15,dB18!\n", + RC.config_file_name, i, rach_messagePowerOffsetGroupB); + + } else if (strcmp(rach_preamblesGroupAConfig, "DISABLE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).rach_preamblesGroupAConfig[j] = FALSE; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_preamblesGroupAConfig choice: ENABLE,DISABLE !\n", + RC.config_file_name, i, rach_preamblesGroupAConfig); + + RRC_CONFIGURATION_REQ (msg_p).rach_preambleInitialReceivedTargetPower[j] = (rach_preambleInitialReceivedTargetPower+120)/2; + + if ((rach_preambleInitialReceivedTargetPower<-120) || (rach_preambleInitialReceivedTargetPower>-90) || ((rach_preambleInitialReceivedTargetPower&1)!=0)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleInitialReceivedTargetPower choice: -120,-118,...,-90 !\n", + RC.config_file_name, i, rach_preambleInitialReceivedTargetPower); + + + RRC_CONFIGURATION_REQ (msg_p).rach_powerRampingStep[j] = rach_powerRampingStep/2; + + if ((rach_powerRampingStep<0) || (rach_powerRampingStep>6) || ((rach_powerRampingStep&1)!=0)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_powerRampingStep choice: 0,2,4,6 !\n", + RC.config_file_name, i, rach_powerRampingStep); + + + + switch (rach_preambleTransMax) { +#ifndef Rel14 + case 3: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3; + break; + + case 4: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4; + break; + + case 5: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5; + break; + + case 6: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6; + break; + + case 7: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7; + break; + + case 8: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8; + break; + + case 10: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10; + break; + + case 20: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20; + break; + + case 50: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50; + break; + + case 100: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100; + break; + + case 200: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200; + break; + +#else + + case 3: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n3; + break; + + case 4: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n4; + break; + + case 5: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n5; + break; + + case 6: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n6; + break; + + case 7: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n7; + break; + + case 8: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n8; + break; + + case 10: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n10; + break; + + case 20: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n20; + break; + + case 50: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n50; + break; + + case 100: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n100; + break; + + case 200: + RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] = PreambleTransMax_n200; + break; +#endif + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleTransMax choice: 3,4,5,6,7,8,10,20,50,100,200!\n", + RC.config_file_name, i, rach_preambleTransMax); + break; + } + + RRC_CONFIGURATION_REQ (msg_p).rach_raResponseWindowSize[j] = (rach_raResponseWindowSize==10)?7:rach_raResponseWindowSize-2; + + if ((rach_raResponseWindowSize<0)||(rach_raResponseWindowSize==9)||(rach_raResponseWindowSize>10)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_raResponseWindowSize choice: 2,3,4,5,6,7,8,10!\n", + RC.config_file_name, i, rach_preambleTransMax); + + + RRC_CONFIGURATION_REQ (msg_p).rach_macContentionResolutionTimer[j] = (rach_macContentionResolutionTimer/8)-1; + + if ((rach_macContentionResolutionTimer<8) || (rach_macContentionResolutionTimer>64) || ((rach_macContentionResolutionTimer&7)!=0)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_macContentionResolutionTimer choice: 8,16,...,56,64!\n", + RC.config_file_name, i, rach_preambleTransMax); + + RRC_CONFIGURATION_REQ (msg_p).rach_maxHARQ_Msg3Tx[j] = rach_maxHARQ_Msg3Tx; + + if ((rach_maxHARQ_Msg3Tx<0) || (rach_maxHARQ_Msg3Tx>8)) + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_maxHARQ_Msg3Tx choice: 1..8!\n", + RC.config_file_name, i, rach_preambleTransMax); + + + switch (pcch_defaultPagingCycle) { + case 32: + RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf32; + break; + + case 64: + RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf64; + break; + + case 128: + RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf128; + break; + + case 256: + RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf256; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pcch_defaultPagingCycle choice: 32,64,128,256!\n", + RC.config_file_name, i, pcch_defaultPagingCycle); + break; + } + + if (strcmp(pcch_nB, "fourT") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_fourT; + } else if (strcmp(pcch_nB, "twoT") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_twoT; + } else if (strcmp(pcch_nB, "oneT") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneT; + } else if (strcmp(pcch_nB, "halfT") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_halfT; + } else if (strcmp(pcch_nB, "quarterT") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_quarterT; + } else if (strcmp(pcch_nB, "oneEighthT") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneEighthT; + } else if (strcmp(pcch_nB, "oneSixteenthT") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneSixteenthT; + } else if (strcmp(pcch_nB, "oneThirtySecondT") == 0) { + RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneThirtySecondT; + } else + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pcch_nB choice: fourT,twoT,oneT,halfT,quarterT,oneighthT,oneSixteenthT,oneThirtySecondT !\n", + RC.config_file_name, i, pcch_defaultPagingCycle); + + + + switch (bcch_modificationPeriodCoeff) { + case 2: + RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n2; + break; + + case 4: + RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n4; + break; + + case 8: + RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n8; + break; + + case 16: + RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[j] = BCCH_Config__modificationPeriodCoeff_n16; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for bcch_modificationPeriodCoeff choice: 2,4,8,16", + RC.config_file_name, i, bcch_modificationPeriodCoeff); + + break; + } + + + switch (ue_TimersAndConstants_t300) { + case 100: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms100; + break; + + case 200: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms200; + break; + + case 300: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms300; + break; + + case 400: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms400; + break; + + case 600: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms600; + break; + + case 1000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms1000; + break; + + case 1500: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms1500; + break; + + case 2000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[j] = UE_TimersAndConstants__t300_ms2000; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t300 choice: 100,200,300,400,600,1000,1500,2000 ", + RC.config_file_name, i, ue_TimersAndConstants_t300); + break; + + } + + switch (ue_TimersAndConstants_t301) { + case 100: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms100; + break; + + case 200: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms200; + break; + + case 300: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms300; + break; + + case 400: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms400; + break; + + case 600: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms600; + break; + + case 1000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms1000; + break; + + case 1500: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms1500; + break; + + case 2000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[j] = UE_TimersAndConstants__t301_ms2000; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t301 choice: 100,200,300,400,600,1000,1500,2000 ", + RC.config_file_name, i, ue_TimersAndConstants_t301); + break; + + } + + switch (ue_TimersAndConstants_t310) { + case 0: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms0; + break; + + case 50: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms50; + break; + + case 100: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms100; + break; + + case 200: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms200; + break; + + case 500: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms500; + break; + + case 1000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms1000; + break; + + case 2000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[j] = UE_TimersAndConstants__t310_ms2000; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t310 choice: 0,50,100,200,500,1000,1500,2000 ", + RC.config_file_name, i, ue_TimersAndConstants_t310); + break; + + } + + switch (ue_TimersAndConstants_t311) { + case 1000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms1000; + break; + + case 3110: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms3000; + break; + + case 5000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms5000; + break; + + case 10000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms10000; + break; + + case 15000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms15000; + break; + + case 20000: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms20000; + break; + + case 31100: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[j] = UE_TimersAndConstants__t311_ms30000; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t311 choice: 1000,3000,5000,10000,150000,20000,30000", + RC.config_file_name, i, ue_TimersAndConstants_t311); + break; + + } + + switch (ue_TimersAndConstants_n310) { + case 1: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n1; + break; + + case 2: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n2; + break; + + case 3: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n3; + break; + + case 4: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n4; + break; + + case 6: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n6; + break; + + case 8: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n8; + break; + + case 10: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n10; + break; + + case 20: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[j] = UE_TimersAndConstants__n310_n20; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_n310 choice: 1,2,3,4,6,6,8,10,20", + RC.config_file_name, i, ue_TimersAndConstants_n311); + break; + + } + + switch (ue_TimersAndConstants_n311) { + case 1: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n1; + break; + + case 2: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n2; + break; + + case 3: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n3; + break; + + case 4: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n4; + break; + + case 5: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n5; + break; + + case 6: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n6; + break; + + case 8: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n8; + break; + + case 10: + RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[j] = UE_TimersAndConstants__n311_n10; + break; + + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TimersAndConstants_t311 choice: 1,2,3,4,5,6,8,10", + RC.config_file_name, i, ue_TimersAndConstants_t311); + break; + + } + + switch (ue_TransmissionMode) { + case 1: + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm1; + break; + case 2: + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm2; + break; + case 3: + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm3; + break; + case 4: + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm4; + break; + case 5: + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm5; + break; + case 6: + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm6; + break; + case 7: + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm7; + break; + default: + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TransmissionMode choice: 1,2,3,4,5,6,7", + RC.config_file_name, i, ue_TransmissionMode); + break; + } + } + } + char srb1path[MAX_OPTNAME_SIZE*2 + 8]; + int npar = config_get( SRB1Params,sizeof(SRB1Params)/sizeof(paramdef_t),enbpath); + sprintf(srb1path,"%s.%s",enbpath,ENB_CONFIG_STRING_SRB1); + if (npar == sizeof(SRB1Params)/sizeof(paramdef_t)) { + switch (srb1_max_retx_threshold) { + case 1: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t1; + break; + + case 2: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t2; + break; + + case 3: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t3; + break; + + case 4: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t4; + break; + + case 6: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t6; + break; + + case 8: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; + break; + + case 16: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t16; + break; + + case 32: + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t32; + break; + + default: + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_max_retx_threshold %u!\n", + RC.config_file_name, i, srb1_max_retx_threshold); + } + + + switch (srb1_poll_pdu) { + case 4: + rrc->srb1_poll_pdu = PollPDU_p4; + break; + + case 8: + rrc->srb1_poll_pdu = PollPDU_p8; + break; + + case 16: + rrc->srb1_poll_pdu = PollPDU_p16; + break; + + case 32: + rrc->srb1_poll_pdu = PollPDU_p32; + break; + + case 64: + rrc->srb1_poll_pdu = PollPDU_p64; + break; + + case 128: + rrc->srb1_poll_pdu = PollPDU_p128; + break; + + case 256: + rrc->srb1_poll_pdu = PollPDU_p256; + break; + + default: + if (srb1_poll_pdu >= 10000) + rrc->srb1_poll_pdu = PollPDU_pInfinity; + else + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_pdu %u!\n", + RC.config_file_name, i, srb1_poll_pdu); + } + + rrc->srb1_poll_byte = srb1_poll_byte; + + switch (srb1_poll_byte) { + case 25: + rrc->srb1_poll_byte = PollByte_kB25; + break; + + case 50: + rrc->srb1_poll_byte = PollByte_kB50; + break; + + case 75: + rrc->srb1_poll_byte = PollByte_kB75; + break; + + case 100: + rrc->srb1_poll_byte = PollByte_kB100; + break; + + case 125: + rrc->srb1_poll_byte = PollByte_kB125; + break; + + case 250: + rrc->srb1_poll_byte = PollByte_kB250; + break; + + case 375: + rrc->srb1_poll_byte = PollByte_kB375; + break; + + case 500: + rrc->srb1_poll_byte = PollByte_kB500; + break; + + case 750: + rrc->srb1_poll_byte = PollByte_kB750; + break; + + case 1000: + rrc->srb1_poll_byte = PollByte_kB1000; + break; + + case 1250: + rrc->srb1_poll_byte = PollByte_kB1250; + break; + + case 1500: + rrc->srb1_poll_byte = PollByte_kB1500; + break; + + case 2000: + rrc->srb1_poll_byte = PollByte_kB2000; + break; + + case 3000: + rrc->srb1_poll_byte = PollByte_kB3000; + break; + + default: + if (srb1_poll_byte >= 10000) + rrc->srb1_poll_byte = PollByte_kBinfinity; + else + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_poll_byte %u!\n", + RC.config_file_name, i, srb1_poll_byte); + } + + if (srb1_timer_poll_retransmit <= 250) { + rrc->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 5)/5; + } else if (srb1_timer_poll_retransmit <= 500) { + rrc->srb1_timer_poll_retransmit = (srb1_timer_poll_retransmit - 300)/50 + 50; + } else { + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_poll_retransmit %u!\n", + RC.config_file_name, i, srb1_timer_poll_retransmit); + } + + if (srb1_timer_status_prohibit <= 250) { + rrc->srb1_timer_status_prohibit = srb1_timer_status_prohibit/5; + } else if ((srb1_timer_poll_retransmit >= 300) && (srb1_timer_poll_retransmit <= 500)) { + rrc->srb1_timer_status_prohibit = (srb1_timer_status_prohibit - 300)/50 + 51; + } else { + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_status_prohibit %u!\n", + RC.config_file_name, i, srb1_timer_status_prohibit); + } + + switch (srb1_timer_reordering) { + case 0: + rrc->srb1_timer_reordering = T_Reordering_ms0; + break; + + case 5: + rrc->srb1_timer_reordering = T_Reordering_ms5; + break; + + case 10: + rrc->srb1_timer_reordering = T_Reordering_ms10; + break; + + case 15: + rrc->srb1_timer_reordering = T_Reordering_ms15; + break; + + case 20: + rrc->srb1_timer_reordering = T_Reordering_ms20; + break; + + case 25: + rrc->srb1_timer_reordering = T_Reordering_ms25; + break; + + case 30: + rrc->srb1_timer_reordering = T_Reordering_ms30; + break; + + case 35: + rrc->srb1_timer_reordering = T_Reordering_ms35; + break; + + case 40: + rrc->srb1_timer_reordering = T_Reordering_ms40; + break; + + case 45: + rrc->srb1_timer_reordering = T_Reordering_ms45; + break; + + case 50: + rrc->srb1_timer_reordering = T_Reordering_ms50; + break; + + case 55: + rrc->srb1_timer_reordering = T_Reordering_ms55; + break; + + case 60: + rrc->srb1_timer_reordering = T_Reordering_ms60; + break; + + case 65: + rrc->srb1_timer_reordering = T_Reordering_ms65; + break; + + case 70: + rrc->srb1_timer_reordering = T_Reordering_ms70; + break; + + case 75: + rrc->srb1_timer_reordering = T_Reordering_ms75; + break; + + case 80: + rrc->srb1_timer_reordering = T_Reordering_ms80; + break; + + case 85: + rrc->srb1_timer_reordering = T_Reordering_ms85; + break; + + case 90: + rrc->srb1_timer_reordering = T_Reordering_ms90; + break; + + case 95: + rrc->srb1_timer_reordering = T_Reordering_ms95; + break; + + case 100: + rrc->srb1_timer_reordering = T_Reordering_ms100; + break; + + case 110: + rrc->srb1_timer_reordering = T_Reordering_ms110; + break; + + case 120: + rrc->srb1_timer_reordering = T_Reordering_ms120; + break; + + case 130: + rrc->srb1_timer_reordering = T_Reordering_ms130; + break; + + case 140: + rrc->srb1_timer_reordering = T_Reordering_ms140; + break; + + case 150: + rrc->srb1_timer_reordering = T_Reordering_ms150; + break; + + case 160: + rrc->srb1_timer_reordering = T_Reordering_ms160; + break; + + case 170: + rrc->srb1_timer_reordering = T_Reordering_ms170; + break; + + case 180: + rrc->srb1_timer_reordering = T_Reordering_ms180; + break; + + case 190: + rrc->srb1_timer_reordering = T_Reordering_ms190; + break; + + case 200: + rrc->srb1_timer_reordering = T_Reordering_ms200; + break; + + default: + AssertFatal (0, + "Bad config value when parsing eNB configuration file %s, enb %d srb1_timer_reordering %u!\n", + RC.config_file_name, i, srb1_timer_reordering); + } + + } else { + rrc->srb1_timer_poll_retransmit = T_PollRetransmit_ms80; + rrc->srb1_timer_reordering = T_Reordering_ms35; + rrc->srb1_timer_status_prohibit = T_StatusProhibit_ms0; + rrc->srb1_poll_pdu = PollPDU_p4; + rrc->srb1_poll_byte = PollByte_kBinfinity; + rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; + } + /* + // Network Controller + subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG); + + if (subsetting != NULL) { + if ( ( + config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME, + (const char **)&flexran_agent_interface_name) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS, + (const char **)&flexran_agent_ipv4_address) + && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT, + &flexran_agent_port) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE, + (const char **)&flexran_agent_cache) + ) + ) { + enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_interface_name = strdup(flexran_agent_interface_name); + cidr = flexran_agent_ipv4_address; + address = strtok(cidr, "/"); + //enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address = strdup(address); + if (address) { + IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); + } + + enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_port = flexran_agent_port; + enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_cache = strdup(flexran_agent_cache); + } + } + */ + + /* + // OTG _CONFIG + setting_otg = config_setting_get_member (setting_enb, ENB_CONF_STRING_OTG_CONFIG); + + if (setting_otg != NULL) { + num_otg_elements = config_setting_length(setting_otg); + printf("num otg elements %d \n", num_otg_elements); + enb_properties_loc.properties[enb_properties_loc_index]->num_otg_elements = 0; + + for (j = 0; j < num_otg_elements; j++) { + subsetting_otg=config_setting_get_elem(setting_otg, j); + + if (config_setting_lookup_int(subsetting_otg, ENB_CONF_STRING_OTG_UE_ID, &otg_ue_id)) { + enb_properties_loc.properties[enb_properties_loc_index]->otg_ue_id[j] = otg_ue_id; + } else { + enb_properties_loc.properties[enb_properties_loc_index]->otg_ue_id[j] = 1; + } + + if (config_setting_lookup_string(subsetting_otg, ENB_CONF_STRING_OTG_APP_TYPE, (const char **)&otg_app_type)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->otg_app_type[j] = map_str_to_int(otg_app_type_names,otg_app_type))== -1) { + enb_properties_loc.properties[enb_properties_loc_index]->otg_app_type[j] = BCBR; + } + } else { + enb_properties_loc.properties[enb_properties_loc_index]->otg_app_type[j] = NO_PREDEFINED_TRAFFIC; // 0 + } + + if (config_setting_lookup_string(subsetting_otg, ENB_CONF_STRING_OTG_BG_TRAFFIC, (const char **)&otg_bg_traffic)) { + + if ((enb_properties_loc.properties[enb_properties_loc_index]->otg_bg_traffic[j] = map_str_to_int(switch_names,otg_bg_traffic)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->otg_bg_traffic[j]=0; + } + } else { + enb_properties_loc.properties[enb_properties_loc_index]->otg_bg_traffic[j] = 0; + printf("otg bg %s\n", otg_bg_traffic); + } + + enb_properties_loc.properties[enb_properties_loc_index]->num_otg_elements+=1; + + } + } + + // log_config + subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_LOG_CONFIG); + + if (subsetting != NULL) { + // global + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GLOBAL_LOG_LEVEL, (const char **) &glog_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->glog_level = map_str_to_int(log_level_names, glog_level)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->glog_level = LOG_INFO; + } + + //printf( "\tGlobal log level :\t%s->%d\n",glog_level, enb_properties_loc.properties[enb_properties_loc_index]->glog_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->glog_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,(const char **) &glog_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity = map_str_to_int(log_verbosity_names, glog_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity = LOG_MED; + } + + //printf( "\tGlobal log verbosity:\t%s->%d\n",glog_verbosity, enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity = LOG_MED; + } + + // HW + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_HW_LOG_LEVEL, (const char **) &hw_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level = map_str_to_int(log_level_names,hw_log_level)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level = LOG_INFO; + } + + //printf( "\tHW log level :\t%s->%d\n",hw_log_level,enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_HW_LOG_VERBOSITY, (const char **) &hw_log_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity = map_str_to_int(log_verbosity_names,hw_log_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity = LOG_MED; + } + + //printf( "\tHW log verbosity:\t%s->%d\n",hw_log_verbosity, enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity = LOG_MED; + } + + // phy + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PHY_LOG_LEVEL,(const char **) &phy_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level = map_str_to_int(log_level_names,phy_log_level)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level = LOG_INFO; + } + + //printf( "\tPHY log level :\t%s->%d\n",phy_log_level,enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PHY_LOG_VERBOSITY, (const char **)&phy_log_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity = map_str_to_int(log_verbosity_names,phy_log_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity = LOG_MED; + } + + //printf( "\tPHY log verbosity:\t%s->%d\n",phy_log_level,enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity = LOG_MED; + } + + //mac + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_MAC_LOG_LEVEL, (const char **)&mac_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level = map_str_to_int(log_level_names,mac_log_level)) == -1 ) { + enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level = LOG_INFO; + } + + //printf( "\tMAC log level :\t%s->%d\n",mac_log_level,enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_MAC_LOG_VERBOSITY, (const char **)&mac_log_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity = map_str_to_int(log_verbosity_names,mac_log_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity = LOG_MED; + } + + //printf( "\tMAC log verbosity:\t%s->%d\n",mac_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity = LOG_MED; + } + + //rlc + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RLC_LOG_LEVEL, (const char **)&rlc_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level = map_str_to_int(log_level_names,rlc_log_level)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level = LOG_INFO; + } + + //printf( "\tRLC log level :\t%s->%d\n",rlc_log_level, enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RLC_LOG_VERBOSITY, (const char **)&rlc_log_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity = map_str_to_int(log_verbosity_names,rlc_log_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity = LOG_MED; + } + + //printf( "\tRLC log verbosity:\t%s->%d\n",rlc_log_verbosity, enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity = LOG_MED; + } + + //pdcp + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PDCP_LOG_LEVEL, (const char **)&pdcp_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level = map_str_to_int(log_level_names,pdcp_log_level)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level = LOG_INFO; + } + + //printf( "\tPDCP log level :\t%s->%d\n",pdcp_log_level, enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PDCP_LOG_VERBOSITY, (const char **)&pdcp_log_verbosity)) { + enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_verbosity = map_str_to_int(log_verbosity_names,pdcp_log_verbosity); + //printf( "\tPDCP log verbosity:\t%s->%d\n",pdcp_log_verbosity, enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_verbosity = LOG_MED; + } + + //rrc + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RRC_LOG_LEVEL, (const char **)&rrc_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level = map_str_to_int(log_level_names,rrc_log_level)) == -1 ) { + enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level = LOG_INFO; + } + + //printf( "\tRRC log level :\t%s->%d\n",rrc_log_level,enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RRC_LOG_VERBOSITY, (const char **)&rrc_log_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity = map_str_to_int(log_verbosity_names,rrc_log_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity = LOG_MED; + } + + //printf( "\tRRC log verbosity:\t%s->%d\n",rrc_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity = LOG_MED; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GTPU_LOG_LEVEL, (const char **)>pu_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level = map_str_to_int(log_level_names,gtpu_log_level)) == -1 ) { + enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level = LOG_INFO; + } + + //printf( "\tGTPU log level :\t%s->%d\n",gtpu_log_level,enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GTPU_LOG_VERBOSITY, (const char **)>pu_log_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity = map_str_to_int(log_verbosity_names,gtpu_log_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity = LOG_MED; + } + + //printf( "\tGTPU log verbosity:\t%s->%d\n",gtpu_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity = LOG_MED; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_UDP_LOG_LEVEL, (const char **)&udp_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level = map_str_to_int(log_level_names,udp_log_level)) == -1 ) { + enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level = LOG_INFO; + } + + //printf( "\tUDP log level :\t%s->%d\n",udp_log_level,enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_UDP_LOG_VERBOSITY, (const char **)&udp_log_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->udp_log_verbosity = map_str_to_int(log_verbosity_names,udp_log_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->udp_log_verbosity = LOG_MED; + } + + //printf( "\tUDP log verbosity:\t%s->%d\n",udp_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->udp_log_verbosity = LOG_MED; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_OSA_LOG_LEVEL, (const char **)&osa_log_level)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level = map_str_to_int(log_level_names,osa_log_level)) == -1 ) { + enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level = LOG_INFO; + } + + //printf( "\tOSA log level :\t%s->%d\n",osa_log_level,enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level = LOG_INFO; + } + + if (config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_OSA_LOG_VERBOSITY, (const char **)&osa_log_verbosity)) { + if ((enb_properties_loc.properties[enb_properties_loc_index]->osa_log_verbosity = map_str_to_int(log_verbosity_names,osa_log_verbosity)) == -1) { + enb_properties_loc.properties[enb_properties_loc_index]->osa_log_verbosity = LOG_MED; + } + + //printf( "\tOSA log verbosity:\t%s->%d\n",osa_log_verbosity,enb_properties_loc.properties[enb_properties_loc_index]->gosa_log_verbosity); + } else { + enb_properties_loc.properties[enb_properties_loc_index]->osa_log_verbosity = LOG_MED; + } + + } else { // not configuration is given + enb_properties_loc.properties[enb_properties_loc_index]->glog_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->glog_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->hw_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->hw_log_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->phy_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->phy_log_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->mac_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->mac_log_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->rlc_log_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->pdcp_log_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->rrc_log_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->gtpu_log_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->udp_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->udp_log_verbosity = LOG_MED; + enb_properties_loc.properties[enb_properties_loc_index]->osa_log_level = LOG_INFO; + enb_properties_loc.properties[enb_properties_loc_index]->osa_log_verbosity = LOG_MED; + } + */ + break; + } + + } + } +return 0; +} + +int RCconfig_gtpu(void ) { +/* temporary code to use Eurecom configuration mechanism */ + if ( donotuse_configmodule== 1){ + return Eurecom_RCconfig_gtpu(); + } +/*------------------------------------------*/ + int num_enbs = 0; + + + + char* enb_interface_name_for_S1U = NULL; + char* enb_ipv4_address_for_S1U = NULL; + uint32_t enb_port_for_S1U = 0; + char *address = NULL; + char *cidr = NULL; + char gtpupath[MAX_OPTNAME_SIZE*2 + 8]; + + + paramdef_t ENBSParams[] = ENBSPARAMS_DESC; + + paramdef_t GTPUParams[] = GTPUPARAMS_DESC; + LOG_I(GTPU,"Configuring GTPu\n"); + +/* get number of active eNodeBs */ + config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); + num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; + AssertFatal (num_enbs >0, + "Failed to parse config file no active eNodeBs in %s \n", ENB_CONFIG_STRING_ACTIVE_ENBS); + + + sprintf(gtpupath,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,0,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); + config_get( GTPUParams,sizeof(GTPUParams)/sizeof(paramdef_t),gtpupath); + + + + cidr = enb_ipv4_address_for_S1U; + address = strtok(cidr, "/"); + + if (address) { + IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); + + LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up); + + } + + RC.gtpv1u_data_g->enb_port_for_S1u_S12_S4_up = enb_port_for_S1U; +return 0; +} + + +int RCconfig_S1(MessageDef *msg_p, uint32_t i) { + +/* temporary code to use Eurecom configuration mechanism */ + if ( donotuse_configmodule== 1){ + return Eurecom_RCconfig_S1(msg_p, i); + } +/*------------------------------------------*/ + + int j,k = 0; + + + int enb_id; + + int32_t my_int; + + + + const char* active_enb[MAX_ENB]; + + + char *address = NULL; + char *cidr = NULL; + + + // for no gcc warnings + + (void)my_int; + + memset((char*)active_enb, 0 , MAX_ENB * sizeof(char*)); + + paramdef_t ENBSParams[] = ENBSPARAMS_DESC; + + paramdef_t ENBParams[] = ENBPARAMS_DESC; + paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0}; + +/* get global parameters, defined outside any section in the config file */ + + config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); +#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) + if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) { + asn_debug = 0; + asn1_xer_print = 0; + } else if (strcasecmp( *(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr), ENB_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0) { + asn_debug = 1; + asn1_xer_print = 1; + } else if (strcasecmp(*(ENBSParams[ENB_ASN1_VERBOSITY_IDX].strptr) , ENB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING) == 0) { + asn_debug = 1; + asn1_xer_print = 2; + } else { + asn_debug = 0; + asn1_xer_print = 0; + } + +#endif + + AssertFatal (i<ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt, + "Failed to parse config file %s, %uth attribute %s \n", + RC.config_file_name, i, ENB_CONFIG_STRING_ACTIVE_ENBS); + + + if (ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt>0) { + // Output a list of all eNBs. + config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL); + + + + + + if (ENBParamList.numelt > 0) { + for (k = 0; k < ENBParamList.numelt; k++) { + if (ENBParamList.paramarray[k][ENB_ENB_ID_IDX].uptr == NULL) { + // Calculate a default eNB ID + +# if defined(ENABLE_USE_MME) + uint32_t hash; + + hash = s1ap_generate_eNB_id (); + enb_id = k + (hash & 0xFFFF8); +# else + enb_id = k; +# endif + } else { + enb_id = *(ENBParamList.paramarray[k][ENB_ENB_ID_IDX].uptr); + } + + + // search if in active list + for (j=0; j < ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; j++) { + if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[j], *(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr)) == 0) { + paramdef_t S1Params[] = S1PARAMS_DESC; + paramlist_def_t S1ParamList = {ENB_CONFIG_STRING_MME_IP_ADDRESS,NULL,0}; + + paramdef_t SCTPParams[] = SCTPPARAMS_DESC; + paramdef_t NETParams[] = NETPARAMS_DESC; + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + + S1AP_REGISTER_ENB_REQ (msg_p).eNB_id = enb_id; + + if (strcmp(*(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr), "CELL_MACRO_ENB") == 0) { + S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_MACRO_ENB; + } else if (strcmp(*(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr), "CELL_HOME_ENB") == 0) { + S1AP_REGISTER_ENB_REQ (msg_p).cell_type = CELL_HOME_ENB; + } else { + AssertFatal (0, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_ENB or CELL_HOME_ENB !\n", + RC.config_file_name, i, *(ENBParamList.paramarray[k][ENB_CELL_TYPE_IDX].strptr)); + } + + S1AP_REGISTER_ENB_REQ (msg_p).eNB_name = strdup(*(ENBParamList.paramarray[k][ENB_ENB_NAME_IDX].strptr)); + S1AP_REGISTER_ENB_REQ (msg_p).tac = (uint16_t)atoi(*(ENBParamList.paramarray[k][ENB_TRACKING_AREA_CODE_IDX].strptr)); + S1AP_REGISTER_ENB_REQ (msg_p).mcc = (uint16_t)atoi(*(ENBParamList.paramarray[k][ENB_MOBILE_COUNTRY_CODE_IDX].strptr)); + S1AP_REGISTER_ENB_REQ (msg_p).mnc = (uint16_t)atoi(*(ENBParamList.paramarray[k][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length = strlen(*(ENBParamList.paramarray[k][ENB_MOBILE_NETWORK_CODE_IDX].strptr)); + S1AP_REGISTER_ENB_REQ (msg_p).default_drx = 0; + AssertFatal((S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length == 2) || + (S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length == 3), + "BAD MNC DIGIT LENGTH %d", + S1AP_REGISTER_ENB_REQ (msg_p).mnc_digit_length); + + sprintf(aprefix,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k); + config_getlist( &S1ParamList,S1Params,sizeof(S1Params)/sizeof(paramdef_t),aprefix); + + S1AP_REGISTER_ENB_REQ (msg_p).nb_mme = 0; + + for (int l = 0; l < S1ParamList.numelt; l++) { + + S1AP_REGISTER_ENB_REQ (msg_p).nb_mme += 1; + + strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4_address,*(S1ParamList.paramarray[l][ENB_MME_IPV4_ADDRESS_IDX].strptr)); + strcpy(S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6_address,*(S1ParamList.paramarray[l][ENB_MME_IPV6_ADDRESS_IDX].strptr)); + + if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_ACTIVE_IDX].strptr), "yes") == 0) { +#if defined(ENABLE_USE_MME) + EPC_MODE_ENABLED = 1; +#endif + } + if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) { + S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1; + } else if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) { + S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1; + } else if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) { + S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1; + S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1; + } + } + + + // SCTP SETTING + S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = SCTP_OUT_STREAMS; + S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = SCTP_IN_STREAMS; +# if defined(ENABLE_USE_MME) + sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG); + config_get( SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); + S1AP_REGISTER_ENB_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[ENB_SCTP_INSTREAMS_IDX].uptr); + S1AP_REGISTER_ENB_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[ENB_SCTP_OUTSTREAMS_IDX].uptr); +#endif + + sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); + // NETWORK_INTERFACES + config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix); + + // S1AP_REGISTER_ENB_REQ (msg_p).enb_interface_name_for_S1U = strdup(enb_interface_name_for_S1U); + cidr = *(NETParams[ENB_INTERFACE_NAME_FOR_S1U_IDX].strptr); + address = strtok(cidr, "/"); + + S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv6 = 0; + S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4 = 1; + + strcpy(S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4_address, address); + + /* + in_addr_t ipv4_address; + + if (address) { + IPV4_STR_ADDR_TO_INT_NWBO ( address, ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); + } + strcpy(S1AP_REGISTER_ENB_REQ (msg_p).enb_ip_address.ipv4_address, inet_ntoa(ipv4_address)); + // S1AP_REGISTER_ENB_REQ (msg_p).enb_port_for_S1U = enb_port_for_S1U; + + + S1AP_REGISTER_ENB_REQ (msg_p).enb_interface_name_for_S1_MME = strdup(enb_interface_name_for_S1_MME); + cidr = enb_ipv4_address_for_S1_MME; + address = strtok(cidr, "/"); + + if (address) { + IPV4_STR_ADDR_TO_INT_NWBO ( address, S1AP_REGISTER_ENB_REQ(msg_p).enb_ipv4_address_for_S1_MME, "BAD IP ADDRESS FORMAT FOR eNB S1_MME !\n" ); + } +*/ + + + + + break; + } + } + } + } + } +return 0; +} + +void RCConfig(const char *config_file_name) { + +/* temporary code to use Eurecom configuration mechanism */ + if ( config_file_name != NULL ) { + Eurecom_RCConfig(config_file_name); + return; + } else { + donotuse_configmodule=0; + } +/*------------------------------------------*/ + paramlist_def_t MACRLCParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0}; + paramlist_def_t L1ParamList = {CONFIG_STRING_L1_LIST,NULL,0}; + paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0}; + paramdef_t ENBSParams[] = ENBSPARAMS_DESC; + paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0}; + + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + + + +/* get global parameters, defined outside any section in the config file */ + + config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL); + RC.nb_inst = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; + + if (RC.nb_inst > 0) { + RC.nb_CC = (int *)malloc((1+RC.nb_inst)*sizeof(int)); + for (int i=0;i<RC.nb_inst;i++) { + sprintf(aprefix,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,i); + config_getlist( &CCsParamList,NULL,0, aprefix); + RC.nb_CC[i] = CCsParamList.numelt; + } + } + + // Get num MACRLC instances + + + config_getlist( &MACRLCParamList,NULL,0, NULL); + RC.nb_macrlc_inst = MACRLCParamList.numelt; + // Get num L1 instances + config_getlist( &L1ParamList,NULL,0, NULL); + RC.nb_L1_inst = L1ParamList.numelt; + + // Get num RU instances + config_getlist( &RUParamList,NULL,0, NULL); + RC.nb_RU = RUParamList.numelt; + + +} diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index aaaaf82647f..550719c8402 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -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"); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 667b70dcaf9..c884b92bedb 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -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; -- GitLab