Commit c86b6840 authored by Nick Ho's avatar Nick Ho

Use FAPI structures to present the IF Module

parent f822c17d
......@@ -172,13 +172,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
/*NB-IoT IF module Common setting*/
UL_IND_t UL_Info;
UL_IND_t UL_INFO;
UL_Info.module_id = eNB->Mod_id;
UL_Info.CC_id = eNB->CC_id;
UL_Info.frame = frame;
UL_Info.subframe = subframe;
UL_INFO.module_id = eNB->Mod_id;
UL_INFO.CC_id = eNB->CC_id;
UL_INFO.frame = frame;
UL_INFO.subframe = subframe;
T(T_ENB_PHY_UL_TICK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe));
......@@ -333,14 +333,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
if (eNB->mac_enabled == 1)
{
//instead rx_sdu to report The Uplink data not received successfully to MAC
UL_Info.UL_SPEC_Info[i].RNTI= eNB->ulsch[i]->rnti;
UL_Info.UL_SPEC_Info[i].sdu = NULL;
UL_Info.UL_SPEC_Info[i].sdu_lenP = 0;
UL_Info.UL_SPEC_Info[i].harq_pidP = harq_pid;
UL_Info.UL_SPEC_Info[i].msg3_flagP = &eNB->ulsch[i]->Msg3_flag;
UL_Info.UL_SPEC_Info[i].NAK=1;
UL_Info.UE_NUM++;
(UL_INFO.crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 1;
UL_INFO.crc_ind.number_of_crcs++;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->data= NULL;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = 0;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO.RX_NPUSCH.number_of_pdus++;
}
}
}
......@@ -376,12 +375,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
if (eNB->mac_enabled)
{
// store successful MSG3 in UL_Info instead rx_sdu
UL_Info.UL_SPEC_Info[i].RNTI= eNB->ulsch[i]->rnti;
UL_Info.UL_SPEC_Info[i].sdu = eNB->ulsch[i]->harq_processes[harq_pid]->b;
UL_Info.UL_SPEC_Info[i].sdu_lenP = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
UL_Info.UL_SPEC_Info[i].harq_pidP = harq_pid;
UL_Info.UL_SPEC_Info[i].msg3_flagP = &eNB->ulsch[i]->Msg3_flag;
UL_Info.UE_NUM++;
(UL_INFO.crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0;
UL_INFO.crc_ind.number_of_crcs++;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->data = eNB->ulsch[i]->harq_processes[harq_pid]->b;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO.RX_NPUSCH.number_of_pdus++;
}
/* Need check if this needed in NB-IoT
......@@ -435,12 +435,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
if (eNB->mac_enabled==1)
{
// store successful Uplink data in UL_Info instead rx_sdu
UL_Info.UL_SPEC_Info[i].RNTI= eNB->ulsch[i]->rnti;
UL_Info.UL_SPEC_Info[i].sdu = eNB->ulsch[i]->harq_processes[harq_pid]->b;
UL_Info.UL_SPEC_Info[i].sdu_lenP = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
UL_Info.UL_SPEC_Info[i].harq_pidP = harq_pid;
UL_Info.UL_SPEC_Info[i].msg3_flagP = NULL;
UL_Info.UE_NUM++;
(UL_INFO.crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0;
UL_INFO.crc_ind.number_of_crcs++;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->data = eNB->ulsch[i]->harq_processes[harq_pid]->b;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO.RX_NPUSCH.number_of_pdus++;
} // mac_enabled==1
} // Msg3_flag == 0
......@@ -476,7 +477,7 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
/*Exact not here, but use to debug*/
UL_indication(UL_Info);
if_inst->UL_indication(UL_INFO);
}
......@@ -506,7 +507,7 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched
{ // this is a normal DLSCH allocation
if (UE_id>=0)
{
LOG_D(PHY,"Generating dlsch params for RNTI %x\n",Sched_Rsp->NB_DL.NB_DCI.RNTI);
LOG_D(PHY,"Generating dlsch params for RNTI %x\n",Sched_Rsp->NB_DL.NB_DCI.DL_DCI.npdcch_pdu_rel13.rnti);
//NB_generate_eNB_dlsch_params_from_dci();
/*Log for remaining DCI*/
......@@ -518,7 +519,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->NB_DL.NB_DCI.RNTI);
eNB->Mod_id,frame,Sched_Rsp->NB_DL.NB_DCI.DL_DCI.npdcch_pdu_rel13.rnti);
}
}
......@@ -534,7 +535,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->NB_DL.NB_DCI.RNTI >= CBA_RNTI) && (Sched_Rsp->NB_DL.NB_DCI.RNTI < P_RNTI))
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;
......@@ -634,9 +635,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->NB_DL.NB_DCI.RNTI<= P_RNTI)
if (Sched_Rsp->NB_DL.NB_DCI.DL_DCI.npdcch_pdu_rel13.rnti<= P_RNTI)
{
UE_id = find_ue((int16_t)Sched_Rsp->NB_DL.NB_DCI.RNTI,eNB);
UE_id = find_ue((int16_t)Sched_Rsp->NB_DL.NB_DCI.DL_DCI.npdcch_pdu_rel13.rnti,eNB);
}
else
UE_id=0;
......@@ -651,14 +652,14 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if (Sched_Rsp->NB_DL.NB_DCI.DCI_Format == DCIFormatN0) // this is a ULSCH allocation
{
UE_id = find_ue((int16_t)Sched_Rsp->NB_DL.NB_DCI.RNTI,eNB);
UE_id = find_ue((int16_t)Sched_Rsp->NB_DL.NB_DCI.UL_DCI.npdcch_dci_pdu_rel13.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();
//NB_generate_dci_top();
if(Sched_Rsp->NB_DL.NB_DLSCH.ndlsch_pdu_payload||Sched_Rsp->NB_DL.NB_DLSCH.nbcch_pdu_payload)
if(Sched_Rsp->NB_DL.NB_DLSCH.NPDSCH_pdu.segments)
{
/*TODO: MPDSCH procedures for NB-IoT*/
//npdsch_procedures();
......
......@@ -72,8 +72,8 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
const rnti_t rntiP,
uint8_t *sduP,
const uint16_t sdu_lenP,
const int harq_pidP,
uint8_t *msg3_flagP)
const int harq_pidP
)
{
unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr;
......@@ -164,9 +164,6 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
crnti_rx=1;
payload_ptr+=2;
if (msg3_flagP != NULL) {
*msg3_flagP = 0;
break;
/*For this moment, long bsr is not processed in the case*/
//case TRUNCATED_BSR:
......@@ -215,7 +212,7 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
default:
LOG_E(MAC, "[eNB %d] CC_id %d Received unknown MAC header (0x%02x)\n", enb_mod_idP, CC_idP, rx_ces[i]);
break;
}
}
for (i=0; i<num_sdu; i++) {
......@@ -402,12 +399,6 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
if (UE_id != -1)
UE_list->eNB_UE_stats[CC_idP][UE_id].total_num_errors_rx+=1;
if (msg3_flagP != NULL) {
if( *msg3_flagP == 1 ) {
LOG_N(MAC,"[eNB %d] CC_id %d frame %d : false msg3 detection: signal phy to canceling RA and remove the UE\n", enb_mod_idP, CC_idP, frameP);
*msg3_flagP=0;
}
}
} else {
if (UE_id != -1) {
UE_list->eNB_UE_stats[CC_idP][UE_id].pdu_bytes_rx=sdu_lenP;
......@@ -420,5 +411,5 @@ void NB_rx_sdu(const module_id_t enb_mod_idP,
stop_meas(&eNB->rx_ulsch_sdu);
}
}
\
......@@ -38,7 +38,7 @@
/* \brief Function to indicate a received SDU on ULSCH for NB-IoT.
*/
void NB_rx_sdu(const module_id_t module_idP, const int CC_id,const frame_t frameP, const sub_frame_t subframeP, const rnti_t rnti, uint8_t *sdu, const uint16_t sdu_len, const int harq_pid,uint8_t *msg3_flag);
void NB_rx_sdu(const module_id_t module_idP, const int CC_id,const frame_t frameP, const sub_frame_t subframeP, const rnti_t rnti, uint8_t *sdu, const uint16_t sdu_len, const int harq_pid);
/* \brief Function to retrieve result of scheduling (DCI) in current subframe. Can be called an arbitrary numeber of times after eNB_dlsch_ulsch_scheduler
in a given subframe.
......
......@@ -3,41 +3,41 @@
void UL_indication(UL_IND_t UL_INFO)
{
int i=0;
UL_INFO.test=1;
if(UL_INFO.test == 1)
{
/*If there is a preamble, do the initiate RA procedure*/
if(UL_INFO.Number_SC>0)
if(UL_INFO.NRACH.number_of_initial_scs_detected>0)
{
for(i=0;i<UL_INFO.Number_SC;i++)
for(i=0;i<UL_INFO.NRACH.number_of_initial_scs_detected;i++)
{
NB_initiate_ra_proc(UL_INFO.module_id,
UL_INFO.CC_id,
UL_INFO.frame,
UL_INFO.Preamble_list[UL_INFO.Number_SC].preamble_index,
UL_INFO.Preamble_list[UL_INFO.Number_SC].timing_offset,
(UL_INFO.NRACH.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
//timing_offset = Timing_advance * 16
(UL_INFO.NRACH.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance * 16,
UL_INFO.subframe
);
}
}
if(UL_INFO.RX_NPUSCH.number_of_pdus>0)
{
/*If there is a Uplink SDU (even MSG3, NAK) need to send to MAC*/
for(i=0;i<UL_INFO.UE_NUM;i++)
for(i=0;i<UL_INFO.RX_NPUSCH.number_of_pdus;i++)
{
/*For MSG3, Normal Uplink Data, NAK*/
if(UL_INFO.UL_SPEC_Info[i].RNTI)
NB_rx_sdu(UL_INFO.module_id,
UL_INFO.CC_id,
UL_INFO.frame,
UL_INFO.subframe,
UL_INFO.UL_SPEC_Info[i].RNTI,
UL_INFO.UL_SPEC_Info[i].sdu,
UL_INFO.UL_SPEC_Info[i].sdu_lenP,
UL_INFO.UL_SPEC_Info[i].harq_pidP,
UL_INFO.UL_SPEC_Info[i].msg3_flagP
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti,
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->data,
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length,
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid
);
}
}
//NB_eNB_dlsch_ulsch_scheduler(UL_INFO.module_id,0,UL_INFO.frame,UL_INFO.subframe); TODO: to be implemented
......
......@@ -11,7 +11,8 @@ IF_Module_t* IF_Module_init_L2(void) //southbound IF-Module Interface
{
//register the IF Module to MAC
if_inst->UL_indication = UL_indication;
return 0;
return if_inst;
}
//called at initialization of L1
......@@ -23,6 +24,6 @@ IF_Module_t* IF_Module_init_L1(void) //northbound IF-Module Interface
if_inst->schedule_response = schedule_response;
if_inst->PHY_config_req = PHY_config_req;
return 0;
return if_inst;
}
......@@ -8,6 +8,7 @@
#ifndef __IF_MODULE_NB_IoT__H__
#define __IF_MODULE_NB_IoT__H__
#include "nfapi_interface.h"
#include "openair1/PHY/LTE_TRANSPORT/defs_nb_iot.h"
#include "PhysicalConfigDedicated-NB-r13.h"
#include "openair2/PHY_INTERFACE/IF_Module_nb_iot.h"
......@@ -146,52 +147,12 @@ typedef struct{
// uplink subframe P7
typedef struct{
//index of the preamble, detected initial subcarrier (0-47)
uint16_t preamble_index;
//timing offset by PHY
int16_t timing_offset;
//Indicates the NRACH CE level as configured in CONFIG (0,1,2 = CE level 0,1,2)
uint8_t NRACH_CE_Level;
//RA-RNTI
uint16_t RNTI;
//Timing Advance
uint16_t TA;
}NRACH_t;
/*UL_SPEC_t:
* A struture mainly describes the UE specific information. (for NB_rx_sdu)
* Corresponding to the RX_ULSCH.indication, CRC.inidcation, NB_HARQ.indication in FAPI
*/
typedef struct{
// 0 = format 1 (data), 1 = formaat 2 (ACK/NACK)
uint8_t NPUSCH_format;
//An opaque handling returned in the RX.indication
uint32_t OPA_handle;
//rnti
uint16_t RNTI;
//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 feedback received by the NPUSCH from UE
uint8_t NAK;
}UL_SPEC_t;
/*UL_IND_t:
* A structure handles all the uplink information.
* Corresponding to the NRACH.indicaiton, UL_Config_indication, RX_ULSCH.indication, CRC.inidcation, NB_HARQ.indication in FAPI
*/
typedef struct{
......@@ -210,17 +171,16 @@ typedef struct{
/*preamble part*/
//number of the subcarrier detected in the same time
uint8_t Number_SC;
//NRACH Indication parameters list
NRACH_t Preamble_list[48];
nfapi_nrach_indication_body_t NRACH;
/*UE specific part*/
/*Uplink data part*/
//Number of availble UE for Uplink
int UE_NUM;
//Uplink Schedule information
UL_SPEC_t UL_SPEC_Info[NUMBER_OF_UE_MAX];
/*indication of the uplink data*/
nfapi_ul_config_nulsch_pdu NULSCH;
/*Uplink data PDU*/
nfapi_rx_indication_body_t RX_NPUSCH;
/*crc_indication*/
nfapi_crc_indication_body_t crc_ind;
}UL_IND_t;
......@@ -228,64 +188,28 @@ typedef struct{
typedef struct{
//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];
/*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{
//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];
/*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{
// 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;
/*DL DCI*/
nfapi_dl_config_npdcch_pdu DL_DCI;
/*UL DCI*/
nfapi_hi_dci0_npdcch_dci_pdu UL_DCI;
}npdcch_t;
......@@ -318,7 +242,8 @@ typedef struct{
}Sched_Rsp_t;
/*IF_Module_t*/
/*IF_Module_t a group for gathering the Interface
It should be allocated at the main () in lte-softmodem.c*/
typedef struct IF_Module_s{
//define the function pointer
void (*UL_indication)(UL_IND_t UL_INFO);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1737,6 +1737,7 @@ int main( int argc, char **argv ) {
int eMBMS_active=0;
if (node_function[0] <= NGFI_RAU_IF4p5) { // don't initialize L2 for RRU
LOG_I(PHY,"Intializing L2\n");
// Initialization of IF module for NB-IoT should be here
mac_xface = malloc(sizeof(MAC_xface));
l2_init(frame_parms[0],eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
0,// cba_group_active
......
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