diff --git a/srslte/include/srslte/ue/ue_ul.h b/srslte/include/srslte/ue/ue_ul.h index b0264a6e5..20642cdcc 100644 --- a/srslte/include/srslte/ue/ue_ul.h +++ b/srslte/include/srslte/ue/ue_ul.h @@ -51,8 +51,6 @@ #include "srslte/config.h" -#define SRSLTE_UE_UL_NOF_HARQ_PROCESSES 8 - /* UE UL power control */ typedef struct { // Common configuration diff --git a/srslte/lib/ch_estimation/chest_ul.c b/srslte/lib/ch_estimation/chest_ul.c index 75d816702..4366e865c 100644 --- a/srslte/lib/ch_estimation/chest_ul.c +++ b/srslte/lib/ch_estimation/chest_ul.c @@ -145,13 +145,13 @@ void srslte_chest_ul_set_cfg(srslte_chest_ul_t *q, } /* Uses the difference between the averaged and non-averaged pilot estimates */ -static float estimate_noise_pilots(srslte_chest_ul_t *q, cf_t *ce, uint32_t nrefs) +static float estimate_noise_pilots(srslte_chest_ul_t *q, cf_t *ce, uint32_t nrefs, uint32_t n_prb[2]) { float power = 0; for (int i=0;i<2;i++) { power += srslte_chest_estimate_noise_pilots(&q->pilot_estimates[i*nrefs], - &ce[SRSLTE_REFSIGNAL_UL_L(i, q->cell.cp)*q->cell.nof_prb*SRSLTE_NRE], + &ce[SRSLTE_REFSIGNAL_UL_L(i, q->cell.cp)*q->cell.nof_prb*SRSLTE_NRE+n_prb[i]*SRSLTE_NRE], q->tmp_noise, nrefs); } @@ -168,9 +168,9 @@ static float estimate_noise_pilots(srslte_chest_ul_t *q, cf_t *ce, uint32_t nref } } -#define cesymb(i) ce[SRSLTE_RE_IDX(q->cell.nof_prb,i,0)] - -static void interpolate_pilots(srslte_chest_ul_t *q, cf_t *ce, uint32_t nrefs) +// The interpolator currently only supports same frequency allocation for each subframe +#define cesymb(i) ce[SRSLTE_RE_IDX(q->cell.nof_prb,i,n_prb[0]*SRSLTE_NRE)] +static void interpolate_pilots(srslte_chest_ul_t *q, cf_t *ce, uint32_t nrefs, uint32_t n_prb[2]) { uint32_t L1 = SRSLTE_REFSIGNAL_UL_L(0, q->cell.cp); uint32_t L2 = SRSLTE_REFSIGNAL_UL_L(1, q->cell.cp); @@ -206,10 +206,10 @@ void srslte_chest_ul_set_smooth_filter3_coeff(srslte_chest_ul_t* q, float w) q->smooth_filter_len = 3; } -static void average_pilots(srslte_chest_ul_t *q, cf_t *input, cf_t *ce, uint32_t nrefs) { +static void average_pilots(srslte_chest_ul_t *q, cf_t *input, cf_t *ce, uint32_t nrefs, uint32_t n_prb[2]) { for (int i=0;i<2;i++) { srslte_chest_average_pilots(&input[i*nrefs], - &ce[SRSLTE_REFSIGNAL_UL_L(i, q->cell.cp)*q->cell.nof_prb*SRSLTE_NRE], + &ce[SRSLTE_REFSIGNAL_UL_L(i, q->cell.cp)*q->cell.nof_prb*SRSLTE_NRE+n_prb[i]*SRSLTE_NRE], q->smooth_filter, nrefs, 1, q->smooth_filter_len); } } @@ -237,21 +237,25 @@ int srslte_chest_ul_estimate(srslte_chest_ul_t *q, cf_t *input, cf_t *ce, srslte_vec_prod_conj_ccc(q->pilot_recv_signal, q->dmrs_pregen.r[cyclic_shift_for_dmrs][sf_idx][nof_prb], q->pilot_estimates, nrefs_sf); + if (n_prb[0] != n_prb[1]) { + printf("ERROR: intra-subframe frequency hopping not supported in the estimator!!\n"); + } + if (ce != NULL) { if (q->smooth_filter_len > 0) { - average_pilots(q, q->pilot_estimates, ce, nrefs_sym); - interpolate_pilots(q, ce, nrefs_sym); + average_pilots(q, q->pilot_estimates, ce, nrefs_sym, n_prb); + interpolate_pilots(q, ce, nrefs_sym, n_prb); /* If averaging, compute noise from difference between received and averaged estimates */ - q->noise_estimate = estimate_noise_pilots(q, ce, nrefs_sym); + q->noise_estimate = estimate_noise_pilots(q, ce, nrefs_sym, n_prb); } else { // Copy estimates to CE vector without averaging for (int i=0;i<2;i++) { - memcpy(&ce[SRSLTE_REFSIGNAL_UL_L(i, q->cell.cp)*q->cell.nof_prb*SRSLTE_NRE], + memcpy(&ce[SRSLTE_REFSIGNAL_UL_L(i, q->cell.cp)*q->cell.nof_prb*SRSLTE_NRE+n_prb[i]*SRSLTE_NRE], &q->pilot_estimates[i*nrefs_sym], - nrefs_sym*sizeof(cf_t)); + nrefs_sym*sizeof(cf_t)); } - interpolate_pilots(q, ce, nrefs_sym); + interpolate_pilots(q, ce, nrefs_sym, n_prb); q->noise_estimate = 0; } } diff --git a/srslte/lib/phch/pusch.c b/srslte/lib/phch/pusch.c index d1e9b6838..7f771159a 100644 --- a/srslte/lib/phch/pusch.c +++ b/srslte/lib/phch/pusch.c @@ -533,7 +533,7 @@ int srslte_pusch_decode(srslte_pusch_t *q, srslte_demod_soft_demodulate_s(cfg->grant.mcs.mod, q->d, q->q, cfg->nbits.nof_re); srslte_sequence_t *seq = NULL; - + // Create sequence if does not exist if (!q->users[rnti]) { seq = &q->tmp_seq; @@ -557,7 +557,7 @@ int srslte_pusch_decode(srslte_pusch_t *q, srslte_scrambling_s_offset(seq, q->q, 0, cfg->nbits.nof_bits); srslte_sequence_free(seq); } - + return srslte_ulsch_uci_decode(&q->ul_sch, cfg, softbuffer, q->q, q->g, data, uci_data); } else { return SRSLTE_ERROR_INVALID_INPUTS; diff --git a/srslte/lib/phch/sch.c b/srslte/lib/phch/sch.c index ad77035b8..3b521f794 100644 --- a/srslte/lib/phch/sch.c +++ b/srslte/lib/phch/sch.c @@ -463,7 +463,7 @@ static int decode_tb(srslte_sch_t *q, par_tx = ((uint32_t) parity[0])<<16 | ((uint32_t) parity[1])<<8 | ((uint32_t) parity[2]); if (!par_rx) { - INFO("Warning: Received all-zero transport block\n\n", 0); + INFO("Warning: Received all-zero transport block\n\n", 0); } if (par_rx == par_tx) { @@ -657,7 +657,7 @@ int srslte_ulsch_uci_decode(srslte_sch_t *q, srslte_pusch_cfg_t *cfg, srslte_sof } e_offset += Q_prime_cqi*Qm; - + // Decode ULSCH if (cfg->cb_segm.tbs > 0) { uint32_t G = nb_q/Qm - Q_prime_ri - Q_prime_cqi;