Commit 3c6e206e authored by hbilel's avatar hbilel

TDD fix for several issues

parent cd7e479f
......@@ -637,105 +637,137 @@ 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)
//subframe_select(ue->frame_parms,((Ns>>1)-1)) == SF_UL
//if((Ns>>1) != 5)
uint8_t previous_subframe;
if(Ns>>1 == 0)
previous_subframe = 9;
else
previous_subframe = ((Ns>>1) - 1 )%9;
if(((Ns>>1)>0 && subframe_select(&ue->frame_parms,((Ns>>1)-1)) == SF_UL && ue->frame_parms.frame_type == TDD) ||
((Ns>>1)==0 && subframe_select(&ue->frame_parms,9) == SF_UL && ue->frame_parms.frame_type == TDD) )
{
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;
}
}
}
}
}
}
// }
}
}
......
......@@ -8031,10 +8031,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;
......@@ -8086,7 +8092,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
// ulsch->n_DMRS2 = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cshift;
#ifdef DEBUG_DCI
//#ifdef DEBUG_DCI
printf("Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx%1024,subframe);
printf("Format 0 DCI : ulsch (ue): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb);
......@@ -8108,9 +8114,9 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
printf("Format 0 DCI :ulsch (ue): Nsymb_pusch %d\n",ulsch->Nsymb_pusch);
printf("Format 0 DCI :ulsch (ue): cshift %d\n",ulsch->harq_processes[harq_pid]->n_DMRS2);
printf("Format 0 DCI :ulsch (ue): phich status %d\n",ulsch->harq_processes[harq_pid]->status);
#else
//#else
UNUSED_VARIABLE(dai);
#endif
//#endif
return(0);
} else {
LOG_E(PHY,"frame %d, subframe %d: FATAL ERROR, generate_ue_ulsch_params_from_dci, Illegal dci_format %d\n",
......
......@@ -517,7 +517,8 @@ uint32_t ulsch_encoding(uint8_t *a,
LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), "
"Q_CQI %d, Q_ACK %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI,Q_ACK);
"Q_CQI %d, Q_ACK %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,
ulsch->beta_offset_ri_times8,Q_CQI,Q_ACK);
LOG_I(PHY,"ULSCH Encoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n",
frame_parms->Nid_cell,ulsch->rnti,
......
......@@ -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];
......
......@@ -172,19 +172,19 @@ int slot_fep(PHY_VARS_UE *ue,
}
//#ifdef DEBUG_FEP
#ifdef DEBUG_FEP
// if (ue->frame <100)
printf("slot_fep: frame %d: symbol %d rx_offset %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx, symbol,rx_offset);
//#endif
#endif
}
if (ue->perfect_ce == 0) {
if ((l==0) || (l==(4-frame_parms->Ncp))) {
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
//#ifdef DEBUG_FEP
#ifdef DEBUG_FEP
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
//#endif
#endif
start_meas(&ue->dlsch_channel_estimation_stats);
lte_dl_channel_estimation(ue,eNB_id,0,
Ns,
......
......@@ -311,7 +311,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
......@@ -322,8 +322,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)
......
......@@ -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,10 +335,10 @@ 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;
......@@ -347,29 +349,29 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
} 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);
}
......@@ -396,18 +398,18 @@ 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[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[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[cw_idx], status);
}
......@@ -415,7 +417,7 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
// 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,22 +436,25 @@ 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);
}
......@@ -463,11 +468,12 @@ uint8_t get_reset_ack(LTE_DL_FRAME_PARMS *frame_parms,
} else if (harq_ack[subframe_dl1].send_harq_status == 1)
o_ACK[cw_idx] = harq_ack[subframe_dl1].ack;
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_I(PHY,"TDD Config3 UL Sfn %d, dl Sfn0 %d status %d o_Ack %d, dl Sfn1 %d status %d o_Ack %d\n",
subframe, 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);
LOG_I(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;
......@@ -488,20 +494,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);
}
......
......@@ -444,7 +444,522 @@ 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];
if (cqi_status == 1 || ri_status == 1)
{
if( (AntennaInfoDedicated__transmissionMode_tm3 == transmission_mode) || (AntennaInfoDedicated__transmissionMode_tm4 == transmission_mode) )
{
ulsch->O_RI = 1;
}
else
{
ulsch->O_RI = 0;
}
//ulsch->O_RI = 0; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table
switch(transmission_mode) {
// The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling
case 1:
if ((rnti >= cba_rnti) && (rnti < p_rnti)) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->o_RI[0] = 0;
} else if(meas->rank[eNB_id] == 0) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->o_RI[0] = 0;
} else {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->o_RI[0] = 1;
}
break;
case 2:
if ((rnti >= cba_rnti) && (rnti < p_rnti)) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->o_RI[0] = 0;
} else if(meas->rank[eNB_id] == 0) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->o_RI[0] = 0;
} else {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->o_RI[0] = 1;
}
break;
case 3:
if ((rnti >= cba_rnti) && (rnti < p_rnti)) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->o_RI[0] = 0;
} else if(meas->rank[eNB_id] == 0) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->o_RI[0] = 0;
} else {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->o_RI[0] = 1;
}
break;
case 4:
if ((rnti >= cba_rnti) && (rnti < p_rnti)) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->o_RI[0] = 0;
} else if(meas->rank[eNB_id] == 0) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_wideband_cqi_rank1_2A_1_5MHz;
break;
case 25:
ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz;
break;
case 50:
ulsch->O = sizeof_wideband_cqi_rank1_2A_10MHz;
break;
case 100:
ulsch->O = sizeof_wideband_cqi_rank1_2A_20MHz;
break;
}
ulsch->uci_format = wideband_cqi_rank1_2A;
ulsch->o_RI[0] = 0;
} else {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_wideband_cqi_rank2_2A_1_5MHz;
break;
case 25:
ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz;
break;
case 50:
ulsch->O = sizeof_wideband_cqi_rank2_2A_10MHz;
break;
case 100:
ulsch->O = sizeof_wideband_cqi_rank2_2A_20MHz;
break;
}
ulsch->uci_format = wideband_cqi_rank2_2A;
ulsch->o_RI[0] = 1;
}
break;
case 5:
if ((rnti >= cba_rnti) && (rnti < p_rnti)) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->o_RI[0] = 0;
} else if(meas->rank[eNB_id] == 0) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_wideband_cqi_rank1_2A_1_5MHz;
break;
case 25:
ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz;
break;
case 50:
ulsch->O = sizeof_wideband_cqi_rank1_2A_10MHz;
break;
case 100:
ulsch->O = sizeof_wideband_cqi_rank1_2A_20MHz;
break;
}
ulsch->uci_format = wideband_cqi_rank1_2A;
ulsch->o_RI[0] = 0;
} else {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_wideband_cqi_rank2_2A_1_5MHz;
break;
case 25:
ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz;
break;
case 50:
ulsch->O = sizeof_wideband_cqi_rank2_2A_10MHz;
break;
case 100:
ulsch->O = sizeof_wideband_cqi_rank2_2A_20MHz;
break;
}
ulsch->uci_format = wideband_cqi_rank2_2A;
ulsch->o_RI[0] = 1;
}
break;
case 6:
if ((rnti >= cba_rnti) && (rnti < p_rnti)) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->o_RI[0] = 0;
} else if(meas->rank[eNB_id] == 0) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_wideband_cqi_rank1_2A_1_5MHz;
break;
case 25:
ulsch->O = sizeof_wideband_cqi_rank1_2A_5MHz;
break;
case 50:
ulsch->O = sizeof_wideband_cqi_rank1_2A_10MHz;
break;
case 100:
ulsch->O = sizeof_wideband_cqi_rank1_2A_20MHz;
break;
}
ulsch->uci_format = wideband_cqi_rank1_2A;
ulsch->o_RI[0] = 0;
} else {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_wideband_cqi_rank2_2A_1_5MHz;
break;
case 25:
ulsch->O = sizeof_wideband_cqi_rank2_2A_5MHz;
break;
case 50:
ulsch->O = sizeof_wideband_cqi_rank2_2A_10MHz;
break;
case 100:
ulsch->O = sizeof_wideband_cqi_rank2_2A_20MHz;
break;
}
ulsch->uci_format = wideband_cqi_rank2_2A;
ulsch->o_RI[0] = 1;
}
break;
case 7:
if ((rnti >= cba_rnti) && (rnti < p_rnti)) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_mcs_CBA_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_mcs_CBA;
ulsch->o_RI[0] = 0;
} else if(meas->rank[eNB_id] == 0) {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->o_RI[0] = 0;
} else {
switch (ue->frame_parms.N_RB_DL) {
case 6:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_1_5MHz;
break;
case 25:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_5MHz;
break;
case 50:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_10MHz;
break;
case 100:
ulsch->O = sizeof_HLC_subband_cqi_nopmi_20MHz;
break;
}
ulsch->uci_format = HLC_subband_cqi_nopmi;
ulsch->o_RI[0] = 1;
}
break;
default:
LOG_E(PHY,"Incorrect Transmission Mode \n");
break;
}
ulsch->O = 4;
}
else
{
ulsch->O_RI = 0;
ulsch->O = 0;
ulsch->uci_format = HLC_subband_cqi_nopmi;
}
}
void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t isSubframeSRS)
{
......@@ -511,7 +1026,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[subframe_DL(&ue->frame_parms,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;
}
......@@ -536,6 +1051,7 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id
}
LOG_D(PHY," srsCellSubframe: %d, srsUeSubframe: %d, Nsymb-pusch: %d \n", pSoundingrs_ul_config_dedicated->srsCellSubframe, pSoundingrs_ul_config_dedicated->srsUeSubframe, ue->ulsch[eNB_id]->Nsymb_pusch);
}
}
......@@ -1218,9 +1734,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
......@@ -1323,25 +1841,41 @@ 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[subframe_DL(&ue->frame_parms,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[subframe_DL(&ue->frame_parms,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[subframe_DL(&ue->frame_parms,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;
//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])
......@@ -1369,7 +1903,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
//#ifdef DEBUG_PHY_PROC
LOG_I(PHY,
"[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, bundling %d\n",
"cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %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,
......@@ -1383,7 +1917,9 @@ 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);
ue->ulsch[eNB_id]->bundling, Nbundled,
cqi_status,
ri_status);
//#endif
......@@ -1793,12 +2329,14 @@ 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[subframe_DL(&ue->frame_parms,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[subframe_DL(&ue->frame_parms,proc->subframe_rx)&0x1][eNB_id][1]->harq_ack,
subframe_tx,
proc->subframe_rx,
pucch_ack_payload,
1);
......@@ -1812,9 +2350,9 @@ 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",
LOG_I(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);
return;
}
......@@ -2154,23 +2692,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[subframe_DL(&ue->frame_parms,proc->subframe_rx)&0x1][eNB_id][0] != NULL)
{
reset_ack(&ue->frame_parms,
ue->dlsch[subframe_DL(&ue->frame_parms,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[(subframe_DL(&ue->frame_parms,proc->subframe_rx)+1)&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);
}
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);
......@@ -2206,7 +2754,7 @@ 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);
//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;
......@@ -2247,7 +2795,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");
// 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,
......@@ -3175,7 +3723,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_I(PHY,"[UE %d] PDSCH active in subframe %d, harq_pid %d Symbol %d\n",ue->Mod_id,subframe_rx,harq_pid,m);
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) &&
......@@ -3752,8 +4300,8 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
l=1;
}
LOG_D(PHY," ------ slot 0 Processing: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx);
LOG_D(PHY," ------ --> FFT/ChannelEst/PDCCH slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx);
LOG_I(PHY," ------ slot 0 Processing: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx);
LOG_I(PHY," ------ --> FFT/ChannelEst/PDCCH slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx);
for (; l<=l2; l++) {
if (abstraction_flag == 0) {
start_meas(&ue->ofdm_demod_stats);
......@@ -3771,7 +4319,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode);
if ((l==pilot1) ||
((pmch_flag==1)&(l==l2))) {
LOG_D(PHY,"[UE %d] Frame %d: Calling pdcch procedures (eNB %d)\n",ue->Mod_id,frame_rx,eNB_id);
LOG_I(PHY,"[UE %d] Frame %d: Calling pdcch procedures (eNB %d)\n",ue->Mod_id,frame_rx,eNB_id);
if (ue_pdcch_procedures(eNB_id,ue,proc,abstraction_flag) == -1) {
LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Error in pdcch procedures\n",ue->Mod_id,frame_rx,subframe_rx);
......@@ -4051,10 +4599,10 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
memcpy(harq_processes_dest, current_harq_processes, sizeof(LTE_DL_UE_HARQ_t));
memcpy(harq_ack_dest, current_harq_ack, sizeof(harq_status_t));
LOG_I(PHY,"AbsSubframe %d.%d CurrentHarqProcess.status %d DestHarqProcess.status %d\n",frame_rx%1024,subframe_rx,current_harq_processes->status,harq_processes_dest->status);
LOG_I(PHY,"AbsSubframe %d.%d CurrentHarqProcess.round %d DestHarqProcess.round %d\n",frame_rx%1024,subframe_rx,current_harq_processes->round,harq_processes_dest->round);
LOG_I(PHY,"AbsSubframe %d.%d CurrentHarqProcess.delta_PUCCH %d DestHarqProcess.delta_PUCCH %d\n",frame_rx%1024,subframe_rx,current_harq_processes->delta_PUCCH,harq_processes_dest->delta_PUCCH);
LOG_I(PHY,"AbsSubframe %d.%d CurrentHarqProcess.rvidx %d DestHarqProcess.rvidx %d\n",frame_rx%1024,subframe_rx,current_harq_processes->rvidx,harq_processes_dest->rvidx);
//LOG_I(PHY,"AbsSubframe %d.%d CurrentHarqProcess.status %d DestHarqProcess.status %d\n",frame_rx%1024,subframe_rx,current_harq_processes->status,harq_processes_dest->status);
//LOG_I(PHY,"AbsSubframe %d.%d CurrentHarqProcess.round %d DestHarqProcess.round %d\n",frame_rx%1024,subframe_rx,current_harq_processes->round,harq_processes_dest->round);
//LOG_I(PHY,"AbsSubframe %d.%d CurrentHarqProcess.delta_PUCCH %d DestHarqProcess.delta_PUCCH %d\n",frame_rx%1024,subframe_rx,current_harq_processes->delta_PUCCH,harq_processes_dest->delta_PUCCH);
//LOG_I(PHY,"AbsSubframe %d.%d CurrentHarqProcess.rvidx %d DestHarqProcess.rvidx %d\n",frame_rx%1024,subframe_rx,current_harq_processes->rvidx,harq_processes_dest->rvidx);
if (subframe_rx==9) {
if (frame_rx % 10 == 0) {
......
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