From 71a2ad8ea8bf06f08a1d7cf42969a79ed02296b9 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Mon, 29 Jan 2018 16:33:28 +0100 Subject: [PATCH] Catches RA PDCCH order in Format1A --- lib/include/srslte/phy/phch/ra.h | 6 +++++- lib/src/phy/phch/dci.c | 30 +++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lib/include/srslte/phy/phch/ra.h b/lib/include/srslte/phy/phch/ra.h index f4274e416..80097f78e 100644 --- a/lib/include/srslte/phy/phch/ra.h +++ b/lib/include/srslte/phy/phch/ra.h @@ -139,7 +139,11 @@ typedef struct SRSLTE_API { uint8_t tpc_pucch; bool tb_en[2]; - + + bool is_ra_order; + uint32_t ra_preamble; + uint32_t ra_mask_idx; + bool dci_is_1a; bool dci_is_1c; } srslte_ra_dl_dci_t; diff --git a/lib/src/phy/phch/dci.c b/lib/src/phy/phch/dci.c index 6e6e6fe87..e4d6dd159 100644 --- a/lib/src/phy/phch/dci.c +++ b/lib/src/phy/phch/dci.c @@ -71,12 +71,14 @@ int srslte_dci_msg_to_dl_grant(srslte_dci_msg_t *msg, uint16_t msg_rnti, //fprintf(stderr, "Can't unpack DCI message %s (%d)\n", srslte_dci_format_string(msg->format), msg->format); return ret; } - - 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); - srslte_ra_dl_grant_fprint(stdout, grant); + if (!dl_dci->is_ra_order) { + 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); + srslte_ra_dl_grant_fprint(stdout, grant); + } } ret = SRSLTE_SUCCESS; @@ -844,21 +846,31 @@ int dci_format1As_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32 if (*y == 0) { int nof_bits = riv_nbits(nof_prb); int i=0; - while(inof_bits-1 && y[i] == 0) { i++; } if (i == msg->nof_bits-1) { - //printf("Received a Format1A RA PDCCH order. Not implemented!\n"); - return SRSLTE_ERROR; + // This is a Random access order + y+=1+nof_bits; + + data->is_ra_order = true; + data->ra_preamble = srslte_bit_pack(&y, 6); + data->ra_mask_idx = srslte_bit_pack(&y, 4); + + return SRSLTE_SUCCESS; } } } + data->is_ra_order = false; + data->alloc_type = SRSLTE_RA_ALLOC_TYPE2; data->type2_alloc.mode = *y++;