Commit 7110bb74 authored by Nick Ho's avatar Nick Ho

Integrate USS MAC scheduler into OAI

parent 2d2c80db
......@@ -67,80 +67,6 @@ void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,void *pdu,rnti_t rnti,unsigned char
LOG_D(MAC,"add ue specific dci format %d for rnti %x \n",dci_fmt,rnti);
}
int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_IoT_t dci_format,
uint8_t UE_id,
uint8_t aggregation,
uint8_t npdcch_start_symbol)
{
void *ULSCH_DCI_NB_IoT = NULL;
eNB->DCI_pdu = (DCI_PDU_NB_IoT*) malloc(sizeof(DCI_PDU_NB_IoT));
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type;
/// Subcarrier indication, 6 bits
uint8_t scind;
/// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign;
/// Modulation and Coding Scheme, 4 bits
uint8_t mcs;
/// New Data Indicator, 1 bits
uint8_t ndi;
/// Scheduling Delay, 2 bits
uint8_t Scheddly;
/// Repetition Number, 3 bits
uint8_t RepNum;
/// Redundancy version for HARQ (only use 0 and 2), 1 bits
uint8_t rv;
/// DCI subframe repetition Number, 2 bits
uint8_t DCIRep;
if (dci_format == DCIFormatN0)
{
type = DCI_Content->DCIN0.type;
scind = DCI_Content->DCIN0.scind;
ResAssign = DCI_Content->DCIN0.ResAssign;
mcs = DCI_Content->DCIN0.mcs;
ndi = DCI_Content->DCIN0.ndi;
Scheddly = DCI_Content->DCIN0.Scheddly;
RepNum = DCI_Content->DCIN0.RepNum;
rv = DCI_Content->DCIN0.rv;
DCIRep = DCI_Content->DCIN0.DCIRep;
/*Packed DCI here*/
((DCIN0_t *)ULSCH_DCI_NB_IoT)->type =type;
((DCIN0_t *)ULSCH_DCI_NB_IoT)->scind =scind;
((DCIN0_t *)ULSCH_DCI_NB_IoT)->ResAssign =ResAssign;
((DCIN0_t *)ULSCH_DCI_NB_IoT)->Scheddly =Scheddly;
((DCIN0_t *)ULSCH_DCI_NB_IoT)->mcs =mcs;
((DCIN0_t *)ULSCH_DCI_NB_IoT)->rv =rv;
((DCIN0_t *)ULSCH_DCI_NB_IoT)->RepNum =RepNum;
((DCIN0_t *)ULSCH_DCI_NB_IoT)->ndi =ndi;
((DCIN0_t *)ULSCH_DCI_NB_IoT)->DCIRep =DCIRep;
add_dci_NB_IoT(eNB->DCI_pdu,ULSCH_DCI_NB_IoT,rnti,sizeof(DCIN0_t),aggregation,sizeof_DCIN0_t,DCIFormatN0, npdcch_start_symbol);
// use this value to configure PHY both harq_processes and resource mapping.
return(0);
}
else
{
LOG_E(PHY,"generate_eNB_ulsch_params_from_dci, Illegal dci_format %d\n",dci_format);
return(-1);
}
}
//map the Isf (DCI param) to the number of subframes (Nsf)
int resource_to_subframe[8] = {1,2,3,4,5,6,8,10};
......@@ -200,6 +126,97 @@ int DCIrep_to_real_rep(uint8_t DCI_rep, int Rmax)
return R;
}
int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
NB_IoT_eNB_NPDCCH_t *ndlcch,
uint8_t aggregation,
uint8_t npdcch_start_symbol,
uint8_t ncce_index)
{
int tmp = 0;
int i = 0;
uint8_t *DCI_flip = NULL;
ncce_index = 0;
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type;
/// Subcarrier indication, 6 bits
uint8_t scind;
/// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign;
/// Modulation and Coding Scheme, 4 bits
uint8_t mcs;
/// New Data Indicator, 1 bits
uint8_t ndi;
/// Scheduling Delay, 2 bits
uint8_t Scheddly;
/// Repetition Number, 3 bits
uint8_t RepNum;
/// Redundancy version for HARQ (only use 0 and 2), 1 bits
uint8_t rv;
/// DCI subframe repetition Number, 2 bits
uint8_t DCIRep;
type = DCI_Content->DCIN0.type;
scind = DCI_Content->DCIN0.scind;
ResAssign = DCI_Content->DCIN0.ResAssign;
mcs = DCI_Content->DCIN0.mcs;
ndi = DCI_Content->DCIN0.ndi;
Scheddly = DCI_Content->DCIN0.Scheddly;
RepNum = DCI_Content->DCIN0.RepNum;
rv = DCI_Content->DCIN0.rv;
DCIRep = DCI_Content->DCIN0.DCIRep;
/*Now configure the npdcch structure*/
// ndlcch->ncce_index = NCCE_index;
// ndlcch->aggregation_level = aggregation;
ndlcch->A[ncce_index] = sizeof_DCIN0_t; // number of bits in DCI
ndlcch->rnti[ncce_index] = rnti; //we store the RNTI (e.g. for RNTI will be used later)
ndlcch->active[ncce_index] = 1; //will be activated by the corresponding NDSLCH pdu
ndlcch->dci_repetitions[ncce_index] = DCIrep_to_real_rep(DCIRep,4); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
//printf("dci_repetitions: %d, A = %d\n",ndlcch->dci_repetitions[ncce_index],ndlcch->A[ncce_index]);
DCI_flip = (uint8_t*)malloc(3*sizeof(uint8_t));
for(i=0; i<3; ++i){
DCI_flip[i] = 0x0;
}
DCI_flip[0] = (type << 7) | (scind << 1) | (ResAssign>>2);
DCI_flip[1] = (uint8_t)(ResAssign << 6) | (Scheddly << 4) | mcs;
DCI_flip[2] = (rv << 7) | (RepNum << 4) | (ndi << 3) |(DCIRep <<1);
ndlcch->pdu[ncce_index] = DCI_flip;
printf("DCI N0 content:");
for (tmp =0;tmp<3;tmp++)
printf("%d ",DCI_flip[tmp]);
printf("\n");
/*
* TS 36.213 ch 16.4.1.5
* ITBS is always set equivalent to IMCS for data
* ISF = ResAssign
*/
ndlcch->counter_repetition_number[ncce_index] = DCIrep_to_real_rep(DCIRep,4); ////??????? should be repalce by the value in spec table 16.6-3, check also Rmax
LOG_I(PHY,"DCI packing for N0 done \n");
}
int generate_eNB_dlsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB,
int frame,
uint8_t subframe,
......
......@@ -98,7 +98,7 @@ uint16_t get_UL_N_ru_NB_IoT(uint8_t I_mcs, uint8_t I_ru, uint8_t flag_msg3)
return 1;
} else {
printf("error in I_mcs value from nfapi");
//printf("error in I_mcs value from nfapi");
return 0;
}
......
......@@ -208,13 +208,14 @@ void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,
/*Use the UL DCI Information to configure PHY and also Pack the DCI*/
int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_IoT_t dci_format,
uint8_t UE_id,
NB_IoT_eNB_NPDCCH_t *ndlcch,
uint8_t aggregation,
uint8_t npdcch_start_symbol);
uint8_t npdcch_start_symbol,
uint8_t ncce_index);
/*Use the DL DCI Information to configure PHY and also Pack the DCI*/
......
......@@ -395,8 +395,8 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
switch (hi_dci0_pdu->pdu_type)
{
case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
//generate_eNB_ulsch_params_NB_IoT(eNB,proc,hi_dci0_pdu);
LOG_I(PHY, "hi_dci0_pdu type for NB_IoT\n");
generate_eNB_ulsch_params_NB_IoT(eNB,proc,hi_dci0_pdu);
break;
default:
......@@ -462,7 +462,7 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
////////////////////////////////////////////////////////////////////////////////////////
LOG_I(PHY,"subframe = %d (TX timing), IF module proceed UL config NULSCH data pdu, will trigger npusch in next subframe\n",subframe);
}else
{
nulsch = eNB->ulsch_NB_IoT[0];
nulsch_harq = nulsch->harq_process;
......@@ -487,6 +487,7 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
LOG_I(PHY,"subframe = %d (TX timing), IF module proceed UL config NULSCH ack pdu, will trigger npusch in next subframe\n",subframe);
}
break;
case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
//TODO just for update the nprach configuration (given at the beginning through phy_config_sib2)
......
......@@ -913,16 +913,18 @@ void generate_eNB_dlsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,n
void generate_eNB_ulsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu) {
int UE_id = -1;
//int UE_id = -1;
//int harq_pid = 0;
int frame = proc->frame_tx;
int subframe = proc->subframe_tx;
DCI_CONTENT *DCI_Content;
DCI_Content = (DCI_CONTENT*) malloc(sizeof(DCI_CONTENT));
NB_IoT_eNB_NPDCCH_t *npdcch;
//mapping the fapi parameters to the OAI parameters
DCI_Content->DCIN0.type = 0;
DCI_Content->DCIN0.scind = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.subcarrier_indication;
DCI_Content->DCIN0.ResAssign = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.subcarrier_indication;
DCI_Content->DCIN0.ResAssign = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.resource_assignment;
DCI_Content->DCIN0.mcs = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.mcs;
DCI_Content->DCIN0.ndi = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.new_data_indicator;
DCI_Content->DCIN0.Scheddly = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.scheduling_delay;
......@@ -930,27 +932,24 @@ void generate_eNB_ulsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nf
DCI_Content->DCIN0.rv = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.redudancy_version;
DCI_Content->DCIN0.DCIRep = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number;
UE_id = find_ue_NB_IoT(hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti, eNB);
AssertFatal(UE_id == -1, "no ndlsch context available or no ndlsch context corresponding to that rnti\n");
npdcch = eNB->npdcch_DCI;
/*Log for generate ULSCH DCI*/
LOG_I(PHY,"packing DCI N0\n");
LOG_I(PHY,"Dump DCI N0 : scind: %d, ResAssign: %d, mcs: %d, ndi: %d, Scheddly: %d, RepNum: %d, rv: %d, DCIRep: %d\n",DCI_Content->DCIN0.scind,DCI_Content->DCIN0.ResAssign,DCI_Content->DCIN0.mcs,DCI_Content->DCIN0.ndi,DCI_Content->DCIN0.Scheddly,DCI_Content->DCIN0.RepNum,DCI_Content->DCIN0.rv,DCI_Content->DCIN0.DCIRep);
generate_eNB_ulsch_params_from_dci_NB_IoT(eNB,
proc,
frame,
subframe,
DCI_Content,
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti,
DCIFormatN0,
UE_id,
npdcch,
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level,
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.start_symbol);
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.start_symbol,
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.ncce_index
);
//LOG for ULSCH DCI Resource allocation
//CBA is not used in NB-IoT
eNB->nulsch[UE_id]->harq_process->subframe_scheduling_flag = 1;
}
......
......@@ -78,7 +78,7 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
LOG_D(MAC,"[%d][computing flags] common searching space: %d, num subframe: %d\n", mac_inst->current_subframe, i, extend_space[i]);
}
}
/*
//USS trigger flag
for(i=0;i<mac_inst->num_uss_list;++i)
{
......@@ -89,7 +89,7 @@ void eNB_scheduler_computing_flag_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t
LOG_D(MAC,"[%d][computing flags] UE-spec searching space: %d, num subframe: %d\n", mac_inst->current_subframe, i, mac_inst->UE_list_spec[i].NPDCCH_config_dedicated.T);
}
}
*/
*max_subframe = max; // the maximum subframe to be extend
}
......@@ -137,9 +137,9 @@ void eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t ab
for(i=0;i<mac_inst->num_uss_list;++i)
{
if((scheduler_flags&(flag_uss_v<<i))>0){
LOG_I(MAC,"--------------[%04d][SchedulerUSS] Schedule USS list %d------------\n", mac_inst->current_subframe, (scheduler_flags&(flag_uss_v<<i))>>3);
LOG_D(MAC,"--------------[%04d][SchedulerUSS] Schedule USS list %d------------\n", mac_inst->current_subframe, (scheduler_flags&(flag_uss_v<<i))>>3);
schedule_uss_NB_IoT(0, mac_inst,sf, f, h, i);
LOG_I(MAC,"--------------[%04d][SchedulerUSS] Schedule USS list %d end------------\n", mac_inst->current_subframe, (scheduler_flags&(flag_uss_v<<i))>>3);
LOG_D(MAC,"--------------[%04d][SchedulerUSS] Schedule USS list %d end------------\n", mac_inst->current_subframe, (scheduler_flags&(flag_uss_v<<i))>>3);
scheduler_flags &= ~(flag_uss_v<<i);
}
}
......@@ -291,7 +291,7 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
LOG_D(MAC,"[%04d][schedule_uss_NB_IoT][UE%d] UE_sched_ctrl NPUSCH information:sf_start %d sf end %d\n", mac_inst->current_subframe, UE_template_temp->rnti, UE_sched_ctrl_info->NPUSCH_sf_start, UE_sched_ctrl_info->NPUSCH_sf_end);
DCI_N0 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t));
//generate DCI-N0 content
//fill_DCI_N0(DCI_N0, UE_template_temp, UE_sched_ctrl_info);
fill_DCI_N0(DCI_N0, UE_template_temp, UE_sched_ctrl_info);
generate_scheduling_result_UL(UE_sched_ctrl_info->NPDCCH_sf_start, UE_sched_ctrl_info->NPDCCH_sf_end,UE_sched_ctrl_info->NPUSCH_sf_start, UE_sched_ctrl_info->NPUSCH_sf_end,DCI_N0, UE_template_temp->rnti, str22, str23);
//sotre UE_template
UE_template_temp->R_dci=UE_sched_ctrl_info->R_dci;
......@@ -301,6 +301,8 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
{
UE_template_temp->oldNDI_UL=1-UE_template_temp->oldNDI_UL;
}
UE_template_temp->direction = -1;
break;
case -1: // Idle
//DEBUG("current idle.. \n");
......@@ -311,8 +313,8 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
}
}
UE_sched_ctrl_info -> flag_schedule_success = 0;
}
UE_ID = UE_template_temp->next;
}
}
......
......@@ -657,7 +657,7 @@ void receive_msg4_ack_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t rnti){
ue_info[i].direction = 1;
}
ue_info[i].RRC_connected = 1;
LOG_D(MAC,"[%04d][RA scheduler][MSG4] received UE:%d direction: %d \n", mac_inst->current_subframe, rnti, ue_info[i].direction );
LOG_D(MAC,"[%04d][RA scheduler][MSG4] received UE:%d direction: %d ul_total_buffer: %d\n", mac_inst->current_subframe, rnti, ue_info[i].direction,ue_info[i].ul_total_buffer);
break;
}
}
......
......@@ -71,6 +71,8 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
}
*/
ndi = 1;
for (i = 0; i < candidate; i++)
{
/*step 1 : Check DL resource is available for DCI N0 or not*/
......@@ -94,23 +96,14 @@ 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];
if(UE_info->HARQ_round==0)
{
//mcs = 2;
while((TBS<UE_info->ul_total_buffer)&&(Iru<=7))
{
Iru++;
TBS=get_TBS_UL_NB_IoT(mcs,UE_info->multi_tone,Iru);
}
}
else
{
while((TBS<UE_info->allocated_data_size_ul)&&(Iru<7))
{
Iru++;
TBS=get_TBS_UL_NB_IoT(mcs,UE_info->multi_tone,Iru);
}
}
//LOG_D(MAC,"TBS : %d MCS %d I_RU %d\n", TBS, UE_info->ul_total_buffer, mcs, Iru);
Nru = RU_table[Iru];
......@@ -119,7 +112,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
I_rep = get_I_REP(N_rep);
total_ru = Nru * N_rep;
LOG_D(MAC,"[%04d][ULSchedulerUSS][UE:%05d] 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][UE:%05d] 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,Iru:%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,Iru);
/*step 3 Check UL resource for Uplink data*/
// we will loop the scheduling delay here
......@@ -132,30 +125,24 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
//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] 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_I(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][Success] 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);
//----Daniel
// step 5 resource allocation and generate scheduling result
//----Daniel
LOG_D(MAC,"[%04d][ULSchedulerUSS][UE:%05d] Generate result\n", mac_inst->current_subframe, UE_info->rnti);
//generate_scheduling_result_UL(NPDCCH_info->sf_start, NPDCCH_info->sf_end,NPUSCH_info->sf_start, NPUSCH_info->sf_end,DCI_N0,UE_info->rnti, str20, str21);
LOG_D(MAC,"[%04d][ULSchedulerUSS][UE:%05d] Maintain resource\n", mac_inst->current_subframe, UE_info->rnti);
//fill_resource_DL();
maintain_resource_DL(mac_inst,NPDCCH_info,NULL);
//----Daniel
adjust_UL_resource_list(NPUSCH_info);
//----Daniel
/*
//Change the UE state to idle
UE_info->direction = -1;
return 0;
*/
//----Daneil
//Fill result to Output structure
//----Daneil
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->NPUSCH_sf_end=NPUSCH_info->sf_end;
......@@ -170,11 +157,9 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
UE_sched_ctrl_info->dci_n0_index_ndi=ndi;
//UE_sched_ctrl_info->dci_n0_index_R_dci=get_DCI_REP(UE_sched_ctrl_info->R_dci->R_dci,UE_info->R_max);
UE_sched_ctrl_info->dci_n0_index_R_data=I_rep;
//----Daniel
//----Daniel
LOG_D(MAC,"[%04d][ULSchedulerUSS][%d][Success] Finish UL USS scheduling \n", mac_inst->current_subframe, UE_info->rnti);
return 0;
//----Daniel
}
}
......@@ -260,8 +245,8 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
rx_lengths[i]-=1;
LOG_D(MAC,"rx_lengths : %d\n", rx_lengths[i]);
msg4_rrc_pdu = mac_rrc_msg3_ind_NB_IoT(payload_ptr,rnti,rx_lengths[i]);
receive_msg3_NB_IoT(mac_inst,rnti,PHR,DVI_index,first_6,msg4_rrc_pdu);
LOG_I(MAC,"Contention resolution ID = %02x %02x %02x %02x %02x %02x\n",first_6[0],first_6[1],first_6[2],first_6[3],first_6[4],first_6[5]);
receive_msg3_NB_IoT(mac_inst,rnti,PHR,ul_total_buffer,first_6,msg4_rrc_pdu);
LOG_D(MAC,"Contention resolution ID = %02x %02x %02x %02x %02x %02x\n",first_6[0],first_6[1],first_6[2],first_6[3],first_6[4],first_6[5]);
//NB_IoT_mac_rrc_data_ind(payload_ptr,mac_inst,rnti);
//NB_IoT_receive_msg3(mac_inst,rnti,PHR,ul_total_buffer);
break;
......@@ -363,5 +348,5 @@ void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT
DCI_N0->rv = (UE_info->HARQ_round%2==0)?0:1; // rv will loop 0 & 2
DCI_N0->DCIRep = get_DCI_REP(UE_sched_ctrl_info->R_dci,UE_info->R_max);
//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_I(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);
}
......@@ -149,12 +149,12 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
(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;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G = mac_inst->rrc_config.npdcch_ConfigDedicated[i].G;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset = mac_inst->rrc_config.npdcch_ConfigDedicated[i].a_offset;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max = 8;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G = 1;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset = 0;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max = mac_inst->rrc_config.npdcch_ConfigDedicated[i].R_max;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G = mac_inst->rrc_config.npdcch_ConfigDedicated[i].G;
//(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset = mac_inst->rrc_config.npdcch_ConfigDedicated[i].a_offset;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max = 4;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G = 1;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset = 0;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T = (uint32_t)((double)(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.ss_start_uss = (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T * (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset;
//SCHEDULE_LOG("[init_mac_NB_IoT][CE%d] Rmax %d G %d, a_offset %d, PP %d search space 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);
......
......@@ -184,7 +184,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
}else if(schedule_result_list_DL->direction == UL) // DCI for uplink
{
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill UL_DCI\n",hypersfn,frame,subframe);
LOG_I(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill UL_DCI\n",hypersfn,frame,subframe);
hi_dci0_pdu = SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list;
DCI_pdu = schedule_result_list_DL-> DCI_pdu;
SCHED_info-> HI_DCI0_req->hi_dci0_request_body.number_of_dci =1;
......@@ -275,7 +275,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
if(schedule_result_list_UL->channel == NPUSCH) // condition should be added to switch between HI_DCI0 and Msg3
{
//LOG_D(MAC,"first UL \n");
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill UL config\n",hypersfn,frame,subframe);
LOG_I(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill UL config\n",hypersfn,frame,subframe);
//SCHED_info->UL_req = (nfapi_ul_config_request_t *)malloc(sizeof(nfapi_ul_config_request_t));
//SCHED_info->UL_req->ul_config_request_body.number_of_pdus = 0;
//SCHED_info->UL_req->ul_config_request_body.ul_config_pdu_list = (nfapi_ul_config_request_pdu_t *)malloc(5 * sizeof(nfapi_ul_config_request_pdu_t));
......
......@@ -319,7 +319,8 @@ int get_N_REP(int CE_level)
N_rep = (nprach_list+1)->numRepetitionsPerPreambleAttempt;
}else if (CE_level == 2)
{
N_rep = (nprach_list+2)->numRepetitionsPerPreambleAttempt;
//N_rep = (nprach_list+2)->numRepetitionsPerPreambleAttempt;
N_rep = 1;
}else
{
LOG_D(MAC,"unknown CE level!\n");
......@@ -611,7 +612,7 @@ void generate_scheduling_result_UL(int32_t DCI_subframe, int32_t DCI_end_subfram
DL_result->end_subframe = DCI_end_subframe;
DL_result->DCI_pdu = DCI_inst;
DL_result->DCI_release = 0;
DL_result->direction = DL;
DL_result->direction = UL;
DL_result->channel = NPDCCH;
DL_result->rnti = rnti;
DL_result->next = NULL;
......@@ -745,13 +746,14 @@ void add_ue_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint16_t rnti, ce_level_t ce,
UE_list->UE_template_NB_IoT[i].CE_level = (uint32_t)ce;
//assume random select direction
UE_list->UE_template_NB_IoT[i].R_dci = dci_rep[(uint32_t)ce];
UE_list->UE_template_NB_IoT[i].R_max = UE_list->NPDCCH_config_dedicated.R_max;
//UE_list->UE_template_NB_IoT[i].R_max = UE_list->NPDCCH_config_dedicated.R_max;
UE_list->UE_template_NB_IoT[i].R_max = 4;
UE_list->UE_template_NB_IoT[i].R_harq = harq_rep[(uint32_t)ce];
UE_list->UE_template_NB_IoT[i].HARQ_round = 0;
UE_list->UE_template_NB_IoT[i].oldNDI_UL = 0;
UE_list->UE_template_NB_IoT[i].oldNDI_DL = 0;
UE_list->UE_template_NB_IoT[i].multi_tone = 1;
UE_list->UE_template_NB_IoT[i].multi_tone = 0;
//New UE setting ending
UE_list->UE_template_NB_IoT[i].prev = -1;
......
......@@ -122,7 +122,8 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
// Check if there is any feed back of HARQ
if(UL_INFO->nb_harq_ind.nb_harq_indication_body.number_of_harqs>0)
{
LOG_I(MAC,"Recieved Ack of DL Data\n");
LOG_I(MAC,"Recieved Ack of DL Data, rnti : %x\n",UL_INFO->nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list[0].rx_ue_information.rnti);
receive_msg4_ack_NB_IoT(mac_inst,UL_INFO->nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list[0].rx_ue_information.rnti);
}
UL_INFO->nb_harq_ind.nb_harq_indication_body.number_of_harqs = 0;
......
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