Commit 3199b815 authored by hardy's avatar hardy

Merge remote-tracking branch 'origin/enhance-rfsim' into integration_2021_wk08

parents 90d6a57a c910668e
...@@ -331,9 +331,10 @@ void end_configmodule(void) { ...@@ -331,9 +331,10 @@ void end_configmodule(void) {
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs); printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
for(int i=0; i<cfgptr->numptrs ; i++) { for(int i=0; i<cfgptr->numptrs ; i++) {
if (cfgptr->ptrs[i] != NULL) { if (cfgptr->ptrs[i] != NULL && cfgptr->ptrsAllocated[i] == true) {
free(cfgptr->ptrs[i]); free(cfgptr->ptrs[i]);
cfgptr->ptrs[i]=NULL; cfgptr->ptrs[i]=NULL;
cfgptr->ptrsAllocated[i] = false;
} }
} }
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include "common/config/config_paramdesc.h" #include "common/config/config_paramdesc.h"
#include "common/utils/T/T.h" #include "common/utils/T/T.h"
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2... #define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
...@@ -74,6 +76,7 @@ typedef struct configmodule_interface { ...@@ -74,6 +76,7 @@ typedef struct configmodule_interface {
uint32_t numptrs; uint32_t numptrs;
uint32_t rtflags; uint32_t rtflags;
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS]; char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
bool ptrsAllocated[CONFIG_MAX_ALLOCATEDPTRS];
} configmodule_interface_t; } configmodule_interface_t;
#ifdef CONFIG_LOADCONFIG_MAIN #ifdef CONFIG_LOADCONFIG_MAIN
......
...@@ -62,6 +62,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { ...@@ -62,6 +62,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) { if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr; config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
config_get_if()->ptrsAllocated[config_get_if()->numptrs] = true;
config_get_if()->numptrs++; config_get_if()->numptrs++;
} }
} else { } else {
...@@ -82,7 +83,9 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { ...@@ -82,7 +83,9 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
} }
if (*ptr == NULL) { if (*ptr == NULL) {
*ptr = malloc(length>40?length:40); // LTS: dummy fix, waiting Francois full fix in 4G branch *ptr = malloc(length>40?length:40);
// LTS: dummy fix, waiting Francois full fix in 4G branch
// the issue is we don't know at this point the size we will get
if ( *ptr != NULL) { if ( *ptr != NULL) {
memset(*ptr,0,length); memset(*ptr,0,length);
......
...@@ -346,6 +346,7 @@ int config_libconfig_init(char *cfgP[], int numP) { ...@@ -346,6 +346,7 @@ int config_libconfig_init(char *cfgP[], int numP) {
libconfig_privdata.configfile = strdup((char *)cfgP[0]); libconfig_privdata.configfile = strdup((char *)cfgP[0]);
config_get_if()->numptrs=0; config_get_if()->numptrs=0;
memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS); memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS);
memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated));
/* Read the file. If there is an error, report it and exit. */ /* Read the file. If there is an error, report it and exit. */
if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) { if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
......
...@@ -88,16 +88,19 @@ int write_file_matlab(const char *fname, ...@@ -88,16 +88,19 @@ int write_file_matlab(const char *fname,
void *data, void *data,
int length, int length,
int dec, int dec,
char format) unsigned int format)
{ {
FILE *fp=NULL; FILE *fp=NULL;
int i; int i;
AssertFatal((format&~MATLAB_RAW) <16,"");
if (data == NULL) if (data == NULL)
return -1; return -1;
//printf("Writing %d elements of type %d to %s\n",length,format,fname); //printf("Writing %d elements of type %d to %s\n",length,format,fname);
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) { if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
fp = fopen(fname,"a+"); fp = fopen(fname,"a+");
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) { } else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
...@@ -109,6 +112,32 @@ int write_file_matlab(const char *fname, ...@@ -109,6 +112,32 @@ int write_file_matlab(const char *fname,
return(-1); return(-1);
} }
if ( (format&MATLAB_RAW) == MATLAB_RAW ) {
int sz[16]={sizeof(short), 2*sizeof(short),
sizeof(int), 2*sizeof(int),
sizeof(char), 2*sizeof(char),
sizeof(long long),
sizeof(double), 2*sizeof(double),
sizeof(unsigned char),
sizeof(short),
sizeof(short),
sizeof(short),
sizeof(short),
sizeof(short),
sizeof(short)
};
int eltSz= sz[format&~MATLAB_RAW];
if (dec==1)
fwrite(data, eltSz, length, fp);
else
for (i=0; i<length; i+=dec)
fwrite(data+i*eltSz, eltSz, 1, fp);
fclose(fp);
return(0);
}
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
fprintf(fp,"%s = [",vname); fprintf(fp,"%s = [",vname);
...@@ -214,6 +243,8 @@ int write_file_matlab(const char *fname, ...@@ -214,6 +243,8 @@ int write_file_matlab(const char *fname,
case 12 : // case eren for log2_maxh real unsigned 8 bit case 12 : // case eren for log2_maxh real unsigned 8 bit
fprintf(fp,"%d \n",((unsigned char *)&data)[0]); fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
break; break;
default:
AssertFatal(false, "unknown dump format: %d\n", format);
} }
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) { if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
......
...@@ -336,7 +336,25 @@ typedef struct { ...@@ -336,7 +336,25 @@ typedef struct {
@param dec decimation level @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) @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); #define MATLAB_RAW (1<<31)
#define MATLAB_SHORT 0
#define MATLAB_CSHORT 1
#define MATLAB_INT 2
#define MATLAB_CINT 3
#define MATLAB_INT8 4
#define MATLAB_CINT8 5
#define MATLAB_LLONG 6
#define MATLAB_DOUBLE 7
#define MATLAB_CDOUBLE 8
#define MATLAB_UINT8 9
#define MATLEB_EREN1 10
#define MATLEB_EREN2 11
#define MATLEB_EREN3 12
#define MATLAB_CSHORT_BRACKET1 13
#define MATLAB_CSHORT_BRACKET2 14
#define MATLAB_CSHORT_BRACKET3 15
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format);
/*----------------macro definitions for reading log configuration from the config module */ /*----------------macro definitions for reading log configuration from the config module */
#define CONFIG_STRING_LOG_PREFIX "log_config" #define CONFIG_STRING_LOG_PREFIX "log_config"
......
...@@ -557,11 +557,14 @@ int main( int argc, char **argv ) { ...@@ -557,11 +557,14 @@ int main( int argc, char **argv ) {
init_NR_UE_threads(1); init_NR_UE_threads(1);
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
printf("UE threads created by %ld\n", gettid()); printf("UE threads created by %ld\n", gettid());
// wait for end of program // wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n"); printf("TYPE <CTRL-C> TO TERMINATE\n");
// Sleep a while before checking all parameters have been used
// Some are used directly in external threads, asynchronously
sleep(20);
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
while(true) while(true)
sleep(3600); sleep(3600);
......
...@@ -225,6 +225,8 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye ...@@ -225,6 +225,8 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye
} }
static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) {
if ( values == NULL )
return;
fl_winset(FL_ObjWin(graph->graph)); fl_winset(FL_ObjWin(graph->graph));
const int samplesPerPixel=datasize/graph->w; const int samplesPerPixel=datasize/graph->w;
int displayPart=graph->waterFallh-ScaleZone; int displayPart=graph->waterFallh-ScaleZone;
......
...@@ -302,6 +302,7 @@ void ue_ip_change_rx_flags(struct net_device *dev_pP, int flagsP) { ...@@ -302,6 +302,7 @@ void ue_ip_change_rx_flags(struct net_device *dev_pP, int flagsP) {
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
void ue_ip_tx_timeout(struct net_device *dev_pP, unsigned int txqueue) void ue_ip_tx_timeout(struct net_device *dev_pP, unsigned int txqueue)
#else #else
......
...@@ -105,9 +105,10 @@ typedef enum { ...@@ -105,9 +105,10 @@ typedef enum {
ADRV9371_ZC706_DEV, ADRV9371_ZC706_DEV,
/*!\brief device is UEDv2 */ /*!\brief device is UEDv2 */
UEDv2_DEV, UEDv2_DEV,
RFSIMULATOR,
MAX_RF_DEV_TYPE MAX_RF_DEV_TYPE
} dev_type_t; } dev_type_t;
#define DEVTYPE_NAMES {"","EXMIMO","USRP B200","USRP X300","USRP N300","BLADERF","LMSSDR","IRIS","No HW","ADRV9371_ZC706","UEDv2"} #define DEVTYPE_NAMES {"","EXMIMO","USRP B200","USRP X300","USRP N300","BLADERF","LMSSDR","IRIS","No HW","ADRV9371_ZC706","UEDv2", "RFSIMULATOR"}
/*!\brief transport protocol types /*!\brief transport protocol types
*/ */
typedef enum { typedef enum {
...@@ -491,15 +492,11 @@ struct openair0_device_t { ...@@ -491,15 +492,11 @@ struct openair0_device_t {
typedef int(*oai_device_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg); typedef int(*oai_device_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg);
/* type of transport init function, implemented in shared lib */ /* type of transport init function, implemented in shared lib */
typedef int(*oai_transport_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params); typedef int(*oai_transport_initfunc_t)(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t *eth_params);
#define UE_MAGICDL_FDD 0xA5A5A5A5A5A5A5A5 // UE DL FDD record #define UE_MAGICDL 0xA5A5A5A5A5A5A5A5 // UE DL FDD record
#define UE_MAGICUL_FDD 0x5A5A5A5A5A5A5A5A // UE UL FDD record #define UE_MAGICUL 0x5A5A5A5A5A5A5A5A // UE UL FDD record
#define UE_MAGICDL_TDD 0xA6A6A6A6A6A6A6A6 // UE DL TDD record
#define UE_MAGICUL_TDD 0x6A6A6A6A6A6A6A6A // UE UL TDD record
#define ENB_MAGICDL_FDD 0xB5B5B5B5B5B5B5B5 // eNB DL FDD record #define ENB_MAGICDL 0xB5B5B5B5B5B5B5B5 // eNB DL FDD record
#define ENB_MAGICUL_FDD 0x5B5B5B5B5B5B5B5B // eNB UL FDD record #define ENB_MAGICUL 0x5B5B5B5B5B5B5B5B // eNB UL FDD record
#define ENB_MAGICDL_TDD 0xB6B6B6B6B6B6B6B6 // eNB DL TDD record
#define ENB_MAGICUL_TDD 0x6B6B6B6B6B6B6B6B // eNB UL TDD record
#define OPTION_LZ4 0x00000001 // LZ4 compression (option_value is set to compressed size) #define OPTION_LZ4 0x00000001 // LZ4 compression (option_value is set to compressed size)
...@@ -516,19 +513,6 @@ typedef struct { ...@@ -516,19 +513,6 @@ typedef struct {
uint32_t option_flag; // Option flag uint32_t option_flag; // Option flag
} samplesBlockHeader_t; } samplesBlockHeader_t;
#define UE_MAGICDL_FDD 0xA5A5A5A5A5A5A5A5 // UE DL FDD record
#define UE_MAGICUL_FDD 0x5A5A5A5A5A5A5A5A // UE UL FDD record
#define UE_MAGICDL_TDD 0xA6A6A6A6A6A6A6A6 // UE DL TDD record
#define UE_MAGICUL_TDD 0x6A6A6A6A6A6A6A6A // UE UL TDD record
#define ENB_MAGICDL_FDD 0xB5B5B5B5B5B5B5B5 // eNB DL FDD record
#define ENB_MAGICUL_FDD 0x5B5B5B5B5B5B5B5B // eNB UL FDD record
#define ENB_MAGICDL_TDD 0xB6B6B6B6B6B6B6B6 // eNB DL TDD record
#define ENB_MAGICUL_TDD 0x6B6B6B6B6B6B6B6B // eNB UL TDD record
#define OPTION_LZ4 0x00000001 // LZ4 compression (option_value is set to compressed size)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment