Fix Resource Allocation Type 1 Defect

master
Xavier Arteaga 7 years ago
parent 9f7d4718ba
commit 1ba18f1ddc

@ -314,9 +314,10 @@ int srslte_ra_dl_dci_to_grant_prb_allocation(srslte_ra_dl_dci_t *dci, srslte_ra_
break;
case SRSLTE_RA_ALLOC_TYPE1:
n_rb_type1 = srslte_ra_type1_N_rb(nof_prb);
if (dci->type1_alloc.rbg_subset < (nof_prb / P) % P) {
uint32_t temp = ((nof_prb - 1) / P) % P;
if (dci->type1_alloc.rbg_subset < temp) {
n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P + P;
} else if (dci->type1_alloc.rbg_subset == ((nof_prb / P) % P)) {
} else if (dci->type1_alloc.rbg_subset == temp) {
n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P + ((nof_prb - 1) % P) + 1;
} else {
n_rb_rbg_subset = ((nof_prb - 1) / (P * P)) * P;
@ -325,10 +326,9 @@ int srslte_ra_dl_dci_to_grant_prb_allocation(srslte_ra_dl_dci_t *dci, srslte_ra_
bitmask = dci->type1_alloc.vrb_bitmask;
for (i = 0; i < n_rb_type1; i++) {
if (bitmask & (1 << (n_rb_type1 - i - 1))) {
if ((((i + shift) / P)
* P * P + dci->type1_alloc.rbg_subset * P + (i + shift) % P) < nof_prb) {
grant->prb_idx[0][((i + shift) / P)
* P * P + dci->type1_alloc.rbg_subset * P + (i + shift) % P] = true;
uint32_t idx = (((i + shift) / P) * P * P + dci->type1_alloc.rbg_subset * P + (i + shift) % P);
if (idx < nof_prb) {
grant->prb_idx[0][idx] = true;
grant->nof_prb++;
} else {
return SRSLTE_ERROR;

Loading…
Cancel
Save