Commit aa69c550 authored by Elena Lukashova's avatar Elena Lukashova
Browse files

A bit of clean-up.

parent b8e9e188
......@@ -242,19 +242,17 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
first_re=6;
for (re=first_re; re<last_re; re++) {
// printf("element %d precoder_index for allocation %d\n",re, precoder_index );
if ((skip_dc == 1) && (re==6))
re_off=re_off - frame_parms->ofdm_symbol_size+1;
tti_offset = symbol_offset + re_off + re;
// check that RE is not from Cell-specific RS
//check that RE is not from Cell-specific RS
if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==1) {
// printf("re %d (jj %d)\n",re,*jj);
//printf("re %d (jj %d)\n",re,*jj);
if (mimo_mode == SISO) { //SISO mapping
......@@ -263,7 +261,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
switch (mod_order0) {
case 2: //QPSK
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
}
......@@ -276,7 +274,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
*jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -308,8 +306,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re];
((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im];
// ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
// ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
//((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
//((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
}
break;
......@@ -393,7 +391,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
case 4: //16QAM
// Antenna 0 position n
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -419,6 +416,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
if (x0[*jj] == 1)
qam16_table_offset_re+=2;
*jj=*jj+1;
......@@ -437,8 +435,8 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
break;
case 6: // 64-QAM
// Antenna 0
......@@ -515,20 +513,19 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (frame_parms->nb_antennas_tx == 2) {
switch (mod_order0) {
default:
LOG_E(PHY,"Unknown mod_order0 %d\n",mod_order0);
xx0_re=xx0_im=0;
break;
case 2: //QPSK
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx0_re = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
xx0_im = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -582,22 +579,24 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
xx0_re = qam_table_s0[qam64_table_offset_re0];
xx0_im = qam_table_s0[qam64_table_offset_im0];
break;
}
switch (mod_order1) {
default:
LOG_E(PHY,"Unknown mod_order1 %d\n",mod_order1);
xx1_re=xx1_im=0;
break;
case 2: //QPSK
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
......@@ -649,7 +648,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
xx1_re = qam_table_s1[qam64_table_offset_re1];
xx1_im = qam_table_s1[qam64_table_offset_im1];
break;
}
......@@ -679,14 +677,14 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15);
switch (mod_order0) {
case 2: //QPSK
case 2:
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
// normalization for 2 tx antennas
//normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15);
......@@ -698,7 +696,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 4: //16QAM
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -733,8 +731,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -770,14 +767,12 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
}
break;
}
}
else if ((mimo_mode >= DUALSTREAM_UNIFORM_PRECODING1)&&(mimo_mode <= DUALSTREAM_PUSCH_PRECODING)) {
// this is for transmission mode 4 (1 layer)
*re_allocated = *re_allocated + 1;
if (precoder_index==0) {
precoder_index0 = 0; //[1 1]
precoder_index1 = 1; //[1 -1]
......@@ -792,18 +787,18 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
}
switch (mod_order0) {
case 2: //QPSK
case 2:
((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj = *jj + 1;
// normalization for 2 tx antennas
//normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
if (frame_parms->nb_antennas_tx == 2) {
layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index0);
......@@ -813,7 +808,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 4: //16QAM
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -825,7 +820,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
qam16_table_offset_im+=2;
*jj=*jj+1;
if (x0[*jj] == 1)
qam16_table_offset_re+=1;
*jj=*jj+1;
......@@ -846,11 +840,11 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
if (x0[*jj] == 1)
qam64_table_offset_re+=4;
*jj=*jj+1;
......@@ -887,14 +881,15 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
if (dlsch1_harq) {
switch (mod_order1) {
case 2: //QPSK
case 2:
((int16_t*)&tmp_sample1)[0] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
((int16_t*)&tmp_sample1)[1] = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
*jj2 = *jj2 + 1;
// normalization for 2 tx antennas
//normalization for 2 tx antennas
((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_2_Q15)>>15);
((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_2_Q15)>>15);
......@@ -906,7 +901,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 4: //16QAM
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -939,8 +934,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -1042,7 +1036,6 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
case 6: //64QAM
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -1090,10 +1083,7 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
return(-1);
}
}
}
return(0);
}
......@@ -1145,14 +1135,14 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
tti_offset = symbol_offset + re_off + re;
// printf("re %d (jj %d)\n",re,*jj);
//printf("re %d (jj %d)\n",re,*jj);
*re_allocated = *re_allocated + 1;
switch (mod_order) {
case 2: //QPSK
case 2:
// printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++)
((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
......@@ -1163,10 +1153,10 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
*jj = *jj + 1;
// printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
break;
case 4: //16QAM
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
......@@ -1195,14 +1185,13 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam16_table_offset_re];
((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam16_table_offset_im];
// ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
// ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
//((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
//((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
}
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -1403,7 +1392,7 @@ int dlsch_modulation(int32_t **txdataF,
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb));
//for (aa=0;aa<frame_parms->nb_antennas_tx;aa++)
// memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2);
//memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2);
//printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots);
for (rb=0; rb<frame_parms->N_RB_DL; rb++) {
......@@ -1588,7 +1577,6 @@ int dlsch_modulation(int32_t **txdataF,
re_offset+=12; // go to next RB
// check if we crossed the symbol boundary and skip DC
if (re_offset >= frame_parms->ofdm_symbol_size) {
if (skip_dc == 0) //even number of RBs (doesn't straddle DC)
......@@ -1597,11 +1585,8 @@ int dlsch_modulation(int32_t **txdataF,
re_offset=7; // odd number of RBs
}
}
}
#ifdef DEBUG_DLSCH_MODULATION
msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset));
#endif
......@@ -1644,7 +1629,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
amp=1; //we do full scale here for SIC
gain_lin_QPSK = (int16_t)((ONE_OVER_SQRT2_Q15));
// printf("gain=%d\n", gain_lin_QPSK);
//printf("gain=%d\n", gain_lin_QPSK);
jj = 0;
i = 0;
......@@ -1655,18 +1640,17 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
switch (mod_order0) {
case 2: //QPSK
/* TODO: handle more than 1 antenna */
// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
//printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]);
((int16_t*)&sic_buffer[0][i])[0] += (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
((int16_t*)&sic_buffer[0][i])[0] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i
jj = jj + 1;
((int16_t*)&sic_buffer[0][i])[1] += (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
((int16_t*)&sic_buffer[0][i])[1] = (x0[jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1}
jj = jj + 1;
// printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
//printf("recon %d,%d\n",((int16_t*)&sic_buffer[0][i])[0],((int16_t*)&sic_buffer[0][i])[1]);
i++;
break;
......@@ -1705,8 +1689,7 @@ int dlsch_modulation_SIC(int32_t **sic_buffer,
break;
case 6: //64QAM
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
......@@ -1814,7 +1797,6 @@ int mch_modulation(int32_t **txdataF,
}
if (mod_order == 4)
qam_table_s = qam16_table_a;
else if (mod_order == 6)
......@@ -1822,7 +1804,7 @@ int mch_modulation(int32_t **txdataF,
else
qam_table_s = NULL;
// printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
//printf("Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp);
allocate_REs_in_RB_MCH(txdataF,
&jj,
re_offset,
......@@ -1838,7 +1820,6 @@ int mch_modulation(int32_t **txdataF,
re_offset+=12; // go to next RB
// check if we crossed the symbol boundary and skip DC
if (re_offset >= frame_parms->ofdm_symbol_size) {
if (skip_dc == 0) //even number of RBs (doesn't straddle DC)
......@@ -1849,10 +1830,6 @@ int mch_modulation(int32_t **txdataF,
}
}
#ifdef DEBUG_DLSCH_MODULATION
msg("generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset));
#endif
......
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