Commit 24f8fcf3 authored by frtabu's avatar frtabu

Use common log mechanism in layer 3, mapping specific macros to common ones...

Use common log mechanism in layer 3, mapping specific macros to common ones and extending common log utilities to support specific layer3 requirements
parent 79588a49
......@@ -1382,7 +1382,6 @@ include_directories(${NFAPI_USER_DIR})
add_library(CN_UTILS
${OPENAIR3_DIR}/UTILS/conversions.c
${OPENAIR3_DIR}/UTILS/enum_string.c
${OPENAIR3_DIR}/UTILS/log.c
${OPENAIR3_DIR}/UTILS/mcc_mnc_itu.c
)
......@@ -1557,7 +1556,6 @@ set(libnas_ies_OBJS
set (libnas_utils_OBJS
${NAS_SRC}COMMON/UTIL/device.c
${NAS_SRC}COMMON/UTIL/memory.c
${NAS_SRC}COMMON/UTIL/nas_log.c
${NAS_SRC}COMMON/UTIL/nas_timer.c
${NAS_SRC}COMMON/UTIL/socket.c
${NAS_SRC}COMMON/UTIL/stty.c
......
......@@ -38,7 +38,7 @@
#include "config_userapi.h"
void parse_stringlist(paramdef_t *cfgoptions, char *val)
int parse_stringlist(paramdef_t *cfgoptions, char *val)
{
char *atoken;
char *tokctx;
......@@ -63,7 +63,7 @@ int numelt=0;
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
atoken=strtok_r(NULL, ",",&tokctx);
}
cfgoptions->numelt=numelt;
return (cfgoptions->numelt > 0);
}
int processoption(paramdef_t *cfgoptions, char *value)
......@@ -95,7 +95,7 @@ char defbool[2]="1";
break;
case TYPE_STRINGLIST:
parse_stringlist(cfgoptions,tmpval);
optisset=parse_stringlist(cfgoptions,tmpval);
break;
case TYPE_UINT32:
case TYPE_INT32:
......
......@@ -235,14 +235,13 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length,
void log_getconfig(log_t *g_log) {
char *gloglevel = NULL;
int consolelog ;
int level;
paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
paramdef_t logparams_level[MAX_LOG_PREDEF_COMPONENTS];
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
paramdef_t logparams_genfile[sizeof(log_maskmap)/sizeof(mapping)];
paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
if (ret <0) {
......@@ -296,37 +295,37 @@ void log_getconfig(log_t *g_log) {
config_get( logparams_logfile, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
/* now set the log levels and infile option, according to what we read */
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
level = map_str_to_int(log_level_names, *(logparams_level[i].strptr));
set_log(i, level);
g_log->log_component[i].level = map_str_to_int(log_level_names, *(logparams_level[i].strptr));
set_log(i, g_log->log_component[i].level);
if (*(logparams_logfile[i].uptr) == 1)
set_component_filelog(i);
}
/* build then read the debug and genfile parameter array */
/* build then read the debug and dump parameter array */
for (int i=0;log_maskmap[i].name != NULL ; i++) {
sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name);
sprintf(logparams_genfile[i].optname, LOG_CONFIG_GENFILE_FORMAT, log_maskmap[i].name);
sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name);
sprintf(logparams_dump[i].optname, LOG_CONFIG_DUMP_FORMAT, log_maskmap[i].name);
logparams_debug[i].defuintval = 0;
logparams_debug[i].type = TYPE_UINT;
logparams_debug[i].paramflags = PARAMFLAG_BOOL;
logparams_debug[i].uptr = NULL;
logparams_debug[i].chkPptr = NULL;
logparams_debug[i].numelt = 0;
logparams_genfile[i].defuintval = 0;
logparams_genfile[i].type = TYPE_UINT;
logparams_genfile[i].paramflags = PARAMFLAG_BOOL;
logparams_genfile[i].uptr = NULL;
logparams_genfile[i].chkPptr = NULL;
logparams_genfile[i].numelt = 0;
logparams_dump[i].defuintval = 0;
logparams_dump[i].type = TYPE_UINT;
logparams_dump[i].paramflags = PARAMFLAG_BOOL;
logparams_dump[i].uptr = NULL;
logparams_dump[i].chkPptr = NULL;
logparams_dump[i].numelt = 0;
}
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
config_get( logparams_genfile,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
/* set the debug mask according to the debug parameters values */
for (int i=0; log_maskmap[i].name != NULL ; i++) {
if (*(logparams_debug[i].uptr) )
g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value;
if (*(logparams_genfile[i].uptr) )
g_log->genfile_mask = g_log->genfile_mask | log_maskmap[i].value;
if (*(logparams_dump[i].uptr) )
g_log->dump_mask = g_log->dump_mask | log_maskmap[i].value;
}
/* log globally enabled/disabled */
set_glog_onlinelog(consolelog);
......@@ -349,10 +348,9 @@ int computed_compidx=compidx;
}
if (computed_compidx >= 0 && computed_compidx <MAX_LOG_COMPONENTS) {
g_log->log_component[computed_compidx].name = strdup(name);
g_log->log_component[computed_compidx].savedlevel = LOG_ERR;
g_log->log_component[computed_compidx].stream = stdout;
g_log->log_component[computed_compidx].filelog = 0;
g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/<name>.%s rounded to ^2 */
g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/<name>.%s */
sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext);
} else {
fprintf(stderr,"{LOG} %s %d Couldn't register componemt %s\n",__FILE__,__LINE__,name);
......@@ -415,19 +413,15 @@ int logInit (void)
register_log_component("SCTP","",SCTP);
register_log_component("RRH","",RRH);
register_log_component("X2AP","",X2AP);
register_log_component("LOADER","log",LOADER);
register_log_component("ASN","log",ASN);
for (int i=0 ; log_level_names[i].name != NULL ; i++)
g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name
g_log->level2string[OAILOG_ERR] = "E"; // ERROR
g_log->level2string[OAILOG_WARNING] = "W"; // WARNING
g_log->level2string[OAILOG_INFO] = "I"; //INFO
g_log->level2string[OAILOG_DEBUG] = "D"; // DEBUG
// g_log->level2string[OAILOG_FILE] = "F"; // file
g_log->level2string[OAILOG_TRACE] = "T"; // TRACE
......@@ -459,11 +453,19 @@ int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
}
}
int inline log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) {
char threadname[PR_SET_NAME];
return snprintf(log_buffer, buffsize , "%s%s[%s]%c %s %s",
log_level_highlight_end[level],
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
g_log->log_component[comp].name,
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '),
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
format);
}
void logRecord_mt(const char *file, const char *func, int line, int comp, int level, const char* format, ... )
{
char threadname[PR_SET_NAME];
char log_buffer[MAX_LOG_TOTAL];
va_list args;
......@@ -472,16 +474,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
snprintf(log_buffer, MAX_LOG_TOTAL , "%s%s[%s]%s %s %s",
log_level_highlight_end[level],
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
g_log->log_component[comp].name,
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:""),
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
format);
log_header(log_buffer,MAX_LOG_TOTAL ,comp, level,format);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
va_end(args);
......@@ -492,20 +485,23 @@ void log_dump(int component, void *buffer, int buffsize,int datatype, const char
va_list args;
char *wbuf;
switch(datatype) {
case LOG_DUMP_DOUBLE:
wbuf=malloc((buffsize * 10) + 64 );
wbuf=malloc((buffsize * 10) + 64 + MAX_LOG_TOTAL);
break;
case LOG_DUMP_CHAR:
default:
wbuf=malloc((buffsize * 3 ) + 64 );
wbuf=malloc((buffsize * 3 ) + 64 + MAX_LOG_TOTAL);
break;
}
va_start(args, format);
g_log->log_component[component].vprint(g_log->log_component[component].stream,format, args);
va_end(args);
if (wbuf != NULL) {
int pos=0;
}
if (wbuf != NULL) {
va_start(args, format);
int pos=log_header(wbuf,MAX_LOG_TOTAL ,component, OAILOG_INFO,"");
int pos2=vsprintf(wbuf+pos,format, args);
pos=pos+pos2;
va_end(args);
for (int i=0; i<buffsize; i++) {
switch(datatype) {
case LOG_DUMP_DOUBLE:
......@@ -528,12 +524,12 @@ int set_log(int component, int level)
/* Checking parameters */
DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
DevCheck((level < NUM_LOG_LEVEL) && (level >= OAILOG_ERR), level, NUM_LOG_LEVEL,
DevCheck((level < NUM_LOG_LEVEL) && (level >= OAILOG_DISABLE), level, NUM_LOG_LEVEL,
OAILOG_ERR);
if ( g_log->log_component[component].level != OAILOG_DISABLE )
g_log->log_component[component].savedlevel = g_log->log_component[component].level;
g_log->log_component[component].level = level;
g_log->log_component[component].savedlevel = level;
return 0;
}
......@@ -557,7 +553,7 @@ void set_glog_onlinelog(int enable)
g_log->log_component[c].print = fprintf;
g_log->log_component[c].stream = stdout;
} else {
g_log->log_component[c].level = -1;
g_log->log_component[c].level = OAILOG_DISABLE;
}
}
}
......
......@@ -81,14 +81,14 @@ extern "C" {
* @ingroup _macro
* @brief LOG defines 9 levels of messages for users. Importance of these levels decrease gradually from 0 to 8
* @{*/
# define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" fuctinalities */
# define OAILOG_WARNING 1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
# define OAILOG_INFO 2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
# define OAILOG_DEBUG 3 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
# define OAILOG_TRACE 4 /*!< \brief second level debug-level messages, for developers ,likely impact real-time behavior*/
#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG */
# define OAILOG_DISABLE -1 /*!< \brief disable all LOG messages, cannot be used in LOG macros, use only in LOG module */
# define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" fuctinalities */
# define OAILOG_WARNING 1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
# define OAILOG_INFO 2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
# define OAILOG_DEBUG 3 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
# define OAILOG_TRACE 4 /*!< \brief second level debug-level messages, for developers ,likely impact real-time behavior*/
#define NUM_LOG_LEVEL 5 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/
/* @}*/
......@@ -142,21 +142,27 @@ extern "C" {
#define DEBUG_RRC (1<<6)
#define DEBUG_PDCP (1<<7)
#define DEBUG_DFT (1<<8)
#define DEBUG_ASN1 (1<<9)
#define DEBUG_CTRLSOCKET (1<<10)
#define DEBUG_SECURITY (1<<11)
#define DEBUG_NAS (1<<12)
#define UE_TIMING (1<<20)
#define LOG_MASKMAP_INIT {\
{"PRACH", DEBUG_PRACH},\
{"RU", DEBUG_RU},\
{"LTEESTIM", DEBUG_LTEESTIM},\
{"CTRLSOCKET", DEBUG_CTRLSOCKET},\
{"UE_PHYPROC", DEBUG_UE_PHYPROC},\
{"LTEESTIM", DEBUG_LTEESTIM},\
{"DLCELLSPEC", DEBUG_DLCELLSPEC},\
{"ULSCH", DEBUG_ULSCH},\
{"RRC", DEBUG_RRC},\
{"PDCP", DEBUG_PDCP},\
{"DFT", DEBUG_DFT},\
{"ASN1", DEBUG_ASN1},\
{"CTRLSOCKET", DEBUG_CTRLSOCKET},\
{"SECURITY", DEBUG_SECURITY},\
{"NAS", DEBUG_NAS},\
{"UE_TIMING", UE_TIMING},\
{NULL,-1}\
}
......@@ -166,8 +172,8 @@ extern "C" {
#define SET_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask | B)
#define CLEAR_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask & (~B))
#define SET_LOG_DUMP(B) g_log->genfile_mask = (g_log->genfile_mask | B)
#define CLEAR_LOG_DUMP(B) g_log->genfile_mask = (g_log->genfile_mask & (~B))
#define SET_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask | B)
#define CLEAR_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask & (~B))
......@@ -208,9 +214,9 @@ typedef enum {
TMR,
USIM,
LOCALIZE,
RRH,
X2AP,
LOADER,
ASN,
MAX_LOG_PREDEF_COMPONENTS,
}
comp_name_t;
......@@ -243,11 +249,11 @@ typedef struct {
typedef struct {
log_component_t log_component[MAX_LOG_COMPONENTS];
char* level2string[NUM_LOG_LEVEL];
char level2string[NUM_LOG_LEVEL];
int flag;
char* filelog_name;
uint64_t debug_mask;
uint64_t genfile_mask;
uint64_t dump_mask;
} log_t;
......@@ -318,7 +324,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_CONFIG_LEVEL_FORMAT "%s_log_level"
#define LOG_CONFIG_LOGFILE_FORMAT "%s_log_infile"
#define LOG_CONFIG_DEBUG_FORMAT "%s_debug"
#define LOG_CONFIG_GENFILE_FORMAT "%s_genfile"
#define LOG_CONFIG_DUMP_FORMAT "%s_dump"
#define LOG_CONFIG_HELP_OPTIONS " list of comma separated options to enable log module behavior. Available options: \n"\
" nocolor: disable color usage in log messages\n"\
......@@ -356,13 +362,13 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->genfile_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0) /* */
/* bitmask dependant macros, to isolate debugging code */
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
/* bitmask dependant macros, to generate debug file such as matlab file or message dump */
# define LOG_GENFILEFLAG(D) (g_log->genfile_mask & D)
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
/* define variable only used in LOG macro's */
# define LOG_VAR(A,B) A B
......@@ -376,12 +382,13 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_DUMPMSG(c, b, s, x...) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
# define LOG_DEBUGFLAG(D) ( 0 )
# define LOG_GENFILEFLAG(D) ( 0 )
# define LOG_DUMPFLAG(D) ( 0 )
# define LOG_M(file, vector, data, len, dec, format)
# define LOG_VAR(A,B)
# endif /* T_TRACER */
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
#define LOG_USEDINLOG_VAR(A,B) __attribute__((unused)) A B
#define GCC_NOTUSED __attribute__((unused))
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
/* unfiltered macros, usefull for simulators or messages at init time, before log is configured */
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
......@@ -394,9 +401,12 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
* @ingroup _macro
* @brief Macro of some useful functions defined by LOG
* @{*/
#define LOG_ENTER(c) do {LOG_T(c, "Entering\n");}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
#define LOG_EXIT(c) do {LOG_T(c,"Exiting\n"); return;}while(0) /*!< \brief Macro to log a message with severity TRACE when exiting a function */
#define LOG_RETURN(c,x) do {uint32_t __rv;__rv=(unsigned int)(x);LOG_T(c,"Returning %08x\n", __rv);return((typeof(x))__rv);}while(0) /*!< \brief Macro to log a function exit, including integer value, then to return a value to the calling function */
#define LOG_ENTER(c) do {LOG_T(c, "Entering %s\n",__FUNCTION__);}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
#define LOG_END(c) do {LOG_T(c, "End of %s\n",__FUNCTION__);}while(0) /*!< \brief Macro to log a message with severity DEBUG when entering a function */
#define LOG_EXIT(c) do { LOG_END(c); return;}while(0) /*!< \brief Macro to log a message with severity TRACE when exiting a function */
#define LOG_RETURN(c,r) do {LOG_T(c,"Leaving %s (rc = %08lx)\n", __FUNCTION__ , (unsigned long)(r) );return(r);}while(0) /*!< \brief Macro to log a function exit, including integer value, then to return a value to the calling function */
/* @}*/
static __inline__ uint64_t rdtsc(void) {
......
......@@ -750,6 +750,27 @@ ID = LEGACY_OSA_TRACE
GROUP = ALL:LEGACY_OSA:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_ASN_INFO
DESC = ASN legacy logs - info level
GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_ASN_ERROR
DESC = ASN legacy logs - error level
GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_ASN_WARNING
DESC = ASN legacy logs - warning level
GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_ASN_DEBUG
DESC = ASN legacy logs - debug level
GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_ASN_TRACE
DESC = ASN legacy logs - trace level
GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_SIM_INFO
DESC = SIM legacy logs - info level
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_INFO:LEGACY
......
......@@ -39,7 +39,7 @@
#include "assertions.h"
#include "signals.h"
#include "log.h"
#include "common/utils/LOG/log.h"
#if defined (LOG_D) && defined (LOG_E)
# define SIG_DEBUG(x, args...) LOG_D(RRC, x, ##args)
......
......@@ -32,7 +32,7 @@
#include "assertions.h"
#include "intertask_interface.h"
#include "timer.h"
#include "log.h"
#include "common/utils/LOG/log.h"
#include "queue.h"
#if defined (LOG_D) && defined (LOG_E)
......
......@@ -221,7 +221,7 @@ int proccmd_show(char *buf, int debug, telnet_printfunc_t prnt)
for (int i=0; log_maskmap[i].name != NULL ; i++) {
prnt("%02i %17.17s %5.5s %5.5s\n",i ,log_maskmap[i].name,
((g_log->debug_mask & log_maskmap[i].value)?"Y":"N"),
((g_log->genfile_mask & log_maskmap[i].value)?"Y":"N") );
((g_log->dump_mask & log_maskmap[i].value)?"Y":"N") );
}
}
if (strcasestr(buf,"config") != NULL) {
......@@ -343,7 +343,7 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
for (int i=0; log_options[i].name != NULL; i++)
prnt("%s ",log_options[i].name);
prnt("\n\n");
prnt("Available debug or genfile options: \n ");
prnt("Available debug and dump options: \n ");
for (int i=0; log_maskmap[i].name != NULL; i++)
prnt("%s ",log_maskmap[i].name);
prnt("\n\n");
......@@ -402,31 +402,36 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
if (logparam != NULL) free(logparam);
if (opt != NULL) free(opt);
} else if ( s == 3 && logsubcmd != NULL) {
int level, enable, filelog;
int level, enable,filelog;
char *tmpstr=NULL;
char *logparam=NULL;
int l;
level = enable = filelog = -1;
level = OAILOG_DISABLE - 1;
filelog = -1;
enable=-1;
l=sscanf(logsubcmd,"%m[^'_']_%m[^'_']",&logparam,&tmpstr);
if (debug > 0)
prnt("l=%i, %s %s\n",l,((logparam==NULL)?"\"\"":logparam), ((tmpstr==NULL)?"\"\"":tmpstr));
if (l ==2 ) {
if (strcmp(logparam,"level") == 0) {
level=map_str_to_int(log_level_names,tmpstr);
if (level < 0) prnt("level %s unknown\n",tmpstr);
if (level < 0) {
prnt("level %s unknown\n",tmpstr);
level=OAILOG_DISABLE - 1;
}
} else {
prnt("%s%s unknown log sub command \n",logparam, tmpstr);
}
} else if (l ==1 ) {
if (strcmp(logparam,"enable") == 0) {
enable = 1;
enable=1;
} else if (strcmp(logparam,"disable") == 0) {
enable = 0;
level=OAILOG_DISABLE;
} else if (strcmp(logparam,"file") == 0) {
filelog = 1 ;
filelog = 1 ;
} else if (strcmp(logparam,"nofile") == 0) {
filelog = 0 ;
filelog = 0 ;
} else {
prnt("%s%s unknown log sub command \n",logparam, tmpstr);
}
......@@ -436,27 +441,18 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
if (logparam != NULL) free(logparam);
if (tmpstr != NULL) free(tmpstr);
for (int i=idx1; i<=idx2 ; i++) {
if ( level >= 0 || enable >= 0) {
if (level < 0) {
level=g_log->log_component[i].level;
}
if (enable < 0) {
level= -1;
}
set_log(i, level);
}
if ( filelog == 1 ) {
if (level >= OAILOG_DISABLE)
set_log(i, level);
else if ( enable == 1)
set_log(i,g_log->log_component[i].savedlevel);
else if ( filelog == 1 ) {
set_component_filelog(i);
}
if ( filelog == 0 ) {
} else if ( filelog == 0 ) {
close_component_filelog(i);
}
prnt("log level comp %i %s set to %s (%s) output: %s\n",
i,((g_log->log_component[i].name==NULL)?"":g_log->log_component[i].name),
map_int_to_str(log_level_names,g_log->log_component[i].level),
((g_log->log_component[i].level>=0)?"enabled":"disabled"),
((g_log->log_component[i].filelog>0)?g_log->log_component[i].filelog_name:"stdout"));
}
}
proccmd_show("loglvl",debug,prnt);
} else {
prnt("%s: wrong log command...\n",buf);
}
......
......@@ -20,7 +20,7 @@
*/
#include "phy_init.h"
#include "log.h"
#include "common/utils/LOG/log.h"
uint16_t dl_S_table_normal[10]={3,9,10,11,12,3,9,10,11,6};
uint16_t dl_S_table_extended[10]={3,8,9,10,3,8,9,5,0,0};
......
......@@ -274,7 +274,7 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
if ( LOG_GENFILEFLAG(DEBUG_LTEESTIM)){
if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){
LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
......@@ -460,7 +460,7 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2);
if ( LOG_GENFILEFLAG(DEBUG_LTEESTIM)){
if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){
static int debug_cnt;
if (debug_cnt == 0) {
LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2);
......
......@@ -23,7 +23,7 @@
#include "PHY/defs_UE.h"
#include "PHY/phy_extern_ue.h"
#include "log.h"
#include "common/utils/LOG/log.h"
#include "PHY/sse_intrin.h"
//#define k1 1000
......
......@@ -36,7 +36,7 @@
#include "lte_refsig.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "log.h"
#include "common/utils/LOG/log.h"
#include "PHY/impl_defs_top.h"
//extern unsigned int lte_gold_table[3][20][2][14];
......
......@@ -202,7 +202,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
// DJP - indexing below in subframe zero takes us off the beginning of the array???
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset];
if (LOG_GENFILEFLAG(PRACH)){
if (LOG_DUMPFLAG(PRACH)){
int32_t en0=signal_energy((int32_t*)prach[aa],fp->samples_per_tti);
int8_t dbEn0 = dB_fixed(en0);
int8_t rach_dBm = dbEn0 - ru->rx_total_gain_dB;
......@@ -585,7 +585,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
}
memset(prachF, 0, sizeof(int16_t)*2*1024 );
if (LOG_GENFILEFLAG(PRACH)) {
if (LOG_DUMPFLAG(PRACH)) {
if (prach[0]!= NULL) LOG_M("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
LOG_M("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1);
......@@ -619,7 +619,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
}
if (LOG_GENFILEFLAG(PRACH)) {
if (LOG_DUMPFLAG(PRACH)) {
if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
}
......@@ -662,7 +662,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
}
}// preamble_index
if (LOG_GENFILEFLAG(PRACH)) {
if (LOG_DUMPFLAG(PRACH)) {
int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
if (en>60) {
k = (12*n_ra_prb) - 6*fp->N_RB_UL;
......@@ -689,7 +689,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
}
}
} /* LOG_GENFILEFLAG(PRACH) */
} /* LOG_DUMPFLAG(PRACH) */
if (eNB) stop_meas(&eNB->rx_prach);
}
......
......@@ -2035,7 +2035,7 @@ static inline void transpose4_ooff(int16x4_t *x,int16x4_t *y,int off)
#endif
// 16-point optimized DEBUG_DFT kernel
// 16-point optimized DFT kernel
const static int16_t tw16[24] __attribute__((aligned(32))) = { 32767,0,30272,-12540,23169 ,-23170,12539 ,-30273,
32767,0,23169,-23170,0 ,-32767,-23170,-23170,
......@@ -3097,7 +3097,7 @@ void dft128(int16_t *x,int16_t *y,int scale)
dft64((int16_t*)(xtmp),(int16_t*)ytmp,1);
dft64((int16_t*)(xtmp+32),(int16_t*)(ytmp+16),1);
if (LOG_GENFILEFLAG(DEBUG_DFT)) {
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("dft128a.m","dfta",ytmp,64,1,1);
LOG_M("dft128b.m","dftb",ytmp+16,64,1,1);*/
}
......@@ -3149,7 +3149,7 @@ void dft128(int16_t *x,int16_t *y,int scale)
}
if (LOG_GENFILEFLAG(DEBUG_DFT)) {
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("dft128out.m","dft128",y,128,1,1);
exit(-1);
}
......@@ -3177,14 +3177,14 @@ void dft128(int16_t *x,int16_t *y,int scale)
transpose4_ooff_simd256(x256+10,xtmp+5,8);
transpose4_ooff_simd256(x256+12,xtmp+6,8);
transpose4_ooff_simd256(x256+14,xtmp+7,8);
if (LOG_GENFILEFLAG(DEBUG_DFT)) {
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("dft128ina_256.m","dftina",xtmp,64,1,1);
LOG_M("dft128inb_256.m","dftinb",xtmp+8,64,1,1);
}
dft64((int16_t*)(xtmp),(int16_t*)ytmp,1);
dft64((int16_t*)(xtmp+8),(int16_t*)(ytmp+8),1);
if (LOG_GENFILEFLAG(DEBUG_DFT)) {
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("dft128outa_256.m","dftouta",ytmp,64,1,1);
LOG_M("dft128outb_256.m","dftoutb",ytmp+8,64,1,1);
}
......@@ -3220,7 +3220,7 @@ void dft128(int16_t *x,int16_t *y,int scale)
y256[15] = mulhi_int16_simd256(y256[15],ONE_OVER_SQRT2_Q15_256);
}
if (LOG_GENFILEFLAG(DEBUG_DFT)) {
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("dft128.m","dft",y256,128,1,1);
exit(-1);
}
......@@ -5424,7 +5424,7 @@ void dft1536(int16_t *input, int16_t *output, int scale)
tmpo[1][i] = tmpo[1][i<<1];
tmpo[2][i] = tmpo[2][i<<1];
}*/
if (LOG_GENFILEFLAG(DEBUG_DFT)) {
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("dft1536out0.m","o0",tmpo[0],2048,1,1);
LOG_M("dft1536out1.m","o1",tmpo[1],2048,1,1);
LOG_M("dft1536out2.m","o2",tmpo[2],2048,1,1);
......@@ -5588,7 +5588,7 @@ void idft6144(int16_t *input, int16_t *output,int scale)
idft2048((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1);
idft2048((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1);
if (LOG_GENFILEFLAG(DEBUG_DFT)) {
if (LOG_DUMPFLAG(DEBUG_DFT)) {
LOG_M("idft6144in.m","in",input,6144,1,1);
LOG_M("idft6144out0.m","o0",tmpo[0],2048,1,1);
LOG_M("idft6144out1.m","o1",tmpo[1],2048,1,1);
......@@ -5624,9 +5624,6 @@ void idft6144(int16_t *input, int16_t *output,int scale)
}
}
if (LOG_GENFILEFLAG(DEBUG_DFT)) {
LOG_M("idft6144out.m","out",output,6144,1,1);
}
_mm_empty();
_m_empty();
......@@ -5657,7 +5654,7 @@ void dft6144(int16_t *input, int16_t *output,int scale)
tmpo[1][i] = tmpo[1][i<<1];
tmpo[2][i] = tmpo[2][i<<1];
}*/