Commit 993570c2 authored by Michele Paffetti's avatar Michele Paffetti

Correction of some bugs on coding files, starting implementation of single...

Correction of some bugs on coding files, starting implementation of single thread dlsch procedure (schedule_responce, generate_dlsch_params ecc..), Code Compile. Still 150 warnings
parents d6b6cb91 6768c7da
...@@ -1042,8 +1042,9 @@ set(PHY_SRC ...@@ -1042,8 +1042,9 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec_NB_IoT.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold_mbsfn.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold_mbsfn.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_mbsfn.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_mbsfn.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_ul_ref.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_ul_ref.c
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/* file: PHY/CODING/defs_nb_iot.h
purpose: Top-level definitions, data types and function prototypes for openairinterface coding blocks for NB-IoT
author: raymond.knopp@eurecom.fr, michele.paffetti@studio.unibo.it
date: 29.06.2017
*/
#ifndef OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_
#define OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_
#include <stdint.h>
#include "PHY/defs.h"
uint32_t sub_block_interleaving_cc_NB_IoT(uint32_t D, uint8_t *d,uint8_t *w);
uint32_t lte_rate_matching_cc_NB_IoT(uint32_t RCC, // RRC = 2
uint16_t E, // E = 1600
uint8_t *w, // length
uint8_t *e); // length 1600
void ccode_encode_NB_IoT (int32_t numbits,
uint8_t add_crc,
uint8_t *inPtr,
uint8_t *outPtr,
uint16_t rnti);
#endif /* OPENAIR1_PHY_CODING_DEFS_NB_IOT_H_ */
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define DEBUG_PHY #define DEBUG_PHY
#include "assertions.h" #include "assertions.h"
#include <math.h> #include <math.h>
#include "PHY/LTE_REFSIG/defs.h"
extern uint16_t prach_root_sequence_map0_3[838]; extern uint16_t prach_root_sequence_map0_3[838];
extern uint16_t prach_root_sequence_map4[138]; extern uint16_t prach_root_sequence_map4[138];
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#ifndef __LTE_REFSIG_DEFS_NB_IOT__H__ #ifndef __LTE_REFSIG_DEFS_NB_IOT__H__
#define __LTE_REFSIG_DEFS_NB_IOT__H__ #define __LTE_REFSIG_DEFS_NB_IOT__H__
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h" #include "PHY/defs_nb_iot.h"
/** @ingroup _PHY_REF_SIG /** @ingroup _PHY_REF_SIG
* @{ * @{
...@@ -43,7 +43,10 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB, ...@@ -43,7 +43,10 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
short amp, short amp,
unsigned char Ns, unsigned char Ns,
unsigned char l, unsigned char l,
unsigned char p unsigned char p,
unsigned short RB_IoT_ID); unsigned short RB_IoT_ID);
unsigned int lte_gold_generic_NB_IoT(unsigned int *x1, unsigned int *x2, unsigned char reset);
#endif #endif
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "PHY/defs.h" #include "PHY/defs.h"
#include "defs_NB_IoT.h" #include "defs_NB_IoT.h"
#include "PHY/defs_NB_IoT.h" #include "PHY/defs_nb_iot.h"
int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB, int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
int32_t *output, int32_t *output,
...@@ -60,16 +60,17 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB, ...@@ -60,16 +60,17 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
} }
// testing if the total number of RBs is even or odd // testing if the total number of RBs is even or odd
bandwidth_even_odd = frame_parms->N_RB_DL % 2; // 0 even, 1 odd bandwidth_even_odd = phy_vars_eNB->frame_parms.N_RB_DL % 2; // 0 even, 1 odd
mprime = 0; // mprime = 0,1 for NB_IoT // for LTE , maximum number of resources blocks (110) - the total number of RB in the selected bandwidth (.... 15 , 25 , 50, 100) mprime = 0; // mprime = 0,1 for NB_IoT // for LTE , maximum number of resources blocks (110) - the total number of RB in the selected bandwidth (.... 15 , 25 , 50, 100)
k = (nu + phy_vars_eNB->lte_frame_parms.nushift)%6; k = (nu + phy_vars_eNB->frame_parms.nushift)%6;
if(RB_IoT_ID < (phy_vars_eNB->lte_frame_parms.N_RB_DL/2)) if(RB_IoT_ID < (phy_vars_eNB->frame_parms.N_RB_DL/2))
{ { //XXX this mod operation is not valid since the second member is not an integer but double (for the moment i put a cast)
NB_IoT_start = phy_vars_eNB->lte_frame_parms.ofdm_symbol_size - 12*(phy_vars_eNB->lte_frame_parms.N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(ceil(phy_vars_eNB->lte_frame_parms.N_RB_DL/(float)2))); NB_IoT_start = phy_vars_eNB->frame_parms.ofdm_symbol_size - 12*(phy_vars_eNB->frame_parms.N_RB_DL/2) - (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
} else { } else {
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%(ceil(phy_vars_eNB->lte_frame_parms.N_RB_DL/(float)2))); //XXX invalid mod operation (put a cast for the moment)
NB_IoT_start = (bandwidth_even_odd*6) + 12*(RB_IoT_ID%((int)(ceil(phy_vars_eNB->frame_parms.N_RB_DL/(float)2))));
} }
k+=NB_IoT_start; k+=NB_IoT_start;
...@@ -78,7 +79,7 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB, ...@@ -78,7 +79,7 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
DevAssert( l < 2 ); DevAssert( l < 2 );
for (m=0; m<2; m++) { for (m=0; m<2; m++) {
output[k] = qpsk[(phy_vars_eNB->lte_gold_table_NB_IoT[Ns][l][0]) & 3]; output[k] = qpsk[(phy_vars_eNB->lte_gold_table[Ns][l][0]) & 3]; //TODO should be defined one for NB-IoT
k+=6; k+=6;
} }
......
...@@ -44,6 +44,7 @@ typedef enum ...@@ -44,6 +44,7 @@ typedef enum
DCIFormatN1, DCIFormatN1,
DCIFormatN1_RA, DCIFormatN1_RA,
DCIFormatN1_RAR, DCIFormatN1_RAR,
DCIFormatN2,
DCIFormatN2_Ind, DCIFormatN2_Ind,
DCIFormatN2_Pag, DCIFormatN2_Pag,
}DCI_format_NB_t; }DCI_format_NB_t;
......
...@@ -68,8 +68,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -68,8 +68,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
uint16_t rnti, uint16_t rnti,
DCI_format_NB_t dci_format, DCI_format_NB_t dci_format,
uint8_t UE_id, uint8_t UE_id,
uint8_t aggregation, uint8_t aggregation
uint8_t Num_dci
) )
{ {
...@@ -120,7 +119,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -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)->ndi =ndi;
((DCIN0_t *)ULSCH_DCI_NB)->DCIRep =DCIRep; ((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); NB_add_dci(eNB->DCI_pdu,ULSCH_DCI_NB,rnti,sizeof(DCIN0_t),aggregation,sizeof_DCIN0_t,DCIFormatN0);
...@@ -137,64 +136,73 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -137,64 +136,73 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
} }
} }
//map the Isf (DCI param) to the number of subframes (Nsf)
int resource_to_subframe[8] = {1,2,3,4,5,6,8,10};
int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
int frame, int frame,
uint8_t subframe, uint8_t subframe,
DCI_CONTENT *DCI_Content, DCI_CONTENT *DCI_Content,
uint16_t rnti, uint16_t rnti,
DCI_format_NB_t dci_format, DCI_format_NB_t dci_format,
LTE_eNB_DLSCH_t *dlsch, NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_DL_FRAME_PARMS *frame_parms, NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation, uint8_t aggregation
uint8_t Num_dci
) )
{ {
NB_IoT_DL_eNB_HARQ_t* ndlsch_harq = ndlsch->harq_process;
void *DLSCH_DCI_NB = NULL; void *DLSCH_DCI_NB = NULL;
eNB->DCI_pdu = (DCI_PDU_NB*) malloc(sizeof(DCI_PDU_NB)); eNB->DCI_pdu = (DCI_PDU_NB*) malloc(sizeof(DCI_PDU_NB));
//N1 start
//N1 parameters
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits /// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
uint8_t type; uint8_t type = 0;
//NPDCCH order indicator (set to 0),1 bits //NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator; uint8_t orderIndicator = 0;
// Scheduling Delay, 3 bits // Scheduling Delay, 3 bits
uint8_t Scheddly; uint8_t Sched_delay = 0;
// Resourse Assignment (RU Assignment), 3 bits // Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign; uint8_t ResAssign = 0;//Isf
// Modulation and Coding Scheme, 4 bits // Modulation and Coding Scheme, 4 bits
uint8_t mcs; uint8_t mcs = 0;
// Repetition Number, 4 bits // Repetition Number, 4 bits
uint8_t RepNum; uint8_t RepNum = 0;
// DCI subframe repetition Number, 2 bits // DCI subframe repetition Number, 2 bits
uint8_t DCIRep; uint8_t DCIRep = 0;
// New Data Indicator,1 bits // New Data Indicator,1 bits
uint8_t ndi; uint8_t ndi = 0;
// HARQ-ACK resource,4 bits // HARQ-ACK resource,4 bits
uint8_t HARQackRes; uint8_t HARQackRes = 0;
//N2 start //N2 parameters
//Direct indication information, 8 bits //Direct indication information, 8 bits
uint8_t directIndInf; uint8_t directIndInf= 0;
// Reserved information bits, 6 bits // Reserved information bits, 6 bits
uint8_t resInfoBits; uint8_t resInfoBits =0;
// printf("Generate eNB DCI, format %d, rnti %x (pdu %p)\n",dci_format,rnti,dci_pdu); // printf("Generate eNB DCI, format %d, rnti %x (pdu %p)\n",dci_format,rnti,dci_pdu);
switch (dci_format) { switch (dci_format) {
// Impossible to have a DCI N0, we have condition before
case DCIFormatN0: case DCIFormatN0:
return(-1); return(-1);
break; break;
case DCIFormatN1_RAR: // This is DLSCH allocation for control traffic case DCIFormatN1_RAR: // This is DLSCH allocation for control traffic (no NDI and no ACK/NACK resource for RAR DCI)
ndlsch->subframe_tx[subframe] = 1; // check if it's OK
ndlsch->rnti = rnti;
ndlsch->active = 1;
type = DCI_Content->DCIN1_RAR.type; type = DCI_Content->DCIN1_RAR.type;
orderIndicator = DCI_Content->DCIN1_RAR.orderIndicator; orderIndicator = DCI_Content->DCIN1_RAR.orderIndicator;
Scheddly = DCI_Content->DCIN1_RAR.Scheddly; Sched_delay = DCI_Content->DCIN1_RAR.Scheddly;
ResAssign = DCI_Content->DCIN1_RAR.ResAssign; ResAssign = DCI_Content->DCIN1_RAR.ResAssign;
mcs = DCI_Content->DCIN1_RAR.mcs; mcs = DCI_Content->DCIN1_RAR.mcs;
RepNum = DCI_Content->DCIN1_RAR.RepNum; RepNum = DCI_Content->DCIN1_RAR.RepNum;
...@@ -205,7 +213,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -205,7 +213,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
/*Packed DCI here*/ /*Packed DCI here*/
((DCIN1_RAR_t *)DLSCH_DCI_NB)->type =type; ((DCIN1_RAR_t *)DLSCH_DCI_NB)->type =type;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->orderIndicator =orderIndicator; ((DCIN1_RAR_t *)DLSCH_DCI_NB)->orderIndicator =orderIndicator;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->Scheddly =Scheddly; ((DCIN1_RAR_t *)DLSCH_DCI_NB)->Scheddly =Sched_delay;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->ResAssign =ResAssign; ((DCIN1_RAR_t *)DLSCH_DCI_NB)->ResAssign =ResAssign;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->mcs =mcs; ((DCIN1_RAR_t *)DLSCH_DCI_NB)->mcs =mcs;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->RepNum =RepNum; ((DCIN1_RAR_t *)DLSCH_DCI_NB)->RepNum =RepNum;
...@@ -213,20 +221,47 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -213,20 +221,47 @@ 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)->HARQackRes =HARQackRes;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->DCIRep =DCIRep; ((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); NB_add_dci(eNB->DCI_pdu,DLSCH_DCI_NB,rnti,sizeof(DCIN1_RAR_t),aggregation,sizeof_DCIN1_RAR_t,DCIFormatN1_RAR);
// use this value to configure PHY both harq_processes and resource mapping. // use this value to configure PHY both harq_processes and resource mapping.
ndlsch_harq->scheduling_delay = Sched_delay;
ndlsch_harq->resource_assignment = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlsch_harq->repetition_number = RepNum;
ndlsch_harq->dci_subframe_repetitions = DCIRep;
ndlsch_harq->modulation = 2; //QPSK
if(ndlsch_harq->round == 0) //this should be set from initialization (init-lte)
ndlsch_harq->status = ACTIVE;
ndlsch_harq->mcs = mcs;
ndlsch_harq->TBS = TBStable[get_I_TBS(ndlsch_harq->mcs)][ndlsch_harq->resource_assignment-1]; // this table should be rewritten for nb-iot
ndlsch_harq->frame = frame;
ndlsch_harq->subframe = subframe;
//ndlsch_harq->B; we don-t have now my is given when we receive the dlsch data
//ndlsch->error_treshold
//ndlsch->G??
//ndlsc->nsoft?? //set in new_eNB_dlsch (initialization)
//ndlsch-> sqrt_rho_a?? set in dlsch_modulation
//ndlsch-> sqrt_rho_b??? set in dlsch_modulation
//set in new_eNB_dlsch (initialization)
/*
* Mlimit
* nsoft
* round
*/
break;
case DCIFormatN1: // for user data case DCIFormatN1: // for user data
ndlsch->subframe_tx[subframe] = 1; // check if it's OK
type = DCI_Content->DCIN1.type; type = DCI_Content->DCIN1.type;
orderIndicator = DCI_Content->DCIN1.orderIndicator; orderIndicator = DCI_Content->DCIN1.orderIndicator;
Scheddly = DCI_Content->DCIN1.Scheddly; Sched_delay = DCI_Content->DCIN1.Scheddly;
ResAssign = DCI_Content->DCIN1.ResAssign; ResAssign = DCI_Content->DCIN1.ResAssign;
mcs = DCI_Content->DCIN1.mcs; mcs = DCI_Content->DCIN1.mcs;
RepNum = DCI_Content->DCIN1.RepNum; RepNum = DCI_Content->DCIN1.RepNum;
...@@ -237,7 +272,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -237,7 +272,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
/*Packed DCI here*/ /*Packed DCI here*/
((DCIN1_t *)DLSCH_DCI_NB)->type =type; ((DCIN1_t *)DLSCH_DCI_NB)->type =type;
((DCIN1_t *)DLSCH_DCI_NB)->orderIndicator =orderIndicator; ((DCIN1_t *)DLSCH_DCI_NB)->orderIndicator =orderIndicator;
((DCIN1_t *)DLSCH_DCI_NB)->Scheddly =Scheddly; ((DCIN1_t *)DLSCH_DCI_NB)->Scheddly =Sched_delay;
((DCIN1_t *)DLSCH_DCI_NB)->ResAssign =ResAssign; ((DCIN1_t *)DLSCH_DCI_NB)->ResAssign =ResAssign;
((DCIN1_t *)DLSCH_DCI_NB)->mcs =mcs; ((DCIN1_t *)DLSCH_DCI_NB)->mcs =mcs;
((DCIN1_t *)DLSCH_DCI_NB)->RepNum =RepNum; ((DCIN1_t *)DLSCH_DCI_NB)->RepNum =RepNum;
...@@ -245,13 +280,31 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -245,13 +280,31 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
((DCIN1_t *)DLSCH_DCI_NB)->HARQackRes =HARQackRes; ((DCIN1_t *)DLSCH_DCI_NB)->HARQackRes =HARQackRes;
((DCIN1_t *)DLSCH_DCI_NB)->DCIRep =DCIRep; ((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); NB_add_dci(eNB->DCI_pdu,DLSCH_DCI_NB,rnti,sizeof(DCIN1_t),aggregation,sizeof_DCIN1_t,DCIFormatN1);
// use this value to configure PHY both harq_processes and resource mapping. // use this value to configure PHY both harq_processes and resource mapping.
case DCIFormatN2_Ind: // use this value to configure PHY both harq_processes and resource mapping.
ndlsch_harq->scheduling_delay = Sched_delay;
ndlsch_harq->resource_assignment = resource_to_subframe[ResAssign]; //from Isf of DCI to the number of subframe
ndlsch_harq->repetition_number = RepNum;
ndlsch_harq->dci_subframe_repetitions = DCIRep;
ndlsch_harq->modulation = 2; //QPSK
if(ndlsch_harq->round == 0){ //this should be set from initialization (init-lte)
ndlsch_harq->status = ACTIVE;
ndlsch_harq->mcs = mcs;
ndlsch_harq->TBS = TBStable[get_I_TBS(ndlsch_harq->mcs)][ndlsch_harq->resource_assignment-1]; // this table should be rewritten for nb-iot
}
ndlsch_harq->frame = frame;
ndlsch_harq->subframe = subframe;
break;
case DCIFormatN2_Ind: //MP: for the moment is not implemented
type = DCI_Content->DCIN2_Ind.type; type = DCI_Content->DCIN2_Ind.type;
directIndInf = DCI_Content->DCIN2_Ind.directIndInf; directIndInf = DCI_Content->DCIN2_Ind.directIndInf;
...@@ -262,14 +315,15 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -262,14 +315,15 @@ 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)->directIndInf =directIndInf;
((DCIN2_Ind_t *)DLSCH_DCI_NB)->resInfoBits =resInfoBits; ((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); NB_add_dci(eNB->DCI_pdu,DLSCH_DCI_NB,rnti,sizeof(DCIN2_Ind_t),aggregation,sizeof_DCIN2_Ind_t,DCIFormatN2_Ind);
// use this value to configure PHY both harq_processes and resource mapping. // use this value to configure PHY both harq_processes and resource mapping.
break;
case DCIFormatN2_Pag: case DCIFormatN2_Pag: //MP: for the moment is not implemented
type = DCI_Content->DCIN2_Pag.type; type = DCI_Content->DCIN2_Pag.type;
ResAssign = DCI_Content->DCIN2_Pag.ResAssign; ResAssign = DCI_Content->DCIN2_Pag.ResAssign;
...@@ -284,11 +338,12 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -284,11 +338,12 @@ 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)->RepNum =RepNum;
((DCIN2_Pag_t *)DLSCH_DCI_NB)->DCIRep =DCIRep; ((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); NB_add_dci(eNB->DCI_pdu,DLSCH_DCI_NB,rnti,sizeof(DCIN2_Pag_t),aggregation,sizeof_DCIN2_Pag_t,DCIFormatN2_Pag);
// use this value to configure PHY both harq_processes and resource mapping. // use this value to configure PHY both harq_processes and resource mapping.
break;
default: default:
......
...@@ -168,6 +168,7 @@ typedef struct { ...@@ -168,6 +168,7 @@ typedef struct {
uint8_t codeword; uint8_t codeword;
} LTE_DL_eNB_HARQ_t; } LTE_DL_eNB_HARQ_t;
typedef struct { typedef struct {
/// Indicator of first transmission /// Indicator of first transmission
uint8_t first_tx; uint8_t first_tx;
...@@ -286,7 +287,6 @@ typedef struct { ...@@ -286,7 +287,6 @@ typedef struct {
} LTE_eNB_DLSCH_t; } LTE_eNB_DLSCH_t;
#define PUSCH_x 2 #define PUSCH_x 2
#define PUSCH_y 3 #define PUSCH_y 3
...@@ -805,6 +805,8 @@ typedef struct { ...@@ -805,6 +805,8 @@ typedef struct {
// NB-IoT // NB-IoT
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
typedef struct typedef struct
{ {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
...@@ -850,11 +852,49 @@ typedef struct ...@@ -850,11 +852,49 @@ typedef struct
}NB_IoT_eNB_NPDCCH_t; }NB_IoT_eNB_NPDCCH_t;
typedef struct {
/// NB-IoT
/// The scheduling the NPDCCH and the NPDSCH transmission TS 36.213 Table 16.4.1-1
uint8_t scheduling_delay;
/// The number of the subframe to transmit the NPDSCH TB TS 36.213 Table 16.4.1.3-1
/// FAPI spec P.181 for the NPDSCH containing BCCH value 1-8, while 36.331 P.190 value only 2 & 8
/// Nsf
uint8_t resource_assignment;
/// Determined the repeat number of NPDSCH TB TS 36.213 Table 16.4.1.3-2 (Nrep)
uint8_t repetition_number;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
/// Determined the repetition number value 0-3
uint8_t dci_subframe_repetitions;
/// modulation always QPSK Qm = 2
uint8_t modulation;
/// Status Flag indicating for this DLSCH (idle,active,disabled)
SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits, "B" from 36-212
uint32_t B;
/// Pointer to the payload
uint8_t *b;
///pdu of the ndlsch message
uint8_t*pdu;
/// Frame where current HARQ round was sent
uint32_t frame;
/// Subframe where current HARQ round was sent
uint32_t subframe;
/// Index of current HARQ round for this DLSCH
uint8_t round;
/// MCS format for this NDLSCH , TS 36.213 Table 16.4.1.5
uint8_t mcs;
// we don't have code block segmentation / crc attachment / concatenation in NB-IoT R13 36.212 6.4.2
// we don't have beamforming in NB-IoT
} NB_IoT_DL_eNB_HARQ_t;
typedef struct { typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8]; int32_t *txdataF[8];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t **ue_spec_bf_weights[4];
/// dl channel estimates (estimated from ul channel estimates) /// dl channel estimates (estimated from ul channel estimates)
int32_t **calib_dl_ch_estimates; int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used) /// Allocated RNTI (0 means DLSCH_t is not currently used)
...@@ -867,26 +907,14 @@ typedef struct { ...@@ -867,26 +907,14 @@ typedef struct {
uint8_t nCCE[10]; uint8_t nCCE[10];
/*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/ /*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/
/// Current HARQ process id
//uint8_t current_harq_pid;
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids /// The only HARQ process for the DLSCH
//uint8_t harq_ids[10]; NB_IoT_DL_eNB_HARQ_t *harq_process;
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation
uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// The only HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t *harq_process;
/// Number of soft channel bits /// Number of soft channel bits
uint32_t G; uint32_t G;
/// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index;
/// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
//uint8_t Mdlharq;
/// Maximum number of HARQ rounds /// Maximum number of HARQ rounds
uint8_t Mlimit; uint8_t Mlimit;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
//uint8_t Kmimo;
/// Nsoft parameter related to UE Category /// Nsoft parameter related to UE Category
uint32_t Nsoft; uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots /// amplitude of PDSCH (compared to RS) in symbols without pilots
...@@ -894,25 +922,96 @@ typedef struct { ...@@ -894,25 +922,96 @@ typedef struct {
/// amplitude of PDSCH (compared to RS) in symbols containing pilots /// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b; int16_t sqrt_rho_b;
///NB-IoT
/// may use in the npdsch_procedures
uint16_t scrambling_sequence_intialization;
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
/*
* This indicate the current subframe within the subframe interval between the NPDSCH transmission (Nsf*Nrep)
*/
uint16_t sf_index;
} NB_IoT_eNB_NDLSCH_t; } NB_IoT_eNB_NDLSCH_t;
typedef struct {
/// Determined the subcarrier allocation for the NPUSCH.(15, 3.75 KHz)
uint8_t subcarrier_indication;
/// Determined the number of resource unit for the NPUSCH
uint8_t resource_assignment;
/// Determined the scheduling delay for NPUSCH
uint8_t scheduling_delay;
/// The number of the repetition number for NPUSCH Transport block
uint8_t repetition_number;
/// Determined the repetition number value 0-3
uint8_t dci_subframe_repetitions;
/// Flag indicating that this ULSCH has been allocated by a DCI (otherwise it is a retransmission based on PHICH NAK)
uint8_t dci_alloc;
/// Flag indicating that this ULSCH has been allocated by a RAR (otherwise it is a retransmission based on PHICH NAK or DCI)
uint8_t rar_alloc;
/// Status Flag indicating for this ULSCH (idle,active,disabled)
SCH_status_t status;
/// Subframe scheduling indicator (i.e. Transmission opportunity indicator)
uint8_t subframe_scheduling_flag;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits
uint32_t B;
/// Number of soft channel bits
uint32_t G;
/// Pointer to ACK
uint8_t o_ACK[4];
/// Length of ACK information (bits)
uint8_t O_ACK;
/// Temporary h sequence to flag PUSCH_x/PUSCH_y symbols which are not scrambled
uint8_t h[MAX_NUM_CHANNEL_BITS];
/// Pointer to the payload
uint8_t *b;
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// Index of current HARQ round for this ULSCH
uint8_t round;
/// MCS format for this ULSCH
uint8_t mcs;
/// Redundancy-version of the current sub-frame (value 0->RV0,value 1 ->RV2)
uint8_t rvidx;
/// Msc_initial, Initial number of subcarriers for ULSCH (36-212, v8.6 2009-03, p.26-27)
uint16_t Msc_initial;
/// Nsymb_initial, Initial number of symbols for ULSCH (36-212, v8.6 2009-03, p.26-27)
uint8_t Nsymb_initial;
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2)
uint8_t n_DMRS;
/// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2) - previous scheduling
/// This is needed for PHICH generation which
/// is done after a new scheduling
uint8_t previous_n_DMRS;
/// n_DMRS 2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1)
uint8_t n_DMRS2;
/// Flag to indicate that this ULSCH is for calibration information sent from UE (i.e. no MAC SDU to pass up)
// int calibration_flag;
/// delta_TF for power control
int32_t delta_TF;
} NB_IoT_UL_eNB_HARQ_t;
typedef struct { typedef struct {
/// Pointers to 8 HARQ processes for the ULSCH /// Pointers to 8 HARQ processes for the ULSCH
LTE_UL_eNB_HARQ_t *harq_process; NB_IoT_UL_eNB_HARQ_t *harq_process;
/// Maximum number of HARQ rounds /// Maximum number of HARQ rounds
uint8_t Mlimit; uint8_t Mlimit;
/// Maximum number of iterations used in eNB turbo decoder
//uint8_t max_turbo_iterations; /// Value 0 = npush format 1 (data) value 1 = npusch format 2 (ACK/NAK)
//boundling not exist in NB-IoT since we are not using TDD and only 1 HARQ process uint8_t npusch_format;
/// ACK/NAK Bundling flag
//uint8_t bundling;
/// beta_offset_cqi times 8
uint16_t beta_offset_cqi_times8;
/// beta_offset_ri times 8
uint16_t beta_offset_ri_times8;
/// beta_offset_harqack times 8
uint16_t beta_offset_harqack_times8;
/// Flag to indicate that eNB awaits UE Msg3 /// Flag to indicate that eNB awaits UE Msg3
uint8_t Msg3_active; uint8_t Msg3_active;
/// Flag to indicate that eNB should decode UE Msg3 /// Flag to indicate that eNB should decode UE Msg3
...@@ -927,10 +1026,19 @@ typedef struct { ...@@ -927,10 +1026,19 @@ typedef struct {
uint8_t cyclicShift; uint8_t cyclicShift;
/// cooperation flag /// cooperation flag
uint8_t cooperation_flag; uint8_t cooperation_flag;
/// num active cba group /// (only in-band mode), indicate the resource block overlap the SRS configuration of LTE
//uint8_t num_active_cba_groups; uint8_t N_srs;
/// allocated CBA RNTI for this ulsch
//uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP]; uint8_t scrambling_re_intialization_batch_index;
/// number of cell specific TX antenna ports assumed by the UE
uint8_t nrs_antenna_ports;
uint16_t scrambling_sequence_intialization;
uint16_t sf_index;
/// Determined the ACK/NACK delay and the subcarrier allocation TS 36.213 Table 16.4.2
uint8_t HARQ_ACK_resource;
} NB_IoT_eNB_NULSCH_t; } NB_IoT_eNB_NULSCH_t;
......
...@@ -234,7 +234,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_ ...@@ -234,7 +234,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
} }
/*
NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB(//unsigned char Kmimo, NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB(//unsigned char Kmimo,
//unsigned char Mdlharq, //unsigned char Mdlharq,
uint32_t Nsoft, uint32_t Nsoft,
...@@ -295,9 +295,7 @@ NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB(//unsigned char Kmimo, ...@@ -295,9 +295,7 @@ NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB(//unsigned char Kmimo,
//In NB-IoT we have only 1 HARQ process for each User------------- //In NB-IoT we have only 1 HARQ process for each User-------------
/*
* for Nb-IoT we are using the same HARQ structure as for LTE (for the moment)
*/
dlsch->harq_process = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t)); dlsch->harq_process = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
LOG_T(PHY, "[NB-IoT] Required mem size %d (bw scaling %d), dlsch->harq_process %p\n", LOG_T(PHY, "[NB-IoT] Required mem size %d (bw scaling %d), dlsch->harq_process %p\n",
MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling,dlsch->harq_process); MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling,dlsch->harq_process);
...@@ -365,7 +363,7 @@ NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB(//unsigned char Kmimo, ...@@ -365,7 +363,7 @@ NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB(//unsigned char Kmimo,
} }
*/
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
{ {
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "SCHED/extern.h" #include "SCHED/extern.h"
#include "defs.h" #include "defs.h"
#include "extern.h" #include "extern.h"
#include "PHY/LTE_REFSIG/defs.h"
#include "common_lib.h" #include "common_lib.h"
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "PHY/extern.h" #include "PHY/extern.h"
#include "PHY/sse_intrin.h" #include "PHY/sse_intrin.h"
#ifdef PHY_ABSTRACTION #ifdef PHY_ABSTRACTION
#include "SIMULATION/TOOLS/defs.h" #include "SIMULATION/TOOLS/defs.h"
#endif #endif
...@@ -50,6 +51,8 @@ ...@@ -50,6 +51,8 @@
#include "PHY_INTERFACE/defs.h" #include "PHY_INTERFACE/defs.h"
#endif #endif
#include "PHY/LTE_REFSIG/defs.h"
#define PBCH_A 24 #define PBCH_A 24
int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/defs_nb_iot.h" #include "PHY/defs_nb_iot.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB, void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF, int32_t **txdataF,
...@@ -42,11 +43,12 @@ void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB, ...@@ -42,11 +43,12 @@ void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
//Generate Pilots for slot 0 and 1 //Generate Pilots for slot 0 and 1
//antenna 0 symbol 5 slot 0 //antenna 0 symbol 5 slot 0
lte_dl_cell_spec_NB_IoT(phy_vars_eNB,&txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], // tti_offset 512 x 32 bits lte_dl_cell_spec_NB_IoT(phy_vars_eNB,
&txdataF[0][tti_offset + (first_pilot*samples_per_symbol)], // tti_offset 512 x 32 bits
amp, amp,
RB_IoT_ID, RB_IoT_ID,
slot_offset, slot_offset,
0, 0, //p
0); 0);
//antenna 0 symbol 6 slot 0 //antenna 0 symbol 6 slot 0
......
...@@ -99,8 +99,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -99,8 +99,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
uint16_t rnti, uint16_t rnti,
DCI_format_NB_t dci_format, DCI_format_NB_t dci_format,
uint8_t UE_id, uint8_t UE_id,
uint8_t aggregation, uint8_t aggregation
uint8_t Num_dci
); );
/*Use the DL DCI Information to configure PHY and also Packed*/ /*Use the DL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
...@@ -109,10 +108,9 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB, ...@@ -109,10 +108,9 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
DCI_CONTENT *DCI_Content, DCI_CONTENT *DCI_Content,
uint16_t rnti, uint16_t rnti,
DCI_format_NB_t dci_format, DCI_format_NB_t dci_format,
LTE_eNB_DLSCH_t *dlsch, NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_DL_FRAME_PARMS *frame_parms, NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation, uint8_t aggregation
uint8_t Num_dci
); );
......
...@@ -164,7 +164,7 @@ LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uin ...@@ -164,7 +164,7 @@ LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uin
return(NULL); return(NULL);
} }
/*
NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag) NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag)
{ {
...@@ -197,10 +197,7 @@ NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag) ...@@ -197,10 +197,7 @@ NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag)
//MP: add some parameters in npusch structure for convolutional coding to be set //MP: add some parameters in npusch structure for convolutional coding to be set
ulsch->Mlimit = 4; ulsch->Mlimit = 4;
/*
* In NB-IoT we have only 1 HARQ process for each UE
* we use the same HARQ process structure as LTE
*/
ulsch->harq_process = (LTE_UL_eNB_HARQ_t *)malloc16(sizeof(LTE_UL_eNB_HARQ_t)); ulsch->harq_process = (LTE_UL_eNB_HARQ_t *)malloc16(sizeof(LTE_UL_eNB_HARQ_t));
if (ulsch->harq_process) { if (ulsch->harq_process) {
...@@ -245,7 +242,7 @@ NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag) ...@@ -245,7 +242,7 @@ NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag)
return(NULL); return(NULL);
} }
*/
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch) void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch)
{ {
......
...@@ -217,6 +217,12 @@ typedef struct { ...@@ -217,6 +217,12 @@ typedef struct {
/// scheduling parameters for RXn-TXnp4 thread /// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx; struct sched_param sched_param_rxtx;
/// NB-IoT for IF_Module
pthread_t pthread_l2;
pthread_cond_t cond_l2;
pthread_mutex_t mutex_l2;
int instance_cnt_l2;
pthread_attr_t attr_l2;
} eNB_rxtx_proc_t; } eNB_rxtx_proc_t;
typedef struct { typedef struct {
...@@ -447,7 +453,7 @@ typedef struct { ...@@ -447,7 +453,7 @@ typedef struct {
} DCI_ALLOC_NB_t; } DCI_ALLOC_NB_t;
typedef struct { typedef struct {
//delete the count for the DCI numbers,NUM_DCI_MAX should set to 1 //delete the count for the DCI numbers,NUM_DCI_MAX should set to 2
uint32_t num_npdcch_symbols; uint32_t num_npdcch_symbols;
uint8_t Num_dci; uint8_t Num_dci;
DCI_ALLOC_NB_t dci_alloc[2] ; DCI_ALLOC_NB_t dci_alloc[2] ;
...@@ -723,9 +729,10 @@ typedef struct PHY_VARS_eNB_s { ...@@ -723,9 +729,10 @@ typedef struct PHY_VARS_eNB_s {
NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAX_NB_IoT]; //check the max size of this array 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_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_IoT_eNB_NDLSCH_t *ndlsch_SI,*ndlsch_ra;
NB_DL_FRAME_PARMS frame_parms_nb_iot; NB_DL_FRAME_PARMS frame_parms_nb_iot;
// DCI for at most 2 DCI pdus
DCI_PDU_NB *DCI_pdu; DCI_PDU_NB *DCI_pdu;
......
#include "../SCHED/IF_Module_L1_primitives_nb_iot.h" #include "../SCHED/IF_Module_L1_primitives_nb_iot.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "PHY/vars.h"
handle_nfapi_dlsch_pdu_NB(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
nfapi_dl_config_request_pdu_t *dl_config_pdu,
uint8_t *sdu,
uint8_t rnti_type) {
NB_IoT_eNB_NDLSCH_t *ndlsch;
NB_IoT_DL_eNB_HARQ_t *ndlsch_harq;
nfapi_dl_config_ndlsch_pdu_rel13_t *rel13 = &dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13;
//Check for SI PDU since in NB-IoT there is no DCI for that
//SIB (type 0), other DLSCH data (type 1)
if(rnti_type == 0)
{
ndlsch = eNB->ndlsch_SI;
ndlsch_harq = ndlsch->harq_process;
ndlsch_harq->pdu = sdu;
//should be from 1 to 8
ndlsch_harq->resource_assignment = rel13->number_of_subframes_for_resource_assignment;
ndlsch_harq->repetition_number = rel13->repetition_number;
ndlsch_harq->modulation = rel13->modulation;
ndlsch_harq->status = ACTIVE;
//SI information in reality have no feedback
// ndlsch_harq->frame = frame;
// ndlsch_harq->subframe = subframe;
ndlsch->nrs_antenna_ports = rel13->nrs_antenna_ports_assumed_by_the_ue;
ndlsch->scrambling_sequence_intialization = rel13->scrambling_sequence_initialization_cinit;
}
else
{
//TODO
// program addition DLSCH parameters not from DCI
//int UE_id = find_dlsch(rel13->rnti,eNB,SEARCH_EXIST);
//AssertFatal(UE_id==-1,"no existing dlsch_context\n");
//ndlsch_harq = eNB->ndlsch[UE_id]->harq_processes;
//AssertFatal(dlsch_harq!=NULL,"dlsch_harq is null\n");
//dlsch_harq->pdu = sdu;
}
}
// do the schedule response and trigger the TX
void schedule_response(Sched_Rsp_t *Sched_INFO)
{
//XXX check if correct to take eNB like this
PHY_VARS_eNB *eNB = PHY_vars_eNB_g[0][Sched_INFO->CC_id];
eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
NB_IoT_DL_eNB_HARQ_t* ndlsch_harq;
NB_IoT_eNB_NDLSCH_t *ndlsch_SI;
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;
AsserFatal(proc->subframe_tx != subframe, "Current subframe %d != NFAPI subframe %d\n",proc->subframe_tx,subframe);
AsserFatal(proc->frame_tx != frame, "Current sframe %d != NFAPI frame %d\n", proc->frame_tx,frame );
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 (DCI) 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:
//TODO
break;
case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
handle_nfapi_dlsch_pdu_NB(eNB, proc,dl_config_pdu,Sched_INFO->sdu[i],dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.rnti_type);
break;
default:
LOG_E(PHY, "dl_config_pdu type not for NB_IoT\n");
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;
default:
LOG_E(PHY, "dl_config_pdu type not for NB_IoT\n");
break;
}
}
for(i = 0; i , number_ul_pdu; i++)
{
ul_config_pdu = &UL_req->ul_config_request_body.ul_config_pdu_list[i];
switch(ul_config_pdu->pdu_type)
{
case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
//TODO
break;
case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
//TODO
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){ void PHY_config_req(PHY_Config_t* config_INFO){
......
...@@ -374,6 +374,8 @@ uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1); ...@@ -374,6 +374,8 @@ uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
//NB-IoT
int8_t find_ue_NB(uint16_t rnti, PHY_VARS_eNB *eNB);
int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB); int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rnti); int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rnti);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
void process_schedule_rsp(Sched_Rsp_t *sched_rsp, void process_schedule_rsp(Sched_Rsp_t *sched_rsp,
PHY_VARS_eNB *eNB, PHY_VARS_eNB *eNB,
eNB_rxtx_proc_NB_t *proc); eNB_rxtx_proc_t *proc);
/*Processing the ue-specific resources for uplink in NB-IoT*/ /*Processing the ue-specific resources for uplink in NB-IoT*/
void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, UL_IND_t *UL_INFO); void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, UL_IND_t *UL_INFO);
...@@ -18,13 +18,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, UL ...@@ -18,13 +18,13 @@ 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); 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*/ /*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*/ /*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.*/ /*Process all the scheduling result from MAC and also common signals.*/
void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_NB_t *proc,int do_meas); void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int do_meas);
#endif #endif
...@@ -77,7 +77,7 @@ void NB_common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) ...@@ -77,7 +77,7 @@ void NB_common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
int subframe = proc->subframe_tx; int subframe = proc->subframe_tx;
int frame = proc->frame_tx; int frame = proc->frame_tx;
uint16_t Ntti = 10;//ntti = 10 uint16_t Ntti = 10;//ntti = 10
int RB_IoT_ID;// RB reserved for NB-IoT, PRB index int RB_IoT_ID;// XXX should be initialized (RB reserved for NB-IoT, PRB index)
int With_NSSS;// With_NSSS = 1; if the frame include a sub-Frame with NSSS signal int With_NSSS;// With_NSSS = 1; if the frame include a sub-Frame with NSSS signal
/*NSSS only happened in the even frame*/ /*NSSS only happened in the even frame*/
...@@ -447,244 +447,157 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,UL_ ...@@ -447,244 +447,157 @@ 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*/ /*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; NB_DL_FRAME_PARMS *fp=&eNB->frame_parms_nb_iot;
int frame = proc->frame_tx; int frame = proc->frame_tx;
int subframe = proc->subframe_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;
NB_IoT_eNB_NDLSCH_t *ndlsch;
//DCI_Content = (DCI_CONTENT*) malloc(sizeof(DCI_CONTENT));
DCI_Content = (DCI_CONTENT*) malloc(sizeof(DCI_CONTENT));
// In NB-IoT, there is no DCI for SI, we might use the scheduling infomation from SIB1-NB to get the phyical layer configuration. // 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 //mapping the fapi parameters to the oai parameters
for (int i = 0; i< Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci; i++){ // check DCI format is N1 (format 0) or N2 (format 1)
switch (Sched_Rsp->NB_DL.NB_DCI->DCI_Format){ if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_format == 0)
case DCIFormatN1_RAR: {
//DCI format N1 to RAR //check DCI format N1 is for RAR ra_rnti = 2 in FAPI specs table 4-45
DCI_Content[i].DCIN1_RAR.type = 1; if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti_type == 2)
//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_format = DCIFormatN1_RAR;
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; ndlsch= eNB->ndlsch_ra;
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; //DCI format N1 to RAR
DCI_Content->DCIN1_RAR.type = 1;
// configure dlsch parameters and CCE index (fill the dlsch_ra structure???) DCI_Content->DCIN1_RAR.orderIndicator = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication;
LOG_D(PHY,"Generating dlsch params for RA_RNTI\n"); 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;
NB_generate_eNB_dlsch_params_from_dci(eNB, DCI_Content->DCIN1_RAR.mcs = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.mcs;
frame, DCI_Content->DCIN1_RAR.RepNum = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.repetition_number;
subframe, DCI_Content->DCIN1_RAR.ndi = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.new_data_indicator;
&DCI_Content[i], DCI_Content->DCIN1_RAR.HARQackRes = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource;
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.rnti, DCI_Content->DCIN1_RAR.DCIRep = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number;
DCIFormatN1_RAR,
&eNB->dlsch_ra_NB,
fp, // fill the dlsch_ra_NB sructure for RAR, and packed the DCI PDU
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.aggregation_level, LOG_D(PHY,"Generating dlsch params for RA_RNTI\n");
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci NB_generate_eNB_dlsch_params_from_dci(eNB,
); frame,
break; subframe,
case DCIFormatN1: DCI_Content,
//DCI format N1 to DLSCH dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCI_Content[i].DCIN1.type = 1; DCI_format,
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; ndlsch,
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; fp,
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; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level
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; //eNB->dlsch_ra_NB->nCCE[subframe] = eNB->DCI_pdu->dci_alloc.firstCCE;
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; }
else
{ //managing data
//fill the dlsch[] structure???
NB_generate_eNB_dlsch_params_from_dci(eNB, //TODO target/SIMU/USER?init_lte/init_lte_eNB we should allocate the ndlsch structures
frame, UE_id = find_ue_NB(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti, eNB);
subframe, AssertFatal(UE_id == -1, "no ndlsch context available or no ndlsch context corresponding to that rnti\n");
&DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.rnti, ndlsch = eNB->ndlsch[UE_id]; //in the old implementation they also consider UE_id = 1;
DCIFormatN1,
eNB->ndlsch[(uint8_t)UE_id], //DCI format N1 to DLSCH
fp, DCI_Content->DCIN1.type = 1;
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.aggregation_level, DCI_Content->DCIN1.orderIndicator = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication;
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci 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;
break; DCI_Content->DCIN1.mcs = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.mcs;
/*TODO reserve for the N2 DCI*/ DCI_Content->DCIN1.RepNum = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.repetition_number;
case DCIFormatN2_Pag: DCI_Content->DCIN1.ndi = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.new_data_indicator;
LOG_I(PHY, "Paging is not implemented, DCIFormatN2_Pag cannot be elaborated\n"); DCI_Content->DCIN1.HARQackRes = dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource;
break; 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 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) {
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) void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu) {
for(int i = 0; i<Sched_Rsp->NB_DL.NB_DCI->UL_DCI.number_of_dci; i++) int UE_id = -1;
{ int harq_pid = 0;
DCI_CONTENT *DCI_Content;
DCI_Content = (DCI_CONTENT*) malloc(sizeof(DCI_CONTENT));
//mapping the fapi parameters to the OAI parameters //mapping the fapi parameters to the OAI parameters
DCI_Content[i].DCIN0.type = 0; DCI_Content->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->DCIN0.scind = hi_dci0_pdu->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->DCIN0.ResAssign = hi_dci0_pdu->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->DCIN0.mcs = hi_dci0_pdu->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->DCIN0.ndi = hi_dci0_pdu->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->DCIN0.Scheddly = hi_dci0_pdu->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->DCIN0.RepNum = hi_dci0_pdu->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->DCIN0.rv = hi_dci0_pdu->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.DCIRep = hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number;
UE_id = find_ue_NB(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");
/*Log for generate ULSCH DCI*/ /*Log for generate ULSCH DCI*/
NB_generate_eNB_ulsch_params_from_dci(eNB, NB_generate_eNB_ulsch_params_from_dci(eNB,
proc, proc,
&DCI_Content[i], DCI_Content,
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti, hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti,
DCIFormatN0, DCIFormatN0,
UE_id, UE_id,
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level, hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.number_of_dci
); );
//LOG for ULSCH DCI Resource allocation //LOG for ULSCH DCI Resource allocation
//CBA is not used in NB-IoT //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->nulsch[(uint32_t)UE_id]->harq_process->subframe_scheduling_flag = 1;
// 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_NB_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
}
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 * for NB-IoT ndlsch procedure
...@@ -977,7 +890,7 @@ extern int oai_exit; ...@@ -977,7 +890,7 @@ extern int oai_exit;
r_type, rn is only used in PMCH procedure so I remove it. r_type, rn is only used in PMCH procedure so I remove it.
*/ */
void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_NB_t *proc, eNB_rxtx_proc_t *proc,
int do_meas) int do_meas)
{ {
int frame = proc->frame_tx; int frame = proc->frame_tx;
...@@ -994,8 +907,6 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -994,8 +907,6 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
int **txdataF = eNB->common_vars.txdataF[0]; int **txdataF = eNB->common_vars.txdataF[0];
Sched_Rsp_t *sched_rsp;
// are needed??? (maybe not) // are needed??? (maybe not)
//uint8_t num_npdcch_symbols = 0; //uint8_t num_npdcch_symbols = 0;
...@@ -1003,17 +914,6 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1003,17 +914,6 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
start_meas(&eNB->phy_proc_tx); 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)*/ /*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 // clear the transmit data array for the current subframe
...@@ -1024,31 +924,10 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1024,31 +924,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 //generate NPSS/NSSS
NB_common_signal_procedures(eNB,proc); 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 /*Generate MIB
* *
* *
...@@ -1072,42 +951,34 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1072,42 +951,34 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
*in general this RB-ID should be w.r.t LTE bandwidht??? *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 **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, txdataF,
AMP, AMP,
fp, 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, frame%64,
fp->NB_IoT_RB_ID 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) * Generate BCCH transmission (System Information)
*/ */
// check for BCCH
//rnti_type = 0 BCCH information /*TODO: NPDSCH procedures for BCCH for NB-IoT
//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*/
npdsch_procedures(eNB, npdsch_procedures(eNB,
proc, proc,
eNB->dlsch_SI_NB, //should be filled ?? (in the old implementation was filled when from DCI we generate_dlsch_params 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_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) //no HARQ pid (we have only 1 single process for each user)
...@@ -1131,34 +1002,14 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ...@@ -1131,34 +1002,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) //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 */ /*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 //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;
}
......
...@@ -133,10 +133,10 @@ typedef struct{ ...@@ -133,10 +133,10 @@ typedef struct{
/*Uplink data part*/ /*Uplink data part*/
/*indication of the uplink data*/ /*indication of the harq feedback*/
nfapi_ul_config_nulsch_pdu NULSCH; nfapi_nb_harq_indication_t nb_harq_ind;
/*Uplink data PDU*/ /*indication of the uplink data PDU*/
nfapi_rx_indication_body_t RX_NPUSCH; nfapi_rx_indication_body_t RX_NPUSCH;
/*crc_indication*/ /*crc_indication*/
nfapi_crc_indication_body_t crc_ind; nfapi_crc_indication_body_t crc_ind;
...@@ -144,67 +144,28 @@ typedef struct{ ...@@ -144,67 +144,28 @@ typedef struct{
// Downlink subframe P7 // 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{ typedef struct{
/*Start at the common part*/ /*Start at the common part*/
//Module ID //Module ID
module_id_t module_idP; module_id_t module_id;
//CC ID //CC ID
int CC_id; int CC_id;
//frame //frame
frame_t frameP; frame_t frame;
//subframe //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; }Sched_Rsp_t;
......
...@@ -577,11 +577,14 @@ int wait_CCs(eNB_rxtx_proc_t *proc) { ...@@ -577,11 +577,14 @@ int wait_CCs(eNB_rxtx_proc_t *proc) {
/*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 * 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
*
* For the moment the NB-IoT implementation foresees a single thread implementation
* */ * */
static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) { static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
//Allocate memory for the structures used by PHY and MAC
UL_IND_t *UL_INFO; UL_IND_t *UL_INFO;
Sched_Rsp_t *Sched_Rsp; Sched_Rsp_t *Sched_Rsp;
...@@ -596,29 +599,25 @@ static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_ ...@@ -596,29 +599,25 @@ static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_
if ((eNB->do_prach)&&((eNB->node_function != NGFI_RCC_IF4p5))) if ((eNB->do_prach)&&((eNB->node_function != NGFI_RCC_IF4p5)))
eNB->do_prach(eNB,proc->frame_rx,proc->subframe_rx); eNB->do_prach(eNB,proc->frame_rx,proc->subframe_rx);
/*UE-specific RX processing for subframe n*/
// skip the comment for this moment
/*
/*UE-specific RX processing for subframe n*/ * stored the Upink information in UL_info struct, process it and made it into FAPI style,
*/
NB_phy_procedures_eNB_uespec_RX(eNB,proc,UL_INFO); NB_phy_procedures_eNB_uespec_RX(eNB,proc,UL_INFO);
// 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 /*
* send the UL_Indication to higher layer that also provide a tick to the scheduler_dlsch_ulsch
* (on its turn the scheduler will trigger the phy_procedure_eNB_TX through schedule_responce function
*/
if(if_inst->UL_indication) if_inst->UL_indication(UL_INFO); 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);
if (oai_exit) return(-1); 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); if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1);
...@@ -627,51 +626,7 @@ static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_ ...@@ -627,51 +626,7 @@ static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_
return(0); return(0);
} }
/*!
* \brief The RX UE-specific and TX thread of NB-IoT eNB (NB-rxtx).
* \param param is a \ref eNB_proc_t structure which contains the info what to process.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static void* eNB_thread_NB_rxtx( void* param ) {
static int eNB_thread_rxtx_status;
eNB_rxtx_proc_t *proc = (eNB_rxtx_proc_t*)param;
PHY_VARS_eNB *eNB = PHY_vars_eNB_g[0][proc->CC_id];
char thread_name[100];
// set default return value
eNB_thread_rxtx_status = 0;
sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1);
thread_top_init(thread_name,1,850000L,1000000L,2000000L);
while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 );
if (oai_exit) break;
if (eNB->CC_id==0)
if (NB_rxtx(eNB,proc,thread_name) < 0) break;
} // while !oai_exit
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
printf( "Exiting eNB thread RXn_TXnp4\n");
eNB_thread_rxtx_status = 0;
return &eNB_thread_rxtx_status;
}
static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) { static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
start_meas(&softmodem_stats_rxtx_sf); start_meas(&softmodem_stats_rxtx_sf);
...@@ -738,7 +693,13 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -738,7 +693,13 @@ static void* eNB_thread_rxtx( void* param ) {
if (oai_exit) break; if (oai_exit) break;
if (eNB->CC_id==0) if (eNB->CC_id==0)
{
#ifdef NB_IOT
if(NB_rxtx(eNB, proc,thread_name)<0) break;
#else
if (rxtx(eNB,proc,thread_name) < 0) break; if (rxtx(eNB,proc,thread_name) < 0) break;
#endif
}
} // while !oai_exit } // while !oai_exit
......
...@@ -1694,7 +1694,7 @@ int main( int argc, char **argv ) { ...@@ -1694,7 +1694,7 @@ int main( int argc, char **argv ) {
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag); PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag);
//this is a complementary function for just initialize manage NB_ioT stuff inside the PHY_Vars //this is a complementary function for just initialize manage NB_ioT stuff inside the PHY_Vars
#ifdef NB_IOT #ifdef NB_IOT
init_lte_eNB_NB(PHY_vars_eNB_g[0][CC_id],frame_parms_nb_iot[CC_id], 0, frame_parms_nb_iot[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag); //init_lte_eNB_NB(PHY_vars_eNB_g[0][CC_id],frame_parms_nb_iot[CC_id], 0, frame_parms_nb_iot[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag);
#endif #endif
PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff; PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff;
......
...@@ -149,7 +149,11 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -149,7 +149,11 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
} }
/*this is a function just for initialization of NB-IoT stuff*/ /*this is a function just for initialization of NB-IoT stuff*/
/*
void init_lte_eNB_NB( void init_lte_eNB_NB(
PHY_VARS_eNB *PHY_vars_eNB, PHY_VARS_eNB *PHY_vars_eNB,
NB_DL_FRAME_PARMS *frame_parms, NB_DL_FRAME_PARMS *frame_parms,
...@@ -183,10 +187,6 @@ void init_lte_eNB_NB( ...@@ -183,10 +187,6 @@ void init_lte_eNB_NB(
/*
* In NB-IoT we not transmit two dlsch pdu at the same time so the dlsch dimension in PHY_vars_eNB for NB-IoT is just an array
*/
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
LOG_I(PHY,"[NB-IoT] Allocating Transport Channel Buffers for NDLSCH, UE %d\n",i); LOG_I(PHY,"[NB-IoT] Allocating Transport Channel Buffers for NDLSCH, UE %d\n",i);
PHY_vars_eNB->ndlsch[i] = new_eNB_dlsch_NB(NSOFT,abstraction_flag,frame_parms); PHY_vars_eNB->ndlsch[i] = new_eNB_dlsch_NB(NSOFT,abstraction_flag,frame_parms);
...@@ -240,7 +240,7 @@ void init_lte_eNB_NB( ...@@ -240,7 +240,7 @@ void init_lte_eNB_NB(
return; return;
} }
*/
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms, PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id, uint8_t UE_id,
......
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