Commit 98550ce6 authored by Matthieu Kanj's avatar Matthieu Kanj

SIB1 scheduling + bug fix

parent 4ae67730
...@@ -1011,6 +1011,7 @@ set(PHY_SRC ...@@ -1011,6 +1011,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_Isc_NB_IoT.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_Isc_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/npbch_NB_IoT.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/npbch_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/SIB_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_NB_IoT.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c
......
/* 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 PHY/LTE_TRANSPORT/SIB_NB_IoT.c
* \Fucntions for the generation of SIB information for NB_IoT, TS 36-212, V13.4.0 2017-02
* \author M. KANJ
* \date 2018
* \version 0.0
* \company bcom
* \email: matthieu.kanj@b-com.com
* \note
* \warning
*/
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
//#include "PHY/CODING/defs_NB_IoT.h"
//#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
//#include "PHY/impl_defs_lte_NB_IoT.h"
//#include "PHY/impl_defs_top_NB_IoT.h"
#include "PHY/impl_defs_lte.h"
/////////////////////////////////////////////////////////////////////////////////////////
int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID)
{
int done=0;
uint8_t *sib1_pdu = sib1_struct->harq_process->pdu;
uint8_t tmp =0;
uint8_t rep_val = 0;
uint8_t start_frame = get_start_frame_SIB1_NB_IoT(frame_parms, get_rep_num_SIB1_NB_IoT(sib1_struct->repetition_number_SIB1));
switch( get_rep_num_SIB1_NB_IoT(sib1_struct->repetition_number_SIB1) )
{
case 4:
rep_val = 64;
break;
case 8:
rep_val = 32;
break;
case 16:
rep_val = 16;
break;
default:
printf("Error in SIB1");
}
uint8_t var = 0;
if(start_frame == 1)
{
var =1;
}
if(start_frame>=16)
{
tmp = 1;
}
uint8_t born_inf = 0 + start_frame*tmp;
uint8_t born_sup = 16 + start_frame*tmp;
if((subframe == 4) && (frame%2 == var) && (born_inf<= frame % rep_val) && (frame % rep_val < born_sup ))
{
if( frame % rep_val == var )
{
dlsch_encoding_NB_IoT(sib1_pdu,
sib1_struct,
8, ///// number_of_subframes_required
236); //// this vallue is fixed, should take into account in future the case of stand-alone & guard-band
dlsch_scrambling_Gen_NB_IoT(frame_parms,
sib1_struct,
1888,
frame,
subframe*2,
sib1_struct->rnti);
}
dlsch_modulation_NB_IoT(txdataF,
amp,
frame_parms,
3, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
sib1_struct,
236, // number of bits per subframe
((frame%16)/2),
4,
RB_IoT_ID);
done =1;
}
return(done);
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/*int generate_SIB23(NB_IoT_eNB_NPBCH_t *eNB_npbch,
int32_t **txdataF,
int amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t *npbch_pdu,
uint8_t frame_mod64,
unsigned short NB_IoT_RB_ID)
{
return(0);
}
*/
////////////////////////////////////////////////////////////////////////
...@@ -53,7 +53,7 @@ unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU) ...@@ -53,7 +53,7 @@ unsigned char get_Qm_ul_NB_IoT(unsigned char I_MCS, uint8_t N_sc_RU)
int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms) int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms)
{ {
uint16_t num_ctrl_symbols = frame_parms->control_region_size; uint16_t num_ctrl_symbols = frame_parms->control_region_size; // eutra_control_region_size values are 0,1,2
uint8_t nb_antennas_tx_LTE = frame_parms->nb_antennas_tx; uint8_t nb_antennas_tx_LTE = frame_parms->nb_antennas_tx;
uint8_t nb_antennas_tx_NB_IoT = frame_parms->nb_antennas_tx_NB_IoT; uint8_t nb_antennas_tx_NB_IoT = frame_parms->nb_antennas_tx_NB_IoT;
...@@ -62,28 +62,28 @@ int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms) ...@@ -62,28 +62,28 @@ int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms)
switch (nb_antennas_tx_NB_IoT + (2*nb_antennas_tx_LTE)) { switch (nb_antennas_tx_NB_IoT + (2*nb_antennas_tx_LTE)) {
case 10 : case 10:
G_value = G_tab[(1*3)-num_ctrl_symbols]; G_value = G_tab[(1*3)-num_ctrl_symbols-1];
break; break;
case 6: case 6:
G_value = G_tab[(2*3)-num_ctrl_symbols]; G_value = G_tab[(2*3)-num_ctrl_symbols-1];
break; break;
case 4 : case 4 :
G_value = G_tab[(3*3)-num_ctrl_symbols]; G_value = G_tab[(3*3)-num_ctrl_symbols-1];
break; break;
case 9 : case 9 :
G_value = G_tab[(4*3)-num_ctrl_symbols]; G_value = G_tab[(4*3)-num_ctrl_symbols-1];
break; break;
case 5: case 5:
G_value = G_tab[(5*3)-num_ctrl_symbols]; G_value = G_tab[(5*3)-num_ctrl_symbols-1];
break; break;
case 3 : case 3 :
G_value = G_tab[(6*3)-num_ctrl_symbols]; G_value = G_tab[(6*3)-num_ctrl_symbols-1];
break; break;
default: default:
...@@ -96,4 +96,147 @@ int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms) ...@@ -96,4 +96,147 @@ int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms)
} }
int get_G_SIB1_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms, uint8_t operation_mode_info)
{
uint16_t num_ctrl_symbols = 0; // eutra_control_region_size values are 0,1,2
if(operation_mode_info<2) /// operation_mode_info, in-band, stand-alone, guard band
{
num_ctrl_symbols = 2;
}
uint8_t nb_antennas_tx_LTE = frame_parms->nb_antennas_tx;
uint8_t nb_antennas_tx_NB_IoT = frame_parms->nb_antennas_tx_NB_IoT;
int G_value=0;
switch (nb_antennas_tx_NB_IoT + (2*nb_antennas_tx_LTE)) {
case 10:
G_value = G_tab[(1*3)-num_ctrl_symbols-1];
break;
case 6:
G_value = G_tab[(2*3)-num_ctrl_symbols-1];
break;
case 4 :
G_value = G_tab[(3*3)-num_ctrl_symbols-1];
break;
case 9 :
G_value = G_tab[(4*3)-num_ctrl_symbols-1];
break;
case 5:
G_value = G_tab[(5*3)-num_ctrl_symbols-1];
break;
case 3 :
G_value = G_tab[(6*3)-num_ctrl_symbols-1];
break;
default:
printf("Error getting G");
}
return(G_value);
}
int get_rep_num_SIB1_NB_IoT(uint8_t scheduling_info_sib1)
{
int value=0;
if(scheduling_info_sib1 >11)
{
printf("value not allowed for schedulinginfo for sib1");
} else {
switch(scheduling_info_sib1 % 3)
{
case 0:
value =4;
break;
case 1:
value =8;
break;
case 2:
value =16;
break;
}
}
return(value);
}
int get_start_frame_SIB1_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint8_t repetition)
{
int value=0;
uint16_t cell_id = frame_parms->Nid_cell ;
if(repetition == 4)
{
switch(cell_id %4)
{
case 0:
value =0;
break;
case 1:
value =16;
break;
case 2:
value =32;
break;
case 3:
value =48;
break;
}
} else if(repetition == 8) {
switch(cell_id %2)
{
case 0:
value =0;
break;
case 1:
value =16;
break;
}
} else if(repetition == 16) {
switch(cell_id %2)
{
case 0:
value =0;
break;
case 1:
value =1;
break;
}
} else {
printf("Error in getting the starting frame of SIB1 ");
}
return(value);
}
...@@ -106,6 +106,13 @@ int allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -106,6 +106,13 @@ int allocate_REs_in_RB_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t pilot_shift, uint8_t pilot_shift,
uint32_t *re_allocated); uint32_t *re_allocated);
int generate_SIB1(NB_IoT_eNB_NDLSCH_t *sib1_struct,
int32_t **txdataF,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,
uint32_t subframe,
int RB_IoT_ID);
int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch, int generate_npbch(NB_IoT_eNB_NPBCH_t *eNB_npbch,
int32_t **txdataF, int32_t **txdataF,
...@@ -544,6 +551,12 @@ void clean_eNb_ulsch_NB_IoT(NB_IoT_eNB_NULSCH_t *ulsch); ...@@ -544,6 +551,12 @@ void clean_eNb_ulsch_NB_IoT(NB_IoT_eNB_NULSCH_t *ulsch);
int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms); int get_G_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms);
int get_G_SIB1_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms, uint8_t operation_mode_info);
int get_rep_num_SIB1_NB_IoT(uint8_t scheduling_info_sib1);
int get_start_frame_SIB1_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint8_t repetition);
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB_IoT(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag); NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB_IoT(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
......
...@@ -228,10 +228,10 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) ...@@ -228,10 +228,10 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
NB_IoT_eNB_NDLSCH_t *sib23 = eNB->ndlsch_SIB23; NB_IoT_eNB_NDLSCH_t *sib23 = eNB->ndlsch_SIB23;
int **txdataF = eNB->common_vars.txdataF[0]; int **txdataF = eNB->common_vars.txdataF[0];
int subframe = proc->subframe_tx; uint32_t subframe = proc->subframe_tx;
uint32_t frame = proc->frame_tx; uint32_t frame = proc->frame_tx;
//uint16_t Ntti = 10; //ntti = 10 //uint16_t Ntti = 10; //ntti = 10
int RB_IoT_ID=22 ; // XXX should be initialized (RB reserved for NB-IoT, PRB index) int RB_IoT_ID=22; // XXX should be initialized (RB reserved for NB-IoT, PRB index)
int With_NSSS=0; // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal int With_NSSS=0; // With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
...@@ -257,16 +257,14 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) ...@@ -257,16 +257,14 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
//int G=0; //int G=0;
//NSSS only happened in the even frame //NSSS only happened in the even frame
if(frame%2==0) if(frame%2==0)
{ {
With_NSSS = 1; With_NSSS = 1;
} } else {
else
{
With_NSSS = 0; With_NSSS = 0;
} }
if(subframe == 5) if(subframe == 5)
{ {
...@@ -292,7 +290,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) ...@@ -292,7 +290,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
//uint8_t *npbch_pdu = get_NB_IoT_MIB(); //uint8_t *npbch_pdu = get_NB_IoT_MIB();
uint8_t *npbch_pdu = broadcast_str->pdu; uint8_t *npbch_pdu = broadcast_str->pdu;
//uint8_t *sib1_pdu = get_NB_IoT_SIB1(); //uint8_t *sib1_pdu = get_NB_IoT_SIB1();
uint8_t *sib1_pdu = sib1->harq_process->pdu;
//uint8_t *sib23_pdu = get_NB_IoT_SIB23(); //uint8_t *sib23_pdu = get_NB_IoT_SIB23();
uint8_t *sib23_pdu = sib23->harq_process->pdu; uint8_t *sib23_pdu = sib23->harq_process->pdu;
...@@ -313,7 +311,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) ...@@ -313,7 +311,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
RB_IoT_ID); RB_IoT_ID);
} }
///////////////////////////////////////////////////////// SIB1 //////////////////////////////////// //////////////////////////////////////////// SIB1 ////////////////////////////////////
// we need two parameter, NB-IoT cell_id and scheduling info for sib1 (can be found in the MIB) // we need two parameter, NB-IoT cell_id and scheduling info for sib1 (can be found in the MIB)
// using scheduling_info parameter we can get the TBS size. // using scheduling_info parameter we can get the TBS size.
// cell_id help to find the start subframe for sib1. // cell_id help to find the start subframe for sib1.
...@@ -323,39 +321,20 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) ...@@ -323,39 +321,20 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
// fp->Nid_cell // fp->Nid_cell
// TBStable_NB_IoT_SIB1[repetition_number_SIB1] /// TBS // TBStable_NB_IoT_SIB1[repetition_number_SIB1] /// TBS
// //
if((subframe == 4) && (frame%2==0) && (frame%32<16) ) ////if((subframe != 0) && (subframe != 4) && (subframe != 9) ) // rep_val = 4 , 8, 16
{ // if( (subframe ==4) && (frame%2 == var_0_1) && (born_inf<= frame % rep_val) (frame % rep_val <= 16 + start_frame ))
LOG_I(PHY,"SIB1 NB-IoT content:\n"); //
/*for(int i = 0; i<6;i++) // ndlsch->repetition_number_SIB1 -> 10 , should call get_rep_num_SIB1_NB_IoT(repetition_number_SIB1) -> value 4,8,16
printf("%02X",sib1->pdu[i]); //get_start_frame_SIB1_NB_IoT(lte_frame, get_rep_num_SIB1_NB_IoT(repetition_number_SIB1));
printf("\n"); */
//if((subframe == 4) && (frame%2==0) && (frame%32<16) ) ////if((subframe != 0) && (subframe != 4) && (subframe != 9) )
if( frame%32 == 0 ) generate_SIB1(sib1,
{ txdataF,
dlsch_encoding_NB_IoT(sib1_pdu, AMP,
sib1, fp,
8, ///// number_of_subframes_required frame,
get_G_NB_IoT(fp)); //////////// G*2 subframe,
RB_IoT_ID);
dlsch_scrambling_Gen_NB_IoT(fp,
sib1,
1888,
frame,
subframe*2,
eNB->ndlsch_SIB1->rnti);
}
dlsch_modulation_NB_IoT(txdataF,
AMP,
fp,
3, // control region size for LTE , values between 0..3, (0 for stand-alone / 1, 2 or 3 for in-band)
sib1,
236, // number of bits per subframe
((frame%32)/2),
4,
RB_IoT_ID);
}
///////////////////////////////////////////////////////// END //////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// END ////////////////////////////////////////////////////////
//////////////////////////////////////////////////// SIB23 //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////// SIB23 ////////////////////////////////////////////////////////////////////////
......
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