log.c simplification, fix usefull functionality which never worked, move all log code from openair2 to common
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
VCD Plugin v0.1
|
||||
|
||||
The VCD plugin outputs signals to a .vcd file which is readable by gtkwave (http://en.wikipedia.org/wiki/GTKWave).
|
||||
Signals may have two types:
|
||||
- Variables to dump the state of a variable (range 0..2^64 - 1).
|
||||
- Functions to log function usage (implies two call to VCD API: IN and OUT)
|
||||
|
||||
This module is always built in, but is only used when -V oaisim option is added.
|
||||
The VCD file generated is called openair_vcd_dump.vcd and is located in the execution folder.
|
||||
|
||||
Usage:
|
||||
1) To dump function usage:
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(FUNCTION_NAME, VCD_FUNCTION_IN); at start of function
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(FUNCTION_NAME, VCD_FUNCTION_OUT); at end of function
|
||||
FUNCTION_NAME should be defined in the enum in vcd_signal_dumper.h and the function name should be addded at the right place in the vcd_signal_dumper.c file.
|
||||
|
||||
2) To dump a variable:
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VARIABLE_NAME, value); where VARIABLE_NAME is defined as described above for functions and value is the state of the variable at log time.
|
||||
|
||||
TODO list:
|
||||
- Add support for signed variables
|
||||
- Create more than two module (for now: one for variable, one for functions)
|
||||
- Integrate date in filename
|
||||
- Use a more accurate clock (if necessary) or use a host specific clock (for other systems than Linux)
|
||||
|
||||
Useful link:
|
||||
http://www.beyondttl.com/vcd.php
|
||||
@@ -0,0 +1,699 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file log.c
|
||||
* \brief log implementaion
|
||||
* \author Navid Nikaein
|
||||
* \date 2009 - 2014
|
||||
* \version 0.5
|
||||
* @ingroup util
|
||||
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE /* required for pthread_getname_np */
|
||||
//#define LOG_TEST 1
|
||||
|
||||
#define COMPONENT_LOG
|
||||
#define COMPONENT_LOG_IF
|
||||
#include <ctype.h>
|
||||
#define LOG_MAIN
|
||||
#include "log.h"
|
||||
#include "vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
# include <pthread.h>
|
||||
# include <string.h>
|
||||
#include <linux/prctl.h>
|
||||
#include "common/config/config_userapi.h"
|
||||
// main log variables
|
||||
|
||||
|
||||
|
||||
|
||||
mapping log_level_names[] = {
|
||||
{"error", OAILOG_ERR},
|
||||
{"file", OAILOG_FILE},
|
||||
{"warn", OAILOG_WARNING},
|
||||
{"info", OAILOG_INFO},
|
||||
{"debug", OAILOG_DEBUG},
|
||||
{"trace", OAILOG_TRACE},
|
||||
{NULL, -1}
|
||||
};
|
||||
|
||||
mapping log_options[] = {
|
||||
{"nocolor", FLAG_NOCOLOR },
|
||||
{"level", FLAG_LEVEL },
|
||||
{"thread", FLAG_THREAD },
|
||||
{NULL,-1}
|
||||
};
|
||||
|
||||
|
||||
mapping log_maskmap[] = {
|
||||
{"prach", DEBUG_PRACH},
|
||||
{"RU", DEBUG_RU},
|
||||
{NULL,-1}
|
||||
};
|
||||
|
||||
char *log_level_highlight_start[] = {LOG_RED, LOG_GREEN, LOG_ORANGE, "", LOG_BLUE, LOG_CYBL}; /*!< \brief Optional start-format strings for highlighting */
|
||||
char *log_level_highlight_end[] = {LOG_RESET,LOG_RESET,LOG_RESET,LOG_RESET, LOG_RESET,LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */
|
||||
|
||||
|
||||
int write_file_matlab(const char *fname,const char *vname,void *data,int length,int dec,char format)
|
||||
{
|
||||
|
||||
FILE *fp=NULL;
|
||||
int i;
|
||||
|
||||
if (data == NULL)
|
||||
return -1;
|
||||
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
|
||||
|
||||
|
||||
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
|
||||
fp = fopen(fname,"a+");
|
||||
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
|
||||
fp = fopen(fname,"w+");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (fp== NULL) {
|
||||
printf("[OPENAIR][FILE OUTPUT] Cannot open file %s\n",fname);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
|
||||
fprintf(fp,"%s = [",vname);
|
||||
|
||||
|
||||
switch (format) {
|
||||
case 0: // real 16-bit
|
||||
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((short *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 1: // complex 16-bit
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((short *)data)[i],((short *)data)[i+1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 2: // real 32-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((int *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3: // complex 32-bit
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((int *)data)[i],((int *)data)[i+1]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4: // real 8-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((char *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5: // complex 8-bit
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
fprintf(fp,"%d + j*(%d)\n",((char *)data)[i],((char *)data)[i+1]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6: // real 64-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%lld\n",((long long*)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 7: // real double
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%g\n",((double *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 8: // complex double
|
||||
for (i=0; i<length<<1; i+=2*dec) {
|
||||
fprintf(fp,"%g + j*(%g)\n",((double *)data)[i], ((double *)data)[i+1]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 9: // real unsigned 8-bit
|
||||
for (i=0; i<length; i+=dec) {
|
||||
fprintf(fp,"%d\n",((unsigned char *)data)[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 10 : // case eren 16 bit complex :
|
||||
|
||||
for (i=0; i<length<<1; i+=(2*dec)) {
|
||||
|
||||
if((i < 2*(length-1)) && (i > 0))
|
||||
fprintf(fp,"%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]);
|
||||
else if (i == 2*(length-1))
|
||||
fprintf(fp,"%d + j*(%d);",((short *)data)[i],((short *)data)[i+1]);
|
||||
else if (i == 0)
|
||||
fprintf(fp,"\n%d + j*(%d),",((short *)data)[i],((short *)data)[i+1]);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 11 : //case eren 16 bit real for channel magnitudes:
|
||||
for (i=0; i<length; i+=dec) {
|
||||
|
||||
if((i <(length-1))&& (i > 0))
|
||||
fprintf(fp,"%d,",((short *)data)[i]);
|
||||
else if (i == (length-1))
|
||||
fprintf(fp,"%d;",((short *)data)[i]);
|
||||
else if (i == 0)
|
||||
fprintf(fp,"\n%d,",((short *)data)[i]);
|
||||
}
|
||||
|
||||
printf("\n eren: length :%d",length);
|
||||
break;
|
||||
|
||||
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
||||
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
|
||||
fprintf(fp,"];\n");
|
||||
fclose(fp);
|
||||
return(0);
|
||||
} else if (format == 10 || format ==11 || format == 12 || format == 13 || format == 15) {
|
||||
fclose(fp);
|
||||
return(0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get log parameters from configuration file */
|
||||
void log_getconfig(log_t *g_log) {
|
||||
char *gloglevel = NULL;
|
||||
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_matlab[sizeof(log_maskmap)/sizeof(mapping)];
|
||||
|
||||
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
|
||||
if (ret <0) {
|
||||
fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed");
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i=0; i<logparams_defaults[LOG_OPTIONS_IDX].numelt ; i++) {
|
||||
for(int j=0; log_options[j].name != NULL ; j++) {
|
||||
if (strcmp(logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i],log_options[j].name) == 0) {
|
||||
g_log->flag = g_log->flag | log_options[j].value;
|
||||
break;
|
||||
} else if (log_options[j+1].name == NULL){
|
||||
fprintf(stderr,"Unknown log option: %s\n",logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i]);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* build the parameter array for setting per component log level and infile options */
|
||||
memset(logparams_level, 0, sizeof(paramdef_t)*MAX_LOG_PREDEF_COMPONENTS);
|
||||
memset(logparams_logfile, 0, sizeof(paramdef_t)*MAX_LOG_PREDEF_COMPONENTS);
|
||||
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
|
||||
if(g_log->log_component[i].name == NULL) {
|
||||
g_log->log_component[i].name = malloc(16);
|
||||
sprintf((char *)g_log->log_component[i].name,"comp%i?",i);
|
||||
logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
logparams_level[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
}
|
||||
sprintf(logparams_level[i].optname, LOG_CONFIG_LEVEL_FORMAT, g_log->log_component[i].name);
|
||||
sprintf(logparams_logfile[i].optname, LOG_CONFIG_LOGFILE_FORMAT, g_log->log_component[i].name);
|
||||
/* workaround: all log options in existing configuration files use lower case component names
|
||||
where component names include uppercase char in log.h.... */
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_level[i].optname[j] = tolower(logparams_level[i].optname[j]);
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_logfile[i].optname[j] = tolower(logparams_logfile[i].optname[j]);
|
||||
/* */
|
||||
logparams_level[i].defstrval = gloglevel;
|
||||
logparams_logfile[i].defuintval = 0;
|
||||
logparams_logfile[i].numelt = 0;
|
||||
logparams_level[i].numelt = 0;
|
||||
logparams_level[i].type = TYPE_STRING;
|
||||
logparams_logfile[i].type = TYPE_UINT;
|
||||
|
||||
logparams_logfile[i].paramflags = logparams_logfile[i].paramflags|PARAMFLAG_BOOL;
|
||||
}
|
||||
/* read the per component parameters */
|
||||
config_get( logparams_level, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
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,1);
|
||||
if (*(logparams_logfile[i].uptr) == 1)
|
||||
set_component_filelog(i);
|
||||
}
|
||||
|
||||
/* build then read the debug and matlab 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_matlab[i].optname, LOG_CONFIG_MATLAB_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].numelt = 0;
|
||||
logparams_matlab[i].defuintval = 0;
|
||||
logparams_matlab[i].type = TYPE_UINT;
|
||||
logparams_matlab[i].paramflags = PARAMFLAG_BOOL;
|
||||
logparams_matlab[i].numelt = 0;
|
||||
}
|
||||
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get( logparams_matlab,(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_matlab[i].uptr) )
|
||||
g_log->matlab_mask = g_log->matlab_mask | log_maskmap[i].value;
|
||||
}
|
||||
}
|
||||
|
||||
int register_log_component(char *name, char *fext, int compidx)
|
||||
{
|
||||
int computed_compidx=compidx;
|
||||
|
||||
if (strlen(fext) > 3) {
|
||||
fext[3]=0; /* limit log file extension to 3 chars */
|
||||
}
|
||||
if (compidx < 0) { /* this is not a pre-defined component */
|
||||
for (int i = MAX_LOG_PREDEF_COMPONENTS; i< MAX_LOG_COMPONENTS; i++) {
|
||||
if (g_log->log_component[i].name == NULL) {
|
||||
computed_compidx=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (computed_compidx >= 0 && computed_compidx <MAX_LOG_COMPONENTS) {
|
||||
g_log->log_component[computed_compidx].name = strdup(name);
|
||||
g_log->log_component[computed_compidx].level = LOG_ERR;
|
||||
g_log->log_component[computed_compidx].interval = 1;
|
||||
g_log->log_component[computed_compidx].stream = NULL;
|
||||
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 */
|
||||
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);
|
||||
}
|
||||
return computed_compidx;
|
||||
}
|
||||
|
||||
int logInit (void)
|
||||
{
|
||||
int i;
|
||||
g_log = calloc(1, sizeof(log_t));
|
||||
|
||||
if (g_log == NULL) {
|
||||
perror ("cannot allocated memory for log generation module \n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
memset(g_log,0,sizeof(log_t));
|
||||
|
||||
|
||||
|
||||
register_log_component("PHY","log",PHY);
|
||||
register_log_component("MAC","log",MAC);
|
||||
register_log_component("OPT","log",OPT);
|
||||
register_log_component("RLC","log",RLC);
|
||||
register_log_component("PDCP","log",PDCP);
|
||||
register_log_component("RRC","log",RRC);
|
||||
register_log_component("EMU","log",EMU);
|
||||
register_log_component("OMG","csv",OMG);
|
||||
register_log_component("OTG","log",OTG);
|
||||
register_log_component("OTG_LATENCY","dat",OTG_LATENCY);
|
||||
register_log_component("OTG_LATENCY_BG","dat",OTG_LATENCY_BG);
|
||||
register_log_component("OTG_GP","dat",OTG_GP);
|
||||
register_log_component("OTG_GP_BG","dat",OTG_GP_BG);
|
||||
register_log_component("OTG_JITTER","dat",OTG_JITTER);
|
||||
register_log_component("OCG","",OCG);
|
||||
register_log_component("PERF","",PERF);
|
||||
register_log_component("OIP","",OIP);
|
||||
register_log_component("CLI","",CLI);
|
||||
register_log_component("MSC","log",MSC);
|
||||
register_log_component("OCM","log",OCM);
|
||||
register_log_component("HW","",HW);
|
||||
register_log_component("OSA","",OSA);
|
||||
register_log_component("eRAL","",RAL_ENB);
|
||||
register_log_component("mRAL","",RAL_UE);
|
||||
register_log_component("ENB_APP","log",ENB_APP);
|
||||
register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT);
|
||||
register_log_component("TMR","",TMR);
|
||||
register_log_component("USIM","txt",USIM);
|
||||
|
||||
|
||||
/* following log component are used for the localization*/
|
||||
register_log_component("LOCALIZE","log",LOCALIZE);
|
||||
register_log_component("NAS","log",NAS);
|
||||
register_log_component("UDP","",UDP_);
|
||||
|
||||
|
||||
register_log_component("GTPV1U","",GTPU);
|
||||
|
||||
|
||||
register_log_component("S1AP","",S1AP);
|
||||
|
||||
|
||||
register_log_component("SCTP","",SCTP);
|
||||
register_log_component("RRH","",RRH);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
g_log->onlinelog = 1; //online log file
|
||||
g_log->filelog = 0;
|
||||
|
||||
|
||||
|
||||
g_log->filelog_name = "/tmp/openair.log";
|
||||
|
||||
log_getconfig(g_log);
|
||||
|
||||
|
||||
// could put a loop here to check for all comps
|
||||
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
if (g_log->log_component[i].filelog == 1 ) {
|
||||
g_log->log_component[i].stream = fopen(g_log->log_component[i].filelog_name,"w");
|
||||
g_log->log_component[i].fwrite = vfprintf;
|
||||
} else if (g_log->log_component[i].filelog == 1 ) {
|
||||
g_log->log_component[i].stream = fopen(g_log->filelog_name,"w");
|
||||
g_log->log_component[i].fwrite = vfprintf;
|
||||
} else if (g_log->onlinelog == 1 ) {
|
||||
g_log->log_component[i].stream = stdout;
|
||||
g_log->log_component[i].fwrite = vfprintf;
|
||||
}
|
||||
}
|
||||
|
||||
// set all unused component items to 0, they are for non predefined components
|
||||
for (i=MAX_LOG_PREDEF_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
memset(&(g_log->log_component[i]),0,sizeof(log_component_t));
|
||||
}
|
||||
printf("log init done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
char *log_getthreadname(char *threadname) {
|
||||
|
||||
if (pthread_getname_np(pthread_self(), threadname, sizeof(threadname)) != 0)
|
||||
{
|
||||
return "thread?";
|
||||
} else {
|
||||
return threadname;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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):""),
|
||||
format);
|
||||
|
||||
g_log->log_component[comp].fwrite(g_log->log_component[comp].stream,log_buffer, args);
|
||||
va_end(args);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int set_log(int component, int level, int interval)
|
||||
{
|
||||
/* 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,
|
||||
OAILOG_ERR);
|
||||
DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
|
||||
|
||||
g_log->log_component[component].level = level;
|
||||
|
||||
|
||||
g_log->log_component[component].interval = interval;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void set_glog(int level)
|
||||
{
|
||||
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
|
||||
g_log->log_component[c].level = level;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void set_glog_onlinelog(int enable)
|
||||
{
|
||||
g_log->onlinelog = enable;
|
||||
}
|
||||
void set_glog_filelog(int enable)
|
||||
{
|
||||
g_log->filelog = enable;
|
||||
}
|
||||
|
||||
void set_component_filelog(int comp)
|
||||
{
|
||||
if (g_log->log_component[comp].filelog == 0) {
|
||||
g_log->log_component[comp].filelog = 1;
|
||||
|
||||
if (g_log->log_component[comp].stream == NULL) {
|
||||
g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* for the two functions below, the passed array must have a final entry
|
||||
* with string value NULL
|
||||
*/
|
||||
/* map a string to an int. Takes a mapping array and a string as arg */
|
||||
int map_str_to_int(mapping *map, const char *str)
|
||||
{
|
||||
while (1) {
|
||||
if (map->name == NULL) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (!strcmp(map->name, str)) {
|
||||
return(map->value);
|
||||
}
|
||||
|
||||
map++;
|
||||
}
|
||||
}
|
||||
|
||||
/* map an int to a string. Takes a mapping array and a value */
|
||||
char *map_int_to_str(mapping *map, int val)
|
||||
{
|
||||
while (1) {
|
||||
if (map->name == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (map->value == val) {
|
||||
return map->name;
|
||||
}
|
||||
|
||||
map++;
|
||||
}
|
||||
}
|
||||
|
||||
int is_newline( char *str, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < size; i++ ) {
|
||||
if ( str[i] == '\n' ) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we get all the way to here, there must not have been a newline! */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void logClean (void)
|
||||
{
|
||||
int i;
|
||||
LOG_I(PHY,"\n");
|
||||
|
||||
|
||||
|
||||
|
||||
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
if (g_log->log_component[i].stream != NULL) {
|
||||
fclose(g_log->log_component[i].stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef LOG_TEST
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
logInit();
|
||||
|
||||
|
||||
test_log();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int test_log(void)
|
||||
{
|
||||
LOG_ENTER(MAC); // because the default level is DEBUG
|
||||
LOG_I(EMU, "1 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "1 debug MAC \n");
|
||||
LOG_W(MAC, "1 warning MAC \n");
|
||||
|
||||
set_log(EMU, OAILOG_INFO, FLAG_ONLINE);
|
||||
set_log(MAC, OAILOG_WARNING, 0);
|
||||
|
||||
LOG_I(EMU, "2 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_E(MAC, "2 error MAC\n");
|
||||
LOG_D(MAC, "2 debug MAC \n");
|
||||
LOG_W(MAC, "2 warning MAC \n");
|
||||
LOG_I(MAC, "2 info MAC \n");
|
||||
|
||||
|
||||
set_log(MAC, OAILOG_NOTICE, 1);
|
||||
|
||||
LOG_ENTER(MAC);
|
||||
LOG_I(EMU, "3 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "3 debug MAC \n");
|
||||
LOG_W(MAC, "3 warning MAC \n");
|
||||
LOG_I(MAC, "3 info MAC \n");
|
||||
|
||||
set_log(MAC, LOG_DEBUG,1);
|
||||
set_log(EMU, LOG_DEBUG,1);
|
||||
|
||||
LOG_ENTER(MAC);
|
||||
LOG_I(EMU, "4 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "4 debug MAC \n");
|
||||
LOG_W(MAC, "4 warning MAC \n");
|
||||
LOG_I(MAC, "4 info MAC \n");
|
||||
|
||||
|
||||
set_log(MAC, LOG_DEBUG,0);
|
||||
set_log(EMU, LOG_DEBUG,0);
|
||||
|
||||
LOG_I(LOG, "5 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "5 debug MAC \n");
|
||||
LOG_W(MAC, "5 warning MAC \n");
|
||||
LOG_I(MAC, "5 info MAC \n");
|
||||
|
||||
|
||||
set_log(MAC, LOG_TRACE,0X07F);
|
||||
set_log(EMU, LOG_TRACE,0X07F);
|
||||
|
||||
LOG_ENTER(MAC);
|
||||
LOG_I(LOG, "6 Starting OAI logs version %s Build date: %s on %s\n",
|
||||
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
|
||||
LOG_D(MAC, "6 debug MAC \n");
|
||||
LOG_W(MAC, "6 warning MAC \n");
|
||||
LOG_I(MAC, "6 info MAC \n");
|
||||
LOG_EXIT(MAC);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,483 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file log.h
|
||||
* \brief openair log generator (OLG) for
|
||||
* \author Navid Nikaein
|
||||
* \date 2009 - 2014
|
||||
* \version 0.5
|
||||
* @ingroup util
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __LOG_H__
|
||||
# define __LOG_H__
|
||||
|
||||
/*--- INCLUDES ---------------------------------------------------------------*/
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#include "T.h"
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @defgroup _LOG LOG Generator
|
||||
* @{*/
|
||||
/* @}*/
|
||||
|
||||
/** @defgroup _macro Macro Definition
|
||||
* @ingroup _LOG
|
||||
* @brief these macros are used in the code of LOG
|
||||
* @{*/
|
||||
/* @}*/
|
||||
|
||||
/** @defgroup _max_length Maximum Length of LOG
|
||||
* @ingroup _macro
|
||||
* @brief the macros that describe the maximum length of LOG
|
||||
* @{*/
|
||||
|
||||
#define MAX_LOG_TOTAL 1500 /*!< \brief the maximum length of a log */
|
||||
/* @}*/
|
||||
|
||||
/** @defgroup _log_level Message levels defined by LOG
|
||||
* @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_FILE 1 /*!< \brief important informational messages, but everything OK */
|
||||
# define OAILOG_WARNING 2 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
|
||||
# define OAILOG_INFO 3 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
|
||||
# define OAILOG_DEBUG 4 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
|
||||
# define OAILOG_TRACE 5 /*!< \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 */
|
||||
/* @}*/
|
||||
|
||||
|
||||
/** @defgroup _log_format Defined log format
|
||||
* @ingroup _macro
|
||||
* @brief Macro of log formats defined by LOG
|
||||
* @{*/
|
||||
|
||||
/* .log_format = 0x13 uncolored standard messages
|
||||
* .log_format = 0x93 colored standard messages */
|
||||
/* keep white space in first position; switching it to 0 allows colors to be disabled*/
|
||||
#define LOG_RED "\033[1;31m" /*!< \brief VT100 sequence for bold red foreground */
|
||||
#define LOG_GREEN "\033[32m" /*!< \brief VT100 sequence for green foreground */
|
||||
#define LOG_ORANGE "\033[93m" /*!< \brief VT100 sequence for orange foreground */
|
||||
#define LOG_BLUE "\033[34m" /*!< \brief VT100 sequence for blue foreground */
|
||||
#define LOG_CYBL "\033[40;36m" /*!< \brief VT100 sequence for cyan foreground on black background */
|
||||
#define LOG_RESET "\033[0m" /*!< \brief VT100 sequence for reset (black) foreground */
|
||||
/* @}*/
|
||||
|
||||
|
||||
/** @defgroup _syslog_conf Macros for write in syslog.conf
|
||||
* @ingroup _macro
|
||||
* @brief Macros used to write lines (local/remote) in syslog.conf
|
||||
* @{*/
|
||||
|
||||
|
||||
#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
|
||||
#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
|
||||
#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
|
||||
#define FLAG_FUNCT 0x0020
|
||||
#define FLAG_FILE_LINE 0x0040
|
||||
#define FLAG_TIME 0x0100
|
||||
|
||||
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
|
||||
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
|
||||
|
||||
/** @defgroup macros to identify a debug entity
|
||||
* @ingroup each macro is a bit mask where the unique bit set identifies an entity to be debugged
|
||||
* it allows to dynamically activate or not blocks of code
|
||||
* @brief
|
||||
* @{*/
|
||||
#define DEBUG_PRACH (1<<0)
|
||||
#define DEBUG_RU (1<<1)
|
||||
|
||||
#define SET_LOG_DEBUG(O) g_log->debug_mask = (g_log->debug_mask | O)
|
||||
#define CLEAR_LOG_DEBUG(O) g_log->debug_mask = (g_log->debug_mask & (~O))
|
||||
|
||||
#define SET_LOG_MATLAB(O) g_log->matlab_mask = (g_log->matlab_mask | O)
|
||||
#define CLEAR_LOG_MATLAB(O) g_log->matlab_mask = (g_log->matlab_mask & (~O))
|
||||
|
||||
/* @}*/
|
||||
|
||||
#define OAI_OK 0 /*!< \brief all ok */
|
||||
#define OAI_ERR 1 /*!< \brief generic error */
|
||||
#define OAI_ERR_READ_ONLY 2 /*!< \brief tried to write to read-only item */
|
||||
#define OAI_ERR_NOTFOUND 3 /*!< \brief something wasn't found */
|
||||
/* @}*/
|
||||
|
||||
|
||||
typedef enum {
|
||||
MIN_LOG_COMPONENTS = 0,
|
||||
PHY = MIN_LOG_COMPONENTS,
|
||||
MAC,
|
||||
SIM,
|
||||
OCG,
|
||||
OMG,
|
||||
OPT,
|
||||
OTG,
|
||||
OTG_LATENCY,
|
||||
OTG_LATENCY_BG,
|
||||
OTG_GP,
|
||||
OTG_GP_BG,
|
||||
OTG_JITTER,
|
||||
RLC,
|
||||
PDCP,
|
||||
RRC,
|
||||
NAS,
|
||||
PERF,
|
||||
OIP,
|
||||
CLI,
|
||||
MSC,
|
||||
OCM,
|
||||
UDP_,
|
||||
GTPU,
|
||||
SPGW,
|
||||
S1AP,
|
||||
SCTP,
|
||||
HW,
|
||||
OSA,
|
||||
RAL_ENB,
|
||||
RAL_UE,
|
||||
ENB_APP,
|
||||
FLEXRAN_AGENT,
|
||||
TMR,
|
||||
USIM,
|
||||
LOCALIZE,
|
||||
RRH,
|
||||
X2AP,
|
||||
LOADER,
|
||||
MAX_LOG_PREDEF_COMPONENTS,
|
||||
}
|
||||
comp_name_t;
|
||||
|
||||
#define MAX_LOG_DYNALLOC_COMPONENTS 20
|
||||
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
|
||||
|
||||
|
||||
typedef struct {
|
||||
char *name; /*!< \brief string name of item */
|
||||
int value; /*!< \brief integer value of mapping */
|
||||
} mapping;
|
||||
|
||||
typedef int(*log_write_func_t)(FILE *stream, const char *format, va_list ap );
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int level;
|
||||
int flag;
|
||||
int interval;
|
||||
int filelog;
|
||||
char *filelog_name;
|
||||
FILE *stream;
|
||||
log_write_func_t fwrite;
|
||||
/* SR: make the log buffer component relative */
|
||||
char log_buffer[MAX_LOG_TOTAL];
|
||||
} log_component_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
log_component_t log_component[MAX_LOG_COMPONENTS];
|
||||
char* level2string[NUM_LOG_LEVEL];
|
||||
int onlinelog;
|
||||
int flag;
|
||||
int filelog;
|
||||
char* filelog_name;
|
||||
uint64_t debug_mask;
|
||||
uint64_t matlab_mask;
|
||||
} log_t;
|
||||
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
typedef enum log_instance_type_e {
|
||||
LOG_INSTANCE_UNKNOWN,
|
||||
LOG_INSTANCE_ENB,
|
||||
LOG_INSTANCE_UE,
|
||||
} log_instance_type_t;
|
||||
|
||||
void log_set_instance_type (log_instance_type_t instance);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LOG_MAIN
|
||||
log_t *g_log;
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern log_t *g_log;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/*--- INCLUDES ---------------------------------------------------------------*/
|
||||
# include "log_if.h"
|
||||
/*----------------------------------------------------------------------------*/
|
||||
int logInit (void);
|
||||
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
|
||||
|
||||
int set_log(int component, int level, int interval);
|
||||
void set_glog(int level);
|
||||
|
||||
void set_glog_onlinelog(int enable);
|
||||
void set_glog_filelog(int enable);
|
||||
void set_component_filelog(int comp);
|
||||
|
||||
int map_str_to_int(mapping *map, const char *str);
|
||||
char *map_int_to_str(mapping *map, int val);
|
||||
void logClean (void);
|
||||
int is_newline( char *str, int size);
|
||||
|
||||
int register_log_component(char *name, char *fext, int compidx);
|
||||
|
||||
/* @}*/
|
||||
|
||||
/*!\fn int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
|
||||
\brief Write output file from signal data
|
||||
@param fname output file name
|
||||
@param vname output vector name (for MATLAB/OCTAVE)
|
||||
@param data point to data
|
||||
@param length length of data vector to output
|
||||
@param dec decimation level
|
||||
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
|
||||
*/
|
||||
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
|
||||
|
||||
/*----------------macro definitions for reading log configuration from the config module */
|
||||
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
||||
|
||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL "global_log_level"
|
||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE "global_log_online"
|
||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_INFILE "global_log_infile"
|
||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS "global_log_options"
|
||||
|
||||
#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_MATLAB_FORMAT "%s_matlab"
|
||||
|
||||
#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"\
|
||||
" level: add log level indication in log messages\n"\
|
||||
" thread: add threads names in log messages\n"
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* LOG globalconfiguration parameters */
|
||||
/* optname help paramflags XXXptr defXXXval type numelt */
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define LOG_GLOBALPARAMS_DESC { \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(g_log->onlinelog), defintval:1, TYPE_INT, 0}, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
|
||||
}
|
||||
|
||||
#define LOG_OPTIONS_IDX 2
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/** @defgroup _debugging debugging macros
|
||||
* @ingroup _macro
|
||||
* @brief Macro used to call logIt function with different message levels
|
||||
* @{*/
|
||||
|
||||
// debugging macros(g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
|
||||
# if T_TRACER
|
||||
/* per component, level dependant macros */
|
||||
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
|
||||
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
|
||||
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
|
||||
# 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)
|
||||
# define LOG_F(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_FILE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_FILE, 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_DEBUG_BEGIN(D) if (g_log->debug_mask & D) {
|
||||
# define LOG_DEBUG_END }
|
||||
/* bitmask dependant macros, to generate matlab files */
|
||||
# define LOG_M_BEGIN(D) if (g_log->matlab_mask & D) {
|
||||
# define LOG_M_END }
|
||||
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
|
||||
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
|
||||
# define LOG_I(c, x...) /* */
|
||||
# define LOG_W(c, x...) /* */
|
||||
# define LOG_E(c, x...) /* */
|
||||
# define LOG_D(c, x...) /* */
|
||||
# define LOG_T(c, x...) /* */
|
||||
# define LOG_F(c, x...) /* */
|
||||
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
|
||||
# define LOG_DEBUG_BEGIN(D) if (0) {
|
||||
# define LOG_DEBUG_END }
|
||||
# define LOG_M_BEGIN(D) if (0) {
|
||||
# define LOG_M_END }
|
||||
# define LOG_M(file, vector, data, len, dec, format)
|
||||
|
||||
# endif /* T_TRACER */
|
||||
|
||||
|
||||
/* @}*/
|
||||
|
||||
|
||||
/** @defgroup _useful_functions useful functions in LOG
|
||||
* @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 */
|
||||
/* @}*/
|
||||
|
||||
static __inline__ uint64_t rdtsc(void) {
|
||||
uint32_t a, d;
|
||||
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
|
||||
return (((uint64_t)d)<<32) | ((uint64_t)a);
|
||||
}
|
||||
|
||||
#define DEBUG_REALTIME 1
|
||||
#if DEBUG_REALTIME
|
||||
|
||||
extern double cpuf;
|
||||
|
||||
static inline uint64_t checkTCPU(int timeout, char * file, int line) {
|
||||
static uint64_t __thread lastCPUTime=0;
|
||||
static uint64_t __thread last=0;
|
||||
uint64_t cur=rdtsc();
|
||||
struct timespec CPUt;
|
||||
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &CPUt);
|
||||
uint64_t CPUTime=CPUt.tv_sec*1000*1000+CPUt.tv_nsec/1000;
|
||||
double microCycles=(double)(cpuf*1000);
|
||||
int duration=(int)((cur-last)/microCycles);
|
||||
if ( last!=0 && duration > timeout ) {
|
||||
//struct timespec ts;
|
||||
//clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
printf("%s:%d lte-ue delay %d (exceed %d), CPU for this period: %lld\n", file, line,
|
||||
duration, timeout, (long long)CPUTime-lastCPUTime );
|
||||
}
|
||||
last=cur;
|
||||
lastCPUTime=CPUTime;
|
||||
return cur;
|
||||
}
|
||||
|
||||
static inline unsigned long long checkT(int timeout, char * file, int line) {
|
||||
static unsigned long long __thread last=0;
|
||||
unsigned long long cur=rdtsc();
|
||||
int microCycles=(int)(cpuf*1000);
|
||||
int duration=(int)((cur-last)/microCycles);
|
||||
if ( last!=0 && duration > timeout )
|
||||
printf("%s:%d lte-ue delay %d (exceed %d)\n", file, line,
|
||||
duration, timeout);
|
||||
last=cur;
|
||||
return cur;
|
||||
}
|
||||
|
||||
typedef struct m {
|
||||
uint64_t iterations;
|
||||
uint64_t sum;
|
||||
uint64_t maxArray[11];
|
||||
} Meas;
|
||||
|
||||
static inline void printMeas(char * txt, Meas *M, int period) {
|
||||
if (M->iterations%period == 0 ) {
|
||||
char txt2[512];
|
||||
sprintf(txt2,"%s avg=%" PRIu64 " iterations=%" PRIu64 " max=%"
|
||||
PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n",
|
||||
txt,
|
||||
M->sum/M->iterations,
|
||||
M->iterations,
|
||||
M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5],
|
||||
M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]);
|
||||
#if DISABLE_LOG_X
|
||||
printf("%s",txt2);
|
||||
#else
|
||||
LOG_W(PHY, "%s",txt2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static inline int cmpint(const void* a, const void* b) {
|
||||
uint64_t* aa=(uint64_t*)a;
|
||||
uint64_t* bb=(uint64_t*)b;
|
||||
return (int)(*aa-*bb);
|
||||
}
|
||||
|
||||
static inline void updateTimes(uint64_t start, Meas *M, int period, char * txt) {
|
||||
if (start!=0) {
|
||||
uint64_t end=rdtsc();
|
||||
long long diff=(end-start)/(cpuf*1000);
|
||||
M->maxArray[0]=diff;
|
||||
M->sum+=diff;
|
||||
M->iterations++;
|
||||
qsort(M->maxArray, 11, sizeof(uint64_t), cmpint);
|
||||
printMeas(txt,M,period);
|
||||
}
|
||||
}
|
||||
|
||||
#define check(a) do { checkT(a,__FILE__,__LINE__); } while (0)
|
||||
#define checkcpu(a) do { checkTCPU(a,__FILE__,__LINE__); } while (0)
|
||||
#define initRefTimes(a) static __thread Meas a= {0}
|
||||
#define pickTime(a) uint64_t a=rdtsc()
|
||||
#define readTime(a) a
|
||||
#define initStaticTime(a) static __thread uint64_t a={0}
|
||||
#define pickStaticTime(a) do { a=rdtsc(); } while (0)
|
||||
|
||||
#else
|
||||
#define check(a) do {} while (0)
|
||||
#define checkcpu(a) do {} while (0)
|
||||
#define initRefTimes(a) do {} while (0)
|
||||
#define initStaticTime(a) do {} while (0)
|
||||
#define pickTime(a) do {} while (0)
|
||||
#define readTime(a) 0
|
||||
#define pickStaticTime(a) do {} while (0)
|
||||
#define updateTimes(a,b,c,d) do {} while (0)
|
||||
#define printMeas(a,b,c) do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include"log.h"
|
||||
|
||||
extern log_t *g_log;
|
||||
|
||||
|
||||
extern mapping log_level_names[];
|
||||
extern mapping log_options[];
|
||||
extern mapping log_maskmap[];
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file log_if.h
|
||||
* \brief log interface
|
||||
* \author Navid Nikaein
|
||||
* \date 2009 - 2014
|
||||
* \version 0.3
|
||||
* \warning This component can be runned only in user-space
|
||||
* @ingroup routing
|
||||
*/
|
||||
|
||||
// LTS: kept this file for compatibility
|
||||
// this file was probably a trial to separate internal functions and external ones
|
||||
// but it has never been finished, most source code include directly log.h (not log_if.h)
|
||||
#include "log.h"
|
||||
@@ -0,0 +1,823 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file vcd_signal_dumper.c
|
||||
* \brief Dump functions calls and variables to VCD file. Use GTKWave to display this file.
|
||||
* \author S. Roux
|
||||
* \maintainer: navid nikaein
|
||||
* \date 2012 - 2104
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <error.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "assertions.h"
|
||||
#include "signals.h"
|
||||
|
||||
#include "vcd_signal_dumper.h"
|
||||
|
||||
#define VCDSIGNALDUMPER_VERSION_MAJOR 0
|
||||
#define VCDSIGNALDUMPER_VERSION_MINOR 1
|
||||
|
||||
// Global variable. If the VCD option is set at execution time, output VCD trace. Otherwise this module has no effect.
|
||||
int ouput_vcd = 0;
|
||||
|
||||
struct vcd_module_s {
|
||||
const char *name;
|
||||
int number_of_signals;
|
||||
const char **signals_names;
|
||||
vcd_signal_type signal_type;
|
||||
int signal_size;
|
||||
} vcd_module_s;
|
||||
|
||||
const char* eurecomVariablesNames[] = {
|
||||
"frame_number_TX0_eNB",
|
||||
"frame_number_TX1_eNB",
|
||||
"frame_number_RX0_eNB",
|
||||
"frame_number_RX1_eNB",
|
||||
"subframe_number_TX0_eNB",
|
||||
"subframe_number_TX1_eNB",
|
||||
"subframe_number_RX0_eNB",
|
||||
"subframe_number_RX1_eNB",
|
||||
"frame_number_TX0_RU",
|
||||
"frame_number_TX1_RU",
|
||||
"frame_number_RX0_RU",
|
||||
"frame_number_RX1_RU",
|
||||
"subframe_number_TX0_RU",
|
||||
"subframe_number_TX1_RU",
|
||||
"subframe_number_RX0_RU",
|
||||
"subframe_number_RX1_RU",
|
||||
"runtime_TX_eNB",
|
||||
"runtime_RX_eNB",
|
||||
"frame_number_TX0_UE",
|
||||
"frame_number_TX1_UE",
|
||||
"frame_number_RX0_UE",
|
||||
"frame_number_RX1_UE",
|
||||
"subframe_TX0_UE",
|
||||
"subframe_TX1_UE",
|
||||
"subframe_RX0_UE",
|
||||
"subframe_RX1_UE",
|
||||
"ue_rx_offset",
|
||||
"diff2",
|
||||
"hw_subframe",
|
||||
"hw_frame",
|
||||
"hw_subframe_rx",
|
||||
"hw_frame_rx",
|
||||
"txcnt",
|
||||
"rxcnt",
|
||||
"trx_ts",
|
||||
"trx_tst",
|
||||
"trx_ts_ue",
|
||||
"trx_tst_ue",
|
||||
"trx_write_flags",
|
||||
"tx_ts",
|
||||
"rx_ts",
|
||||
"hw_cnt_rx",
|
||||
"lhw_cnt_rx",
|
||||
"hw_cnt_tx",
|
||||
"lhw_cnt_tx",
|
||||
"pck_rx",
|
||||
"pck_tx",
|
||||
"rx_seq_num",
|
||||
"rx_seq_num_prv",
|
||||
"tx_seq_num",
|
||||
"cnt",
|
||||
"dummy_dump",
|
||||
"itti_send_msg",
|
||||
"itti_poll_msg",
|
||||
"itti_recv_msg",
|
||||
"itti_alloc_msg",
|
||||
"mp_alloc",
|
||||
"mp_free",
|
||||
"ue_inst_cnt_rx",
|
||||
"ue_inst_cnt_tx",
|
||||
"dci_info",
|
||||
"ue0_BSR",
|
||||
"ue0_BO",
|
||||
"ue0_scheduled",
|
||||
"ue0_timing_advance",
|
||||
"ue0_SR_ENERGY",
|
||||
"ue0_SR_THRES",
|
||||
"ue0_rssi0",
|
||||
"ue0_rssi1",
|
||||
"ue0_rssi2",
|
||||
"ue0_rssi3",
|
||||
"ue0_rssi4",
|
||||
"ue0_rssi5",
|
||||
"ue0_rssi6",
|
||||
"ue0_rssi7",
|
||||
"ue0_res0",
|
||||
"ue0_res1",
|
||||
"ue0_res2",
|
||||
"ue0_res3",
|
||||
"ue0_res4",
|
||||
"ue0_res5",
|
||||
"ue0_res6",
|
||||
"ue0_res7",
|
||||
"ue0_MCS0",
|
||||
"ue0_MCS1",
|
||||
"ue0_MCS2",
|
||||
"ue0_MCS3",
|
||||
"ue0_MCS4",
|
||||
"ue0_MCS5",
|
||||
"ue0_MCS6",
|
||||
"ue0_MCS7",
|
||||
"ue0_RB0",
|
||||
"ue0_RB1",
|
||||
"ue0_RB2",
|
||||
"ue0_RB3",
|
||||
"ue0_RB4",
|
||||
"ue0_RB5",
|
||||
"ue0_RB6",
|
||||
"ue0_RB7",
|
||||
"ue0_ROUND0",
|
||||
"ue0_ROUND1",
|
||||
"ue0_ROUND2",
|
||||
"ue0_ROUND3",
|
||||
"ue0_ROUND4",
|
||||
"ue0_ROUND5",
|
||||
"ue0_ROUND6",
|
||||
"ue0_ROUND7",
|
||||
"ue0_SFN0",
|
||||
"ue0_SFN1",
|
||||
"ue0_SFN2",
|
||||
"ue0_SFN3",
|
||||
"ue0_SFN4",
|
||||
"ue0_SFN5",
|
||||
"ue0_SFN6",
|
||||
"ue0_SFN7",
|
||||
"send_if4_symbol",
|
||||
"recv_if4_symbol",
|
||||
"send_if5_pkt_id",
|
||||
"recv_if5_pkt_id",
|
||||
"ue_pdcp_flush_size",
|
||||
"ue_pdcp_flush_err",
|
||||
"ue0_trx_read_ns",
|
||||
"ue0_trx_write_ns",
|
||||
"ue0_trx_read_ns_missing",
|
||||
"ue0_trx_write_ns_missing",
|
||||
"enb_thread_rxtx_CPUID",
|
||||
"ru_thread_CPUID",
|
||||
"ru_thread_tx_CPUID"
|
||||
};
|
||||
|
||||
const char* eurecomFunctionsNames[] = {
|
||||
/* softmodem signals */
|
||||
"rt_sleep",
|
||||
"trx_read",
|
||||
"trx_write",
|
||||
"trx_read_ue",
|
||||
"trx_write_ue",
|
||||
"trx_read_if",
|
||||
"trx_write_if",
|
||||
"eNB_thread_rxtx0",
|
||||
"eNB_thread_rxtx1",
|
||||
"ue_thread_synch",
|
||||
"ue_thread_rxtx0",
|
||||
"ue_thread_rxtx1",
|
||||
"trx_read_sf9",
|
||||
"trx_write_sf9",
|
||||
"ue_signal_cond_rxtx0",
|
||||
"ue_signal_cond_rxtx1",
|
||||
"ue_wait_cond_rxtx0",
|
||||
"ue_wait_cond_rxtx1",
|
||||
"ue_lock_mutex_rxtx_for_cond_wait0",
|
||||
"ue_lock_mutex_rxtx_for_cond_wait1",
|
||||
"ue_lock_mutex_rxtx_for_cnt_decrement0",
|
||||
"ue_lock_mutex_rxtx_for_cnt_decrement1",
|
||||
"ue_lock_mutex_rxtx_for_cnt_increment0",
|
||||
"ue_lock_mutex_rxtx_for_cnt_increment1",
|
||||
/* simulation signals */
|
||||
"do_DL_sig",
|
||||
"do_UL_sig",
|
||||
"UE_trx_read",
|
||||
/* RRH signals */
|
||||
"eNB_tx",
|
||||
"eNB_rx",
|
||||
"eNB_trx",
|
||||
"eNB_tm",
|
||||
"eNB_rx_sleep",
|
||||
"eNB_tx_sleep",
|
||||
"eNB_proc_sleep",
|
||||
"trx_read_rf",
|
||||
"trx_write_rf",
|
||||
|
||||
/* PHY signals */
|
||||
"ue_synch",
|
||||
"ue_slot_fep",
|
||||
"ue_rrc_measurements",
|
||||
"ue_gain_control",
|
||||
"ue_adjust_synch",
|
||||
"lte_ue_measurement_procedures",
|
||||
"lte_ue_pdcch_procedures",
|
||||
"lte_ue_pbch_procedures",
|
||||
"phy_procedures_eNb_tx0",
|
||||
"phy_procedures_eNb_tx1",
|
||||
"phy_procedures_ru_feprx0",
|
||||
"phy_procedures_ru_feprx1",
|
||||
"phy_procedures_ru_feptx_ofdm0",
|
||||
"phy_procedures_ru_feptx_ofdm1",
|
||||
"phy_procedures_ru_feptx_prec0",
|
||||
"phy_procedures_ru_feptx_prec1",
|
||||
"phy_procedures_eNb_rx_uespec0",
|
||||
"phy_procedures_eNb_rx_uespec1",
|
||||
"phy_procedures_ue_tx",
|
||||
"phy_procedures_ue_rx",
|
||||
"phy_procedures_ue_tx_ulsch_uespec",
|
||||
"phy_procedures_ue_tx_pucch",
|
||||
"phy_procedures_ue_tx_ulsch_common",
|
||||
"phy_procedures_ue_tx_prach",
|
||||
"phy_procedures_ue_tx_ulsch_rar",
|
||||
"phy_procedures_eNB_lte",
|
||||
"phy_procedures_UE_lte",
|
||||
"pdsch_thread",
|
||||
"dlsch_thread0",
|
||||
"dlsch_thread1",
|
||||
"dlsch_thread2",
|
||||
"dlsch_thread3",
|
||||
"dlsch_thread4",
|
||||
"dlsch_thread5",
|
||||
"dlsch_thread6",
|
||||
"dlsch_thread7",
|
||||
"dlsch_decoding0",
|
||||
"dlsch_decoding1",
|
||||
"dlsch_decoding2",
|
||||
"dlsch_decoding3",
|
||||
"dlsch_decoding4",
|
||||
"dlsch_decoding5",
|
||||
"dlsch_decoding6",
|
||||
"dlsch_decoding7",
|
||||
"rx_pdcch",
|
||||
"dci_decoding",
|
||||
"rx_phich",
|
||||
"pdsch_procedures",
|
||||
"pdsch_procedures_si",
|
||||
"pdsch_procedures_p",
|
||||
"pdsch_procedures_ra",
|
||||
"phy_ue_config_sib2",
|
||||
"macxface_phy_config_sib1_eNB",
|
||||
"macxface_phy_config_sib2_eNB",
|
||||
"macxface_phy_config_dedicated_eNB",
|
||||
"phy_ue_compute_prach",
|
||||
"phy_enb_ulsch_msg3",
|
||||
"phy_enb_ulsch_decoding0",
|
||||
"phy_enb_ulsch_decoding1",
|
||||
"phy_enb_ulsch_decoding2",
|
||||
"phy_enb_ulsch_decoding3",
|
||||
"phy_enb_ulsch_decoding4",
|
||||
"phy_enb_ulsch_decoding5",
|
||||
"phy_enb_ulsch_decoding6",
|
||||
"phy_enb_ulsch_decoding7",
|
||||
"phy_enb_sfgen",
|
||||
"phy_enb_prach_rx",
|
||||
"phy_ru_prach_rx",
|
||||
"phy_enb_pdcch_tx",
|
||||
"phy_enb_rs_tx",
|
||||
"phy_ue_generate_prach",
|
||||
"phy_ue_ulsch_modulation",
|
||||
"phy_ue_ulsch_encoding",
|
||||
#if 1 // add for debugging losing PDSCH immediately before and after reporting CQI
|
||||
"phy_ue_ulsch_encoding_fill_cqi",
|
||||
#endif
|
||||
"phy_ue_ulsch_scrambling",
|
||||
"phy_eNB_dlsch_modulation",
|
||||
"phy_eNB_dlsch_encoding",
|
||||
"phy_eNB_dlsch_encoding_w",
|
||||
"phy_eNB_dlsch_scrambling",
|
||||
"phy_eNB_beam_precoding",
|
||||
"phy_eNB_ofdm_mod_l",
|
||||
|
||||
/* MAC signals */
|
||||
"macxface_macphy_init",
|
||||
"macxface_macphy_exit",
|
||||
"macxface_eNB_dlsch_ulsch_scheduler",
|
||||
"macxface_fill_rar",
|
||||
"macxface_terminate_ra_proc",
|
||||
"macxface_initiate_ra_proc",
|
||||
"macxface_cancel_ra_proc",
|
||||
"macxface_get_dci_sdu",
|
||||
"macxface_get_dlsch_sdu",
|
||||
"macxface_rx_sdu",
|
||||
"macxface_mrbch_phy_sync_failure",
|
||||
"macxface_SR_indication",
|
||||
"mac_dlsch_preprocessor",
|
||||
"mac_schedule_dlsch",
|
||||
"mac_fill_dlsch_dci",
|
||||
|
||||
"macxface_out_of_sync_ind",
|
||||
"macxface_ue_decode_si",
|
||||
"macxface_ue_decode_pcch",
|
||||
"macxface_ue_decode_ccch",
|
||||
"macxface_ue_decode_bcch",
|
||||
"macxface_ue_send_sdu",
|
||||
"macxface_ue_get_sdu",
|
||||
"macxface_ue_get_rach",
|
||||
"macxface_ue_process_rar",
|
||||
"macxface_ue_scheduler",
|
||||
"macxface_ue_get_sr",
|
||||
|
||||
"ue_send_mch_sdu",
|
||||
|
||||
/*RLC signals */
|
||||
"rlc_data_req",
|
||||
// "rlc_data_ind", // this calls "pdcp_data_ind",
|
||||
"mac_rlc_status_ind",
|
||||
"mac_rlc_data_req",
|
||||
"mac_rlc_data_ind",
|
||||
"rlc_um_try_reassembly",
|
||||
"rlc_um_check_timer_dar_time_out",
|
||||
"rlc_um_receive_process_dar",
|
||||
|
||||
/* PDCP signals */
|
||||
"pdcp_run",
|
||||
"pdcp_data_req",
|
||||
"pdcp_data_ind",
|
||||
"pdcp_apply_security",
|
||||
"pdcp_validate_security",
|
||||
"pdcp_fifo_read",
|
||||
"pdcp_fifo_read_buffer",
|
||||
"pdcp_fifo_flush",
|
||||
"pdcp_fifo_flush_buffer",
|
||||
/* RRC signals */
|
||||
"rrc_rx_tx",
|
||||
"rrc_mac_config_req",
|
||||
"rrc_ue_decode_sib1",
|
||||
"rrc_ue_decode_si",
|
||||
/* GTPV1U signals */
|
||||
"gtpv1u_enb_task",
|
||||
"gtpv1u_process_udp_req",
|
||||
"gtpv1u_process_tunnel_data_req",
|
||||
/* UDP signals */
|
||||
"udp_enb_task",
|
||||
/* MISC signals */
|
||||
"emu_transport",
|
||||
"log_record",
|
||||
"itti_enqueue_message",
|
||||
"itti_dump_enqueue_message",
|
||||
"itti_dump_enqueue_message_malloc",
|
||||
"itti_relay_thread",
|
||||
"test",
|
||||
|
||||
/* IF4/IF5 signals */
|
||||
"send_if4",
|
||||
"recv_if4",
|
||||
"send_if5",
|
||||
"recv_if5",
|
||||
|
||||
"compress_if",
|
||||
"decompress_if",
|
||||
|
||||
"nfapi_subframe",
|
||||
"generate_pcfich",
|
||||
"generate_dci0",
|
||||
"generate_dlsch",
|
||||
"generate_phich",
|
||||
"pdcch_scrambling",
|
||||
"pdcch_modulation",
|
||||
"pdcch_interleaving",
|
||||
"pdcch_tx",
|
||||
|
||||
};
|
||||
|
||||
struct vcd_module_s vcd_modules[] = {
|
||||
{ "variables", VCD_SIGNAL_DUMPER_VARIABLES_END, eurecomVariablesNames, VCD_WIRE, 64 },
|
||||
{ "functions", VCD_SIGNAL_DUMPER_FUNCTIONS_END, eurecomFunctionsNames, VCD_WIRE, 1 },
|
||||
// { "ue_procedures_functions", VCD_SIGNAL_DUMPER_UE_PROCEDURES_FUNCTIONS_END, eurecomUEFunctionsNames, VCD_WIRE, 1 },
|
||||
};
|
||||
|
||||
FILE *vcd_fd = NULL;
|
||||
static inline unsigned long long int vcd_get_time(void);
|
||||
|
||||
#if defined(ENABLE_USE_CPU_EXECUTION_TIME)
|
||||
struct timespec g_time_start;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ENABLE_VCD_FIFO)
|
||||
|
||||
# define VCD_POLL_DELAY (500) // Poll delay in micro-seconds
|
||||
# define VCD_MAX_WAIT_DELAY (200 * 1000) // Maximum data ready wait delay in micro-seconds
|
||||
# define VCD_FIFO_NB_ELEMENTS (1 << 24) // Must be a power of 2
|
||||
# define VCD_FIFO_MASK (VCD_FIFO_NB_ELEMENTS - 1)
|
||||
|
||||
typedef struct vcd_queue_user_data_s {
|
||||
uint32_t log_id;
|
||||
vcd_signal_dumper_modules module;
|
||||
union data_u {
|
||||
struct function_s {
|
||||
vcd_signal_dump_functions function_name;
|
||||
vcd_signal_dump_in_out in_out;
|
||||
} function;
|
||||
struct variable_s {
|
||||
vcd_signal_dump_variables variable_name;
|
||||
unsigned long value;
|
||||
} variable;
|
||||
} data;
|
||||
|
||||
long long unsigned int time;
|
||||
} vcd_queue_user_data_t;
|
||||
|
||||
typedef struct vcd_fifo_s {
|
||||
vcd_queue_user_data_t user_data[VCD_FIFO_NB_ELEMENTS];
|
||||
|
||||
volatile uint32_t write_index;
|
||||
volatile uint32_t read_index;
|
||||
} vcd_fifo_t;
|
||||
|
||||
vcd_fifo_t vcd_fifo;
|
||||
|
||||
pthread_t vcd_dumper_thread;
|
||||
#endif
|
||||
|
||||
#define BYTE_SIZE 8
|
||||
#define NIBBLE_SIZE 4
|
||||
static void uint64_to_binary(uint64_t value, char *binary)
|
||||
{
|
||||
static const char * const nibbles_start[] = {
|
||||
"", "1", "10", "11",
|
||||
"100", "101", "110", "111",
|
||||
"1000", "1001", "1010", "1011",
|
||||
"1100", "1101", "1110", "1111",
|
||||
};
|
||||
static const char * const nibbles[] = {
|
||||
"0000", "0001", "0010", "0011",
|
||||
"0100", "0101", "0110", "0111",
|
||||
"1000", "1001", "1010", "1011",
|
||||
"1100", "1101", "1110", "1111",
|
||||
};
|
||||
int nibble;
|
||||
int nibble_value;
|
||||
int nibble_size;
|
||||
int zero = 1;
|
||||
|
||||
for (nibble = 0; nibble < (sizeof (uint64_t) * (BYTE_SIZE / NIBBLE_SIZE)); nibble++) {
|
||||
nibble_value = value >> ((sizeof (uint64_t) * BYTE_SIZE) - NIBBLE_SIZE);
|
||||
|
||||
if (zero) {
|
||||
if (nibble_value > 0) {
|
||||
zero = 0;
|
||||
nibble_size = strlen(nibbles_start[nibble_value]);
|
||||
memcpy (binary, nibbles_start[nibble_value], nibble_size);
|
||||
binary += nibble_size;
|
||||
}
|
||||
} else {
|
||||
memcpy (binary, nibbles[nibble_value], NIBBLE_SIZE);
|
||||
binary += NIBBLE_SIZE;
|
||||
}
|
||||
|
||||
value <<= NIBBLE_SIZE;
|
||||
}
|
||||
|
||||
/* Add a '0' if the value was null */
|
||||
if (zero) {
|
||||
binary[0] = '0';
|
||||
binary ++;
|
||||
}
|
||||
|
||||
/* Add a null value at the end of the string */
|
||||
binary[0] = '\0';
|
||||
}
|
||||
|
||||
#if defined(ENABLE_VCD_FIFO)
|
||||
inline static uint32_t vcd_get_write_index(void)
|
||||
{
|
||||
uint32_t write_index;
|
||||
uint32_t read_index;
|
||||
|
||||
/* Get current write index and increment it (atomic operation) */
|
||||
write_index = __sync_fetch_and_add(&vcd_fifo.write_index, 1);
|
||||
/* Wrap index */
|
||||
write_index &= VCD_FIFO_MASK;
|
||||
|
||||
/* Check FIFO overflow (increase VCD_FIFO_NB_ELEMENTS if this assert is triggered) */
|
||||
DevCheck((read_index = vcd_fifo.read_index, ((write_index + 1) & VCD_FIFO_MASK) != read_index), write_index, read_index, VCD_FIFO_NB_ELEMENTS);
|
||||
|
||||
return write_index;
|
||||
}
|
||||
|
||||
void *vcd_dumper_thread_rt(void *args)
|
||||
{
|
||||
vcd_queue_user_data_t *data;
|
||||
char binary_string[(sizeof (uint64_t) * BYTE_SIZE) + 1];
|
||||
struct sched_param sched_param;
|
||||
uint32_t data_ready_wait;
|
||||
|
||||
# if defined(ENABLE_ITTI)
|
||||
signal_mask();
|
||||
# endif
|
||||
|
||||
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
|
||||
sched_setscheduler(0, SCHED_FIFO, &sched_param);
|
||||
|
||||
while(1) {
|
||||
if (vcd_fifo.read_index == (vcd_fifo.write_index & VCD_FIFO_MASK)) {
|
||||
/* No element -> sleep a while */
|
||||
usleep(VCD_POLL_DELAY);
|
||||
} else {
|
||||
data = &vcd_fifo.user_data[vcd_fifo.read_index];
|
||||
data_ready_wait = 0;
|
||||
|
||||
while (data->module == VCD_SIGNAL_DUMPER_MODULE_FREE) {
|
||||
/* Check wait delay (increase VCD_MAX_WAIT_DELAY if this assert is triggered and that no thread is locked) */
|
||||
DevCheck(data_ready_wait < VCD_MAX_WAIT_DELAY, data_ready_wait, VCD_MAX_WAIT_DELAY, 0);
|
||||
|
||||
/* data is not yet ready, wait for it to be completed */
|
||||
data_ready_wait += VCD_POLL_DELAY;
|
||||
usleep(VCD_POLL_DELAY);
|
||||
}
|
||||
|
||||
switch (data->module) {
|
||||
case VCD_SIGNAL_DUMPER_MODULE_VARIABLES:
|
||||
if (vcd_fd != NULL) {
|
||||
int variable_name;
|
||||
variable_name = (int)data->data.variable.variable_name;
|
||||
fprintf(vcd_fd, "#%llu\n", data->time);
|
||||
/* Set variable to value */
|
||||
uint64_to_binary(data->data.variable.value, binary_string);
|
||||
fprintf(vcd_fd, "b%s %s_w\n", binary_string,
|
||||
eurecomVariablesNames[variable_name]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case VCD_SIGNAL_DUMPER_MODULE_FUNCTIONS:
|
||||
if (vcd_fd != NULL) {
|
||||
int function_name;
|
||||
|
||||
function_name = (int)data->data.function.function_name;
|
||||
fprintf(vcd_fd, "#%llu\n", data->time);
|
||||
|
||||
/* Check if we are entering or leaving the function ( 0 = leaving, 1 = entering) */
|
||||
if (data->data.function.in_out == VCD_FUNCTION_IN)
|
||||
/* Set event to 1 */
|
||||
fprintf(vcd_fd, "1%s_w\n", eurecomFunctionsNames[function_name]);
|
||||
else
|
||||
fprintf(vcd_fd, "0%s_w\n", eurecomFunctionsNames[function_name]);
|
||||
|
||||
fflush(vcd_fd);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
DevParam(data->module, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
data->module = VCD_SIGNAL_DUMPER_MODULE_FREE;
|
||||
vcd_fifo.read_index = (vcd_fifo.read_index + 1) & VCD_FIFO_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void vcd_signal_dumper_init(char *filename)
|
||||
{
|
||||
if (ouput_vcd) {
|
||||
// char filename[] = "/tmp/openair_vcd_dump.vcd";
|
||||
|
||||
if ((vcd_fd = fopen(filename, "w+")) == NULL) {
|
||||
perror("vcd_signal_dumper_init: cannot open file");
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_USE_CPU_EXECUTION_TIME)
|
||||
clock_gettime(CLOCK_MONOTONIC, &g_time_start);
|
||||
#endif
|
||||
|
||||
vcd_signal_dumper_create_header();
|
||||
|
||||
#if defined(ENABLE_VCD_FIFO)
|
||||
vcd_fifo.write_index = 0;
|
||||
vcd_fifo.read_index = 0;
|
||||
|
||||
fprintf(stderr, "[VCD] Creating dumper thread\n");
|
||||
|
||||
if (pthread_create(&vcd_dumper_thread, NULL, vcd_dumper_thread_rt, NULL) < 0) {
|
||||
fprintf(stderr, "vcd_signal_dumper_init: Failed to create thread: %s\n",
|
||||
strerror(errno));
|
||||
ouput_vcd = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void vcd_signal_dumper_close(void)
|
||||
{
|
||||
if (ouput_vcd) {
|
||||
#if defined(ENABLE_VCD_FIFO)
|
||||
|
||||
#else
|
||||
|
||||
if (vcd_fd != NULL) {
|
||||
fclose(vcd_fd);
|
||||
vcd_fd = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static inline void vcd_signal_dumper_print_time_since_start(void)
|
||||
{
|
||||
if (vcd_fd != NULL) {
|
||||
#if defined(ENABLE_USE_CPU_EXECUTION_TIME)
|
||||
struct timespec time;
|
||||
long long unsigned int nanosecondsSinceStart;
|
||||
long long unsigned int secondsSinceStart;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &time);
|
||||
|
||||
/* Get current execution time in nanoseconds */
|
||||
nanosecondsSinceStart = (long long unsigned int)((time.tv_nsec - g_time_start.tv_nsec));
|
||||
secondsSinceStart = (long long unsigned int)time.tv_sec - (long long unsigned int)g_time_start.tv_sec;
|
||||
/* Write time in nanoseconds */
|
||||
fprintf(vcd_fd, "#%llu\n", nanosecondsSinceStart + (secondsSinceStart * 1000000000UL));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned long long int vcd_get_time(void)
|
||||
{
|
||||
#if defined(ENABLE_USE_CPU_EXECUTION_TIME)
|
||||
struct timespec time;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &time);
|
||||
|
||||
return (long long unsigned int)((time.tv_nsec - g_time_start.tv_nsec)) +
|
||||
((long long unsigned int)time.tv_sec - (long long unsigned int)g_time_start.tv_sec) * 1000000000UL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void vcd_signal_dumper_create_header(void)
|
||||
{
|
||||
if (ouput_vcd) {
|
||||
struct tm *pDate;
|
||||
time_t intps;
|
||||
|
||||
intps = time(NULL);
|
||||
pDate = localtime(&intps);
|
||||
|
||||
if (vcd_fd != NULL) {
|
||||
int i, j;
|
||||
fprintf(vcd_fd, "$date\n\t%s$end\n", asctime(pDate));
|
||||
// Display version
|
||||
fprintf(vcd_fd, "$version\n\tVCD plugin ver%d.%d\n$end\n", VCDSIGNALDUMPER_VERSION_MAJOR, VCDSIGNALDUMPER_VERSION_MINOR);
|
||||
// Init timescale, here = 1ns
|
||||
fprintf(vcd_fd, "$timescale 1 ns $end\n");
|
||||
|
||||
/* Initialize each module definition */
|
||||
for(i = 0; i < sizeof(vcd_modules) / sizeof(struct vcd_module_s); i++) {
|
||||
struct vcd_module_s *module;
|
||||
module = &vcd_modules[i];
|
||||
fprintf(vcd_fd, "$scope module %s $end\n", module->name);
|
||||
|
||||
/* Declare each signal as defined in array */
|
||||
for (j = 0; j < module->number_of_signals; j++) {
|
||||
const char *signal_name;
|
||||
signal_name = module->signals_names[j];
|
||||
|
||||
if (VCD_WIRE == module->signal_type) {
|
||||
fprintf(vcd_fd, "$var wire %d %s_w %s $end\n", module->signal_size, signal_name, signal_name);
|
||||
} else if (VCD_REAL == module->signal_type) {
|
||||
fprintf(vcd_fd, "$var real %d %s_r %s $end\n", module->signal_size, signal_name, signal_name);
|
||||
} else {
|
||||
// Handle error here
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(vcd_fd, "$upscope $end\n");
|
||||
}
|
||||
|
||||
/* Init variables and functions to 0 */
|
||||
fprintf(vcd_fd, "$dumpvars\n");
|
||||
|
||||
for(i = 0; i < sizeof(vcd_modules) / sizeof(struct vcd_module_s); i++) {
|
||||
struct vcd_module_s *module;
|
||||
module = &vcd_modules[i];
|
||||
|
||||
/* Declare each signal as defined in array */
|
||||
for (j = 0; j < module->number_of_signals; j++) {
|
||||
const char *signal_name;
|
||||
signal_name = module->signals_names[j];
|
||||
|
||||
if (VCD_WIRE == module->signal_type) {
|
||||
if (module->signal_size > 1) {
|
||||
fprintf(vcd_fd, "b0 %s_w $end\n", signal_name);
|
||||
} else {
|
||||
fprintf(vcd_fd, "0%s_w $end\n", signal_name);
|
||||
}
|
||||
} else if (VCD_REAL == module->signal_type) {
|
||||
fprintf(vcd_fd, "r0 %s_r $end\n", signal_name);
|
||||
} else {
|
||||
// Handle error here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(vcd_fd, "$end\n");
|
||||
fprintf(vcd_fd, "$enddefinitions $end\n\n");
|
||||
//fflush(vcd_fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vcd_signal_dumper_dump_variable_by_name(vcd_signal_dump_variables variable_name,
|
||||
unsigned long value)
|
||||
{
|
||||
DevCheck((0 <= variable_name) && (variable_name < VCD_SIGNAL_DUMPER_VARIABLES_END),
|
||||
variable_name, VCD_SIGNAL_DUMPER_VARIABLES_END, 0);
|
||||
|
||||
if (ouput_vcd) {
|
||||
#if defined(ENABLE_VCD_FIFO)
|
||||
uint32_t write_index = vcd_get_write_index();
|
||||
|
||||
vcd_fifo.user_data[write_index].time = vcd_get_time();
|
||||
vcd_fifo.user_data[write_index].data.variable.variable_name = variable_name;
|
||||
vcd_fifo.user_data[write_index].data.variable.value = value;
|
||||
vcd_fifo.user_data[write_index].module = VCD_SIGNAL_DUMPER_MODULE_VARIABLES; // Set when all other fields are set to validate the user_data
|
||||
#else
|
||||
char binary_string[(sizeof (uint64_t) * BYTE_SIZE) + 1];
|
||||
|
||||
if (vcd_fd != NULL) {
|
||||
vcd_signal_dumper_print_time_since_start();
|
||||
|
||||
/* Set variable to value */
|
||||
uint64_to_binary(value, binary_string);
|
||||
fprintf(vcd_fd, "b%s %s_w\n", binary_string, eurecomVariablesNames[variable_name]);
|
||||
//fflush(vcd_fd);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void vcd_signal_dumper_dump_function_by_name(vcd_signal_dump_functions function_name,
|
||||
vcd_signal_dump_in_out in_out)
|
||||
{
|
||||
DevCheck((0 <= function_name) && (function_name < VCD_SIGNAL_DUMPER_FUNCTIONS_END),
|
||||
function_name, VCD_SIGNAL_DUMPER_FUNCTIONS_END, 0);
|
||||
|
||||
if (ouput_vcd) {
|
||||
#if defined(ENABLE_VCD_FIFO)
|
||||
uint32_t write_index = vcd_get_write_index();
|
||||
|
||||
vcd_fifo.user_data[write_index].time = vcd_get_time();
|
||||
vcd_fifo.user_data[write_index].data.function.function_name = function_name;
|
||||
vcd_fifo.user_data[write_index].data.function.in_out = in_out;
|
||||
vcd_fifo.user_data[write_index].module = VCD_SIGNAL_DUMPER_MODULE_FUNCTIONS; // Set when all other fields are set to validate the user_data
|
||||
#else
|
||||
|
||||
if (vcd_fd != NULL) {
|
||||
vcd_signal_dumper_print_time_since_start();
|
||||
|
||||
/* Check if we are entering or leaving the function ( 0 = leaving, 1 = entering) */
|
||||
if (in_out == VCD_FUNCTION_IN)
|
||||
/* Set event to 1 */
|
||||
fprintf(vcd_fd, "1%s_w\n", eurecomFunctionsNames[function_name]);
|
||||
else
|
||||
fprintf(vcd_fd, "0%s_w\n", eurecomFunctionsNames[function_name]);
|
||||
|
||||
//fflush(vcd_fd);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,460 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file vcd_signal_dumper.h
|
||||
* \brief Output functions call to VCD file which is readable by gtkwave.
|
||||
* \author ROUX Sebastien
|
||||
* \author S. Roux
|
||||
* \maintainer: navid nikaein
|
||||
* \date 2012 - 2104
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef VCD_SIGNAL_DUMPER_H_
|
||||
#define VCD_SIGNAL_DUMPER_H_
|
||||
|
||||
//#define ENABLE_USE_CPU_EXECUTION_TIME
|
||||
|
||||
/* WARNING: if you edit the enums below, update also string definitions in vcd_signal_dumper.c */
|
||||
typedef enum {
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB = 0,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_RU,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_RU,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_RU,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_RU,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_TX_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RUNTIME_RX_ENB,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE_RX_OFFSET,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_DIFF,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME_RX,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME_RX,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TXCNT,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RXCNT,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TX_TS,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RX_TS,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RX_HWCNT,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RX_LHWCNT,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TX_HWCNT,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TX_LHWCNT,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RX_PCK,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TX_PCK,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM_PRV,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_TX_SEQ_NUM,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_CNT,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_DUMMY_DUMP,
|
||||
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
|
||||
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
|
||||
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
|
||||
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_ALLOC_MSG,
|
||||
VCD_SIGNAL_DUMPER_VARIABLE_MP_ALLOC,
|
||||
VCD_SIGNAL_DUMPER_VARIABLE_MP_FREE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_RX,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_TX,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TIMING_ADVANCE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_ENERGY,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_THRES,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI0,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI1,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI2,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI3,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI4,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI5,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI6,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI7,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES0,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES1,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES2,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES3,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES4,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES5,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES6,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES7,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS0,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS1,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS2,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS3,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS4,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS5,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS6,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS7,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB0,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB1,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB2,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB3,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB4,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB5,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB6,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB7,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND0,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND1,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND2,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND3,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND4,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND5,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND6,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND7,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN0,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN1,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN2,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN3,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN4,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN5,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN6,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN7,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF4_SYMBOL,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RECV_IF4_SYMBOL,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF5_PKT_ID,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_RECV_IF5_PKT_ID,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_SIZE,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_ERR,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS_MISSING,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS_MISSING,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_END
|
||||
} vcd_signal_dump_variables;
|
||||
|
||||
typedef enum {
|
||||
/* softmodem signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP=0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_UE,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_UE,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_IF,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_SF9,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1,
|
||||
/* SIMULATION signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_DL_SIGNAL,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_DO_UL_SIGNAL,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_SIM_UE_TRX_READ,
|
||||
/* RRH signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TRX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TM,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX_SLEEP,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX_SLEEP,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_SLEEP,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_RF,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_RF,
|
||||
|
||||
/* PHY signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_THREAD,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD2,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD3,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD4,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD5,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD6,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_THREAD7,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING2,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING3,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING4,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING5,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING6,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING7,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PHICH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB1_ENB,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB2_ENB,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_DEDICATED_ENB,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_MSG3,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING2,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING3,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING4,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING5,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING6,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING7,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING,
|
||||
#if 1 // add for debugging losing PDSCH immediately before and after reporting CQI
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI,
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_SCRAMBLING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,
|
||||
|
||||
/* MAC signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_MACPHY_INIT,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_MACPHY_EXIT,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_RAR,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TERMINATE_RA_PROC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_CANCEL_RA_PROC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GET_DCI_SDU,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GET_DLSCH_SDU,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_MRBCH_PHY_SYNC_FAILURE,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_SR_INDICATION,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, // schedule_ue_spec
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_FILL_DLSCH_DCI,
|
||||
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_OUT_OF_SYNC_IND,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_RACH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PROCESS_RAR,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SR,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU,
|
||||
|
||||
/* RLC signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,
|
||||
// VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_IND,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_STATUS_IND,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_REQ,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_MAC_RLC_DATA_IND,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_TRY_REASSEMBLY,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_CHECK_TIMER_DAR_TIME_OUT,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR,
|
||||
|
||||
/* PDCP signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH_BUFFER,
|
||||
|
||||
/* RRC signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI,
|
||||
|
||||
/* GTPV1U signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_ENB_TASK,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_UDP_REQ,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ,
|
||||
|
||||
/* UDP signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_UDP_ENB_TASK,
|
||||
|
||||
/* MISC signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_EMU_TRANSPORT,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_RELAY_THREAD,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TEST,
|
||||
|
||||
/* IF4/IF5 signals */
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF4,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF5,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF5,
|
||||
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF,
|
||||
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_NFAPI,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,
|
||||
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_END
|
||||
} vcd_signal_dump_functions;
|
||||
|
||||
typedef enum {
|
||||
VCD_SIGNAL_DUMPER_MODULE_FREE = 0,
|
||||
|
||||
VCD_SIGNAL_DUMPER_MODULE_VARIABLES,
|
||||
VCD_SIGNAL_DUMPER_MODULE_FUNCTIONS,
|
||||
// VCD_SIGNAL_DUMPER_MODULE_UE_PROCEDURES_FUNCTIONS,
|
||||
} vcd_signal_dumper_modules;
|
||||
|
||||
typedef enum {
|
||||
VCD_FUNCTION_OUT,
|
||||
VCD_FUNCTION_IN,
|
||||
VCD_FUNCTION_LAST,
|
||||
} vcd_signal_dump_in_out;
|
||||
|
||||
typedef enum {
|
||||
VCD_REAL, // REAL = variable
|
||||
VCD_WIRE, // WIRE = Function
|
||||
} vcd_signal_type;
|
||||
|
||||
/*!
|
||||
* \brief Init function for the vcd dumper.
|
||||
* @param None
|
||||
*/
|
||||
void vcd_signal_dumper_init(char* filename);
|
||||
/*!
|
||||
* \brief Close file descriptor.
|
||||
* @param None
|
||||
*/
|
||||
void vcd_signal_dumper_close(void);
|
||||
/*!
|
||||
* \brief Create header for VCD file.
|
||||
* @param None
|
||||
*/
|
||||
void vcd_signal_dumper_create_header(void);
|
||||
/*!
|
||||
* \brief Dump state of a variable
|
||||
* @param Name of the variable to dump (see the corresponding enum)
|
||||
* @param Value of the variable to dump (type: unsigned long)
|
||||
*/
|
||||
void vcd_signal_dumper_dump_variable_by_name(vcd_signal_dump_variables variable_name,
|
||||
unsigned long value);
|
||||
/*!
|
||||
* \brief Dump function usage
|
||||
* @param Name Function name to dump (see the corresponding enum)
|
||||
* @param State: either VCD_FUNCTION_START or VCD_FUNCTION_END
|
||||
*/
|
||||
void vcd_signal_dumper_dump_function_by_name(vcd_signal_dump_functions function_name,
|
||||
vcd_signal_dump_in_out function_in_out);
|
||||
|
||||
extern int ouput_vcd;
|
||||
|
||||
#if T_TRACER
|
||||
|
||||
#include "T.h"
|
||||
|
||||
#define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(var, val) T_VCD_VARIABLE(var, val)
|
||||
#define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(var, val) T_VCD_FUNCTION(var, val)
|
||||
#else
|
||||
|
||||
#define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(var, val)
|
||||
#define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(var, val)
|
||||
|
||||
#endif /* T_TRACER */
|
||||
|
||||
#endif /* !defined (VCD_SIGNAL_DUMPER_H_) */
|
||||
|
||||
Reference in New Issue
Block a user