Commit eee0a155 authored by Raymond Knopp's avatar Raymond Knopp

TM2 fixes for TDD

parent 551ae353
......@@ -45,7 +45,6 @@
#include "PHY/sse_intrin.h"
#ifndef USER_MODE
#define NOCYGWIN_STATIC static
#else
......@@ -3362,7 +3361,10 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
//PSS in subframe 0/5 if FDD
if (frame_parms->frame_type == FDD) { //FDD
if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
if (((subframe==0)||(subframe==5)) &&
(rb>((frame_parms->N_RB_DL>>1)-3)) &&
(rb<((frame_parms->N_RB_DL>>1)+3)) &&
(l==pss_symb) ) {
rb_alloc_ind = 0;
}
......@@ -3439,7 +3441,7 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
dl_ch0_ext[j++]=dl_ch0[i];
}
}
rxF_ext+=5;
dl_ch0_ext+=5;
} else if (skip_half==2) {
for (i=0; i<6; i++) {
......@@ -3495,29 +3497,31 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
nb_rb++;
// PBCH
if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) {
if ((subframe==0) &&
(l>=(nsymb>>1)) &&
(l<((nsymb>>1) + 4))) {
rb_alloc_ind = 0;
}
//SSS
if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) {
if (((subframe==0)||(subframe==5)) && (l==sss_symb) ) {
rb_alloc_ind = 0;
}
if (frame_parms->frame_type == FDD) {
//PSS
if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
if (((subframe==0)||(subframe==5)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
}
if ((frame_parms->frame_type == TDD) &&
(subframe==6)) {
//PSS
if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
if ((frame_parms->frame_type == TDD) &&
(subframe==6) &&
(l==pss_symb) ) {
rb_alloc_ind = 0;
}
}
// printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]);
// printf("DC rb %d (%p)\n",rb,rxF);
......@@ -3823,9 +3827,12 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
if (rb_alloc_ind == 1)
nb_rb++;
if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs
// PBCH
if ((subframe==0) &&
(prb>((frame_parms->N_RB_DL>>1)-3)) &&
(prb>=((frame_parms->N_RB_DL>>1)-3)) &&
(prb<((frame_parms->N_RB_DL>>1)+3)) &&
(l>=(nsymb>>1)) &&
(l<((nsymb>>1) + 4))) {
......@@ -3836,7 +3843,7 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
//SSS
if (((subframe==0)||(subframe==5)) &&
(prb>((frame_parms->N_RB_DL>>1)-3)) &&
(prb>=((frame_parms->N_RB_DL>>1)-3)) &&
(prb<((frame_parms->N_RB_DL>>1)+3)) &&
(l==sss_symb) ) {
rb_alloc_ind = 0;
......@@ -3848,7 +3855,7 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
//PSS in subframe 0/5 if FDD
if (frame_parms->frame_type == FDD) { //FDD
if (((subframe==0)||(subframe==5)) &&
(prb>((frame_parms->N_RB_DL>>1)-3)) &&
(prb>=((frame_parms->N_RB_DL>>1)-3)) &&
(prb<((frame_parms->N_RB_DL>>1)+3)) &&
(l==pss_symb) ) {
rb_alloc_ind = 0;
......@@ -3859,7 +3866,7 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
if ((frame_parms->frame_type == TDD) &&
(subframe==6)) { //TDD Subframe 6
if ((prb>=((frame_parms->N_RB_DL>>1)-3)) &&
(prb<=((frame_parms->N_RB_DL>>1)+3)) &&
(prb<((frame_parms->N_RB_DL>>1)+3)) &&
(l==pss_symb) ) {
rb_alloc_ind = 0;
}
......@@ -3867,7 +3874,7 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
if (rb_alloc_ind==1) { // PRB is allocated
if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs
prb_off = 12*prb;
prb_off2 = 1+(12*(prb-(frame_parms->N_RB_DL>>1)));
......@@ -3912,9 +3919,53 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
rxF_ext+=8;
} // pilots==1
}
} else { // Odd number of RBs
// PBCH
if ((subframe==0) &&
(prb>((frame_parms->N_RB_DL>>1)-3)) &&
(prb<((frame_parms->N_RB_DL>>1)+3)) &&
(l>=(nsymb>>1)) &&
(l<((nsymb>>1) + 4))) {
rb_alloc_ind = 0;
// printf("symbol %d / rb %d: skipping PBCH REs\n",symbol,prb);
}
//SSS
if (((subframe==0)||(subframe==5)) &&
(prb>((frame_parms->N_RB_DL>>1)-3)) &&
(prb<((frame_parms->N_RB_DL>>1)+3)) &&
(l==sss_symb) ) {
rb_alloc_ind = 0;
// printf("symbol %d / rb %d: skipping SSS REs\n",symbol,prb);
}
//PSS in subframe 0/5 if FDD
if (frame_parms->frame_type == FDD) { //FDD
if (((subframe==0)||(subframe==5)) &&
(prb>((frame_parms->N_RB_DL>>1)-3)) &&
(prb<((frame_parms->N_RB_DL>>1)+3)) &&
(l==pss_symb) ) {
rb_alloc_ind = 0;
// printf("symbol %d / rb %d: skipping PSS REs\n",symbol,prb);
}
}
if ((frame_parms->frame_type == TDD) &&
((subframe==1) || (subframe==6))) { //TDD Subframe 1-6
if ((prb>((frame_parms->N_RB_DL>>1)-3)) &&
(prb<((frame_parms->N_RB_DL>>1)+3)) &&
(l==pss_symb) ) {
rb_alloc_ind = 0;
}
}
if (rb_alloc_ind == 1) {
skip_half=0;
//Check if we have to drop half a PRB due to PSS/SSS/PBCH
......@@ -3947,13 +3998,12 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
if (((frame_parms->frame_type == FDD) &&
(((subframe==0)||(subframe==5)))) || //FDD Subframes 0,5
((frame_parms->frame_type == TDD) &&
(((subframe==2) || (subframe==6))))) { //TDD Subframes 2,6
(((subframe==1) || (subframe==6))))) { //TDD Subframes 1,6
if ((prb==((frame_parms->N_RB_DL>>1)-3)) &&
(l==pss_symb))
skip_half=1;
else if (((subframe==0)||(subframe==5)) &&
(prb==((frame_parms->N_RB_DL>>1)+3)) &&
else if ((prb==((frame_parms->N_RB_DL>>1)+3)) &&
(l==pss_symb))
skip_half=2;
}
......@@ -3973,9 +4023,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
rxF = &rxdataF[aarx][prb_off2+
(symbol*(frame_parms->ofdm_symbol_size))];
}
// printf("symbol %d / rb %d: alloc %d skip_half %d (rxF %p, rxF_ext %p) prb_off (%d,%d)\n",symbol,prb,rb_alloc_ind,skip_half,rxF,rxF_ext,prb_off,prb_off2);
#ifdef DEBUG_DLSCH_DEMOD
printf("symbol %d / rb %d: alloc %d skip_half %d (rxF %p, rxF_ext %p) prb_off (%d,%d)\n",symbol,prb,rb_alloc_ind,skip_half,rxF,rxF_ext,prb_off,prb_off2);
#endif
*pmi_loc = (pmi>>((prb>>2)<<1))&3;
// printf("symbol_mod %d (pilots %d) rb %d, sb %d, pmi %d (pmi_loc %p,rxF %p, ch00 %p, ch01 %p, rxF_ext %p dl_ch0_ext %p dl_ch1_ext %p)\n",symbol_mod,pilots,rb,rb>>2,*pmi_loc,pmi_loc,rxF,dl_ch0, dl_ch1, rxF_ext,dl_ch0_ext,dl_ch1_ext);
......@@ -3987,6 +4037,10 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t));
memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t));
memcpy(rxF_ext,rxF,6*sizeof(int32_t));
#ifdef DEBUG_DLSCH_DEMOD
for (i=0;i<6;i++)
printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
dl_ch0_ext+=6;
dl_ch1_ext+=6;
rxF_ext+=6;
......@@ -3994,6 +4048,10 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
memcpy(dl_ch0_ext,dl_ch0p+6,6*sizeof(int32_t));
memcpy(dl_ch1_ext,dl_ch1p+6,6*sizeof(int32_t));
memcpy(rxF_ext,rxF+6,6*sizeof(int32_t));
#ifdef DEBUG_DLSCH_DEMOD
for (i=0;i<6;i++)
printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
dl_ch0_ext+=6;
dl_ch1_ext+=6;
rxF_ext+=6;
......@@ -4001,8 +4059,10 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
memcpy(dl_ch0_ext,dl_ch0p,12*sizeof(int32_t));
memcpy(dl_ch1_ext,dl_ch1p,12*sizeof(int32_t));
memcpy(rxF_ext,rxF,12*sizeof(int32_t));
// for (i=0;i<12;i++)
// printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#ifdef DEBUG_DLSCH_DEMOD
for (i=0;i<12;i++)
printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
dl_ch0_ext+=12;
dl_ch1_ext+=12;
rxF_ext+=12;
......@@ -4015,7 +4075,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
if ((i!=frame_parms->nushift) &&
(i!=((frame_parms->nushift+3)%6))) {
rxF_ext[j]=rxF[i];
// printf("(pilots,skip1)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("(pilots,skip1)extract rb %d, re %d (%d)=> (%d,%d)\n",prb,i,j,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j]=dl_ch0p[i];
dl_ch1_ext[j++]=dl_ch1p[i];
}
......@@ -4028,15 +4090,17 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
if ((i!=frame_parms->nushift) &&
(i!=((frame_parms->nushift+3)%6))) {
rxF_ext[j]=rxF[(i+6)];
// printf("(pilots,skip2)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("(pilots,skip2)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j]=dl_ch0p[i+6];
dl_ch1_ext[j++]=dl_ch1p[i+6];
}
}
dl_ch0_ext+=4;
dl_ch1_ext+=4;
rxF_ext+=4;
}
} else { //skip_half==0
for (i=0; i<12; i++) {
if ((i!=frame_parms->nushift) &&
......@@ -4044,7 +4108,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
(i!=frame_parms->nushift+6) &&
(i!=((frame_parms->nushift+9)%12))) {
rxF_ext[j]=rxF[i];
// printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j] =dl_ch0p[i];
dl_ch1_ext[j++]=dl_ch1p[i];
}
......@@ -4060,10 +4126,11 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t));
memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t));
memcpy(rxF_ext,rxF,6*sizeof(int32_t));
/*
#ifdef DEBUG_DLSCH_DEMOD
for (i=0; i<6; i++) {
printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
}*/
}
#endif
rxF_ext+=6;
dl_ch0_ext+=6;
dl_ch1_ext+=6;
......@@ -4075,9 +4142,11 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t));
memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t));
memcpy(rxF_ext,rxF,6*sizeof(int32_t));
/*for (i=0; i<6; i++) {
#ifdef DEBUG_DLSCH_DEMOD
for (i=0; i<6; i++) {
printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
}*/
}
#endif
rxF_ext+=6;
dl_ch0_ext+=6;
dl_ch1_ext+=6;
......@@ -4090,7 +4159,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
dl_ch0_ext[j]=dl_ch0p[i];
dl_ch1_ext[j]=dl_ch1p[i];
rxF_ext[j++]=rxF[i];
//printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF[i],*(1+(short*)&rxF[i]));
#ifdef DEBUG_DLSCH_DEMOD
printf("(pilots)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF[i],*(1+(short*)&rxF[i]));
#endif
}
}
rxF = &rxdataF[aarx][1+symbol*(frame_parms->ofdm_symbol_size)];
......@@ -4100,8 +4171,10 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
(i!=((frame_parms->nushift+9)%12))) {
dl_ch0_ext[j]=dl_ch0p[i];
dl_ch1_ext[j]=dl_ch1p[i];
rxF_ext[j++]=rxF[(i-6)];
//printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF[1+i-6],*(1+(short*)&rxF[1+i-6]));
rxF_ext[j++]=rxF[i-6];
#ifdef DEBUG_DLSCH_DEMOD
printf("(pilots)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF[1+i-6],*(1+(short*)&rxF[1+i-6]));
#endif
}
}
......
......@@ -672,6 +672,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
// printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
for (i=0; i<len; i++) {
*llr32 = *rxF;
// printf("llr %d : (%d,%d)\n",i,((int16_t*)llr32)[0],((int16_t*)llr32)[1]);
rxF++;
llr32++;
}
......
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