From 786830daf3264dcc1009f084becbd25390ac4bd5 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 2 May 2019 19:31:46 +0200 Subject: [PATCH] Fix minor issues for TDD --- lib/include/srslte/phy/phch/regs.h | 4 ++++ lib/src/phy/phch/dci.c | 4 ++++ lib/src/phy/phch/phich.c | 2 +- lib/src/phy/phch/regs.c | 8 +++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/include/srslte/phy/phch/regs.h b/lib/include/srslte/phy/phch/regs.h index e3af65f4a..6973b55c4 100644 --- a/lib/include/srslte/phy/phch/regs.h +++ b/lib/include/srslte/phy/phch/regs.h @@ -59,6 +59,7 @@ typedef struct SRSLTE_API { srslte_cell_t cell; uint32_t max_ctrl_symbols; uint32_t ngroups_phich; + uint32_t ngroups_phich_m1; srslte_phich_r_t phich_res; srslte_phich_length_t phich_len; @@ -107,6 +108,9 @@ SRSLTE_API int srslte_regs_phich_get(srslte_regs_t *h, uint32_t ngroup); SRSLTE_API uint32_t srslte_regs_phich_ngroups(srslte_regs_t *h); + +SRSLTE_API uint32_t srslte_regs_phich_ngroups_m1(srslte_regs_t* h); + SRSLTE_API int srslte_regs_phich_reset(srslte_regs_t *h, cf_t *slot_symbols); diff --git a/lib/src/phy/phch/dci.c b/lib/src/phy/phch/dci.c index 2f76ad014..d37b8c3c0 100644 --- a/lib/src/phy/phch/dci.c +++ b/lib/src/phy/phch/dci.c @@ -1204,6 +1204,10 @@ int srslte_dci_msg_unpack_pdsch( dci->nof_bits = msg->nof_bits; #endif + // Set dwpts flag + dci->is_dwpts = + cell->frame_type == SRSLTE_TDD && srslte_sfidx_tdd_type(sf->tdd_config, sf->tti % 10) == SRSLTE_TDD_SF_S; + switch (msg->format) { case SRSLTE_DCI_FORMAT1: return dci_format1_unpack(cell, sf, cfg, msg, dci); diff --git a/lib/src/phy/phch/phich.c b/lib/src/phy/phch/phich.c index 8f887afd2..9da6a6a7a 100644 --- a/lib/src/phy/phch/phich.c +++ b/lib/src/phy/phch/phich.c @@ -130,7 +130,7 @@ int srslte_phich_set_cell(srslte_phich_t *q, srslte_regs_t *regs, srslte_cell_t /* Computes n_group and n_seq according to Section 9.1.2 in 36.213 */ void srslte_phich_calc(srslte_phich_t* q, srslte_phich_grant_t* grant, srslte_phich_resource_t* n_phich) { - uint32_t Ngroups = srslte_phich_ngroups(q); + uint32_t Ngroups = srslte_regs_phich_ngroups_m1(q->regs); if (Ngroups) { if (n_phich) { n_phich->ngroup = (grant->n_prb_lowest + grant->n_dmrs) % Ngroups + grant->I_phich * Ngroups; diff --git a/lib/src/phy/phch/regs.c b/lib/src/phy/phch/regs.c index 6032d53eb..2e091dcd7 100644 --- a/lib/src/phy/phch/regs.c +++ b/lib/src/phy/phch/regs.c @@ -270,7 +270,8 @@ int regs_phich_init(srslte_regs_t* h, uint32_t phich_mi, bool mbsfn_or_sf1_6_tdd ng = 0; break; } - h->ngroups_phich = (int)phich_mi * ceilf(ng * ((float)h->cell.nof_prb / 8)); + h->ngroups_phich_m1 = (int)ceilf(ng * ((float)h->cell.nof_prb / 8)); + h->ngroups_phich = (int)phich_mi * h->ngroups_phich_m1; h->phich = malloc(sizeof(srslte_regs_ch_t) * h->ngroups_phich); if (!h->phich) { perror("malloc"); @@ -397,6 +398,11 @@ uint32_t srslte_regs_phich_ngroups(srslte_regs_t *h) { return h->ngroups_phich; } +uint32_t srslte_regs_phich_ngroups_m1(srslte_regs_t* h) +{ + return h->ngroups_phich_m1; +} + /** * Adds the PHICH symbols to the resource grid pointed by slot_symbols. *