Commit 28991862 authored by Nick Ho's avatar Nick Ho

Update IF_Module_nb_iot.h to compatible to FAPI, and add the regist function for IF Module

parent 27dd07ea
......@@ -380,17 +380,6 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[0],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[1]);
#if defined(MESSAGE_CHART_GENERATOR_PHY)
MSC_LOG_RX_DISCARDED_MESSAGE(
MSC_PHY_ENB,MSC_PHY_UE,
NULL,0,
"%05u:%02u ULSCH received rnti %x harq id %u round %d",
frame,subframe,
eNB->ulsch[i]->rnti,harq_pid,
eNB->ulsch[i]->harq_processes[harq_pid]->round-1
);
#endif
if (eNB->ulsch[i]->harq_processes[harq_pid]->round== eNB->ulsch[i]->Mlimit)
{
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d ULSCH Mlimit %d reached\n",
......@@ -430,15 +419,7 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
T_INT(harq_pid));
// Delete MSG3 log for the PHICH
#if defined(MESSAGE_CHART_GENERATOR_PHY)
MSC_LOG_RX_MESSAGE(
MSC_PHY_ENB,MSC_PHY_UE,
NULL,0,
"%05u:%02u ULSCH received rnti %x harq id %u",
frame,subframe,
eNB->ulsch[i]->rnti,harq_pid
);
#endif
for (j=0; j<fp->nb_antennas_rx; j++)
//this is the RSSI per RB
eNB->UE_stats[i].UL_rssi[j] =
......@@ -540,11 +521,7 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
UL_Info.UL_SPEC_Info[i].msg3_flagP = NULL;
UL_Info.UE_NUM++;
#ifdef LOCALIZATION
start_meas(&eNB->localization_stats);
aggregate_eNB_UE_localization_stats(eNB,i,frame,subframe,get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 1)/100);
stop_meas(&eNB->localization_stats);
#endif
} // mac_enabled==1
} // Msg3_flag == 0
......@@ -581,33 +558,10 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
0,
0);*/
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] Frame %d subframe %d, sect %d: received ULSCH harq_pid %d for UE %d, ret = %d, CQI CRC Status %d, ACK %d,%d, ulsch_errors %d/%d\n",
eNB->Mod_id,frame,subframe,
eNB->UE_stats[i].sector,
harq_pid,
i,
ret,
eNB->ulsch[i]->harq_processes[harq_pid]->cqi_crc_status,
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[0],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[1],
eNB->UE_stats[i].ulsch_errors[harq_pid],
eNB->UE_stats[i].ulsch_decoding_attempts[harq_pid][0]);
#endif
// dump stats to VCD
if (i==0) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_MCS0+harq_pid,eNB->pusch_stats_mcs[0][(frame*10)+subframe]);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_RB0+harq_pid,eNB->pusch_stats_rb[0][(frame*10)+subframe]);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_ROUND0+harq_pid,eNB->pusch_stats_round[0][(frame*10)+subframe]);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_RSSI0+harq_pid,dB_fixed(eNB->pusch_vars[0]->ulsch_power[0]));
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_RES0+harq_pid,ret);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN0+harq_pid,(frame*10)+subframe);
}
} // ulsch[0] && ulsch[0]->rnti>0 && ulsch[0]->subframe_scheduling_flag == 1
//store the parameter to determine if UL failure or not
UL_Info.UL_SPEC_Info[i].ulsch_consecutive_errors = eNB->UE_stats[i].ulsch_consecutive_errors;
} // ulsch[0] && ulsch[0]->rnti>0 && ulsch[0]->subframe_scheduling_flag == 1
// update ULSCH statistics for tracing
......@@ -680,7 +634,7 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched
// In NB-IoT, there is no DCI for SI, we might use the scheduling infomation from SIB1-NB to get the phyical layer configuration.
if (Sched_Rsp->DCI_Format == DCIFormatN1_RAR) // This is format 1A allocation for RA
if (Sched_Rsp->NB_DCI.DCI_Format == DCIFormatN1_RAR) // This is format 1A allocation for RA
{
// configure dlsch parameters and CCE index
LOG_D(PHY,"Generating dlsch params for RA_RNTI\n");
......@@ -690,11 +644,11 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched
//eNB->dlsch_ra->nCCE[subframe] = dci_alloc->firstCCE;
/*Log for common DCI*/
}
else if ((Sched_Rsp->DCI_Format != DCIFormatN0)&&(Sched_Rsp->DCI_Format != DCIFormatN2_Ind)&&(Sched_Rsp->DCI_Format != DCIFormatN2_Pag))
else if ((Sched_Rsp->NB_DCI.DCI_Format != DCIFormatN0)&&(Sched_Rsp->NB_DCI.DCI_Format != DCIFormatN2_Ind)&&(Sched_Rsp->NB_DCI.DCI_Format != DCIFormatN2_Pag))
{ // this is a normal DLSCH allocation
if (UE_id>=0)
{
LOG_D(PHY,"Generating dlsch params for RNTI %x\n",Sched_Rsp->rntiP);
LOG_D(PHY,"Generating dlsch params for RNTI %x\n",Sched_Rsp->NB_DCI.RNTI);
//NB_generate_eNB_dlsch_params_from_dci();
/*Log for remaining DCI*/
......@@ -706,7 +660,7 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched
else
{
LOG_D(PHY,"[eNB %"PRIu8"][PDSCH] Frame %d : No UE_id with corresponding rnti %"PRIx16", dropping DLSCH\n",
eNB->Mod_id,frame,Sched_Rsp->rntiP);
eNB->Mod_id,frame,Sched_Rsp->NB_DCI.RNTI);
}
}
......@@ -722,7 +676,7 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_
//LOG for ULSCH DCI Resource allocation
if ((Sched_Rsp->rntiP >= CBA_RNTI) && (Sched_Rsp->rntiP < P_RNTI))
if ((Sched_Rsp->NB_DCI.RNTI >= CBA_RNTI) && (Sched_Rsp->NB_DCI.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;
......@@ -787,7 +741,7 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
{
/* Not test yet , mutex_l2, cond_l2, instance_cnt_l2
/*Not test yet , mutex_l2, cond_l2, instance_cnt_l2
if(wait_on_condition(&proc->mutex_l2,&proc->cond_l2,&proc->instance_cnt_l2,"eNB_L2_thread") < 0)
break;*/
......@@ -822,9 +776,9 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
/*Loop over all the dci to generate DLSCH allocation, there is only 1 or 2 DCIs for NB-IoT in the same time*/
/*Also Packed the DCI here*/
if (Sched_Rsp->rntiP<= P_RNTI)
if (Sched_Rsp->NB_DCI.RNTI<= P_RNTI)
{
UE_id = find_ue((int16_t)Sched_Rsp->rntiP,eNB);
UE_id = find_ue((int16_t)Sched_Rsp->NB_DCI.RNTI,eNB);
}
else
UE_id=0;
......@@ -837,22 +791,20 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
//dci_alloc = &DCI_pdu->dci_alloc[i];
if (Sched_Rsp->DCI_Format == DCIFormatN0) // this is a ULSCH allocation
if (Sched_Rsp->NB_DCI.DCI_Format == DCIFormatN0) // this is a ULSCH allocation
{
UE_id = find_ue((int16_t)Sched_Rsp->rntiP,eNB);
UE_id = find_ue((int16_t)Sched_Rsp->NB_DCI.RNTI,eNB);
NB_generate_eNB_ulsch_params(eNB,proc,Sched_Rsp,UE_id);
}
/*If we have DCI to generate do it now TODO : have a generate dci top for NB_IoT */
NB_generate_dci_top();
if(Sched_Rsp->pdu_payload)
if(Sched_Rsp->NB_DLSCH.ndlsch_pdu_payload||Sched_Rsp->NB_DLSCH.nbcch_pdu_payload)
{
/*TODO: MPDSCH procedures for NB-IoT*/
//npdsch_procedures();
}
if (do_meas==1)
stop_meas(&eNB->phy_proc_tx);
}
}
\ No newline at end of file
......@@ -38,3 +38,11 @@ void UL_indication(UL_IND_t UL_INFO)
void Schedule_Response(Sched_Rsp_t Sched_INFO){
//todo
}
int IF_Module_init(IF_Module_t *if_inst){
if_inst->UL_indication = UL_indication;
if_inst->Schedule_Response = Schedule_Response;
return 0;
}
\ No newline at end of file
/*This is the interface module between PHY
* this will trigger the corresponding function in MAC or PHY layer according to the type of the message
*Provided the FAPI style interface structures for P7.
*
*
*
......@@ -9,32 +9,39 @@
#include "openair1/PHY/LTE_TRANSPORT/defs_nb_iot.h"
#define SCH_PAYLOAD_SIZE_MAX 4096
#define BCCH_PAYLOAD_SIZE_MAX 128
#define NUMBER_OF_UE_MAX 20
// uplink subframe P7
/*UL_SPEC_t:
* A struture mainly describes the UE specific information. (for NB_rx_sdu)
* Corresponding to thhe RX_ULSCH.indication, CRC.inidcation, NB_HARQ.indication in FAPI
*/
typedef struct{
//flag to show which message is
uint8_t UL_MSG_flag;
//rnti
rnti_t rntiP;
//Pointer to sdu
uint8_t *sdu;
//Pointer to sdu length
uint16_t sdu_lenP;
//HARQ ID
int harq_pidP;
//MSG3 flag
uint8_t *msg3_flagP;
//ACK/NAK
boolean_t NAK;
// ULSCH consecutive error
uint32_t ulsch_consecutive_errors;
//rnti
rnti_t rntiP;
//Pointer to sdu
uint8_t *sdu;
//Pointer to sdu length
uint16_t sdu_lenP;
//HARQ ID
int harq_pidP;
//MSG3 flag
uint8_t *msg3_flagP;
//CRC indication for the message is corrected or not for the Uplink HARQ
uint8_t crc_ind;
//This ACK NACK is for the Downlink HARQ received by the NPUSCH from UE
uint8_t NAK;
}UL_SPEC_t;
//UL_IND
/*UL_IND_t:
* A structure handles all the uplink information.
*/
typedef struct{
/*Start at the common part*/
......@@ -52,43 +59,118 @@ typedef struct{
int UE_NUM;
/*preamble part*/
//index of the preamble
uint16_t preamble_index;
//timing offset by PHY
int16_t timing_offset;
/*UE specific part*/
UL_SPEC_t UL_SPEC_Info[NUMBER_OF_UE_MAX];
}UL_IND_t;
// Downlink subframe P7
typedef union{
//The length (in bytes)
uint16_t Length;
//PDU index
uint16_t PDU_index;
//Transmission Power
uint16_t Trans_Power;
//HYPER SFN 2lsbs
uint16_t HyperSFN2lsbs;
//NPBCH pdu payload
uint8_t npbch_pdu_payload[4];
}npbch_t;
typedef union{
//The length (in bytes)
uint16_t Length;
//PDU index
uint16_t PDU_index;
//start symbol 0-4 0 for guard-band and standalone operating
uint8_t start_symbol;
//RNTI type,0 = BCCH(SIB), 1 for DL data
uint8_t RNTI_type;
// RNTI
uint16_t RNTI;
// SIB payload
uint8_t nbcch_pdu_payload[BCCH_PAYLOAD_SIZE_MAX];
// NDLSCH payload
uint8_t ndlsch_pdu_payload[SCH_PAYLOAD_SIZE_MAX];
}npdsch_t;
typedef union{
// The length (in bytes)
uint16_t Length;
// PDU index
uint16_t PDU_index;
// NCCE index value 0 -> 1
uint8_t NCCE_index;
// Aggregation level
uint8_t aggregation;
// start symbol
uint8_t start_symbol;
// RNTI type,0 = TC-RNTI, 1 = RA-RNTI, 2 = P-RNTI 3 = other
uint8_t RNTI_type;
// RNTI
uint16_t RNTI;
// Scrambliing re-initialization batch index from FAPI specs (1-4)
uint8_t batch_index;
// NRS antenna ports assumed by the UE from FAPI specs (1-2)
uint8_t num_antenna;
// Number of DCI
uint8_t Num_dci;
// Format of DCI
DCI_format_NB_t DCI_Format;
// Content of DCI
DCI_CONTENT *DCI_Content;
}npdcch_t;
typedef struct{
/*Common part*/
/*Start at the common part*/
//Module ID
module_id_t module_idP;
//CC ID
int CC_id;
//frame
frame_t frameP;
//subframe
sub_frame_t subframeP;
rnti_t rntiP;
npdcch_t NB_DCI;
/*Downlink data*/
//TB size for Downlink data
uint8_t TBindex;
//PDU for Downlink
uint8_t *pdu_payload;
npdsch_t NB_DLSCH;
/*DCI start*/
// Format of DCI
uint8_t aggregation;
uint8_t Num_dci;
DCI_format_NB_t DCI_Format;
// Content of DCI
DCI_CONTENT *DCI_Content;
npbch_t NB_BCH;
}Sched_Rsp_t;
// Calvin 20170531 start
/*IF_Module_t*/
typedef struct IF_Module_s{
void (*UL_indication)(UL_IND_t UL_INFO);
void (*Schedule_Response)(Sched_Rsp_t Sched_INFO);
}IF_Module_t;
/*Initial */
int IF_Module_init(IF_Module_t *if_inst);
// Calvin 20170531 end
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
void UL_indication(UL_IND_t UL_INFO);
......
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