diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 64e8c8380f69c52e403a340ab9a0114fcde48d99..88ee3d14aec5536efae1fdc638a817f6ca068d60 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -209,7 +209,7 @@ void generate_Msg2(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t // get narrowband according to higher-layer config num_nb = p[RA_template->rach_resource_type-1]->mpdcch_NarrowbandsToMonitor_r13.list.count; RA_template->msg2_narrowband = *p[RA_template->rach_resource_type-1]->mpdcch_NarrowbandsToMonitor_r13.list.array[RA_template->preamble_index%num_nb]; - first_rb = RA_template->msg2_narrowband*6; + first_rb = narrowband_to_first_rb(&cc[CC_idP],RA_template->msg2_narrowband); if ((RA_template->msg2_mpdcch_repetition_cnt == 0) && (mpdcch_sf_condition(eNB,CC_idP,frameP,subframeP,rmax,TYPE2)>0)){ @@ -555,8 +555,8 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t // get actual repetition count from Table 9.1.5-3 reps = (rmax<=8)?(1<<rep):(rmax>>(3-rep)); // get first narrowband - first_rb = RA_template->msg34_narrowband*6; - + first_rb = narrowband_to_first_rb(&cc[CC_idP],RA_template->msg34_narrowband); + if ((RA_template->msg4_mpdcch_repetition_cnt == 0) && (mpdcch_sf_condition(eNB,CC_idP,frameP,subframeP,rmax,TYPE2)>0)){ // MPDCCH configuration for RAR diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index 426693dd9fcb8c61a2b97fe2937841fc8181fd72..a5056f165cefe762aad295d00cbfb5c6aed24035 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -199,7 +199,9 @@ schedule_SIB1_BR( LOG_D(MAC,"[eNB %d] Frame %d : BCCH_BR->DLSCH CC_id %d, Received %d bytes \n",module_idP,frameP,CC_id,bcch_sdu_length); // allocate all 6 PRBs in narrowband for SIB1_BR - first_rb = n_NB*6; + + first_rb = narrowband_to_first_rb(cc,n_NB); + vrb_map[first_rb] = 1; vrb_map[first_rb+1] = 1; vrb_map[first_rb+2] = 1; @@ -383,7 +385,7 @@ schedule_SI_BR( LOG_D(MAC,"[eNB %d] Frame %d : BCCH_BR %d->DLSCH CC_id %d, Received %d bytes \n",module_idP,frameP,i,CC_id,bcch_sdu_length); // allocate all 6 PRBs in narrowband for SIB1_BR - first_rb = si_Narrowband_r13*6; + first_rb = narrowband_to_first_rb(cc,si_Narrowband_r13); vrb_map[first_rb] = 1; vrb_map[first_rb+1] = 1; vrb_map[first_rb+2] = 1; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 09e5fe4d2cd3f26c54d453c88b5b465ea29a5e09..02e0db1c4e3d5e249aa8d930d2a72a45d9b28bb1 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -524,7 +524,35 @@ int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t } +int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index) { + switch (cc->mib->message.dl_Bandwidth) { + case 0: // 6 PRBs, N_NB=1, i_0=0 + return(0); + break; + case 3: // 50 PRBs, N_NB=8, i_0=1 + return((int)(1+(6*nb_index))); + break; + case 5: // 100 PRBs, N_NB=16, i_0=2 + return((int)(2+(6*nb_index))); + break; + case 1: // 15 PRBs N_NB=2, i_0=1 + if (nb_index>0) return(1); + else return(0); + break; + case 2: // 25 PRBs, N_NB=4, i_0=0 + if (nb_index>1) return(1+(6*nb_index)); + else return((6*nb_index)); + break; + case 4: // 75 PRBs, N_NB=12, i_0=1 + if (nb_index>5) return(2+(6*nb_index)); + else return(1+(6*nb_index)); + break; + default: + AssertFatal(1==0,"Impossible dl_Bandwidth %d\n",cc->mib->message.dl_Bandwidth); + break; + } +} #endif //------------------------------------------------------------------------------ diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 54bb2f8ad9507c8f195fed77c836f77279503972..8781a4112804554289385ea257890f77a12adb80 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -904,6 +904,9 @@ int get_numnarrowbandbits(long dl_Bandwidth); int mpdcch_sf_condition(eNB_MAC_INST *eNB,int CC_id, frame_t frameP,sub_frame_t subframeP,int rmax,MPDCCH_TYPES_t mpdcch_type); int get_numnarrowbands(long dl_Bandwidth); + +int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index); + #endif