diff --git a/srslte/examples/pdsch_enodeb.c b/srslte/examples/pdsch_enodeb.c index cb8f6b049..1d0e28cfe 100644 --- a/srslte/examples/pdsch_enodeb.c +++ b/srslte/examples/pdsch_enodeb.c @@ -345,7 +345,7 @@ int update_radl() { srslte_ra_pdsch_fprint(stdout, &ra_dl, cell.nof_prb); srslte_ra_dl_grant_t dummy_grant; srslte_ra_nbits_t dummy_nbits; - srslte_ra_dl_dci_to_grant(&ra_dl, cell.nof_prb, true, &dummy_grant); + srslte_ra_dl_dci_to_grant(&ra_dl, cell.nof_prb, UE_CRNTI, &dummy_grant); srslte_ra_dl_grant_to_nbits(&dummy_grant, cfi, cell, 0, &dummy_nbits); srslte_ra_dl_grant_fprint(stdout, &dummy_grant); printf("Type new MCS index and press Enter: "); fflush(stdout); @@ -617,7 +617,7 @@ int main(int argc, char **argv) { /* Configure pdsch_cfg parameters */ srslte_ra_dl_grant_t grant; - srslte_ra_dl_dci_to_grant(&ra_dl, cell.nof_prb, true, &grant); + srslte_ra_dl_dci_to_grant(&ra_dl, cell.nof_prb, UE_CRNTI, &grant); if (srslte_pdsch_cfg(&pdsch_cfg, cell, &grant, cfi, sf_idx, 0)) { fprintf(stderr, "Error configuring PDSCH\n"); exit(-1); diff --git a/srslte/include/srslte/phch/ra.h b/srslte/include/srslte/phch/ra.h index d34fb3b3d..9edbfce3c 100644 --- a/srslte/include/srslte/phch/ra.h +++ b/srslte/include/srslte/phch/ra.h @@ -189,7 +189,7 @@ SRSLTE_API char* srslte_ra_dl_dci_string(srslte_ra_dl_dci_t *dci); SRSLTE_API int srslte_ra_dl_dci_to_grant(srslte_ra_dl_dci_t *dci, uint32_t nof_prb, - bool crc_is_crnti, + uint16_t rnti, srslte_ra_dl_grant_t *grant); SRSLTE_API void srslte_ra_dl_grant_to_nbits(srslte_ra_dl_grant_t *grant, diff --git a/srslte/lib/phch/dci.c b/srslte/lib/phch/dci.c index 0327df2df..69fedaead 100644 --- a/srslte/lib/phch/dci.c +++ b/srslte/lib/phch/dci.c @@ -79,7 +79,7 @@ int srslte_dci_msg_to_dl_grant(srslte_dci_msg_t *msg, uint16_t msg_rnti, return ret; } - srslte_ra_dl_dci_to_grant(dl_dci, nof_prb, crc_is_crnti, grant); + srslte_ra_dl_dci_to_grant(dl_dci, nof_prb, msg_rnti, grant); if (SRSLTE_VERBOSE_ISINFO()) { srslte_ra_pdsch_fprint(stdout, dl_dci, nof_prb); diff --git a/srslte/lib/phch/ra.c b/srslte/lib/phch/ra.c index 4f373784e..eaad6c5eb 100644 --- a/srslte/lib/phch/ra.c +++ b/srslte/lib/phch/ra.c @@ -458,8 +458,12 @@ void srslte_ra_dl_grant_to_nbits(srslte_ra_dl_grant_t *grant, uint32_t cfi, srsl } /** Obtains a DL grant from a DCI grant for PDSCH */ -int srslte_ra_dl_dci_to_grant(srslte_ra_dl_dci_t *dci, uint32_t nof_prb, bool crc_is_crnti, srslte_ra_dl_grant_t *grant) +int srslte_ra_dl_dci_to_grant(srslte_ra_dl_dci_t *dci, uint32_t nof_prb, uint16_t msg_rnti, srslte_ra_dl_grant_t *grant) { + bool crc_is_crnti = false; + if (msg_rnti >= SRSLTE_CRNTI_START && msg_rnti <= SRSLTE_CRNTI_END) { + crc_is_crnti = true; + } // Compute PRB allocation if (!dl_dci_to_grant_prb_allocation(dci, grant, nof_prb)) { // Compute MCS @@ -467,6 +471,13 @@ int srslte_ra_dl_dci_to_grant(srslte_ra_dl_dci_t *dci, uint32_t nof_prb, bool cr // Fill rest of grant structure grant->mcs.idx = dci->mcs_idx; grant->Qm = srslte_mod_bits_x_symbol(grant->mcs.mod); + + // Apply Section 7.1.7.3. If RA-RNTI and Format1C rv_idx=0 + if (msg_rnti >= SRSLTE_RARNTI_START && msg_rnti <= SRSLTE_RARNTI_END && + dci->dci_format == SRSLTE_RA_DCI_FORMAT1C) + { + dci->rv_idx = 0; + } } else { return SRSLTE_ERROR; } diff --git a/srslte/lib/phch/test/CMakeLists.txt b/srslte/lib/phch/test/CMakeLists.txt index 595c376cd..9789a605d 100644 --- a/srslte/lib/phch/test/CMakeLists.txt +++ b/srslte/lib/phch/test/CMakeLists.txt @@ -95,7 +95,8 @@ target_link_libraries(pdsch_test srslte) add_test(pdsch_test_qpsk pdsch_test -m 10 -n 50 -r 1) add_test(pdsch_test_qam16 pdsch_test -m 20 -n 100) -add_test(pdsch_test_qam64 pdsch_test -m 28 -n 100 -r 0) +add_test(pdsch_test_qam16 pdsch_test -m 20 -n 100 -r 2) +add_test(pdsch_test_qam64 pdsch_test -m 28 -n 100) BuildMex(MEXNAME pdsch SOURCES pdsch_test_mex.c LIBRARIES srslte_static srslte_mex) BuildMex(MEXNAME dlsch_encode SOURCES dlsch_encode_test_mex.c LIBRARIES srslte_static srslte_mex) diff --git a/srslte/lib/phch/test/pdsch_test.c b/srslte/lib/phch/test/pdsch_test.c index b505c42ae..44d131d0b 100644 --- a/srslte/lib/phch/test/pdsch_test.c +++ b/srslte/lib/phch/test/pdsch_test.c @@ -135,10 +135,11 @@ int main(int argc, char **argv) { srslte_ra_dl_dci_t dci; bzero(&dci, sizeof(srslte_ra_dl_dci_t)); + dci.dci_format = SRSLTE_DCI_FORMAT1; dci.mcs_idx = mcs; dci.rv_idx = rv_idx; dci.type0_alloc.rbg_bitmask = 0xffffffff; - if (srslte_ra_dl_dci_to_grant(&dci, cell.nof_prb, true, &grant)) { + if (srslte_ra_dl_dci_to_grant(&dci, cell.nof_prb, rnti, &grant)) { fprintf(stderr, "Error computing resource allocation\n"); return ret; }