Commit 6768c7da authored by Nick Ho's avatar Nick Ho

modify the rxtx approach code compiled

parent abad0f86
......@@ -44,6 +44,7 @@ typedef enum
DCIFormatN1,
DCIFormatN1_RA,
DCIFormatN1_RAR,
DCIFormatN2,
DCIFormatN2_Ind,
DCIFormatN2_Pag,
}DCI_format_NB_t;
......
......@@ -68,8 +68,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
uint16_t rnti,
DCI_format_NB_t dci_format,
uint8_t UE_id,
uint8_t aggregation,
uint8_t Num_dci
uint8_t aggregation
)
{
......@@ -120,7 +119,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
((DCIN0_t *)ULSCH_DCI_NB)->ndi =ndi;
((DCIN0_t *)ULSCH_DCI_NB)->DCIRep =DCIRep;
eNB->DCI_pdu->Num_dci = Num_dci;
eNB->DCI_pdu->Num_dci++;
NB_add_dci(eNB->DCI_pdu,ULSCH_DCI_NB,rnti,sizeof(DCIN0_t),aggregation,sizeof_DCIN0_t,DCIFormatN0);
......@@ -147,8 +146,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
DCI_format_NB_t dci_format,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t Num_dci
uint8_t aggregation
)
{
......@@ -221,7 +219,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
((DCIN1_RAR_t *)DLSCH_DCI_NB)->HARQackRes =HARQackRes;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->DCIRep =DCIRep;
eNB->DCI_pdu->Num_dci = Num_dci;
eNB->DCI_pdu->Num_dci++;
NB_add_dci(eNB->DCI_pdu,DLSCH_DCI_NB,rnti,sizeof(DCIN1_RAR_t),aggregation,sizeof_DCIN1_RAR_t,DCIFormatN1_RAR);
......@@ -255,7 +253,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
((DCIN1_t *)DLSCH_DCI_NB)->HARQackRes =HARQackRes;
((DCIN1_t *)DLSCH_DCI_NB)->DCIRep =DCIRep;
eNB->DCI_pdu->Num_dci = Num_dci;
//eNB->DCI_pdu->Num_dci = Num_dci;
NB_add_dci(eNB->DCI_pdu,DLSCH_DCI_NB,rnti,sizeof(DCIN1_t),aggregation,sizeof_DCIN1_t,DCIFormatN1);
......@@ -272,7 +270,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
((DCIN2_Ind_t *)DLSCH_DCI_NB)->directIndInf =directIndInf;
((DCIN2_Ind_t *)DLSCH_DCI_NB)->resInfoBits =resInfoBits;
eNB->DCI_pdu->Num_dci = Num_dci;
eNB->DCI_pdu->Num_dci++;
NB_add_dci(eNB->DCI_pdu,DLSCH_DCI_NB,rnti,sizeof(DCIN2_Ind_t),aggregation,sizeof_DCIN2_Ind_t,DCIFormatN2_Ind);
......@@ -294,7 +292,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
((DCIN2_Pag_t *)DLSCH_DCI_NB)->RepNum =RepNum;
((DCIN2_Pag_t *)DLSCH_DCI_NB)->DCIRep =DCIRep;
eNB->DCI_pdu->Num_dci = Num_dci;
eNB->DCI_pdu->Num_dci++;
NB_add_dci(eNB->DCI_pdu,DLSCH_DCI_NB,rnti,sizeof(DCIN2_Pag_t),aggregation,sizeof_DCIN2_Pag_t,DCIFormatN2_Pag);
......
......@@ -99,8 +99,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
uint16_t rnti,
DCI_format_NB_t dci_format,
uint8_t UE_id,
uint8_t aggregation,
uint8_t Num_dci
uint8_t aggregation
);
/*Use the DL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
......@@ -111,8 +110,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
DCI_format_NB_t dci_format,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t Num_dci
uint8_t aggregation
);
......
#include "../SCHED/IF_Module_L1_primitives_nb_iot.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "PHY/vars.h"
// do the schedule response and trigger the TX
void schedule_response(Sched_Rsp_t *Sched_INFO)
{
PHY_VARS_eNB *eNB = PHY_vars_eNB_g[0][Sched_INFO->CC_id];
eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
int UE_id = 0;
int i;
module_id_t Mod_id = Sched_INFO->module_id;
uint8_t CC_id = Sched_INFO->CC_id;
nfapi_dl_config_request_body_t *DL_req = &Sched_INFO->DL_req;
nfapi_ul_config_request_t *UL_req = &Sched_INFO->UL_req;
nfapi_hi_dci0_request_body_t *HI_DCI0_req = &Sched_INFO->HI_DCI0_req;
frame_t frame = Sched_INFO->frame;
sub_frame_t subframe = Sched_INFO->subframe;
uint8_t number_dl_pdu = DL_req->number_pdu;
uint8_t number_ul_pdu = UL_req->ul_config_request_body.number_of_pdus;
uint8_t number_ul_dci = HI_DCI0_req->number_of_dci;
uint8_t number_pdsch_rnti = DL_req->number_pdsch_rnti; // for the moment not used
// at most 2 pdus in the case of NPDCCH
nfapi_dl_config_request_pdu_t *dl_config_pdu;
nfapi_ul_config_request_pdu_t *ul_config_pdu;
nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
for (i=0;i<number_dl_pdu;i++)
{
dl_config_pdu = &DL_req->dl_config_pdu_list[i];
switch (dl_config_pdu->pdu_type)
{
case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
NB_generate_eNB_dlsch_params(eNB,proc,dl_config_pdu);
break;
case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
// Do nothing for the moment
break;
case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
// Do the distinction between SIB (type 0) and other downlink data (type 1)
//handle_nfapi_dlsch_pdu(eNB,proc,dl_config_pdu,Sched_INFO->sdu[i]);
break;
}
}
for (i=0;i<number_ul_dci;i++)
{
hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[i];
switch (hi_dci0_pdu->pdu_type)
{
case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
NB_generate_eNB_ulsch_params(eNB,proc,hi_dci0_pdu);
break;
}
}
NB_phy_procedures_eNB_TX(eNB,proc,NULL);
//to be integrated in the scheduling procedure of L1
void schedule_response(Sched_Rsp_t *Sched_INFO){
//todo
}
void PHY_config_req(PHY_Config_t* config_INFO){
......
......@@ -18,10 +18,10 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, UL
void NB_common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
/*Generate the ulsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/
void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_Rsp_t *Sched_Rsp,const int UE_id);
void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu);
/*Generate the dlsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched_Rsp_t *Sched_Rsp,const int UE_id);
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi_dl_config_request_pdu_t *dl_config_pdu);
/*Process all the scheduling result from MAC and also common signals.*/
void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int do_meas);
......
......@@ -447,266 +447,146 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,UL_
/*Generate eNB dlsch params for NB-IoT, modify the input to the Sched Rsp variable*/
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched_Rsp_t *Sched_Rsp,const int UE_id)
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi_dl_config_request_pdu_t *dl_config_pdu)
{
int UE_id = -1;
NB_DL_FRAME_PARMS *fp=&eNB->frame_parms_nb_iot;
int frame = proc->frame_tx;
int subframe = proc->subframe_tx;
DCI_CONTENT DCI_Content[2]; //max number of DCI in a single subframe = 2 (may put this as a global variable)
DCI_CONTENT *DCI_Content;
DCI_format_NB_t DCI_format;
//DCI_Content = (DCI_CONTENT*) malloc(sizeof(DCI_CONTENT));
DCI_Content = (DCI_CONTENT*) malloc(sizeof(DCI_CONTENT));
// find UE id here
// In NB-IoT, there is no DCI for SI, we might use the scheduling infomation from SIB1-NB to get the phyical layer configuration.
//mapping the fapi parameters to the oai parameters
for (int i = 0; i< Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci; i++){
switch (Sched_Rsp->NB_DL.NB_DCI->DCI_Format){
case DCIFormatN1_RAR:
//DCI format N1 to RAR
DCI_Content[i].DCIN1_RAR.type = 1;
//check if this work
DCI_Content[i].DCIN1_RAR.orderIndicator = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication;
DCI_Content[i].DCIN1_RAR.Scheddly = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.scheduling_delay;
DCI_Content[i].DCIN1_RAR.ResAssign = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.resource_assignment;
DCI_Content[i].DCIN1_RAR.mcs = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.mcs;
DCI_Content[i].DCIN1_RAR.ndi = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.new_data_indicator;
DCI_Content[i].DCIN1_RAR.HARQackRes = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource;
DCI_Content[i].DCIN1_RAR.DCIRep = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number;
// configure dlsch parameters and CCE index (fill the dlsch_ra structure???)
LOG_D(PHY,"Generating dlsch params for RA_RNTI\n");
// fill the dlsch_ra_NB sructure for RAR, and packed the DCI PDU
NB_generate_eNB_dlsch_params_from_dci(eNB,
frame,
subframe,
&DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCIFormatN1_RAR,
&eNB->dlsch_ra_NB,
fp,
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci
);
eNB->dlsch_ra_NB->nCCE[subframe] = eNB->DCI_pdu->dci_alloc[i].firstCCE;
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resource for common DCI (RA) => %"PRIu8"\n",eNB->Mod_id,frame,subframe,
eNB->dlsch_ra_NB->nCCE[subframe]);
break;
case DCIFormatN1:
if(UE_id >= 0)
{
//DCI format N1 to DLSCH
DCI_Content[i].DCIN1.type = 1;
DCI_Content[i].DCIN1.orderIndicator = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication;
DCI_Content[i].DCIN1.Scheddly = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.scheduling_delay;
DCI_Content[i].DCIN1.ResAssign = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.resource_assignment;
DCI_Content[i].DCIN1.mcs = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.mcs;
DCI_Content[i].DCIN1.ndi = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.new_data_indicator;
DCI_Content[i].DCIN1.HARQackRes = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource;
DCI_Content[i].DCIN1.DCIRep = Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number;
//fill the ndlsch structure for UE
//parameters we don't consider pdsch config dedicated since not calling the phy config dedicated step2
NB_generate_eNB_dlsch_params_from_dci(eNB,
frame,
subframe,
&DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCIFormatN1,
eNB->ndlsch[(uint8_t)UE_id],
fp,
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci
);
eNB->ndlsch[(uint8_t)UE_id]->nCCE[subframe] = eNB->DCI_pdu->dci_alloc[i].firstCCE;
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resource for ue DCI (PDSCH %"PRIx16") => %"PRIu8"\n",eNB->Mod_id,frame,subframe,
eNB->DCI_pdu->dci_alloc[i].rnti,eNB->ndlsch[(uint8_t)UE_id]->nCCE[subframe]);
}
else
// check DCI format is N1 or N2
if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_format == 0)
{
//check DCI format N1 is for RAR or for other uespec data , ra_rnti = 2 in FAPI specs table 4-45
if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti_type == 2)
{
LOG_D(PHY,"[eNB %"PRIu8"][NPDSCH] Frame %d : No UE_id with corresponding rnti %"PRIx16", dropping NDLSCH\n",
eNB->Mod_id,frame,eNB->DCI_pdu->dci_alloc[i].rnti);
DCI_format = DCIFormatN1_RAR;
//DCI format N1 to RAR
DCI_Content->DCIN1_RAR.type = 1;
DCI_Content->DCIN1_RAR.orderIndicator = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication;
DCI_Content->DCIN1_RAR.Scheddly = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.scheduling_delay;
DCI_Content->DCIN1_RAR.ResAssign = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.resource_assignment;
DCI_Content->DCIN1_RAR.mcs = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.mcs;
DCI_Content->DCIN1_RAR.ndi = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.new_data_indicator;
DCI_Content->DCIN1_RAR.HARQackRes = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource;
DCI_Content->DCIN1_RAR.DCIRep = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number;
// configure dlsch parameters and CCE index (fill the dlsch_ra_NB structure)
LOG_D(PHY,"Generating dlsch params for RA_RNTI\n");
// fill the dlsch_ra_NB sructure for RAR, and packed the DCI PDU
NB_generate_eNB_dlsch_params_from_dci(eNB,
frame,
subframe,
DCI_Content,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCI_format,
&eNB->dlsch_ra_NB,
fp,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level
);
//eNB->dlsch_ra_NB->nCCE[subframe] = eNB->DCI_pdu->dci_alloc.firstCCE;
}
break;
/*TODO reserve for the N2 DCI*/
case DCIFormatN2_Pag:
LOG_I(PHY, "Paging is not implemented, DCIFormatN2_Pag cannot be elaborated\n");
break;
else
{
if(UE_id >= 0) // DCI format N1 to uespec DLSCH
{
//DCI format N1 to DLSCH
DCI_Content->DCIN1.type = 1;
DCI_Content->DCIN1.orderIndicator = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication;
DCI_Content->DCIN1.Scheddly = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.scheduling_delay;
DCI_Content->DCIN1.ResAssign = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.resource_assignment;
DCI_Content->DCIN1.mcs = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.mcs;
DCI_Content->DCIN1.ndi = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.new_data_indicator;
DCI_Content->DCIN1.HARQackRes = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource;
DCI_Content->DCIN1.DCIRep = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number;
//fill the ndlsch structure for UE
//parameters we don't consider pdsch config dedicated since not calling the phy config dedicated step2
NB_generate_eNB_dlsch_params_from_dci(eNB,
frame,
subframe,
DCI_Content,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCI_format,
eNB->ndlsch[(uint8_t)UE_id],
fp,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level
);
//eNB->ndlsch[(uint8_t)UE_id]->nCCE[subframe] = eNB->DCI_pdu->dci_alloc[i].firstCCE;
}
}
else
{
LOG_D(PHY,"[eNB %"PRIu8"][NPDSCH] Frame %d : No UE_id with corresponding rnti %"PRIx16", dropping NDLSCH\n",
eNB->Mod_id,frame,dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti);
}
}
}
else if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_format == 1)
{
DCI_format = DCIFormatN2;
LOG_D(PHY,"Paging procedure not implemented\n");
}
else
LOG_E(PHY,"unknown DCI format for NB-IoT DL\n");
}
}
}
void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_Rsp_t *Sched_Rsp,const int UE_id) {
void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu) {
int UE_id = -1;
int harq_pid = 0;
DCI_CONTENT DCI_Content[2]; //max number of DCI in a single subframe = 2 (may put this as a global variable)
for(int i = 0; i<Sched_Rsp->NB_DL.NB_DCI->UL_DCI.number_of_dci; i++)
{
DCI_CONTENT *DCI_Content;
DCI_Content = (DCI_CONTENT*) malloc(sizeof(DCI_CONTENT));
//mapping the fapi parameters to the OAI parameters
DCI_Content[i].DCIN0.type = 0;
DCI_Content[i].DCIN0.scind = Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.subcarrier_indication;
DCI_Content[i].DCIN0.ResAssign = Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.subcarrier_indication;
DCI_Content[i].DCIN0.mcs = Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.mcs;
DCI_Content[i].DCIN0.ndi = Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.new_data_indicator;
DCI_Content[i].DCIN0.Scheddly = Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.scheduling_delay;
DCI_Content[i].DCIN0.RepNum = Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.repetition_number;
DCI_Content[i].DCIN0.rv = Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.redudancy_version;
DCI_Content[i].DCIN0.DCIRep = Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number;
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.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;
DCI_Content->DCIN0.RepNum = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.repetition_number;
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;
/*Log for generate ULSCH DCI*/
NB_generate_eNB_ulsch_params_from_dci(eNB,
proc,
&DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti,
DCI_Content,
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti,
DCIFormatN0,
UE_id,
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.number_of_dci
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level
);
//LOG for ULSCH DCI Resource allocation
//CBA is not used in NB-IoT
// if ((Sched_Rsp->NB_DL.NB_DCI.UL_DCI.npdcch_dci_pdu_rel13.rnti >= CBA_RNTI) && (Sched_Rsp->NB_DL.NB_DCI.UL_DCI.npdcch_dci_pdu_rel13.rnti < P_RNTI))
// eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->subframe_cba_scheduling_flag = 1;
// else
eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
}
}
/* process the following message
* mainly for filling DLSCH and ULSCH data structures in PHY_vars
* if there is a DCI we do the packing
*
*/
void process_schedule_rsp(Sched_Rsp_t *sched_rsp,
PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc)
{
int UE_id = 0;
//First check for DCI
if(sched_rsp->NB_DL.NB_DCI != NULL)
{
/*
* In NB-IoT we could have at most 2 DCI but not of two different type (only 2 for the DL or two for the UL)
* DCI N0 is the only format for UL
*
*/
if(Sched_Rsp->NB_DL.NB_DCI->DCI_Format != DCIFormatN0) //this is a DLSCH allocation
{
/*Loop over all the dci to generate DLSCH allocation, there is only 1 or 2 DCIs for NB-IoT in the same time*/
// Add dci fapi structure for contain two dcis
/*Also Packed the DCI here*/
for(int i= 0; i< Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci; i++)
{
if (Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.rnti<= P_RNTI)
{
//is not system iformation but cound be paging
//in any case we generate dlsch for not system information
UE_id = find_ue_NB((int16_t)Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list[i].npdcch_pdu.npdcch_pdu_rel13.rnti,eNB);
if (UE_id<0)
LOG_E(PHY, "process_schedule_rsp: UE_id for DL_DCI is negative\n");
}
else
UE_id=0;
//inside we have nFAPI to OAI parameters
NB_generate_eNB_dlsch_params(eNB,proc,Sched_Rsp,UE_id);
}
}
else //ULSCH allocation
{
/* Apply physicalConfigDedicated if needed, don't know if needed in NB-IoT or not
This is for UEs that have received this IE, which changes these DL and UL configuration, we apply after a delay for the eNodeB UL parameters
phy_config_dedicated_eNB_step2(eNB);*/
//HI_DCI0_request
for (int i = 0; Sched_Rsp->NB_DL.NB_DCI->UL_DCI.number_of_dci; i ++)
{
UE_id = find_ue_NB((int16_t)Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list[i].npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti,eNB);
if (UE_id<0)
LOG_E(PHY, "process_schedule_rsp: UE_id for UL_DCI is negative\n");
NB_generate_eNB_ulsch_params(eNB,proc,Sched_Rsp,UE_id);
}
}
}
else if(sched_rsp->NB_DL.NB_DLSCH != NULL)
{
//check for the SI (FAPI specs rnti_type = 1 Other or rnti_type = 0 BCCH information)
if(sched_rsp->NB_DL.NB_DLSCH->ndlsch.rnti_type == 0)
{
//TODO fill the dlsch_SI, in NB-IoT you don't have the DCI to manage system information
}
else
{
//TODO fill dlsch ue data
}
}
else if(sched_rsp->NB_DL.NB_UL_config != NULL)
{
//TODO : manage the configuration for UL
/*
* UL_CONFIG.request body
* pdu_type = 16 (NULSCH PDU)
* pdu_type = 17 (NRACH PDU) just for nprach configuration change (not managed here)
*
*/
//NULSCH PDU (FAPI specs table 4-49)
if(sched_rsp->NB_DL.NB_UL_config->ulsch_pdu.pdu_type == 16)
{
}
}
else
LOG_D(PHY, "No DL data contained in the Sched_rsp!!\n");
};
/*
* for NB-IoT ndlsch procedure
......@@ -1016,8 +896,6 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
int **txdataF = eNB->common_vars.txdataF[0];
Sched_Rsp_t *sched_rsp;
// are needed??? (maybe not)
//uint8_t num_npdcch_symbols = 0;
......@@ -1025,17 +903,6 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
start_meas(&eNB->phy_proc_tx);
//UE_stats can be not considered
// for(i = 0;i<NUMBER_OF_UE_MAX;i++)
// {
// if((frame==0)&&(subframe==0))
// {
// if(eNB->UE_stats[i].crnti > 0)
// LOG_I(PHY,"UE%d : rnti %x\n",i,eNB->UE_stats[i].crnti);
// }
// }
//ULSCH consecutive error count from Ue_stats reached has been deleted
/*called the original scheduler "eNB_dlsch_ulsch_scheduler" now is no more done here but is triggered directly from UL_Indication (IF-Module Function)*/
// clear the transmit data array for the current subframe
......@@ -1046,31 +913,10 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
}
//follow similar approach of (eNB_thread_prach)
while(!oai_exit)
{
if(oai_exit) break;
//generate NPSS/NSSS
NB_common_signal_procedures(eNB,proc);
//Not test yet , mutex_l2, cond_l2, instance_cnt_l2
//cond_l2 should be given by sched_rsp after the scheduling
//WE should unlock this thread through the Schedule_rsp content
if(wait_on_condition(&proc->mutex_l2,&proc->cond_l2,&proc->instance_cnt_l2,"eNB_L2_thread") < 0)
break;
/*At this point it means that we have the Sched_rsp structure filled by the MAC scheduler*/
//Take the Sched_rsp structures from the shared structures
if(Sched_Rsp == NULL)
LOG_E(PHY, "We don't have the Sched_Rsp_t structure ready\n");
sched_rsp = Sched_Rsp;
/*Generate MIB
*
*
......@@ -1094,42 +940,34 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
*in general this RB-ID should be w.r.t LTE bandwidht???
**allowed indexes for Nb-IoT PRBs are reported in R&Shwartz pag 9
*
*should add new condition here
*/
if((subframe==0) && (sched_rsp->NB_DL.NB_BCH->MIB_pdu.segments[0].segment_data)!=NULL)
if(subframe==0)
{
generate_npbch(&eNB->npbch,
/*generate_npbch(&eNB->npbch,
txdataF,
AMP,
fp,
&sched_rsp->NB_DL.NB_BCH->MIB_pdu.segments[0].segment_data,
frame%64,
fp->NB_IoT_RB_ID
);
);*/
}
/*process the schedule response
* fill the PHY config structures
* */
process_schedule_rsp(sched_rsp, eNB, proc);
/*
* Generate BCCH transmission (System Information)
*/
// check for BCCH
//rnti_type = 0 BCCH information
//rnti_type = 1 Other
if(sched_rsp->NB_DL.NB_DLSCH->ndlsch.rnti_type == 0 && (sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_data)!= NULL)
{
/*TODO: NPDSCH procedures for BCCH for NB-IoT*/
/*TODO: NPDSCH procedures for BCCH for NB-IoT
npdsch_procedures(eNB,
proc,
eNB->dlsch_SI_NB, //should be filled ?? (in the old implementation was filled when from DCI we generate_dlsch_params
sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_length,
sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_data);
sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_data);*/
}
//no HARQ pid (we have only 1 single process for each user)
......@@ -1153,34 +991,14 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
}
//no PHICH in NB-IoT
//num_pdcch_symbols?? (maybe later when we have the DCI)
//now we should check if Sched_Rsp contains data
//rnti_type = 0 BCCH information
//rnti_type = 1 Other
if(Sched_Rsp->NB_DL.NB_DLSCH->ndlsch.rnti_type == 1 && (sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_data)!= NULL)
{
//we not need between RAR PDUS
/*TODO: NPDSCH procedures for BCCH for NB-IoT*/
//npdsch_procedures();
}
/*If we have DCI to generate do it now TODO : have a generate dci top for NB_IoT */
//to be modified but inside we have the nuew function for dci transmission
generate_dci_top_NB();
//generate_dci_top_NB();
//maybe not needed
if (release_thread(&proc->mutex_l2,&proc->instance_cnt_l2,"eNB_L2_thread") < 0) break;
}
......
......@@ -127,10 +127,10 @@ typedef struct{
/*Uplink data part*/
/*indication of the uplink data*/
nfapi_ul_config_nulsch_pdu NULSCH;
/*Uplink data PDU*/
nfapi_rx_indication_body_t RX_NPUSCH;
/*indication of the harq feedback*/
nfapi_nb_harq_indication_t nb_harq_ind;
/*indication of the uplink data PDU*/
nfapi_rx_indication_body_t RX_NPUSCH;
/*crc_indication*/
nfapi_crc_indication_body_t crc_ind;
......@@ -138,67 +138,28 @@ typedef struct{
// Downlink subframe P7
typedef struct{
/*Indicate the MIB PDU*/
nfapi_dl_config_nbch_pdu_rel13_t nbch;
/*MIB PDU*/
nfapi_tx_request_pdu_t MIB_pdu;
}npbch_t;
typedef struct{
/*indicate the NPDSCH PDU*/
nfapi_dl_config_ndlsch_pdu_rel13_t ndlsch;
/*NPDSCH PDU*/
nfapi_tx_request_pdu_t NPDSCH_pdu;
}npdsch_t;
typedef struct{
// sinces FAPI spec didn't explain the format for the DCI clearly
DCI_format_NB_t DCI_Format;
/*DL DCI, it contains the DCI list and the other useful information*/
nfapi_dl_config_request_body_t DL_DCI;
/*UL DCI*/
nfapi_hi_dci0_request_body_t UL_DCI;
}npdcch_t;
typedef struct{
nfapi_ul_config_request_pdu_t ulsch_pdu;
}nulsch_t;
typedef struct{
// these structures contains both instruction and PDUs itself
npdcch_t *NB_DCI;
npdsch_t *NB_DLSCH;
npbch_t *NB_BCH;
nulsch_t *NB_UL_config;
}NB_DL_t;
typedef struct{
/*Start at the common part*/
//Module ID
module_id_t module_idP;
module_id_t module_id;
//CC ID
int CC_id;
//frame
frame_t frameP;
frame_t frame;
//subframe
sub_frame_t subframeP;
sub_frame_t subframe;
NB_DL_t NB_DL;
/// nFAPI DL Config Request
nfapi_dl_config_request_body_t *DL_req;
/// nFAPI UL Config Request
nfapi_ul_config_request_t *UL_req;
/// nFAPI HI_DCI Request
nfapi_hi_dci0_request_body_t *HI_DCI0_req;
/// Pointers to DL SDUs
uint8_t **sdu;
}Sched_Rsp_t;
......
......@@ -608,17 +608,10 @@ static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_
if(if_inst->UL_indication) if_inst->UL_indication(UL_INFO);
// *****************************************
// TX processing for subframe n+4
// run PHY TX procedures the one after the other for all CCs to avoid race conditions
// (may be relaxed in the future for performance reasons)
// *****************************************
//if (wait_CCs(proc)<0) return(-1);
// phy_proceduers_eNB_TX will be triggered at schedule response
if (oai_exit) return(-1);
NB_phy_procedures_eNB_TX(eNB,proc,NULL);
if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1);
......
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