mirror of https://github.com/PentHertz/srsLTE.git
added support for 2 tb in format2
This commit is contained in:
parent
16454f5eb1
commit
66ac734c51
|
@ -103,7 +103,9 @@ typedef struct SRSLTE_API {
|
|||
bool prb_idx[2][SRSLTE_MAX_PRB];
|
||||
uint32_t nof_prb;
|
||||
uint32_t Qm;
|
||||
uint32_t Qm2;
|
||||
srslte_ra_mcs_t mcs;
|
||||
srslte_ra_mcs_t mcs2;
|
||||
} srslte_ra_dl_grant_t;
|
||||
|
||||
/** Unpacked DCI message for DL grant */
|
||||
|
@ -130,6 +132,8 @@ typedef struct SRSLTE_API {
|
|||
bool pconf;
|
||||
bool power_offset;
|
||||
|
||||
uint32_t nof_tb;
|
||||
|
||||
bool dci_is_1a;
|
||||
bool dci_is_1c;
|
||||
} srslte_ra_dl_dci_t;
|
||||
|
|
|
@ -627,6 +627,7 @@ int dci_format1_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32_t
|
|||
|
||||
// TPC not implemented
|
||||
|
||||
data->nof_tb = 1;
|
||||
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
@ -813,6 +814,8 @@ int dci_format1As_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
|
|||
data->type2_alloc.n_prb1a = *y++; // LSB indicates N_prb_1a for TBS
|
||||
}
|
||||
|
||||
data->nof_tb = 1;
|
||||
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -857,6 +860,7 @@ int dci_format1B_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32_
|
|||
data->pinfo = srslte_bit_pack(&y, tpmi_bits(nof_ports));
|
||||
data->pconf = *y++ ? true : false;
|
||||
|
||||
data->nof_tb = 1;
|
||||
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
@ -949,6 +953,8 @@ int dci_format1Cs_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
|
|||
|
||||
msg->nof_bits = (y - msg->data);
|
||||
|
||||
data->nof_tb = 1;
|
||||
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -993,6 +999,7 @@ int dci_format1D_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32_
|
|||
data->pinfo = srslte_bit_pack(&y, tpmi_bits(nof_ports));
|
||||
data->power_offset = *y++ ? true : false;
|
||||
|
||||
data->nof_tb = 1;
|
||||
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
@ -1060,6 +1067,8 @@ int dci_format2AB_unpack(srslte_dci_msg_t *msg, srslte_ra_dl_dci_t *data, uint32
|
|||
data->pinfo = srslte_bit_pack(&y, precoding_bits_f2a(nof_ports));
|
||||
}
|
||||
|
||||
data->nof_tb = 2;
|
||||
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -380,6 +380,40 @@ static int dl_dci_to_grant_prb_allocation(srslte_ra_dl_dci_t *dci, srslte_ra_dl_
|
|||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
||||
static int dl_fill_ra_mcs(srslte_ra_mcs_t *mcs, uint32_t nprb) {
|
||||
uint32_t i_tbs = 0;
|
||||
int tbs = -1;
|
||||
if (mcs->idx < 10) {
|
||||
mcs->mod = SRSLTE_MOD_QPSK;
|
||||
i_tbs = mcs->idx;
|
||||
} else if (mcs->idx < 17) {
|
||||
mcs->mod = SRSLTE_MOD_16QAM;
|
||||
i_tbs = mcs->idx-1;
|
||||
} else if (mcs->idx < 29) {
|
||||
mcs->mod = SRSLTE_MOD_64QAM;
|
||||
i_tbs = mcs->idx-2;
|
||||
} else if (mcs->idx == 29) {
|
||||
mcs->mod = SRSLTE_MOD_QPSK;
|
||||
tbs = 0;
|
||||
i_tbs = 0;
|
||||
} else if (mcs->idx == 30) {
|
||||
mcs->mod = SRSLTE_MOD_16QAM;
|
||||
tbs = 0;
|
||||
i_tbs = 0;
|
||||
} else if (mcs->idx == 31) {
|
||||
mcs->mod = SRSLTE_MOD_64QAM;
|
||||
tbs = 0;
|
||||
i_tbs = 0;
|
||||
}
|
||||
if (tbs == -1) {
|
||||
tbs = srslte_ra_tbs_from_idx(i_tbs, nprb);
|
||||
if (tbs >= 0) {
|
||||
mcs->tbs = tbs;
|
||||
}
|
||||
}
|
||||
return tbs;
|
||||
}
|
||||
|
||||
/* Modulation order and transport block size determination 7.1.7 in 36.213 */
|
||||
static int dl_dci_to_grant_mcs(srslte_ra_dl_dci_t *dci, srslte_ra_dl_grant_t *grant, bool crc_is_crnti) {
|
||||
uint32_t n_prb=0;
|
||||
|
@ -397,40 +431,23 @@ static int dl_dci_to_grant_mcs(srslte_ra_dl_dci_t *dci, srslte_ra_dl_grant_t *gr
|
|||
}
|
||||
}
|
||||
grant->mcs.mod = SRSLTE_MOD_QPSK;
|
||||
grant->mcs.tbs = (uint32_t) tbs;
|
||||
} else {
|
||||
tbs = -1;
|
||||
n_prb = grant->nof_prb;
|
||||
if (dci->mcs_idx < 10) {
|
||||
grant->mcs.mod = SRSLTE_MOD_QPSK;
|
||||
i_tbs = dci->mcs_idx;
|
||||
} else if (dci->mcs_idx < 17) {
|
||||
grant->mcs.mod = SRSLTE_MOD_16QAM;
|
||||
i_tbs = dci->mcs_idx-1;
|
||||
} else if (dci->mcs_idx < 29) {
|
||||
grant->mcs.mod = SRSLTE_MOD_64QAM;
|
||||
i_tbs = dci->mcs_idx-2;
|
||||
} else if (dci->mcs_idx == 29) {
|
||||
grant->mcs.mod = SRSLTE_MOD_QPSK;
|
||||
tbs = 0;
|
||||
i_tbs = 0;
|
||||
} else if (dci->mcs_idx == 30) {
|
||||
grant->mcs.mod = SRSLTE_MOD_16QAM;
|
||||
tbs = 0;
|
||||
i_tbs = 0;
|
||||
} else if (dci->mcs_idx == 31) {
|
||||
grant->mcs.mod = SRSLTE_MOD_64QAM;
|
||||
tbs = 0;
|
||||
i_tbs = 0;
|
||||
}
|
||||
if (tbs == -1) {
|
||||
tbs = srslte_ra_tbs_from_idx(i_tbs, n_prb);
|
||||
grant->mcs.idx = dci->mcs_idx;
|
||||
tbs = dl_fill_ra_mcs(&grant->mcs, n_prb);
|
||||
if (dci->nof_tb == 2) {
|
||||
grant->mcs2.idx = dci->mcs_idx_1;
|
||||
tbs = dl_fill_ra_mcs(&grant->mcs2, n_prb);
|
||||
}
|
||||
}
|
||||
|
||||
grant->Qm = srslte_mod_bits_x_symbol(grant->mcs.mod);
|
||||
if (dci->nof_tb == 2) {
|
||||
grant->Qm2 = srslte_mod_bits_x_symbol(grant->mcs2.mod);
|
||||
}
|
||||
if (tbs < 0) {
|
||||
return SRSLTE_ERROR;
|
||||
} else {
|
||||
grant->mcs.tbs = (uint32_t) tbs;
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -456,10 +473,6 @@ int srslte_ra_dl_dci_to_grant(srslte_ra_dl_dci_t *dci,
|
|||
if (!dl_dci_to_grant_prb_allocation(dci, grant, nof_prb)) {
|
||||
// Compute MCS
|
||||
if (!dl_dci_to_grant_mcs(dci, grant, crc_is_crnti)) {
|
||||
// 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_is_1c)
|
||||
|
|
Loading…
Reference in New Issue