Commit fb902d98 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'develop' into bugfix-40-channel_bandwidth

parents bc1f00e9 94a42bec
......@@ -1649,7 +1649,7 @@ foreach(myExe s1ap
${OPENAIR3_DIR}/TEST/test_${myExe}.c
)
target_link_libraries (test_${myExe}
-Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
-Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
endforeach(myExe)
......
......@@ -47,6 +47,7 @@ PRINT_STATS="False"
VCD_TIMING="False"
REL="Rel10"
HW="EXMIMO"
NOS1=0
EPC=0
VERBOSE_COMPILE=0
CFLAGS_PROCESSOR_USER=""
......@@ -270,7 +271,6 @@ function main() {
echo_info "installing packages for BALDERF support"
check_install_bladerf_driver
fi
fi
if [ "$INSTALL_OPTIONAL" = "1" ] ; then
......@@ -321,7 +321,7 @@ function main() {
cmake ..
fi
if [ "$eNB" = "1" ] ; then
if [ "$eNB" = "1" -o "$UE" = "1" ] ; then
echo_info "Compiling $lte_exec"
compilations \
$lte_build_dir $lte_exec \
......@@ -338,7 +338,7 @@ function main() {
fi
fi
if [ "$UE" = 1 ] ; then
if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then
# ue_ip driver compilation
echo_info "Compiling UE specific part"
compilations \
......
......@@ -45,7 +45,6 @@
#include "PHY/sse_intrin.h"
#ifndef USER_MODE
#define NOCYGWIN_STATIC static
#else
......@@ -53,7 +52,7 @@
#endif
//#define DEBUG_PHY 1
//#define DEBUG_DLSCH_MOD 1
//#define DEBUG_DLSCH_DEMOD 1
int avg[4];
......@@ -3098,12 +3097,14 @@ void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms,
// Alamouti RX combining
// printf("Alamouti: symbol %d, rb %d, re %d: rxF0 (%d,%d,%d,%d), rxF1 (%d,%d,%d,%d)\n",symbol,rb,re,rxF0[0],rxF0[1],rxF0[2],rxF0[3],rxF1[0],rxF1[1],rxF1[2],rxF1[3]);
rxF0[0] = rxF0[0] + rxF1[2];
rxF0[1] = rxF0[1] - rxF1[3];
rxF0[2] = rxF0[2] - rxF1[0];
rxF0[3] = rxF0[3] + rxF1[1];
// printf("Alamouti: rxF0 after (%d,%d,%d,%d)\n",rxF0[0],rxF0[1],rxF0[2],rxF0[3]);
rxF0+=4;
rxF1+=4;
......@@ -3229,12 +3230,40 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
else
rb_alloc_ind = 0;
if (rb_alloc_ind == 1)
nb_rb++;
// For second half of RBs skip DC carrier
if (rb==(frame_parms->N_RB_DL>>1)) {
rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))];
//dl_ch0++;
}
// 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))) {
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) ) {
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) ) {
rb_alloc_ind = 0;
}
}
if ((frame_parms->frame_type == TDD) &&
(subframe==6)) { //TDD Subframe 6
if ((rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) {
rb_alloc_ind = 0;
}
}
if (rb_alloc_ind==1) {
*pmi_ext = (pmi>>((rb>>2)<<1))&3;
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
......@@ -3272,7 +3301,7 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
rxF_ext+=10;
}
nb_rb++;
}
dl_ch0+=12;
......@@ -3281,7 +3310,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
}
else { // Odd number of RBs
for (rb=0; rb<frame_parms->N_RB_DL>>1; rb++) {
// printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]);
#ifdef DEBUG_DLSCH_DEMOD
printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]);
#endif
skip_half=0;
if (rb < 32)
......@@ -3295,6 +3326,8 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
else
rb_alloc_ind = 0;
if (rb_alloc_ind == 1)
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))) {
......@@ -3328,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;
}
......@@ -3352,32 +3388,42 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
if (rb_alloc_ind==1) {
// printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#ifdef DEBUG_DLSCH_DEMOD
printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#endif
if (pilots==0) {
// printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half);
if (skip_half==1) {
memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int));
for (i=0; i<6; i++)
for (i=0; i<6; i++) {
rxF_ext[i]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else if (skip_half==2) {
memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int));
for (i=0; i<6; i++)
for (i=0; i<6; i++) {
rxF_ext[i]=rxF[(i+6)];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else {
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
for (i=0; i<12; i++)
for (i=0; i<12; i++) {
rxF_ext[i]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=12;
rxF_ext+=12;
}
......@@ -3389,18 +3435,21 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
rxF_ext[j]=rxF[i];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i];
}
}
dl_ch0_ext+=5;
rxF_ext+=5;
dl_ch0_ext+=5;
} else if (skip_half==2) {
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
rxF_ext[j]=rxF[(i+6)];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i+6];
}
}
......@@ -3412,7 +3461,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
if ((i!=(frame_parms->nushift+poffset)) &&
(i!=((frame_parms->nushift+poffset+6)%12))) {
rxF_ext[j]=rxF[i];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i];
}
......@@ -3422,8 +3473,6 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
rxF_ext+=10;
}
}
nb_rb++;
}
dl_ch0+=12;
......@@ -3444,36 +3493,42 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
rb_alloc_ind = 0;
if (rb_alloc_ind == 1)
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);
if (rb_alloc_ind==1) {
// printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#ifdef DEBUG_DLSCH_DEMOD
printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#endif
if (pilots==0) {
for (i=0; i<6; i++) {
dl_ch0_ext[i]=dl_ch0[i];
......@@ -3496,7 +3551,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
if (i!=((frame_parms->nushift+poffset)%6)) {
dl_ch0_ext[j]=dl_ch0[i];
rxF_ext[j++]=rxF[i];
// printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
#ifdef DEBUG_DLSCH_DEMOD
printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
#endif
}
}
......@@ -3506,7 +3563,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
if (i!=((frame_parms->nushift+6+poffset)%12)) {
dl_ch0_ext[j]=dl_ch0[i];
rxF_ext[j++]=rxF[(1+i-6)];
// printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
#ifdef DEBUG_DLSCH_DEMOD
printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1]));
#endif
}
}
......@@ -3514,7 +3573,6 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
rxF_ext+=10;
} // symbol_mod==0
nb_rb++;
} // rballoc==1
else {
rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))];
......@@ -3540,7 +3598,8 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
else
rb_alloc_ind = 0;
if (rb_alloc_ind == 1)
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))) {
......@@ -3590,7 +3649,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
}
if (rb_alloc_ind==1) {
// printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#ifdef DEBUG_DLSCH_DEMOD
printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half);
#endif
/*
printf("rb %d\n",rb);
for (i=0;i<12;i++)
......@@ -3602,27 +3663,36 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
if (skip_half==1) {
memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int));
for (i=0; i<6; i++)
for (i=0; i<6; i++) {
rxF_ext[i]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else if (skip_half==2) {
memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int));
for (i=0; i<6; i++)
for (i=0; i<6; i++) {
rxF_ext[i]=rxF[(i+6)];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=6;
rxF_ext+=6;
} else {
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
for (i=0; i<12; i++)
for (i=0; i<12; i++) {
rxF_ext[i]=rxF[i];
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i]));
#endif
}
dl_ch0_ext+=12;
rxF_ext+=12;
}
......@@ -3634,7 +3704,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
rxF_ext[j]=rxF[i];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i];
}
}
......@@ -3645,7 +3717,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
for (i=0; i<6; i++) {
if (i!=((frame_parms->nushift+poffset)%6)) {
rxF_ext[j]=rxF[(i+6)];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i+6];
}
}
......@@ -3657,7 +3731,9 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
if ((i!=(frame_parms->nushift+poffset)) &&
(i!=((frame_parms->nushift+poffset+6)%12))) {
rxF_ext[j]=rxF[i];
// printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#ifdef DEBUG_DLSCH_DEMOD
printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j]));
#endif
dl_ch0_ext[j++]=dl_ch0[i];
}
}
......@@ -3666,8 +3742,6 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
rxF_ext+=10;
}
} // pilots=0
nb_rb++;
}
dl_ch0+=12;
......@@ -3750,9 +3824,15 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
else
rb_alloc_ind = 0;
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))) {
......@@ -3763,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;
......@@ -3775,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;
......@@ -3786,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;
}
......@@ -3794,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)));
......@@ -3839,10 +3919,53 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
rxF_ext+=8;
} // pilots==1
nb_rb++;
}
} 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
......@@ -3875,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;
}
......@@ -3901,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);
......@@ -3915,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;
......@@ -3922,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;
......@@ -3929,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));
#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]));
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;
......@@ -3943,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];
}
......@@ -3956,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) &&
......@@ -3972,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];
}
......@@ -3982,31 +4120,33 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
rxF_ext+=8;
} //skip_half==0
} //pilots==1
nb_rb++;
} else { // Do middle RB (around DC)
if (pilots==0) {
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;
dl_ch0p+=6;
dl_ch1p+=6;
rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))];
rxF = &rxdataF[aarx][1+((symbol*(frame_parms->ofdm_symbol_size)))];
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;
......@@ -4019,18 +4159,22 @@ 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][symbol*(frame_parms->ofdm_symbol_size)];
rxF = &rxdataF[aarx][1+symbol*(frame_parms->ofdm_symbol_size)];
for (; i<12; i++) {
if ((i!=((frame_parms->nushift+6)%12)) &&
(i!=((frame_parms->nushift+9)%12))) {
dl_ch0_ext[j]=dl_ch0p[i];
dl_ch1_ext[j]=dl_ch1p[i];
rxF_ext[j++]=rxF[(1+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
}
}
......@@ -4038,7 +4182,6 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
dl_ch1_ext+=8;
rxF_ext+=8;
} //pilots==1
nb_rb++;
} // if Middle PRB
} // if odd PRB
} // if rballoc==1
......@@ -4126,7 +4269,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per
#endif
#ifdef DEBUG_DLSCH_DEMOD
/*
void print_bytes(char *s,__m128i *x)
{
......@@ -4164,5 +4307,5 @@ void print_ints(char *s,__m128i *x)
printf("%s : %d,%d,%d,%d\n",s,
tempb[0],tempb[1],tempb[2],tempb[3]);
}
}*/
#endif
......@@ -662,16 +662,17 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) {
if (frame_parms->mode1_flag==0)
len = (nb_rb*8);// - (2*pbch_pss_sss_adjust/3);
len = (nb_rb*8)- (2*pbch_pss_sss_adjust/3);
else
len = (nb_rb*10);// - (5*pbch_pss_sss_adjust/6);
len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6);
} else {
len = (nb_rb*12);// - pbch_pss_sss_adjust;
len = (nb_rb*12) - pbch_pss_sss_adjust;
}
// 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);
// 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++;
}
......
......@@ -42,9 +42,9 @@ static
void do_kdf(uint8_t *key, unsigned key_length, uint8_t *data, unsigned data_length,
uint8_t *exp, unsigned exp_length)
{
uint8_t *result;
uint8_t result[32];
kdf(key, key_length, data, data_length, &result, 32);
kdf(key, key_length, data, data_length, result, 32);
if (compare_buffer(result, exp_length, exp, exp_length) != 0) {
fail("Fail: kdf\n");
......
......@@ -39,15 +39,15 @@ static
void do_derive_kenb(uint32_t nas_count, const uint8_t *kasme, const unsigned length,
const uint8_t *kenb_exp)
{
uint8_t *kenb;
uint8_t kenb[32];
derive_keNB(kasme, nas_count, &kenb);
memset(kenb, 0, sizeof(kenb));
derive_keNB(kasme, nas_count, kenb);
if (compare_buffer(kenb_exp, length, kenb, length) != 0) {
fail("Fail: kenb derivation\n");
}
free(kenb);
}
void doit (void)
......
......@@ -39,21 +39,23 @@ static
void derive_knas_keys(algorithm_type_dist_t atd, uint8_t *kasme, unsigned length,
uint8_t *knas_enc_exp, uint8_t *knas_int_exp)
{
uint8_t *knas_enc;
uint8_t *knas_int;
uint8_t *knas_enc = NULL;
uint8_t *knas_int = NULL;
derive_key_nas_enc(atd, kasme, &knas_enc);
derive_key_nas_int(atd, kasme, &knas_int);
knas_enc = calloc(1, 32);
knas_int = calloc(1, 32);
derive_key_nas_enc(atd, kasme, knas_enc);
derive_key_nas_int(atd, kasme, knas_int);
/* Compare both keys with expected */
if (compare_buffer(knas_enc, 32, knas_enc_exp, 32) != 0) {
if (compare_buffer(knas_enc, 16, &knas_enc_exp[16], 16) != 0) {
fail("Fail: knas_enc derivation\n");
}
if (compare_buffer(knas_int, 32, knas_int_exp, 32) != 0) {
if (compare_buffer(knas_int, 16, &knas_int_exp[16], 16) != 0) {
fail("Fail: knas_int derivation\n");
}
free(knas_enc);
free(knas_int);
}
......
......@@ -40,14 +40,15 @@ void eea1_encrypt(uint8_t direction, uint32_t count,
uint8_t bearer, uint8_t *key, uint32_t key_length, uint8_t *message,
uint32_t length, uint8_t *expected)
{
nas_stream_cipher_t *nas_cipher;
uint8_t *result;
nas_stream_cipher_t *nas_cipher = NULL;
uint8_t *result = NULL;
uint32_t zero_bits = length & 7;
uint32_t byte_length = length >> 3;
if (zero_bits > 0)
byte_length += 1;
result = calloc(1, byte_length);
nas_cipher = calloc(1, sizeof(nas_stream_cipher_t));
nas_cipher->direction = direction;
......@@ -58,7 +59,7 @@ void eea1_encrypt(uint8_t direction, uint32_t count,
nas_cipher->blength = length;
nas_cipher->message = message;
if (nas_stream_encrypt_eea1(nas_cipher, &result) != 0)
if (nas_stream_encrypt_eea1(nas_cipher, result) != 0)
fail("Fail: nas_stream_encrypt_eea1\n");
if (compare_buffer(result, byte_length, expected, byte_length) != 0) {
......
......@@ -40,14 +40,15 @@ void eea2_encrypt(uint8_t direction, uint32_t count,
uint8_t bearer, uint8_t *key, uint32_t key_length, uint8_t *message,
uint32_t length, uint8_t *expected)
{
nas_stream_cipher_t *nas_cipher;
uint8_t *result;
nas_stream_cipher_t *nas_cipher = NULL;
uint8_t *result = NULL;
uint32_t zero_bits = length & 7;
uint32_t byte_length = length >> 3;
if (zero_bits > 0)
byte_length += 1;
result = calloc(1, byte_length);
nas_cipher = calloc(1, sizeof(nas_stream_cipher_t));
nas_cipher->direction = direction;
......@@ -58,7 +59,7 @@ void eea2_encrypt(uint8_t direction, uint32_t count,
nas_cipher->blength = length;
nas_cipher->message = message;
if (nas_stream_encrypt_eea2(nas_cipher, &result) != 0)
if (nas_stream_encrypt_eea2(nas_cipher, result) != 0)
fail("Fail: nas_stream_encrypt_eea2\n");
if (compare_buffer(result, byte_length, expected, byte_length) != 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