Commit aaf5aa3f authored by Nick Ho's avatar Nick Ho

clean code at MAC and RRC layer

parent 22ddb6be
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
/*! \file config_NB_IoT.c /*! \file config_NB_IoT.c
* \brief configuration primitives between RRC and MAC * \brief configuration primitives between RRC and MAC
* \author NTUST BMW Lab./ * \author NTUST BMW Lab./
* \date 2017 * \date 2019
* \email: * \email:
* \version 1.0 * \version 2.0
* *
*/ */
...@@ -17,24 +17,22 @@ ...@@ -17,24 +17,22 @@
//#include "SIB-Type-NB-r13.h" //#include "SIB-Type-NB-r13.h"
typedef struct eutra_bandentry_NB_s { typedef struct eutra_bandentry_NB_s {
//this should be the colum order of the table below //this should be the colum order of the table below (eutra_bandtable)
int16_t band; int16_t band;
uint32_t ul_min; uint32_t ul_min;
uint32_t ul_max; uint32_t ul_max;
uint32_t dl_min; uint32_t dl_min;
uint32_t dl_max; uint32_t dl_max;
uint32_t N_OFFs_DL; uint32_t N_OFFs_DL;
} eutra_bandentry_NB_IoT_t; } eutra_bandentry_NB_IoT_t;
typedef struct band_info_s { typedef struct band_info_s {
int nbands;
int nbands; eutra_bandentry_NB_IoT_t band_info[100];
eutra_bandentry_NB_IoT_t band_info[100];
} band_info_t; } band_info_t;
static const eutra_bandentry_NB_IoT_t eutra_bandtable[] = {
//[BAND] [FUL_low] [FUL_hi] [FDL_low] [FDL_hig] [NOFF_DL] //[BAND] [FUL_low] [FUL_hi] [FDL_low] [FDL_hig] [NOFF_DL]
static const eutra_bandentry_NB_IoT_t eutra_bandtable[] = {
{ 1, 19200, 19800, 21100, 21700, 0}, { 1, 19200, 19800, 21100, 21700, 0},
{ 2, 18500, 19100, 19300, 19900, 6000}, { 2, 18500, 19100, 19300, 19900, 6000},
{ 3, 17100, 17850, 18050, 18800, 12000}, { 3, 17100, 17850, 18050, 18800, 12000},
...@@ -54,16 +52,14 @@ static const eutra_bandentry_NB_IoT_t eutra_bandtable[] = { ...@@ -54,16 +52,14 @@ static const eutra_bandentry_NB_IoT_t eutra_bandtable[] = {
{66, 17100, 18000, 21100, 22000, 664360}, {66, 17100, 18000, 21100, 22000, 664360},
{70, 16950 , 17100, 19950, 20200, 683360}}; //may not used for Rel.13 equipment {70, 16950 , 17100, 19950, 20200, 683360}}; //may not used for Rel.13 equipment
//this function is used in phy_config_mib_NB for getting the DL Carrier Frequency from the EARFCN //used for getting the DL Carrier Frequency from the EARFCN
uint32_t from_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_earfcn, float m_dl) { uint32_t from_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_earfcn, float m_dl) {
int i; int i;
// float m_dl = 0; //for the moment we fix but maybe should be dynamic (anyway the 0 works for any case)
// float m_dl = 0; //for the moment we fix but maybe should be dynamic (anyway the 0 works for any case)
AssertFatal(eutra_bandP <= 70,"eutra_band %d > 70\n",eutra_bandP); AssertFatal(eutra_bandP <= 70,"eutra_band %d > 70\n",eutra_bandP);
for (i=0;i<= 70 && eutra_bandtable[i].band!=eutra_bandP;i++); for (i=0;i<= 70 && eutra_bandtable[i].band!=eutra_bandP;i++);
// this function is given by TS 36.104 Release 13.2 CH 5.7.3
return(eutra_bandtable[i].dl_min + 0.0025*(2*m_dl+1)+(dl_earfcn-(eutra_bandtable[i].N_OFFs_DL/10)))*100000; return(eutra_bandtable[i].dl_min + 0.0025*(2*m_dl+1)+(dl_earfcn-(eutra_bandtable[i].N_OFFs_DL/10)))*100000;
} }
...@@ -85,12 +81,6 @@ uint32_t to_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_CarrierFreq, float m_dl) { ...@@ -85,12 +81,6 @@ uint32_t to_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_CarrierFreq, float m_dl) {
"Band %d : DL carrier frequency %u Hz < %u\n", "Band %d : DL carrier frequency %u Hz < %u\n",
eutra_bandP,dl_CarrierFreq,eutra_bandtable[i].dl_min); eutra_bandP,dl_CarrierFreq,eutra_bandtable[i].dl_min);
//I would say that for sure the EUTRA band is larger that 1 PRB for NB-IoT so this check may is unuseful
// AssertFatal(dl_CarrierFreq_by_100k<=(eutra_bandtable[i].dl_max-bw_by_100),
// "Band %d, bw %u: DL carrier frequency %u Hz > %d\n",
// eutra_bandP,bw,dl_CarrierFreq,eutra_bandtable[i].dl_max-bw_by_100);
//based on formula TS 36.101 5.7.3F //based on formula TS 36.101 5.7.3F
return(dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min - 0.0025*(2*m_dl+ 1)+ (eutra_bandtable[i].N_OFFs_DL/10)); return(dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min - 0.0025*(2*m_dl+ 1)+ (eutra_bandtable[i].N_OFFs_DL/10));
} }
...@@ -123,7 +113,7 @@ void config_mib_fapi_NB_IoT(int physCellId, ...@@ -123,7 +113,7 @@ void config_mib_fapi_NB_IoT(int physCellId,
switch (mib_NB_IoT->message.operationModeInfo_r13.present) switch (mib_NB_IoT->message.operationModeInfo_r13.present)
{ {
//FAPI specs pag 135 //FAPI specs pag 135
case MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13: case MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13:
cfg->nb_iot_config.operating_mode.value = 0; cfg->nb_iot_config.operating_mode.value = 0;
...@@ -131,36 +121,28 @@ void config_mib_fapi_NB_IoT(int physCellId, ...@@ -131,36 +121,28 @@ void config_mib_fapi_NB_IoT(int physCellId,
cfg->nb_iot_config.assumed_crs_aps.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
if(eutraControlRegionSize == NULL) if(eutraControlRegionSize == NULL)
LOG_E(RRC, "rrc_mac_config_req_eNB_NB_IoT: operation mode is in-band but eutraControlRegionSize is not defined\n"); LOG_E(RRC, "rrc_mac_config_req_eNB_NB_IoT: operation mode is in-band but eutraControlRegionSize is not defined\n");
else else
cfg->nb_iot_config.control_region_size.value = *eutraControlRegionSize; cfg->nb_iot_config.control_region_size.value = *eutraControlRegionSize;
//m_dl = NB_Category_Offset_anchor[rand()%4];
break; break;
case MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_DifferentPCI_r13: case MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_DifferentPCI_r13:
cfg->nb_iot_config.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 //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)
//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; 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) if(eutraControlRegionSize == NULL)
LOG_E(RRC, "rrc_mac_config_req_eNB_NB_IoT: operation mode is in-band but eutraControlRegionSize is not defined\n"); LOG_E(RRC, "rrc_mac_config_req_eNB_NB_IoT: operation mode is in-band but eutraControlRegionSize is not defined\n");
else else
cfg->nb_iot_config.control_region_size.value = *eutraControlRegionSize; cfg->nb_iot_config.control_region_size.value = *eutraControlRegionSize;
break; break;
case MasterInformationBlock_NB__operationModeInfo_r13_PR_guardband_r13: case MasterInformationBlock_NB__operationModeInfo_r13_PR_guardband_r13:
cfg->nb_iot_config.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)
//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.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 cfg->nb_iot_config.assumed_crs_aps.value = -1; //is not defined so we put a negative value
...@@ -190,19 +172,19 @@ void config_sib2_fapi_NB_IoT( ...@@ -190,19 +172,19 @@ void config_sib2_fapi_NB_IoT(
nfapi_config_request_t *cfg = &mac_inst->config; nfapi_config_request_t *cfg = &mac_inst->config;
/* /*
* Following the FAPI like approach: * Following the FAPI like approach:
* 1)fill the PHY_Config_t structure (PHY_INTERFACE/IF_Module_NB_IoT.h) * 1) fill the PHY_Config_t structure (PHY_INTERFACE/IF_Module_NB_IoT.h)
* 1.1) check for how many NPRACH resources has been set and enable the corresponding parameter * 1.1) check for how many NPRACH resources has been set and enable the corresponding parameter
* 1.2)fill the structure PHY_Config_t (shared structure of the IF_Module * 1.2) fill the structure PHY_Config_t (shared structure of the IF_Module
* 2)Call the PHY_config_req for trigger the NB_phy_config_sib2_eNB() * 2) Call the PHY_config_req for trigger the NB_phy_config_sib2_eNB()
*/ */
/*NPRACH Resources*/ /*NPRACH section*/
NPRACH_Parameters_NB_r13_t* nprach_parameter; NPRACH_Parameters_NB_r13_t* nprach_parameter;
cfg->nb_iot_config.nprach_config_0_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_1_enabled.value = 0;
cfg->nb_iot_config.nprach_config_2_enabled.value = 0; cfg->nb_iot_config.nprach_config_2_enabled.value = 0;
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) 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)
{ {
...@@ -214,16 +196,7 @@ void config_sib2_fapi_NB_IoT( ...@@ -214,16 +196,7 @@ void config_sib2_fapi_NB_IoT(
cfg->nb_iot_config.nprach_config_0_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_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_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
cfg->nb_iot_config.nprach_config_0_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13; cfg->nb_iot_config.nprach_config_0_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
/* //rsrp_ThresholdsPrachInfoList_r13 -> optional
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
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]; nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1];
cfg->nb_iot_config.nprach_config_1_enabled.value = 1; cfg->nb_iot_config.nprach_config_1_enabled.value = 1;
...@@ -233,17 +206,7 @@ void config_sib2_fapi_NB_IoT( ...@@ -233,17 +206,7 @@ void config_sib2_fapi_NB_IoT(
cfg->nb_iot_config.nprach_config_1_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_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_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
cfg->nb_iot_config.nprach_config_1_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13; cfg->nb_iot_config.nprach_config_1_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
//rsrp_ThresholdsPrachInfoList_r13 -> optional
/*
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
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]; nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2];
cfg->nb_iot_config.nprach_config_2_enabled.value = 1; cfg->nb_iot_config.nprach_config_2_enabled.value = 1;
...@@ -253,32 +216,21 @@ void config_sib2_fapi_NB_IoT( ...@@ -253,32 +216,21 @@ void config_sib2_fapi_NB_IoT(
cfg->nb_iot_config.nprach_config_2_subcarrier_offset.value = nprach_parameter->nprach_SubcarrierOffset_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_subcarriers.value = nprach_parameter->nprach_NumSubcarriers_r13;
cfg->nb_iot_config.nprach_config_2_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13; cfg->nb_iot_config.nprach_config_2_number_of_repetitions_per_attempt.value = nprach_parameter->numRepetitionsPerPreambleAttempt_r13;
//rsrp_ThresholdsPrachInfoList_r13 -> optional
/*
//MP: missed configuration for FAPI-style structure (I have added on my own byt maybe are not needed)
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*/
}else }else
{ {
LOG_E(MAC,"NPRACH Configuration isn't set properly\n"); LOG_E(MAC,"NPRACH Configuration isn't set properly\n");
} }
LOG_I(MAC,"Fill parameters of FAPI NPRACH done\n"); LOG_I(MAC,"Fill parameters of FAPI NPRACH done\n");
/*NPDSCH ConfigCommon*/ /*NPDSCH ConfigCommon*/
//FIXME: MP: FAPI specs define a range of value [0-255]==[0db - 63.75db] with 0.25db step -- corrispondence in 3GPP specs??? //FAPI specs define a range of value [0-255]==[0db - 63.75db] with 0.25db step -- corrispondence in Ts 36.213 CH 16.2.2
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*/ /*NPUSCH ConfigCommon*/
//a pointer to the first element of the list
// 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 */ if(radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13 != NULL)/* OPTIONAL */
{ {
...@@ -313,8 +265,6 @@ void config_sib2_fapi_NB_IoT( ...@@ -313,8 +265,6 @@ void config_sib2_fapi_NB_IoT(
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
//srs_SubframeConfig_r13 /* OPTIONAL */ //srs_SubframeConfig_r13 /* OPTIONAL */
/*DL GAP config */ /*DL GAP config */
...@@ -329,20 +279,14 @@ void config_sib2_fapi_NB_IoT( ...@@ -329,20 +279,14 @@ void config_sib2_fapi_NB_IoT(
cfg->nb_iot_config.dl_gap_config_enable.value = 0; cfg->nb_iot_config.dl_gap_config_enable.value = 0;
/*UL Power Control ConfigCommon*/ /*UL Power Control ConfigCommon*/
/* //nothing defined in FAPI specs
//nothing defined in FAPI specs
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*/ /*RACH Config Common*/
//nothing defined in FAPI specs //nothing defined in FAPI specs
} }
///-------------------------------------------Function---------------------------------------------/// // Called by init_testing_NB_IoT, configure and initiate NB-IoT MAC and PHY here
void rrc_mac_config_req_NB_IoT( void rrc_mac_config_req_NB_IoT(
module_id_t Mod_idP, module_id_t Mod_idP,
int CC_idP, int CC_idP,
...@@ -351,7 +295,7 @@ void rrc_mac_config_req_NB_IoT( ...@@ -351,7 +295,7 @@ void rrc_mac_config_req_NB_IoT(
SystemInformationBlockType1_NB_t *sib1_NB_IoT, SystemInformationBlockType1_NB_t *sib1_NB_IoT,
RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon, RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon,
PhysicalConfigDedicated_NB_r13_t *physicalConfigDedicated, PhysicalConfigDedicated_NB_r13_t *physicalConfigDedicated,
LogicalChannelConfig_NB_r13_t *logicalChannelConfig, //FIXME: decide how to use it LogicalChannelConfig_NB_r13_t *logicalChannelConfig,
uint8_t ded_flag, uint8_t ded_flag,
uint8_t ue_list_ded_num) uint8_t ue_list_ded_num)
{ {
...@@ -368,42 +312,28 @@ void rrc_mac_config_req_NB_IoT( ...@@ -368,42 +312,28 @@ void rrc_mac_config_req_NB_IoT(
if(ded_flag==0) if(ded_flag==0)
{ {
LOG_D(MAC,"Initiate config by system information\n");
}else }else
{ {
// now we only have 3 UE list USS for three CE levels // now we only have 3 UE list USS for three CE levels
// we fix value for RMAX to 8 / 16 / 32 // fix value for RMAX to 8 / 16 / 32
mac_config->npdcch_ConfigDedicated[ue_list_ded_num].R_max = 8 + 8*ue_list_ded_num; mac_config->npdcch_ConfigDedicated[ue_list_ded_num].R_max = 8 + 8*ue_list_ded_num;
// fix value for G to 8 / 4 / 2 // 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); 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 // fix a_offest to 0 / 0 / 0
mac_config->npdcch_ConfigDedicated[ue_list_ded_num].a_offset = 0; mac_config->npdcch_ConfigDedicated[ue_list_ded_num].a_offset = 0;
return;
return;
} }
if (&carrier->mib_NB_IoT != NULL)
{
if (&carrier->mib_NB_IoT != NULL){
/*printf(MAC,
"Configuring MIB for instance %d, CCid %d : (band %ld,Nid_cell %d,TX antenna port (p) %d,DL freq %u\n",
Mod_idP,
CC_idP,
sib1_NB_IoT->freqBandIndicator_r13,
carrier->physCellId,
carrier->p_eNB,
carrier->dl_CarrierFreq
);*/
/* /*
* Following the FAPI like approach: * Following the FAPI like approach:
* 1)fill the PHY_Config_t structure (PHY_INTERFACE/IF_Module_NB_IoT.h) * 1) fill the PHY_Config_t structure (PHY_INTERFACE/IF_Module_NB_IoT.h)
* 2)Call the PHY_config_req for trigger the NB_phy_config_mib_eNB() at the end * 2) Call the PHY_config_req for trigger the NB_phy_config_mib_eNB() at the end
*/ */
//Mapping OAI params into FAPI params //Mapping OAI params into FAPI params
config_mib_fapi_NB_IoT(carrier->physCellId, config_mib_fapi_NB_IoT(carrier->physCellId,
sib1_NB_IoT->freqBandIndicator_r13, sib1_NB_IoT->freqBandIndicator_r13,
carrier->Ncp, carrier->Ncp,
...@@ -415,11 +345,10 @@ void rrc_mac_config_req_NB_IoT( ...@@ -415,11 +345,10 @@ void rrc_mac_config_req_NB_IoT(
sib1_NB_IoT->eutraControlRegionSize_r13, sib1_NB_IoT->eutraControlRegionSize_r13,
&carrier->mib_NB_IoT &carrier->mib_NB_IoT
); );
}else
{
}else{ LOG_E(MAC,"carrier->mib_NB_IoT is NULL\n");
LOG_E(MAC,"carrier->mib_NB_IoT is NULL\n"); return;
return;
} }
if(sib1_NB_IoT != NULL) if(sib1_NB_IoT != NULL)
...@@ -445,78 +374,29 @@ void rrc_mac_config_req_NB_IoT( ...@@ -445,78 +374,29 @@ void rrc_mac_config_req_NB_IoT(
} }
}else }else
LOG_E(MAC,"SchedulinginfoSIB1 value not available!\n"); LOG_E(MAC,"SchedulinginfoSIB1 value not available!\n");
//printf("[ASN Debug] SI P: %ld\n",sib1_NB_IoT->schedulingInfoList_r13.list.array[0]->si_Periodicity_r13);
mac_config->si_window_length = ms160; mac_config->si_window_length = ms160;
///OAI only supports SIB2/3-NB for the system information
mac_config->sibs_NB_IoT_sched[0].si_periodicity = si_Periodicity_rf64 ;
mac_config->sibs_NB_IoT_sched[0].si_repetition_pattern = si_RepetitionPattern_every4thRF;
mac_config->sibs_NB_IoT_sched[0].sib_mapping_info = sib3_v;
mac_config->sibs_NB_IoT_sched[0].si_tb = si_TB_680;
LOG_D(MAC,"si_periodicity:%d, siw: %d, start rf: %d\n",mac_config->sibs_NB_IoT_sched[0].si_periodicity, mac_config->si_window_length,mac_config->sib1_NB_IoT_sched_config.starting_rf);
///OAI only supports SIB2/3-NB for the sibs }else
{
mac_config->sibs_NB_IoT_sched[0].si_periodicity = si_Periodicity_rf64 ; LOG_E(MAC,"sib1_NB_IoT is NULL\n");
mac_config->sibs_NB_IoT_sched[0].si_repetition_pattern = si_RepetitionPattern_every4thRF;
mac_config->sibs_NB_IoT_sched[0].sib_mapping_info = sib3_v;
mac_config->sibs_NB_IoT_sched[0].si_tb = si_TB_680;
LOG_I(MAC,"si_periodicity:%d, siw: %d, start rf: %d\n",mac_config->sibs_NB_IoT_sched[0].si_periodicity, mac_config->si_window_length,mac_config->sib1_NB_IoT_sched_config.starting_rf);
/*
/// 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;
}
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)
{
//LOG_I(MAC,"[CONFIG]SIB2/3-NB radioResourceConfigCommon Contents (partial)\n");
NPRACH_Parameters_NB_r13_t* nprach_parameter;
if (radioResourceConfigCommon!=NULL) { //CE level 0
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[0] != NULL)
//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"); {
// need to fix these array setting issue
//LOG_I(MAC,"[CONFIG]SIB2/3-NB radioResourceConfigCommon Contents (partial)\n");
//LOG_I(MAC,"[CONFIG]npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_CyclicShift_r13= %ld\n", radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->threeTone_CyclicShift_r13);
//LOG_I(MAC,"[CONFIG]npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_CyclicShift_r13= %ld\n", radioResourceConfigCommon->npusch_ConfigCommon_r13.dmrs_Config_r13->sixTone_CyclicShift_r13);
//LOG_I(MAC,"[CONFIG]npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13= %d\n", radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13);
//LOG_I(MAC,"[CONFIG]npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13= %ld\n", radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13);
NPRACH_Parameters_NB_r13_t* nprach_parameter;
///CE level 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]; 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); LOG_I(MAC,"NPRACH CE 0 setting: NumRepetition: %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 = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13]; mac_config->mac_NPRACH_ConfigSIB[0].mac_numRepetitionsPerPreambleAttempt_NB_IoT = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13];
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13]; mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13]; mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
...@@ -524,13 +404,13 @@ void rrc_mac_config_req_NB_IoT( ...@@ -524,13 +404,13 @@ void rrc_mac_config_req_NB_IoT(
mac_inst->npdcch_config_common[0].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13]; mac_inst->npdcch_config_common[0].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[0].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13]; mac_inst->npdcch_config_common[0].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[0].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13]; mac_inst->npdcch_config_common[0].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH 0 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[0].R_max,mac_inst->npdcch_config_common[0].G,mac_inst->npdcch_config_common[0].a_offset); LOG_I(MAC,"NPRACH CE 0 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[0].R_max,mac_inst->npdcch_config_common[0].G,mac_inst->npdcch_config_common[0].a_offset);
} }
///CE level 1 //CE level 1
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1] != NULL)
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1] != NULL) { {
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1]; 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); LOG_I(MAC,"NPRACH CE 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 = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13]; mac_config->mac_NPRACH_ConfigSIB[1].mac_numRepetitionsPerPreambleAttempt_NB_IoT = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13];
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13]; mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13]; mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
...@@ -538,12 +418,13 @@ void rrc_mac_config_req_NB_IoT( ...@@ -538,12 +418,13 @@ void rrc_mac_config_req_NB_IoT(
mac_inst->npdcch_config_common[1].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13]; mac_inst->npdcch_config_common[1].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[1].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13]; mac_inst->npdcch_config_common[1].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[1].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13]; mac_inst->npdcch_config_common[1].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH 1 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[1].R_max,mac_inst->npdcch_config_common[1].G,mac_inst->npdcch_config_common[1].a_offset); LOG_I(MAC,"NPRACH CE 1 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[1].R_max,mac_inst->npdcch_config_common[1].G,mac_inst->npdcch_config_common[1].a_offset);
} }
///CE level 2 //CE level 2
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2] != NULL) { if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2] != NULL)
{
nprach_parameter = radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2]; 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); LOG_I(MAC,"NPRACH CE 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 = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13]; mac_config->mac_NPRACH_ConfigSIB[2].mac_numRepetitionsPerPreambleAttempt_NB_IoT = rachrepeat[nprach_parameter->numRepetitionsPerPreambleAttempt_r13];
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13]; mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13]; mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
...@@ -551,21 +432,18 @@ void rrc_mac_config_req_NB_IoT( ...@@ -551,21 +432,18 @@ void rrc_mac_config_req_NB_IoT(
mac_inst->npdcch_config_common[2].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13]; mac_inst->npdcch_config_common[2].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[2].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13]; mac_inst->npdcch_config_common[2].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[2].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13]; mac_inst->npdcch_config_common[2].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH 2 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[2].R_max,mac_inst->npdcch_config_common[2].G,mac_inst->npdcch_config_common[2].a_offset); LOG_I(MAC,"NPRACH CE 2 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[2].R_max,mac_inst->npdcch_config_common[2].G,mac_inst->npdcch_config_common[2].a_offset);
} }
config_sib2_fapi_NB_IoT(carrier->physCellId,radioResourceConfigCommon); config_sib2_fapi_NB_IoT(carrier->physCellId,radioResourceConfigCommon);
}else{ }else
LOG_E(MAC,"radioResourceConfigCommon is NULL\n"); {
LOG_E(MAC,"radioResourceConfigCommon is NULL\n");
} }
if (logicalChannelConfig!= NULL) { if (logicalChannelConfig!= NULL) {
if (UE_id == -1) if (UE_id == -1)
{ {
LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
...@@ -579,84 +457,32 @@ void rrc_mac_config_req_NB_IoT( ...@@ -579,84 +457,32 @@ void rrc_mac_config_req_NB_IoT(
if (physicalConfigDedicated != NULL) { if (physicalConfigDedicated != NULL) {
if (UE_id == -1) if (UE_id == -1)
LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
else else
{ {
/* LOG_D(MAC,"UE id = %d\n",UE_id);
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
} }
} }
//LOG_I(MAC,"CP Length Checking %u\n",RC.nb_iot_mac[Mod_idP]->config.nb_iot_config.nprach_config_0_cp_length.value);
if(mac_inst->if_inst_NB_IoT!=NULL) if(mac_inst->if_inst_NB_IoT!=NULL)
{ {
if (radioResourceConfigCommon!=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"); 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; PHY_Config_NB_IoT_t phycfg;
phycfg.mod_id = Mod_idP; phycfg.mod_id = Mod_idP;
phycfg.cfg = &mac_inst->config; 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); 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");
}
//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(mac_inst, i);
LOG_I(MAC,"[NB-IoT] scheduler testing done %d\n",i);
} }
*/ }else
{
// RC.L1_NB_IoT[Mod_idP]->configured=1; LOG_E(MAC,"NB-IoT IF INST is NULL, need to fix\n");
/*if( ded_flag!=0 )
{
mac_config->npdcch_ConfigDedicated[0].R_max =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[0].npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13;
mac_config->npdcch_ConfigDedicated[1].R_max =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[1].npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13;
mac_config->npdcch_ConfigDedicated[2].R_max =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[2].npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13;
mac_config->npdcch_ConfigDedicated[0].G =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[0].npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
mac_config->npdcch_ConfigDedicated[1].G =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[1].npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
mac_config->npdcch_ConfigDedicated[2].G =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[2].npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
mac_config->npdcch_ConfigDedicated[0].a_offset =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[0].npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
mac_config->npdcch_ConfigDedicated[1].a_offset =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[1].npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
mac_config->npdcch_ConfigDedicated[2].a_offset =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[2].npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
// now we only have 3 UE list USS
mac_config->npdcch_ConfigDedicated[ue_list_ded_num].R_max =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[ue_list_ded_num].npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13;
mac_config->npdcch_ConfigDedicated[ue_list_ded_num].G =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[ue_list_ded_num].npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13;
mac_config->npdcch_ConfigDedicated[ue_list_ded_num].a_offset =DED_Config.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13[ue_list_ded_num].npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13;
} }
init_mac_NB_IoT(mac_inst);
return 0;*/ LOG_I(MAC,"[NB-IoT] Init_MAC done\n");
} }
...@@ -2,17 +2,15 @@ ...@@ -2,17 +2,15 @@
/*! \file config_NB_IoT.h /*! \file config_NB_IoT.h
* \brief configured structures used by scheduler * \brief configured structures used by scheduler
* \author NTUST BMW Lab./ * \author NTUST BMW Lab./
* \date 2017 * \date 2019
* \email: * \email:
* \version 1.0 * \version 2.0
* *
*/ */
#ifndef _CONFIG_H_ #ifndef _CONFIG_H_
#define _CONFIG_H_ #define _CONFIG_H_
//#include "NB_IoT_Message_definitions.h"
#define NUMBER_OF_SIBS_MAX_NB_IoT 6 #define NUMBER_OF_SIBS_MAX_NB_IoT 6
///MIB ///MIB
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/*! \file defs_NB_IoT.c /*! \file defs_NB_IoT.c
* \brief MAC layer structures * \brief MAC layer structures
* \author NTUST BMW Lab./Nick HO, Xavier LIU, Calvin HSU * \author NTUST BMW Lab./Nick HO, Xavier LIU, Calvin HSU
* \date 2017 - 2018 * \date 2017 - 2019
* \email: nick133371@gmail.com, sephiroth7277@gmail.com , kai-hsiang.hsu@eurecom.fr * \email: nick133371@gmail.com, sephiroth7277@gmail.com , kai-hsiang.hsu@eurecom.fr
* \version 1.0 * \version 1.0
* *
...@@ -150,33 +150,6 @@ typedef enum{ ...@@ -150,33 +150,6 @@ typedef enum{
/*Index of PADDING logical channel*/ /*Index of PADDING logical channel*/
#define PADDING 31 #define PADDING 31
/// NPRACH-ParametersList-NB_IoT-r13 from 36.331 RRC spec defined in PHY
/*typedef struct NPRACH_Parameters_NB_IoT{
/// the period time for nprach
int nprach_Periodicity;
/// for the start time for the NPRACH resource from 40ms-2560ms
int nprach_StartTime;
/// for the subcarrier of set to the NPRACH preamble from n0 - n34
int nprach_SubcarrierOffset;
///number of subcarriers in a NPRACH resource allowed values (n12,n24,n36,n48)
int nprach_NumSubcarriers;
/// where is the region that in NPRACH resource to indicate if this UE support MSG3 for multi-tone or not. from 0 - 1
int nprach_SubcarrierMSG3_RangeStart;
/// The max preamble transmission attempt for the CE level from 1 - 128
int maxNumPreambleAttemptCE;
/// Number of NPRACH repetitions per attempt for each NPRACH resource
int numRepetitionsPerPreambleAttempt;
/// The number of the repetition for DCI use in RAR/MSG3/MSG4 from 1 - 2048 (Rmax)
int npdcch_NumRepetitions_RA;
/// Starting subframe for NPDCCH Common searching space for (RAR/MSG3/MSG4)
int npdcch_StartSF_CSS_RA;
/// Fractional period offset of starting subframe for NPDCCH common search space
int npdcch_Offset_RA;
} nprach_parameters_NB_IoT_t;*/
/*! \brief Downlink SCH PDU Structure */ /*! \brief Downlink SCH PDU Structure */
typedef struct { typedef struct {
uint8_t payload[SCH_PAYLOAD_SIZE_MAX_NB_IoT]; uint8_t payload[SCH_PAYLOAD_SIZE_MAX_NB_IoT];
...@@ -238,22 +211,23 @@ typedef struct { ...@@ -238,22 +211,23 @@ typedef struct {
} UE_TEMPLATE_NB_IoT; } UE_TEMPLATE_NB_IoT;
// link list of uplink resource node
typedef struct available_resource_UL_s{ typedef struct available_resource_UL_s{
///Resource start subframe
///Resource start subframe uint32_t start_subframe;
uint32_t start_subframe; ///Resource end subframe
///Resource end subframe uint32_t end_subframe;
uint32_t end_subframe; //pointer to next and previous node
// pointer to next node struct available_resource_UL_s *next, *prev;
struct available_resource_UL_s *next, *prev;
}available_resource_UL_t; }available_resource_UL_t;
// link list of downlink resource node
typedef struct available_resource_DL_s{ typedef struct available_resource_DL_s{
///Resource start subframe
uint32_t start_subframe; uint32_t start_subframe;
///Resource end subframe
uint32_t end_subframe; uint32_t end_subframe;
//uint32_t DLSF_num; //pointer to next and previous node
struct available_resource_DL_s *next, *prev; struct available_resource_DL_s *next, *prev;
}available_resource_DL_t; }available_resource_DL_t;
...@@ -271,13 +245,10 @@ typedef struct{ ...@@ -271,13 +245,10 @@ typedef struct{
/*Structure used for UL scheduling*/ /*Structure used for UL scheduling*/
typedef struct{ typedef struct{
//resource position info. //resource position info, used subframe as unit
uint32_t sf_end, sf_start; uint32_t sf_end, sf_start;
//resource position info. separate by HyperSF, Frame, Subframe
//uint32_t start_h, end_h; // information for allocating the resource (to fill DCIN)
//uint32_t start_f, end_f;
//uint32_t start_sf, end_sf;
// information for allocating the resource
int tone; int tone;
int scheduling_delay; int scheduling_delay;
int subcarrier_indication; int subcarrier_indication;
...@@ -285,7 +256,6 @@ typedef struct{ ...@@ -285,7 +256,6 @@ typedef struct{
available_resource_UL_t *node; available_resource_UL_t *node;
}sched_temp_UL_NB_IoT_t; }sched_temp_UL_NB_IoT_t;
/******Update******/
/*** the value of variable in this structure is able to be changed in Preprocessor**/ /*** the value of variable in this structure is able to be changed in Preprocessor**/
typedef struct{ typedef struct{
...@@ -333,7 +303,6 @@ typedef struct{ ...@@ -333,7 +303,6 @@ typedef struct{
uint8_t flag_schedule_success; uint8_t flag_schedule_success;
}UE_SCHED_CTRL_NB_IoT_t; }UE_SCHED_CTRL_NB_IoT_t;
/*36331 NPDCCH-ConfigDedicated-NB_IoT*/ /*36331 NPDCCH-ConfigDedicated-NB_IoT*/
typedef struct{ typedef struct{
//npdcch-NumRepetitions-r13 //npdcch-NumRepetitions-r13
...@@ -369,9 +338,8 @@ typedef struct { ...@@ -369,9 +338,8 @@ typedef struct {
} UE_list_NB_IoT_t; } UE_list_NB_IoT_t;
// scheduling flag calculated by computing flag function
typedef struct{ typedef struct{
// flag to indicate scheduing MIB-NB_IoT // flag to indicate scheduing MIB-NB_IoT
uint8_t flag_MIB; uint8_t flag_MIB;
// flag to indicate scheduling SIB1-NB_IoT // flag to indicate scheduling SIB1-NB_IoT
...@@ -392,7 +360,6 @@ typedef struct{ ...@@ -392,7 +360,6 @@ typedef struct{
uint8_t num_type1_css_run; uint8_t num_type1_css_run;
// number of the uss to schedule in this period // number of the uss to schedule in this period
uint8_t num_uss_run; uint8_t num_uss_run;
}scheduling_flag_t; }scheduling_flag_t;
/*!\brief MAC subheader short with 7bit Length field */ /*!\brief MAC subheader short with 7bit Length field */
...@@ -404,6 +371,7 @@ typedef struct { ...@@ -404,6 +371,7 @@ typedef struct {
uint8_t L:7; // octet 2 LSB uint8_t L:7; // octet 2 LSB
uint8_t F:1; // octet 2 MSB uint8_t F:1; // octet 2 MSB
} __attribute__((__packed__))SCH_SUBHEADER_SHORT_NB_IoT; } __attribute__((__packed__))SCH_SUBHEADER_SHORT_NB_IoT;
typedef struct { typedef struct {
uint8_t LCID:5; // octet 1 LSB uint8_t LCID:5; // octet 1 LSB
uint8_t E:1; uint8_t E:1;
...@@ -413,6 +381,7 @@ typedef struct { ...@@ -413,6 +381,7 @@ typedef struct {
uint8_t F:1; // octet 2 MSB uint8_t F:1; // octet 2 MSB
uint8_t L_LSB:8; uint8_t L_LSB:8;
} __attribute__((__packed__))SCH_SUBHEADER_LONG_NB_IoT; } __attribute__((__packed__))SCH_SUBHEADER_LONG_NB_IoT;
typedef struct { typedef struct {
uint8_t LCID:5; // octet 1 LSB uint8_t LCID:5; // octet 1 LSB
uint8_t E:1; uint8_t E:1;
...@@ -421,6 +390,7 @@ typedef struct { ...@@ -421,6 +390,7 @@ typedef struct {
uint8_t L_MSB:8; // octet 2 MSB uint8_t L_MSB:8; // octet 2 MSB
uint8_t L_LSB:8; uint8_t L_LSB:8;
} __attribute__((__packed__))SCH_SUBHEADER_LONG_EXTEND_NB_IoT; } __attribute__((__packed__))SCH_SUBHEADER_LONG_EXTEND_NB_IoT;
/*!\brief MAC subheader short without length field */ /*!\brief MAC subheader short without length field */
typedef struct { typedef struct {
uint8_t LCID:5; uint8_t LCID:5;
...@@ -447,22 +417,22 @@ typedef struct { ...@@ -447,22 +417,22 @@ typedef struct {
} __attribute__((__packed__))RA_HEADER_RAPID_NB_IoT; } __attribute__((__packed__))RA_HEADER_RAPID_NB_IoT;
typedef struct Available_available_resource_DL{ typedef struct Available_resource_tones_UL_s{
///Available Resoruce for sixtone ///Available Resoruce for sixtone
available_resource_UL_t *sixtone_Head;//, *sixtone_npusch_frame; available_resource_UL_t *sixtone_Head;//, *sixtone_npusch_frame;
uint32_t sixtone_end_subframe; uint32_t sixtone_end_subframe;
///Available Resoruce for threetone ///Available Resoruce for threetone
available_resource_UL_t *threetone_Head;//, *threetone_npusch_frame; available_resource_UL_t *threetone_Head;//, *threetone_npusch_frame;
uint32_t threetone_end_subframe; uint32_t threetone_end_subframe;
///Available Resoruce for singletone1 ///Available Resoruce for singletone1
available_resource_UL_t *singletone1_Head;//, *singletone1_npusch_frame; available_resource_UL_t *singletone1_Head;//, *singletone1_npusch_frame;
uint32_t singletone1_end_subframe; uint32_t singletone1_end_subframe;
///Available Resoruce for singletone2 ///Available Resoruce for singletone2
available_resource_UL_t *singletone2_Head;//, *singletone2_npusch_frame; available_resource_UL_t *singletone2_Head;//, *singletone2_npusch_frame;
uint32_t singletone2_end_subframe; uint32_t singletone2_end_subframe;
///Available Resoruce for singletone3 ///Available Resoruce for singletone3
available_resource_UL_t *singletone3_Head;//, *singletone3_npusch_frame; available_resource_UL_t *singletone3_Head;//, *singletone3_npusch_frame;
uint32_t singletone3_end_subframe; uint32_t singletone3_end_subframe;
}available_resource_tones_UL_t; }available_resource_tones_UL_t;
...@@ -500,9 +470,8 @@ typedef struct schedule_result{ ...@@ -500,9 +470,8 @@ typedef struct schedule_result{
int16_t dl_sdly; int16_t dl_sdly;
int16_t ul_sdly; int16_t ul_sdly;
int16_t num_sf; int16_t num_sf;
//-----clare
int16_t harq_round; int16_t harq_round;
//-----clare
}schedule_result_t; }schedule_result_t;
......
...@@ -50,7 +50,6 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t ...@@ -50,7 +50,6 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
*common_flags |= flag_sib1; *common_flags |= flag_sib1;
} }
/* uint32_t type2_css_pp[3] = { type2_css_info[0]->npdcch_NumRepetitions_RA_r13*type2_css_info[0]->npdcch_StartSF_CSS_RA_r13, type2_css_info[1]->npdcch_NumRepetitions_RA_r13*type2_css_info[1]->npdcch_StartSF_CSS_RA_r13, type2_css_info[2]->npdcch_NumRepetitions_RA_r13*type2_css_info[2]->npdcch_StartSF_CSS_RA_r13 };*/
uint32_t type2_css_pp[3] = { mac_inst->npdcch_config_common[0].R_max*mac_inst->npdcch_config_common[0].G, uint32_t type2_css_pp[3] = { mac_inst->npdcch_config_common[0].R_max*mac_inst->npdcch_config_common[0].G,
mac_inst->npdcch_config_common[1].R_max*mac_inst->npdcch_config_common[1].G, mac_inst->npdcch_config_common[1].R_max*mac_inst->npdcch_config_common[1].G,
mac_inst->npdcch_config_common[2].R_max*mac_inst->npdcch_config_common[2].G }; mac_inst->npdcch_config_common[2].R_max*mac_inst->npdcch_config_common[2].G };
......
...@@ -246,11 +246,10 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){ ...@@ -246,11 +246,10 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
dci_result->R_harq = 0; dci_result->R_harq = 0;
dci_result->next = (schedule_result_t *)0; dci_result->next = (schedule_result_t *)0;
dci_result->DCI_pdu = (void *)dci_n1_rar; dci_result->DCI_pdu = (void *)dci_n1_rar;
//----------clare
dci_result->dl_sdly = msg2_subframe - dci_end_subframe; dci_result->dl_sdly = msg2_subframe - dci_end_subframe;
dci_result->ul_sdly = msg3_subframe - msg2_end_subframe; dci_result->ul_sdly = msg3_subframe - msg2_end_subframe;
dci_result->num_sf = msg2_end_subframe - msg2_subframe+1; dci_result->num_sf = msg2_end_subframe - msg2_subframe+1;
//----------clare
// for msg2 // for msg2
msg2_result->output_subframe = msg2_first_subframe;//msg2_subframe; msg2_result->output_subframe = msg2_first_subframe;//msg2_subframe;
msg2_result->end_subframe = msg2_end_subframe; msg2_result->end_subframe = msg2_end_subframe;
...@@ -266,10 +265,8 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){ ...@@ -266,10 +265,8 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
msg2_result->next = (schedule_result_t *)0; msg2_result->next = (schedule_result_t *)0;
msg2_result->DCI_pdu = (void *)dci_n1_rar; msg2_result->DCI_pdu = (void *)dci_n1_rar;
msg2_result->rar_buffer = msg2_nodes->rar_buffer; msg2_result->rar_buffer = msg2_nodes->rar_buffer;
//----------clare
msg2_result->dl_sdly = -1; msg2_result->dl_sdly = -1;
msg2_result->ul_sdly = -1; msg2_result->ul_sdly = -1;
//----------clare
// for msg3(fake DCI N0) // for msg3(fake DCI N0)
dci_n0->type = 0; dci_n0->type = 0;
...@@ -841,12 +838,10 @@ void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){ ...@@ -841,12 +838,10 @@ void schedule_msg4_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
dci_result->R_harq = 0; dci_result->R_harq = 0;
dci_result->next = (schedule_result_t *)0; dci_result->next = (schedule_result_t *)0;
dci_result->DCI_pdu = (void *)dci_n1_msg4; dci_result->DCI_pdu = (void *)dci_n1_msg4;
//-------clare
dci_result->dl_sdly = msg4_subframe - dci_end_subframe; dci_result->dl_sdly = msg4_subframe - dci_end_subframe;
dci_result->ul_sdly = harq_subframe - msg4_end_subframe; dci_result->ul_sdly = harq_subframe - msg4_end_subframe;
dci_result->num_sf = msg4_end_subframe - msg4_subframe+1; dci_result->num_sf = msg4_end_subframe - msg4_subframe+1;
dci_result->harq_round = msg4_nodes->msg4_retransmit_count; dci_result->harq_round = msg4_nodes->msg4_retransmit_count;
//-------clare
// for msg4 // for msg4
msg4_result = (schedule_result_t *)malloc(sizeof(schedule_result_t)); msg4_result = (schedule_result_t *)malloc(sizeof(schedule_result_t));
...@@ -937,9 +932,6 @@ void fill_rar_NB_IoT( ...@@ -937,9 +932,6 @@ void fill_rar_NB_IoT(
uint8_t *dlsch_buffer = &ra_template->rar_buffer[0]; uint8_t *dlsch_buffer = &ra_template->rar_buffer[0];
RA_HEADER_RAPID_NB_IoT *rarh = (RA_HEADER_RAPID_NB_IoT *)dlsch_buffer; RA_HEADER_RAPID_NB_IoT *rarh = (RA_HEADER_RAPID_NB_IoT *)dlsch_buffer;
int i; int i;
//,ra_idx = -1;
// uint16_t rballoc;
// uint8_t mcs,TPC,ULdelay,cqireq;
for(i=0; i<7; ++i){ for(i=0; i<7; ++i){
dlsch_buffer[i] = 0x0; dlsch_buffer[i] = 0x0;
......
...@@ -44,13 +44,11 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -44,13 +44,11 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
sched_temp_DL_NB_IoT_t *NPDSCH_info = (sched_temp_DL_NB_IoT_t*)malloc(sizeof(sched_temp_DL_NB_IoT_t)); sched_temp_DL_NB_IoT_t *NPDSCH_info = (sched_temp_DL_NB_IoT_t*)malloc(sizeof(sched_temp_DL_NB_IoT_t));
sched_temp_UL_NB_IoT_t *HARQ_info = (sched_temp_UL_NB_IoT_t*)malloc(sizeof(sched_temp_UL_NB_IoT_t)); sched_temp_UL_NB_IoT_t *HARQ_info = (sched_temp_UL_NB_IoT_t*)malloc(sizeof(sched_temp_UL_NB_IoT_t));
//Eric current remove it
//DCI N1 //DCI N1
//DCIFormatN1_t *DCI_N1 = (DCIFormatN1_t*)malloc(sizeof(DCIFormatN1_t)); //DCIFormatN1_t *DCI_N1 = (DCIFormatN1_t*)malloc(sizeof(DCIFormatN1_t));
//RLC Status //RLC Status
//Eric
//mac_rlc_status_resp_NB_IoT_t rlc_status; //mac_rlc_status_resp_NB_IoT_t rlc_status;
/*Index in DCI_N1*/ /*Index in DCI_N1*/
...@@ -70,9 +68,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -70,9 +68,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//uint8_t sdu_temp[SCH_PAYLOAD_SIZE_MAX_NB_IoT]; //uint8_t sdu_temp[SCH_PAYLOAD_SIZE_MAX_NB_IoT];
//Eric
//logical_chan_id_t logical_channel; //logical_chan_id_t logical_channel;
//Eric
uint32_t subheader_length=2; uint32_t subheader_length=2;
...@@ -86,7 +82,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -86,7 +82,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//get max TBS //get max TBS
TBS = get_max_tbs(I_tbs); TBS = get_max_tbs(I_tbs);
//Eric
if(UE_info->HARQ_round==0) if(UE_info->HARQ_round==0)
{ {
flag_retransmission=0; flag_retransmission=0;
...@@ -97,7 +92,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -97,7 +92,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
flag_retransmission=1; flag_retransmission=1;
data_size=UE_info->DLSCH_pdu_size; data_size=UE_info->DLSCH_pdu_size;
} }
//Eric
LOG_D(MAC,"[%04d][DLSchedulerUSS] Max TBS %d MCS index %d TBS index %d\n", mac_inst->current_subframe, TBS, I_mcs, I_tbs); LOG_D(MAC,"[%04d][DLSchedulerUSS] Max TBS %d MCS index %d TBS index %d\n", mac_inst->current_subframe, TBS, I_mcs, I_tbs);
/*set UE data information*/ /*set UE data information*/
...@@ -160,13 +154,11 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -160,13 +154,11 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
LOG_D(MAC,"[%04d][DLSchedulerUSS] TBS change to %d because data size is smaller than previous TBS\n", mac_inst->current_subframe, TBS); LOG_D(MAC,"[%04d][DLSchedulerUSS] TBS change to %d because data size is smaller than previous TBS\n", mac_inst->current_subframe, TBS);
} }
search_space_end_sf=cal_num_dlsf(mac_inst, hyperSF_start, frame_start, subframe_start, &h_temp, &f_temp, &sf_temp, UE_info->R_max); search_space_end_sf=cal_num_dlsf(mac_inst, hyperSF_start, frame_start, subframe_start, &h_temp, &f_temp, &sf_temp, UE_info->R_max);
LOG_D(MAC,"[%04d][DLSchedulerUSS] Search_space_start_sf %d Search_space_end_sf %d\n", convert_system_number_sf(hyperSF_start, frame_start, subframe_start), mac_inst->current_subframe, search_space_end_sf); LOG_D(MAC,"[%04d][DLSchedulerUSS] Search_space_start_sf %d Search_space_end_sf %d\n", convert_system_number_sf(hyperSF_start, frame_start, subframe_start), mac_inst->current_subframe, search_space_end_sf);
//LOG_D(MAC,"[%04d][DLSchedulerUSS][%d] Search_space_start_sf %d Search_space_end_sf %d\n", mac_inst->current_subframe, UE_info->rnti, mac_inst->current_subframe, convert_system_number_sf(hyperSF_start, frame_start, subframe_start), search_space_end_sf); //LOG_D(MAC,"[%04d][DLSchedulerUSS][%d] Search_space_start_sf %d Search_space_end_sf %d\n", mac_inst->current_subframe, UE_info->rnti, mac_inst->current_subframe, convert_system_number_sf(hyperSF_start, frame_start, subframe_start), search_space_end_sf);
/*Loop all NPDCCH candidate position*/ /*Loop all NPDCCH candidate position*/
//Eric
for(cdd_num=0;cdd_num<UE_info->R_max/UE_sched_ctrl_info->R_dci;++cdd_num) for(cdd_num=0;cdd_num<UE_info->R_max/UE_sched_ctrl_info->R_dci;++cdd_num)
//Eric
{ {
//LOG_D(MAC,"[%04d][DLSchedulerUSS] Candidate num %d DCI Rep %d\n",mac_inst->current_subframe, cdd_num, UE_sched_ctrl_info->R_dci); //LOG_D(MAC,"[%04d][DLSchedulerUSS] Candidate num %d DCI Rep %d\n",mac_inst->current_subframe, cdd_num, UE_sched_ctrl_info->R_dci);
/*Check NPDCCH Resource*/ /*Check NPDCCH Resource*/
...@@ -183,9 +175,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -183,9 +175,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
if(TBS > data_size+subheader_length) if(TBS > data_size+subheader_length)
{ {
TBS = get_tbs(data_size, I_tbs, &I_sf); TBS = get_tbs(data_size, I_tbs, &I_sf);
//Eric
LOG_D(MAC,"[%04d][DLSchedulerUSS] [%d] data_size %d TBS change to %d \n", mac_inst->current_subframe,UE_info->rnti, data_size, TBS); LOG_D(MAC,"[%04d][DLSchedulerUSS] [%d] data_size %d TBS change to %d \n", mac_inst->current_subframe,UE_info->rnti, data_size, TBS);
//Eric
} }
...@@ -235,16 +225,13 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -235,16 +225,13 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
*/ */
//mac_sdu_size = mac_rlc_data_req_eNB_NB_IoT(module_id, UE_info->rnti, 0, frame_start, 0, DCCH0_NB_IoT, sdu_temp); //mac_sdu_size = mac_rlc_data_req_eNB_NB_IoT(module_id, UE_info->rnti, 0, frame_start, 0, DCCH0_NB_IoT, sdu_temp);
//Eric
//channel=DCCH0_NB_IoT; //channel=DCCH0_NB_IoT;
//Eric
//Generate header //Generate header
//payload_offset = generate_dlsch_header_NB_IoT(UE_info->DLSCH_pdu.payload, 1, &logical_channel, &mac_sdu_size, 0, 0, TBS); //payload_offset = generate_dlsch_header_NB_IoT(UE_info->DLSCH_pdu.payload, 1, &logical_channel, &mac_sdu_size, 0, 0, TBS);
//Complete MAC PDU //Complete MAC PDU
//memcpy(UE_info->DLSCH_pdu.payload+payload_offset, sdu_temp, mac_sdu_size); //memcpy(UE_info->DLSCH_pdu.payload+payload_offset, sdu_temp, mac_sdu_size);
//Eric
//UE_info->DLSCH_pdu.pdu_size=TBS; //UE_info->DLSCH_pdu.pdu_size=TBS;
UE_sched_ctrl_info->NPDCCH_sf_end=NPDCCH_info->sf_end; UE_sched_ctrl_info->NPDCCH_sf_end=NPDCCH_info->sf_end;
UE_sched_ctrl_info->NPDCCH_sf_start=NPDCCH_info->sf_start; UE_sched_ctrl_info->NPDCCH_sf_start=NPDCCH_info->sf_start;
...@@ -260,7 +247,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -260,7 +247,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
UE_sched_ctrl_info->dci_n1_index_delay=I_delay; UE_sched_ctrl_info->dci_n1_index_delay=I_delay;
UE_sched_ctrl_info->dci_n1_index_ack_nack=HARQ_info->ACK_NACK_resource_field; UE_sched_ctrl_info->dci_n1_index_ack_nack=HARQ_info->ACK_NACK_resource_field;
UE_sched_ctrl_info->total_data_size_dl=data_size; UE_sched_ctrl_info->total_data_size_dl=data_size;
//Eric
} }
LOG_D(MAC,"[%04d][DLSchedulerUSS][%d][Success] Complete scheduling with data size %d\n", mac_inst->current_subframe, UE_info->rnti, data_size); LOG_D(MAC,"[%04d][DLSchedulerUSS][%d][Success] Complete scheduling with data size %d\n", mac_inst->current_subframe, UE_info->rnti, data_size);
//LOG_D(MAC,"[%04d][DLSchedulerUSS] RNTI %d\n", mac_inst->current_subframe, UE_info->rnti); //LOG_D(MAC,"[%04d][DLSchedulerUSS] RNTI %d\n", mac_inst->current_subframe, UE_info->rnti);
...@@ -276,10 +262,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -276,10 +262,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//fill_DCI_N1(DCI_N1, UE_info, I_delay, I_sf, HARQ_info->ACK_NACK_resource_field); //fill_DCI_N1(DCI_N1, UE_info, I_delay, I_sf, HARQ_info->ACK_NACK_resource_field);
//LOG_D(MAC,"[%04d][DLSchedulerUSS] HARQ index %d\n", HARQ_info->ACK_NACK_resource_field); //LOG_D(MAC,"[%04d][DLSchedulerUSS] HARQ index %d\n", HARQ_info->ACK_NACK_resource_field);
//Eric
//LOG_D(MAC,"[%04d][DLSchedulerUSS][%d] DCI N1 type:%d order:%d MCS:%d HARQ index:%d R:%d RscAssign:%d scheddly:%d DCI_R:%d\n", mac_inst->current_subframe, UE_info->rnti, DCI_N1->type, DCI_N1->orderIndicator, DCI_N1->mcs, DCI_N1->HARQackRes, DCI_N1->RepNum, DCI_N1->ResAssign, DCI_N1->Scheddly, DCI_N1->DCIRep); //LOG_D(MAC,"[%04d][DLSchedulerUSS][%d] DCI N1 type:%d order:%d MCS:%d HARQ index:%d R:%d RscAssign:%d scheddly:%d DCI_R:%d\n", mac_inst->current_subframe, UE_info->rnti, DCI_N1->type, DCI_N1->orderIndicator, DCI_N1->mcs, DCI_N1->HARQackRes, DCI_N1->RepNum, DCI_N1->ResAssign, DCI_N1->Scheddly, DCI_N1->DCIRep);
//Eric
//Generate Scheduling result for this UE //Generate Scheduling result for this UE
//generate_scheduling_result_DL(NPDCCH_info->sf_start, NPDSCH_info->sf_start, HARQ_info->sf_start, DCI_N1, UE_info->rnti, TBS, UE_info->DLSCH_pdu.payload); //generate_scheduling_result_DL(NPDCCH_info->sf_start, NPDSCH_info->sf_start, HARQ_info->sf_start, DCI_N1, UE_info->rnti, TBS, UE_info->DLSCH_pdu.payload);
...@@ -324,9 +307,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -324,9 +307,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//LOG_D(MAC,"[%04d][DLSchedulerUSS] Candidate %d no resource\n", mac_inst->current_subframe, cdd_num); //LOG_D(MAC,"[%04d][DLSchedulerUSS] Candidate %d no resource\n", mac_inst->current_subframe, cdd_num);
} }
//Eric
UE_sched_ctrl_info->flag_schedule_success=0; UE_sched_ctrl_info->flag_schedule_success=0;
//Eric
/*Resource allocate fail*/ /*Resource allocate fail*/
if((end_flagCCH==-1)||(end_flagSCH==-1)||(end_flagHARQ==-1)) if((end_flagCCH==-1)||(end_flagSCH==-1)||(end_flagHARQ==-1))
...@@ -334,9 +315,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_ ...@@ -334,9 +315,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
LOG_D(MAC,"[%04d][DLSchedulerUSS][%d][Fail] Resource allocate fail\n", mac_inst->current_subframe, UE_info->rnti); LOG_D(MAC,"[%04d][DLSchedulerUSS][%d][Fail] Resource allocate fail\n", mac_inst->current_subframe, UE_info->rnti);
LOG_D(MAC,"[%04d][DLSchedulerUSS][%d][Fail] Resource allocate fail\n", mac_inst->current_subframe, UE_info->rnti); LOG_D(MAC,"[%04d][DLSchedulerUSS][%d][Fail] Resource allocate fail\n", mac_inst->current_subframe, UE_info->rnti);
} }
//Eric
return -1; return -1;
//Eric
} }
int check_resource_NPDCCH_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t hyperSF_start, uint32_t frame_start, uint32_t subframe_start, sched_temp_DL_NB_IoT_t *NPDCCH_info, uint32_t cdd_num, uint32_t dci_rep) int check_resource_NPDCCH_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t hyperSF_start, uint32_t frame_start, uint32_t subframe_start, sched_temp_DL_NB_IoT_t *NPDCCH_info, uint32_t cdd_num, uint32_t dci_rep)
...@@ -422,9 +401,7 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch ...@@ -422,9 +401,7 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
uint32_t num_sdu_L_15; uint32_t num_sdu_L_15;
int32_t padding_size; int32_t padding_size;
uint8_t flag_end_padding=0; uint8_t flag_end_padding=0;
//Eric
SCH_SUBHEADER_FIXED_NB_IoT *mac_header=(SCH_SUBHEADER_FIXED_NB_IoT*)pdu; SCH_SUBHEADER_FIXED_NB_IoT *mac_header=(SCH_SUBHEADER_FIXED_NB_IoT*)pdu;
//Eric
uint32_t offset=0; uint32_t offset=0;
for(i=0;i<num_sdu;++i) for(i=0;i<num_sdu;++i)
...@@ -494,7 +471,6 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch ...@@ -494,7 +471,6 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
} }
else else
{ {
//Eric
if(sdu_length[i]<128) if(sdu_length[i]<128)
{ {
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->LCID = logical_channel[i]; ((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->LCID = logical_channel[i];
...@@ -520,7 +496,6 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch ...@@ -520,7 +496,6 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
num_subheader--; num_subheader--;
offset+=3; offset+=3;
} }
//Eric
} }
} }
if(flag_end_padding==1) if(flag_end_padding==1)
...@@ -545,9 +520,7 @@ void fill_DCI_N1(DCIFormatN1_t *DCI_N1, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT ...@@ -545,9 +520,7 @@ void fill_DCI_N1(DCIFormatN1_t *DCI_N1, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT
DCI_N1->HARQackRes = UE_sched_ctrl_info->dci_n1_index_ack_nack; DCI_N1->HARQackRes = UE_sched_ctrl_info->dci_n1_index_ack_nack;
//DCI_N1->DCIRep = 3-UE_info->R_max/UE_info->R_dci/2; //DCI_N1->DCIRep = 3-UE_info->R_max/UE_info->R_dci/2;
DCI_N1->DCIRep=get_DCI_REP(UE_sched_ctrl_info->R_dci, UE_info->R_max); DCI_N1->DCIRep=get_DCI_REP(UE_sched_ctrl_info->R_dci, UE_info->R_max);
// Eric
LOG_D(MAC,"[fill_DCI_N1] Type %d order %d I_delay %d I_SF %d I_mcs %d I_rep %d I_harq %d I_dci %d\n", DCI_N1->type, DCI_N1->orderIndicator, DCI_N1->Scheddly, DCI_N1->ResAssign, DCI_N1->mcs, DCI_N1->RepNum, DCI_N1->HARQackRes, DCI_N1->DCIRep); LOG_D(MAC,"[fill_DCI_N1] Type %d order %d I_delay %d I_SF %d I_mcs %d I_rep %d I_harq %d I_dci %d\n", DCI_N1->type, DCI_N1->orderIndicator, DCI_N1->Scheddly, DCI_N1->ResAssign, DCI_N1->mcs, DCI_N1->RepNum, DCI_N1->HARQackRes, DCI_N1->DCIRep);
// Eric
} }
...@@ -684,9 +657,7 @@ void generate_scheduling_result_DL(uint32_t NPDCCH_sf_end, uint32_t NPDCCH_sf_st ...@@ -684,9 +657,7 @@ void generate_scheduling_result_DL(uint32_t NPDCCH_sf_end, uint32_t NPDCCH_sf_st
/*HARQ scheduling result*/ /*HARQ scheduling result*/
// be the first node of UL // be the first node of UL
// be the first node of UL // be the first node of UL
// Eric
#if 1 #if 1
// Eric
tmp1 = NULL; tmp1 = NULL;
tmp = NULL; tmp = NULL;
if(schedule_result_list_UL == NULL) if(schedule_result_list_UL == NULL)
...@@ -727,9 +698,7 @@ void generate_scheduling_result_DL(uint32_t NPDCCH_sf_end, uint32_t NPDCCH_sf_st ...@@ -727,9 +698,7 @@ void generate_scheduling_result_DL(uint32_t NPDCCH_sf_end, uint32_t NPDCCH_sf_st
} }
} }
} }
// Eric
#endif #endif
// Eric
} }
void maintain_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, sched_temp_DL_NB_IoT_t *NPDCCH_info, sched_temp_DL_NB_IoT_t *NPDSCH_info) void maintain_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, sched_temp_DL_NB_IoT_t *NPDCCH_info, sched_temp_DL_NB_IoT_t *NPDSCH_info)
...@@ -1048,14 +1017,11 @@ uint32_t get_I_mcs(int CE_level) ...@@ -1048,14 +1017,11 @@ uint32_t get_I_mcs(int CE_level)
uint32_t get_max_tbs(uint32_t I_tbs) uint32_t get_max_tbs(uint32_t I_tbs)
{ {
//Eric
return MAC_TBStable_NB_IoT[I_tbs][7]/8; return MAC_TBStable_NB_IoT[I_tbs][7]/8;
//Eric
} }
uint32_t get_tbs(uint32_t data_size, uint32_t I_tbs, uint32_t *I_sf) uint32_t get_tbs(uint32_t data_size, uint32_t I_tbs, uint32_t *I_sf)
{ {
//Eric
for((*I_sf)=0;(*I_sf)<8;++(*I_sf)) for((*I_sf)=0;(*I_sf)<8;++(*I_sf))
{ {
...@@ -1067,7 +1033,6 @@ uint32_t get_tbs(uint32_t data_size, uint32_t I_tbs, uint32_t *I_sf) ...@@ -1067,7 +1033,6 @@ uint32_t get_tbs(uint32_t data_size, uint32_t I_tbs, uint32_t *I_sf)
} }
LOG_D(MAC,"error\n"); LOG_D(MAC,"error\n");
return 0; return 0;
//Eric
} }
uint32_t get_num_sf(uint32_t I_sf) uint32_t get_num_sf(uint32_t I_sf)
......
...@@ -35,16 +35,12 @@ unsigned char str20[] = "DCI_uss"; ...@@ -35,16 +35,12 @@ unsigned char str20[] = "DCI_uss";
unsigned char str21[] = "DATA_uss"; unsigned char str21[] = "DATA_uss";
// scheduling UL // scheduling UL
//-------Daniel
int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info,uint32_t subframe, uint32_t frame, uint32_t H_SFN, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info){ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info,uint32_t subframe, uint32_t frame, uint32_t H_SFN, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info){
//-------Daniel
int i,ndi = 0,check_DCI_result = 0,check_UL_result = 0,candidate; int i,ndi = 0,check_DCI_result = 0,check_UL_result = 0,candidate;
uint32_t DL_end; uint32_t DL_end;
//Scheduling resource temp buffer //Scheduling resource temp buffer
sched_temp_DL_NB_IoT_t *NPDCCH_info = (sched_temp_DL_NB_IoT_t*)malloc(sizeof(sched_temp_DL_NB_IoT_t)); sched_temp_DL_NB_IoT_t *NPDCCH_info = (sched_temp_DL_NB_IoT_t*)malloc(sizeof(sched_temp_DL_NB_IoT_t));
//-------Daniel
candidate = UE_info->R_max/UE_sched_ctrl_info->R_dci; candidate = UE_info->R_max/UE_sched_ctrl_info->R_dci;
//-------Daniel
uint32_t mcs = max_mcs[UE_info->multi_tone]; uint32_t mcs = max_mcs[UE_info->multi_tone];
uint32_t mappedMcsIndex=UE_info->PHR+(4 * UE_info->multi_tone); uint32_t mappedMcsIndex=UE_info->PHR+(4 * UE_info->multi_tone);
int TBS = 0; int TBS = 0;
...@@ -53,27 +49,20 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -53,27 +49,20 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
if(UE_info->ul_total_buffer<=0) if(UE_info->ul_total_buffer<=0)
{ {
//------Daniel
LOG_D(MAC,"[%04d][ULSchedulerUSS][UE:%05d] No UL data in buffer\n", mac_inst->current_subframe, UE_info->rnti); LOG_D(MAC,"[%04d][ULSchedulerUSS][UE:%05d] No UL data in buffer\n", mac_inst->current_subframe, UE_info->rnti);
//------Daniel
return -1; return -1;
} }
TBS=get_TBS_UL_NB_IoT(mcs,UE_info->multi_tone,Iru); TBS=get_TBS_UL_NB_IoT(mcs,UE_info->multi_tone,Iru);
//-------Daniel
LOG_D(MAC,"Initial TBS : %d UL_buffer: %d\n", TBS, UE_info->ul_total_buffer); LOG_D(MAC,"Initial TBS : %d UL_buffer: %d\n", TBS, UE_info->ul_total_buffer);
//-------Daneil
sched_temp_UL_NB_IoT_t *NPUSCH_info = (sched_temp_UL_NB_IoT_t*)malloc(sizeof(sched_temp_UL_NB_IoT_t)); sched_temp_UL_NB_IoT_t *NPUSCH_info = (sched_temp_UL_NB_IoT_t*)malloc(sizeof(sched_temp_UL_NB_IoT_t));
//-------Daniel
//DCIFormatN0_t *DCI_N0 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t)); //DCIFormatN0_t *DCI_N0 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t));
//-------Daniel
//available_resource_DL_t *node; //available_resource_DL_t *node;
// setting of the NDI // setting of the NDI
//-------Daniel
/* /*
if(UE_info->HARQ_round == 0) if(UE_info->HARQ_round == 0)
{ {
...@@ -81,7 +70,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -81,7 +70,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
UE_info->oldNDI_UL=ndi; UE_info->oldNDI_UL=ndi;
} }
*/ */
//-------Daniel
for (i = 0; i < candidate; i++) for (i = 0; i < candidate; i++)
{ {
...@@ -106,7 +94,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -106,7 +94,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
mcs = mapped_mcs[UE_info->CE_level][mappedMcsIndex]; mcs = mapped_mcs[UE_info->CE_level][mappedMcsIndex];
//--------Daniel
if(UE_info->HARQ_round==0) if(UE_info->HARQ_round==0)
{ {
...@@ -124,7 +111,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -124,7 +111,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
TBS=get_TBS_UL_NB_IoT(mcs,UE_info->multi_tone,Iru); TBS=get_TBS_UL_NB_IoT(mcs,UE_info->multi_tone,Iru);
} }
} }
//--------Daniel
//LOG_D(MAC,"TBS : %d MCS %d I_RU %d\n", TBS, UE_info->ul_total_buffer, mcs, Iru); //LOG_D(MAC,"TBS : %d MCS %d I_RU %d\n", TBS, UE_info->ul_total_buffer, mcs, Iru);
Nru = RU_table[Iru]; Nru = RU_table[Iru];
...@@ -143,11 +129,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -143,11 +129,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
check_UL_result = Check_UL_resource(uplink_time,total_ru, NPUSCH_info, UE_info->multi_tone, 0); check_UL_result = Check_UL_resource(uplink_time,total_ru, NPUSCH_info, UE_info->multi_tone, 0);
if (check_UL_result != -1) if (check_UL_result != -1)
{ {
//----Daniel
//----Daniel
//----Daniel
//LOG_D(MAC,"[%04d][UL scheduler][UE:%05d] DCI content = scind : %d ResAssign : %d mcs : %d ndi : %d scheddly : %d RepNum : %d rv : %d DCIRep : %d\n", mac_inst->current_subframe,UE_info->rnti,DCI_N0->scind,DCI_N0->ResAssign,DCI_N0->mcs,DCI_N0->ndi,DCI_N0->Scheddly,DCI_N0->RepNum,DCI_N0->rv,DCI_N0->DCIRep); //LOG_D(MAC,"[%04d][UL scheduler][UE:%05d] DCI content = scind : %d ResAssign : %d mcs : %d ndi : %d scheddly : %d RepNum : %d rv : %d DCIRep : %d\n", mac_inst->current_subframe,UE_info->rnti,DCI_N0->scind,DCI_N0->ResAssign,DCI_N0->mcs,DCI_N0->ndi,DCI_N0->Scheddly,DCI_N0->RepNum,DCI_N0->rv,DCI_N0->DCIRep);
LOG_D(MAC,"[%04d][ULSchedulerUSS][%d][Success] complete scheduling with data size %d\n", mac_inst->current_subframe, UE_info->rnti, UE_info->ul_total_buffer); LOG_D(MAC,"[%04d][ULSchedulerUSS][%d][Success] complete scheduling with data size %d\n", mac_inst->current_subframe, UE_info->rnti, UE_info->ul_total_buffer);
LOG_D(MAC,"[%04d][ULSchedulerUSS][%d] Multi-tone:%d,MCS:%d,TBS:%d,UL_buffer:%d,DL_start:%d,DL_end:%d,N_rep:%d,N_ru:%d,Total_ru:%d\n", mac_inst->current_subframe,UE_info->rnti,UE_info->multi_tone,mcs,TBS,UE_info->ul_total_buffer,NPDCCH_info->sf_start,DL_end,N_rep,Nru,total_ru); LOG_D(MAC,"[%04d][ULSchedulerUSS][%d] Multi-tone:%d,MCS:%d,TBS:%d,UL_buffer:%d,DL_start:%d,DL_end:%d,N_rep:%d,N_ru:%d,Total_ru:%d\n", mac_inst->current_subframe,UE_info->rnti,UE_info->multi_tone,mcs,TBS,UE_info->ul_total_buffer,NPDCCH_info->sf_start,DL_end,N_rep,Nru,total_ru);
...@@ -243,9 +225,13 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t ...@@ -243,9 +225,13 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
break; break;
case SHORT_BSR: case SHORT_BSR:
// update BSR here // update BSR here
LOG_I(MAC,"Update BSR, but still not implemented here\n");
UE_info = get_ue_from_rnti(mac_inst, rnti); UE_info = get_ue_from_rnti(mac_inst, rnti);
BSR_index = payload_ptr[0] & 0x3f; BSR_index = payload_ptr[0] & 0x3f;
UE_info->ul_total_buffer = BSR_table[BSR_index]; if(UE_info != NULL)
UE_info->ul_total_buffer = BSR_table[BSR_index];
else
LOG_E(MAC,"UE info empty\n");
payload_ptr+=1; payload_ptr+=1;
break; break;
default: default:
...@@ -365,7 +351,6 @@ uint16_t length, ce_len=0; ...@@ -365,7 +351,6 @@ uint16_t length, ce_len=0;
return(mac_header_ptr); return(mac_header_ptr);
} }
//------Daniel
void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info) void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info)
{ {
DCI_N0->type = 0; DCI_N0->type = 0;
...@@ -380,4 +365,3 @@ void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT ...@@ -380,4 +365,3 @@ void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT
//DCI_N0->DCIRep = UE_sched_ctrl_info->dci_n0_index_R_dci; //DCI_N0->DCIRep = UE_sched_ctrl_info->dci_n0_index_R_dci;
LOG_D(MAC,"[fill_DCI_N0] Type %d scind %d I_ru %d I_mcs %d ndi %d I_delay %d I_rep %d RV %d I_dci %d\n", DCI_N0->type, DCI_N0->scind, DCI_N0->ResAssign, DCI_N0->mcs, DCI_N0->ndi, DCI_N0->Scheddly, DCI_N0->RepNum, DCI_N0->rv, DCI_N0->DCIRep); LOG_D(MAC,"[fill_DCI_N0] Type %d scind %d I_ru %d I_mcs %d ndi %d I_delay %d I_rep %d RV %d I_dci %d\n", DCI_N0->type, DCI_N0->scind, DCI_N0->ResAssign, DCI_N0->mcs, DCI_N0->ndi, DCI_N0->Scheddly, DCI_N0->RepNum, DCI_N0->rv, DCI_N0->DCIRep);
} }
//-----Daniel
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