Commit c6df27ba authored by Michele Paffetti's avatar Michele Paffetti

commit before pull nick version

parent 6bc94248
......@@ -37,7 +37,8 @@
#endif
/*brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB-NB decoding + primary/secondary synch).*/
void NB_phy_config_mib_eNB(int Mod_id,
void NB_phy_config_mib_eNB(
int Mod_id,
int CC_id,
int eutra_band,
int Nid_cell,
......@@ -45,9 +46,11 @@ void NB_phy_config_mib_eNB(int Mod_id,
int Ncp_UL,
int p_eNB,
uint32_t dl_CarrierFreq,
uint32_t ul_CarrierFreq);
//struct MasterInformationBlock_NB__operationModeInfo_r13 operationModeInfo);
uint32_t ul_CarrierFreq,
uint16_t prb_index, // NB_IoT_RB_ID,
uint16_t operating_mode,
uint16_t control_region_size,
uint16_t eutra_NumCRS_ports);
/*NB_phy_config_sib1_eNB is not needed since NB-IoT use only FDD mode*/
......
......@@ -53,7 +53,12 @@ void NB_phy_config_mib_eNB(
int Ncp_UL,
int p_eNB,
uint32_t dl_CarrierFreq,
uint32_t ul_CarrierFreq) {
uint32_t ul_CarrierFreq,
uint16_t prb_index, // NB_IoT_RB_ID,
uint16_t operating_mode,
uint16_t control_region_size,
uint16_t eutra_NumCRS_ports)
{
/*Not sure if phy parameters should be initial here or not*/
/*the phy_config_mib_eNB as the entry point to allocate the context for L1. The RC contains the context for L1,L2. If RC.eNB is NULL, it hasn't been allocated earlier so we allocate it there.*/
......@@ -78,7 +83,7 @@ void NB_phy_config_mib_eNB(
fp = &RC.eNB[Mod_id][CC_id]->frame_parms; */
NB_DL_FRAME_PARMS *fp = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms; //MP: PHY_VARS_eNB still to be modified
NB_DL_FRAME_PARMS *fp = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms_nb_iot;
LOG_I(PHY,"Configuring MIB-NB for instance %d, CCid %d : (band %d,Nid_cell %d,p %d,DL freq %u)\n",
Mod_id, CC_id, eutra_band, Nid_cell, p_eNB,dl_CarrierFreq);
......@@ -91,11 +96,11 @@ void NB_phy_config_mib_eNB(
fp->nb_antenna_ports_eNB = p_eNB; //tx antenna port
fp->dl_CarrierFreq = dl_CarrierFreq;
fp->ul_CarrierFreq = ul_CarrierFreq;
//fp->operating mode (in-band, guard-band, out-of-band)
fp->operating_mode = operating_mode; //see how are defined by FAPI structure
fp->NB_IoT_RB_ID = prb_index; //XXX to be better understand how should be managed
//fp->nb_rx_antenna_ports_eNB
//fp->prb_index (applicable only in guard band or in-band operating mode) indicates the prb index with regard to the middle prb in LTE system / delivered by MIB-NB
//fp->eutraControlRegionSize (only if in-band operating mode)
//fp->nb_CRS_ports (valid only for in-band operating mode with different PCI)
fp->control_region_size = control_region_size; //(assume that this value is negative if not used)
fp->eutra_NumCRS_ports = eutra_NumCRS_ports //(valid only for in-band operating mode with different PCI)
//TODO
......
......@@ -105,7 +105,14 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
if (dci_alloc[i].firstCCE>=0) {
//encoding
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,e+(72*dci_alloc[i].firstCCE),dci_alloc[i].dci_length,dci_alloc[i].L,dci_alloc[i].rnti);
e_ptr = generate_dci0(
dci_alloc[i].dci_pdu, //we should pass the two DCI pdu (if exist)
//second pdu
//aggregation level
e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length,
dci_alloc[i].L,
dci_alloc[i].rnti);
//new NB-IoT
npdcch_encoding_NB_IoT(
......@@ -131,11 +138,12 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
//NB-IoT--------------------------
/*
* switch(npdcch_start_index)
* switch(npdcch_start_index) (see mail)
*
* case 0
* G = 272
* G = 304
* case 1
* G = 248
* G = 240
* case 2
* G = 224
* case 3
......@@ -174,6 +182,7 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
// there is a function to do the resource mapping function
//already done in the modulation in our NB-IoT implementaiton
return 0;
}
......@@ -664,14 +664,42 @@ typedef struct PHY_VARS_eNB_s {
//------------------------
// NB-IoT
//------------------------
/*
* NUMBER_OF_UE_MAX_NB_IoT maybe in the future should be dynamic because could be very large and the memory may explode
* (is almost the indication of the number of UE context that we are storing at PHY layer)
*
* reasoning: the following data structure (ndlsch, nulsch ecc..) are used to store the context that should be transmitted in at least n+4 subframe later
* (the minimum interval between NPUSCH and the ACK for this)
* the problem is that in NB_IoT the ACK for the UPLINK is contained in the DCI through the NDI field (if this value change from the previous one then it means ACK)
* but may we could schedule this DCI long time later so may lots of contents shuld be stored (there is no concept of phich channel in NB-IoT)
* For the DL transmission the UE send a proper ACK/NACK message
*
* *the HARQ process should be killed when the NDI change
*
* *In the Structure for nulsch we should also store the information related to the subframe (because each time we should read it and understand what should be done
* in that subframe)
*
*/
/*
* TIMING
* the entire transmission and scheduling are done for the "subframe" concept but the subframe = proc->subframe_tx (that in reality is the subframe_rx +4)
* (see USER/lte-enb/wakeup_rxtx )
*
* Related to FAPI:
* DCI and DL_CONFIG.request (also more that 1) and MAC_PDU are transmitted in the same subframe (our assumption) so will be all contained in the schedule_response getting from the scheduler
* DCI0 and UL_CONFIG.request are transmitted in the same subframe (our assumption) so contained in the schedule_response
*
*/
NB_IoT_eNB_NPBCH npbch;
NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAX_NB_IoT]; //check the max size of this array
NB_IoT_eNB_NDLSCH_t *ndlsch[NUMBER_OF_UE_MAX_NB_IoT];
NB_IoT_eNB_NULSCH_t *nulsch[NUMBER_OF_UE_MAX_NB_IoT+1] //nulsch[0] contains the RAR
NB_IoT_eNB_NULSCH_t *nulsch[NUMBER_OF_UE_MAX_NB_IoT+1]; //nulsch[0] contains the RAR
NB_IoT_eNB_NDLSCH_t *dlsch_SI_NB,*dlsch_ra_NB;
NB_DL_FRAME_PARMS frame_parms_nb_iot;
DCI_PDU_NB DCI_pdu;
......
......@@ -299,25 +299,6 @@ typedef struct eNB_proc_NB_t_s {
} eNB_proc_NB_t;
/// Top-level PHY Data Structure for eNB
typedef struct PHY_VARS_eNB_NB_s {
/// Module ID indicator for this instance
module_id_t Mod_id;
uint8_t CC_id;
eNB_proc_NB_t proc;
NB_DL_FRAME_PARMS frame_parms;
NB_IoT_eNB_NPBCH npbch;
//number of UE max = 1 // in fapy is udated dinamically each subframe and is no more a table
LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams
//how many ULSCH we keep???? should be more that 1 for sure
LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
LTE_eNB_DLSCH_t *dlsch_SI,*dlsch_ra;
LTE_eNB_DLSCH_t *dlsch_MCH;
} PHY_VARS_eNB_NB;
#include "PHY/INIT/defs.h"
#include "PHY/LTE_REFSIG/defs.h"
......
......@@ -587,8 +587,6 @@ typedef struct {
struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[MAX_MBSFN_AREA];
//NB-iot to be transfer in the new structure
unsigned short NB_IoT_RB_ID;
} LTE_DL_FRAME_PARMS;
......
......@@ -226,6 +226,40 @@ typedef struct {
// CE level to determine the NPRACH Configuration (one CE for each NPRACH config.)
uint8_t CE;
/*
* index of the PRB assigned to NB-IoT carrier in in-band/guard-band operating mode
*/
unsigned short NB_IoT_RB_ID;
/*Following FAPI approach:
* 0 = in-band with same PCI
* 1 = in-band with diff PCI
* 2 = guard band
* 3 =stand alone
*/
uint16_t operating_mode;
/*
* Only for In-band operating mode with same PCI
* its measured in number of OFDM symbols
* allowed values:
* 1, 2, 3, 4(this value is written in FAPI specs but not exist in TS 36.331 v14.2.1 pag 587)
* -1 (we put this value when is not defined - other operating mode)
*/
uint16_t control_region_size;
/*Number of EUTRA CRS antenna ports (AP)
* valid only for in-band different PCI mode
* value 0 = indicates the same number of AP as NRS APs
* value 1 = four CRS APs
*/
uint16_t eutra_NumCRS_ports;
} NB_DL_FRAME_PARMS;
#define NPBCH_A 34
......
......@@ -78,4 +78,7 @@ extern fifo_dump_emos_eNB emos_dump_eNB;
#endif
*/
extern Sched_Rsp_t* Sched_Rsp;
#endif /*__SCHED_EXTERN_H__ */
......@@ -911,7 +911,13 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
T_INT(dci_alloc->firstCCE));
}
void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t *dlsch1,LTE_eNB_UE_stats *ue_stats,int ra_flag,int num_pdcch_symbols) {
void pdsch_procedures(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
LTE_eNB_DLSCH_t *dlsch,
LTE_eNB_DLSCH_t *dlsch1,
LTE_eNB_UE_stats *ue_stats,
int ra_flag,
int num_pdcch_symbols) {
int frame=proc->frame_tx;
int subframe=proc->subframe_tx;
......@@ -1017,6 +1023,11 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
*/
/*this for MSG3*/
//the problem of OAI is that i don't have any DCI0 for scheduling the info for getting Msg3 (because is direclty given in RAR)
//so i should gather the information directly form RAR before sending it
//In FAPI style apporach so we directly get it from the next UL-config given in the Sched_rsp
//so most probably i don't care about it because i will receive all the information for get Msg3
generate_eNB_ulsch_params_from_rar(DLSCH_pdu,
frame,
subframe,
......@@ -1432,7 +1443,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
// Check for SI activity
//MP: eNB->dlsch_SI->active is set by the function generate_dlsch_params_from_dci (depending on the DCI content)
if ((eNB->dlsch_SI) && (eNB->dlsch_SI->active == 1)) {
pdsch_procedures(eNB,proc,eNB->dlsch_SI,(LTE_eNB_DLSCH_t*)NULL,(LTE_eNB_UE_stats*)NULL,0,num_pdcch_symbols);
......
......@@ -2,7 +2,7 @@
#include "PHY/defs.h"
#include "PHY/defs_nb_iot.h"
#include "PHY/extern.h"
#include "PHY/extern.h" //where we get the global Sched_Rsp_t structure filled
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "PHY/LTE_TRANSPORT/if4_tools.h"
......@@ -586,13 +586,13 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_
* ** CQI and PMI are not present in NB-IoT
* ** redundancy version exist only in UL for NB-IoT and not in DL
*/
void pdsch_procedures_NB(PHY_VARS_eNB *eNB,
void npdsch_procedures(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc, //Context data structure for RX/TX portion of subframe processing
NB_IoT_eNB_DLSCH_t *dlsch,
NB_IoT_eNB_DLSCH_t *dlsch1,//this is the second colum of the UE specific LTE_eNB_DLSCH_t (see the PHY/defs.h line 471)
//NB_IoT_eNB_DLSCH_t *dlsch1,//this is the second colum of the UE specific LTE_eNB_DLSCH_t (see the PHY/defs.h line 471) is used only in ue specific dlsch for two parallel streams (but we don't have it in NB-IoT)
LTE_eNB_UE_stats *ue_stats,
int ra_flag,// set to 1 only in case of RA
int num_pdcch_symbols,
int ra_flag,// set to 1 only in case of RAR as a segment data
//int num_pdcch_symbols, (BCOM says are not needed
uint32_t segment_length, //lenght of the DLSCH PDU from the Sched_rsp (FAPI nomenclature)
uint8_t* segment_data // the DLSCH PDU itself from the Sched_rsp (FAPI nomenclature)
)
......@@ -606,7 +606,7 @@ void pdsch_procedures_NB(PHY_VARS_eNB *eNB,
NB_DL_FRAME_PARMS *fp=&eNB->frame_parms_nb_iot;
uint8_t *DLSCH_pdu=NULL;
uint8_t DLSCH_pdu_tmp[input_buffer_length+4]; //[768*8];
uint8_t DLSCH_pdu_rar[256];
//uint8_t DLSCH_pdu_rar[256];
int i;
......@@ -618,61 +618,63 @@ void pdsch_procedures_NB(PHY_VARS_eNB *eNB,
harq_pid,
frame, subframe, input_buffer_length,
get_G(fp,dlsch_harq->nb_rb,dlsch_harq->rb_alloc,get_Qm(dlsch_harq->mcs),dlsch_harq->Nl, num_pdcch_symbols, frame, subframe, dlsch_harq->mimo_mode==TM7?7:0),
dlsch_harq->nb_rb, //in NB_IoT we not need it???
dlsch_harq->mcs, //why MCS is inside the harq???
dlsch_harq->round);
#if defined(MESSAGE_CHART_GENERATOR_PHY)
MSC_LOG_TX_MESSAGE(
MSC_PHY_ENB,MSC_PHY_UE,
NULL,0,
"%05u:%02u PDSCH/DLSCH input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx16", rv %"PRIu8" (round %"PRIu8")",
frame, subframe,
input_buffer_length,
get_G(fp,
dlsch_harq->nb_rb,
dlsch_harq->rb_alloc,
get_Qm(dlsch_harq->mcs),
dlsch_harq->Nl,
num_pdcch_symbols,
frame,
subframe,
dlsch_harq->mimo_mode==TM7?7:0),
dlsch_harq->nb_rb,
dlsch_harq->nb_rb, //in NB_IoT we not need it??? (Current Number of RBs should be only 1)
dlsch_harq->mcs,
pmi2hex_2Ar1(dlsch_harq->pmi_alloc),
dlsch_harq->rvidx,
dlsch_harq->round);
#endif
if (ue_stats) ue_stats->dlsch_sliding_cnt++;
if (dlsch_harq->round == 0) {
if (ue_stats)
ue_stats->dlsch_trials[harq_pid][0]++;
if (eNB->mac_enabled==1) { // set in lte-softmodem - main line 1646
///XXX skip this for the moment and all the ue stats
//#if defined(MESSAGE_CHART_GENERATOR_PHY)
// MSC_LOG_TX_MESSAGE(
// MSC_PHY_ENB,MSC_PHY_UE,
// NULL,0,
// "%05u:%02u PDSCH/DLSCH input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx16", rv %"PRIu8" (round %"PRIu8")",
// frame, subframe,
// input_buffer_length,
// get_G(fp,
// dlsch_harq->nb_rb,
// dlsch_harq->rb_alloc,
// get_Qm(dlsch_harq->mcs),
// dlsch_harq->Nl,
// num_pdcch_symbols,
// frame,
// subframe,
// dlsch_harq->mimo_mode==TM7?7:0),
// dlsch_harq->nb_rb,
// dlsch_harq->mcs,
// pmi2hex_2Ar1(dlsch_harq->pmi_alloc),
// dlsch_harq->rvidx,
// dlsch_harq->round);
//#endif
//if (ue_stats) ue_stats->dlsch_sliding_cnt++; //used to compute the mcs offset
if (dlsch_harq->round == 0) { //first transmission
// if (ue_stats)
// ue_stats->dlsch_trials[harq_pid][0]++;
if (eNB->mac_enabled==1) { // set in lte-softmodem/main line 1646
if (ra_flag == 0) {
DLSCH_pdu =segment_data;
}
else { // XXX decide what should be done for NB-IoT
else { //manage the RAR
/*
* In FAPI style we don-t need to process the RAR because we have all the parameters for getting the MSG3 given by the
* UL_CONFIG.request
* 1) this data are given at the same time with the DLSCH PDU containing the RAR???
* 2) wee need to do a mapping of this parameters OAI->FAPI
* UL_CONFIG.request (all inside the next Sched_RSP function)
*
*/
int16_t crnti = mac_xface->fill_rar(eNB->Mod_id,
eNB->CC_id,
frame,
DLSCH_pdu_rar,
fp->N_RB_UL,
input_buffer_length);
DLSCH_pdu = DLSCH_pdu_rar;
// int16_t crnti = mac_xface->fill_rar(eNB->Mod_id,
// eNB->CC_id,
// frame,
// DLSCH_pdu_rar,
// fp->N_RB_UL,
// input_buffer_length);
DLSCH_pdu = segment_data; //the proper PDU should be passed in the function when the RA flag is activated
int UE_id;
......@@ -785,6 +787,15 @@ void pdsch_procedures_NB(PHY_VARS_eNB *eNB,
// 36-212
//encoding---------------------------
/*
* we should have as an iput parameter also G for the encoding based on the switch/case
* G is evaluated based on the switch/case done over eutracontrolRegionSize (if exist) and operationModeInfo
* NB: switch case of G is the same for npdsch and npdcch
*
* Nsf needed as an input (number of subframe)
*/
start_meas(&eNB->dlsch_encoding_stats);
LOG_I(PHY, "NB-IoT Encoding step\n");
......@@ -798,6 +809,7 @@ void pdsch_procedures_NB(PHY_VARS_eNB *eNB,
&eNB->dlsch_turbo_encoding_stats,
&eNB->dlsch_interleaving_stats);
stop_meas(&eNB->dlsch_encoding_stats);
//scrambling-------------------------------------------
// 36-211
......@@ -864,10 +876,10 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
int frame = proc->frame_tx;
int subframe = proc->subframe_tx;
uint32_t i,aa;
uint8_t harq_pid;
//DCI_PDU_NB *DCI_pdu;
//uint8_t harq_pid; only one HARQ process
//DCI_PDU_NB *DCI_pdu; we already have inside Sched_Rsp
//DCI_PDU_NB DCI_pdu_tmp;
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
NB_DL_FRAME_PARMS *fp = &eNB->frame_parms_nb_iot;
// DCI_ALLOC_t *dci_alloc = (DCI_ALLOC_t *)NULL;
int8_t UE_id = 0;
uint8_t ul_subframe;
......@@ -875,28 +887,31 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
int **txdataF = eNB->common_vars.txdataF[0];
//uint8_t num_npdcch_symbols = 0;
Sched_Rsp_t *sched_rsp;
//for NB-IoT
// are needed??? (maybe not)
//uint8_t num_npdcch_symbols = 0;
Sched_Rsp_t *Sched_Rsp;
Sched_Rsp_t *sched_rsp;
if(do_meas == 1)
start_meas(&eNB->phy_proc_tx);
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);
}
}
// Original scheduler
//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
// clear the transmit data array for the current subframe
/*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
for (aa=0; aa<fp->nb_antenna_ports_eNB; aa++)
{
memset(&eNB->common_vars.txdataF[0][aa][subframe*fp->ofdm_symbol_size*(fp->symbols_per_tti)],
......@@ -906,72 +921,105 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
while(!oai_exit)
{
//ignore the PMCH part only do the generate PSS/SSS, note: Seperate MIB from here
//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;
/*Take the structures from the shared structures*/
//Sched_Rsp = ;
/*
broadcast channel for n-FAPI style
pdu length - 14 (bytes)
pdu index - 1
num segments -1
segment length 5 bytes
segment data 34 bits (5 bytes)
/*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
*
*
*Sched_Rsp_t content:
*
* DL_Config.request--> dl_config_request_pdu --> nfapi_dl_config_nbch_pdu_rel13_t --> NBCH PDU
*
* TX.request --> nfapi_tx_request_pdu_t --> MAC PDU (MIB)
* Content of tx_request_pdu
* -pdu length 14 (bytes)???
* -pdu index = 1
* -num segments = 1,
* -segment length 5 bytes,
* -segment data 34 bits for MIB (5 bytes)
*
*XXX we are assuming that for the moment we are not segmenting the pdu (this should happen only when we have separate machines)
*XXX so the data is always contained in the first segment (segments[0])
*
*Problem: NB_IoT_RB_ID should be the ID of the RB dedicated to NB-IoT
*but if we are in stand alone mode?? i should pass the DC carrier???
*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
*
*/
if((subframe==0) && (Sched_Rsp->NB_DL.NB_BCH.MIB_pdu.segments[0].segment_data)!=NULL)
if((subframe==0) && (sched_rsp->NB_DL.NB_BCH.MIB_pdu.segments[0].segment_data)!=NULL)
{
generate_npbch(&eNB->npbch,
txdataF,
AMP,
fp,
&Sched_Rsp->NB_DL.NB_BCH.MIB_pdu.segments[0].segment_data,
&sched_rsp->NB_DL.NB_BCH.MIB_pdu.segments[0].segment_data,
frame%64,
fp->NB_IoT_RB_ID // iD of the resource block may be passed by the config request (phy config structure)
fp->NB_IoT_RB_ID
);
}
/*clear the existing ulsch dci allocations before applying info from MAC*/
ul_subframe = (subframe+4)%10;
ul_frame = frame+(ul_subframe >= 6 ? 1 :0);
harq_pid = ((ul_frame<<1)+ul_subframe)&7;
/*
* 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)
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*/
npdsch_procedures_NB();
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);
}
/*clear the DCI allocation maps for new subframe*/
for(i=0;i<NUMBER_OF_UE_MAX;i++)
//no HARQ pid (we have only 1 single process for each user)
//clear previous possible allocation
for(int i = 0; i < NUMBER_OF_UE_MAX_NB_IoT; i++)
{
if(eNB->ulsch[i])
if(eNB->ndlsch[i])
{
eNB->ulsch[i]->harq_processes[harq_pid]->dci_alloc = 0;
eNB->ulsch[i]->harq_processes[harq_pid]->rar_alloc = 0;
}
eNB->ndlsch[i]->harq_process->round=0; // may not needed
/*clear previous allocation information for all UEs*/
eNB->ndlsch[i]->subframe_tx[subframe] = 0;
}
/*clear previous allocation information for all UEs*/
for(i=0;i<NUMBER_OF_UE_MAX;i++)
/*clear the DCI allocation maps for new subframe*/
if(eNB->nulsch[i])
{
if(eNB->dlsch[i][0])
eNB->dlsch[i][0]->subframe_tx[subframe]=0;
eNB->nulsch[i]->harq_process->dci_alloc = 0; //flag for indicating that a DCI has been allocated for UL
eNB->nulsch[i]->harq_process->rar_alloc = 0; //Flag indicating that this ULSCH has been allocated by a RAR
}
}
if(Sched_Rsp->NB_DL.NB_DCI != NULL)
{
//no PHICH in NB-IoT
//num_pdcch_symbols?? (maybe later when we have the DCI)
/*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
......@@ -1011,12 +1059,12 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
//to be modified but inside we have the nuew function for dci transmission
generate_dci_top();
}
//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 != 0)
if(Sched_Rsp->NB_DL.NB_DLSCH.ndlsch.rnti_type == 0)
{
//we not need between RAR PDUS
......
......@@ -15,7 +15,7 @@
#define SCH_PAYLOAD_SIZE_MAX 4096
#define BCCH_PAYLOAD_SIZE_MAX 128
#define NUMBER_OF_UE_MAX 20
// P5 FAPI-like configuration structures
......@@ -60,6 +60,10 @@ typedef struct{
int get_COMMON;
int get_DEDICATED;
//ID of the Resource Block dedicated to NB-IoT
//For Nb-IoT only a restricted values of PRB indexes are allowed (see Rhode&Shwartz pag9)
//unsigned short NB_IoT_RB_ID; (should coincide with PRB index)
//In FAPI specs --> is inside the nb_iot_rssi_request (P4 Network Monitor Mode procedure)
//In OAI is called eutra_band
uint8_t frequency_band_indicator; //parameter carried by the SIB1-NB, is and index of the Table 5.5-1 TS 36.101
......
......@@ -154,11 +154,9 @@ int NB_rrc_mac_config_req_eNB(
LogicalChannelConfig_NB_r13_t *logicalChannelConfig //FIXME: decide how to use it
)
{
//no ul_Bandwidth
//------------
PHY_Config_t *config_INFO; //TODO should be seen as a global variable (who initialize this???)
//------------
/*to review with the Raymond implementation*/
int UE_id = -1;
//eNB_MAC_INST_NB *eNB = &eNB_mac_inst_NB[Mod_idP];
......@@ -181,7 +179,6 @@ int NB_rrc_mac_config_req_eNB(
//mac_top_init_eNB(); //TODO MP: to be included in the MAC/main.c
///to review with the Raymond implementation
eNB_mac_inst_NB[Mod_idP].common_channels[CC_idP].mib_NB = mib_NB;
eNB_mac_inst_NB[Mod_idP].common_channels[CC_idP].physCellId = physCellId;
......@@ -225,28 +222,37 @@ int NB_rrc_mac_config_req_eNB(
//FAPI specs pag 135
case MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13:
config_INFO->nb_iot_config.operating_mode.value = 0;
config_INFO->nb_iot_config.prb_index.value = mib_NB->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13;
config_INFO->nb_iot_config.prb_index.value = mib_NB->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13; //see TS 36.213 ch 16.0
config_INFO->nb_iot_config.assumed_crs_aps.value = -1; //is not defined so we put a negative value
if(eutraControlRegionSize == NULL)
LOG_E(RRC, "NB_rrc_mac_config_req_eNB: operation mode is in-band but eutraControlRegionSize is not defined");
else
config_INFO->nb_iot_config.control_region_size.value = *eutraControlRegionSize;
break;
case MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_DifferentPCI_r13:
config_INFO->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 it
//config_INFO->nb_iot_config.prb_index.value = mib_NB->message.operationModeInfo_r13.choice.inband_DifferentPCI_r13 XXX (see FAPI specs pag 135)
config_INFO->nb_iot_config.assumed_crs_aps.value = mib_NB->message.operationModeInfo_r13.choice.inband_DifferentPCI_r13.eutra_NumCRS_Ports_r13;
if(eutraControlRegionSize == NULL)
LOG_E(RRC, "NB_rrc_mac_config_req_eNB: operation mode is in-band but eutraControlRegionSize is not defined");
else
config_INFO->nb_iot_config.control_region_size.value = *eutraControlRegionSize;
break;
case MasterInformationBlock_NB__operationModeInfo_r13_PR_guardband_r13:
config_INFO->nb_iot_config.operating_mode.value = 2;
//config_INFO->nb_iot_config.prb_index = mib_NB->message.operationModeInfo_r13.choice.guardband_r13 XXX (see FAPI specs pag 135)
//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 it
//config_INFO->nb_iot_config.prb_index = mib_NB->message.operationModeInfo_r13.choice.guardband_r13; XXX (see FAPI specs pag 135)
config_INFO->nb_iot_config.control_region_size.value = -1; //should not being defined so we put a negative value
config_INFO->nb_iot_config.assumed_crs_aps.value = -1; //is not defined so we put a negative value
break;
case MasterInformationBlock_NB__operationModeInfo_r13_PR_standalone_r13:
config_INFO->nb_iot_config.operating_mode.value = 3;
......
......@@ -41,6 +41,7 @@
extern eNB_RRC_INST_NB *eNB_rrc_inst_NB;
extern PHY_Config_t *config_INFO;
extern rlc_info_t Rlc_info_am_NB,Rlc_info_am_config_NB;
extern uint8_t DRB2LCHAN_NB[2];
......
......@@ -1620,6 +1620,12 @@ init_SI_NB(
//-----------------------------------------------------------------------------
{
/*WE should allocate memory for PHY_Config structure
* is declared in vars_nb_iot.c and put also in the extern_nb_iot
* */
config_INFO = malloc(sizeof(PHY_Config_t));
// uint8_t SIwindowsize = 1; //frame
// uint16_t SIperiod = 8; // in frames
......
......@@ -69,6 +69,9 @@ unsigned short Data_to_read;
eNB_RRC_INST_NB *eNB_rrc_inst_NB;
uint8_t DRB2LCHAN_NB[2];//max can be 2 DRBs for NB_IoT --> it used for saving the LCID of DRBs
//structure for FAPI-like configuration
PHY_Config_t *config_INFO;
BOOLEAN_t logicalChannelSR_Prohibit = 1;
long priority =1;
......
......@@ -28,6 +28,6 @@
#endif
#define NUMBER_OF_UE_MAX_NB_IoT 1
#define NUMBER_OF_UE_MAX_NB_IoT 16
#endif /* OPENAIRINTERFACE5G_LIMITS_H_ */
......@@ -575,10 +575,13 @@ int wait_CCs(eNB_rxtx_proc_t *proc) {
return(0);
}
/*NB-IoT rxtx*/
/*NB-IoT rxtx
* IMPORTANT
* When we run the rxtx thread for NB-IoT we should not run at the same time otherwise we fill the same buffers in PHY_Vars_eNB
* */
static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
UL_IND_t UL_INFO; //not here but temp
start_meas(&softmodem_stats_rxtx_sf);
......@@ -590,13 +593,11 @@ static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_
// skip the comment for this moment
// phy_procedures_eNB_common_RX(eNB,proc);
// UE-specific RX processing for subframe n
/*UE-specific RX processing for subframe n*/
NB_phy_procedures_eNB_uespec_RX(eNB,proc);
// After stored the Upink information, process it and made it into FAPI style, also provide a tick to the scheduler
// After stored the Upink information, process it and made it into FAPI style, send the UL_Indication to higher layer that also provide a tick to the scheduler
if(if_inst->UL_indication) if_inst->UL_indication(UL_INFO);
......@@ -1243,6 +1244,7 @@ void rx_fh_slave(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
int wakeup_rxtx(eNB_proc_t *proc,eNB_rxtx_proc_t *proc_rxtx,LTE_DL_FRAME_PARMS *fp) {
int i;
struct timespec wait;
......
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