Commit 9b174dd8 authored by islam.galal's avatar islam.galal

integration step 1, breaks in SIB2 generation in L1 (lte-segmentation.c)

parent db808ddd
......@@ -514,7 +514,8 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
if (Ncb>(3*(RTC<<5)))
AssertFatal(1==0,"Exiting, RM condition (Ncb %d, RTC %d, Nir/C %d, Nsoft %d, Kw %d)\n",Ncb,RTC,Nir/C,Nsoft,3*(RTC<<5));
AssertFatal(Nl>0,"Nl is 0\n");
AssertFatal(Qm>0,"Qm is 0\n");
Gp = G/Nl/Qm;
GpmodC = Gp%C;
......@@ -720,6 +721,8 @@ int lte_rate_matching_turbo_rx(uint32_t RTC,
Ncb = 3*(RTC<<5);
}
AssertFatal(Nl>0,"Nl is 0\n");
AssertFatal(Qm>0,"Qm is 0\n");
Gp = G/Nl/Qm;
GpmodC = Gp%C;
......
......@@ -123,6 +123,9 @@ int lte_segmentation(unsigned char *input_buffer,
}
AssertFatal(Bprime <= (*Cplus)*(*Kplus) + (*Cminus)*(*Kminus),
"Bprime %d < (*Cplus %d)*(*Kplus %d) + (*Cminus %d)*(*Kminus %d)\n",
Bprime,*Cplus,*Kplus,*Cminus,*Kminus);
*F = ((*Cplus)*(*Kplus) + (*Cminus)*(*Kminus) - (Bprime));
#ifdef DEBUG_SEGMENTATION
......
......@@ -1018,7 +1018,7 @@ handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
else dlsch1_harq->pdu = sdu;
#ifdef Rel14
if ((rel13->pdsch_payload_type == 0) && (rel13->ue_type>0)) { // this is a BR/CE UE and SIB1-BR
if ((rel13->pdsch_payload_type <2) && (rel13->ue_type>0)) { // this is a BR/CE UE and SIB1-BR
// configure PDSCH
switch (eNB->frame_parms.N_RB_DL) {
case 6:
......@@ -1048,8 +1048,8 @@ handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
dlsch0_harq->nb_rb = 6;
dlsch0_harq->vrb_type = LOCALIZED;
dlsch0_harq->rvidx = 0;
dlsch0_harq->Nl = 0;
dlsch0_harq->rvidx = rel8->redundancy_version;
dlsch0_harq->Nl = 1;
dlsch0_harq->mimo_mode = (eNB->frame_parms.nb_antenna_ports_eNB == 1) ? SISO : ALAMOUTI;
dlsch0_harq->dl_power_off = 1;
dlsch0_harq->round = 0;
......
......@@ -566,7 +566,8 @@ void RCconfig_RU() {
if ( !(
config_setting_lookup_int(setting_ru, CONFIG_STRING_RU_MAX_RS_EPRE, &max_pdschReferenceSignalPower)
config_setting_lookup_int(setting_ru, CONFIG_STRING_RU_MAX_RS_EPRE, &max_pdschReferenceSignalPower) &&
config_setting_lookup_int(setting_ru, CONFIG_STRING_RU_MAX_RXGAIN, &max_rxgain)
)
) {
AssertFatal (0,
......@@ -575,8 +576,6 @@ void RCconfig_RU() {
continue;
}
>>>>>>> faa111ecc0815354979e075d5b83c5af107d404e
AssertFatal((setting_band = config_setting_get_member(setting_ru, CONFIG_STRING_RU_BAND_LIST))!=NULL,"No allowable LTE bands\n");
if (setting_band != NULL) num_bands = config_setting_length(setting_band);
......@@ -2568,10 +2567,11 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
for (sched_info_idx = 0; sched_info_idx < num_scheduling_info; ++sched_info_idx)
{
scheduling_info_br = config_setting_get_elem(scheduling_info_br_list, sched_info_idx);
if (! config_setting_lookup_int(scheduling_info_br, ENB_CONFIG_STRING_SI_NARROWBAND_R13, &si_Narrowband_r13)
&& config_setting_lookup_int(setting_br13, ENB_CONFIG_STRING_SI_TBS_R13, &si_TBS_r13)
if (!(
config_setting_lookup_int(scheduling_info_br, ENB_CONFIG_STRING_SI_NARROWBAND_R13, &si_Narrowband_r13)
&& config_setting_lookup_int(scheduling_info_br, ENB_CONFIG_STRING_SI_TBS_R13, &si_TBS_r13)
)
{
){
AssertFatal (0, "Failed to parse eNB configuration file %s, scheduking info br %d!\n", RC.config_file_name, nb_cc++);
}
RRC_CONFIGURATION_REQ (msg_p).si_Narrowband_r13[j][sched_info_idx] = si_Narrowband_r13;
......@@ -3767,6 +3767,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
if (config_setting_lookup_string(setting_br13, ENB_CONFIG_STRING_BRAccessRelatedInfo, &bandwidthReducedAccessRelatedInfo_r13) && !strcmp(bandwidthReducedAccessRelatedInfo_r13, "ENABLE"))
{
printf("Enabling BR access SI scheduling parameters\n");
RRC_CONFIGURATION_REQ(msg_p).bandwidthReducedAccessRelatedInfo_r13[j] = TRUE;
if (!config_setting_lookup_int(setting_br13, ENB_CONFIG_STRING_SI_WINDOWLENGTH_BR, &si_WindowLength_BR_r13) ||
!config_setting_lookup_int(setting_br13, ENB_CONFIG_STRING_SI_REPETITIONPATTERN, &si_RepetitionPattern_r13) ||
......
......@@ -527,6 +527,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
}
#ifdef Rel14
if (sib1_v13ext != NULL) {
LOG_I(MAC,"[CONFIG] Retrieved sib1_v13ext\n");
RC.mac[Mod_idP]->common_channels[CC_idP].sib1_v13ext = sib1_v13ext;
}
#endif
......
......@@ -176,6 +176,7 @@ schedule_SIB1_BR(
n_NB = Sj[((cc->physCellId % N_S_NB) + (i*N_S_NB/m))%N_S_NB];
if ((frameP%1000) < 40) LOG_D(MAC,"[eNB %d] Frame %d, subframe %d : BCCH_BR->DLSCH (SIB1) CC_id %d\n",module_idP,frameP,subframeP,CC_id);
bcch_sdu_length = mac_rrc_data_req(module_idP,
CC_id,
......@@ -189,12 +190,14 @@ schedule_SIB1_BR(
AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13<19,"schedulingInfoSIB1_BR_r13 %d > 18\n",
(int)cc->mib->message.schedulingInfoSIB1_BR_r13);
AssertFatal(bcch_sdu_length>0,"RRC returned 0 bytes for SIB1-BR\n");
TBS = SIB1_BR_TBS_table[(cc->mib->message.schedulingInfoSIB1_BR_r13-1)/3]>>3;
AssertFatal(bcch_sdu_length <= TBS, "length returned by RRC is not compatible with the TBS %d from MIB\n",TBS);
AssertFatal(bcch_sdu_length <= TBS, "length returned by RRC %d is not compatible with the TBS %d from MIB\n",bcch_sdu_length,TBS);
if (bcch_sdu_length > 0) {
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);
if ((frameP%1000) < 40) LOG_D(MAC,"[eNB %d] Frame %d : BCCH_BR->DLSCH (SIB1) CC_id %d, Received %d bytes for NB %d\n",module_idP,frameP,CC_id,bcch_sdu_length,n_NB);
// allocate all 6 PRBs in narrowband for SIB1_BR
first_rb = n_NB*6;
......@@ -275,12 +278,10 @@ schedule_SIB1_BR(
CC_id,
bcch_sdu_length);
}
} else {
//LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame);
}
}
return;
}
......@@ -360,8 +361,13 @@ schedule_SI_BR(
int period_in_sf = 80<<si_Periodicity; // 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms
int sf_mod_period = ((frameP*10)+subframeP)%period_in_sf;
rvidx = (((3*sf_mod_period)>>1) + (sf_mod_period&1))&3;
if ((frameP%1000) < 200) LOG_I(MAC,"[eNB %d] Frame %d : BCCH_BR->DLSCH (SI) CC_id %d, rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d\n",
module_idP,frameP,CC_id,si_Narrowband_r13,rvidx,
sf_mod_period,si_WindowLength_BR_r13,si_RepetitionPattern_r13);
if ((sf_mod_period < si_WindowLength_BR_r13) &&
((frameP&(((1<<si_RepetitionPattern_r13)-1)))==0)) { // this SIB is to be scheduled
......@@ -374,13 +380,16 @@ schedule_SI_BR(
module_idP,
0); // not used in this case
AssertFatal(bcch_sdu_length>0,"RRC returned 0 bytes for SI-BR %d\n",i);
if (bcch_sdu_length > 0) {
AssertFatal(bcch_sdu_length <= (si_TBS_r13>>3),
"RRC provided bcch with length %d > %d\n",
bcch_sdu_length,(int)(si_TBS_r13>>3));
"RRC provided bcch with length %d > %d (si_TBS_r13 %d)n",
bcch_sdu_length,(int)(si_TBS_r13>>3),schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13);
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);
if ((frameP%1000) < 200) LOG_I(MAC,"[eNB %d] Frame %d : BCCH_BR->DLSCH (SI) CC_id %d, Received %d bytes for NB %d/rvidx %d\n",module_idP,frameP,CC_id,bcch_sdu_length,si_Narrowband_r13,rvidx);
// allocate all 6 PRBs in narrowband for SIB1_BR
first_rb = si_Narrowband_r13*6;
vrb_map[first_rb] = 1;
......@@ -504,6 +513,8 @@ void schedule_mib(module_id_t module_idP,
LOG_D(MAC,"Frame %d, subframe %d: Adding BCH PDU in position %d (length %d)\n",
frameP,subframeP,dl_req->number_pdu,mib_sdu_length);
if ((frameP&1023) < 40) LOG_I(MAC,"[eNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes (cc->mib->message.schedulingInfoSIB1_BR_r13 %d)\n",module_idP,frameP,CC_id,mib_sdu_length,cc->mib->message.schedulingInfoSIB1_BR_r13);
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_BCH_PDU_TYPE,
......@@ -553,8 +564,8 @@ schedule_SI(
start_meas(&eNB->schedule_si);
// Only schedule System Information in subframe 5
if (subframeP != 5) return;
// Only schedule LTE System Information in subframe 5
if (subframeP == 5) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
......@@ -735,6 +746,12 @@ schedule_SI(
//LOG_D(MAC,"[eNB %d] Frame %d : BCCH not active \n",Mod_id,frame);
}
}
}
#ifdef Rel14
schedule_SIB1_BR(module_idP,frameP,subframeP);
schedule_SI_BR(module_idP,frameP,subframeP);
#endif
// this might be misleading when bcch is inactive
stop_meas(&eNB->schedule_si);
......
......@@ -302,8 +302,24 @@ mac_rrc_data_req(
//else
//return(0);
}
#endif
#ifdef Rel14
if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
}
#endif //Rel10 || Rel14
if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
}
#endif
} else { //This is an UE
......
......@@ -192,7 +192,11 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId)
return 0xFF; //error!
}
uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame, uint32_t schedulingInfoSIB1)
uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame
#ifdef Rel14
, uint32_t schedulingInfoSIB1
#endif
)
{
asn_enc_rval_t enc_rval;
......@@ -246,11 +250,13 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
#ifndef Rel14
mib->message.spare.size = 2;
mib->message.spare.bits_unused = 6; // This makes a spare of 10 bits
mib->message.schedulingInfoSIB1_BR_r13 = schedulingInfoSIB1; // turn on eMTC
#else
mib->message.spare.size = 1;
mib->message.spare.bits_unused = 3; // This makes a spare of 5 bits
mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC
mib->message.schedulingInfoSIB1_BR_r13 = schedulingInfoSIB1; // turn on/off eMTC
LOG_I(RRC,"[MIB] schedulingInfoSIB1 %d\n",
(uint32_t)mib->message.schedulingInfoSIB1_BR_r13);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
......@@ -550,9 +556,13 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
if (configuration->bandwidthReducedAccessRelatedInfo_r13[CC_id])
{
sib1_1310->bandwidthReducedAccessRelatedInfo_r13
= calloc(1, sizeof(struct SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13));
LOG_I(RRC,"Allocating memory for BR access of SI (%p)\n",
sib1_1310->bandwidthReducedAccessRelatedInfo_r13);
sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13
= configuration->si_WindowLength_BR_r13[CC_id]; // 0
......@@ -570,17 +580,9 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
for (index = 0; index < num_sched_info_br; ++index)
{
if (configuration->si_Narrowband_r13[CC_id][index] && configuration->si_TBS_r13[CC_id][index])
{
schedulinginfo_br_13->si_Narrowband_r13 = configuration->si_Narrowband_r13[CC_id][index];
schedulinginfo_br_13->si_TBS_r13 = configuration->si_TBS_r13[CC_id][index];
}
else
{
schedulinginfo_br_13->si_Narrowband_r13 = 1;
schedulinginfo_br_13->si_TBS_r13 = SchedulingInfo_BR_r13__si_TBS_r13_b152;
}
LOG_I(RRC,"Adding (%d,%d) to scheduling_info_br_13\n",schedulinginfo_br_13->si_Narrowband_r13,schedulinginfo_br_13->si_TBS_r13);
ASN_SEQUENCE_ADD(&sib1_1310->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13->list, schedulinginfo_br_13);
}
......
......@@ -67,7 +67,11 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId);
@param phich_duration PHICH duration parameter
@param frame radio frame number
@return size of encoded bit stream in bytes*/
uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame, uint32_t schedulingInfoSIB1);
uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame
#ifdef Rel14
, uint32_t schedulingInfoSIB1
#endif
);
/**
\brief Generate configuration for SIB1 (eNB).
......
......@@ -150,16 +150,26 @@ init_SI(
configuration->N_RB_DL[CC_id],
(int)configuration->radioresourceconfig[CC_id].phich_resource,
(int)configuration->radioresourceconfig[CC_id].phich_duration);
#ifdef Rel14
LOG_I(RRC, "configuration->schedulingInfoSIB1_BR_r13[CC_id] %d\n",(int)configuration->schedulingInfoSIB1_BR_r13[CC_id]);
#endif
do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
#ifdef ENABLE_ITTI
configuration->N_RB_DL[CC_id],
(int)configuration->radioresourceconfig[CC_id].phich_resource,
(int)configuration->radioresourceconfig[CC_id].phich_duration,
configuration->schedulingInfoSIB1_BR_r13[CC_id]
0
#else
50, 0, 0, 0
#endif
#ifdef Rel14
#ifdef ENABLE_ITTI
,configuration->schedulingInfoSIB1_BR_r13[CC_id]
#else
50, 0, 0, 1
,0
#endif
,0);
#endif
);
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0;
......@@ -311,14 +321,18 @@ init_SI(
if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) &&
(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) {
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL,
"sib2_br->nonCriticalExtension is null (v9.2)\n");
"sib2_br->nonCriticalExtension is null (v8.9)\n");
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL,
"sib2_br->nonCriticalExtension is null (v11.3)\n");
"sib2_br->nonCriticalExtension is null (v9.2)\n");
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
"sib2_br->nonCriticalExtension is null (v11.3)\n");
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
"sib2_br->nonCriticalExtension is null (v12.5)\n");
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
"sib2_br->nonCriticalExtension is null (v13.10)\n");
sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension;
sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension;
}
#endif
......
......@@ -342,10 +342,10 @@ int trx_usrp_set_gains(openair0_device* device,
usrp_state_t *s = (usrp_state_t*)device->priv;
s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[0]);
s->usrp->set_tx_gain(89.0-openair0_cfg[0].tx_gain[0]);
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(0);
// limit to maximum gain
if (openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0] > gain_range.stop()) {
if (125.0-openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0] > gain_range.stop()) {
LOG_E(PHY,"RX Gain 0 too high, reduce by %f dB\n",
openair0_cfg[0].rx_gain[0]-openair0_cfg[0].rx_gain_offset[0] - gain_range.stop());
exit(-1);
......@@ -632,10 +632,10 @@ extern "C" {
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
// limit to maximum gain
AssertFatal( openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] <= gain_range.stop(),
AssertFatal( 125.0-openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] <= gain_range.stop(),
"RX Gain too high, lower by %f dB\n",
openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] - gain_range.stop());
s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],i);
125.0-openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] - gain_range.stop());
s->usrp->set_rx_gain(125.0-openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],i);
LOG_I(PHY,"RX Gain %d %f (%f) => %f (max %f)\n",i,
openair0_cfg[0].rx_gain[i],openair0_cfg[0].rx_gain_offset[i],
openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],gain_range.stop());
......@@ -645,7 +645,7 @@ extern "C" {
if (i<openair0_cfg[0].tx_num_channels) {
s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i);
s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[i],i);
s->usrp->set_tx_gain(89.0-openair0_cfg[0].tx_gain[i],i);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment