new set of cppcheck fixes
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
#include "LAYER2/MAC/vars.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif
|
||||
|
||||
#include "OCG_vars.h"
|
||||
@@ -58,11 +58,8 @@ int32_t dummy2[2048*14];
|
||||
int32_t dummy3[2048*14];
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,aa;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1;
|
||||
uint8_t snr1set=0;
|
||||
@@ -81,127 +78,119 @@ int main(int argc, char **argv)
|
||||
int trial, n_trials, ntrials=1, n_errors,n_errors2,n_alamouti;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *eNB2UE,*eNB2UE1 = NULL,*eNB2UE2 = NULL;
|
||||
uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
|
||||
uint8_t extended_prefix_flag=0;
|
||||
int8_t interf1=-21,interf2=-21;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
FILE *input_fd=NULL,*pbch_file_fd=NULL;
|
||||
char input_val_str[50],input_val_str2[50];
|
||||
// double input_val1,input_val2;
|
||||
// uint16_t amask=0;
|
||||
uint8_t frame_mod4,num_pdcch_symbols = 0;
|
||||
uint16_t NB_RB=25;
|
||||
|
||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||
|
||||
//DCI_ALLOC_t dci_alloc[8];
|
||||
uint8_t abstraction_flag=0;//,calibration_flag=0;
|
||||
double pbch_sinr;
|
||||
int pbch_tx_ant;
|
||||
uint8_t N_RB_DL=25,osf=1;
|
||||
|
||||
unsigned char frame_type = 0;
|
||||
unsigned char pbch_phase = 0;
|
||||
|
||||
#ifdef XFORMS
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
#endif
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
logInit();
|
||||
number_of_cards = 1;
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:N:F:GR:O:dP:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
frame_type = 1;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
case 'd':
|
||||
frame_type = 1;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
case 'i':
|
||||
interf1=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
case 'j':
|
||||
interf2=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
interf1=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
interf2=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 't':
|
||||
Td= atof(optarg);
|
||||
break;
|
||||
*/
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'r':
|
||||
@@ -212,111 +201,111 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
case 'A':
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
// case 'C':
|
||||
// calibration_flag=1;
|
||||
// msg("Running Abstraction calibration for Bias removal\n");
|
||||
// break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
// printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
// printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +313,6 @@ int main(int argc, char **argv)
|
||||
n_tx=2;
|
||||
|
||||
lte_param_init(n_tx, n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,3,N_RB_DL,0,osf,0);
|
||||
|
||||
eNB1 = malloc(sizeof(PHY_VARS_eNB));
|
||||
eNB2 = malloc(sizeof(PHY_VARS_eNB));
|
||||
UE->measurements.n_adj_cells=2;
|
||||
@@ -334,19 +322,16 @@ int main(int argc, char **argv)
|
||||
for (i=0; i<3; i++)
|
||||
lte_gold(&eNB->frame_parms,UE->lte_gold_table[i],Nid_cell+i);
|
||||
|
||||
memcpy((void*)&eNB1->frame_parms,(void*)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
memcpy((void *)&eNB1->frame_parms,(void *)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
eNB1->frame_parms.Nid_cell=Nid_cell+1;
|
||||
eNB1->frame_parms.nushift=(Nid_cell+1)%6;
|
||||
eNB1->Mod_id=1;
|
||||
|
||||
memcpy((void*)&eNB2->frame_parms,(void*)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
memcpy((void *)&eNB2->frame_parms,(void *)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
eNB2->frame_parms.Nid_cell=Nid_cell+2;
|
||||
eNB2->frame_parms.nushift=(Nid_cell+2)%6;
|
||||
eNB2->Mod_id=2;
|
||||
|
||||
phy_init_lte_eNB(eNB1,0,0);
|
||||
phy_init_lte_eNB(eNB2,0,0);
|
||||
|
||||
#ifdef XFORMS
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
@@ -362,38 +347,27 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
|
||||
|
||||
txdata = eNB->common_vars.txdata[0];
|
||||
txdata1 = eNB1->common_vars.txdata[0];
|
||||
txdata2 = eNB2->common_vars.txdata[0];
|
||||
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
s_re1 = malloc(2*sizeof(double*));
|
||||
s_im1 = malloc(2*sizeof(double*));
|
||||
s_re2 = malloc(2*sizeof(double*));
|
||||
s_im2 = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
r_re1 = malloc(2*sizeof(double*));
|
||||
r_im1 = malloc(2*sizeof(double*));
|
||||
r_re2 = malloc(2*sizeof(double*));
|
||||
r_im2 = malloc(2*sizeof(double*));
|
||||
|
||||
s_re = malloc(2*sizeof(double *));
|
||||
s_im = malloc(2*sizeof(double *));
|
||||
s_re1 = malloc(2*sizeof(double *));
|
||||
s_im1 = malloc(2*sizeof(double *));
|
||||
s_re2 = malloc(2*sizeof(double *));
|
||||
s_im2 = malloc(2*sizeof(double *));
|
||||
r_re = malloc(2*sizeof(double *));
|
||||
r_im = malloc(2*sizeof(double *));
|
||||
r_re1 = malloc(2*sizeof(double *));
|
||||
r_im1 = malloc(2*sizeof(double *));
|
||||
r_re2 = malloc(2*sizeof(double *));
|
||||
r_im2 = malloc(2*sizeof(double *));
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d, interf (%d,%d)\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb,interf1,interf2);
|
||||
|
||||
printf("eNB1->common_vars.txdataF[0][0] = %p\n",
|
||||
eNB1->common_vars.txdataF[0][0]);
|
||||
|
||||
|
||||
DLSCH_alloc_pdu2.rah = 0;
|
||||
DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC;
|
||||
DLSCH_alloc_pdu2.TPC = 0;
|
||||
@@ -405,12 +379,11 @@ int main(int argc, char **argv)
|
||||
DLSCH_alloc_pdu2.rv1 = 0;
|
||||
// Forget second codeword
|
||||
DLSCH_alloc_pdu2.tpmi = (transmission_mode==6 ? 5 : 0) ; // precoding
|
||||
|
||||
eNB2UE = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
@@ -419,8 +392,8 @@ int main(int argc, char **argv)
|
||||
eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
4,
|
||||
0);
|
||||
@@ -429,20 +402,18 @@ int main(int argc, char **argv)
|
||||
eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
8,
|
||||
0);
|
||||
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -455,7 +426,6 @@ int main(int argc, char **argv)
|
||||
bzero(s_re2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_im2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
|
||||
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -487,7 +457,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (input_fd==NULL) {
|
||||
|
||||
// for (i=0;i<6;i++)
|
||||
// pbch_pdu[i] = i;
|
||||
pbch_pdu[0]=100;
|
||||
@@ -515,7 +484,6 @@ int main(int argc, char **argv)
|
||||
&eNB->frame_parms,
|
||||
(eNB->frame_parms.Ncp==0) ? 5 : 4,
|
||||
10);
|
||||
|
||||
} else {
|
||||
generate_sss(eNB->common_vars.txdataF[0],
|
||||
AMP,
|
||||
@@ -537,8 +505,6 @@ int main(int argc, char **argv)
|
||||
&eNB->frame_parms,
|
||||
2,
|
||||
12);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -552,16 +518,12 @@ int main(int argc, char **argv)
|
||||
dci_alloc[1].L = 3;
|
||||
dci_alloc[1].rnti = 0x1234;
|
||||
*/
|
||||
|
||||
printf("Generating PBCH for mode1_flag = %d\n", eNB->frame_parms.mode1_flag);
|
||||
|
||||
|
||||
generate_pilots(eNB,
|
||||
eNB->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
/*
|
||||
num_pdcch_symbols = generate_dci_top(1,
|
||||
dci_alloc,
|
||||
@@ -572,7 +534,6 @@ int main(int argc, char **argv)
|
||||
0);
|
||||
*/
|
||||
|
||||
|
||||
if (num_pdcch_symbols<3) {
|
||||
printf("Less than 3 pdcch symbols\n");
|
||||
// exit(-1);
|
||||
@@ -584,7 +545,7 @@ int main(int argc, char **argv)
|
||||
dummybuf[2] = dummy2;
|
||||
dummybuf[3] = dummy3;
|
||||
generate_pbch(&eNB->pbch,
|
||||
(int32_t**)dummybuf,
|
||||
(int32_t **)dummybuf,
|
||||
AMP,
|
||||
&eNB->frame_parms,
|
||||
pbch_pdu,
|
||||
@@ -618,15 +579,12 @@ int main(int argc, char **argv)
|
||||
eNB1->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
generate_pbch(&eNB1->pbch,
|
||||
eNB1->common_vars.txdataF[0],
|
||||
AMP,
|
||||
&eNB1->frame_parms,
|
||||
pbch_pdu,
|
||||
0);
|
||||
|
||||
}
|
||||
|
||||
if (interf2>-20) {
|
||||
@@ -638,27 +596,19 @@ int main(int argc, char **argv)
|
||||
0);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
generate_pilots(eNB2,
|
||||
eNB2->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
generate_pbch(&eNB2->pbch,
|
||||
eNB2->common_vars.txdataF[0],
|
||||
AMP,
|
||||
&eNB2->frame_parms,
|
||||
pbch_pdu,
|
||||
0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// LOG_M("pilotsF.m","rsF",txdataF[0],frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
LOG_M("txsigF0.m","txsF0", eNB->common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
|
||||
|
||||
if (eNB->frame_parms.nb_antennas_tx>1)
|
||||
@@ -668,9 +618,6 @@ int main(int argc, char **argv)
|
||||
tx_lev1 = 0;
|
||||
tx_lev2 = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (frame_parms->Ncp == 1)
|
||||
PHY_ofdm_mod(eNB->common_vars.txdataF[0][aa], // input,
|
||||
@@ -743,7 +690,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
|
||||
LOG_M("txsig0.m","txs0", txdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
if (frame_parms->nb_antennas_tx>1)
|
||||
@@ -768,11 +714,11 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if ((i%4)==0) {
|
||||
((short*)txdata[0])[i/2] = (short)((1<<15)*strtod(input_val_str,NULL));
|
||||
((short*)txdata[0])[(i/2)+1] = (short)((1<<15)*strtod(input_val_str2,NULL));
|
||||
((short *)txdata[0])[i/2] = (short)((1<<15)*strtod(input_val_str,NULL));
|
||||
((short *)txdata[0])[(i/2)+1] = (short)((1<<15)*strtod(input_val_str2,NULL));
|
||||
|
||||
if ((i/4)<100)
|
||||
printf("sample %d => %e + j%e (%d +j%d)\n",i/4,strtod(input_val_str,NULL),strtod(input_val_str2,NULL),((short*)txdata[0])[i/4],((short*)txdata[0])[(i/4)+1]);//1,input_val2,);
|
||||
printf("sample %d => %e + j%e (%d +j%d)\n",i/4,strtod(input_val_str,NULL),strtod(input_val_str2,NULL),((short *)txdata[0])[i/4],((short *)txdata[0])[(i/4)+1]); //1,input_val2,);
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -789,7 +735,6 @@ int main(int argc, char **argv)
|
||||
// tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
}
|
||||
|
||||
|
||||
// multipath channel
|
||||
|
||||
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
@@ -809,10 +754,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
|
||||
|
||||
n_errors = 0;
|
||||
n_errors2 = 0;
|
||||
n_alamouti = 0;
|
||||
@@ -824,8 +766,6 @@ int main(int argc, char **argv)
|
||||
printf("*********************** trial %d ***************************\n",trial);
|
||||
|
||||
while (pbch_sinr>-2.0) {
|
||||
|
||||
|
||||
multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
|
||||
2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0);
|
||||
|
||||
@@ -882,8 +822,8 @@ int main(int argc, char **argv)
|
||||
r_im[aa][i] += (pow(10.0,.05*interf1)*r_im1[aa][i] + pow(10.0,.05*interf2)*r_im2[aa][i]);
|
||||
}
|
||||
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) UE->common_vars.rxdata[aa])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) UE->common_vars.rxdata[aa])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,7 +832,6 @@ int main(int argc, char **argv)
|
||||
10*log10(signal_energy(&UE->common_vars.rxdata[0][frame_parms->samples_per_tti/2],4*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// optional: read rx_frame from file
|
||||
if ((rx_frame_file = fopen("rx_frame.dat","r")) == NULL)
|
||||
@@ -911,19 +850,15 @@ int main(int argc, char **argv)
|
||||
fclose(rx_frame_file);
|
||||
*/
|
||||
|
||||
|
||||
for (l=0; l<eNB->frame_parms.symbols_per_tti; l++) {
|
||||
|
||||
// subframe_offset = (l/eNB->frame_parms.symbols_per_tti)*eNB->frame_parms.samples_per_tti;
|
||||
// printf("subframe_offset = %d\n",subframe_offset);
|
||||
|
||||
slot_fep(UE,
|
||||
l%(eNB->frame_parms.symbols_per_tti/2),
|
||||
l/(eNB->frame_parms.symbols_per_tti/2),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
0);
|
||||
|
||||
if (l==0) {
|
||||
lte_ue_measurements(UE,
|
||||
@@ -961,16 +896,14 @@ int main(int argc, char **argv)
|
||||
//sprintf(fname,"dl_ch00_%d.m",l);
|
||||
//sprintf(vname,"dl_ch00_%d",l);
|
||||
//LOG_M(fname,vname,&(common_vars->dl_ch_estimates[0][frame_parms->ofdm_symbol_size*(l%6)]),frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
lte_est_freq_offset(UE->common_vars.common_vars_rx_data_per_thread[/*subframe*/0&0x1].dl_ch_estimates[0],
|
||||
&UE->frame_parms,
|
||||
l,
|
||||
&freq_offset,
|
||||
1);
|
||||
1);
|
||||
}
|
||||
|
||||
if (l==((eNB->frame_parms.Ncp==0)?10:9)) {
|
||||
|
||||
for (frame_mod4=0; frame_mod4<4; frame_mod4++) {
|
||||
pbch_tx_ant = rx_pbch(&UE->common_vars,
|
||||
UE->pbch_vars[0],
|
||||
@@ -1003,7 +936,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((pbch_tx_ant>0) && (pbch_tx_ant<4)) {
|
||||
if (n_frames==1)
|
||||
msg("pbch decoded sucessfully mode1_flag %d, frame_mod4 %d, tx_ant %d!\n",
|
||||
@@ -1023,7 +955,6 @@ int main(int argc, char **argv)
|
||||
UE,
|
||||
0,0,1);
|
||||
#endif
|
||||
|
||||
} //noise trials
|
||||
|
||||
if (abstraction_flag==1) {
|
||||
@@ -1049,7 +980,6 @@ int main(int argc, char **argv)
|
||||
} // NSR
|
||||
|
||||
if (n_frames==1) {
|
||||
|
||||
LOG_M("H00.m","h00",&(UE->common_vars.common_vars_rx_data_per_thread[/*subframe*/0&0x1].dl_ch_estimates[0][0][0]),((frame_parms->Ncp==0)?7:6)*(eNB->frame_parms.ofdm_symbol_size),1,1);
|
||||
|
||||
if (n_tx==2)
|
||||
@@ -1062,7 +992,6 @@ int main(int argc, char **argv)
|
||||
LOG_M("PBCH_rxF_llr.m","pbch_llr",UE->pbch_vars[0]->llr,(frame_parms->Ncp==0) ? 1920 : 1728,1,4);
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
@@ -1074,15 +1003,15 @@ int main(int argc, char **argv)
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
|
||||
|
||||
lte_sync_time_free();
|
||||
|
||||
if (write_output_file)
|
||||
fclose(output_fd);
|
||||
|
||||
return(n_errors);
|
||||
if (input_fd != NULL)
|
||||
fclose(input_fd);
|
||||
|
||||
return(n_errors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user