Commit 33cf7a27 authored by yincong's avatar yincong Committed by Haruki NAOI

fix cppcheck and Basic Simulator build NG

(cherry picked from commit a51c2f08c8699e4367ff1b95028662ce22f88b9d)

# Conflicts:
#	common/utils/T/tracer/extract.c
#	common/utils/T/tracer/extract_input_subframe.c
#	common/utils/T/tracer/extract_output_subframe.c
#	common/utils/T/tracer/hacks/dump_nack_signal.c
#	common/utils/T/tracer/hacks/multi-rru-clean.c
#	common/utils/T/tracer/record.c
#	common/utils/T/tracer/to_vcd.c
#	common/utils/itti_analyzer/libparser/xml_parse.c
#	common/utils/itti_analyzer/libui/ui_filters.c
#	common/utils/itti_analyzer/libui/ui_notifications.c
#	common/utils/msc/msc.c
#	nfapi/open-nFAPI/vnf/src/vnf_p7.c
#	nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
#	openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
#	openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
#	openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m
#	openair1/PHY/LTE_ESTIMATION/freq_domain_filters.m
#	openair1/PHY/LTE_REFSIG/gen_mod_table.m
#	openair1/PHY/LTE_REFSIG/primary_synch.m
#	openair1/PHY/TOOLS/lte_dfts.c
#	openair1/PHY/TOOLS/lte_enb_scope.c
#	openair1/PHY/TOOLS/lte_ue_scope.c
#	openair1/PHY/TOOLS/smbv.c
#	openair1/SIMULATION/LTE_PHY/Abstraction/Training/polyfit_beta_training.m
#	openair1/SIMULATION/LTE_PHY/Abstraction/Training/training_abstraction.m
#	openair1/SIMULATION/LTE_PHY/dlsim.c
#	openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
#	openair1/SIMULATION/LTE_PHY/dlsim_tm7.c
#	openair1/SIMULATION/LTE_PHY/mat2wv.m
#	openair1/SIMULATION/LTE_PHY/mbmssim.c
#	openair1/SIMULATION/LTE_PHY/pbchsim.c
#	openair1/SIMULATION/LTE_PHY/scansim.c
#	openair1/SIMULATION/LTE_PHY/syncsim.c
#	openair1/SIMULATION/LTE_PHY/ulsim.c
#	openair1/SIMULATION/TOOLS/corr_mat.m
#	openair3/TEST/EPC_TEST/generate_scenario.c
#	openair3/TEST/EPC_TEST/play_scenario_parse.c
#	targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
#	targets/RT/USER/lte-ue.c
parent 60ac40c2
......@@ -94,6 +94,11 @@ int main(int n, char **v)
exit(1);
}
if(-1 == (access(output_file,F_OK))){
creat(output_file, 0644);
}else{
chmod(output_file, 0644);
}
out = fopen(output_file, "w"); if(out==NULL){perror(output_file);exit(1);}
database = parse_database(database_filename);
......
......@@ -68,6 +68,11 @@ int main(int n, char **v)
exit(1);
}
if(-1 == (access(output_file,F_OK))){
creat(output_file, 0644);
}else{
chmod(output_file, 0644);
}
out = fopen(output_file, "w"); if(out==NULL){perror(output_file);exit(1);}
database = parse_database(database_filename);
......
......@@ -59,6 +59,11 @@ int main(int n, char **v)
if (out_filename == NULL) out = stdout;
else {
if(-1 == (access(out_filename,F_OK))){
creat(out_filename, 0644);
}else{
chmod(out_filename, 0644);
}
out = fopen(out_filename, "w");
if (out == NULL) { perror(out_filename); exit(1); }
}
......
......@@ -88,6 +88,11 @@ int main(int n, char **v) {
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
char dump[10][T_BUFFER_MAX];
event dump_ev[10];
if(-1 == (access("/tmp/dd",F_OK))){
creat("/tmp/dd", 0644);
}else{
chmod("/tmp/dd", 0644);
}
FILE *z = fopen("/tmp/dd", "w");
if (z == NULL) abort();
......@@ -120,6 +125,11 @@ int main(int n, char **v) {
if (e.type == ev_nack) {
int sf = e.e[2].i;
printf("nack %d/%d\n", e.e[1].i, sf);
if(-1 == (access("/tmp/dump.raw",F_OK))){
creat("/tmp/dump.raw", 0644);
}else{
chmod("/tmp/dump.raw", 0644);
}
FILE *f = fopen("/tmp/dump.raw", "w");
if (f == NULL) abort();
......@@ -136,6 +146,11 @@ int main(int n, char **v) {
if (e.type == ev_ack) {
int sf = e.e[2].i;
printf("ack %d/%d\n", e.e[1].i, sf);
if(-1 == (access("/tmp/dump.raw",F_OK))){
creat("/tmp/dump.raw", 0644);
}else{
chmod("/tmp/dump.raw", 0644);
}
FILE *f = fopen("/tmp/dump.raw", "w");
if (f == NULL) abort();
......
......@@ -133,6 +133,11 @@ int main(int n, char **v)
in = fopen(input_filename, "r");
if (in == NULL) { perror(input_filename); abort(); }
if(-1 == (access(output_filename,F_OK))){
creat(output_filename, 0644);
}else{
chmod(output_filename, 0644);
}
out = fopen(output_filename, "w");
if (out == NULL) { perror(output_filename); abort(); }
......
......@@ -112,6 +112,11 @@ int main(int n, char **v)
socket_send(socket, is_on, number_of_events * sizeof(int)) == -1)
abort();
if(-1 == (access(output_filename,F_OK))){
creat(output_filename, 0644);
}else{
chmod(output_filename, 0644);
}
out = fopen(output_filename, "w");
if (out == NULL) {
perror(output_filename);
......
......@@ -37,6 +37,11 @@ int start_time_inited;
void vcd_init(char *file)
{
if(-1 == (access(file,F_OK))){
creat(file, 0644);
}else{
chmod(file, 0644);
}
out = fopen(file, "w"); if (out == NULL) { perror(file); exit(1); }
}
......
......@@ -797,6 +797,11 @@ static int xml_parse_doc(xmlDocPtr doc) {
FILE *dissect_file = NULL;
if (ui_main_data.dissect_file_name != NULL) {
if(-1 == (access(ui_main_data.dissect_file_name,F_OK))){
creat(ui_main_data.dissect_file_name, 0644);
}else{
chmod(ui_main_data.dissect_file_name, 0644);
}
dissect_file = fopen (ui_main_data.dissect_file_name, "w");
}
......
......@@ -445,6 +445,11 @@ int ui_filters_file_write(const char *file_name)
return RC_FAIL;
}
if(-1 == (access(file_name,F_OK))){
creat(file_name, 0644);
}else{
chmod(file_name, 0644);
}
filter_file = fopen (file_name, "w");
if (filter_file == NULL)
{
......
......@@ -351,6 +351,11 @@ static int ui_messages_file_write(char *file_name, gboolean filtered)
return RC_FAIL;
}
if(-1 == (access(file_name,F_OK))){
creat(file_name, 0644);
}else{
chmod(file_name, 0644);
}
messages_file = fopen (file_name, "w");
if (messages_file == NULL)
{
......
......@@ -133,6 +133,11 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
fprintf(stderr, "Error in MSC log file name");
}
if(-1 == (access(msc_filename,F_OK))){
creat(msc_filename, 0644);
}else{
chmod(msc_filename, 0644);
}
g_msc_fd = fopen(msc_filename,"w");
AssertFatal(g_msc_fd != NULL, "Could not open MSC log file %s : %s", msc_filename, strerror(errno));
rv = lfds611_stack_new(&g_msc_memory_stack_p, (lfds611_atom_t)max_threadsP + 2);
......
......@@ -956,6 +956,11 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
}
#ifdef LOG
if(-1 == (access(LOGFILE_PATH2,F_OK))){
creat(LOGFILE_PATH2, 0644);
}else{
chmod(LOGFILE_PATH2, 0644);
}
fp = fopen(LOGFILE_PATH2, "a");
......
......@@ -493,6 +493,11 @@ int nfapi_vnf_p7_time(nfapi_vnf_p7_config_t* config){
// pselect timed out
#ifdef LOG
if(-1 == (access(LOGFILE_PATH,F_OK))){
creat(LOGFILE_PATH, 0644);
}else{
chmod(LOGFILE_PATH, 0644);
}
fp = fopen(LOGFILE_PATH, "a");
#endif
......
......@@ -939,7 +939,17 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
int offset8_flag=0;
#ifdef DEBUG_LOGMAP
if(-1 == (access("dump_avx2.txt",F_OK))){
creat("dump_avx2.txt", 0644);
}else{
chmod("dump_avx2.txt", 0644);
}
fdavx2 = fopen("dump_avx2.txt","w");
if(-1 == (access("dump_avx2b.txt",F_OK))){
creat("dump_avx2b.txt", 0644);
}else{
chmod("dump_avx2b.txt", 0644);
}
fdavx2b = fopen("dump_avx2b.txt","w");
printf("tc avx2_16 (y,y2) %p,%p\n",y,y2);
......
......@@ -1117,6 +1117,11 @@ uint8_t phy_threegpplte_turbo_decoder16(int16_t *y,
#endif
int offset8_flag=0;
#ifdef DEBUG_LOGMAP
if(-1 == (access("dump_sse4.txt",F_OK))){
creat("dump_sse4.txt", 0644);
}else{
chmod("dump_sse4.txt", 0644);
}
fdsse4 = fopen("dump_sse4.txt","w");
printf("tc sse4_16 (y) %p\n",y);
#endif
......
......@@ -26,6 +26,11 @@ for i=2:3
end
if(-1 == (access("filt16_32.h",F_OK))){
creat("filt16_32.h", 0644);
}else{
chmod("filt16_32.h", 0644);
}
fd = fopen("filt16_32.h","w");
for i=0:3
......
......@@ -29,6 +29,11 @@ Ftrunk8 = floor(32767*[F((2041-filter_length/2):2048) F(1:-8+filter_length/2)])
plot(Ftrunk0,'r',Ftrunk2,'b')
if(-1 == (access("filt96_32.h",F_OK))){
creat("filt96_32.h", 0644);
}else{
chmod("filt96_32.h", 0644);
}
fd = fopen("filt96_32.h","w");
fprintf(fd,"short filt96_32_0[96] = {\n");
fprintf(fd,"%d,",real(Ftrunk0(1:length(Ftrunk0)-1)));
......
......@@ -95,6 +95,11 @@ table2 = zeros(1,length(table)*2);
table2(1:2:end) = real(table);
table2(2:2:end) = imag(table);
if(-1 == (access("mod_table.h",F_OK))){
creat("mod_table.h", 0644);
}else{
chmod("mod_table.h", 0644);
}
fd = fopen("mod_table.h","w");
fprintf(fd,"#define MOD_TABLE_SIZE_SHORT %d\n", length(table)*2);
fprintf(fd,"#define MOD_TABLE_QPSK_OFFSET %d\n", 1);
......
......@@ -38,6 +38,11 @@ primary_synch2_mod2((128-35):128)=primary_synch2(1:36);
primary_synch2_mod2(2:37)=primary_synch2(37:end);
primary_synch2_time = ifft(primary_synch2_mod2)*sqrt(128);
if(-1 == (access("primary_synch.h",F_OK))){
creat("primary_synch.h", 0644);
}else{
chmod("primary_synch.h", 0644);
}
fd = fopen('primary_synch.h','w');
fprintf(fd,'short primary_synch0[144] = {');
fprintf(fd,'%d,',primary_synch0_mod(1:end-1));
......@@ -60,6 +65,11 @@ fprintf(fd,'%d};\n',primary_synch2_tab(end));
fclose(fd);
% for LEON we need to invert the endianess
if(-1 == (access("primary_synch_leon.h",F_OK))){
creat("primary_synch_leon.h", 0644);
}else{
chmod("primary_synch_leon.h", 0644);
}
fd = fopen('primary_synch_leon.h','w');
primary_synch0_tab = reshape(primary_synch0_tab,4,[]);
primary_synch0_tab = primary_synch0_tab([4 3 2 1],:);
......
......@@ -8709,7 +8709,11 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
printf("Writing %d elements of type %d to %s\n",length,format,fname);
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
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) {
......
......@@ -83,6 +83,11 @@ static void *scope_thread_eNB(void *arg) {
sched_setscheduler(0, SCHED_FIFO,&sched_param);
printf("Scope thread has priority %d\n",sched_param.sched_priority);
# ifdef ENABLE_XFORMS_WRITE_STATS
if(-1 == (access("eNB_stats.txt",F_OK))){
creat("eNB_stats.txt", 0644);
}else{
chmod("eNB_stats.txt", 0644);
}
eNB_stats = fopen("eNB_stats.txt", "w");
#endif
......
......@@ -80,6 +80,11 @@ static void *scope_thread_UE(void *arg) {
sched_setscheduler(0, SCHED_FIFO,&sched_param);
printf("Scope thread has priority %d\n",sched_param.sched_priority);
# ifdef ENABLE_XFORMS_WRITE_STATS
if(-1 == (access("UE_stats.txt",F_OK))){
creat("UE_stats.txt", 0644);
}else{
chmod("UE_stats.txt", 0644);
}
UE_stats = fopen("UE_stats.txt", "w");
#endif
......
......@@ -60,6 +60,11 @@ int smbv_init_config(const char* fname, uint16_t sequence_length)
FILE *f_ptr;
int k;
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
f_ptr = fopen(fname,"w");
if (sequence_length>4) {
......@@ -100,6 +105,11 @@ int smbv_write_config_from_frame_parms(const char* fname, LTE_DL_FRAME_PARMS *fr
FILE *f_ptr;
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
f_ptr = fopen(fname,"a");
fprintf(f_ptr, "BB:EUTR:SLEN %d\n",slen);
......@@ -187,6 +197,11 @@ int smbv_write_config_from_frame_parms(const char* fname, LTE_DL_FRAME_PARMS *fr
int smbv_configure_datalist_for_alloc(const char* fname, uint8_t alloc, uint8_t subframe, uint8_t *buffer, uint32_t len)
{
FILE *f_ptr;
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
f_ptr = fopen(fname,"a");
char strbuf[(8<<1)+1];
int i,k;
......@@ -244,6 +259,11 @@ int smbv_is_config_frame(uint32_t frame)
int smbv_configure_datalist_for_user(const char* fname, uint8_t user, uint8_t *buffer, uint32_t len)
{
FILE *f_ptr;
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
f_ptr = fopen(fname,"a");
char strbuf[(8<<1)+1];
int i,k;
......@@ -283,6 +303,11 @@ int smbv_configure_datalist_for_user(const char* fname, uint8_t user, uint8_t *b
int smbv_configure_user(const char* fname, uint8_t user, uint8_t transmission_mode, uint16_t rnti)
{
FILE *f_ptr;
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
f_ptr = fopen(fname,"a");
fprintf(f_ptr, "BB:EUTR:DL:USER%d:TXM M1\n",user);
......@@ -301,6 +326,11 @@ int smbv_configure_pdcch(const char* fname,uint8_t subframe,uint8_t num_pdcch_sy
int k;
FILE *f_ptr;
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
f_ptr = fopen(fname,"a");
fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:PCF:CREG %d\n",subframe,num_pdcch_symbols);
......@@ -324,6 +354,11 @@ int smbv_configure_common_dci(const char* fname, uint8_t subframe, const char* t
FILE *f_ptr;
void *dci_pdu = &dci_alloc->dci_pdu[0];
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
f_ptr = fopen(fname,"a");
fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:STAT ON\n",subframe);
......@@ -382,6 +417,11 @@ int smbv_configure_ue_spec_dci(const char* fname, uint8_t subframe, uint8_t user
FILE *f_ptr;
void *dci_pdu = &dci_alloc->dci_pdu[0];
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
f_ptr = fopen(fname,"a");
fprintf(f_ptr, "BB:EUTR:DL:SUBF%d:ENCC:STAT ON\n",subframe);
......
......@@ -58,6 +58,11 @@ save_out=1;
if(save_out)
if(-1 == (access('IA_polyfit_M1_MIESM.tex',F_OK))){
creat('IA_polyfit_M1_MIESM.tex', 0644);
}else{
chmod('IA_polyfit_M1_MIESM.tex', 0644);
}
fid = fopen('IA_polyfit_M1_MIESM.tex','w');
fprintf(fid,'\\documentclass[english,12pt,a4paper]{article}\n\n');
fprintf(fid,'\\usepackage{times}\n');
......
......@@ -78,6 +78,11 @@ if (save_out)
end
end
if(-1 == (access(strcat(out_fname, '.tex'),F_OK))){
creat(strcat(out_fname, '.tex'), 0644);
}else{
chmod(strcat(out_fname, '.tex'), 0644);
}
fid = fopen(strcat(out_fname, '.tex'),'w');
fprintf(fid,'\\documentclass[a4paper,conference]{IEEEtran}\n');
fprintf(fid,'\\usepackage{epsfig}\n');
......
......@@ -1032,6 +1032,11 @@ int main(int argc, char **argv) {
else
sprintf(bler_fname,"bler_tx%d_chan%d_nrx%d_mcs%d.csv",transmission_mode,channel_model,n_rx,mcs1);
if(-1 == (access(bler_fname,F_OK))){
creat(bler_fname, 0644);
}else{
chmod(bler_fname, 0644);
}
bler_fd = fopen(bler_fname,"w");
if (bler_fd==NULL) {
......@@ -1051,6 +1056,11 @@ int main(int argc, char **argv) {
sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv",
N_RB_DL,mcs1,n_tx_phy,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode);
//mkdir(dirname,0777);
if(-1 == (access(time_meas_fname,F_OK))){
creat(time_meas_fname, 0644);
}else{
chmod(time_meas_fname, 0644);
}
time_meas_fd = fopen(time_meas_fname,"w");
if (time_meas_fd==NULL) {
......@@ -1062,6 +1072,11 @@ int main(int argc, char **argv) {
if(abstx) {
// CSV file
sprintf(csv_fname,"dataout_tx%d_u2%d_mcs%d_chan%d_nsimus%d_R%d.m",transmission_mode,dual_stream_UE,mcs1,channel_model,n_frames,num_rounds);
if(-1 == (access(csv_fname,F_OK))){
creat(csv_fname, 0644);
}else{
chmod(csv_fname, 0644);
}
csv_fd = fopen(csv_fname,"w");
if (csv_fd==NULL) {
......@@ -1075,6 +1090,11 @@ int main(int argc, char **argv) {
/*
//sprintf(tikz_fname, "second_bler_tx%d_u2=%d_mcs%d_chan%d_nsimus%d.tex",transmission_mode,dual_stream_UE,mcs,channel_model,n_frames);
sprintf(tikz_fname, "second_bler_tx%d_u2%d_mcs%d_chan%d_nsimus%d",transmission_mode,dual_stream_UE,mcs,channel_model,n_frames);
if(-1 == (access(tikz_fname,F_OK)){
creat(tikz_fname, 0644);
}else{
chmod(tikz_fname, 0644);
}
tikz_fd = fopen(tikz_fname,"w");
//fprintf(tikz_fd,"\\addplot[color=red, mark=o] plot coordinates {");
switch (mcs)
......
......@@ -857,6 +857,11 @@ int main(int argc, char **argv)
sprintf(rankadapt_fname,"rank_adapt0_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_sh%d_connum_%d.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, cond_num_threshold);
}
if(-1 == (access(rankadapt_fname,F_OK))){
creat(rankadapt_fname, 0644);
}else{
chmod(rankadapt_fname, 0644);
}
rankadapt_fd = fopen(rankadapt_fname,"w");
if (rankadapt_fd==NULL) {
fprintf(stderr,"Cannot create file %s!\n",rankadapt_fname);
......@@ -868,6 +873,11 @@ int main(int argc, char **argv)
fprintf(rankadapt_fd,"SNR; rank_adapt; clsm_counter; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_tb0; err0_tb1; trials_tb0_r0; trials_tb1_r0; deact_tb0_r0; deact_tb1_r0; ret_both0; ret_one0; err1_tb0; err1_tb1; trials_tb0_r1; trials_tb1_r1; deact_tb0_r1; deact_tb1_r1; ret_both1; ret_one1; err2_tb0; err2_tb1; trials_tb0_r2; trials1_tb1_r2; deact_tb0_r2; deact_tb1_r2; ret_both2; ret_one2; err3_tb0; err3_tb1; trials_tb0_r3; trials_tb1_r3; th_tb0_r0; th_tb1_r0; th_sum_r0; th_tb0_r1; th_tb1_r1; th_sum_r1; th_tb0_r2; th_tb1_r2; th_sum_r2; th_tb0_r3; th_tb1_r3; th_sum_r3; tot_th\n");
}
if(-1 == (access(bler_fname,F_OK))){
creat(bler_fname, 0644);
}else{
chmod(bler_fname, 0644);
}
bler_fd = fopen(bler_fname,"w");
if (bler_fd==NULL) {
fprintf(stderr,"Cannot create file %s!\n",bler_fname);
......@@ -895,6 +905,11 @@ int main(int argc, char **argv)
sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv",
N_RB_DL,mcs1,n_tx_phy,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode);
//mkdir(dirname,0777);
if(-1 == (access(time_meas_fname,F_OK))){
creat(time_meas_fname, 0644);
}else{
chmod(time_meas_fname, 0644);
}
time_meas_fd = fopen(time_meas_fname,"w");
if (time_meas_fd==NULL) {
fprintf(stderr,"Cannot create file %s!\n",time_meas_fname);
......@@ -914,6 +929,11 @@ int main(int argc, char **argv)
else
sprintf(csv_fname,"dout_tx%d_r%d_ch%d_%d_rnd%d_mcs%d_mcsi%d_sh%d_%d_csi.m",transmission_mode,rx_type, channel_model, n_frames, num_rounds, mcs1, mcs2, dlsch_demod_shift, n_ch_rlz);
if(-1 == (access(csv_fname,F_OK))){
creat(csv_fname, 0644);
}else{
chmod(csv_fname, 0644);
}
csv_fd = fopen(csv_fname,"w");
fprintf(csv_fd,"data_all%d=[",mcs1);
if (csv_fd==NULL) {
......
......@@ -639,6 +639,11 @@ int main(int argc, char **argv) {
else
sprintf(bler_fname,"bler_tm%d_chan%d_perfce%d_ntx%d_nrx%d_mcs%d.csv",transmission_mode,channel_model,perfect_ce,n_tx_phy,n_rx,mcs1);
if(-1 == (access(bler_fname,F_OK))){
creat(bler_fname, 0644);
}else{
chmod(bler_fname, 0644);
}
bler_fd = fopen(bler_fname,"w");
if (bler_fd==NULL) {
......@@ -658,6 +663,11 @@ int main(int argc, char **argv) {
sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv",
N_RB_DL,mcs1,n_tx_phy,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode);
//mkdir(dirname,0777);
if(-1 == (access(time_meas_fname,F_OK))){
creat(time_meas_fname, 0644);
}else{
chmod(time_meas_fname, 0644);
}
time_meas_fd = fopen(time_meas_fname,"w");
if (time_meas_fd==NULL) {
......@@ -669,6 +679,11 @@ int main(int argc, char **argv) {
if(abstx) {
// CSV file
sprintf(csv_fname,"dataout_tx%d_u2%d_mcs%d_chan%d_nsimus%d_R%d.m",transmission_mode,dual_stream_UE,mcs1,channel_model,n_frames,num_rounds);
if(-1 == (access(csv_fname,F_OK))){
creat(csv_fname, 0644);
}else{
chmod(csv_fname, 0644);
}
csv_fd = fopen(csv_fname,"w");
if (csv_fd==NULL) {
fprintf(stderr,"Cannot create file %s!\n",csv_fname);
......@@ -680,6 +695,11 @@ int main(int argc, char **argv) {
/*
//sprintf(tikz_fname, "second_bler_tx%d_u2=%d_mcs%d_chan%d_nsimus%d.tex",transmission_mode,dual_stream_UE,mcs,channel_model,n_frames);
sprintf(tikz_fname, "second_bler_tx%d_u2%d_mcs%d_chan%d_nsimus%d",transmission_mode,dual_stream_UE,mcs,channel_model,n_frames);
if(-1 == (access(tikz_fname,F_OK)){
creat(tikz_fname, 0644);
}else{
chmod(tikz_fname, 0644);
}
tikz_fd = fopen(tikz_fname,"w");
//fprintf(tikz_fd,"\\addplot[color=red, mark=o] plot coordinates {");
switch (mcs)
......
......@@ -58,6 +58,11 @@ clear vicData;
viDataInterleaved = int16(viDataInterleaved);
% Write waveform file
if(-1 == (access(sFilename,F_OK))){
creat(sFilename, 0644);
}else{
chmod(sFilename, 0644);
}
fid = fopen(sFilename,'w');
fprintf(fid,'%s','{TYPE: SMU-WV,0}');
fprintf(fid,'%s','{COMMENT: Generated by mat2wv.m}');
......
......@@ -243,6 +243,11 @@ int main(int argc, char **argv) {
else
sprintf(fname,"embms_awgn_%d_%d.m",mcs,N_RB_DL);
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
if (!(fd = fopen(fname,"w"))) {
printf("Cannot open %s, check permissions\n",fname);
exit(-1);
......
......@@ -110,6 +110,11 @@ int main(int argc, char **argv) {
switch (c) {
case 'f':
write_output_file=1;
if(-1 == (access(optarg,F_OK))){
creat(optarg, 0644);
}else{
chmod(optarg, 0644);
}
output_fd = fopen(optarg,"w");
if (output_fd==NULL) {
......
......@@ -109,6 +109,11 @@ int main(int argc, char **argv) {
switch (c) {
case 'f':
write_output_file=1;
if(-1 == (access(optarg,F_OK))){
creat(optarg, 0644);
}else{
chmod(optarg, 0644);
}
output_fd = fopen(optarg,"w");
if (output_fd==NULL) {
......
......@@ -400,6 +400,11 @@ int main(int argc, char **argv) {
break;
case 'f':
if(-1 == (access(optarg,F_OK))){
creat(optarg, 0644);
}else{
chmod(optarg, 0644);
}
output_fd = fopen(optarg,"w");
write_output_file=1;
break;
......
......@@ -643,6 +643,11 @@ int main(int argc, char **argv) {
txdata = UE->common_vars.txdata;
nsymb = (eNB->frame_parms.Ncp == NORMAL) ? 14 : 12;
sprintf(bler_fname,"ULbler_mcs%d_nrb%d_ChannelModel%d_nsim%d.csv",mcs,nb_rb,chMod,n_frames);
if(-1 == (access(bler_fname,F_OK))){
creat(bler_fname, 0644);
}else{
chmod(bler_fname, 0644);
}
bler_fd = fopen(bler_fname,"w");
if (bler_fd==NULL) {
......@@ -662,6 +667,11 @@ int main(int argc, char **argv) {
//mkdir(dirname, 0777);
sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv",
N_RB_DL,mcs,n_rx,channel_model_input,transmission_m);
if(-1 == (access(time_meas_fname,F_OK))){
creat(time_meas_fname, 0644);
}else{
chmod(time_meas_fname, 0644);
}
time_meas_fd = fopen(time_meas_fname,"w");
if (time_meas_fd==NULL) {
......@@ -673,6 +683,11 @@ int main(int argc, char **argv) {
if(abstx) {
// CSV file
sprintf(csv_fname,"EULdataout_tx%d_mcs%d_nbrb%d_chan%d_nsimus%d_eren.m",transmission_m,mcs,nb_rb,chMod,n_frames);
if(-1 == (access(csv_fname,F_OK))){
creat(csv_fname, 0644);
}else{
chmod(csv_fname, 0644);
}
csv_fdUL = fopen(csv_fname,"w");
if (csv_fdUL == NULL) {
......@@ -859,6 +874,11 @@ int main(int argc, char **argv) {
// printf("UL frame %d/subframe %d, harq_pid %d\n",UE->frame,subframe,harq_pid);
if (input_fdUL == NULL) {
if (n_frames == 1) {
if(-1 == (access("ulsch_trchUL.txt",F_OK))){
creat("ulsch_trchUL.txt", 0644);
}else{
chmod("ulsch_trchUL.txt", 0644);
}
trch_out_fdUL= fopen("ulsch_trchUL.txt","w");
for (i=0; i<input_buffer_length; i++) {
......
......@@ -56,6 +56,11 @@ R22_sqrt_int(1:2:end,:,:) = real(R22_sqrt);
R22_sqrt_int(2:2:end,:,:) = imag(R22_sqrt);
%%
if(-1 == ('scm_corrmat.h',F_OK))){
creat('scm_corrmat.h', 0644);
}else{
chmod('scm_corrmat.h', 0644);
}
fid = fopen('scm_corrmat.h','w');
fprintf(fid,'double R22_sqrt[][] = {\n');
for i=1:size(Gamma,3)
......
......@@ -43,6 +43,10 @@ Description Memory access utilities
#include <stdio.h> // fopen, fread, fclose
#include <stdlib.h> // getenv, malloc, free
#include <string.h> // strlen
#include <unistd.h> //access
#include <sys/types.h>//creat
#include <sys/stat.h>//creat
#include <fcntl.h>//creat
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
......
......@@ -238,6 +238,11 @@ int generate_test_scenario(const char const * test_nameP, const char const * pdm
sprintf(test_scenario_filename,"%s",pdml_in_basenameP);
if (strip_extension(test_scenario_filename) > 0) {
strcat(test_scenario_filename, ".xml");
if(-1 == (access(test_scenario_filename,F_OK))){
creat(test_scenario_filename, 0644);
}else{
chmod(test_scenario_filename, 0644);
}
test_scenario_file = fopen( test_scenario_filename, "w+");
if (NULL != test_scenario_file) {
xsltSaveResultToFile(test_scenario_file, res, cur);
......
......@@ -564,6 +564,11 @@ int et_generate_xml_scenario(
sprintf((char *)tsml_out_scenario_filename,"%s",xml_in_scenario_filename);
if (et_strip_extension((char *)tsml_out_scenario_filename) > 0) {
strcat((char *)tsml_out_scenario_filename, ".tsml");
if(-1 == (access(tsml_out_scenario_filename,F_OK))){
creat(tsml_out_scenario_filename, 0644);
}else{
chmod(tsml_out_scenario_filename, 0644);
}
play_scenario_file = fopen( tsml_out_scenario_filename, "w+");
if (NULL != play_scenario_file) {
xsltSaveResultToFile(play_scenario_file, res, cur);
......
......@@ -379,6 +379,11 @@ static void trx_usrp_end(openair0_device *device) {
#if defined(USRP_REC_PLAY)
if (u_sf_mode == 1) { // subframes store
if(-1 == (access(u_sf_filename,F_OK))){
creat(u_sf_filename, 0644);
}else{
chmod(u_sf_filename, 0644);
}
pFile = fopen (u_sf_filename,"wb+");
if (pFile == NULL) {
......
......@@ -674,6 +674,11 @@ static void *UE_thread_synch(void *arg) {
FILE *fd;
if ((UE->proc.proc_rxtx[0].frame_rx&1) == 0) { // this guarantees SIB1 is present
if(-1 == (access("rxsig_frame0.dat",F_OK))){
creat("rxsig_frame0.dat", 0644);
}else{
chmod("rxsig_frame0.dat", 0644);
}
if ((fd = fopen("rxsig_frame0.dat","w")) != NULL) {
fwrite((void *)&UE->common_vars.rxdata[0][0],
sizeof(int32_t),
......@@ -705,7 +710,11 @@ static void *UE_thread_synch(void *arg) {
if (abs(freq_offset) > 7500) {
LOG_I( PHY, "[initial_sync] No cell synchronization found, abandoning\n" );
FILE *fd;
if(-1 == (access("rxsig_frame0.dat",F_OK))){
creat("rxsig_frame0.dat", 0644);
}else{
chmod("rxsig_frame0.dat", 0644);
}
if ((fd = fopen("rxsig_frame0.dat","w"))!=NULL) {
fwrite((void *)&UE->common_vars.rxdata[0][0],
sizeof(int32_t),
......
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