diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c index b34331eb8d4614d3a13b83c9583b722d89b0d649..9743c68a22a2071e84fef4ed29c36293c8441429 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c @@ -23,6 +23,7 @@ #include <string.h> #endif #include "defs.h" +#include "SCHED/defs.h" #include "PHY/defs.h" #include "filt96_32.h" #include "T.h" @@ -637,105 +638,129 @@ int lte_dl_channel_estimation(PHY_VARS_UE *ue, 32767-ue->ch_est_alpha, dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),0,ue->frame_parms.ofdm_symbol_size); } else { // high_speed_flag == 1 - if (symbol == 0) { - // printf("Interpolating %d->0\n",4-ue->frame_parms.Ncp); - // dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][(4-ue->frame_parms.Ncp)*(ue->frame_parms.ofdm_symbol_size)]; + if ((symbol == 0)) { + // printf("Interpolating %d->0\n",4-ue->frame_parms.Ncp); + // dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][(4-ue->frame_parms.Ncp)*(ue->frame_parms.ofdm_symbol_size)]; if(((Ns>>1)!=0) || ( ((Ns>>1)==0) && interpolateS11S12)) { - //LOG_D(PHY,"Interpolate s11-->s0 to get s12 and s13 Ns %d \n", Ns); - dl_ch_prev = (int16_t *)&dl_ch_estimates_previous[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)]; + //LOG_I(PHY,"Interpolate s11-->s0 to get s12 and s13 Ns %d \n", Ns); + dl_ch_prev = (int16_t *)&dl_ch_estimates_previous[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)]; + + multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); + } + + interpolateS11S12 = 1; + } // this is 1/3,2/3 combination for pilots spaced by 3 symbols + else if (symbol == pilot1) { + dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][0]; + + //LOG_I(PHY,"Interpolate s0-->s4 to get s1 s2 and s3 Ns %d \n", Ns); + if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination) + + uint8_t previous_subframe; + if(Ns>>1 == 0) + previous_subframe = 9; + else + previous_subframe = ((Ns>>1) - 1 )%9; + + if((subframe_select(&ue->frame_parms,previous_subframe) == SF_UL)) + { + + multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,32440,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); + } + else + { + multadd_complex_vector_real_scalar(dl_ch_prev,24576,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,8192,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_ch_prev,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,24576,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); + + } + } else { + multadd_complex_vector_real_scalar(dl_ch_prev,328,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); + } // pilot spacing 3 symbols (1/3,2/3 combination) + } else if (symbol == pilot2) { + dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot1*(ue->frame_parms.ofdm_symbol_size)]; multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size); multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); - } - - interpolateS11S12 = 1; - } // this is 1/3,2/3 combination for pilots spaced by 3 symbols - else if (symbol == pilot1) { - dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][0]; - - if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination) - multadd_complex_vector_real_scalar(dl_ch_prev,24576,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,8192,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); - - multadd_complex_vector_real_scalar(dl_ch_prev,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); - - multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,24576,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); - } else { - multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); - - multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); - } // pilot spacing 3 symbols (1/3,2/3 combination) - } else if (symbol == pilot2) { - dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot1*(ue->frame_parms.ofdm_symbol_size)]; - - multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); - - multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); - } else { // symbol == pilot3 - // printf("Interpolating 0->%d\n",4-ue->frame_parms.Ncp); - dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)]; - - if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination) - multadd_complex_vector_real_scalar(dl_ch_prev,24576,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,8192,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); - - multadd_complex_vector_real_scalar(dl_ch_prev,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); - - multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,24576,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); - } else { - multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); - - multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size); - multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); - } // pilot spacing 3 symbols (1/3,2/3 combination) - - if((ue->rx_offset_diff !=0) && ((Ns>>1) == 9)) - { - //LOG_D(PHY,"Extrapolate s7-->s11 to get s12 and s13 Ns %d\n", Ns); - interpolateS11S12 = 0; - //LOG_E(PHY,"Interpolate s7--s11 s12 s13 pilot 3 Ns %d l %d symbol %d \n", Ns, l, symbol); - int16_t *dlChEst_ofdm11 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)]; - int16_t *dlChEst_ofdm7 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)]; - - // interpolate ofdm s12: 5/4*ofdms11 + -1/4*ofdms7 5/4 q1.15 40960 -1/4 q1.15 8192 - int16_t *dlChEst_ofdm12 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][12*ue->frame_parms.ofdm_symbol_size]; - for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++) - { - int64_t tmp_mult = 0; - tmp_mult = ((int64_t)dlChEst_ofdm11[i] * 40960 - (int64_t)dlChEst_ofdm7[i] * 8192); + } else { // symbol == pilot3 + // printf("Interpolating 0->%d\n",4-ue->frame_parms.Ncp); + dl_ch_prev = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)]; - tmp_mult = tmp_mult >> 15; - dlChEst_ofdm12[i] = tmp_mult; - } + if (ue->frame_parms.Ncp==0) {// pilot spacing 4 symbols (1/4,1/2,3/4 combination) + multadd_complex_vector_real_scalar(dl_ch_prev,24576,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,8192,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); - // interpolate ofdm s13: 3/2*ofdms11 + -1/2*ofdms7 3/2 q1.15 49152 1/2 q1.15 16384 - int16_t *dlChEst_ofdm13 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][13*ue->frame_parms.ofdm_symbol_size]; - for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++) - { - int64_t tmp_mult = 0; - tmp_mult = ((int64_t)dlChEst_ofdm11[i] * 49152 - (int64_t)dlChEst_ofdm7[i] * 16384); + multadd_complex_vector_real_scalar(dl_ch_prev,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,16384,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_ch_prev,8192,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,24576,dl_ch_prev+(3*2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); + } else { + multadd_complex_vector_real_scalar(dl_ch_prev,10923,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)),0,ue->frame_parms.ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_ch_prev,21845,dl_ch_prev+(2*(ue->frame_parms.ofdm_symbol_size)<<1),1,ue->frame_parms.ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_ch,10923,dl_ch_prev+(2*((ue->frame_parms.ofdm_symbol_size)<<1)),0,ue->frame_parms.ofdm_symbol_size); + } // pilot spacing 3 symbols (1/3,2/3 combination) - tmp_mult = tmp_mult >> 15; - dlChEst_ofdm13[i] = tmp_mult; + if((ue->rx_offset_diff !=0) && ((Ns>>1) == 9)) + { + //LOG_I(PHY,"Extrapolate s7-->s11 to get s12 and s13 Ns %d\n", Ns); + interpolateS11S12 = 0; + //LOG_E(PHY,"Interpolate s7--s11 s12 s13 pilot 3 Ns %d l %d symbol %d \n", Ns, l, symbol); + int16_t *dlChEst_ofdm11 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot3*(ue->frame_parms.ofdm_symbol_size)]; + int16_t *dlChEst_ofdm7 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][pilot2*(ue->frame_parms.ofdm_symbol_size)]; + + // interpolate ofdm s12: 5/4*ofdms11 + -1/4*ofdms7 5/4 q1.15 40960 -1/4 q1.15 8192 + int16_t *dlChEst_ofdm12 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][12*ue->frame_parms.ofdm_symbol_size]; + for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++) + { + int64_t tmp_mult = 0; + tmp_mult = ((int64_t)dlChEst_ofdm11[i] * 40960 - (int64_t)dlChEst_ofdm7[i] * 8192); + + tmp_mult = tmp_mult >> 15; + dlChEst_ofdm12[i] = tmp_mult; + } + + // interpolate ofdm s13: 3/2*ofdms11 + -1/2*ofdms7 3/2 q1.15 49152 1/2 q1.15 16384 + int16_t *dlChEst_ofdm13 = (int16_t *)&dl_ch_estimates[(p<<1)+aarx][13*ue->frame_parms.ofdm_symbol_size]; + for(int i=0; i<(2*ue->frame_parms.ofdm_symbol_size); i++) + { + int64_t tmp_mult = 0; + tmp_mult = ((int64_t)dlChEst_ofdm11[i] * 49152 - (int64_t)dlChEst_ofdm7[i] * 16384); + + tmp_mult = tmp_mult >> 15; + dlChEst_ofdm13[i] = tmp_mult; + } } - } + } } - } } } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index d075d0ca50b1411d4e95dd703be0747f0749b9de..4033e4c37835351927db640fe5f11cc1ea0b0a01 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -171,20 +171,25 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, { uint8_t subframe = slot>>1; - int aarx,rb,n; + int aarx,rb; + uint8_t pss_symb; + uint8_t sss_symb; + + int32_t **rxdataF; int16_t *rxF,*rxF_pss,*rxF_sss; uint16_t Nid_cell = ue->frame_parms.Nid_cell; uint8_t eNB_offset,nu,l,nushift,k; uint16_t off; - uint8_t isPss; // indicate if this is a slot for extracting PSS - uint8_t isSss; // indicate if this is a slot for extracting SSS - int32_t pss_ext[4][72]; // contain the extracted 6*12 REs for mapping the PSS - int32_t sss_ext[4][72]; // contain the extracted 6*12 REs for mapping the SSS - int32_t (*xss_ext)[72]; // point to either pss_ext or sss_ext for common calculation - int16_t *re,*im; // real and imag part of each 32-bit xss_ext[][] value + //uint8_t isPss; // indicate if this is a slot for extracting PSS + //uint8_t isSss; // indicate if this is a slot for extracting SSS + //int32_t pss_ext[4][72]; // contain the extracted 6*12 REs for mapping the PSS + //int32_t sss_ext[4][72]; // contain the extracted 6*12 REs for mapping the SSS + //int32_t (*xss_ext)[72]; // point to either pss_ext or sss_ext for common calculation + //int16_t *re,*im; // real and imag part of each 32-bit xss_ext[][] value + //LOG_I(PHY,"UE RRC MEAS Start Subframe %d Frame Type %d slot %d \n",subframe,ue->frame_parms.frame_type,slot); for (eNB_offset = 0; eNB_offset<1+ue->measurements.n_adj_cells; eNB_offset++) { if (eNB_offset==0) { @@ -192,27 +197,28 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, //ue->measurements.n0_power_tot = 0; if (abstraction_flag == 0) { - if ((ue->frame_parms.frame_type == FDD) && - ((subframe == 0) || (subframe == 5))) { // FDD PSS/SSS, compute noise in DTX REs + if ( ((ue->frame_parms.frame_type == FDD) && ((subframe == 0) || (subframe == 5))) || + ((ue->frame_parms.frame_type == TDD) && ((subframe == 1) || (subframe == 6))) + ) + { // FDD PSS/SSS, compute noise in DTX REs if (ue->frame_parms.Ncp==NORMAL) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { + if(ue->frame_parms.frame_type == FDD) + { rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(5*ue->frame_parms.ofdm_symbol_size)]; rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(6*ue->frame_parms.ofdm_symbol_size)]; - + } + else + { + rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[(subframe+1)&0x1].rxdataF[aarx][(13*ue->frame_parms.ofdm_symbol_size)]; + rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(2*ue->frame_parms.ofdm_symbol_size)]; + } //-ve spectrum from SSS - // printf("slot %d: SSS DTX: %d,%d, non-DTX %d,%d\n",slot,rxF_pss[-72],rxF_pss[-71],rxF_pss[-36],rxF_pss[-35]); - // ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); - // printf("sssn36 %d\n",ue->measurements.n0_power[aarx]); - ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); - ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67])); - ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65])); - // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); - // printf("sssm32 %d\n",ue->measurements.n0_power[aarx]); //+ve spectrum from SSS - ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69])); ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+68]*rxF_sss[2+68])+((int32_t)rxF_sss[2+67]*rxF_sss[2+67])); ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+66]*rxF_sss[2+66])+((int32_t)rxF_sss[2+65]*rxF_sss[2+65])); // ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63])); @@ -223,18 +229,34 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+66]*rxF_pss[2+66])+((int32_t)rxF_pss[2+65]*rxF_pss[2+65])); // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+64]*rxF_pss[2+64])+((int32_t)rxF_pss[2+63]*rxF_pss[2+63])); // printf("pss32 %d\n",ue->measurements.n0_power[aarx]); //-ve spectrum from PSS - rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(7*ue->frame_parms.ofdm_symbol_size)]; + if(ue->frame_parms.frame_type == FDD) + { + rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(6*ue->frame_parms.ofdm_symbol_size)]; + rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(7*ue->frame_parms.ofdm_symbol_size)]; + } + else + { + rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[(subframe+1)&0x1].rxdataF[aarx][(14*ue->frame_parms.ofdm_symbol_size)]; + rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(3*ue->frame_parms.ofdm_symbol_size)]; + } // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); // printf("pssm36 %d\n",ue->measurements.n0_power[aarx]); ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67])); ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65])); + + ue->measurements.n0_power[aarx] = (((int32_t)rxF_sss[-70]*rxF_sss[-70])+((int32_t)rxF_sss[-69]*rxF_sss[-69])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[-68]*rxF_sss[-68])+((int32_t)rxF_sss[-67]*rxF_sss[-67])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[-66]*rxF_sss[-66])+((int32_t)rxF_sss[-65]*rxF_sss[-65])); + // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); // printf("pssm32 %d\n",ue->measurements.n0_power[aarx]); ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12); ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx]; } + //LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot); + ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx)); ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size); } else { @@ -242,87 +264,61 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, } } else if ((ue->frame_parms.frame_type == TDD) && - ((slot == 2) || (slot == 12) || (slot == 1) || (slot == 11))) { // TDD PSS/SSS, compute noise in DTX REs // 2016-09-29 wilson fix incorrect noise power calculation + ((subframe == 1) || (subframe == 6))) { // TDD PSS/SSS, compute noise in DTX REs // 2016-09-29 wilson fix incorrect noise power calculation -#if 1 // fixing REs extraction in noise power calculation - // check if this slot has a PSS or SSS sequence - if ((slot == 2) || (slot == 12)) { - isPss = 1; - } else { - isPss = 0; - } - if ((slot == 1) || (slot == 11)) { - isSss = 1; - } else { - isSss = 0; - } - - if (isPss) { - pss_only_extract(ue, pss_ext); - xss_ext = pss_ext; - } - - if (isSss) { - sss_only_extract(ue, sss_ext); - xss_ext = sss_ext; - } - - // calculate noise power - int num_tot=0; // number of REs totally used in calculating noise power - for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { - - int num_per_rx=0; // number of REs used in caluclaing noise power for this RX antenna - ue->measurements.n0_power[aarx] = 0; - for (n=2; n<70; n++) { // skip the 2 REs next to PDSCH, i.e. n={0,1,70,71} - if (n==5) {n=67;} - - re = (int16_t*)(&(xss_ext[aarx][n])); - im = re+1; - ue->measurements.n0_power[aarx] += (*re)*(*re) + (*im)*(*im); - num_per_rx++; - num_tot++; - } - - ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/(num_per_rx)); - ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx]; - } - - ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(num_tot)); - ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size); - -#else + pss_symb = 2; + sss_symb = ue->frame_parms.symbols_per_tti-1; if (ue->frame_parms.Ncp==NORMAL) { for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) { - rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(6*ue->frame_parms.ofdm_symbol_size)]; - // note this is a dummy pointer, the pss is not really there! - // in FDD the pss is in the symbol after the sss, but not in TDD - - rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(7*ue->frame_parms.ofdm_symbol_size)]; + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(subframe&0x1)].rxdataF; + rxF_pss = (int16_t *) &rxdataF[aarx][((pss_symb*(ue->frame_parms.ofdm_symbol_size)))]; + + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(subframe+1)&0x1].rxdataF; + rxF_sss = (int16_t *) &rxdataF[aarx][((sss_symb*(ue->frame_parms.ofdm_symbol_size)))]; + + //-ve spectrum from SSS + // printf("slot %d: SSS DTX: %d,%d, non-DTX %d,%d\n",slot,rxF_pss[-72],rxF_pss[-71],rxF_pss[-36],rxF_pss[-35]); + + // ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); + // printf("sssn36 %d\n",ue->measurements.n0_power[aarx]); + ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65])); + // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); + // printf("sssm32 %d\n",ue->measurements.n0_power[aarx]); + //+ve spectrum from SSS + ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+68]*rxF_sss[2+68])+((int32_t)rxF_sss[2+67]*rxF_sss[2+67])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+66]*rxF_sss[2+66])+((int32_t)rxF_sss[2+65]*rxF_sss[2+65])); + // ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63])); + // printf("sssp32 %d\n",ue->measurements.n0_power[aarx]); + //+ve spectrum from PSS + ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+70]*rxF_pss[2+70])+((int32_t)rxF_pss[2+69]*rxF_pss[2+69])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+68]*rxF_pss[2+68])+((int32_t)rxF_pss[2+67]*rxF_pss[2+67])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+66]*rxF_pss[2+66])+((int32_t)rxF_pss[2+65]*rxF_pss[2+65])); + // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+64]*rxF_pss[2+64])+((int32_t)rxF_pss[2+63]*rxF_pss[2+63])); + // printf("pss32 %d\n",ue->measurements.n0_power[aarx]); //-ve spectrum from PSS + rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(7*ue->frame_parms.ofdm_symbol_size)]; + // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); + // printf("pssm36 %d\n",ue->measurements.n0_power[aarx]); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67])); + ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65])); + // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); + // printf("pssm32 %d\n",ue->measurements.n0_power[aarx]); + ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12); + ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx]; + } - //-ve spectrum from SSS - // ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71])); - ue->measurements.n0_power[aarx] = (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69])); - ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67])); - ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65])); - // ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63])); - //+ve spectrum from SSS - // ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+72]*rxF_sss[2+72])+((int32_t)rxF_sss[2+71]*rxF_sss[2+71])); - ue->measurements.n0_power[aarx] = (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69])); - ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+68]*rxF_sss[2+68])+((int32_t)rxF_sss[2+67]*rxF_sss[2+67])); - ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+66]*rxF_sss[2+66])+((int32_t)rxF_sss[2+65]*rxF_sss[2+65])); - // ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63])); + ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx)); + ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size); - ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/(6)); - ue->measurements.n0_power_tot += ue->measurements.n0_power[aarx]; - } - ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(6*aarx)); - ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size); + //LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot); } -#endif } } } @@ -550,6 +546,8 @@ void lte_ue_measurements(PHY_VARS_UE *ue, (((k1*((long long int)(ue->measurements.rx_power_avg[eNB_id]))) + (k2*((long long int)(ue->measurements.rx_power_tot[eNB_id]))))>>10); + //LOG_I(PHY,"Noise Power Computation: k1 %d k2 %d n0 avg %d n0 tot %d\n", k1, k2, ue->measurements.n0_power_avg, + // ue->measurements.n0_power_tot); ue->measurements.n0_power_avg = (int) (((k1*((long long int) (ue->measurements.n0_power_avg))) + (k2*((long long int) (ue->measurements.n0_power_tot))))>>10); @@ -567,8 +565,9 @@ void lte_ue_measurements(PHY_VARS_UE *ue, ue->measurements.wideband_cqi_avg[eNB_id] = dB_fixed2(ue->measurements.rx_power_avg[eNB_id],ue->measurements.n0_power_avg); ue->measurements.rx_rssi_dBm[eNB_id] = ue->measurements.rx_power_avg_dB[eNB_id] - ue->rx_total_gain_dB; #ifdef DEBUG_MEAS_UE - LOG_D(PHY,"[eNB %d] RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n", + LOG_I(PHY,"[eNB %d] Subframe %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n", eNB_id, + subframe, ue->measurements.rx_rssi_dBm[eNB_id], ue->measurements.rx_power_avg_dB[eNB_id], ue->measurements.wideband_cqi_avg[eNB_id], diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 6c0c4ff94cfd1e7495b4f6aeffabb23f18300a9b..5aa676da9a65df3de769e3edd941f38c85bd15b3 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -8013,13 +8013,20 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ulsch->bundling = 1-AckNackFBMode; if (frame_parms->frame_type == FDD) { - int dl_subframe = (subframe<4) ? (subframe+6) : (subframe-4); + //int dl_subframe = (subframe<4) ? (subframe+6) : (subframe-4); + int dl_subframe = subframe; if (ue->dlsch[dl_subframe&0x1][eNB_id][0]->harq_ack[dl_subframe].send_harq_status>0) { // we have downlink transmission ulsch->harq_processes[harq_pid]->O_ACK = 1; } else { ulsch->harq_processes[harq_pid]->O_ACK = 0; } + /*LOG_I(PHY,"DCI 0 Processing: dl_subframe %d send_harq_status Odd %d send_harq_status Even %d harq_pid %d O_ACK %d\n", dl_subframe, + ue->dlsch[0][eNB_id][0]->harq_ack[dl_subframe].send_harq_status, + ue->dlsch[1][eNB_id][0]->harq_ack[dl_subframe].send_harq_status, + harq_pid, + ulsch->harq_processes[harq_pid]->O_ACK);*/ + } else { if (ulsch->bundling) ulsch->harq_processes[harq_pid]->O_ACK = (dai == 3)? 0 : 1; @@ -8031,10 +8038,16 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, dlsch[0]->harq_ack[subframe].vDAI_UL = dai+1; - LOG_D(PHY, "[PUSCH %d] Format0 DCI %s, CQI_req=%d, cshift=%d, TPC=%d, DAI=%d, vDAI_UL[sf#%d]=%d, NDI=%d, MCS=%d, RBalloc=%d, first_rb=%d, harq_pid=%d, nb_rb=%d, subframe_scheduling_flag=%d\n", + + /*LOG_I(PHY, "[PUSCH %d] Format0 DCI %s, CQI_req=%d, cshift=%d, TPC=%d, DAI=%d, vDAI_UL[sf#%d]=%d, NDI=%d, MCS=%d, RBalloc=%d, first_rb=%d, harq_pid=%d, nb_rb=%d, subframe_scheduling_flag=%d" + " ulsch->bundling %d, O_ACK %d \n", harq_pid, (frame_parms->frame_type == TDD? "TDD" : "FDD"), - cqi_req, cshift, TPC, dai, subframe, dlsch[0]->harq_ack[subframe].vDAI_UL, ndi, mcs, rballoc, ulsch->harq_processes[harq_pid]->first_rb, harq_pid, ulsch->harq_processes[harq_pid]->nb_rb, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag); + cqi_req, cshift, TPC, dai, subframe, dlsch[0]->harq_ack[subframe].vDAI_UL, ndi, mcs, rballoc, + ulsch->harq_processes[harq_pid]->first_rb, harq_pid, ulsch->harq_processes[harq_pid]->nb_rb, + ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, + ulsch->bundling, + ulsch->harq_processes[harq_pid]->O_ACK);*/ ulsch->beta_offset_cqi_times8 = beta_cqi[ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index];//18; ulsch->beta_offset_ri_times8 = beta_ri[ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index];//10; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c index 9f8ee6cec79a861403653fabbc6348f534647fa6..05f458e94a2e05b49172e1d8b5351181faaa7888 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c @@ -461,11 +461,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, //#ifndef __AVX2__ #if 1 if (err_flag == 0) { - - LOG_D(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n", - Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS, +/* + LOG_I(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n", + Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS, harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_turbo_iterations); - +*/ if (llr8_flag) { AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n", Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round); @@ -641,8 +641,8 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, frame_rx_prev = frame_rx_prev%1024; if (err_flag == 1) { - LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, round %d, subframe %d)\n", - phy_vars_ue->Mod_id, frame_rx_prev, subframe_rx_prev, harq_pid, harq_process->round, subframe); + //LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", + // phy_vars_ue->Mod_id, frame, subframe, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round); dlsch->harq_ack[subframe].ack = 0; dlsch->harq_ack[subframe].harq_id = harq_pid; @@ -665,13 +665,16 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, return((1+dlsch->max_turbo_iterations)); } else { + //LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d TBS %d harq_process->mcs %d harq_process->nb_rb %d\n", + //phy_vars_ue->Mod_id,subframe,harq_process->TBS,harq_process->mcs,harq_process->nb_rb); + harq_process->status = SCH_IDLE; harq_process->round = 0; dlsch->harq_ack[subframe].ack = 1; dlsch->harq_ack[subframe].harq_id = harq_pid; dlsch->harq_ack[subframe].send_harq_status = 1; - LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, pid status %d, round %d, subframe %d)\n", - phy_vars_ue->Mod_id, frame_rx_prev, subframe_rx_prev, harq_pid, harq_process->status, harq_process->round, subframe); + //LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d)\n", + // phy_vars_ue->Mod_id, frame, subframe, harq_pid, harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs); if(is_crnti) { diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index e7f98cea1a5adcf3cb4c4b362a7d3ae93205cca8..1450209c260a6d7abb8fa1904df9afe42cf8d7a7 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -31,6 +31,7 @@ */ //#include "PHY/defs.h" #include "PHY/extern.h" +#include "SCHED/defs.h" #include "defs.h" #include "extern.h" #include "PHY/sse_intrin.h" @@ -256,12 +257,12 @@ int rx_pdsch(PHY_VARS_UE *ue, ue->high_speed_flag, frame_parms, dlsch0_harq->mimo_mode); -//#ifdef DEBUG_DLSCH_MOD - /* printf("dlsch: using pmi %lx, rb_alloc %x, pmi_ext ",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),*rballoc); +#ifdef DEBUG_DLSCH_MOD + printf("dlsch: using pmi %lx, rb_alloc %x, pmi_ext ",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),*rballoc); for (rb=0;rb<nb_rb;rb++) printf("%d",pdsch_vars[eNB_id]->pmi_ext[rb]); - printf("\n");*/ -//#endif + printf("\n"); +#endif if (rx_type >= rx_IC_single_stream) { if (eNB_id_i<ue->n_connected_eNB) // we are in TM5 @@ -353,7 +354,7 @@ int rx_pdsch(PHY_VARS_UE *ue, #ifdef DEBUG_PHY - LOG_D(PHY,"[DLSCH] log2_maxh = %d (%d,%d)\n",pdsch_vars[eNB_id]->log2_maxh,avg[0],avgs); + LOG_D(PHY,"[DLSCH] nb_rb %d log2_maxh = %d (%d,%d)\n",nb_rb,pdsch_vars[eNB_id]->log2_maxh,avg[0],avgs); LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode); #endif @@ -465,11 +466,12 @@ int rx_pdsch(PHY_VARS_UE *ue, symbol, nb_rb); #ifdef DEBUG_PHY - LOG_I(PHY,"[DLSCH] log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n",pdsch_vars[eNB_id]->log2_maxh, + LOG_I(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n", + frame%1024,subframe, pdsch_vars[eNB_id]->log2_maxh, pdsch_vars[eNB_id]->log2_maxh0, pdsch_vars[eNB_id]->log2_maxh1, avg[0],avgs); - LOG_I(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode); + LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode); #endif } @@ -744,6 +746,8 @@ int rx_pdsch(PHY_VARS_UE *ue, //i_mod should have been passed as a parameter } + //printf("LLR dlsch0_harq->Qm %d rx_type %d cw0 %d cw1 %d symbol %d \n",dlsch0_harq->Qm,rx_type,codeword_TB0,codeword_TB1,symbol); + switch (dlsch0_harq->Qm) { case 2 : if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) { @@ -909,6 +913,8 @@ int rx_pdsch(PHY_VARS_UE *ue, } break; case 6 : + //printf("LLR rx_type %d cw0 %d cw1 %d symbol %d first symbol %d nb_rb %d rballoceven %d sfn %d beamforming_mode %d\n", + // rx_type,codeword_TB0,codeword_TB1,symbol,first_symbol_flag,nb_rb,dlsch0_harq->rb_alloc_even,subframe,beamforming_mode); if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) { dlsch_64qam_llr(frame_parms, pdsch_vars[eNB_id]->rxdataF_comp0, @@ -1045,15 +1051,15 @@ int rx_pdsch(PHY_VARS_UE *ue, // Please keep it: useful for debugging #if 0 - if( (symbol == 13) && (dlsch0_harq->mimo_mode == 2) ) + if( (symbol == 13) && (subframe==0) && (dlsch0_harq->Qm == 6) /*&& (nb_rb==25)*/) { LOG_E(PHY,"Dump Phy Chan Est \n"); - if(subframe&0x1) + if(1) { #if 1 - //write_output("rxdataF0.m" , "rxdataF0", &common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF[0][0],14*frame_parms->ofdm_symbol_size,1,1); + write_output("rxdataF0.m" , "rxdataF0", &common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF[0][0],14*frame_parms->ofdm_symbol_size,1,1); //write_output("rxdataF1.m" , "rxdataF1", &common_vars->common_vars_rx_data_per_thread[subframe&0x1].rxdataF[0][0],14*frame_parms->ofdm_symbol_size,1,1); - //write_output("dl_ch_estimates00.m", "dl_ch_estimates00", &common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][0][0],14*frame_parms->ofdm_symbol_size,1,1); + write_output("dl_ch_estimates00.m", "dl_ch_estimates00", &common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][0][0],14*frame_parms->ofdm_symbol_size,1,1); //write_output("dl_ch_estimates01.m", "dl_ch_estimates01", &common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][1][0],14*frame_parms->ofdm_symbol_size,1,1); //write_output("dl_ch_estimates10.m", "dl_ch_estimates10", &common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][2][0],14*frame_parms->ofdm_symbol_size,1,1); //write_output("dl_ch_estimates11.m", "dl_ch_estimates11", &common_vars->common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][3][0],14*frame_parms->ofdm_symbol_size,1,1); @@ -1064,16 +1070,16 @@ int rx_pdsch(PHY_VARS_UE *ue, //write_output("rxdataF_ext10.m" , "rxdataF_ext10", &pdsch_vars[eNB_id]->rxdataF_ext[2][0],14*frame_parms->N_RB_DL*12,1,1); //write_output("rxdataF_ext11.m" , "rxdataF_ext11", &pdsch_vars[eNB_id]->rxdataF_ext[3][0],14*frame_parms->N_RB_DL*12,1,1); write_output("dl_ch_estimates_ext00.m", "dl_ch_estimates_ext00", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][0],14*frame_parms->N_RB_DL*12,1,1); - write_output("dl_ch_estimates_ext01.m", "dl_ch_estimates_ext01", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[1][0],14*frame_parms->N_RB_DL*12,1,1); - write_output("dl_ch_estimates_ext10.m", "dl_ch_estimates_ext10", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[2][0],14*frame_parms->N_RB_DL*12,1,1); - write_output("dl_ch_estimates_ext11.m", "dl_ch_estimates_ext11", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[3][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("dl_ch_estimates_ext01.m", "dl_ch_estimates_ext01", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[1][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("dl_ch_estimates_ext10.m", "dl_ch_estimates_ext10", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[2][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("dl_ch_estimates_ext11.m", "dl_ch_estimates_ext11", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[3][0],14*frame_parms->N_RB_DL*12,1,1); write_output("rxdataF_comp00.m","rxdataF_comp00", &pdsch_vars[eNB_id]->rxdataF_comp0[0][0],14*frame_parms->N_RB_DL*12,1,1); - write_output("rxdataF_comp01.m","rxdataF_comp01", &pdsch_vars[eNB_id]->rxdataF_comp0[1][0],14*frame_parms->N_RB_DL*12,1,1); - write_output("rxdataF_comp10.m","rxdataF_comp10", &pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][0][0],14*frame_parms->N_RB_DL*12,1,1); - write_output("rxdataF_comp11.m","rxdataF_comp11", &pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][1][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_comp01.m","rxdataF_comp01", &pdsch_vars[eNB_id]->rxdataF_comp0[1][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_comp10.m","rxdataF_comp10", &pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][0][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_comp11.m","rxdataF_comp11", &pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][1][0],14*frame_parms->N_RB_DL*12,1,1); #endif write_output("llr0.m","llr0", &pdsch_vars[eNB_id]->llr[0][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); - write_output("llr1.m","llr1", &pdsch_vars[eNB_id]->llr[1][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); + //write_output("llr1.m","llr1", &pdsch_vars[eNB_id]->llr[1][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); AssertFatal(0," "); @@ -3323,7 +3329,7 @@ void dlsch_scale_channel(int **dl_ch_estimates_ext, ch_amp = ((pilots) ? (dlsch_ue[0]->sqrt_rho_b) : (dlsch_ue[0]->sqrt_rho_a)); - LOG_D(PHY,"Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp); + LOG_D(PHY,"Scaling PDSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n",symbol_mod,ch_amp,pilots,nb_rb,frame_parms->Ncp,symbol); // printf("Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp); ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13 diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 6d2603d9040ddccde8aa518667d00e8327e0158e..2100f07805e58cf2a8542837060aa4431bcc0ae5 100755 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -1333,7 +1333,8 @@ int pss_sss_extract(PHY_VARS_UE *phy_vars_ue, @returns 0 on success */ int pss_only_extract(PHY_VARS_UE *phy_vars_ue, - int32_t pss_ext[4][72]); + int32_t pss_ext[4][72], + uint8_t subframe); /*! \brief Extract only SSS resource elements @param phy_vars_ue Pointer to UE variables @@ -1341,7 +1342,8 @@ int pss_only_extract(PHY_VARS_UE *phy_vars_ue, @returns 0 on success */ int sss_only_extract(PHY_VARS_UE *phy_vars_ue, - int32_t sss_ext[4][72]); + int32_t sss_ext[4][72], + uint8_t subframe); /*! \brief Performs detection of SSS to find cell ID and other framing parameters (FDD/TDD, normal/extended prefix) @param phy_vars_ue Pointer to UE variables diff --git a/openair1/PHY/LTE_TRANSPORT/sss.c b/openair1/PHY/LTE_TRANSPORT/sss.c index fc5e7f0d1bd7c995002c961983e63b4c6970f681..5eada8bc9c3eef2af838b2ae7901644d0a806d29 100644 --- a/openair1/PHY/LTE_TRANSPORT/sss.c +++ b/openair1/PHY/LTE_TRANSPORT/sss.c @@ -166,6 +166,7 @@ int _do_pss_sss_extract(PHY_VARS_UE *ue, int32_t **rxdataF; + //LOG_I(PHY,"do_pss_sss_extract subframe %d \n",subframe); for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { if (frame_parms->frame_type == FDD) { @@ -180,11 +181,26 @@ int _do_pss_sss_extract(PHY_VARS_UE *ue, pss_symb = 2; sss_symb = frame_parms->symbols_per_tti-1; + if(subframe==5 || subframe==0) + { rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(subframe&0x1)].rxdataF; sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; rxdataF = ue->common_vars.common_vars_rx_data_per_thread[((subframe+1)&0x1)].rxdataF; pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else if(subframe==6 || subframe==1) + { + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(subframe&0x1)].rxdataF; + pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(subframe+1)&0x1].rxdataF; + sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else + { + AssertFatal(0,""); + } } //printf("extract_rbs: symbol_mod=%d, rx_offset=%d, ch_offset=%d\n",symbol_mod, @@ -204,11 +220,26 @@ int _do_pss_sss_extract(PHY_VARS_UE *ue, } else { + if(subframe==5 || subframe==0) + { rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(subframe&0x1)].rxdataF; sss_rxF = &rxdataF[aarx][(1 + (sss_symb*(frame_parms->ofdm_symbol_size)))]; rxdataF = ue->common_vars.common_vars_rx_data_per_thread[((subframe+1)&0x1)].rxdataF; pss_rxF = &rxdataF[aarx][(1 + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else if(subframe==6 || subframe==1) + { + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(subframe&0x1)].rxdataF; + pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[(subframe+1)&0x1].rxdataF; + sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else + { + AssertFatal(0,""); + } } } @@ -237,18 +268,20 @@ int pss_sss_extract(PHY_VARS_UE *phy_vars_ue, } int pss_only_extract(PHY_VARS_UE *phy_vars_ue, - int32_t pss_ext[4][72]) + int32_t pss_ext[4][72], + uint8_t subframe) { static int32_t dummy[4][72]; - return _do_pss_sss_extract(phy_vars_ue, pss_ext, dummy, 1 /* doPss */, 0 /* doSss */, 0); + return _do_pss_sss_extract(phy_vars_ue, pss_ext, dummy, 1 /* doPss */, 0 /* doSss */, subframe); } int sss_only_extract(PHY_VARS_UE *phy_vars_ue, - int32_t sss_ext[4][72]) + int32_t sss_ext[4][72], + uint8_t subframe) { static int32_t dummy[4][72]; - return _do_pss_sss_extract(phy_vars_ue, dummy, sss_ext, 0 /* doPss */, 1 /* doSss */, 0); + return _do_pss_sss_extract(phy_vars_ue, dummy, sss_ext, 0 /* doPss */, 1 /* doSss */, subframe); } diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index a26f3a876bd53be7a4db161878d735070490cf83..51a9d1e9469d8862088c2d17fb9fe32640d2e8a1 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -2067,7 +2067,8 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, if ((UE_index >= oai_emulation.info.first_ue_local) ||(UE_index <(oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local))) { get_ack(&eNB->frame_parms, PHY_vars_UE_g[UE_id][CC_id]->dlsch[0][0][0]->harq_ack, - subframe, + proc->subframe_tx, + proc->subframe_rx, eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK,0); } else { // get remote UEs' ack eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[0] = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_ACK[0]; diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index a6223bef5b6f4ec508c39daa8584bce30c26d4cf..10d9d69c5219287de740513132754ca1d77cf10d 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/defs.h @@ -212,6 +212,7 @@ void prach_procedures(PHY_VARS_eNB *eNB); lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); + /*! \brief Function to compute which type of DCIs to detect in the given subframe @param frame_parms Pointer to DL frame parameter descriptor @param subframe Subframe index @@ -305,7 +306,7 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n); @param o_ACK Pointer to ACK/NAK payload for PUCCH/PUSCH @returns status indicator for PUCCH/PUSCH transmission */ -uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t subframe,uint8_t *o_ACK, uint8_t cw_idx); +uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t subframe_tx,uint8_t subframe_rx,uint8_t *o_ACK, uint8_t cw_idx); /*! \brief Reset ACK/NACK information @param frame_parms Pointer to DL frame parameter descriptor @@ -316,8 +317,10 @@ uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t */ uint8_t reset_ack(LTE_DL_FRAME_PARMS *frame_parms, harq_status_t *harq_ack, - unsigned char subframe, + unsigned char subframe_tx, + unsigned char subframe_rx, unsigned char *o_ACK, + uint8_t *pN_bundled, uint8_t cw_idx); /*! \brief Compute UL ACK subframe from DL subframe. This is used to retrieve corresponding DLSCH HARQ pid at eNB upon reception of ACK/NAK information on PUCCH/PUSCH. Derived from Table 10.1-1 in 36.213 (p. 69 in version 8.6) diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c index e5753483daf8c7966fd4684b985dc4d7c03f51f4..314f934a8112e5c689ddba83c7217089a5fade74 100644 --- a/openair1/SCHED/phy_procedures_lte_common.c +++ b/openair1/SCHED/phy_procedures_lte_common.c @@ -323,8 +323,10 @@ unsigned char ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char s // return the number 'Nbundled' uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms, harq_status_t *harq_ack, - unsigned char subframe, + unsigned char subframe_tx, + unsigned char subframe_rx, unsigned char *o_ACK, + uint8_t *pN_bundled, uint8_t cw_idx, uint8_t do_reset) // 1 to reset ACK/NACK status : 0 otherwise { @@ -333,60 +335,61 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms, // printf("get_ack: SF %d\n",subframe); if (frame_parms->frame_type == FDD) { - if (subframe < 4) - subframe_dl0 = subframe + 6; + if (subframe_tx < 4) + subframe_dl0 = subframe_tx + 6; else - subframe_dl0 = subframe - 4; + subframe_dl0 = subframe_tx - 4; o_ACK[cw_idx] = harq_ack[subframe_dl0].ack; status = harq_ack[subframe_dl0].send_harq_status; + //LOG_I(PHY,"dl subframe %d send_harq_status %d cw_idx %d, reset %d\n",subframe_dl0, status, cw_idx, do_reset); if(do_reset) harq_ack[subframe_dl0].send_harq_status = 0; //printf("get_ack: Getting ACK/NAK for PDSCH (subframe %d) => %d\n",subframe_dl,o_ACK[0]); } else { switch (frame_parms->tdd_config) { case 1: - if (subframe == 2) { // ACK subframes 5,6 + if (subframe_tx == 2) { // ACK subframes 5,6 subframe_ul = 6; subframe_dl0 = 5; subframe_dl1 = 6; - } else if (subframe == 3) { // ACK subframe 9 + } else if (subframe_tx == 3) { // ACK subframe 9 subframe_ul = 9; subframe_dl0 = 9; subframe_dl1 = 0xff; - } else if (subframe == 4) { // nothing + } else if (subframe_tx == 4) { // nothing subframe_ul = 0xff; subframe_dl0 = 0xff; // invalid subframe number indicates ACK/NACK is not needed subframe_dl1 = 0xff; - } else if (subframe == 7) { // ACK subframes 0,1 + } else if (subframe_tx == 7) { // ACK subframes 0,1 subframe_ul = 1; subframe_dl0 = 0; subframe_dl1 = 1; - } else if (subframe == 8) { // ACK subframes 4 + } else if (subframe_tx == 8) { // ACK subframes 4 subframe_ul = 4; subframe_dl0 = 4; subframe_dl1 = 0xff; } else { - LOG_E(PHY,"phy_procedures_lte.c: get_ack, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); + LOG_E(PHY,"phy_procedures_lte.c: get_ack, illegal subframe_tx %d for tdd_config %d\n", + subframe_tx,frame_parms->tdd_config); return(0); } // report ACK/NACK status - o_ACK[0] = 1; + o_ACK[cw_idx] = 1; status = 0; if ((subframe_dl0 < 10) && (harq_ack[subframe_dl0].send_harq_status)) { - o_ACK[0] &= harq_ack[subframe_dl0].ack; + o_ACK[cw_idx] &= harq_ack[subframe_dl0].ack; status = harq_ack[subframe_dl0].send_harq_status; } if ((subframe_dl1 < 10) && (harq_ack[subframe_dl1].send_harq_status)) { - o_ACK[0] &= harq_ack[subframe_dl1].ack; + o_ACK[cw_idx] &= harq_ack[subframe_dl1].ack; status = harq_ack[subframe_dl1].send_harq_status; } // report status = Nbundled if (!status) { - o_ACK[0] = 0; + o_ACK[cw_idx] = 0; } else { if (harq_ack[subframe_ul].vDAI_UL < 0xff) { status = harq_ack[subframe_ul].vDAI_UL; @@ -396,26 +399,26 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms, if (!do_reset && (subframe_ul < 10)) { if ((subframe_dl0 < 10) && (subframe_dl1 < 10)) { LOG_D(PHY,"ul-sf#%d vDAI_UL[sf#%d]=%d Nbundled=%d: dlsf#%d ACK=%d harq_status=%d vDAI_DL=%d, dlsf#%d ACK=%d harq_status=%d vDAI_DL=%d, o_ACK[0]=%d status=%d\n", - subframe, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status, + subframe_tx, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status, subframe_dl0, harq_ack[subframe_dl0].ack, harq_ack[subframe_dl0].send_harq_status, harq_ack[subframe_dl0].vDAI_DL, subframe_dl1, harq_ack[subframe_dl1].ack, harq_ack[subframe_dl1].send_harq_status, harq_ack[subframe_dl1].vDAI_DL, - o_ACK[0], status); + o_ACK[cw_idx], status); } else if (subframe_dl0 < 10) { LOG_D(PHY,"ul-sf#%d vDAI_UL[sf#%d]=%d Nbundled=%d: dlsf#%d ACK=%d status=%d vDAI_DL=%d, o_ACK[0]=%d status=%d\n", - subframe, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status, + subframe_tx, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status, subframe_dl0, harq_ack[subframe_dl0].ack, harq_ack[subframe_dl0].send_harq_status, harq_ack[subframe_dl0].vDAI_DL, - o_ACK[0], status); + o_ACK[cw_idx], status); }else if (subframe_dl1 < 10) { LOG_D(PHY,"ul-sf#%d vDAI_UL[sf#%d]=%d Nbundled=%d: dlsf#%d ACK=%d status=%d vDAI_DL=%d, o_ACK[0]=%d status=%d\n", - subframe, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status, + subframe_tx, subframe_ul, harq_ack[subframe_ul].vDAI_UL, status, subframe_dl1, harq_ack[subframe_dl1].ack, harq_ack[subframe_dl1].send_harq_status, harq_ack[subframe_dl1].vDAI_DL, - o_ACK[0], status); + o_ACK[cw_idx], status); } } // reset ACK/NACK status if (do_reset) { - LOG_D(PHY,"ul-sf#%d ACK/NACK status resetting @ dci0-sf#%d, dci1x/2x-sf#%d, dci1x/2x-sf#%d\n", subframe, subframe_ul, subframe_dl0, subframe_dl1); + LOG_D(PHY,"ul-sf#%d ACK/NACK status resetting @ dci0-sf#%d, dci1x/2x-sf#%d, dci1x/2x-sf#%d\n", subframe_tx, subframe_ul, subframe_dl0, subframe_dl1); if (subframe_ul < 10) { harq_ack[subframe_ul].vDAI_UL = 0xff; } @@ -434,36 +437,44 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms, break; case 3: - if (subframe == 2) { // ACK subframes 5 and 6 + if (subframe_tx == 2) { // ACK subframes 5 and 6 subframe_dl0 = 5; subframe_dl1 = 6; - //printf("Subframe 2, TDD config 3: harq_ack[5] = %d (%d),harq_ack[6] = %d (%d)\n",harq_ack[5].ack,harq_ack[5].send_harq_status,harq_ack[6].ack,harq_ack[6].send_harq_status); - } else if (subframe == 3) { // ACK subframes 7 and 8 + subframe_ul = 2; + //printf("subframe_tx 2, TDD config 3: harq_ack[5] = %d (%d),harq_ack[6] = %d (%d)\n",harq_ack[5].ack,harq_ack[5].send_harq_status,harq_ack[6].ack,harq_ack[6].send_harq_status); + } else if (subframe_tx == 3) { // ACK subframes 7 and 8 subframe_dl0 = 7; subframe_dl1 = 8; + subframe_ul = 3; //printf("Subframe 3, TDD config 3: harq_ack[7] = %d,harq_ack[8] = %d\n",harq_ack[7].ack,harq_ack[8].ack); //printf("status %d : o_ACK (%d,%d)\n", status,o_ACK[0],o_ACK[1]); - } else if (subframe == 4) { // ACK subframes 9 and 0 + } else if (subframe_tx == 4) { // ACK subframes 9 and 0 subframe_dl0 = 9; subframe_dl1 = 0; + subframe_ul = 4; //printf("Subframe 4, TDD config 3: harq_ack[9] = %d,harq_ack[0] = %d\n",harq_ack[9].ack,harq_ack[0].ack); } else { - LOG_E(PHY,"phy_procedures_lte.c: get_ack, illegal subframe %d for tdd_config %d\n", - subframe,frame_parms->tdd_config); + LOG_E(PHY,"phy_procedures_lte.c: get_ack, illegal subframe_tx %d for tdd_config %d\n", + subframe_tx,frame_parms->tdd_config); return(0); } // report ACK/NACK status + o_ACK[cw_idx] = 0; if (harq_ack[subframe_dl0].send_harq_status == 1) { - o_ACK[0] = harq_ack[subframe_dl0].ack; + o_ACK[cw_idx] = harq_ack[subframe_dl0].ack; if (harq_ack[subframe_dl1].send_harq_status == 1) - o_ACK[1] = harq_ack[subframe_dl1].ack; + o_ACK[cw_idx] &= harq_ack[subframe_dl1].ack; } else if (harq_ack[subframe_dl1].send_harq_status == 1) - o_ACK[0] = harq_ack[subframe_dl1].ack; + o_ACK[cw_idx] = harq_ack[subframe_dl1].ack; - status = harq_ack[subframe_dl0].send_harq_status + (harq_ack[subframe_dl1].send_harq_status<<1); + pN_bundled[0] = harq_ack[subframe_rx].vDAI_UL; + status = harq_ack[subframe_dl0].send_harq_status + harq_ack[subframe_dl1].send_harq_status; + //LOG_D(PHY,"TDD Config3 UL Sfn %d, dl Sfn0 %d status %d o_Ack %d, dl Sfn1 %d status %d o_Ack %d subframe_rx %d N_bundled %d \n", + // subframe_tx, subframe_dl0, harq_ack[subframe_dl0].send_harq_status,harq_ack[subframe_dl0].ack, + // subframe_dl1, harq_ack[subframe_dl1].send_harq_status,harq_ack[subframe_dl1].ack, subframe_rx, pN_bundled[0]); if (do_reset) { // reset ACK/NACK status harq_ack[subframe_dl0].ack = 2; @@ -484,20 +495,24 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms, uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms, harq_status_t *harq_ack, - unsigned char subframe, + unsigned char subframe_tx, + unsigned char subframe_rx, unsigned char *o_ACK, uint8_t cw_idx) { - return get_reset_ack(frame_parms, harq_ack, subframe, o_ACK, cw_idx, 0); + uint8_t N_bundled = 0; + return get_reset_ack(frame_parms, harq_ack, subframe_tx, subframe_rx, o_ACK, &N_bundled, cw_idx, 0); } uint8_t reset_ack(LTE_DL_FRAME_PARMS *frame_parms, harq_status_t *harq_ack, - unsigned char subframe, + unsigned char subframe_tx, + unsigned char subframe_rx, unsigned char *o_ACK, + uint8_t *pN_bundled, uint8_t cw_idx) { - return get_reset_ack(frame_parms, harq_ack, subframe, o_ACK, cw_idx, 1); + return get_reset_ack(frame_parms, harq_ack, subframe_tx, subframe_rx, o_ACK, pN_bundled, cw_idx, 1); } diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 83eeee1f313059d4ede718407b7dcef93f0ddb4f..19037455943d89e155ad167a372513b871b462c6 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -444,7 +444,25 @@ uint8_t is_ri_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) return(0); } +void compute_cqi_ri_resources(PHY_VARS_UE *ue, + LTE_UE_ULSCH_t *ulsch, + uint8_t eNB_id, + uint16_t rnti, + uint16_t p_rnti, + uint16_t cba_rnti, + uint8_t cqi_status, + uint8_t ri_status) +{ + //PHY_MEASUREMENTS *meas = &ue->measurements; + //uint8_t transmission_mode = ue->transmission_mode[eNB_id]; + + //LOG_I(PHY,"compute_cqi_ri_resources O_RI %d O %d uci format %d \n",ulsch->O_RI,ulsch->O,ulsch->uci_format); + if (cqi_status == 1 || ri_status == 1) + { + ulsch->O = 4; + } +} void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t isSubframeSRS) { @@ -511,7 +529,7 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id uint8_t pucch_ack_payload[2]; if (get_ack(&ue->frame_parms, ue->dlsch[proc->subframe_rx&0x1][eNB_id][0]->harq_ack, - subframe_tx,pucch_ack_payload,0) > 0) + subframe_tx,proc->subframe_rx,pucch_ack_payload,0) > 0) { is_sr_an_subframe = 1; } @@ -633,13 +651,15 @@ PUCCH_FMT_t get_pucch_format(lte_frame_type_t frame_type, } if(SR_payload == 1) { + return pucch_format1; + /* if (frame_type == FDD) { return pucch_format1; } else if (frame_type == TDD) { return pucch_format1b; } else { AssertFatal(1==0,"Unknown frame_type"); - } + }*/ } } else @@ -1216,9 +1236,11 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32))); uint8_t access_mode; uint8_t Nbundled=0; + uint8_t NbundledCw1=0; uint8_t ack_status_cw0=0; uint8_t ack_status_cw1=0; - + uint8_t cqi_status = 0; + uint8_t ri_status = 0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN); // get harq_pid from subframe relationship @@ -1321,25 +1343,45 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB ack_status_cw0 = reset_ack(&ue->frame_parms, ue->dlsch[proc->subframe_rx&0x1][eNB_id][0]->harq_ack, subframe_tx, - ue->ulsch[eNB_id]->o_ACK,0); + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &Nbundled, + 0); ack_status_cw1 = reset_ack(&ue->frame_parms, ue->dlsch[proc->subframe_rx&0x1][eNB_id][1]->harq_ack, subframe_tx, - ue->ulsch[eNB_id]->o_ACK,1); + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &NbundledCw1, + 1); + + //Nbundled = ue->dlsch[proc->subframe_rx&0x1][eNB_id][0]->harq_ack; + //ue->ulsch[eNB_id]->bundling = Nbundled; - Nbundled = ack_status_cw0; first_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb; nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb; + // check Periodic CQI/RI reporting + cqi_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&& + (is_cqi_TXOp(ue,proc,eNB_id)==1)); + + ri_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) && + (is_ri_TXOp(ue,proc,eNB_id)==1)); - + // compute CQI/RI resources + compute_cqi_ri_resources(ue, ue->ulsch[eNB_id], eNB_id, ue->ulsch[eNB_id]->rnti, P_RNTI, CBA_RNTI, cqi_status, ri_status); + if (ack_status_cw0 > 0) { // check if we received a PDSCH at subframe_tx - 4 // ==> send ACK/NACK on PUSCH - ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = ack_status_cw0 + ack_status_cw1; + if (ue->frame_parms.frame_type == FDD) + { + ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = ack_status_cw0 + ack_status_cw1; + } + #if T_TRACER if(ue->ulsch[eNB_id]->o_ACK[0]) @@ -1366,8 +1408,9 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB #ifdef DEBUG_PHY_PROC LOG_D(PHY, - "[UE %d][PUSCH %d] AbsSubframe %d.%d %d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, bundling %d\n", - Mod_id,harq_pid,frame_tx,subframe_tx,proc->subframe_rx, + "[UE %d][PUSCH %d] AbsSubframe %d.%d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, " + "cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, ack_status_cw0 %d ack_status_cw1 %d bundling %d, Nbundled %d, CQI %d, RI %d\n", + Mod_id,harq_pid,frame_tx%1024,subframe_tx, first_rb,nb_rb, ue->ulsch[eNB_id]->harq_processes[harq_pid]->round, ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs, @@ -1380,7 +1423,11 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB ue->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe_tx<<1], ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1], ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK, - ue->ulsch[eNB_id]->bundling); + ack_status_cw0, + ack_status_cw1, + ue->ulsch[eNB_id]->bundling, Nbundled, + cqi_status, + ri_status); #endif @@ -1619,11 +1666,16 @@ int16_t get_pucch2_cqi(PHY_VARS_UE *ue,int eNB_id,int *len) { if ((ue->transmission_mode[eNB_id]<4)|| (ue->transmission_mode[eNB_id]==7)) { // Mode 1-0 feedback // 4-bit CQI message + /*LOG_I(PHY,"compute CQI value, TM %d, length 4, Cqi Avg %d, value %d \n", ue->transmission_mode[eNB_id], + ue->measurements.wideband_cqi_avg[eNB_id], + sinr2cqi((double)ue->measurements.wideband_cqi_avg[eNB_id], + ue->transmission_mode[eNB_id]));*/ *len=4; return(sinr2cqi((double)ue->measurements.wideband_cqi_avg[eNB_id], ue->transmission_mode[eNB_id])); } else { // Mode 1-1 feedback, later + //LOG_I(PHY,"compute CQI value, TM %d, length 0, Cqi Avg 0 \n", ue->transmission_mode[eNB_id]); *len=0; // 2-antenna ports RI=1, 6 bits (2 PMI, 4 CQI) @@ -1784,16 +1836,18 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ack_status_cw0 = get_ack(&ue->frame_parms, ue->dlsch[proc->subframe_rx&0x1][eNB_id][0]->harq_ack, subframe_tx, + proc->subframe_rx, pucch_ack_payload, 0); ack_status_cw1 = get_ack(&ue->frame_parms, ue->dlsch[proc->subframe_rx&0x1][eNB_id][1]->harq_ack, subframe_tx, + proc->subframe_rx, pucch_ack_payload, 1); - nb_cw = ack_status_cw0 + ack_status_cw1; + nb_cw = ( (ack_status_cw0 != 0) ? 1:0) + ( (ack_status_cw1 != 0) ? 1:0); cqi_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&& (is_cqi_TXOp(ue,proc,eNB_id)==1)); @@ -1803,7 +1857,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin // Part - II // if nothing to report ==> exit function - if( (nb_cw==0) && (SR_payload==0) && (cqi_status==0) && (ri_status==0)) + if( (nb_cw==0) && (SR_payload==0) && (cqi_status==0) && (ri_status==0) ) { LOG_D(PHY,"PUCCH No feedback AbsSubframe %d.%d SR_payload %d nb_cw %d pucch_ack_payload[0] %d pucch_ack_payload[1] %d cqi_status %d Return \n", frame_tx%1024, subframe_tx, SR_payload, nb_cw, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status); @@ -1830,8 +1884,8 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin (uint8_t *)&pucch_payload, &len); - LOG_D(PHY,"PUCCH feedback AbsSubframe %d.%d SR %d NbCW %d AckNack %d.%d CQI %d RI %d format %d pucch_resource %d pucch_payload %d %d \n", - frame_tx%1024, subframe_tx, SR_payload, nb_cw, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status, ri_status, format, pucch_resource,pucch_payload[0],pucch_payload[1]); + LOG_D(PHY,"PUCCH feedback AbsSubframe %d.%d SR %d NbCW %d (%d %d) AckNack %d.%d CQI %d RI %d format %d pucch_resource %d pucch_payload %d %d \n", + frame_tx%1024, subframe_tx, SR_payload, nb_cw, ack_status_cw0, ack_status_cw1, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status, ri_status, format, pucch_resource,pucch_payload[0],pucch_payload[1]); // Part - IV @@ -1995,13 +2049,13 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin break; case pucch_format2a: - LOG_I(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2a (RI or CQI) Ack/Nack 1bit \n", + LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2a (RI or CQI) Ack/Nack 1bit \n", Mod_id, ue->dlsch[proc->subframe_rx&0x1][eNB_id][0]->rnti, frame_tx%1024, subframe_tx); break; case pucch_format2b: - LOG_I(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2b (RI or CQI) Ack/Nack 2bits\n", + LOG_D(PHY,"[UE %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2b (RI or CQI) Ack/Nack 2bits\n", Mod_id, ue->dlsch[proc->subframe_rx&0x1][eNB_id][0]->rnti, frame_tx%1024, subframe_tx); @@ -2145,17 +2199,33 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui } // reset DL ACK/NACK status + uint8_t N_bundled = 0; if (ue->dlsch[proc->subframe_rx&0x1][eNB_id][0] != NULL) + { reset_ack(&ue->frame_parms, ue->dlsch[proc->subframe_rx&0x1][eNB_id][0]->harq_ack, subframe_tx, - ue->ulsch[eNB_id]->o_ACK,0); + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &N_bundled, + 0); + reset_ack(&ue->frame_parms, + ue->dlsch[(proc->subframe_rx+1)&0x1][eNB_id][0]->harq_ack, + subframe_tx, + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &N_bundled, + 0); + } if (ue->dlsch_SI[eNB_id] != NULL) reset_ack(&ue->frame_parms, ue->dlsch_SI[eNB_id]->harq_ack, subframe_tx, - ue->ulsch[eNB_id]->o_ACK,0); + proc->subframe_rx, + ue->ulsch[eNB_id]->o_ACK, + &N_bundled, + 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); @@ -2191,6 +2261,8 @@ void ue_measurement_procedures( uint16_t slot, // slot index of each radio frame [0..19] uint8_t abstraction_flag,runmode_t mode) { + //LOG_I(PHY,"ue_measurement_procedures l %d Ncp %d\n",l,ue->frame_parms.Ncp); + LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; @@ -2230,6 +2302,7 @@ void ue_measurement_procedures( if (l==(6-ue->frame_parms.Ncp)) { // make sure we have signal from PSS/SSS for N0 measurement + // LOG_I(PHY," l==(6-ue->frame_parms.Ncp) ue_rrc_measurements\n"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS, VCD_FUNCTION_IN); ue_rrc_measurements(ue, @@ -3142,6 +3215,48 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,int eNB_id,int abs } // is_pmch_subframe=true } +void copy_harq_proc_struct(LTE_DL_UE_HARQ_t *harq_processes_dest, LTE_DL_UE_HARQ_t *current_harq_processes) +{ + harq_processes_dest->B = current_harq_processes->B ; + harq_processes_dest->C = current_harq_processes->C ; + harq_processes_dest->Cminus = current_harq_processes->Cminus ; + harq_processes_dest->Cplus = current_harq_processes->Cplus ; + harq_processes_dest->DCINdi = current_harq_processes->DCINdi ; + harq_processes_dest->F = current_harq_processes->F ; + harq_processes_dest->G = current_harq_processes->G ; + harq_processes_dest->Kminus = current_harq_processes->Kminus ; + harq_processes_dest->Kplus = current_harq_processes->Kplus ; + harq_processes_dest->Nl = current_harq_processes->Nl ; + harq_processes_dest->Qm = current_harq_processes->Qm ; + harq_processes_dest->TBS = current_harq_processes->TBS ; + harq_processes_dest->b = current_harq_processes->b ; + harq_processes_dest->codeword = current_harq_processes->codeword ; + harq_processes_dest->delta_PUCCH = current_harq_processes->delta_PUCCH ; + harq_processes_dest->dl_power_off = current_harq_processes->dl_power_off ; + harq_processes_dest->first_tx = current_harq_processes->first_tx ; + harq_processes_dest->mcs = current_harq_processes->mcs ; + harq_processes_dest->mimo_mode = current_harq_processes->mimo_mode ; + harq_processes_dest->nb_rb = current_harq_processes->nb_rb ; + harq_processes_dest->pmi_alloc = current_harq_processes->pmi_alloc ; + harq_processes_dest->rb_alloc_even[0] = current_harq_processes->rb_alloc_even[0] ; + harq_processes_dest->rb_alloc_even[1] = current_harq_processes->rb_alloc_even[1] ; + harq_processes_dest->rb_alloc_even[2] = current_harq_processes->rb_alloc_even[2] ; + harq_processes_dest->rb_alloc_even[3] = current_harq_processes->rb_alloc_even[3] ; + harq_processes_dest->rb_alloc_odd[0] = current_harq_processes->rb_alloc_odd[0] ; + harq_processes_dest->rb_alloc_odd[1] = current_harq_processes->rb_alloc_odd[1] ; + harq_processes_dest->rb_alloc_odd[2] = current_harq_processes->rb_alloc_odd[2] ; + harq_processes_dest->rb_alloc_odd[3] = current_harq_processes->rb_alloc_odd[3] ; + harq_processes_dest->round = current_harq_processes->round ; + harq_processes_dest->rvidx = current_harq_processes->rvidx ; + harq_processes_dest->status = current_harq_processes->status ; + harq_processes_dest->vrb_type = current_harq_processes->vrb_type ; +} + +void copy_ack_struct(harq_status_t *harq_ack_dest, harq_status_t *current_harq_ack) +{ + memcpy(harq_ack_dest, current_harq_ack, sizeof(harq_status_t)); +} + void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSCH_t pdsch, LTE_UE_DLSCH_t *dlsch0, LTE_UE_DLSCH_t *dlsch1, int s0, int s1, int abstraction_flag) { int subframe_rx = proc->subframe_rx; @@ -3157,7 +3272,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC if (dlsch0 && (!dlsch1)) { harq_pid = dlsch0->current_harq_pid; - LOG_D(PHY,"[UE %d] PDSCH active in subframe %d, harq_pid %d\n",ue->Mod_id,subframe_rx,harq_pid); + LOG_D(PHY,"[UE %d] PDSCH active in subframe %d, harq_pid %d Symbol %d\n",ue->Mod_id,subframe_rx,harq_pid,m); if ((pdsch==PDSCH) && (ue->transmission_mode[eNB_id] == 5) && @@ -3929,6 +4044,27 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin } start_meas(&ue->generic_stat); + +#if 0 + if(subframe_rx==5 && ue->dlsch[subframe_rx&0x1][eNB_id][0]->harq_processes[ue->dlsch[subframe_rx&0x1][eNB_id][0]->current_harq_pid]->nb_rb > 20){ + //write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0); + //write_output("llr.m","llr", &ue->pdsch_vars[eNB_id]->llr[0][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); + + write_output("rxdataF0_current.m" , "rxdataF0", &ue->common_vars.common_vars_rx_data_per_thread[subframe_rx&0x1].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); + //write_output("rxdataF0_previous.m" , "rxdataF0_prev_sss", &ue->common_vars.common_vars_rx_data_per_thread[(subframe_rx+1)&0x1].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); + + //write_output("rxdataF0_previous.m" , "rxdataF0_prev", &ue->common_vars.common_vars_rx_data_per_thread[(subframe+1)&0x1].rxdataF[0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); + + write_output("dl_ch_estimates.m", "dl_ch_estimates_sfn5", &ue->common_vars.common_vars_rx_data_per_thread[subframe_rx&0x1].dl_ch_estimates[0][0][0],14*ue->frame_parms.ofdm_symbol_size,1,1); + write_output("dl_ch_estimates_ext.m", "dl_ch_estimatesExt_sfn5", &ue->pdsch_vars[subframe_rx&0x1][0]->dl_ch_estimates_ext[0][0],14*ue->frame_parms.N_RB_DL*12,1,1); + write_output("rxdataF_comp00.m","rxdataF_comp00", &ue->pdsch_vars[subframe_rx&0x1][0]->rxdataF_comp0[0][0],14*ue->frame_parms.N_RB_DL*12,1,1); + //write_output("magDLFirst.m", "magDLFirst", &phy_vars_ue->pdsch_vars[subframe&0x1][0]->dl_ch_mag0[0][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("magDLSecond.m", "magDLSecond", &phy_vars_ue->pdsch_vars[subframe&0x1][0]->dl_ch_magb0[0][0],14*frame_parms->N_RB_DL*12,1,1); + + AssertFatal (0,""); + } +#endif + // do procedures for SI-RNTI if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { ue_pdsch_procedures(ue, @@ -3999,6 +4135,18 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ue->dlsch_ra[eNB_id]->active = 0; } + // duplicate harq structure + + uint8_t current_harq_pid = ue->dlsch[subframe_rx&0x1][eNB_id][0]->current_harq_pid; + LTE_DL_UE_HARQ_t *current_harq_processes = ue->dlsch[subframe_rx&0x1][eNB_id][0]->harq_processes[current_harq_pid]; + LTE_DL_UE_HARQ_t *harq_processes_dest = ue->dlsch[(subframe_rx+1)&0x1][eNB_id][0]->harq_processes[current_harq_pid]; + + harq_status_t *current_harq_ack = &ue->dlsch[subframe_rx&0x1][eNB_id][0]->harq_ack[subframe_rx]; + harq_status_t *harq_ack_dest = &ue->dlsch[(subframe_rx+1)&0x1][eNB_id][0]->harq_ack[subframe_rx]; + + copy_harq_proc_struct(harq_processes_dest, current_harq_processes); + copy_ack_struct(harq_ack_dest, current_harq_ack); + if (subframe_rx==9) { if (frame_rx % 10 == 0) { if ((ue->dlsch_received[eNB_id] - ue->dlsch_received_last[eNB_id]) != 0) diff --git a/openair1/SCHED/pucch_pc.c b/openair1/SCHED/pucch_pc.c index ae831238622a91fef15d58e9be8d7d0f65ae28a5..1a1289ab8805c2af8eccb63e6981db6deabb61f2 100644 --- a/openair1/SCHED/pucch_pc.c +++ b/openair1/SCHED/pucch_pc.c @@ -31,6 +31,7 @@ */ #include "PHY/defs.h" +#include "SCHED/defs.h" #include "PHY/LTE_TRANSPORT/proto.h" #include "PHY/extern.h"