Commit b25a592c authored by Wang Tsu-Han's avatar Wang Tsu-Han

Merge branch 'develop' into L1_renaming

Conflicts:
	common/utils/LOG/log.c
	targets/RT/USER/lte-softmodem.c
	targets/RT/USER/lte-uesoftmodem.c
parents 6aadf831 814b967c
/inet.*brd/{print "interfaceToUse="$NF"done"}
This diff is collapsed.
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<TestCaseRequestedList> <TestCaseRequestedList>
010101 010101
050101 060101 070101 040101 050101 060101 070101 040101
030100 040300 040401 040201 030201
030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201 030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201
030111 040301 040511 040613 040614 040615 040616 040617 040651 040652 040653 040654 040401 040201 030201 030111 040301 040511 040613 040614 040615 040616 040617 040651 040652 040653 040654 040401 040201 030201
030121 040301 040521 040623 040624 040625 040626 040627 040662 040661 040663 040664 040401 040201 030201 030121 040301 040521 040623 040624 040625 040626 040627 040662 040661 040663 040664 040401 040201 030201
...@@ -37,6 +38,12 @@ ...@@ -37,6 +38,12 @@
<Build_eNB_args>-w USRP -c --eNB</Build_eNB_args> <Build_eNB_args>-w USRP -c --eNB</Build_eNB_args>
</testCase> </testCase>
<testCase id="030100">
<class>Initialize_eNB</class>
<desc>Initialize eNB (FDD/Band7/5MHz) with T Tracer on</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --T_stdout 0</Initialize_eNB_args>
</testCase>
<testCase id="030101"> <testCase id="030101">
<class>Initialize_eNB</class> <class>Initialize_eNB</class>
<desc>Initialize eNB (FDD/Band7/5MHz)</desc> <desc>Initialize eNB (FDD/Band7/5MHz)</desc>
...@@ -70,6 +77,12 @@ ...@@ -70,6 +77,12 @@
<desc>Terminate UE</desc> <desc>Terminate UE</desc>
</testCase> </testCase>
<testCase id="040300">
<class>Attach_UE</class>
<desc>Attach single UE</desc>
<nbMaxUEtoAttach>1</nbMaxUEtoAttach>
</testCase>
<testCase id="040301"> <testCase id="040301">
<class>Attach_UE</class> <class>Attach_UE</class>
<desc>Attach UE</desc> <desc>Attach UE</desc>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<TestCaseRequestedList> <TestCaseRequestedList>
010101 010101
050101 060101 070101 040101 050101 060101 070101 040101
030100 040300 040401 040201 030201
030104 040301 040501 040602 040601 040603 040642 040641 040643 040401 040201 030201 030104 040301 040501 040602 040601 040603 040642 040641 040643 040401 040201 030201
030114 040301 040511 040612 040611 040613 040652 040651 040653 040401 040201 030201 030114 040301 040511 040612 040611 040613 040652 040651 040653 040401 040201 030201
050201 060201 070201 050201 060201 070201
...@@ -40,12 +41,18 @@ ...@@ -40,12 +41,18 @@
<Build_eNB_args>-w USRP -c --eNB</Build_eNB_args> <Build_eNB_args>-w USRP -c --eNB</Build_eNB_args>
</testCase> </testCase>
<testCase id="030100">
<class>Initialize_eNB</class>
<desc>Initialize eNB (TDD/Band40/5MHz) with T Tracer on</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf --T_stdout 0</Initialize_eNB_args>
</testCase>
<testCase id="030104"> <testCase id="030104">
<class>Initialize_eNB</class> <class>Initialize_eNB</class>
<desc>Initialize eNB (TDD/Band40/5MHz)</desc> <desc>Initialize eNB (TDD/Band40/5MHz)</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf</Initialize_eNB_args> <Initialize_eNB_args>-O ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf</Initialize_eNB_args>
</testCase> </testCase>
<testCase id="030114"> <testCase id="030114">
<class>Initialize_eNB</class> <class>Initialize_eNB</class>
<desc>Initialize eNB (TDD/Band40/10MHz/info)</desc> <desc>Initialize eNB (TDD/Band40/10MHz/info)</desc>
...@@ -73,6 +80,12 @@ ...@@ -73,6 +80,12 @@
<desc>Terminate UE</desc> <desc>Terminate UE</desc>
</testCase> </testCase>
<testCase id="040300">
<class>Attach_UE</class>
<desc>Attach single UE</desc>
<nbMaxUEtoAttach>1</nbMaxUEtoAttach>
</testCase>
<testCase id="040301"> <testCase id="040301">
<class>Attach_UE</class> <class>Attach_UE</class>
<desc>Attach UE</desc> <desc>Attach UE</desc>
......
...@@ -107,6 +107,28 @@ ...@@ -107,6 +107,28 @@
<desc>Reboot UE</desc> <desc>Reboot UE</desc>
</testCase> </testCase>
<!-- CAT-M UE class command references -->
<testCase id="040102">
<class>Initialize_CatM_module</class>
<desc>Initialize CAT-M Module</desc>
</testCase>
<testCase id="040202">
<class>Terminate_CatM_module</class>
<desc>Terminate CAT-M Module</desc>
</testCase>
<testCase id="040302">
<class>Attach_CatM_module</class>
<desc>Attach CAT-M Module</desc>
</testCase>
<testCase id="040402">
<class>Detach_CatM_module</class>
<desc>Detach CAT-M Module</desc>
</testCase>
<!-- EPC class command references --> <!-- EPC class command references -->
<testCase id="050101"> <testCase id="050101">
......
...@@ -630,7 +630,6 @@ add_boolean_option(ENABLE_VCD True "always true now, time measurem ...@@ -630,7 +630,6 @@ add_boolean_option(ENABLE_VCD True "always true now, time measurem
add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)") add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)")
add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???") add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???")
add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False") add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true")
add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true") add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
########################## ##########################
...@@ -1927,6 +1926,7 @@ add_executable(lte-softmodem ...@@ -1927,6 +1926,7 @@ add_executable(lte-softmodem
${OPENAIR_TARGETS}/RT/USER/lte-enb.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c
...@@ -1966,6 +1966,7 @@ add_executable(lte-softmodem-nos1 ...@@ -1966,6 +1966,7 @@ add_executable(lte-softmodem-nos1
${OPENAIR_TARGETS}/RT/USER/lte-enb.c ${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/COMMON/create_tasks.c
...@@ -2003,6 +2004,7 @@ add_executable(lte-uesoftmodem ...@@ -2003,6 +2004,7 @@ add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/rfsim.c ${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
...@@ -2041,6 +2043,7 @@ add_executable(lte-uesoftmodem-nos1 ...@@ -2041,6 +2043,7 @@ add_executable(lte-uesoftmodem-nos1
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/rfsim.c ${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
......
...@@ -651,6 +651,9 @@ function main() { ...@@ -651,6 +651,9 @@ function main() {
compilations \ compilations \
lte-simulators coding \ lte-simulators coding \
libcoding.so $dbin/libcoding.so libcoding.so $dbin/libcoding.so
# compilations \
# lte-simulators $config_libconfig_shlib \
# lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
fi fi
# Core simulators # Core simulators
......
This diff is collapsed.
This diff is collapsed.
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
*/ */
/*! \file common/config/config_load_configmodule.h /*! \file common/config/config_load_configmodule.h
* \brief: configuration module, include file to be used by the source code calling the * \brief: configuration module, include file to be used by the source code calling the
* configuration module initialization * configuration module initialization
* \author Francois TABURET * \author Francois TABURET
* \date 2017 * \date 2017
* \version 0.1 * \version 0.1
...@@ -31,12 +31,13 @@ ...@@ -31,12 +31,13 @@
* \warning * \warning
*/ */
#ifndef INCLUDE_CONFIG_LOADCONFIGMODULE_H #ifndef INCLUDE_CONFIG_LOADCONFIGMODULE_H
#define INCLUDE_CONFIG_LOADCONFIGMODULE_H #define INCLUDE_CONFIG_LOADCONFIGMODULE_H
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "common/config/config_paramdesc.h" #include "common/config/config_paramdesc.h"
#include "common/utils/T/T.h"
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2... #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 allocated in the config module #define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
...@@ -44,12 +45,14 @@ ...@@ -44,12 +45,14 @@
#define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file #define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file
#define CONFIG_CMDLINEONLY "cmdline" // use only command line options #define CONFIG_CMDLINEONLY "cmdline" // use only command line options
#define DEFAULT_CFGFILENAME "oai.conf" // default config file #define DEFAULT_CFGFILENAME "oai.conf" // default config file
/* bit position definition for the argv_info mask of the configmodule_interface_t structure */
/* rtflags bit position definitions */ #define CONFIG_CMDLINEOPT_PROCESSED (1<<0) // command line option has been processed
/* bit position definitions for the rtflags mask of the configmodule_interface_t structure*/
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing #define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages #define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages #define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages
#define CONFIG_NOABORTONCHKF (1<<3) // disable abort execution when parameter checking function fails #define CONFIG_NOCHECKUNKOPT (1<<3) // disable check unprocessed (so invalid) command line options
#define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails
#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help #define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help
#define CONFIG_HELP (1<<20) // print help message #define CONFIG_HELP (1<<20) // print help message
#define CONFIG_ABORT (1<<21) // config failed,abort execution #define CONFIG_ABORT (1<<21) // config failed,abort execution
...@@ -58,10 +61,10 @@ typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP); ...@@ -58,10 +61,10 @@ typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix); 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 int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
typedef void(*configmodule_endfunc_t)(void); typedef void(*configmodule_endfunc_t)(void);
typedef struct configmodule_interface typedef struct configmodule_interface {
{
int argc; int argc;
char **argv; char **argv;
uint32_t *argv_info;
char *cfgmode; char *cfgmode;
int num_cfgP; int num_cfgP;
char *cfgP[CONFIG_MAX_OOPT_PARAMS]; char *cfgP[CONFIG_MAX_OOPT_PARAMS];
...@@ -71,7 +74,7 @@ typedef struct configmodule_interface ...@@ -71,7 +74,7 @@ typedef struct configmodule_interface
configmodule_endfunc_t end; configmodule_endfunc_t end;
uint32_t numptrs; uint32_t numptrs;
uint32_t rtflags; uint32_t rtflags;
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS]; char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
} configmodule_interface_t; } configmodule_interface_t;
#ifdef CONFIG_LOADCONFIG_MAIN #ifdef CONFIG_LOADCONFIG_MAIN
...@@ -81,17 +84,17 @@ static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugfl ...@@ -81,17 +84,17 @@ static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugfl
debugflags can also be defined in the config_libconfig section of the config file\n \ debugflags can also be defined in the config_libconfig section of the config file\n \
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \ debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
4->print command line processing debug messages\n "; 4->print command line processing debug messages\n ";
#define CONFIG_SECTIONNAME "config" #define CONFIG_SECTIONNAME "config"
#define CONFIGPARAM_DEBUGFLAGS_IDX 0 #define CONFIGPARAM_DEBUGFLAGS_IDX 0
static paramdef_t Config_Params[] = { static paramdef_t Config_Params[] = {
/*-----------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------*/
/* config parameters for config module */ /* config parameters for config module */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------*/
{"debugflags", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0}, {"debugflags", config_helpstr, 0, uptr:NULL, defintval:0, TYPE_MASK, 0},
}; };
#else #else
...@@ -100,10 +103,11 @@ extern configmodule_interface_t *cfgptr; ...@@ -100,10 +103,11 @@ extern configmodule_interface_t *cfgptr;
#define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); } #define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); }
#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); } #define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
#define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); } #define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); }
extern configmodule_interface_t *load_configmodule(int argc, char **argv); #define CONFIG_ENABLECMDLINEONLY (1<<1)
extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
extern void end_configmodule(void); extern void end_configmodule(void);
#endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */ #endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define MAX_OPTNAME_SIZE 64 #define MAX_OPTNAME_SIZE 64
#define CONFIG_MAXOPTLENGTH 512 /* max full option length, full option name exemple: (prefix1.[<index>].prefix2.optname */
/* parameter flags definitions */ /* parameter flags definitions */
...@@ -55,83 +55,81 @@ ...@@ -55,83 +55,81 @@
#define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions #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 #define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */ /* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
#define CONFIG_MAX_NUMCHECKVAL 20 #define CONFIG_MAX_NUMCHECKVAL 20
typedef struct paramdef paramdef_t; typedef struct paramdef paramdef_t;
typedef union checkedparam { typedef union checkedparam {
struct { struct {
int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */ int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */ int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
int num_okintval; /* number of valid values in the checkingval array */ int num_okintval; /* number of valid values in the checkingval array */
} s1; } s1;
struct { struct {
int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */ int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
/* to the corresponding item in setintval array (mainly for RRC params) */ /* to the corresponding item in setintval array (mainly for RRC params) */
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */ int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */ int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
int num_okintval; /* number of valid values in the checkingval array */ int num_okintval; /* number of valid values in the checkingval array */
} s1a; } s1a;
struct { struct {
int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */ int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */ int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
} s2; } s2;
struct { struct {
int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */ int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */ char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
int num_okstrval; /* number of valid values in the checkingval array */ int num_okstrval; /* number of valid values in the checkingval array */
} s3; } s3;
struct { struct {
int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */ int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
/* to the corresponding item in setintval array (mainly for RRC params) */ /* to the corresponding item in setintval array (mainly for RRC params) */
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */ char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */ int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
int num_okstrval; /* number of valid values in the checkingval array */ int num_okstrval; /* number of valid values in the checkingval array */
} s3a; } s3a;
struct { struct {
int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */ int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
} s4; } s4;
struct { struct {
void (*checkfunc)(void) ; void (*checkfunc)(void) ;
} s5; } s5;
} checkedparam_t; } checkedparam_t;
/* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */ /* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */
/* config apis used to retrieve parameters values */ /* config apis used to retrieve parameters values */
typedef struct paramdef typedef struct paramdef {
{ char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */ char *helpstr; /* help string */
char *helpstr; /* help string */ unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */ union { /* pointer to the parameter value, completed by the config module */
union { /* pointer to the parameter value, completed by the config module */ char **strptr;
char **strptr; char **strlistptr;
char **strlistptr; uint8_t *u8ptr;
uint8_t *u8ptr; int8_t *i8ptr;
int8_t *i8ptr; uint16_t *u16ptr;
uint16_t *u16ptr; int16_t *i16ptr;
int16_t *i16ptr; uint32_t *uptr;
uint32_t *uptr; int32_t *iptr;
int32_t *iptr; uint64_t *u64ptr;
uint64_t *u64ptr; int64_t *i64ptr;
int64_t *i64ptr; double *dblptr;
double *dblptr; void *voidptr;
void *voidptr; } ;
} ; union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */ char *defstrval;
char *defstrval; char **defstrlistval;
char **defstrlistval; uint32_t defuintval;
uint32_t defuintval; int defintval;
int defintval; uint64_t defint64val;
uint64_t defint64val; int *defintarrayval;
int *defintarrayval; double defdblval;
double defdblval; } ;
} ; char type; /* parameter value type, as listed below as TYPE_XXXX macro */
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 */
int numelt; /* number of elements in a list or array parameters or max size of string value */ checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */
checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */ int *processedvalue; /* used to store integer values computed from string original value */
int *processedvalue; /* used to store integer values computed from string original value */
} paramdef_t; } paramdef_t;
#define TYPE_INT TYPE_INT32 #define TYPE_INT TYPE_INT32
...@@ -161,9 +159,9 @@ typedef struct paramdef ...@@ -161,9 +159,9 @@ typedef struct paramdef
#define ANY_IPV4ADDR_STRING "0.0.0.0" #define ANY_IPV4ADDR_STRING "0.0.0.0"
typedef struct paramlist_def { typedef struct paramlist_def {
char listname[MAX_OPTNAME_SIZE]; char listname[MAX_OPTNAME_SIZE];
paramdef_t **paramarray; paramdef_t **paramarray;
int numelt ; int numelt ;
} paramlist_def_t; } paramlist_def_t;
/* macro helpers for module users */ /* macro helpers for module users */
......
This diff is collapsed.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
/*! \file common/config/config_userapi.h /*! \file common/config/config_userapi.h
* \brief: configuration module, include file to be used by the source code calling the * \brief: configuration module, include file to be used by the source code calling the
* configuration module to access configuration parameters * configuration module to access configuration parameters
* \author Francois TABURET * \author Francois TABURET
* \date 2017 * \date 2017
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* \warning * \warning
*/ */
#ifndef INCLUDE_CONFIG_USERAPI_H #ifndef INCLUDE_CONFIG_USERAPI_H
#define INCLUDE_CONFIG_USERAPI_H #define INCLUDE_CONFIG_USERAPI_H
#include "config_load_configmodule.h" #include "config_load_configmodule.h"
#ifdef __cplusplus #ifdef __cplusplus
...@@ -48,14 +48,16 @@ extern "C" ...@@ -48,14 +48,16 @@ extern "C"
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F)) #define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
/* utility functions, to be used by configuration module and/or configuration libraries */ /* utility functions, to be used by configuration module and/or configuration libraries */
extern configmodule_interface_t *config_get_if(void); extern configmodule_interface_t *config_get_if(void);
extern char * config_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 void config_printhelp(paramdef_t *,int numparams);
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix); extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
extern void config_assign_processedint(paramdef_t *cfgoption, int val); extern void config_assign_processedint(paramdef_t *cfgoption, int val);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val); extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr); extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
/* apis to get parameters, to be used by oai modules, at configuration time */ /* apis to get/check parameters, to be used by oai modules, at configuration time */
#define CONFIG_CHECKALLSECTIONS "ALLSECTIONS"
extern int config_check_cmdlineopt(char *prefix);
extern int config_get(paramdef_t *params,int numparams, char *prefix); extern int config_get(paramdef_t *params,int numparams, char *prefix);
extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix); extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
......
The configuration module objectives are The loader objectives are
1. Allow easy parameters management in oai, helping the development of a flexible, modularized and fully configurable softmodem. 1. provides a common mechanism to prevent an executable to include code that is only used under specific configurations, without rebuilding the code
1. Use a common configuration API in all oai modules 1. Provide a common mechanism to allow to choose between different implementations of a given set of functions, without rebuilding the code
1. Allow development of alternative configuration sources without modifying the oai code. Today the only delivered configuration source is the libconfig format configuration file.
As a developer you may need to look at these sections: As a developer you may need to look at these sections:
......
### Adding console traces in oai code
#### console messages macros
```C
LOG_E(<component>,<format>,<argument>,...)
LOG_W(<component>,<format>,<argument>,...)
LOG_I(<component>,<format>,<argument>,...)
LOG_D(<component>,<format>,<argument>,...)
LOG_T(<component>,<format>,<argument>,...)
)
```
these macros are used in place of the printf C function. The additionnal ***component*** parameter identifies the functionnal module which generates the message. At run time, the message will only be printed if the configured log level for the component is greater or equal than the macro level used in the code.
| macro | level letter | level value | level name |
|:---------|:---------------|:---------------|----------------:|
| LOG_E | E | 0 | error |
| LOG_W | W | 1 | warning |
| LOG_I | I | 2 | informational |
| LOG_D | D | 3 | debug |
| LOG_T | T | 4 | trace |
component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt).
Most oai sources are including LOG macros.
#### conditional code macros
```C
LOG_DEBUGFLAG(<flag>)
```
this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md)
```C
if ( LOG_DEBUGFLAG(<flag>) {
/*
the code below is only executed if the corresponding
<flag>_debug option is set.
*/
......................
......................
}
```
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396)
#### memory dump macros
```C
LOG_DUMPFLAG(<flag>)
```
this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md). It is mainly provided to surround LOG_M macros or direct calls to `log_dump`which otherwise would be unconditionals.
```C
if ( LOG_DUMPFLAG(<flag>) {
/*
the code below is only executed if the corresponding
<flag>_dump option is set.
*/
LOG_M(.............
LOG_M(.............
log_dump(...
}
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
#### matlab format dump
```C
LOG_M(file, vector, data, len, dec, format)
```
|argument| type| description |
|:-----------|:-------|-----------------:|
| file | char* |path to the fle which will contain the dump |
|vector |char * |name of the dump, printed at the top of the dump file |
|data| void *| pointer to the memory to be dumpped |
|len | int | length of the data to be dumpped, in `dec` unit|
| dec| int | length of each data item.Interpretation depends on format|
|format| int | defines the type of data to be dumped|
This macro can be used to dump a buffer in a format that can be used for analyze via tools like matlab or octave. **It must be surrounded by LOG_DEBUGFLAG or LOG_DUMPFLAG macros, to prevent the dump to be built unconditionally.** The LOG_M macro points to the `write_file_matlab` function implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). **This function should be revisited for more understandable implementation and ease of use (format parameter ???)**
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
#### hexadecimal format dump
```C
LOG_DUMPMSG(c, f, b, s, x...)
```
dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md)
|argument| type| description |
|:-----------|:-------|-----------------:|
| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments |
|f |int |flag used to filter the dump depending on the logs configuration. flag list is defined by the LOG_MASKMAP_INIT macro in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) |
|b| void *| pointer to the memory to be dumpped |