diff --git a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h index aa21de552b47c4d6a54307eab737c197459fddac..be0d8ebb99d3ab5469e77bc20475e937c74f00de 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h +++ b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h @@ -690,14 +690,16 @@ typedef struct { // int calibration_flag; /// delta_TF for power control int32_t delta_TF; - ///////////////////////////////////////////// 3 parameter added by vincent /////////////////////////////////////////////// + ///////////////////////////////////////////// 4 parameter added by vincent /////////////////////////////////////////////// // NB_IoT: Nsymb_UL and Nslot_UL are defined in 36.211, Section 10.1.2.3, Table 10.1.2.3-1 // The number of symbol in a resource unit is given by Nsymb_UL*Nslot_UL uint8_t Nsymb_UL; // Number of NPUSCH slots uint8_t Nslot_UL; - // Number of subcarrier for NPUSH - uint8_t N_sc_RU; + // Number of subcarrier for NPUSH, can be 1, 3, 6, 12 + uint8_t N_sc_RU; + // index of UL NB_IoT resource block + uint32_t UL_RB_ID_NB_IoT; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } NB_IoT_UL_eNB_HARQ_t; diff --git a/openair1/PHY/LTE_TRANSPORT/proto_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/proto_NB_IoT.h index b515e543de217cbfd762d164a466e70e1df1cd9f..7cc885cf38535a2f1c5300c7506465ae747ba77b 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto_NB_IoT.h +++ b/openair1/PHY/LTE_TRANSPORT/proto_NB_IoT.h @@ -220,7 +220,9 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB, void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, int32_t **rxdataF_ext, - uint32_t first_rb, + // uint32_t first_rb, + uint32_t UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block + uint8_t N_sc_RU, // number of subcarriers in UL uint32_t nb_rb, uint8_t l, uint8_t Ns, diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation_NB_IoT.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation_NB_IoT.c index c75bd80230003e231bcd29b2328fab34edaa17a6..c9fd2e1e87f62d1760809b05c868a87fa41e9244 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation_NB_IoT.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation_NB_IoT.c @@ -546,49 +546,65 @@ void ulsch_detection_mrc_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms, void ulsch_extract_rbs_single_NB_IoT(int32_t **rxdataF, int32_t **rxdataF_ext, - uint32_t first_rb, + // uint32_t first_rb, + uint32_t UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block + uint8_t N_sc_RU, // number of subcarriers in UL uint32_t nb_rb, uint8_t l, uint8_t Ns, NB_IoT_DL_FRAME_PARMS *frame_parms) { - uint16_t nb_rb1,nb_rb2; - uint8_t aarx; - int32_t *rxF,*rxF_ext; + uint16_t nb_rb1; + // uint16_t nb_rb2; + uint8_t aarx,n; + // int32_t *rxF,*rxF_ext; //uint8_t symbol = l+Ns*frame_parms->symbols_per_tti/2; uint8_t symbol = l+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + nb_rb1 = cmin(cmax((int)(frame_parms->N_RB_UL) - (int)(2*UL_RB_ID_NB_IoT),(int)0),(int)(2)); // 2 times no. RBs before the DC + // 2 times no. RBs after the DC - nb_rb1 = cmin(cmax((int)(frame_parms->N_RB_UL) - (int)(2*first_rb),(int)0),(int)(2*nb_rb)); // 2 times no. RBs before the DC - nb_rb2 = 2*nb_rb - nb_rb1; // 2 times no. RBs after the DC + // rxF_ext = &rxdataF_ext[aarx][(symbol*frame_parms->N_RB_UL*12)]; - rxF_ext = &rxdataF_ext[aarx][(symbol*frame_parms->N_RB_UL*12)]; + if (nb_rb1) { // RB NB-IoT is in the first half - if (nb_rb1) { - rxF = &rxdataF[aarx][(first_rb*12 + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size)]; - memcpy(rxF_ext, rxF, nb_rb1*6*sizeof(int)); - rxF_ext += nb_rb1*6; + for (n=0;n<N_sc_RU;n++){ + // Note that FFT split the RBs + rxdataF_ext[aarx][symbol*frame_parms->N_RB_UL*12 + n] = rxdataF[aarx][UL_RB_ID_NB_IoT*12 + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size + n]; + + } - if (nb_rb2) { - //#ifdef OFDMA_ULSCH - // rxF = &rxdataF[aarx][(1 + symbol*frame_parms->ofdm_symbol_size)*2]; - //#else - rxF = &rxdataF[aarx][(symbol*frame_parms->ofdm_symbol_size)]; - //#endif - memcpy(rxF_ext, rxF, nb_rb2*6*sizeof(int)); - rxF_ext += nb_rb2*6; + // rxF = &rxdataF[aarx][(first_rb*12 + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size)]; + // memcpy(rxF_ext, rxF, nb_rb1*6*sizeof(int)); + // rxF_ext += nb_rb1*6; + + // if (nb_rb2) { + // //#ifdef OFDMA_ULSCH + // // rxF = &rxdataF[aarx][(1 + symbol*frame_parms->ofdm_symbol_size)*2]; + // //#else + // rxF = &rxdataF[aarx][(symbol*frame_parms->ofdm_symbol_size)]; + // //#endif + // memcpy(rxF_ext, rxF, nb_rb2*6*sizeof(int)); + // rxF_ext += nb_rb2*6; + // } + } else { // RB NB-IoT is in the second half + + for (n=0;n<N_sc_RU;n++){ + // Note that FFT split the RBs + rxdataF_ext[aarx][symbol*frame_parms->N_RB_UL*12 + n] = rxdataF[aarx][6*(2*UL_RB_ID_NB_IoT - frame_parms->N_RB_UL) + symbol*frame_parms->ofdm_symbol_size + n]; + } - } else { //there is only data in the second half + //#ifdef OFDMA_ULSCH // rxF = &rxdataF[aarx][(1 + 6*(2*first_rb - frame_parms->N_RB_UL) + symbol*frame_parms->ofdm_symbol_size)*2]; //#else - rxF = &rxdataF[aarx][(6*(2*first_rb - frame_parms->N_RB_UL) + symbol*frame_parms->ofdm_symbol_size)]; - //#endif - memcpy(rxF_ext, rxF, nb_rb2*6*sizeof(int)); - rxF_ext += nb_rb2*6; + // rxF = &rxdataF[aarx][(6*(2*first_rb - frame_parms->N_RB_UL) + symbol*frame_parms->ofdm_symbol_size)]; + // //#endif + // memcpy(rxF_ext, rxF, nb_rb2*6*sizeof(int)); + // rxF_ext += nb_rb2*6; } } @@ -1417,7 +1433,9 @@ void rx_ulsch_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ulsch_extract_rbs_single_NB_IoT(common_vars->rxdataF[eNB_id], pusch_vars->rxdataF_ext[eNB_id], - ulsch[UE_id]->harq_process->first_rb, + // ulsch[UE_id]->harq_process->first_rb, + ulsch[UE_id]->harq_process->UL_RB_ID_NB_IoT, // index of UL NB_IoT resource block + ulsch[UE_id]->harq_process-> N_sc_RU, // number of subcarriers in UL ulsch[UE_id]->harq_process->nb_rb, l%(frame_parms->symbols_per_tti/2), l/(frame_parms->symbols_per_tti/2),