diff --git a/srslte/include/srslte/enb/enb_ul.h b/srslte/include/srslte/enb/enb_ul.h index 9a05436ba..6e426b81c 100644 --- a/srslte/include/srslte/enb/enb_ul.h +++ b/srslte/include/srslte/enb/enb_ul.h @@ -94,10 +94,9 @@ typedef struct { srslte_dci_location_t location; uint32_t rv_idx; uint32_t current_tx_nb; - bool needs_pdcch; uint8_t *data; srslte_softbuffer_rx_t *softbuffer; - + bool needs_pdcch; } srslte_enb_ul_pusch_t; /* This function shall be called just after the initial synchronization */ diff --git a/srslte/include/srslte/phch/ra.h b/srslte/include/srslte/phch/ra.h index 5da9a191b..176ccecf9 100644 --- a/srslte/include/srslte/phch/ra.h +++ b/srslte/include/srslte/phch/ra.h @@ -206,6 +206,10 @@ SRSLTE_API void srslte_ra_dl_grant_to_nbits(srslte_ra_dl_grant_t *grant, uint32_t sf_idx, srslte_ra_nbits_t *nbits); +SRSLTE_API uint32_t srslte_ra_dl_approx_nof_re(srslte_cell_t cell, + uint32_t nof_prb, + uint32_t nof_ctrl_symbols); + SRSLTE_API uint32_t srslte_ra_dl_grant_nof_re(srslte_ra_dl_grant_t *grant, srslte_cell_t cell, uint32_t sf_idx, diff --git a/srslte/lib/phch/ra.c b/srslte/lib/phch/ra.c index 2f4db4074..9f5da581f 100644 --- a/srslte/lib/phch/ra.c +++ b/srslte/lib/phch/ra.c @@ -198,6 +198,7 @@ static int ul_dci_to_grant_mcs(srslte_ra_ul_dci_t *dci, srslte_ra_ul_grant_t *gr // 8.6.1 and 8.6.2 36.213 second paragraph grant->mcs.mod = SRSLTE_MOD_QPSK; tbs = srslte_ra_tbs_from_idx(last_ul_tbs_idx[harq_pid%8], grant->L_prb); + dci->rv_idx = 1; } else if (dci->mcs_idx >= 29) { // Else use last TBS/Modulation and use mcs to obtain rv_idx tbs = srslte_ra_tbs_from_idx(last_ul_tbs_idx[harq_pid%8], grant->L_prb); @@ -249,6 +250,24 @@ int srslte_ra_ul_dci_to_grant(srslte_ra_ul_dci_t *dci, uint32_t nof_prb, uint32_ return SRSLTE_SUCCESS; } +uint32_t srslte_ra_dl_approx_nof_re(srslte_cell_t cell, uint32_t nof_prb, uint32_t nof_ctrl_symbols) +{ + uint32_t nof_refs = 0; + uint32_t nof_symb = 2*SRSLTE_CP_NSYMB(cell.cp)-nof_ctrl_symbols; + switch(cell.nof_ports) { + case 1: + nof_refs = 2*3; + break; + case 2: + nof_refs = 4*3; + break; + case 4: + nof_refs = 4*4; + break; + } + return nof_prb * (nof_symb*SRSLTE_NRE-nof_refs); +} + /* Computes the number of RE for each PRB in the prb_dist structure */ uint32_t srslte_ra_dl_grant_nof_re(srslte_ra_dl_grant_t *grant, srslte_cell_t cell, uint32_t sf_idx, uint32_t nof_ctrl_symbols)