Commit 82fbfae5 authored by Nick Ho's avatar Nick Ho

Fix NB-IoT Asn.1 configuration and initialization

parent 03c6604f
......@@ -136,6 +136,8 @@ static inline void* malloc16_clear( size_t size )
//#include "PHY/LTE_TRANSPORT/defs.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include <pthread.h>
#include "targets/ARCH/COMMON/common_lib.h"
......@@ -758,7 +760,7 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
// DCI for at most 2 DCI pdus
DCI_PDU_NB_IoT *DCI_pdu;
UL_IND_NB_IoT_t UL_INFO;
} PHY_VARS_eNB_NB_IoT;
......@@ -1107,7 +1109,6 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *
//#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
//#include "PHY/LTE_ESTIMATION/defs.h"
//#include "SIMULATION/ETH_TRANSPORT/defs.h"
//#endif
#endif // __PHY_DEFS__H__
......@@ -57,8 +57,6 @@ extern PHY_VARS_eNB_NB_IoT *PHY_vars_eNB_NB_IoT_g[MAX_eNB_NB_IoT][MAX_NUM_CCs];
//extern MAC_xface_NB_IoT *mac_xface_NB_IoT;
extern IF_Module_t *if_inst;
extern short primary_synch_NB_IoT[264];
/*
......
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "../SCHED/IF_Module_L1_primitives_NB_IoT.h"
//#include "../SCHED/defs.h"
#include "../SCHED/defs_NB_IoT.h"
......@@ -169,7 +169,7 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
// do the schedule response and trigger the TX
void schedule_response(Sched_Rsp_t *Sched_INFO)
void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
{
//XXX check if correct to take eNB like this
......@@ -316,7 +316,8 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
}
void PHY_config_req(PHY_Config_t* config_INFO){
void PHY_config_req_NB_IoT(PHY_Config_NB_IoT_t* config_INFO){
LOG_I(PHY,"[NB-IoT] PHY CONFIG REQ NB-IoT In\n");
if(config_INFO->get_MIB != 0){
......@@ -330,10 +331,10 @@ void PHY_config_req(PHY_Config_t* config_INFO){
config_INFO->cfg->subframe_config.ul_cyclic_prefix_type.value,
config_INFO->cfg->rf_config.tx_antenna_ports.value,
config_INFO->cfg->nfapi_config.earfcn.value,
config_INFO->cfg->config_NB_IoT.prb_index.value,
config_INFO->cfg->config_NB_IoT.operating_mode.value,
config_INFO->cfg->config_NB_IoT.control_region_size.value,
config_INFO->cfg->config_NB_IoT.assumed_crs_aps.value); //defined only in in-band different PCI
config_INFO->cfg->nb_iot_config.prb_index.value,
config_INFO->cfg->nb_iot_config.operating_mode.value,
config_INFO->cfg->nb_iot_config.control_region_size.value,
config_INFO->cfg->nb_iot_config.assumed_crs_aps.value); //defined only in in-band different PCI
}
......@@ -342,7 +343,7 @@ void PHY_config_req(PHY_Config_t* config_INFO){
//Common Configuration included in SIB2-NB
phy_config_sib2_eNB_NB_IoT(config_INFO->mod_id,
config_INFO->CC_id,
&config_INFO->cfg->config_NB_IoT, // FIXME to be evaluated is should be passed a pointer
&config_INFO->cfg->nb_iot_config, // FIXME to be evaluated is should be passed a pointer
&config_INFO->cfg->rf_config,
&config_INFO->cfg->uplink_reference_signal_config,
&config_INFO->extra_phy_parms);
......@@ -359,5 +360,7 @@ void PHY_config_req(PHY_Config_t* config_INFO){
&config_INFO->extra_phy_parms);
}
LOG_I(PHY,"IF Module for PHY Configuration has been done\n");
}
......@@ -7,21 +7,13 @@
#ifndef __IF_MODULE_L1_PRIMITIVES_NB_IOT_H__
#define __IF_MODULE_L1_PRIMITIVES_NB_IOT_H__
//#include "openair2/PHY_INTERFACE/IF_Module_nb_iot.h"
#include "openair1/PHY/defs_NB_IoT.h"
//#include "LAYER2/MAC/extern.h"
//#include "LAYER2/MAC/proto_NB_IoT.h"
//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void schedule_response(Sched_Rsp_t *Sched_INFO);
/*Interface for PHY Configuration
* Trigger the phy_config_xxx functions using parameters from the shared PHY_Config structure
* */
void PHY_config_req(PHY_Config_t* config_INFO);
void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
nfapi_dl_config_request_pdu_t *dl_config_pdu,
......
......@@ -17,12 +17,12 @@ enum openair_HARQ_TYPE_NB_IoT {
};
void process_schedule_rsp_NB_IoT(Sched_Rsp_t *sched_rsp,
void process_schedule_rsp_NB_IoT(Sched_Rsp_NB_IoT_t *sched_rsp,
PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_t *proc);
/*Processing the ue-specific resources for uplink in NB-IoT*/
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc, UL_IND_t *UL_INFO);
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc, UL_IND_NB_IoT_t *UL_INFO);
/* For NB-IoT, we put NPBCH in later part, since it would be scheduled by MAC scheduler,this generates NRS/NPSS/NSSS*/
void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
......
......@@ -63,13 +63,7 @@
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
extern uint16_t hundred_times_log10_NPRB_NB_IoT[100];
extern Sched_Rsp_t* Sched_Rsp;
#endif /*__SCHED_EXTERN_H__ */
......@@ -270,7 +270,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
}
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc,UL_IND_t *UL_INFO)
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc,UL_IND_NB_IoT_t *UL_INFO)
{
//RX processing for ue-specific resources (i
......
......@@ -97,10 +97,7 @@ uint32_t to_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_CarrierFreq, float m_dl) {
void config_mib_fapi_NB_IoT(
int rntiP,
int physCellId,
void config_mib_fapi_NB_IoT(int physCellId,
uint8_t eutra_band,
int Ncp,
int Ncp_UL,
......@@ -114,40 +111,29 @@ void config_mib_fapi_NB_IoT(
{
//XXX MP: one important problem to solve is how we decide when we deal with anchor or non anchor carrier?? configuration time?
//anchor carrier refers to the allowed PRBs index in the in-band operation mode at the beginning the UE is always camp on an anchor carrier from which
//receive NSSS, NPSSS ecc... but the RRCConnectionReconfiguration may could indicate non-anchor carrier to be used for data transmission
//ASSUMPTION: we always use an anchor carrier
float m_dl = 0; //this is the category offset for NB1/NB2 UE category used for EARFCN evaluation (TS 36.101 ch. 5.7.3F) (for the moment we keep this value fixed)
config_INFO->get_MIB = 1;
config_INFO->rnti = rntiP;
config_INFO->cfg->nfapi_config.rf_bands.rf_band[0] = (uint16_t)eutra_band;
config_INFO->cfg->sch_config.physical_cell_id.value = physCellId;
config_INFO->cfg->subframe_config.dl_cyclic_prefix_type.value = Ncp;
config_INFO->cfg->subframe_config.ul_cyclic_prefix_type.value = Ncp_UL;
config_INFO->cfg->rf_config.tx_antenna_ports.value = p_eNB;
config_INFO->cfg->rf_config.rx_antenna_ports.value = p_rx_eNB;
//PROBLEM: we need to know the LTE bandwidht for In-band and Guard band operating mode in order to choose the proper PRB idex or is given at configuration time??
//The prb index allowed are the one specified in R&shwarz pag 9 NB-IoT white papaer
nfapi_config_request_t *cfg = &mac_inst->config;
cfg->sch_config.physical_cell_id.value = physCellId;
cfg->nfapi_config.rf_bands.rf_band[0] = eutra_band;
cfg->subframe_config.dl_cyclic_prefix_type.value = Ncp;
cfg->subframe_config.ul_cyclic_prefix_type.value = Ncp_UL;
cfg->rf_config.tx_antenna_ports.value = p_eNB;
cfg->nfapi_config.earfcn.value = 9370; // value from taiwan commercial base station, just setting for now, will use formula to calculate it layer
//cfg->nb_iot_config.prb_index.value = // need to set in thread part
switch (mib_NB_IoT->message.operationModeInfo_r13.present)
{
//FAPI specs pag 135
case MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13:
config_INFO->cfg->config_NB_IoT.operating_mode.value = 0;
config_INFO->cfg->config_NB_IoT.prb_index.value = mib_NB_IoT->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13; //see TS 36.213 ch 16.0
config_INFO->cfg->config_NB_IoT.assumed_crs_aps.value = -1; //is not defined so we put a negative value
cfg->nb_iot_config.operating_mode.value = 0;
cfg->nb_iot_config.prb_index.value = mib_NB_IoT->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13; //see TS 36.213 ch 16.0
cfg->nb_iot_config.assumed_crs_aps.value = -1; //is not defined so we put a negative value
if(eutraControlRegionSize == NULL)
LOG_E(RRC, "rrc_mac_config_req_eNB_NB_IoT: operation mode is in-band but eutraControlRegionSize is not defined");
LOG_E(RRC, "rrc_mac_config_req_eNB_NB_IoT: operation mode is in-band but eutraControlRegionSize is not defined\n");
else
config_INFO->cfg->config_NB_IoT.control_region_size.value = *eutraControlRegionSize;
cfg->nb_iot_config.control_region_size.value = *eutraControlRegionSize;
//m_dl = NB_Category_Offset_anchor[rand()%4];
......@@ -157,35 +143,35 @@ void config_mib_fapi_NB_IoT(
case MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_DifferentPCI_r13:
config_INFO->cfg->config_NB_IoT.operating_mode.value = 1;
cfg->nb_iot_config.operating_mode.value = 1;
//XXX problem: fapi think to define also eutra_CRS_sequenceInfo also for in band with different PCI but the problem is that we don-t have i
//XXX should pass the prb_index may defined by configuration file depending on the LTE band we are considering (see Rhode&Shwartz whitepaper pag9)
//config_INFO->config_NB_IoT.prb_index.value =
config_INFO->cfg->config_NB_IoT.assumed_crs_aps.value = mib_NB_IoT->message.operationModeInfo_r13.choice.inband_DifferentPCI_r13.eutra_NumCRS_Ports_r13;
//nb_iot_config.prb_index.value =
cfg->nb_iot_config.assumed_crs_aps.value = mib_NB_IoT->message.operationModeInfo_r13.choice.inband_DifferentPCI_r13.eutra_NumCRS_Ports_r13;
if(eutraControlRegionSize == NULL)
LOG_E(RRC, "rrc_mac_config_req_eNB_NB_IoT: operation mode is in-band but eutraControlRegionSize is not defined");
LOG_E(RRC, "rrc_mac_config_req_eNB_NB_IoT: operation mode is in-band but eutraControlRegionSize is not defined\n");
else
config_INFO->cfg->config_NB_IoT.control_region_size.value = *eutraControlRegionSize;
cfg->nb_iot_config.control_region_size.value = *eutraControlRegionSize;
break;
case MasterInformationBlock_NB__operationModeInfo_r13_PR_guardband_r13:
config_INFO->cfg->config_NB_IoT.operating_mode.value = 2;
cfg->nb_iot_config.operating_mode.value = 2;
//XXX should pass the prb_index may defined by configuration file depending on the LTE band we are considering (see Rhode&Shwartz whitepaper pag9)
//config_INFO->config_NB_IoT.prb_index.value =
config_INFO->cfg->config_NB_IoT.control_region_size.value = -1; //should not being defined so we put a negative value
config_INFO->cfg->config_NB_IoT.assumed_crs_aps.value = -1; //is not defined so we put a negative value
//nb_iot_config.prb_index.value =
cfg->nb_iot_config.control_region_size.value = -1; //should not being defined so we put a negative value
cfg->nb_iot_config.assumed_crs_aps.value = -1; //is not defined so we put a negative value
break;
case MasterInformationBlock_NB__operationModeInfo_r13_PR_standalone_r13:
config_INFO->cfg->config_NB_IoT.operating_mode.value = 3;
config_INFO->cfg->config_NB_IoT.prb_index.value = -1; // is not defined for this case (put a negative random value--> will be not considered for encoding, scrambling procedures)
config_INFO->cfg->config_NB_IoT.control_region_size.value = -1; //is not defined so we put a negative value
config_INFO->cfg->config_NB_IoT.assumed_crs_aps.value = -1; //is not defined so we put a negative value
cfg->nb_iot_config.operating_mode.value = 3;
cfg->nb_iot_config.prb_index.value = -1; // is not defined for this case (put a negative random value--> will be not considered for encoding, scrambling procedures)
cfg->nb_iot_config.control_region_size.value = -1; //is not defined so we put a negative value
cfg->nb_iot_config.assumed_crs_aps.value = -1; //is not defined so we put a negative value
break;
default:
......@@ -193,13 +179,6 @@ void config_mib_fapi_NB_IoT(
break;
}
//we shoud use dl_CarrierConfig for generating the earfcn for LTE-CAT N2 based on TS 36.101 5.7.3F
/*
* 1) takes a random number from the offset of category NB1 and NB2 based on the operating mode (we assume always the usage of anchor carrier)
* 2)evaluate the EARFCN value based on the corresponding formula
*/
config_INFO->cfg->nfapi_config.earfcn.value = to_earfcn_NB_IoT(eutra_band,dl_CarrierFreq, m_dl);
}
void config_sib2_fapi_NB_IoT(
......@@ -208,6 +187,7 @@ void config_sib2_fapi_NB_IoT(
)
{
nfapi_config_request_t *cfg = &mac_inst->config;
/*
* Following the FAPI like approach:
* 1)fill the PHY_Config_t structure (PHY_INTERFACE/IF_Module_NB_IoT.h)
......@@ -220,174 +200,118 @@ void config_sib2_fapi_NB_IoT(
NPRACH_Parameters_NB_r13_t* nprach_parameter;
config_INFO->cfg->config_NB_IoT.nprach_config_0_enabled.value = 0;
config_INFO->cfg->config_NB_IoT.nprach_config_1_enabled.value = 0;
config_INFO->cfg->config_NB_IoT.nprach_config_2_enabled.value = 0;
cfg->nb_iot_config.nprach_config_0_enabled.value = 0;
cfg->nb_iot_config.nprach_config_1_enabled.value = 0;
cfg->nb_iot_config.nprach_config_2_enabled.value = 0;
switch(radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.size)
if(radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0]!=NULL&&radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1]!=NULL&&radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2]!=NULL)
{
case 0:
LOG_E(MAC, "nprach_ParametersLis is empty\n");
break;
case 1:
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0];
config_INFO->cfg->config_NB_IoT.nprach_config_0_enabled.value = 1;
config_INFO->cfg->config_NB_IoT.nprach_config_0_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_start_time.value = nprach_parameter->nprach_StartTime_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
config_INFO->extra_phy_parms.nprach_config_0_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
config_INFO->extra_phy_parms.nprach_config_0_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
config_INFO->extra_phy_parms.nprach_config_0_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13; //Rmax
config_INFO->extra_phy_parms.nprach_config_0_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
config_INFO->extra_phy_parms.nprach_config_0_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
//rsrp_ThresholdsPrachInfoList_r13 /*OPTIONAL*/
break;
case 2:
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0];
config_INFO->cfg->config_NB_IoT.nprach_config_0_enabled.value = 1;
config_INFO->cfg->config_NB_IoT.nprach_config_0_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_start_time.value = nprach_parameter->nprach_StartTime_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
config_INFO->extra_phy_parms.nprach_config_0_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
config_INFO->extra_phy_parms.nprach_config_0_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
config_INFO->extra_phy_parms.nprach_config_0_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13;
config_INFO->extra_phy_parms.nprach_config_0_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
config_INFO->extra_phy_parms.nprach_config_0_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
//rsrp_ThresholdsPrachInfoList_r13 /*OPTIONAL*/
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1];
config_INFO->cfg->config_NB_IoT.nprach_config_1_enabled.value = 1;
config_INFO->cfg->config_NB_IoT.nprach_config_1_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_start_time.value = nprach_parameter->nprach_StartTime_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
config_INFO->extra_phy_parms.nprach_config_1_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
config_INFO->extra_phy_parms.nprach_config_1_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
config_INFO->extra_phy_parms.nprach_config_1_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13;
config_INFO->extra_phy_parms.nprach_config_1_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
config_INFO->extra_phy_parms.nprach_config_1_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
//rsrp_ThresholdsPrachInfoList_r13 /*OPTIONAL*/
break;
case 3:
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0];
config_INFO->cfg->config_NB_IoT.nprach_config_0_enabled.value = 1;
config_INFO->cfg->config_NB_IoT.nprach_config_0_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_start_time.value = nprach_parameter->nprach_StartTime_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_0_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
cfg->nb_iot_config.nprach_config_0_enabled.value = 1;
cfg->nb_iot_config.nprach_config_0_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
cfg->nb_iot_config.nprach_config_0_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
cfg->nb_iot_config.nprach_config_0_start_time.value = nprach_parameter->nprach_StartTime_r13;
cfg->nb_iot_config.nprach_config_0_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
cfg->nb_iot_config.nprach_config_0_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
cfg->nb_iot_config.nprach_config_0_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
/*
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
config_INFO->extra_phy_parms.nprach_config_0_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
config_INFO->extra_phy_parms.nprach_config_0_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
config_INFO->extra_phy_parms.nprach_config_0_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13;
config_INFO->extra_phy_parms.nprach_config_0_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
config_INFO->extra_phy_parms.nprach_config_0_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
extra_phy_parms.nprach_config_0_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
extra_phy_parms.nprach_config_0_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
extra_phy_parms.nprach_config_0_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13;
extra_phy_parms.nprach_config_0_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
extra_phy_parms.nprach_config_0_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
*/
//rsrp_ThresholdsPrachInfoList_r13 /*OPTIONAL*/
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1];
config_INFO->cfg->config_NB_IoT.nprach_config_1_enabled.value = 1;
config_INFO->cfg->config_NB_IoT.nprach_config_1_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_start_time.value = nprach_parameter->nprach_StartTime_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_1_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
cfg->nb_iot_config.nprach_config_1_enabled.value = 1;
cfg->nb_iot_config.nprach_config_1_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
cfg->nb_iot_config.nprach_config_1_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
cfg->nb_iot_config.nprach_config_1_start_time.value = nprach_parameter->nprach_StartTime_r13;
cfg->nb_iot_config.nprach_config_1_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
cfg->nb_iot_config.nprach_config_1_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
cfg->nb_iot_config.nprach_config_1_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
/*
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
config_INFO->extra_phy_parms.nprach_config_1_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
config_INFO->extra_phy_parms.nprach_config_1_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
config_INFO->extra_phy_parms.nprach_config_1_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13;
config_INFO->extra_phy_parms.nprach_config_1_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
config_INFO->extra_phy_parms.nprach_config_1_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
extra_phy_parms.nprach_config_1_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
extra_phy_parms.nprach_config_1_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
extra_phy_parms.nprach_config_1_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13;
extra_phy_parms.nprach_config_1_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
extra_phy_parms.nprach_config_1_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
*/
//rsrp_ThresholdsPrachInfoList_r13 /*OPTIONAL*/
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2];
config_INFO->cfg->config_NB_IoT.nprach_config_2_enabled.value = 1;
config_INFO->cfg->config_NB_IoT.nprach_config_2_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_2_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_2_start_time.value = nprach_parameter->nprach_StartTime_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_2_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_2_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
config_INFO->cfg->config_NB_IoT.nprach_config_2_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
cfg->nb_iot_config.nprach_config_2_enabled.value = 1;
cfg->nb_iot_config.nprach_config_2_cp_length.value = radioResourceConfigCommon->nprach_Config_r13.nprach_CP_Length_r13;
cfg->nb_iot_config.nprach_config_2_sf_periodicity.value = nprach_parameter->nprach_Periodicity_r13;
cfg->nb_iot_config.nprach_config_2_start_time.value = nprach_parameter->nprach_StartTime_r13;
cfg->nb_iot_config.nprach_config_2_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_r13;
cfg->nb_iot_config.nprach_config_2_number_of_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
cfg->nb_iot_config.nprach_config_2_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
/*
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
config_INFO->extra_phy_parms.nprach_config_2_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
config_INFO->extra_phy_parms.nprach_config_2_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
config_INFO->extra_phy_parms.nprach_config_2_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13;
config_INFO->extra_phy_parms.nprach_config_2_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
config_INFO->extra_phy_parms.nprach_config_2_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
extra_phy_parms.nprach_config_2_subcarrier_MSG3_range_start = nprach_parameter->nprach_SubcarrierMSG3_RangeStart_r13;
extra_phy_parms.nprach_config_2_max_num_preamble_attempt_CE = nprach_parameter->maxNumPreambleAttemptCE_r13;
extra_phy_parms.nprach_config_2_npdcch_num_repetitions_RA = nprach_parameter->npdcch_NumRepetitions_RA_r13;
extra_phy_parms.nprach_config_2_npdcch_startSF_CSS_RA = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
extra_phy_parms.nprach_config_2_npdcch_offset_RA = nprach_parameter->npdcch_Offset_RA_r13;
*/
//rsrp_ThresholdsPrachInfoList_r13 /*OPTIONAL*/
break;
default:
LOG_E(RRC,"rrc_mac_config_req_eNB_NB_IoT: nprach_ParametersList size not valid\n");
break;
}else
{
LOG_E(MAC,"NPRACH Configuration isn't set properly\n");
}
LOG_I(MAC,"Fill parameters of FAPI NPRACH done\n");
/*NPDSCH ConfigCommon*/
//FIXME: MP: FAPI specs define a range of value [0-255]==[0db - 63.75db] with 0.25db step -- corrispondence in 3GPP specs???
config_INFO->cfg->rf_config.reference_signal_power.value = radioResourceConfigCommon->npdsch_ConfigCommon_r13.nrs_Power_r13;
cfg->rf_config.reference_signal_power.value = radioResourceConfigCommon->npdsch_ConfigCommon_r13.nrs_Power_r13;
/*NPUSCH ConfigCommon*/
//a pointer to the first element of the list
config_INFO->extra_phy_parms.ack_nack_numRepetitions_MSG4 = radioResourceConfigCommon->npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list.array[0];
// extra_phy_parms.ack_nack_numRepetitions_MSG4 = radioResourceConfigCommon->npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list.array[0];
if(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13 != NULL)/* OPTIONAL */
{
/* OPTIONAL */
if(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_BaseSequence_r13!= NULL)
config_INFO->cfg->config_NB_IoT.three_tone_base_sequence.value = *(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_BaseSequence_r13);
cfg->nb_iot_config.three_tone_base_sequence.value = *(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_BaseSequence_r13);
else
config_INFO->cfg->config_NB_IoT.three_tone_base_sequence.value = physCellId%12; //see spec TS 36.331 NPUSCH-Config-NB
cfg->nb_iot_config.three_tone_base_sequence.value = physCellId%12; //see spec TS 36.331 NPUSCH-Config-NB
/* OPTIONAL */
if(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_BaseSequence_r13!= NULL)
config_INFO->cfg->config_NB_IoT.six_tone_base_sequence.value = *(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_BaseSequence_r13);
cfg->nb_iot_config.six_tone_base_sequence.value = *(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_BaseSequence_r13);
else
config_INFO->cfg->config_NB_IoT.six_tone_base_sequence.value = physCellId%14; //see spec TS 36.331 NPUSCH-Config-NB
cfg->nb_iot_config.six_tone_base_sequence.value = physCellId%14; //see spec TS 36.331 NPUSCH-Config-NB
/* OPTIONAL */
if(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->twelveTone_BaseSequence_r13!= NULL)
config_INFO->cfg->config_NB_IoT.twelve_tone_base_sequence.value = *(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->twelveTone_BaseSequence_r13);
cfg->nb_iot_config.twelve_tone_base_sequence.value = *(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->twelveTone_BaseSequence_r13);
else
config_INFO->cfg->config_NB_IoT.twelve_tone_base_sequence.value = physCellId%30; //see spec TS 36.331 NPUSCH-Config-NB
cfg->nb_iot_config.twelve_tone_base_sequence.value = physCellId%30; //see spec TS 36.331 NPUSCH-Config-NB
config_INFO->cfg->config_NB_IoT.three_tone_cyclic_shift.value = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_CyclicShift_r13;
config_INFO->cfg->config_NB_IoT.six_tone_cyclic_shift.value = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_CyclicShift_r13;
cfg->nb_iot_config.three_tone_cyclic_shift.value = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_CyclicShift_r13;
cfg->nb_iot_config.six_tone_cyclic_shift.value = radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_CyclicShift_r13;
}
//NOTE: MP: FAPI specs for UL RS Configurations seems to be targeted for LTE and not for NB-IoT
if(radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13 == TRUE)
config_INFO->cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 1; //RS_GROUP_HOPPING (FAPI specs pag 127)
cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 1; //RS_GROUP_HOPPING (FAPI specs pag 127)
else
config_INFO->cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 0;//RS_NO_HOPPING
cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 0;//RS_NO_HOPPING
config_INFO->cfg->uplink_reference_signal_config.group_assignment.value = radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13;
cfg->uplink_reference_signal_config.group_assignment.value = radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13;
//Some missed parameters are in UL_CONFIG.request message (P7) in FAPI specs. and not configured through P5 procedure
//ack_NACK_NumRepetitions_Msg4_r13
......@@ -396,20 +320,21 @@ void config_sib2_fapi_NB_IoT(
/*DL GAP config */
if(radioResourceConfigCommon->dl_Gap_r13 !=NULL)/* OPTIONAL */
{
config_INFO->cfg->config_NB_IoT.dl_gap_config_enable.value = 1;
config_INFO->cfg->config_NB_IoT.dl_gap_threshold.value = radioResourceConfigCommon->dl_Gap_r13->dl_GapThreshold_r13;
config_INFO->cfg->config_NB_IoT.dl_gap_duration_coefficient.value = radioResourceConfigCommon->dl_Gap_r13->dl_GapDurationCoeff_r13;
config_INFO->cfg->config_NB_IoT.dl_gap_periodicity.value = radioResourceConfigCommon->dl_Gap_r13->dl_GapPeriodicity_r13;
cfg->nb_iot_config.dl_gap_config_enable.value = 1;
cfg->nb_iot_config.dl_gap_threshold.value = radioResourceConfigCommon->dl_Gap_r13->dl_GapThreshold_r13;
cfg->nb_iot_config.dl_gap_duration_coefficient.value = radioResourceConfigCommon->dl_Gap_r13->dl_GapDurationCoeff_r13;
cfg->nb_iot_config.dl_gap_periodicity.value = radioResourceConfigCommon->dl_Gap_r13->dl_GapPeriodicity_r13;
}
else
config_INFO->cfg->config_NB_IoT.dl_gap_config_enable.value = 0;
cfg->nb_iot_config.dl_gap_config_enable.value = 0;
/*UL Power Control ConfigCommon*/
/*
//nothing defined in FAPI specs
config_INFO->extra_phy_parms.p0_nominal_npusch = radioResourceConfigCommon->uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13;
config_INFO->extra_phy_parms.alpha = radioResourceConfigCommon->uplinkPowerControlCommon_r13.alpha_r13;
config_INFO->extra_phy_parms.delta_preamle_MSG3 = radioResourceConfigCommon->uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13;
extra_phy_parms.p0_nominal_npusch = radioResourceConfigCommon->uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13;
extra_phy_parms.alpha = radioResourceConfigCommon->uplinkPowerControlCommon_r13.alpha_r13;
extra_phy_parms.delta_preamle_MSG3 = radioResourceConfigCommon->uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13;
*/
/*RACH Config Common*/
//nothing defined in FAPI specs
......@@ -427,21 +352,37 @@ void rrc_mac_config_req_NB_IoT(
RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon,
PhysicalConfigDedicated_NB_r13_t *physicalConfigDedicated,
LogicalChannelConfig_NB_r13_t *logicalChannelConfig, //FIXME: decide how to use it
rrc_config_NB_IoT_t *mac_config,
uint8_t ded_flag,
uint8_t ue_list_ded_num)
{
int UE_id = -1;
//find ue_id here
rrc_config_NB_IoT_t *mac_config=NULL;
mac_top_init_eNB_NB_IoT();
mac_config = &mac_inst->rrc_config;
if(ded_flag==0)
{
}else
{
// now we only have 3 UE list USS for three CE levels
// we fix value for RMAX to 8 / 16 / 32
mac_config->npdcch_ConfigDedicated[ue_list_ded_num].R_max = 8 + 8*ue_list_ded_num;
// fix value for G to 8 / 4 / 2
mac_config->npdcch_ConfigDedicated[ue_list_ded_num].G = 2 + (2-ue_list_ded_num)*(3-ue_list_ded_num);
// fix a_offest to 0 / 0 / 0
mac_config->npdcch_ConfigDedicated[ue_list_ded_num].a_offset = 0;
return;
}
config_INFO->get_MIB = 0;
config_INFO->get_COMMON = 0;
config_INFO->get_DEDICATED = 0;
config_INFO->mod_id = Mod_idP;
config_INFO->CC_id = CC_idP;
config_INFO->cfg->subframe_config.duplex_mode.value = 2; //HD-FDD for NB-IoT
if (&carrier->mib_NB_IoT != NULL){
/*printf(MAC,
......@@ -460,13 +401,8 @@ void rrc_mac_config_req_NB_IoT(
* 2)Call the PHY_config_req for trigger the NB_phy_config_mib_eNB() at the end
*/
//XXX where allocate memory for cfg??
if(config_INFO->cfg != NULL) LOG_E(MAC, "rrc_mac_config_req_eNB_NB_IoT: trying to configure PHY but no config.request message in config_INFO is allocated\n");
//Mapping OAI params into FAPI params
config_mib_fapi_NB_IoT( rntiP,
carrier->physCellId,
config_mib_fapi_NB_IoT(carrier->physCellId,
sib1_NB_IoT->freqBandIndicator_r13,
carrier->Ncp,
carrier->Ncp_UL,
......@@ -479,51 +415,85 @@ void rrc_mac_config_req_NB_IoT(
);
}else{
LOG_E(MAC,"carrier->mib_NB_IoT is NULL\n");
return;
}
if(sib1_NB_IoT != NULL)
{
mac_config->sib1_NB_IoT_sched_config.repetitions = 4;
mac_config->sib1_NB_IoT_sched_config.starting_rf = sib1_NB_IoT->si_RadioFrameOffset_r13[0];
//printf("[ASN Debug] SI P: %ld\n",sib1_NB_IoT->schedulingInfoList_r13.list.array[0]->si_Periodicity_r13);
mac_config->sib1_NB_IoT_sched_config.starting_rf = (intptr_t)(sib1_NB_IoT->si_RadioFrameOffset_r13);
mac_config->si_window_length = sib1_NB_IoT->si_WindowLength_r13;
SchedulingInfo_NB_r13_t *scheduling_info_list;
///CE level 0
///OAI only supports SIB2/3-NB for the sibs
if ( sib1_NB_IoT->schedulingInfoList_r13.list.array[0] != NULL){
scheduling_info_list = sib1_NB_IoT->schedulingInfoList_r13.list.array[0];
mac_config->sibs_NB_IoT_sched[0].si_periodicity = scheduling_info_list->si_Periodicity_r13 ;
//printf("Pass first SIBs Asn, SI P:%d\n",mac_config->sibs_NB_IoT_sched[0].si_periodicity);
mac_config->sibs_NB_IoT_sched[0].si_repetition_pattern = scheduling_info_list->si_RepetitionPattern_r13 ;
mac_config->sibs_NB_IoT_sched[0].sib_mapping_info = scheduling_info_list->sib_MappingInfo_r13.list.array[0][0] | scheduling_info_list->sib_MappingInfo_r13.list.array[1][0];
mac_config->sibs_NB_IoT_sched[0].sib_mapping_info = scheduling_info_list->sib_MappingInfo_r13.list.array[0][0];
mac_config->sibs_NB_IoT_sched[0].si_tb = scheduling_info_list->si_TB_r13 ;
///CE level 1
scheduling_info_list = sib1_NB_IoT->schedulingInfoList_r13.list.array[1];
} else { //set this value for now to be test further
mac_config->sibs_NB_IoT_sched[0].si_periodicity = si_Periodicity_rf4096 ;
mac_config->sibs_NB_IoT_sched[0].si_repetition_pattern = si_RepetitionPattern_every2ndRF;
mac_config->sibs_NB_IoT_sched[0].sib_mapping_info = sib3_v;
mac_config->sibs_NB_IoT_sched[0].si_tb = si_TB_680;
}
/// Thiese value is setting for different SIB set
if ( sib1_NB_IoT->schedulingInfoList_r13.list.array[1] != NULL) {
scheduling_info_list = sib1_NB_IoT->schedulingInfoList_r13.list.array[1];
mac_config->sibs_NB_IoT_sched[1].si_periodicity = scheduling_info_list->si_Periodicity_r13 ;
mac_config->sibs_NB_IoT_sched[1].si_repetition_pattern = scheduling_info_list->si_RepetitionPattern_r13 ;
mac_config->sibs_NB_IoT_sched[1].sib_mapping_info = scheduling_info_list->sib_MappingInfo_r13.list.array[0][0] | scheduling_info_list->sib_MappingInfo_r13.list.array[1][0];
mac_config->sibs_NB_IoT_sched[1].si_tb = scheduling_info_list->si_TB_r13 ;
} else { //set this value for now to be test further
mac_config->sibs_NB_IoT_sched[1].si_periodicity = si_Periodicity_rf4096 ;
mac_config->sibs_NB_IoT_sched[1].si_repetition_pattern = si_RepetitionPattern_every2ndRF;
mac_config->sibs_NB_IoT_sched[1].sib_mapping_info = sib3_v;
mac_config->sibs_NB_IoT_sched[1].si_tb = si_TB_680;
}
///CE level 2
if ( sib1_NB_IoT->schedulingInfoList_r13.list.array[2] != NULL) {
scheduling_info_list = sib1_NB_IoT->schedulingInfoList_r13.list.array[2];
mac_config->sibs_NB_IoT_sched[2].si_periodicity = scheduling_info_list->si_Periodicity_r13 ;
mac_config->sibs_NB_IoT_sched[2].si_repetition_pattern = scheduling_info_list->si_RepetitionPattern_r13 ;
mac_config->sibs_NB_IoT_sched[2].sib_mapping_info = scheduling_info_list->sib_MappingInfo_r13.list.array[0][0] | scheduling_info_list->sib_MappingInfo_r13.list.array[1][0];
mac_config->sibs_NB_IoT_sched[2].si_tb = scheduling_info_list->si_TB_r13 ;
} else { //set this value for now to be test further
mac_config->sibs_NB_IoT_sched[2].si_periodicity = si_Periodicity_rf4096 ;
mac_config->sibs_NB_IoT_sched[2].si_repetition_pattern = si_RepetitionPattern_every2ndRF;
mac_config->sibs_NB_IoT_sched[2].sib_mapping_info = sib3_v;
mac_config->sibs_NB_IoT_sched[2].si_tb = si_TB_680;
}
mac_config->sibs_NB_IoT_sched[3].sib_mapping_info = 0x0;
mac_config->sibs_NB_IoT_sched[4].sib_mapping_info = 0x0;
mac_config->sibs_NB_IoT_sched[5].sib_mapping_info = 0x0;
}else{
LOG_E(MAC,"sib1_NB_IoT is NULL\n");
}
if (radioResourceConfigCommon!=NULL) {
//if(config_INFO->cfg == NULL) LOG_E(MAC, "rrc_mac_config_req_eNB_NB_IoT: trying to configure PHY but no config.request message in config_INFO is allocated\n");
//if(cfg == NULL) LOG_E(MAC, "rrc_mac_config_req_eNB_NB_IoT: trying to configure PHY but no config.request message in config_INFO is allocated\n");
config_INFO->get_COMMON = 1;
// need to fix these array setting issue
//LOG_I(MAC,"[CONFIG]SIB2/3-NB radioResourceConfigCommon Contents (partial)\n");
......@@ -535,42 +505,46 @@ void rrc_mac_config_req_NB_IoT(
NPRACH_Parameters_NB_r13_t* nprach_parameter;
///CE level 0
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0];
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0] != NULL) {
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0];
LOG_I(MAC,"NPRACH 0 setting: NumRepetiion: %ld Period: %ld size of list %d\n",nprach_parameter->numRepetitionsPerPreambleAttempt_r13,nprach_parameter->nprach_Periodicity_r13,radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.size);
mac_config->mac_NPRACH_ConfigSIB[0].mac_numRepetitionsPerPreambleAttempt_NB_IoT = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT = nprach_parameter->npdcch_NumRepetitions_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_StartSF_CSS_RA_NB_IoT = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_Offset_RA_NB_IoT = nprach_parameter->npdcch_Offset_RA_r13;
}
///CE level 1
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1];
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1] != NULL) {
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1];
LOG_I(MAC,"NPRACH 1 setting: NumRepetiion: %ld size of list %d\n",nprach_parameter->numRepetitionsPerPreambleAttempt_r13,radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.size);
mac_config->mac_NPRACH_ConfigSIB[1].mac_numRepetitionsPerPreambleAttempt_NB_IoT = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_NumRepetitions_RA_NB_IoT = nprach_parameter->npdcch_NumRepetitions_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_StartSF_CSS_RA_NB_IoT = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_Offset_RA_NB_IoT = nprach_parameter->npdcch_Offset_RA_r13;
}
///CE level 2
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2] != NULL) {
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2];
LOG_I(MAC,"NPRACH 2 setting: NumRepetiion: %ld size of list %d\n",nprach_parameter->numRepetitionsPerPreambleAttempt_r13,radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.size);
mac_config->mac_NPRACH_ConfigSIB[2].mac_numRepetitionsPerPreambleAttempt_NB_IoT = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_NumRepetitions_RA_NB_IoT = nprach_parameter->npdcch_NumRepetitions_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_StartSF_CSS_RA_NB_IoT = nprach_parameter->npdcch_StartSF_CSS_RA_r13;
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_Offset_RA_NB_IoT = nprach_parameter->npdcch_Offset_RA_r13;
}
//eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].radioResourceConfigCommon = radioResourceConfigCommon;
if (carrier->ul_CarrierFreq>0)
//eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].ul_CarrierFreq = ul_CarrierFreq;
config_sib2_fapi_NB_IoT(carrier->physCellId,radioResourceConfigCommon);
}else{
LOG_E(MAC,"radioResourceConfigCommon is NULL\n");
}
if (logicalChannelConfig!= NULL) {
if(config_INFO->cfg == NULL) LOG_E(MAC, "rrc_mac_config_req_eNB_NB_IoT: trying to configure PHY but no config.request message in config_INFO is allocated\n");
if (UE_id == -1)
{
......@@ -586,37 +560,56 @@ void rrc_mac_config_req_NB_IoT(
if (physicalConfigDedicated != NULL) {
if(config_INFO->cfg == NULL) LOG_E(MAC, "rrc_mac_config_req_eNB_NB_IoT: trying to configure PHY but no config.request message in config_INFO is allocated\n");
if (UE_id == -1)
LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
else
{
/*
extra_phy_parms.npdcch_NumRepetitions = physicalConfigDedicated->npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13; //Rmax
extra_phy_parms.npdcch_Offset_USS = physicalConfigDedicated->npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
extra_phy_parms.npdcch_StartSF_USS = physicalConfigDedicated->npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
*/
//extra_phy_parms.phy_config_dedicated = physicalConfigDedicated; //for the moment fapi not allow this so not used
config_INFO->get_DEDICATED = 1;
}
}
//XXX this parameters seems to be not defined by FAPi specs
//this are UE specific information that should be transmitted to the PHY layer
//use UE-specific structure at phy layer where to store this information (NPDCCH structure) this structure will be scrambled based on the rnti
//config_INFO->rnti = UE_RNTI_NB_IoT(Mod_idP, UE_id);
config_INFO->extra_phy_parms.npdcch_NumRepetitions = physicalConfigDedicated->npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13; //Rmax
config_INFO->extra_phy_parms.npdcch_Offset_USS = physicalConfigDedicated->npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
config_INFO->extra_phy_parms.npdcch_StartSF_USS = physicalConfigDedicated->npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
//LOG_I(MAC,"CP Length Checking %u\n",RC.nb_iot_mac[Mod_idP]->config.nb_iot_config.nprach_config_0_cp_length.value);
//config_INFO->extra_phy_parms.phy_config_dedicated = physicalConfigDedicated; //for the moment fapi not allow this so not used
if(mac_inst->if_inst_NB_IoT!=NULL)
{
if (radioResourceConfigCommon!=NULL) {
AssertFatal( mac_inst->if_inst_NB_IoT->PHY_config_req != NULL, "rrc_mac_config_req_eNB_NB_IoT: PHY_config_req pointer function is NULL\n");
PHY_Config_NB_IoT_t phycfg;
phycfg.mod_id = Mod_idP;
phycfg.cfg = &mac_inst->config;
if (mac_inst->if_inst_NB_IoT->PHY_config_req) mac_inst->if_inst_NB_IoT->PHY_config_req(&phycfg);
}
}else{
LOG_E(MAC,"NB-IoT IF INST is NULL, need to fix\n");
}
//Now trigger the phy_config_xxx for configuring PHY through the PHY_config_req
AssertFatal(if_inst->PHY_config_req != NULL, "rrc_mac_config_req_eNB_NB_IoT: PHY_config_req pointer function is NULL\n");
if(if_inst->PHY_config_req)
if_inst->PHY_config_req(config_INFO);
//return 0;
init_mac_NB_IoT(mac_inst);
LOG_I(MAC,"[NB-IoT] Init_MAC done\n");
//for sacheduler testing
/*for(int i =0;i<30;i++)
{
LOG_I(MAC,"[NB-IoT] scheduler testing start %d\n",i);
eNB_dlsch_ulsch_scheduler_NB_IoT(RC.nb_iot_mac[Mod_idP], i);
LOG_I(MAC,"[NB-IoT] scheduler testing done %d\n",i);
}*/
// RC.L1_NB_IoT[Mod_idP]->configured=1;
/*if( ded_flag!=0 )
{
......
......@@ -479,6 +479,8 @@ typedef struct RA_template_list_s{
/*! \brief top level eNB MAC structure */
typedef struct {
uint8_t Mod_id;
// System
uint32_t hyper_system_frame;
uint32_t system_frame;
......@@ -516,6 +518,11 @@ typedef struct {
rrc_config_NB_IoT_t rrc_config;
nfapi_config_request_t config;
IF_Module_NB_IoT_t *if_inst_NB_IoT;
} eNB_MAC_INST_NB_IoT;
// actually not here, but for now put it here
......@@ -531,6 +538,8 @@ typedef struct {
nprach_parameters_NB_IoT_t nprach_list[3];
nfapi_config_request_t config;
//DLSF Table
DLSF_INFO_t DLSF_information;
......
......@@ -13,6 +13,7 @@
#include "extern_NB_IoT.h"
unsigned char str[6][7] = { "SIBs_1", "SIBs_2", "SIBs_3", "SIBs_4", "SIBs_5", "SIBs_6" };
unsigned char si_repetition_pattern_table[4] = { 20, 40, 80, 160};
void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start_subframe1){
......@@ -22,9 +23,11 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in
schedule_result_t *new_node;
DCIFormatN1_t *sibs_dci;
uint32_t j, i, k, num_subframe, last_subframe, residual_subframe;
num_subframe = mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_tb;
for(k=0, i=start_subframe1;i<(start_subframe1+mac_inst->rrc_config.si_window_length);i+=mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern, ++k){
for(k=0, i=start_subframe1;i<(start_subframe1+mac_inst->rrc_config.si_window_length);i+=si_repetition_pattern_table[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern], ++k){
//printf("[debug][sibs%d] subframe: %d, check %d", sibs_order, i, num_subframe);
pt[k] = (available_resource_DL_t *)check_sibs_resource(mac_inst, i, i+9, num_subframe, &residual_subframe, &last_subframe, &first_subframe[k]);
......@@ -45,7 +48,8 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in
sibs_dci->HARQackRes = 0;
sibs_dci->DCIRep = 0;
for(k=0, j=start_subframe1;j<=i;++k, j+=mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern){
for(k=0, j=start_subframe1;j<=i;++k, j+=si_repetition_pattern_table[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern]){
if((available_resource_DL_t *)0 != pt[k]){
new_node = (schedule_result_t *)malloc(sizeof(schedule_result_t));
// fill new node
......@@ -65,6 +69,7 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in
fill_resource_DL(mac_inst, pt[k], first_subframe[k], (j==i)?last_subframe:j+9, new_node);
}
}
return ;
}
}
......
......@@ -27,7 +27,7 @@
//#include "LAYER2/MAC/vars_NB_IoT.h"
//NB-IoT
extern IF_Module_t *if_inst;
extern eNB_MAC_INST_NB_IoT *mac_inst;
// //extern uint32_t EBSR_Level[63];
......
......@@ -49,6 +49,8 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
{
int32_t i, j, k;
LOG_I(MAC,"[NB-IoT] MAC start initialization\n");
for(i=0;i<64;++i)
{
mac_inst->sib1_flag[i] = 0;
......@@ -69,7 +71,6 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
sib1_NB_IoT_sched_t *config = &mac_inst->rrc_config.sib1_NB_IoT_sched_config;
// DLSF Table
init_dlsf_info(mac_inst, &DLSF_information);
......@@ -97,8 +98,8 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
}
}
//mac_inst->si_window_length = ms160;
//mac_inst->sibs_NB_IoT_sched[0].si_periodicity = rf64;
mac_inst->rrc_config.si_window_length = ms160;
mac_inst->rrc_config.sibs_NB_IoT_sched[0].si_periodicity = rf64;
for(i=0;i<256;++i){
mac_inst->sibs_table[i] = -1;
......@@ -136,12 +137,13 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
//3 CE level USS list
mac_inst->UE_list_spec = (UE_list_NB_IoT_t*)malloc(NUM_USS_PP*sizeof(UE_list_NB_IoT_t));
//initial UE list
printf("[init_mac_NB_IoT] Initial UE list\n");
LOG_I(MAC,"[NB-IoT] Initial UE list\n");
mac_inst->num_uss_list = NUM_USS_PP;
for(i=0;i<NUM_USS_PP;++i)
{
//rrc_mac_config_req_NB_IoT(&mac_inst->rrc_config, 0, 0, 1, i);
rrc_mac_config_req_NB_IoT(0,0,0,NULL,NULL,NULL,NULL,NULL,1,i);
(mac_inst->UE_list_spec+i)->head = -1;
(mac_inst->UE_list_spec+i)->tail = -1;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max = mac_inst->rrc_config.npdcch_ConfigDedicated[i].R_max;
......@@ -159,7 +161,8 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
(mac_inst->UE_list_spec+i)->UE_template_NB_IoT[j].direction = -1;
}
//SCHEDULE_LOG("[%04d][init_mac_NB_IoT] List_number %d R_max %d G %.1f a_offset %.1f T %d SS_start %d\n", mac_inst->current_subframe, 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);
printf("[init_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);
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);
}
/*
......@@ -200,13 +203,45 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
Initialize_Resource();
//add_UL_Resource(mac_inst);
extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + 160);
}
void mac_top_init_eNB_NB_IoT(void)
{
// can be an input of this function, but now fix to 0
module_id_t i = 0;
//UE_list_t *UE_list;
//eNB_MAC_INST_NB_IoT *mac;
int nb_inst_NB_IOT_MAC= 1;
LOG_I(MAC,"[NB-IoT MAIN] Init function start:nb_nbiot_macrlc_inst=%d\n",nb_inst_NB_IOT_MAC);
if (nb_inst_NB_IOT_MAC>0) {
// only one inst exit in legacy OAI
mac_inst->Mod_id = i;
// IF Module Initialization linking
mac_inst->if_inst_NB_IoT = IF_Module_init_NB_IoT(i);
mac_inst->if_inst_NB_IoT->PHY_config_req = PHY_config_req_NB_IoT;
mac_inst->if_inst_NB_IoT->schedule_response = schedule_response_NB_IoT;
//reserve for fapi structure initializati
} else {
mac_inst = NULL;
}
// for NB-IoT UE list initialization will be in init_mac_NB_IoT
}
int l2_init_eNB_NB_IoT(void)
{
LOG_I(MAC,"[MAIN] Mapping L2 IF-Module functions\n");
IF_Module_init_L2();
LOG_I(MAC,"[MAIN] MAC_INIT_GLOBAL_PARAM NB-IoT IN...\n");
......
......@@ -23,10 +23,10 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
uint8_t MIB_size = 0;
uint8_t SIB1_size = 0, i = 0;
Sched_Rsp_t *SCHED_info = (Sched_Rsp_t*) malloc(sizeof(Sched_Rsp_t));
Sched_Rsp_NB_IoT_t *SCHED_info = (Sched_Rsp_NB_IoT_t*) malloc(sizeof(Sched_Rsp_NB_IoT_t));
nfapi_dl_config_request_pdu_t *dl_config_pdu;
nfapi_hi_dci0_request_pdu_t* hi_dci0_pdu;
nfapi_ul_config_request_pdu_t* ul_config_pdu;
nfapi_ul_config_request_pdu_t* ul_config_pdu = NULL;
schedule_result_t *tmp;
int DL_empty = 0, UL_empty = 0;
//uint32_t current_time = 0;
......@@ -63,6 +63,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
// fill MIB PDU
//SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->NB_IoTch_pdu.NB_IoTch_pdu_rel13.pdu_index].segments[0].segment_data = MIB;
LOG_I(MAC,"NB-IoT fill MIB\n");
//dl_scheduled(mac_inst->current_subframe, _NPBCH, 0, "MIB");
}
else if(SIB1_flag == 1)
......@@ -78,7 +79,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
//SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = SIB1;
LOG_I(MAC,"NB-IoT fill SIB1\n");
//start symbol, Resource assignment, Repetition number, Number of subframe Resource assignment lost for now
//dl_scheduled(mac_inst->current_subframe, _NPDSCH, SI_RNTI, "SIB1");
}
......@@ -114,6 +115,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
if(schedule_result_list_DL->direction == DL)
{
LOG_I(MAC,"NB-IoT fill DL_DCI\n");
//printf("Sched Info DL DCI here\n");
SCHED_info->DL_req->dl_config_request_body.number_dci = 1;
DCI_pdu = schedule_result_list_DL->DCI_pdu;
......@@ -137,6 +139,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep;
}else if(schedule_result_list_DL->direction == UL)
{
LOG_I(MAC,"NB-IoT fill DL_DCI\n");
SCHED_info->HI_DCI0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t));
SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)malloc(sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu = SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list;
......@@ -158,7 +161,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
}
break;
case NPDSCH:
LOG_I(MAC,"NB-IoT fill DL Data\n");
DCI_pdu = schedule_result_list_DL-> DCI_pdu;
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE;
......@@ -221,7 +224,8 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
{
if(schedule_result_list_UL->channel == NPUSCH)
{
printf("first UL \n");
//printf("first UL \n");
LOG_I(MAC,"NB-IoT fill ul_config_pdu\n");
SCHED_info->UL_req->ul_config_request_body.number_of_pdus ++;
//SCHED_info->UL_req.sfn_sf = ;
(ul_config_pdu + i) ->pdu_type = NFAPI_UL_CONFIG_NULSCH_PDU_TYPE;
......
......@@ -38,6 +38,7 @@
* @{
*/
void mac_top_init_eNB_NB_IoT(void);
int l2_init_eNB_NB_IoT(void);
// main schedule functions
......@@ -104,7 +105,6 @@ uint32_t from_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_earfcn, float m_dl);
int32_t get_uldl_offset_NB_IoT(int eutra_band);
void config_mib_fapi_NB_IoT(
int rntiP,
int physCellId,
uint8_t eutra_band,
int Ncp,
......@@ -131,7 +131,6 @@ void rrc_mac_config_req_NB_IoT(
RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon,
PhysicalConfigDedicated_NB_r13_t *physicalConfigDedicated,
LogicalChannelConfig_NB_r13_t *logicalChannelConfig, //FIXME: decide how to use it
rrc_config_NB_IoT_t *mac_config,
uint8_t ded_flag,
uint8_t ue_list_ded_num);
......
......@@ -21,8 +21,6 @@
//#include "COMMON/mac_rrc_primitives.h"
IF_Module_t *if_inst;
//NB-IoT--------------------------------------
eNB_MAC_INST_NB_IoT *mac_inst;
......
......@@ -3,7 +3,7 @@
// Sched_INFO as a input for the scheduler
void UL_indication(UL_IND_t *UL_INFO)
void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
{
int i=0;
//UE_TEMPLATE_NB_IoT *UE_info;
......
......@@ -6,8 +6,4 @@
#ifndef __IF_MODULE_L2_PRIMITIVES_NB_IOT_H__
#define __IF_MODULE_L2_PRIMITIVES_NB_IOT_H__
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
void UL_indication(UL_IND_t *UL_INFO);
#endif
......@@ -5,23 +5,25 @@
//#include "LAYER2/MAC/proto_NB_IoT.h"
//called at initialization of L2
void IF_Module_init_L2(void) // northbound IF-Module Interface
{
//mapping the IF-Module function to L2 definition
if_inst->UL_indication = UL_indication;
#define MAX_IF_MODULES_NB_IoT 1
//return if_inst;
}
IF_Module_NB_IoT_t *if_inst_NB_IoT[MAX_IF_MODULES_NB_IoT];
//#include "LAYER2/MAC/proto_NB_IoT.h"
//called at initialization of L1 (phy_init_lte_eNB)
void IF_Module_init_L1(void) //southbound IF-Module Interface
{
//mapping the IF-module function to L1 definition
if_inst->schedule_response = schedule_response;
if_inst->PHY_config_req = PHY_config_req;
IF_Module_NB_IoT_t *IF_Module_init_NB_IoT(int Mod_id){
//return if_inst;
}
AssertFatal(Mod_id<MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES_NB_IoT);
if (if_inst_NB_IoT[Mod_id]==NULL) {
if_inst_NB_IoT[Mod_id] = (IF_Module_NB_IoT_t*)malloc(sizeof(IF_Module_NB_IoT_t));
memset((void*)if_inst_NB_IoT[Mod_id],0,sizeof(IF_Module_NB_IoT_t));
//if_inst[Mod_id]->CC_mask=0;
if_inst_NB_IoT[Mod_id]->UL_indication = UL_indication_NB_IoT;
/*AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0,
"allocation of if_inst[%d]->if_mutex fails\n",Mod_id);*/
}
return if_inst_NB_IoT[Mod_id];
}
......@@ -13,6 +13,7 @@
#include "PhysicalConfigDedicated-NB-r13.h"
//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "openair2/COMMON/platform_types.h"
//#include "openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h"
//#define SCH_PAYLOAD_SIZE_MAX 4096
#define BCCH_PAYLOAD_SIZE_MAX_NB_IoT 128
......@@ -106,7 +107,7 @@ typedef struct{
/*MP: MISSED COMMON CONFIG. of SIB2-NB in FAPI SPECS (may non needed)*/
extra_phyConfig_t extra_phy_parms;
}PHY_Config_t;
}PHY_Config_NB_IoT_t;
......@@ -147,7 +148,7 @@ typedef struct{
/*crc_indication*/
nfapi_crc_indication_body_t crc_ind;
}UL_IND_t;
}UL_IND_NB_IoT_t;
// Downlink subframe P7
......@@ -178,25 +179,34 @@ typedef struct{
/// Pointers to DL SDUs
//uint8_t **sdu;
}Sched_Rsp_t;
}Sched_Rsp_NB_IoT_t;
/*IF_Module_t a group for gathering the Interface
It should be allocated at the main () in lte-softmodem.c*/
typedef struct IF_Module_s{
//define the function pointer
void (*UL_indication)(UL_IND_t *UL_INFO);
void (*schedule_response)(Sched_Rsp_t *Sched_INFO);
void (*PHY_config_req)(PHY_Config_t* config_INFO);
void (*UL_indication)(UL_IND_NB_IoT_t *UL_INFO);
void (*schedule_response)(Sched_Rsp_NB_IoT_t *Sched_INFO);
void (*PHY_config_req)(PHY_Config_NB_IoT_t* config_INFO);
}IF_Module_t;
}IF_Module_NB_IoT_t;
/*Initial */
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO);
//int IF_Module_init(IF_Module_t *if_inst);
/*Interface for PHY Configuration
* Trigger the phy_config_xxx functions using parameters from the shared PHY_Config structure
* */
void PHY_config_req_NB_IoT(PHY_Config_NB_IoT_t* config_INFO);
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO);
void IF_Module_init_L1(void);
void IF_Module_init_L2(void);
/*Initial */
IF_Module_NB_IoT_t *IF_Module_init_NB_IoT(int Mod_id);
#endif
......@@ -1125,7 +1125,7 @@ typedef struct {
nfapi_emtc_config_t emtc_config;
nfapi_tdd_frame_structure_t tdd_frame_structure_config;
nfapi_l23_config_t l23_config;
nfapi_config_NB_IoT_t config_NB_IoT;
nfapi_config_NB_IoT_t nb_iot_config;
// addition nfapi tlvs as per table 2-16 in idle or configure
nfapi_nfapi_t nfapi_config;
......
......@@ -34,7 +34,7 @@
unsigned int mac_debug;
//MAC_xface *mac_xface;
IF_Module_t* if_inst;
//IF_Module_t* if_inst;
//MACPHY_PARAMS MACPHY_params;
......
......@@ -97,7 +97,8 @@ int errno;
uint8_t do_MIB_NB_IoT(
rrc_eNB_carrier_data_NB_IoT_t *carrier,
uint16_t N_RB_DL,//may not needed--> for NB_IoT only 1 PRB is used
uint32_t frame)
uint32_t frame,
uint32_t hyper_frame)
{
asn_enc_rval_t enc_rval;
BCCH_BCH_Message_NB_t *mib_NB_IoT = &(carrier->mib_NB_IoT);
......@@ -117,7 +118,7 @@ uint8_t do_MIB_NB_IoT(
//XXX check if correct the bit assignment
uint8_t sfn_MSB = (uint8_t)((frame>>6) & 0x0f); // all the 4 bits are set to 1
uint8_t hsfn_LSB = (uint8_t)(frame & 0x3); //2 bits set to 1 (0x3 = 0011)
uint8_t hsfn_LSB = (uint8_t)(hyper_frame & 0x3); //2 bits set to 1 (0x3 = 0011)
uint16_t spare=0; //11 bits --> use uint16
mib_NB_IoT->message.systemFrameNumber_MSB_r13.buf = &sfn_MSB;
......@@ -129,7 +130,7 @@ uint8_t do_MIB_NB_IoT(
mib_NB_IoT->message.hyperSFN_LSB_r13.bits_unused = 6;
//XXX to be set??
mib_NB_IoT->message.spare.buf = (uint16_t *)&spare;
mib_NB_IoT->message.spare.buf = (uint8_t *)&spare;
mib_NB_IoT->message.spare.size = 2;
mib_NB_IoT->message.spare.bits_unused = 5;
......@@ -142,7 +143,7 @@ uint8_t do_MIB_NB_IoT(
mib_NB_IoT->message.operationModeInfo_r13.present = MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13;
mib_NB_IoT->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13 = 0;
printf("[MIB] something to write HERE ,sfn_MSB %x, hsfn_LSB %x\n",
printf("[MIB] Intialization of frame information ,sfn_MSB %x, hsfn_LSB %x\n",
(uint32_t)sfn_MSB,
(uint32_t)hsfn_LSB);
......@@ -169,14 +170,15 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
)
{
BCCH_DL_SCH_Message_NB_t *bcch_message= &(carrier->siblock1_NB_IoT);
SystemInformationBlockType1_NB_t *sib1_NB_IoT;
SystemInformationBlockType1_NB_t **sib1_NB_IoT= &(carrier->sib1_NB_IoT);
asn_enc_rval_t enc_rval;
PLMN_IdentityInfo_NB_r13_t PLMN_identity_info_NB_IoT;
MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3];
SchedulingInfo_NB_r13_t schedulingInfo_NB_IoT;
SIB_Type_NB_r13_t sib_type_NB_IoT;
SchedulingInfo_NB_r13_t *schedulingInfo_NB_IoT;
SIB_Type_NB_r13_t *sib_type_NB_IoT;
long* attachWithoutPDN_Connectivity = NULL;
......@@ -192,8 +194,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformationBlockType1_r13;
//allocation
carrier->sib1_NB_IoT = &bcch_message->message.choice.c1.choice.systemInformationBlockType1_r13;
sib1_NB_IoT = carrier->sib1_NB_IoT;
*sib1_NB_IoT = &bcch_message->message.choice.c1.choice.systemInformationBlockType1_r13;
/*TS 36.331 v14.2.0 pag 589
......@@ -204,14 +205,11 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
uint8_t hyperSFN_MSB = (uint8_t) ((frame>>2)& 0xff);
//XXX to be checked
sib1_NB_IoT->hyperSFN_MSB_r13.buf = &hyperSFN_MSB;
sib1_NB_IoT->hyperSFN_MSB_r13.size = 1;
sib1_NB_IoT->hyperSFN_MSB_r13.bits_unused = 0;
(*sib1_NB_IoT)->hyperSFN_MSB_r13.buf = &hyperSFN_MSB;
(*sib1_NB_IoT)->hyperSFN_MSB_r13.size = 1;
(*sib1_NB_IoT)->hyperSFN_MSB_r13.bits_unused = 0;
memset(&PLMN_identity_info_NB_IoT,0,sizeof(PLMN_IdentityInfo_NB_r13_t));
memset(&schedulingInfo_NB_IoT,0,sizeof(SchedulingInfo_NB_r13_t));
memset(&sib_type_NB_IoT,0,sizeof(SIB_Type_NB_r13_t));
PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc = CALLOC(1,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc));
memset(PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc,0,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc));
......@@ -272,55 +270,55 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
*attachWithoutPDN_Connectivity = 0;
PLMN_identity_info_NB_IoT.attachWithoutPDN_Connectivity_r13 = attachWithoutPDN_Connectivity;
ASN_SEQUENCE_ADD(&sib1_NB_IoT->cellAccessRelatedInfo_r13.plmn_IdentityList_r13.list,&PLMN_identity_info_NB_IoT);
ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.plmn_IdentityList_r13.list,&PLMN_identity_info_NB_IoT);
// 16 bits = 2 byte
sib1_NB_IoT->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf = MALLOC(2); //MALLOC works in byte
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf = MALLOC(2); //MALLOC works in byte
//lefts as it is?
#if defined(ENABLE_ITTI)
sib1_NB_IoT->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = (configuration->tac >> 8) & 0xff;
sib1_NB_IoT->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = (configuration->tac >> 0) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = (configuration->tac >> 8) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = (configuration->tac >> 0) & 0xff;
#else
sib1_NB_IoT->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = 0x00;
sib1_NB_IoT->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = 0x01;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = 0x00;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = 0x01;
#endif
sib1_NB_IoT->cellAccessRelatedInfo_r13.trackingAreaCode_r13.size=2;
sib1_NB_IoT->cellAccessRelatedInfo_r13.trackingAreaCode_r13.bits_unused=0;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.size=2;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.bits_unused=0;
// 28 bits --> i have to use 32 bits = 4 byte
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf = MALLOC(8); // why allocate 8 byte?
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf = MALLOC(8); // why allocate 8 byte?
#if defined(ENABLE_ITTI)
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = (configuration->cell_identity >> 20) & 0xff;
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = (configuration->cell_identity >> 12) & 0xff;
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = (configuration->cell_identity >> 4) & 0xff;
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = (configuration->cell_identity << 4) & 0xf0;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = (configuration->cell_identity >> 20) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = (configuration->cell_identity >> 12) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = (configuration->cell_identity >> 4) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = (configuration->cell_identity << 4) & 0xf0;
#else
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = 0x00;
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = 0x00;
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = 0x00;
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = 0x10;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = 0x00;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = 0x00;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = 0x00;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = 0x10;
#endif
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.size=4;
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellIdentity_r13.bits_unused=4;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.size=4;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.bits_unused=4;
//Still set to "notBarred" as in the previous case
sib1_NB_IoT->cellAccessRelatedInfo_r13.cellBarred_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__cellBarred_r13_notBarred;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellBarred_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__cellBarred_r13_notBarred;
//Still Set to "notAllowed" like in the previous case
sib1_NB_IoT->cellAccessRelatedInfo_r13.intraFreqReselection_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__intraFreqReselection_r13_notAllowed;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.intraFreqReselection_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__intraFreqReselection_r13_notAllowed;
sib1_NB_IoT->cellSelectionInfo_r13.q_RxLevMin_r13=-65; //which value?? TS 36.331 V14.2.1 pag. 589
sib1_NB_IoT->cellSelectionInfo_r13.q_QualMin_r13 = 0; //FIXME new parameter for SIB1-NB, not present in SIB1 (for cell reselection but if not used the UE should apply the default value)
(*sib1_NB_IoT)->cellSelectionInfo_r13.q_RxLevMin_r13=-65; //which value?? TS 36.331 V14.2.1 pag. 589
(*sib1_NB_IoT)->cellSelectionInfo_r13.q_QualMin_r13 = 0; //FIXME new parameter for SIB1-NB, not present in SIB1 (for cell reselection but if not used the UE should apply the default value)
sib1_NB_IoT->p_Max_r13 = CALLOC(1, sizeof(P_Max_t));
*(sib1_NB_IoT->p_Max_r13) = 23;
(*sib1_NB_IoT)->p_Max_r13 = CALLOC(1, sizeof(P_Max_t));
*((*sib1_NB_IoT)->p_Max_r13) = 23;
//FIXME
sib1_NB_IoT->freqBandIndicator_r13 =
(*sib1_NB_IoT)->freqBandIndicator_r13 =
#if defined(ENABLE_ITTI)
configuration->eutra_band[CC_id];
configuration->eutra_band;
#else
5; //if not configured we use band 5 (UL: 824 MHz - 849MHz / DL: 869 MHz - 894 MHz FDD mode)
#endif
......@@ -334,33 +332,45 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
*/
sib1_NB_IoT->downlinkBitmap_r13 = CALLOC(1, sizeof(struct DL_Bitmap_NB_r13));
(sib1_NB_IoT->downlinkBitmap_r13)->present= DL_Bitmap_NB_r13_PR_NOTHING;
(*sib1_NB_IoT)->downlinkBitmap_r13 = CALLOC(1, sizeof(struct DL_Bitmap_NB_r13));
((*sib1_NB_IoT)->downlinkBitmap_r13)->present= DL_Bitmap_NB_r13_PR_NOTHING;
*eutraControlRegionSize = 0;
sib1_NB_IoT->eutraControlRegionSize_r13 = eutraControlRegionSize;
*eutraControlRegionSize = 1;
(*sib1_NB_IoT)->eutraControlRegionSize_r13 = eutraControlRegionSize;
*nrs_CRS_PowerOffset= 0;
sib1_NB_IoT->nrs_CRS_PowerOffset_r13 = nrs_CRS_PowerOffset;
(*sib1_NB_IoT)->nrs_CRS_PowerOffset_r13 = nrs_CRS_PowerOffset;
schedulingInfo_NB_IoT = (SchedulingInfo_NB_r13_t*) malloc (3*sizeof(SchedulingInfo_NB_r13_t));
sib_type_NB_IoT = (SIB_Type_NB_r13_t *) malloc (3*sizeof(SIB_Type_NB_r13_t));
memset(&schedulingInfo_NB_IoT[0],0,sizeof(SchedulingInfo_NB_r13_t));
memset(&schedulingInfo_NB_IoT[1],0,sizeof(SchedulingInfo_NB_r13_t));
memset(&schedulingInfo_NB_IoT[2],0,sizeof(SchedulingInfo_NB_r13_t));
memset(&sib_type_NB_IoT[0],0,sizeof(SIB_Type_NB_r13_t));
memset(&sib_type_NB_IoT[1],0,sizeof(SIB_Type_NB_r13_t));
memset(&sib_type_NB_IoT[2],0,sizeof(SIB_Type_NB_r13_t));
// Now, follow the scheduler SIB configuration
// There is only one sib2+sib3 common setting
schedulingInfo_NB_IoT[0].si_Periodicity_r13=SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096;
schedulingInfo_NB_IoT[0].si_RepetitionPattern_r13=SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF; //This Indicates the starting radio frames within the SI window used for SI message transmission.
schedulingInfo_NB_IoT[0].si_TB_r13= SchedulingInfo_NB_r13__si_TB_r13_b680;//208 bits
//FIXME which value to set?
schedulingInfo_NB_IoT.si_Periodicity_r13=SchedulingInfo_NB_r13__si_Periodicity_r13_rf64;
schedulingInfo_NB_IoT.si_RepetitionPattern_r13=SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF; //This Indicates the starting radio frames within the SI window used for SI message transmission.
schedulingInfo_NB_IoT.si_TB_r13= SchedulingInfo_NB_r13__si_TB_r13_b208;//208 bits
//from ASN1 tools we have seen that sib2 + sib3 we are always below 200 bits so we use this si_TB size.
//from the specs the SI-message will be transmitted in 8 subframe = 8ms (pag 590 TS 36.331)
// This is for SIB2/3
/*SIB3 --> There is no mapping information of SIB2 since it is always present
* in the first SystemInformation message
* listed in the schedulingInfoList list.
* */
sib_type_NB_IoT=SIB_Type_NB_r13_sibType3_NB_r13;
sib_type_NB_IoT[0]=SIB_Type_NB_r13_sibType3_NB_r13;
ASN_SEQUENCE_ADD(&schedulingInfo_NB_IoT[0].sib_MappingInfo_r13.list,&sib_type_NB_IoT[0]);
ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->schedulingInfoList_r13.list,&schedulingInfo_NB_IoT[0]);
ASN_SEQUENCE_ADD(&schedulingInfo_NB_IoT.sib_MappingInfo_r13.list,&sib_type_NB_IoT);
ASN_SEQUENCE_ADD(&sib1_NB_IoT->schedulingInfoList_r13.list,&schedulingInfo_NB_IoT);
//printf("[ASN Debug] SI P: %ld\n",(*sib1_NB_IoT)->schedulingInfoList_r13.list.array[0]->si_Periodicity_r13);
#if defined(ENABLE_ITTI)
......@@ -368,22 +378,22 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
#endif
{
//FIXME in NB-IoT mandatory to be FDD --> so must give an error
LOG_E(RRC,"[eNB %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct?
LOG_E(RRC,"[NB-IoT %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct?
exit(-1);
}
//FIXME which value chose for the following parameter
sib1_NB_IoT->si_WindowLength_r13=SystemInformationBlockType1_NB__si_WindowLength_r13_ms160;
sib1_NB_IoT->si_RadioFrameOffset_r13= 0;
(*sib1_NB_IoT)->si_WindowLength_r13=SystemInformationBlockType1_NB__si_WindowLength_r13_ms160;
(*sib1_NB_IoT)->si_RadioFrameOffset_r13= 0;
/*In Nb-IoT change/update of specific SI message can additionally be indicated by a SI message specific value tag
* systemInfoValueTagSI (there is no SystemInfoValueTag in SIB1-NB but only in MIB-NB)
*contained in systemInfoValueTagList_r13
**/
//FIXME correct?
sib1_NB_IoT->systemInfoValueTagList_r13 = CALLOC(1, sizeof(struct SystemInfoValueTagList_NB_r13));
asn_set_empty(&sib1_NB_IoT->systemInfoValueTagList_r13->list);
ASN_SEQUENCE_ADD(&sib1_NB_IoT->systemInfoValueTagList_r13->list,&systemInfoValueTagSI);
(*sib1_NB_IoT)->systemInfoValueTagList_r13 = CALLOC(1, sizeof(struct SystemInfoValueTagList_NB_r13));
asn_set_empty(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list);
ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list,&systemInfoValueTagSI);
#ifdef XER_PRINT //generate xml files
......@@ -396,12 +406,14 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
carrier->SIB1_NB_IoT,
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
if (enc_rval.encoded > 0){
LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
#ifdef USER_MODE
LOG_D(RRC,"[eNB] SystemInformationBlockType1-NB Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
LOG_D(RRC,"[NB-IoT] SystemInformationBlockType1-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
if (enc_rval.encoded==-1) {
......@@ -427,14 +439,15 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
asn_enc_rval_t enc_rval;
RACH_Info_NB_r13_t rach_Info_NB_IoT;
NPRACH_Parameters_NB_r13_t nprach_parameters;
NPRACH_Parameters_NB_r13_t *nprach_parameters;
//optional
long *connEstFailOffset = NULL;
connEstFailOffset = CALLOC(1, sizeof(long));
RSRP_ThresholdsNPRACH_InfoList_NB_r13_t *rsrp_ThresholdsPrachInfoList;
RSRP_Range_t rsrp_range;
// RSRP_ThresholdsNPRACH_InfoList_NB_r13_t *rsrp_ThresholdsPrachInfoList;
// RSRP_Range_t rsrp_range;
ACK_NACK_NumRepetitions_NB_r13_t ack_nack_repetition;
struct NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13 *dmrs_config;
struct DL_GapConfig_NB_r13 *dl_Gap;
......@@ -446,23 +459,23 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
if (bcch_message) {
memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_NB_t));
} else {
LOG_E(RRC,"[eNB %d] BCCH_MESSAGE_NB is null, exiting\n", Mod_id);
LOG_E(RRC,"[NB-IoT %d] BCCH_MESSAGE_NB is null, exiting\n", Mod_id);
exit(-1);
}
//before schould be allocated memory somewhere?
if (!carrier->sib2_NB_IoT) {
LOG_E(RRC,"[eNB %d] sib2_NB_IoT is null, exiting\n", Mod_id);
exit(-1);
}
if (!carrier->sib3_NB_IoT) {
LOG_E(RRC,"[eNB %d] sib3_NB_IoT is null, exiting\n", Mod_id);
exit(-1);
}
// if (!carrier->sib2_NB_IoT) {
// LOG_E(RRC,"[NB-IoT %d] sib2_NB_IoT is null, exiting\n", Mod_id);
// exit(-1);
// }
//
// if (!carrier->sib3_NB_IoT) {
// LOG_E(RRC,"[NB-IoT %d] sib3_NB_IoT is null, exiting\n", Mod_id);
// exit(-1);
// }
LOG_I(RRC,"[eNB %d] Configuration SIB2/3\n", Mod_id);
LOG_I(RRC,"[NB-IoT %d] Configuration SIB2/3\n", Mod_id);
sib2_NB_part = CALLOC(1,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
sib3_NB_part = CALLOC(1,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
......@@ -478,6 +491,11 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
sib2_NB_IoT = carrier->sib2_NB_IoT;
sib3_NB_IoT = carrier->sib3_NB_IoT;
nprach_parameters = (NPRACH_Parameters_NB_r13_t *) malloc (3*sizeof(NPRACH_Parameters_NB_r13_t));
memset(&nprach_parameters[0],0,sizeof(NPRACH_Parameters_NB_r13_t));
memset(&nprach_parameters[1],0,sizeof(NPRACH_Parameters_NB_r13_t));
memset(&nprach_parameters[2],0,sizeof(NPRACH_Parameters_NB_r13_t));
/// SIB2-NB-----------------------------------------
......@@ -498,40 +516,70 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
//TS 36.331 pag 614 --> if not present the value to infinity sould be used
*connEstFailOffset = 0;
sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.connEstFailOffset_r13 = connEstFailOffset; /*OPTIONAL*/
// BCCH-Config-NB-IoT----------------------------------------------------------------
sib2_NB_IoT->radioResourceConfigCommon_r13.bcch_Config_r13.modificationPeriodCoeff_r13
= configuration->bcch_modificationPeriodCoeff_NB[CC_id];
= configuration->bcch_modificationPeriodCoeff_NB;
// PCCH-Config-NB-IoT-----------------------------------------------------------------
sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.defaultPagingCycle_r13
= configuration->pcch_defaultPagingCycle_NB[CC_id];
= configuration->pcch_defaultPagingCycle_NB;
sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.nB_r13 = configuration->pcch_nB_NB[CC_id];
sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.npdcch_NumRepetitionPaging_r13 = configuration-> pcch_npdcch_NumRepetitionPaging_NB[CC_id];
//NPRACH-Config-NB-IoT-----------------------------------------------------------------
sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13 = NULL;
sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_CP_Length_r13 = configuration->nprach_CP_Length[CC_id];
sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13 = NULL; /*OPTIONAL*/
/*OPTIONAL*/
// =CALLOC(1, sizeof(struct RSRP_ThresholdsNPRACH_InfoList_NB_r13)); //fatto uguale dopo
// rsrp_ThresholdsPrachInfoList = sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13;
// rsrp_range = configuration->nprach_rsrp_range_NB;
// ASN_SEQUENCE_ADD(&rsrp_ThresholdsPrachInfoList->list,rsrp_range);
nprach_parameters.nprach_Periodicity_r13 = configuration->nprach_Periodicity[CC_id];
nprach_parameters.nprach_StartTime_r13 = configuration->nprach_StartTime[CC_id];
nprach_parameters.nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[CC_id];
nprach_parameters.nprach_NumSubcarriers_r13= configuration->nprach_NumSubcarriers[CC_id];
nprach_parameters.nprach_SubcarrierMSG3_RangeStart_r13= configuration->nprach_SubcarrierMSG3_RangeStart[CC_id];
nprach_parameters.maxNumPreambleAttemptCE_r13= configuration->maxNumPreambleAttemptCE_NB[CC_id];
nprach_parameters.numRepetitionsPerPreambleAttempt_r13 = configuration->numRepetitionsPerPreambleAttempt_NB[CC_id];
nprach_parameters.npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[CC_id];
nprach_parameters.npdcch_StartSF_CSS_RA_r13= configuration->npdcch_StartSF_CSS_RA[CC_id];
nprach_parameters.npdcch_Offset_RA_r13= configuration->npdcch_Offset_RA[CC_id];
// According configuration to set the 3 CE level configuration setting, for the initial testing, only consider the CE 0, since there is only one set of parameters.
nprach_parameters[0].nprach_Periodicity_r13 = configuration->nprach_Periodicity[CC_id];
nprach_parameters[0].nprach_StartTime_r13 = configuration->nprach_StartTime[CC_id];
nprach_parameters[0].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[CC_id];
nprach_parameters[0].nprach_NumSubcarriers_r13 = configuration->nprach_NumSubcarriers[CC_id];
nprach_parameters[0].numRepetitionsPerPreambleAttempt_r13 = configuration->numRepetitionsPerPreambleAttempt_NB[CC_id];
nprach_parameters[0].nprach_SubcarrierMSG3_RangeStart_r13 = configuration->nprach_SubcarrierMSG3_RangeStart[CC_id];
nprach_parameters[0].maxNumPreambleAttemptCE_r13 = configuration->maxNumPreambleAttemptCE_NB[CC_id];
nprach_parameters[0].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[CC_id];
nprach_parameters[0].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[CC_id];
nprach_parameters[0].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[CC_id];
nprach_parameters[1].nprach_Periodicity_r13 = configuration->nprach_Periodicity[CC_id];
nprach_parameters[1].nprach_StartTime_r13 = configuration->nprach_StartTime[CC_id];
nprach_parameters[1].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[CC_id];
nprach_parameters[1].nprach_NumSubcarriers_r13 = configuration->nprach_NumSubcarriers[1];
nprach_parameters[1].numRepetitionsPerPreambleAttempt_r13 = configuration->numRepetitionsPerPreambleAttempt_NB[CC_id];
nprach_parameters[1].nprach_SubcarrierMSG3_RangeStart_r13 = configuration->nprach_SubcarrierMSG3_RangeStart[CC_id];
nprach_parameters[1].maxNumPreambleAttemptCE_r13 = configuration->maxNumPreambleAttemptCE_NB[CC_id];
nprach_parameters[1].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[CC_id];
nprach_parameters[1].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[CC_id];
nprach_parameters[1].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[CC_id];
nprach_parameters[2].nprach_Periodicity_r13 = configuration->nprach_Periodicity[CC_id];
nprach_parameters[2].nprach_StartTime_r13 = configuration->nprach_StartTime[CC_id];
nprach_parameters[2].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[CC_id];
nprach_parameters[2].nprach_NumSubcarriers_r13 = configuration->nprach_NumSubcarriers[CC_id];
nprach_parameters[2].numRepetitionsPerPreambleAttempt_r13 = configuration->numRepetitionsPerPreambleAttempt_NB[CC_id];
nprach_parameters[2].nprach_SubcarrierMSG3_RangeStart_r13 = configuration->nprach_SubcarrierMSG3_RangeStart[CC_id];
nprach_parameters[2].maxNumPreambleAttemptCE_r13 = configuration->maxNumPreambleAttemptCE_NB[CC_id];
nprach_parameters[2].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[CC_id];
nprach_parameters[2].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[CC_id];
nprach_parameters[2].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[CC_id];
//nprach_parameterList have a max size of 3 possible nprach configuration (see maxNPRACH_Resources_NB_r13)
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters);
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[0]);
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[1]);
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[2]);
// NPDSCH-Config NB-IOT
sib2_NB_IoT->radioResourceConfigCommon_r13.npdsch_ConfigCommon_r13.nrs_Power_r13= configuration->npdsch_nrs_Power[CC_id];
......@@ -540,7 +588,7 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
//NPUSCH-Config NB-IoT----------------------------------------------------------------
//list of size 3 (see maxNPRACH_Resources_NB_r13)
ack_nack_repetition = configuration-> npusch_ack_nack_numRepetitions_NB[CC_id]; //is an enumerative
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list,ack_nack_repetition);
ASN_SEQUENCE_ADD(&(sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list) ,&ack_nack_repetition);
*srs_SubframeConfig = configuration->npusch_srs_SubframeConfig_NB[CC_id];
sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.srs_SubframeConfig_r13= srs_SubframeConfig; /*OPTIONAL*/
......@@ -548,8 +596,8 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
/*OPTIONAL*/
dmrs_config = CALLOC(1,sizeof(struct NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13));
dmrs_config->threeTone_CyclicShift_r13 = configuration->npusch_threeTone_CyclicShift_r13[CC_id];
dmrs_config->sixTone_CyclicShift_r13 = configuration->npusch_sixTone_CyclicShift_r13[CC_id];
dmrs_config->threeTone_CyclicShift_r13 = configuration->npusch_threeTone_CyclicShift_r13;
dmrs_config->sixTone_CyclicShift_r13 = configuration->npusch_sixTone_CyclicShift_r13;
/*OPTIONAL
* -define the base sequence for a DMRS sequence in a cell with multi tone transmission (3,6,12) see TS 36.331 NPUSCH-Config-NB
......@@ -579,9 +627,9 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
// uplinkPowerControlCommon - NB-IoT------------------------------------------------------
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13 = configuration->npusch_p0_NominalNPUSCH;
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13 = configuration->deltaPreambleMsg3;
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.alpha_r13 = configuration->npusch_alpha;
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13 = configuration->npusch_p0_NominalNPUSCH[CC_id];
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13 = configuration->deltaPreambleMsg3[CC_id];
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.alpha_r13 = configuration->npusch_alpha[CC_id];
//no deltaFlist_PUCCH and no UL cyclic prefix
// UE Timers and Constants -NB-IoT--------------------------------------------------------
......@@ -604,7 +652,7 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
/// SIB3-NB-------------------------------------------------------
sib3_NB_IoT->cellReselectionInfoCommon_r13.q_Hyst_r13=SystemInformationBlockType3_NB_r13__cellReselectionInfoCommon_r13__q_Hyst_r13_dB4;
sib3_NB_IoT->cellReselectionServingFreqInfo_r13.s_NonIntraSearch_r13=NULL; //or define in configuration?
sib3_NB_IoT->cellReselectionServingFreqInfo_r13.s_NonIntraSearch_r13=0; //or define in configuration?
sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_RxLevMin_r13 = -70;
//new
......@@ -639,14 +687,14 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
(void*)bcch_message,
carrier->SIB23_NB_IoT,
900);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
// AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
// enc_rval.failed_type->name, enc_rval.encoded);
//#if defined(ENABLE_ITTI).....
#ifdef USER_MODE
LOG_D(RRC,"[eNB] SystemInformation-NB Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
LOG_D(RRC,"[NB-IoT] SystemInformation-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
if (enc_rval.encoded==-1) {
......@@ -654,6 +702,9 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
return(-1);
}
carrier->sib2_NB_IoT = sib2_NB_IoT;
carrier->sib3_NB_IoT = sib3_NB_IoT;
return((enc_rval.encoded+7)/8);
}
......
......@@ -65,7 +65,8 @@
uint8_t do_MIB_NB_IoT(
rrc_eNB_carrier_data_NB_IoT_t *carrier,
uint32_t N_RB_DL,
uint32_t frame);
uint32_t frame,
uint32_t hyper_frame);
/**
......
......@@ -39,7 +39,6 @@
#include "LogicalChannelConfig-NB-r13.h"
#include "LAYER2/MAC/defs_NB_IoT.h"
extern IF_Module_t *if_inst;
extern eNB_MAC_INST_NB_IoT *mac_inst;
......@@ -48,7 +47,6 @@ extern eNB_MAC_INST_NB_IoT *mac_inst;
extern UE_RRC_INST_NB_IoT *UE_rrc_inst_NB_IoT;
extern eNB_RRC_INST_NB_IoT *eNB_rrc_inst_NB_IoT;
extern PHY_Config_t *config_INFO;
extern rlc_info_t Rlc_info_am_NB_IoT,Rlc_info_am_config_NB_IoT;
extern uint8_t DRB2LCHAN_NB_IoT[2];
......
......@@ -37,6 +37,10 @@
#include "LAYER2/MAC/defs_NB_IoT.h"
/*NOTE: no static function should be declared in this header file (e.g. init_SI_NB)*/
uint8_t *get_NB_IoT_MIB(void);
void init_testing_NB_IoT(uint8_t Mod_id, int CC_id, rrc_eNB_carrier_data_NB_IoT_t *carrier, RrcConfigurationReq *configuration, uint32_t frame, uint32_t hyper_frame);
/*------------------------common_nb_iot.c----------------------------------------*/
/** \brief configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
......
......@@ -45,7 +45,7 @@
//#include "rrc_eNB_UE_context.h"
//#include "proto_NB_IoT.h"
#include "RRC/LITE/defs_NB_IoT.h"
#include "RRC/LITE/vars_NB_IoT.h"
//#include "RRC/LITE/vars_NB_IoT.h"
#ifdef LOCALIZATION
#include <sys/time.h>
......
......@@ -31,7 +31,15 @@
#define RRC_ENB_C
#include "defs.h"
// NB-IoT Section
#include "defs_NB_IoT.h"
#include "vars_NB_IoT.h"
#include "extern.h"
#include "extern_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
#include "RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h"
// NB-IoT end
#include "assertions.h"
#include "asn1_conversions.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
......@@ -111,6 +119,112 @@ extern uint16_t two_tier_hexagonal_cellIds[7];
mui_t rrc_eNB_mui = 0;
uint8_t *get_NB_IoT_MIB(void)
{
// CC_ID=0
return eNB_rrc_inst_NB_IoT->carrier[0].MIB_NB_IoT;
}
void init_testing_NB_IoT(uint8_t Mod_id, int CC_id, rrc_eNB_carrier_data_NB_IoT_t *carrier, RrcConfigurationReq *configuration, uint32_t frame, uint32_t hyper_frame)
{
//copy basic parameters
carrier[CC_id].physCellId = configuration->Nid_cell[CC_id];
carrier[CC_id].p_rx_eNB = 1;
carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; //DL Cyclic prefix
carrier[CC_id].Ncp_UL = configuration->prefix_type_UL[CC_id];//UL cyclic prefix
carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id];
carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id];
//TODO: verify who allocate memory for sib1_NB_IoT, sib2_NB_IoT, sib3_NB and mib_nb in the carrier before being passed as parameter
carrier[CC_id].sizeof_SIB1_NB_IoT = 0;
carrier[CC_id].sizeof_SIB23_NB_IoT = 0;
carrier[CC_id].sizeof_MIB_NB_IoT = 0;
//MIB
carrier[CC_id].MIB_NB_IoT = (uint8_t*) malloc16(32); //MIB is 34 bits=5bytes needed
if (carrier[CC_id].MIB_NB_IoT)
{
carrier[CC_id].sizeof_MIB_NB_IoT =
do_MIB_NB_IoT(carrier,
configuration->N_RB_DL[CC_id],
0, //frame
0// hyper sfn
);
}
else {
LOG_E(RRC, " init_SI: FATAL, no memory for MIB_NB_IoT allocated\n");
//exit here
}
if (carrier[CC_id].sizeof_MIB_NB_IoT == 255) {
// exit here
}
//SIB1_NB_IoT
carrier[CC_id].SIB1_NB_IoT = (uint8_t*) malloc16(32);//allocation of buffer memory for SIB1_NB_IOT
if (carrier[CC_id].SIB1_NB_IoT)
carrier[CC_id].sizeof_SIB1_NB_IoT = do_SIB1_NB_IoT( //follow the new implementation
Mod_id,
CC_id,
carrier,
configuration,
0 //FIXME is correct to pass frame = 0??
);
else {
LOG_E(RRC, " init_SI: FATAL, no memory for SIB1_NB_IoT allocated\n");
//exit here
}
if (carrier[CC_id].sizeof_SIB1_NB_IoT == 255) {
//exit here
}
//SIB23_NB_IoT
carrier[CC_id].SIB23_NB_IoT = (uint8_t*) malloc16(64);
if (carrier[CC_id].SIB23_NB_IoT) {
carrier[CC_id].sizeof_SIB23_NB_IoT = do_SIB23_NB_IoT(
Mod_id,
CC_id,
carrier,
configuration
);
if (carrier[CC_id].sizeof_SIB23_NB_IoT == 255) {
//exit here
}
//Configure MAC
rrc_mac_config_req_NB_IoT(Mod_id,
CC_id,
0,
carrier,
(SystemInformationBlockType1_NB_t*) carrier[CC_id].sib1_NB_IoT,
(RadioResourceConfigCommonSIB_NB_r13_t *) &carrier[CC_id].sib2_NB_IoT->radioResourceConfigCommon_r13,
(struct PhysicalConfigDedicated_NB_r13 *)NULL,
(struct LogicalChannelConfig_NB_r13 *)NULL,
0,
0
);
} else {
LOG_E(RRC, " init_SI: FATAL, no memory for SIB23_NB_IoT allocated\n");
//exit here
}
}
//-----------------------------------------------------------------------------
static void
init_SI(
......@@ -129,6 +243,14 @@ init_SI(
int i;
#endif
/*Nick Start*/
// for NB-IoT Initialization configuration testing
if(eNB_rrc_inst_NB_IoT==NULL)
eNB_rrc_inst_NB_IoT = (eNB_RRC_INST_NB_IoT*) malloc (sizeof(eNB_RRC_INST_NB_IoT));
init_testing_NB_IoT(ctxt_pP->module_id,CC_id,&eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id],configuration,0,0);
/*Here will copy basic parameters and implement do_MIB, rrc_eNB_carrier_data_t will add some parameters in MIB*/
eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1 = 0;
......
......@@ -1599,7 +1599,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB_IoT(const protocol_
/*-----------------CONFIGURATION-------------------*/
/*
//-----------------------------------------------------------------------------
static void init_SI_NB_IoT(
const protocol_ctxt_t* const ctxt_pP,
......@@ -1608,9 +1608,7 @@ static void init_SI_NB_IoT(
)
//-----------------------------------------------------------------------------
{
/*WE should allocate memory for PHY_Config structure
* is declared in vars_nb_iot.c and put also in the extern_nb_iot
* */
config_INFO = malloc(sizeof(PHY_Config_t));
......@@ -1639,7 +1637,8 @@ static void init_SI_NB_IoT(
eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id].sizeof_MIB_NB_IoT =
do_MIB_NB_IoT(&eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id],
configuration->N_RB_DL[CC_id],
0 //FIXME is correct to pass frame = 0??
0, //FIXME is correct to pass frame = 0??
0
);
}
else {
......@@ -1693,7 +1692,7 @@ static void init_SI_NB_IoT(
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
/*FIXME: decide which parameter to show....*/
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" TODO: some parameter of SIB23-NB to show\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
......@@ -1729,7 +1728,7 @@ static void init_SI_NB_IoT(
//exit here
}
}
*/
//-----------------------------------------------------------------------------
//aka openair_rrc_eNB_init
char openair_rrc_eNB_configuration_NB_IoT(
......@@ -1780,7 +1779,7 @@ while ( eNB_rrc_inst_NB_IoT == NULL ) {
//init SI
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
init_SI_NB_IoT(&ctxt, CC_id,configuration);
//init_SI_NB_IoT(&ctxt, CC_id,configuration);
}
/*New implementation Raymond*/
......
......@@ -71,8 +71,6 @@ unsigned short Data_to_read;
eNB_RRC_INST_NB_IoT *eNB_rrc_inst_NB_IoT;
uint8_t DRB2LCHAN_NB_IoT[2];//max can be 2 DRBs for NB_IoT --> it used for saving the LCID of DRBs
//structure for FAPI-like configuration (memory for this is allocated in init_SI)
PHY_Config_t *config_INFO;
BOOLEAN_t logicalChannelSR_Prohibit = 1;
long priority =1;
......
......@@ -1914,10 +1914,7 @@ int main( int argc, char **argv ) {
int eMBMS_active=0;
if (node_function[0] <= NGFI_RAU_IF4p5) { // don't initialize L2 for RRU
// MP, Nick: Initialization of IF module for NB-IoT should be here
if_inst = malloc(sizeof(IF_Module_t));
LOG_I(PHY,"Allocate IF-Module for NB-IoT\n");
//---------------------------
......@@ -2042,9 +2039,9 @@ int main( int argc, char **argv ) {
} else {
#ifdef NB_IOT
printf("Initializing IF Module in PHY layer\n");
//printf("Initializing IF Module in PHY layer\n");
//register function
IF_Module_init_L1();
//IF_Module_init_L1();
#endif
printf("Initializing eNB threads\n");
......
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