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
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.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_uespec.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec_NB_IoT.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_dl_mbsfn.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 @@
#define DEBUG_PHY
#include "assertions.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_map4[138];
......
......@@ -17,7 +17,7 @@
#ifndef __LTE_REFSIG_DEFS_NB_IOT__H__
#define __LTE_REFSIG_DEFS_NB_IOT__H__
#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h"
#include "PHY/defs_nb_iot.h"
/** @ingroup _PHY_REF_SIG
* @{
......@@ -43,7 +43,10 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
short amp,
unsigned char Ns,
unsigned char l,
unsigned char p
unsigned char p,
unsigned short RB_IoT_ID);
unsigned int lte_gold_generic_NB_IoT(unsigned int *x1, unsigned int *x2, unsigned char reset);
#endif
......@@ -21,7 +21,7 @@
#include "PHY/defs.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,
int32_t *output,
......@@ -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
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)
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))
{
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)));
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->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 {
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;
......@@ -78,7 +79,7 @@ int lte_dl_cell_spec_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
DevAssert( l < 2 );
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;
}
......
......@@ -44,6 +44,7 @@ typedef enum
DCIFormatN1,
DCIFormatN1_RA,
DCIFormatN1_RAR,
DCIFormatN2,
DCIFormatN2_Ind,
DCIFormatN2_Pag,
}DCI_format_NB_t;
......
......@@ -68,8 +68,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
uint16_t rnti,
DCI_format_NB_t dci_format,
uint8_t UE_id,
uint8_t aggregation,
uint8_t Num_dci
uint8_t aggregation
)
{
......@@ -120,7 +119,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
((DCIN0_t *)ULSCH_DCI_NB)->ndi =ndi;
((DCIN0_t *)ULSCH_DCI_NB)->DCIRep =DCIRep;
eNB->DCI_pdu->Num_dci = Num_dci;
eNB->DCI_pdu->Num_dci++;
NB_add_dci(eNB->DCI_pdu,ULSCH_DCI_NB,rnti,sizeof(DCIN0_t),aggregation,sizeof_DCIN0_t,DCIFormatN0);
......@@ -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 frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_t dci_format,
LTE_eNB_DLSCH_t *dlsch,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t Num_dci
uint8_t aggregation
)
{
NB_IoT_DL_eNB_HARQ_t* ndlsch_harq = ndlsch->harq_process;
void *DLSCH_DCI_NB = NULL;
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
uint8_t type;
uint8_t type = 0;
//NPDCCH order indicator (set to 0),1 bits
uint8_t orderIndicator;
uint8_t orderIndicator = 0;
// Scheduling Delay, 3 bits
uint8_t Scheddly;
uint8_t Sched_delay = 0;
// Resourse Assignment (RU Assignment), 3 bits
uint8_t ResAssign;
uint8_t ResAssign = 0;//Isf
// Modulation and Coding Scheme, 4 bits
uint8_t mcs;
uint8_t mcs = 0;
// Repetition Number, 4 bits
uint8_t RepNum;
uint8_t RepNum = 0;
// DCI subframe repetition Number, 2 bits
uint8_t DCIRep;
uint8_t DCIRep = 0;
// New Data Indicator,1 bits
uint8_t ndi;
uint8_t ndi = 0;
// HARQ-ACK resource,4 bits
uint8_t HARQackRes;
uint8_t HARQackRes = 0;
//N2 start
//N2 parameters
//Direct indication information, 8 bits
uint8_t directIndInf;
uint8_t directIndInf= 0;
// 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);
switch (dci_format) {
// Impossible to have a DCI N0, we have condition before
case DCIFormatN0:
return(-1);
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;
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;
mcs = DCI_Content->DCIN1_RAR.mcs;
RepNum = DCI_Content->DCIN1_RAR.RepNum;
......@@ -205,7 +213,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
/*Packed DCI here*/
((DCIN1_RAR_t *)DLSCH_DCI_NB)->type =type;
((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)->mcs =mcs;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->RepNum =RepNum;
......@@ -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)->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);
// 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
ndlsch->subframe_tx[subframe] = 1; // check if it's OK
type = DCI_Content->DCIN1.type;
orderIndicator = DCI_Content->DCIN1.orderIndicator;
Scheddly = DCI_Content->DCIN1.Scheddly;
Sched_delay = DCI_Content->DCIN1.Scheddly;
ResAssign = DCI_Content->DCIN1.ResAssign;
mcs = DCI_Content->DCIN1.mcs;
RepNum = DCI_Content->DCIN1.RepNum;
......@@ -237,7 +272,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
/*Packed DCI here*/
((DCIN1_t *)DLSCH_DCI_NB)->type =type;
((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)->mcs =mcs;
((DCIN1_t *)DLSCH_DCI_NB)->RepNum =RepNum;
......@@ -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)->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);
// 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;
directIndInf = DCI_Content->DCIN2_Ind.directIndInf;
......@@ -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)->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);
// 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;
ResAssign = DCI_Content->DCIN2_Pag.ResAssign;
......@@ -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)->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);
// use this value to configure PHY both harq_processes and resource mapping.
break;
default:
......
......@@ -168,6 +168,7 @@ typedef struct {
uint8_t codeword;
} LTE_DL_eNB_HARQ_t;
typedef struct {
/// Indicator of first transmission
uint8_t first_tx;
......@@ -286,7 +287,6 @@ typedef struct {
} LTE_eNB_DLSCH_t;
#define PUSCH_x 2
#define PUSCH_y 3
......@@ -805,6 +805,8 @@ typedef struct {
// NB-IoT
//----------------------------------------------------------------------------------------------------
typedef struct
{
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
......@@ -850,11 +852,49 @@ typedef struct
}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 {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
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)
int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
......@@ -867,26 +907,14 @@ typedef struct {
uint8_t nCCE[10];
/*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
//uint8_t harq_ids[10];
/// 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;
/// The only HARQ process for the DLSCH
NB_IoT_DL_eNB_HARQ_t *harq_process;
/// Number of soft channel bits
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
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
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
......@@ -894,25 +922,96 @@ typedef struct {
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
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;
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 {
/// 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
uint8_t Mlimit;
/// Maximum number of iterations used in eNB turbo decoder
//uint8_t max_turbo_iterations;
//boundling not exist in NB-IoT since we are not using TDD and only 1 HARQ process
/// 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;
/// Value 0 = npush format 1 (data) value 1 = npusch format 2 (ACK/NAK)
uint8_t npusch_format;
/// Flag to indicate that eNB awaits UE Msg3
uint8_t Msg3_active;
/// Flag to indicate that eNB should decode UE Msg3
......@@ -927,10 +1026,19 @@ typedef struct {
uint8_t cyclicShift;
/// cooperation flag
uint8_t cooperation_flag;
/// num active cba group
//uint8_t num_active_cba_groups;
/// allocated CBA RNTI for this ulsch
//uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP];
/// (only in-band mode), indicate the resource block overlap the SRS configuration of LTE
uint8_t N_srs;
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;
......
......@@ -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,
//unsigned char Mdlharq,
uint32_t Nsoft,
......@@ -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-------------
/*
* 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));
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);
......@@ -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)
{
......
......@@ -36,6 +36,7 @@
#include "SCHED/extern.h"
#include "defs.h"
#include "extern.h"
#include "PHY/LTE_REFSIG/defs.h"
#include "common_lib.h"
......
......@@ -37,6 +37,7 @@
#include "PHY/extern.h"
#include "PHY/sse_intrin.h"
#ifdef PHY_ABSTRACTION
#include "SIMULATION/TOOLS/defs.h"
#endif
......@@ -50,6 +51,8 @@
#include "PHY_INTERFACE/defs.h"
#endif
#include "PHY/LTE_REFSIG/defs.h"
#define PBCH_A 24
int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms,
......
......@@ -14,6 +14,7 @@
#include "PHY/defs.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,
int32_t **txdataF,
......@@ -42,11 +43,12 @@ void generate_pilots_NB_IoT(PHY_VARS_eNB *phy_vars_eNB,
//Generate Pilots for slot 0 and 1
//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,
RB_IoT_ID,
slot_offset,
0,
0, //p
0);
//antenna 0 symbol 6 slot 0
......
......@@ -99,8 +99,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
uint16_t rnti,
DCI_format_NB_t dci_format,
uint8_t UE_id,
uint8_t aggregation,
uint8_t Num_dci
uint8_t aggregation
);
/*Use the DL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
......@@ -109,10 +108,9 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_t dci_format,
LTE_eNB_DLSCH_t *dlsch,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t Num_dci
uint8_t aggregation
);
......
......@@ -164,7 +164,7 @@ LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uin
return(NULL);
}
/*
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
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));
if (ulsch->harq_process) {
......@@ -245,7 +242,7 @@ NB_IoT_eNB_NULSCH_t *new_eNB_ulsch_NB(uint8_t abstraction_flag)
return(NULL);
}
*/
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch)
{
......
......@@ -217,6 +217,12 @@ typedef struct {
/// scheduling parameters for RXn-TXnp4 thread
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;
typedef struct {
......@@ -447,7 +453,7 @@ typedef struct {
} DCI_ALLOC_NB_t;
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;
uint8_t Num_dci;
DCI_ALLOC_NB_t dci_alloc[2] ;
......@@ -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_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_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;
// DCI for at most 2 DCI pdus
DCI_PDU_NB *DCI_pdu;
......
#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){
......
......@@ -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);
//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);
int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rnti);
......
......@@ -9,7 +9,7 @@
void process_schedule_rsp(Sched_Rsp_t *sched_rsp,
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*/
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
void NB_common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
/*Generate the ulsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/
void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_Rsp_t *Sched_Rsp,const int UE_id);
void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu);
/*Generate the dlsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched_Rsp_t *Sched_Rsp,const int UE_id);
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi_dl_config_request_pdu_t *dl_config_pdu);
/*Process all the scheduling result from MAC and also common signals.*/
void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_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
......@@ -133,10 +133,10 @@ typedef struct{
/*Uplink data part*/
/*indication of the uplink data*/
nfapi_ul_config_nulsch_pdu NULSCH;
/*Uplink data PDU*/
nfapi_rx_indication_body_t RX_NPUSCH;
/*indication of the harq feedback*/
nfapi_nb_harq_indication_t nb_harq_ind;
/*indication of the uplink data PDU*/
nfapi_rx_indication_body_t RX_NPUSCH;
/*crc_indication*/
nfapi_crc_indication_body_t crc_ind;
......@@ -144,67 +144,28 @@ typedef struct{
// Downlink subframe P7
typedef struct{
/*Indicate the MIB PDU*/
nfapi_dl_config_nbch_pdu_rel13_t nbch;
/*MIB PDU*/
nfapi_tx_request_pdu_t MIB_pdu;
}npbch_t;
typedef struct{
/*indicate the NPDSCH PDU*/
nfapi_dl_config_ndlsch_pdu_rel13_t ndlsch;
/*NPDSCH PDU*/
nfapi_tx_request_pdu_t NPDSCH_pdu;
}npdsch_t;
typedef struct{
// sinces FAPI spec didn't explain the format for the DCI clearly
DCI_format_NB_t DCI_Format;
/*DL DCI, it contains the DCI list and the other useful information*/
nfapi_dl_config_request_body_t DL_DCI;
/*UL DCI*/
nfapi_hi_dci0_request_body_t UL_DCI;
}npdcch_t;
typedef struct{
nfapi_ul_config_request_pdu_t ulsch_pdu;
}nulsch_t;
typedef struct{
// these structures contains both instruction and PDUs itself
npdcch_t *NB_DCI;
npdsch_t *NB_DLSCH;
npbch_t *NB_BCH;
nulsch_t *NB_UL_config;
}NB_DL_t;
typedef struct{
/*Start at the common part*/
//Module ID
module_id_t module_idP;
module_id_t module_id;
//CC ID
int CC_id;
//frame
frame_t frameP;
frame_t frame;
//subframe
sub_frame_t subframeP;
sub_frame_t subframe;
NB_DL_t NB_DL;
/// nFAPI DL Config Request
nfapi_dl_config_request_body_t *DL_req;
/// nFAPI UL Config Request
nfapi_ul_config_request_t *UL_req;
/// nFAPI HI_DCI Request
nfapi_hi_dci0_request_body_t *HI_DCI0_req;
/// Pointers to DL SDUs
uint8_t **sdu;
}Sched_Rsp_t;
......
......@@ -577,11 +577,14 @@ int wait_CCs(eNB_rxtx_proc_t *proc) {
/*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) {
//Allocate memory for the structures used by PHY and MAC
UL_IND_t *UL_INFO;
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_
if ((eNB->do_prach)&&((eNB->node_function != NGFI_RCC_IF4p5)))
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);
// 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);
// *****************************************
// 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);
NB_phy_procedures_eNB_TX(eNB,proc,NULL);
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_
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) {
start_meas(&softmodem_stats_rxtx_sf);
......@@ -738,7 +693,13 @@ static void* eNB_thread_rxtx( void* param ) {
if (oai_exit) break;
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;
#endif
}
} // while !oai_exit
......
......@@ -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);
//this is a complementary function for just initialize manage NB_ioT stuff inside the PHY_Vars
#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
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,
}
/*this is a function just for initialization of NB-IoT stuff*/
/*
void init_lte_eNB_NB(
PHY_VARS_eNB *PHY_vars_eNB,
NB_DL_FRAME_PARMS *frame_parms,
......@@ -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++) {
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);
......@@ -240,7 +240,7 @@ void init_lte_eNB_NB(
return;
}
*/
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
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