Commit 7a1d8e30 authored by AlanLi's avatar AlanLi

Fixed bugs for SIB23

parent 0daeb68d
......@@ -223,8 +223,10 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
NB_IoT_eNB_NPBCH_t *broadcast_str = &eNB->npbch;
//NB_IoT_eNB_NDLSCH_t *sib1 = &eNB->ndlsch_SIB;
NB_IoT_DL_eNB_SIB_t *sib1 = &eNB->ndlsch_SIB.content_sib1;
NB_IoT_DL_eNB_SIB_t *sib23 = &eNB->ndlsch_SIB.content_sib23;
NB_IoT_eNB_NDLSCH_t *ndlsch = &eNB->ndlsch_SIB;
NB_IoT_DL_eNB_SIB_t *sib1 = &ndlsch->content_sib1;
NB_IoT_DL_eNB_SIB_t *sib23 = &ndlsch->content_sib23;
int **txdataF = eNB->common_vars.txdataF[0];
int subframe = proc->subframe_tx;
uint32_t frame = proc->frame_tx;
......@@ -299,6 +301,10 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
if(subframe == 0)
{
LOG_I(PHY,"MIB NB-IoT content:\n");
for(int i = 0; i<6;i++)
printf("%02X",broadcast_str->pdu[i]);
printf("\n");
generate_npbch(broadcast_str,
txdataF,
......@@ -313,6 +319,12 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
///////////////////////////////////////////////////////// SIB1 ////////////////////////////////////
if((subframe == 4) && (frame%2==0) && (frame%32<16) ) ////if((subframe != 0) && (subframe != 4) && (subframe != 9) )
{
LOG_I(PHY,"SIB1 NB-IoT content:\n");
for(int i = 0; i<6;i++)
printf("%02X",sib1->pdu[i]);
printf("\n");
if( frame%32 == 0 )
{
dlsch_encoding_NB_IoT(sib1_pdu,
......@@ -345,6 +357,11 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
//////////////////////////////////////////////////// SIB23 ////////////////////////////////////////////////////////////////////////
if( (subframe >0) && (subframe !=5) && (With_NSSS == 0) && (frame%2==1) && (frame%64<16) ) ////if((subframe != 0) && (subframe != 4) && (subframe != 9) )
{
LOG_I(PHY,"SIB2 NB-IoT content:\n");
for(int i = 0; i<6;i++)
printf("%02X",sib23->pdu[i]);
printf("\n");
if( subframe == 1 )
{
dlsch_encoding_NB_IoT(sib23_pdu,
......
......@@ -298,4 +298,4 @@ typedef struct rrc_config_NB_IoT_s{
}rrc_config_NB_IoT_t;
#endif
\ No newline at end of file
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file eNB_scheduler_NB_IoT.c
* \brief top level of the scheduler, it scheduled in pdcch period based.
* \author NTUST BMW Lab./Nick HO, Xavier LIU, Calvin HSU
* \date 2017 - 2018
* \email: nick133371@gmail.com, sephiroth7277@gmail.com , kai-hsiang.hsu@eurecom.fr
* \author NTUST BMW Lab./
* \date 2017
* \email:
* \version 1.0
*
*/
......@@ -37,17 +18,6 @@
#define flag_css_type2 0x2
#define flag_uss_v 0x4
#if 0 // disable now
#define flag_css_type1_ce0 0x1
#define flag_css_type1_ce1 0x2
#define flag_css_type1_ce2 0x4
#define flag_css_type2_ce0 0x8
#define flag_css_type2_ce1 0x10
#define flag_css_type2_ce2 0x20
#define flag_uss_v 0x40
#endif
// common
#define flag_mib 0x1
......@@ -56,10 +26,6 @@
#define flag_nsss 0x8
#define num_flags 2
// type2 css, type1 css
//extern BCCH_DL_SCH_Message_NB_IoT_t SIB;
void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe, uint32_t *scheduler_flags, uint32_t *common_flags, uint32_t *max_subframe){
......@@ -70,6 +36,7 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
//NPRACH_Parameters_NB_IoT_r13_t **type2_css_info = SIB.message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.choice.sib2_r13.radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list.array;
// fixed scheduling part (e.g. MIB, NPSS, NSSS, SIB1)
if(subframe == 0){
*common_flags |= flag_mib;
}else if(subframe == 5){
......@@ -81,7 +48,7 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
}
/* uint32_t type2_css_pp[3] = { type2_css_info[0]->npdcch_NumRepetitions_RA_r13*type2_css_info[0]->npdcch_StartSF_CSS_RA_r13, type2_css_info[1]->npdcch_NumRepetitions_RA_r13*type2_css_info[1]->npdcch_StartSF_CSS_RA_r13, type2_css_info[2]->npdcch_NumRepetitions_RA_r13*type2_css_info[2]->npdcch_StartSF_CSS_RA_r13 };*/
uint32_t type2_css_pp[3] = {256, 256, 256};
uint32_t type2_css_pp[3] = {256, 256, 256}; // TODO RRC config should get from structure
uint32_t start_subframe;
for(i=0; i<1; ++i){ // only CE0
start_subframe = 0;
......@@ -119,7 +86,7 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
}
}
*max_subframe = max;
*max_subframe = max; // the maximum subframe to be extend
}
/*function description:
......@@ -129,16 +96,13 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t abs_subframe){
int i;
uint8_t MIB_flag,SIB1_flag ;
uint8_t tx_mib=0, tx_sib1=0;
uint32_t scheduler_flags, max_subframe, common_flags;
/*Check this subframe should schedule something, set the flag*/
scheduler_flags = 0;
common_flags = 0;
MIB_flag = 0;
SIB1_flag = 0;
uint32_t h,f,sf;
int a;
eNB_scheduler_computing_flag_NB_IoT(mac_inst, abs_subframe, &scheduler_flags, &common_flags, &max_subframe);
if(scheduler_flags > 0){
......@@ -147,7 +111,7 @@ void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t ab
maintain_available_resource(mac_inst);
if((abs_subframe % rachperiod[4]) == rachstart[0]){
if((abs_subframe % rachperiod[4]) == rachstart[0]){ //TODO, configuration should be pass by configuration module
add_UL_Resource();
}
......@@ -159,6 +123,7 @@ void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t ab
//Check if type1 searching space scheduling
if((scheduler_flags&flag_css_type1)>0){
// paging, direct indication
scheduler_flags &= ~(flag_css_type1);
}
//The scheduling time is current subframe + 1
......@@ -175,22 +140,22 @@ void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t ab
}
}
if(common_flags == flag_mib)
MIB_flag = 1;
if(common_flags == flag_sib1)
SIB1_flag = 1;
convert_system_number(abs_subframe, &h, &f, &sf);
if(common_flags&flag_mib){
tx_mib = 1;
}
if(common_flags&flag_sib1){
tx_sib1 = 1;
}
a = output_handler(mac_inst, (module_id_t)0, 0, h, f, sf, MIB_flag, SIB1_flag, abs_subframe);
convert_system_number(abs_subframe, &h, &f, &sf);
if(a != 0){
if(0 != output_handler(mac_inst, (module_id_t)0, 0, h, f, sf, tx_mib, tx_sib1, abs_subframe)){
LOG_D(MAC,"output handler error\n");
}
}
void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, uint32_t subframe, uint32_t frame, uint32_t hypersfn, int index_ss)
{
// printf_FUNCTION_IN("[USS]");
//SCHEDULE_NB_IoT_t *scheduler = &eNB->scheduler;
mac_inst->scheduling_flag.flag_uss[0]=1;
......@@ -245,6 +210,5 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
UE_ID = UE_template_temp->next;
}
// printf_FUNCTION_OUT("[USS]");
}
......@@ -464,8 +464,8 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui
mac_xface->eNB_dlsch_ulsch_scheduler = eNB_dlsch_ulsch_scheduler;
mac_xface->get_dci_sdu = get_dci_sdu;
mac_xface->fill_rar = fill_rar;
//mac_xface->initiate_ra_proc = initiate_ra_proc;
mac_xface->initiate_ra_proc = initiate_ra_proc_NB_IoT;
mac_xface->initiate_ra_proc = initiate_ra_proc;
//mac_xface->initiate_ra_proc = initiate_ra_proc_NB_IoT;
mac_xface->cancel_ra_proc = cancel_ra_proc;
mac_xface->set_msg3_subframe = set_msg3_subframe;
mac_xface->SR_indication = SR_indication;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file main_NB_IoT.c
* \brief top init of Layer 2
* \author NTUST BMW Lab./Nick HO, Xavier LIU, Calvin HSU
* \date 2017 - 2018
* \email: nick133371@gmail.com, sephiroth7277@gmail.com , kai-hsiang.hsu@eurecom.fr
* \author NTUST BMW LAB./
* \date 2017
* \version 1.0
*
* \email:
*/
......@@ -71,6 +51,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
LOG_I(MAC,"[NB-IoT] MAC start initialization\n");
mac_inst->current_subframe = 0;
for(i=0;i<64;++i)
{
mac_inst->sib1_flag[i] = 0;
......@@ -119,6 +100,7 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
mac_inst->rrc_config.si_window_length = ms160;
mac_inst->rrc_config.sibs_NB_IoT_sched[0].si_periodicity = rf64;
mac_inst->rrc_config.si_radio_frame_offset = 1;
for(i=0;i<256;++i){
mac_inst->sibs_table[i] = -1;
......@@ -183,45 +165,14 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
LOG_I(MAC,"[NB-IoT] List_number %d R_max %d G %.1f a_offset %.1f T %d SS_start %d\n", i, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.ss_start_uss);
}
/*
//Initial one UE template
//UE_TEMPLATE_NB_IoT *UE_info=(UE_TEMPLATE_NB_IoT*)malloc(USER_NUM_USS*sizeof(UE_TEMPLATE_NB_IoT));
mac_inst->UE_list_spec->head=0;
mac_inst->UE_list_spec->tail=0;
for(i=0;i<USER_NUM_USS;++i)
{
UE_info_setting(mac_inst->UE_list_spec->UE_template_NB_IoT+i);
if(i==0)
{
(mac_inst->UE_list_spec->UE_template_NB_IoT+i)->prev=-1;
(mac_inst->UE_list_spec->UE_template_NB_IoT+i)->next=1;
//mac_inst->UE_list_spec->next[i]=-1;
}
else if(i>=USER_NUM_USS-1)
{
(mac_inst->UE_list_spec->UE_template_NB_IoT+i)->prev=i-1;
(mac_inst->UE_list_spec->UE_template_NB_IoT+i)->next=-1;
}
else
{
(mac_inst->UE_list_spec->UE_template_NB_IoT+i)->prev=i-1;
(mac_inst->UE_list_spec->UE_template_NB_IoT+i)->next=i+1;
}
//mac_inst->UE_list_spec->UE_template_NB_IoT[i]=UE_info[i];
mac_inst->UE_list_spec->tail=i;
}
*/
//UL initial
//Setting nprach configuration
setting_nprach();
//Initialize uplink resource from nprach configuration
Initialize_Resource();
//add_UL_Resource(mac_inst);
extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + 160);
extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + mac_inst->rrc_config.si_window_length);
}
......
This diff is collapsed.
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