Commit 2b1c1482 authored by Michele Paffetti's avatar Michele Paffetti

almost complete the ndlsch and npdcch path. missed the coding, modulation and...

almost complete the ndlsch and npdcch path. missed the coding, modulation and scrambling function.Code compile. 140 warnings
parent 993570c2
......@@ -1045,11 +1045,13 @@ set(PHY_SRC
${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_NB_IoT.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
${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_NB_IoT.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
......@@ -1057,6 +1059,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching_NB_IoT.c
${OPENAIR1_DIR}/PHY/CODING/rate_matching.c
${OPENAIR1_DIR}/PHY/CODING/viterbi.c
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
......
......@@ -14,9 +14,10 @@
#include "defs.h"
#include "defs_NB_IoT.h"
#include "defs_nb_iot.h"
unsigned char ccodelte_table_NB_IoT[128]; // for transmitter
unsigned short glte_NB[] = { 0133, 0171, 0165 }; // {A,B} //renaimed but is exactly the same as the one in the old implementation
//unsigned char ccodelte_table_rev[128]; // for receiver
/*************************************************************************
......@@ -128,7 +129,7 @@ void ccodelte_init_NB_IoT(void)
sum = 0;
for (k = 0; k < 7; k++)
if ((i & glte[j]) & (1 << k))
if ((i & glte_NB[j]) & (1 << k))
sum++;
/* Write the sum modulo 2 in bit j */
......
......@@ -19,7 +19,7 @@
#include "PHY/defs.h"
#include "assertions.h"
#include "PHY/defs_NB_IoT.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
static uint32_t bitrev_cc[32] = {1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30};
......
......@@ -60,7 +60,7 @@ void NB_phy_config_mib_eNB(
uint16_t eutra_NumCRS_ports)
{
/*Not sure if phy parameters should be initial here or not*/
/*Not sure if phy parameters should be initial here or not (RAYMOND version)*/
/*the phy_config_mib_eNB as the entry point to allocate the context for L1. The RC contains the context for L1,L2. If RC.eNB is NULL, it hasn't been allocated earlier so we allocate it there.*/
/*if (RC.eNB == NULL) {
RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
......
......@@ -44,25 +44,26 @@
#include "T.h"
uint8_t generate_dci_top_NB(uint8_t Num_dci,
DCI_ALLOC_t *dci_alloc,
uint32_t n_rnti,
DCI_ALLOC_NB_t *dci_alloc,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
NB_DL_FRAME_PARMS *fp,
//NB_IoT_eNB_NPDCCH_t npdcch,
int32_t **txdataF,
uint32_t subframe)
{
int i,L;
/*
int i,L, G;
int npdcch_start_index;
/* PARAMETERS may not needed
**e_ptr : store the encoding result, and as a input to modulation
*num_pdcch_symbols : to calculate the resource allocation for pdcch
*L = aggregation level (there is 2 (at most) in NB-IoT) (Note this is not the real value but the index)
*lprime,kprime,kprime_mod12,mprime,nsymb,symbol_offset,tti_offset,re_offset : used in the REG allocation
*gain_lin_QPSK,yseq0[Msymb],yseq1[Msymb],*y[2] : used in the modulation
*mi = used in interleaving
*e = used to store the taus sequence (taus sequence is used to generate the first sequence for DCI)
*e = used to store the taus sequence (taus sequence is used to generate the first sequence for DCI) Turbo coding
*wbar used in the interleaving and also REG allocation
*/
......@@ -70,11 +71,13 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
// generate DCIs in order of decreasing aggregation level, then common/ue spec
// MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization
// there is only 2 aggregation (0 = 1, 1 = 2)
for (L=1; L>=0; L--) {
// MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization???
// Value of aggregation level (FAPI/NFAPI specs v.9.0 pag 221 value 1,2)
for (L=2; L>=1; L--) {
for (i=0; i<Num_dci; i++) {
//XXX should be checked how the scheduler store the aggregation level for NB-IoT (value 1-2 or 0-1)
if (dci_alloc[i].L == (uint8_t)L) {
if (dci_alloc[i].firstCCE>=0) {
......@@ -89,66 +92,93 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
//rm_stats, te_stats, i_stats
);*/
}
}
}
}
// Scrambling
//pdcch_scrambling(frame_parms,subframe,e,8*get_nquad(num_pdcch_symbols, frame_parms, mi));
//NB-IoT--------------------------
//NB-IoT scrambling
/*
* switch(npdcch_start_index) (see mail)
*
* case 0
* G = 304
* case 1
* G = 240
* case 2
* G = 224
* case 3
* G = 200
* TS 36.213 ch 16.6.1
* npdcch_start_index indicate the starting OFDM symbol for NPDCCH in the first slot of a subframe k ad is determined as follow:
* - if eutracontrolregionsize is present (defined for in-band operating mode (mode 0,1 for FAPI specs))
* npdcch_start_index = eutracontrolregionsize (value 1,2,3) [units in number of OFDM symbol]
* -otherwise
* npdcch_start_index = 0
*
*Depending on npddch_start_index then we define different values for G
*/
/*
// NB-IoT scrambling
npdcch_scrambling_NB_IoT(
frame_parms,
npdcch,
//G,
//q = nf mod 2 (TS 36.211 ch 10.2.3.1) with nf = number of frame
//slot_id
);
//XXX the setting of this npdcch_start_index parameter should be done in the MAC
// if(fp->operating_mode == 0 || fp->operating_mode == 1) //in-band operating mode
// {
// npdcch_start_index = fp->control_region_size;
// }
// else
// {
// npdcch_start_index = 0;
// }
for(int i = 0; i <Num_dci; i++)
{
switch(dci_alloc[i].npdcch_start_symbol) //mail Bcom matthieu
{
case 0:
G = 304;
break;
case 1:
G = 240;
break;
case 2:
G = 224;
break;
case 3:
G =200;
break;
default:
LOG_E (PHY,"npdcch_start_index has unwanted value\n");
break;
}
// // NB-IoT scrambling
// npdcch_scrambling_NB_IoT(
// frame_parms,
// npdcch,
// //G,
// //q = nf mod 2 (TS 36.211 ch 10.2.3.1) with nf = number of frame
// //slot_id
// );
}
//NB-IoT modulation
npdcch_modulation_NB_IoT(
txdataF,
AMP,
frame_parms,
//no symbol
//npdcch0???
//RB_ID --> statically get from the higher layer (may included in the dl_frame params)
);*/
// //NB-IoT modulation
// npdcch_modulation_NB_IoT(
// txdataF,
// AMP,
// frame_parms,
// //no symbol
// //npdcch0???
// //RB_ID --> statically get from the higher layer (may included in the dl_frame params)
// );
// This is the interleaving procedure defined in 36-211, first part of Section 6.8.5
//pdcch_interleaving(frame_parms,&y[0],&wbar[0],num_pdcch_symbols,mi);
//in NB-IoT the interleaving is done directly with the encoding procedure
//there is no interleaving because we don't apply turbo coding
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
// there is a function to do the resource mapping function
//already done in the modulation in our NB-IoT implementaiton
// This is the REG allocation algorithm from 36-211
//already done in the modulation in our NB-IoT implementaiton??
return 0;
}
......@@ -42,19 +42,20 @@
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/defs.h"
#include "PHY/defs_nb_iot.h"
//#define DEBUG_DCI
void NB_add_dci(DCI_PDU_NB *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size_bytes,unsigned char aggregation,unsigned char dci_size_bits,unsigned char dci_fmt)
void NB_add_dci(DCI_PDU_NB *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size_bytes,unsigned char aggregation,unsigned char dci_size_bits,unsigned char dci_fmt, uint8_t npdcch_start_symbol)
{
//put the pdu
memcpy(&DCI_pdu->dci_alloc[DCI_pdu->Num_dci].dci_pdu[0],pdu,dci_size_bytes);
//configure the dci alloc
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].dci_length = dci_size_bits;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].L = aggregation;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].rnti = rnti;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].format = dci_fmt;
DCI_pdu->dci_alloc[DCI_pdu->Num_dci].npdcch_start_symbol = npdcch_start_symbol;
DCI_pdu->Num_dci++;
......@@ -68,7 +69,8 @@ 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 aggregation,
uint8_t npdcch_start_symbol
)
{
......@@ -121,7 +123,7 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
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, npdcch_start_symbol);
// use this value to configure PHY both harq_processes and resource mapping.
......@@ -147,7 +149,8 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
DCI_format_NB_t dci_format,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation
uint8_t aggregation,
uint8_t npdcch_start_symbol
)
{
......@@ -156,7 +159,6 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
eNB->DCI_pdu = (DCI_PDU_NB*) malloc(sizeof(DCI_PDU_NB));
//N1 parameters
/// type = 0 => DCI Format N0, type = 1 => DCI Format N1, 1 bits
......@@ -196,10 +198,8 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
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;
/*Packed DCI here-------------------------------------------*/
type = DCI_Content->DCIN1_RAR.type;
orderIndicator = DCI_Content->DCIN1_RAR.orderIndicator;
Sched_delay = DCI_Content->DCIN1_RAR.Scheddly;
......@@ -210,7 +210,7 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
HARQackRes = DCI_Content->DCIN1_RAR.HARQackRes;
DCIRep = DCI_Content->DCIN1_RAR.DCIRep;
/*Packed DCI here*/
//DCI pdu content
((DCIN1_RAR_t *)DLSCH_DCI_NB)->type =type;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->orderIndicator =orderIndicator;
((DCIN1_RAR_t *)DLSCH_DCI_NB)->Scheddly =Sched_delay;
......@@ -221,9 +221,15 @@ 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++;
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, npdcch_start_symbol);
/*Now configure the ndlsch structure*/
ndlsch->subframe_tx[subframe] = 1; // check if it's OK
ndlsch->rnti = rnti;
ndlsch->active = 1;
// use this value to configure PHY both harq_processes and resource mapping.
ndlsch_harq->scheduling_delay = Sched_delay;
......@@ -257,7 +263,6 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
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;
......@@ -280,11 +285,12 @@ 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;
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,npdcch_start_symbol);
// use this value to configure PHY both harq_processes and resource mapping.
/*Now configure the ndlsch structure*/
ndlsch->subframe_tx[subframe] = 1; // check if it's OK
// use this value to configure PHY both harq_processes and resource mapping.
ndlsch_harq->scheduling_delay = Sched_delay;
......@@ -315,9 +321,8 @@ 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++;
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,npdcch_start_symbol);
// use this value to configure PHY both harq_processes and resource mapping.
break;
......@@ -338,9 +343,8 @@ 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++;
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,npdcch_start_symbol);
// use this value to configure PHY both harq_processes and resource mapping.
break;
......@@ -352,9 +356,6 @@ int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
break;
}
// compute DL power control parameters
......
......@@ -38,6 +38,8 @@
#include "UTIL/LISTS/list.h"
#endif
#include "dci_nb_iot.h"
#define MOD_TABLE_QPSK_OFFSET 1
#define MOD_TABLE_16QAM_OFFSET 5
#define MOD_TABLE_64QAM_OFFSET 21
......@@ -806,59 +808,41 @@ typedef struct {
//----------------------------------------------------------------------------------------------------
typedef struct {
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)
uint16_t rnti;
/// Active flag for baseband transmitter processing
uint8_t active;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/// 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;
/// Pointers to 8 HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t *harq_processes[8];
/// 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
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
}NB_IoT_eNB_NPDCCH_t;
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDCCH transmission
/// see FAPI/NFAPI specs Table 4-121
uint8_t npdcch_start_symbol;
/// Length of DCI in bits
uint8_t dci_length;
/// Aggregation level only 0,1 in NB-IoT
uint8_t L;
/// Position of first CCE of the dci
int firstCCE;
/// flag to indicate that this is a RA response
boolean_t ra_flag;
/// rnti
rnti_t rnti;
/// Format
DCI_format_NB_t format;
/// DCI pdu
uint8_t dci_pdu[8];
} DCI_ALLOC_NB_t;
typedef struct {
//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] ;
} DCI_PDU_NB;
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
/// The number of the subframe to transmit the NPDSCH TB TS 36.213 Table 16.4.1.3-1 (Nsf
/// 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;
......@@ -933,6 +917,11 @@ typedef struct {
*/
uint16_t sf_index;
///indicates the starting OFDM symbol in the first slot of a subframe k for the NPDSCH transmission
/// see FAPI/NFAPI specs Table 4-47
uint8_t npdsch_start_symbol;
} NB_IoT_eNB_NDLSCH_t;
......@@ -1042,6 +1031,19 @@ typedef struct {
} NB_IoT_eNB_NULSCH_t;
#define NPBCH_A 34
typedef struct {
uint8_t npbch_d[96+(3*(16+NPBCH_A))];
uint8_t npbch_w[3*3*(16+NPBCH_A)];
uint8_t npbch_e[1600];
///pdu of the npbch message
uint8_t*pdu;
} NB_IoT_eNB_NPBCH;
//---------------------------------------------------------------------------------------
......
......@@ -21,6 +21,9 @@
#include "PHY/extern.h"
#include "PHY/sse_intrin.h"
#include "PHY/CODING/defs_nb_iot.h"
#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
#ifdef PHY_ABSTRACTION
#include "SIMULATION/TOOLS/defs.h"
#endif
......
......@@ -90,7 +90,7 @@ void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
// Functions below implement 36-211 and 36-212
/*Function to pack the DCI*/
void NB_add_dci(DCI_PDU_NB *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size_bytes,unsigned char aggregation,unsigned char dci_size_bits,unsigned char dci_fmt);
void NB_add_dci(DCI_PDU_NB *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size_bytes,unsigned char aggregation,unsigned char dci_size_bits,unsigned char dci_fmt, uint8_t npdcch_start_symbol);
/*Use the UL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
......@@ -99,18 +99,20 @@ 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 aggregation,
uint8_t npdcch_start_symbol
);
/*Use the DL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_dlsch_params_from_dci(PHY_VARS_eNB *eNB,
int frame,
int frame,
uint8_t subframe,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_t dci_format,
NB_IoT_eNB_NDLSCH_t *ndlsch,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation
uint8_t aggregation,
uint8_t npdcch_start_symbol
);
......
......@@ -435,29 +435,6 @@ typedef struct {
UE_rxtx_proc_t proc_rxtx[2];
} UE_proc_t;
typedef struct {
/// Length of DCI in bits
uint8_t dci_length;
/// Aggregation level only 0,1 in NB-IoT
uint8_t L;
/// Position of first CCE of the dci
int firstCCE;
/// flag to indicate that this is a RA response
boolean_t ra_flag;
/// rnti
rnti_t rnti;
/// Format
DCI_format_NB_t format;
/// DCI pdu
uint8_t dci_pdu[8];
} DCI_ALLOC_NB_t;
typedef struct {
//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] ;
} DCI_PDU_NB;
/// Top-level PHY Data Structure for eNB
......@@ -725,8 +702,8 @@ typedef struct PHY_VARS_eNB_s {
*
*/
NB_IoT_eNB_NPBCH npbch;
NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAX_NB_IoT]; //check the max size of this array
NB_IoT_eNB_NPBCH *npbch;
//NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAX_NB_IoT]; //check the max size of this array
NB_IoT_eNB_NDLSCH_t *ndlsch[NUMBER_OF_UE_MAX_NB_IoT];
NB_IoT_eNB_NULSCH_t *nulsch[NUMBER_OF_UE_MAX_NB_IoT+1]; //nulsch[0] contains the RAR
NB_IoT_eNB_NDLSCH_t *ndlsch_SI,*ndlsch_ra;
......
......@@ -262,13 +262,5 @@ typedef struct {
} NB_DL_FRAME_PARMS;
#define NPBCH_A 34
typedef struct {
uint8_t npbch_d[96+(3*(16+NPBCH_A))];
uint8_t npbch_w[3*3*(16+NPBCH_A)];
uint8_t npbch_e[1600];
} NB_IoT_eNB_NPBCH;
#endif
#include "../SCHED/IF_Module_L1_primitives_nb_iot.h"
#include "../SCHED/defs.h"
#include "../SCHED/defs_nb_iot.h"
#include "common/utils/itti/assertions.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "PHY/vars.h"
#include "PHY/INIT/defs_nb_iot.h"
handle_nfapi_dlsch_pdu_NB(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
void 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) {
uint8_t *sdu)
{
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;
int UE_id= -1;
//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)
if(rel13->rnti_type == 0)
{
ndlsch = eNB->ndlsch_SI;
ndlsch->npdsch_start_symbol = rel13->start_symbol; //start symbol for the ndlsch transmission
ndlsch_harq = ndlsch->harq_process;
ndlsch_harq->pdu = sdu;
......@@ -36,16 +43,31 @@ handle_nfapi_dlsch_pdu_NB(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
}
else
{
//TODO
{ //ue specific data or RAR
//check if the PDU is for RAR
if(eNB->ndlsch_ra != NULL && rel13->rnti == eNB->ndlsch_ra->rnti)
{
eNB->ndlsch_ra->harq_process->pdu = sdu;
eNB->ndlsch_ra->npdsch_start_symbol = rel13->start_symbol;
}
else
{ //this for ue data
//TODO
//program addition DLSCH parameters not from DCI (for the moment we only pass the pdu)
//int UE_id = find_dlsch(rel13->rnti,eNB,SEARCH_EXIST);
// 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");
UE_id = find_ue_NB(rel13->rnti,eNB);
AssertFatal(UE_id==-1,"no existing ue specific dlsch_context\n");
//ndlsch_harq = eNB->ndlsch[UE_id]->harq_processes;
//AssertFatal(dlsch_harq!=NULL,"dlsch_harq is null\n");
//dlsch_harq->pdu = sdu;
ndlsch_harq = eNB->ndlsch[(uint8_t)UE_id]->harq_process;
AssertFatal(ndlsch_harq!=NULL,"dlsch_harq for ue specific is null\n");
ndlsch = eNB->ndlsch[(uint8_t)UE_id];
ndlsch->npdsch_start_symbol = rel13->start_symbol;
ndlsch_harq->pdu = sdu;
}
}
......@@ -63,16 +85,15 @@ 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;
NB_IoT_eNB_NPBCH *npbch;
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;
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;
......@@ -102,11 +123,15 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
break;
case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
//TODO
//XXX for the moment we don't care about the n-bch pdu content since we need only the sdu if tx.request
npbch = eNB->npbch;
npbch->pdu = Sched_INFO->sdu[i];
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);
handle_nfapi_dlsch_pdu_NB(eNB, proc,dl_config_pdu,Sched_INFO->sdu[i]);
break;
default:
......@@ -133,16 +158,24 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
}
for(i = 0; i , number_ul_pdu; i++)
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
//TODO should distinguish between data and between data (npusch format)
/*NB: for reception of Msg3 generally not exist a DCI (because scheduling information are implicitly given by the RAR)
* but in case of FAPI specs we should receive an UL_config (containing the NULSCH pdu) for configuring the PHY for Msg3 reception from the MAC
* (this UL_config most probably will be created by the MAC when fill the RAR)
* (most probably we don't have the DL_config (for the RAR transmission) and the UL_CONFIG (for the Msg3 reception) at the same time (same subrame)
* since we are working in HD-FDD mode so for sure the UE will transmit the Msg3 in another subframe so make sense to have a UL_CONFIG in subframe
* diferent from the DL_CONFIG one)
*
*/
break;
case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
//TODO
//TODO just for update the nprach configuration (given at the beginning through phy_config_sib2)
break;
}
}
......@@ -156,6 +189,7 @@ void PHY_config_req(PHY_Config_t* config_INFO){
if(config_INFO->get_MIB != 0){
//MIB-NB configuration
NB_phy_config_mib_eNB(config_INFO->mod_id,
config_INFO->CC_id,
......@@ -165,7 +199,11 @@ void PHY_config_req(PHY_Config_t* config_INFO){
config_INFO->cfg->subframe_config.ul_cyclic_prefix_type.value,
config_INFO->cfg->rf_config.tx_antenna_ports.value,
config_INFO->dl_CarrierFreq,
config_INFO->ul_CarrierFreq);
config_INFO->ul_CarrierFreq,
config_INFO->cfg->nb_iot_config.prb_index.value,
config_INFO->cfg->nb_iot_config.operating_mode.value,
config_INFO->cfg->nb_iot_config.control_region_size.value,
config_INFO->cfg->nb_iot_config.assumed_crs_aps.value); //defined only in in-band different PCI
}
if(config_INFO->get_COMMON != 0)
......
......@@ -13,5 +13,9 @@ void schedule_response(Sched_Rsp_t *Sched_INFO);
* Trigger the phy_config_xxx functions using parameters from the shared PHY_Config structure
* */
void PHY_config_req(PHY_Config_t* config_INFO);
void 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);
#endif
......@@ -764,7 +764,8 @@ void generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
#endif
LOG_D(PHY,"Generating dlsch params for RNTI %x\n",dci_alloc->rnti);
LOG_D(PHY,"Generating dlsch params for RNTI %x\n",dci_alloc->rnti);
//fill the dlsch structures
generate_eNB_dlsch_params_from_dci(frame,
subframe,
&dci_alloc->dci_pdu[0],
......
......@@ -445,7 +445,7 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,UL_
#undef DEBUG_PHY_PROC
/*Generate eNB dlsch params for NB-IoT, modify the input to the Sched Rsp variable*/
/*Generate eNB ndlsch params for NB-IoT from the NPDCCH PDU of the DCI, modify the input to the Sched Rsp variable*/
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi_dl_config_request_pdu_t *dl_config_pdu)
{
......@@ -458,6 +458,7 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi
NB_IoT_eNB_NDLSCH_t *ndlsch;
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.
......@@ -468,13 +469,11 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi
if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_format == 0)
{
//check DCI format N1 is for RAR ra_rnti = 2 in FAPI specs table 4-45
if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti_type == 2)
if(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti_type == 1)
{
DCI_format = DCIFormatN1_RAR;
ndlsch= eNB->ndlsch_ra;
ndlsch= eNB->ndlsch_ra;//we store the RNTI for the RAR
//DCI format N1 to RAR
DCI_Content->DCIN1_RAR.type = 1;
......@@ -498,7 +497,8 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi
DCI_format,
ndlsch,
fp,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.start_symbol
);
//eNB->dlsch_ra_NB->nCCE[subframe] = eNB->DCI_pdu->dci_alloc.firstCCE;
......@@ -510,7 +510,7 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi
UE_id = find_ue_NB(dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti, eNB);
AssertFatal(UE_id == -1, "no ndlsch context available or no ndlsch context corresponding to that rnti\n");
ndlsch = eNB->ndlsch[UE_id]; //in the old implementation they also consider UE_id = 1;
ndlsch = eNB->ndlsch[(uint8_t)UE_id]; //in the old implementation they also consider UE_id = 1;
//DCI format N1 to DLSCH
DCI_Content->DCIN1.type = 1;
......@@ -531,9 +531,10 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi
DCI_Content,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCI_format,
eNB->ndlsch[(uint8_t)UE_id],
ndlsch,
fp,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.aggregation_level,
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.start_symbol
);
//eNB->ndlsch[(uint8_t)UE_id]->nCCE[subframe] = eNB->DCI_pdu->dci_alloc[i].firstCCE;
......@@ -587,7 +588,8 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti,
DCIFormatN0,
UE_id,
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level,
hi_dci0_pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13.start_symbol
);
......@@ -602,224 +604,138 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_
/*
* for NB-IoT ndlsch procedure
* this function is called by the PHy procedure TX in 3 possible occasion:
* 1) we manage BCCH pdu
* 1) we manage BCCH pdu (SI)
* 2) we manage RA dlsch pdu (to be checked if needed in our case)
* 3) UE specific dlsch pdu
* ** we need to know if exist and which value has the eutracontrolRegionSize (TS 36.213 ch 16.4.1.4) whenever we are in In-band mode
* ** CQI and PMI are not present in NB-IoT
* ** redundancy version exist only in UL for NB-IoT and not in DL
*/
//void npdsch_procedures(PHY_VARS_eNB *eNB,
// eNB_rxtx_proc_t *proc, //Context data structure for RX/TX portion of subframe processing
// NB_IoT_eNB_NDLSCH_t *dlsch,
////NB_IoT_eNB_DLSCH_t *dlsch1,//this is the second colum of the UE specific LTE_eNB_DLSCH_t (see the PHY/defs.h line 471) is used only in ue specific dlsch for two parallel streams (but we don't have it in NB-IoT)
// LTE_eNB_UE_stats *ue_stats,
// int ra_flag,// set to 1 only in case of RAR as a segment data
// //int num_pdcch_symbols, (BCOM says are not needed
// uint32_t segment_length, //lenght of the DLSCH PDU from the Sched_rsp (FAPI nomenclature)
// uint8_t* segment_data // the DLSCH PDU itself from the Sched_rsp (FAPI nomenclature)
// )
//{
// int frame=proc->frame_tx;
// int subframe=proc->subframe_tx;
// //int harq_pid = dlsch->current_harq_pid;
// LTE_DL_eNB_HARQ_t *dlsch_harq=dlsch->harq_process; //TODO: review the HARQ process for NB_IoT
// int input_buffer_length = dlsch_harq->TBS/8; // get in byte //to be changed for NB_IoT????
// NB_DL_FRAME_PARMS *fp=&eNB->frame_parms_nb_iot;
// uint8_t *DLSCH_pdu=NULL;
// uint8_t DLSCH_pdu_tmp[input_buffer_length+4]; //[768*8];
// //uint8_t DLSCH_pdu_rar[256];
// int i;
//
//
//
// LOG_D(PHY,
// "[eNB %"PRIu8"][PDSCH rnti%"PRIx16"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8"(round %"PRIu8")\n",
// eNB->Mod_id,
// dlsch->rnti,
// frame, subframe, input_buffer_length,
// get_G(fp,dlsch_harq->nb_rb,dlsch_harq->rb_alloc,get_Qm(dlsch_harq->mcs),dlsch_harq->Nl, num_pdcch_symbols, frame, subframe, dlsch_harq->mimo_mode==TM7?7:0),
// dlsch_harq->nb_rb, //in NB_IoT we not need it??? (Current Number of RBs should be only 1)
// dlsch_harq->mcs,
// dlsch_harq->round);
//
//
/////XXX skip this for the moment and all the ue stats
////#if defined(MESSAGE_CHART_GENERATOR_PHY)
//// MSC_LOG_TX_MESSAGE(
//// MSC_PHY_ENB,MSC_PHY_UE,
//// NULL,0,
//// "%05u:%02u PDSCH/DLSCH input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx16", rv %"PRIu8" (round %"PRIu8")",
//// frame, subframe,
//// input_buffer_length,
//// get_G(fp,
//// dlsch_harq->nb_rb,
//// dlsch_harq->rb_alloc,
//// get_Qm(dlsch_harq->mcs),
//// dlsch_harq->Nl,
//// num_pdcch_symbols,
//// frame,
//// subframe,
//// dlsch_harq->mimo_mode==TM7?7:0),
//// dlsch_harq->nb_rb,
//// dlsch_harq->mcs,
//// pmi2hex_2Ar1(dlsch_harq->pmi_alloc),
//// dlsch_harq->rvidx,
//// dlsch_harq->round);
////#endif
//
////if (ue_stats) ue_stats->dlsch_sliding_cnt++; //used to compute the mcs offset
//
// if(dlsch_harq->round == 0) { //first transmission
//
//// if (ue_stats)
//// ue_stats->dlsch_trials[harq_pid][0]++;
//
// if (eNB->mac_enabled==1) { // set in lte-softmodem/main line 1646
// if (ra_flag == 0) {
// DLSCH_pdu =segment_data;
//
// }
// else { //manage the RAR
//
// /*
// * In FAPI style we don-t need to process the RAR because we have all the parameters for getting the MSG3 given by the
// * UL_CONFIG.request (all inside the next Sched_RSP function)
// *
// */
//
//// int16_t crnti = mac_xface->fill_rar(eNB->Mod_id,
//// eNB->CC_id,
//// frame,
//// DLSCH_pdu_rar,
//// fp->N_RB_UL,
//// input_buffer_length);
//
// DLSCH_pdu = segment_data; //the proper PDU should be passed in the function when the RA flag is activated
//
// int UE_id;
//
// if (crnti!=0)
// UE_id = add_ue(crnti,eNB);
// else
// UE_id = -1;
//
// if (UE_id==-1) {
// LOG_W(PHY,"[eNB] Max user count reached.\n");
// mac_xface->cancel_ra_proc(eNB->Mod_id,
// eNB->CC_id,
// frame,
// crnti);
// } else {
// eNB->UE_stats[(uint32_t)UE_id].mode = RA_RESPONSE;
// // Initialize indicator for first SR (to be cleared after ConnectionSetup is acknowledged)
// eNB->first_sr[(uint32_t)UE_id] = 1;
//
//
//
//
//
// generate_eNB_ulsch_params_from_rar(DLSCH_pdu,
// frame,
// subframe,
// eNB->ulsch[(uint32_t)UE_id],
// fp);
//
// LOG_D(PHY,"[eNB][RAPROC] Frame %d subframe %d, Activated Msg3 demodulation for UE %"PRId8" in frame %"PRIu32", subframe %"PRIu8"\n",
// frame,
// subframe,
// UE_id,
// eNB->ulsch[(uint32_t)UE_id]->Msg3_frame,
// eNB->ulsch[(uint32_t)UE_id]->Msg3_subframe);
//
// /* TODO: get rid of this hack. The problem is that the eNodeB may
// * sometimes wrongly generate PHICH because somewhere 'phich_active' was
// * not reset to 0, due to an unidentified reason. When adding this
// * resetting here the problem seems to disappear completely.
// */
// LOG_D(PHY, "hack: set phich_active to 0 for UE %d fsf %d %d all HARQs\n", UE_id, frame, subframe);
// for (i = 0; i < 8; i++)
// eNB->ulsch[(uint32_t)UE_id]->harq_processes[i]->phich_active = 0;
//
// mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, (uint16_t)crnti,
// eNB->ulsch[UE_id]->Msg3_frame, eNB->ulsch[UE_id]->Msg3_subframe);
//
// T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
// T_INT(UE_id), T_INT((uint16_t)crnti), T_INT(1 /* 1 is for initial transmission*/),
// T_INT(eNB->ulsch[UE_id]->Msg3_frame), T_INT(eNB->ulsch[UE_id]->Msg3_subframe));
// }
// if (ue_stats) ue_stats->total_TBS_MAC += dlsch_harq->TBS;
//
// }// ra_flag = 1
//
// } //mac_eabled = 1
// else { //XXX we should change taus function???
// DLSCH_pdu = DLSCH_pdu_tmp;
//
// for (i=0; i<input_buffer_length; i++)
// DLSCH_pdu[i] = (unsigned char)(taus()&0xff);
// }
//
//#if defined(SMBV)
//
// // Configures the data source of allocation (allocation is configured by DCI)
// if (smbv_is_config_frame(frame) && (smbv_frame_cnt < 4)) {
// LOG_D(PHY,"[SMBV] Frame %3d, Configuring PDSCH payload in SF %d alloc %"PRIu8"\n",frame,(smbv_frame_cnt*10) + (subframe),smbv_alloc_cnt);
// // smbv_configure_datalist_for_user(smbv_fname, find_ue(dlsch->rnti,eNB)+1, DLSCH_pdu, input_buffer_length);
// }
//#endif
//
//
//
//#ifdef DEBUG_PHY_PROC
//#ifdef DEBUG_DLSCH
// LOG_T(PHY,"eNB DLSCH SDU: \n");
//
// //eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe] = DCI_pdu->dci_alloc[i].firstCCE;
//
// LOG_D(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resource for ue DCI (PDSCH %"PRIx16") => %"PRIu8"/%u\n",eNB->Mod_id,eNB->proc[sched_subframe].frame_tx,subframe,
// DCI_pdu->dci_alloc[i].rnti,eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe],DCI_pdu->dci_alloc[i].firstCCE);
//
//
// for (i=0; i<dlsch_harq->TBS>>3; i++)
// LOG_T(PHY,"%"PRIx8".",DLSCH_pdu[i]);
//
// LOG_T(PHY,"\n");
//#endif
//#endif
// } //harq round == 0
// else {
// //We are doing a retransmission
//
// ue_stats->dlsch_trials[harq_pid][dlsch_harq->round]++;
//
//#ifdef DEBUG_PHY_PROC
//#ifdef DEBUG_DLSCH
// LOG_D(PHY,"[eNB] This DLSCH is a retransmission\n");
//#endif
//#endif
// }
//
// if (eNB->abstraction_flag==0) { // used for simulation of the PHY??
//
// LOG_D(PHY,"Generating NDLSCH/NPDSCH %d\n",ra_flag);
//
//
// // 36-212
// //encoding---------------------------
//
// /*
// * we should have as an iput parameter also G for the encoding based on the switch/case
// * G is evaluated based on the switch/case done over eutracontrolRegionSize (if exist) and operationModeInfo
// * NB: switch case of G is the same for npdsch and npdcch
// *
// * Nsf needed as an input (number of subframe)
// */
//
// start_meas(&eNB->dlsch_encoding_stats);
//
// LOG_I(PHY, "NB-IoT Encoding step\n");
//
void npdsch_procedures(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc, //Context data structure for RX/TX portion of subframe processing
NB_IoT_eNB_NDLSCH_t *ndlsch,
//int num_pdcch_symbols, (BCOM says are not needed
uint8_t* pdu
)
{
int frame=proc->frame_tx;
int subframe=proc->subframe_tx;
LTE_DL_eNB_HARQ_t *ndlsch_harq=ndlsch->harq_process;
int input_buffer_length = ndlsch_harq->TBS/8; // get in byte //the TBS is set in generate_dlsch_param
NB_DL_FRAME_PARMS *fp=&eNB->frame_parms_nb_iot;
int G;
uint8_t *DLSCH_pdu=NULL;
uint8_t DLSCH_pdu_tmp[input_buffer_length+4]; //[768*8];
//uint8_t DLSCH_pdu_rar[256];
int i;
LOG_D(PHY,
"[eNB %"PRIu8"][PDSCH rnti%"PRIx16"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", mcs %"PRIu8"(round %"PRIu8")\n",
eNB->Mod_id,
ndlsch->rnti,
frame, subframe, input_buffer_length,
ndlsch_harq->mcs,
ndlsch_harq->round);
///XXX skip this for the moment and all the ue stats
//#if defined(MESSAGE_CHART_GENERATOR_PHY)..
//if (ue_stats) ue_stats->dlsch_sliding_cnt++; //used to compute the mcs offset
if(ndlsch_harq->round == 0) { //first transmission
// if (ue_stats)
// ue_stats->dlsch_trials[harq_pid][0]++;
if (eNB->mac_enabled==1) { // set in lte-softmodem/main line 1646
DLSCH_pdu =pdu;
/*
* we don't need to manage the RAR here since should be managed in the MAC layer for two reasons:
* 1)we should receive directly the pdu containing the RAR from the MAC in the schedule_response
* 2)all the parameters for getting the MSG3 should be given by the UL_CONFIG.request (all inside the next Sched_RSP function)
*
*/
//fill_rar shouduld be in the MAC
//cancel ra procedure should be in the mac
//scheduling request not implemented in NB-IoT
//nulsch_param configuration for MSG3 should be considered in handling UL_Config.request
//(in particular the nulsch structure for RAR is distinguished based on the harq_process->rar_alloc and the particular subframe in which we should have Msg3)
}
else { //XXX we should change taus function???
DLSCH_pdu = DLSCH_pdu_tmp;
for (i=0; i<input_buffer_length; i++)
DLSCH_pdu[i] = (unsigned char)(taus()&0xff);
}
}
else {
//We are doing a retransmission (harq round > 0
#ifdef DEBUG_PHY_PROC
#ifdef DEBUG_DLSCH
LOG_D(PHY,"[eNB] This DLSCH is a retransmission\n");
#endif
#endif
}
if (eNB->abstraction_flag==0) { // used for simulation of the PHY??
// 36-212
//encoding---------------------------
/*
* we should have as an iput parameter also G for the encoding based on the switch/case
* G is evaluated based on the switch/case done over eutracontrolRegionSize (if exist) and operationModeInfo
* NB: switch case of G is the same for npdsch and npdcch
*
* the npdsch_start symbol index refers to TS 36.213 ch 16.4.1.4
* (is the starting OFDM for the NPDSCH transmission in the first slot in a subframe k)
* FAPI style: is stored in the ndlsch structure from the reception of the NPDLSCH PDU in the DL_CONFIG.request (so should be set by the MAC and put inside the schedule response)
*-if subframe k is a subframe for receiving the SIB1-NB
*-- if operationModeInfo set to 00 or 01 (in band) --> npdsch_start_sysmbol = 3
*-- otherwise --> npdsch_start_symbol = 0
*-if the k subframe is not for SIB1-NB
*--npdsch_start_symbol = eutracontrolregionsize (defined for in-band operating mode (mode 0,1 for FAPI specs) and take values 1,2,3 [units in number of OFDM symbol])
*- otherwise --> npdsch_start_symbol = 0
*
* Nsf needed as an input (number of subframe)-->inside harq_process of ndlsch
*/
switch(ndlsch->npdsch_start_symbol)
{
case 0:
G = 304;
break;
case 1:
G = 240;
break;
case 2:
G = 224;
break;
case 3:
G =200;
break;
default:
LOG_E (PHY,"npdsch_start_index has unwanted value\n");
break;
}
start_meas(&eNB->dlsch_encoding_stats);
LOG_I(PHY, "NB-IoT Encoding step\n");
// eNB->te(eNB,
// DLSCH_pdu,
// num_pdcch_symbols,
......@@ -828,14 +744,16 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_
// &eNB->dlsch_rate_matching_stats,
// &eNB->dlsch_turbo_encoding_stats,
// &eNB->dlsch_interleaving_stats);
//
//
// stop_meas(&eNB->dlsch_encoding_stats);
// //scrambling-------------------------------------------
// // 36-211
// start_meas(&eNB->dlsch_scrambling_stats);
// LOG_I(PHY, "NB-IoT Scrambling step\n");
//
stop_meas(&eNB->dlsch_encoding_stats);
// 36-211
//scrambling-------------------------------------------
start_meas(&eNB->dlsch_scrambling_stats);
LOG_I(PHY, "NB-IoT Scrambling step\n");
// dlsch_scrambling(fp,
// 0,
// dlsch,
......@@ -849,14 +767,14 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_
// 0),
// 0,
// subframe<<1);
//
// stop_meas(&eNB->dlsch_scrambling_stats);
//
//
// //modulation-------------------------------------------
// start_meas(&eNB->dlsch_modulation_stats);
// LOG_I(PHY, "NB-IoT Modulation step\n");
//
stop_meas(&eNB->dlsch_scrambling_stats);
//modulation-------------------------------------------
start_meas(&eNB->dlsch_modulation_stats);
LOG_I(PHY, "NB-IoT Modulation step\n");
// dlsch_modulation(eNB,
// eNB->common_vars.txdataF[0],
// AMP,
......@@ -864,23 +782,23 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_
// num_pdcch_symbols,
// dlsch,
// dlsch1);
//
// stop_meas(&eNB->dlsch_modulation_stats);
// }
//
//
//#ifdef PHY_ABSTRACTION
// else {
// start_meas(&eNB->dlsch_encoding_stats);
// dlsch_encoding_emul(eNB,
// DLSCH_pdu,
// dlsch);
// stop_meas(&eNB->dlsch_encoding_stats);
// }
//
//#endif
// dlsch->active = 0;
//}
stop_meas(&eNB->dlsch_modulation_stats);
}
#ifdef PHY_ABSTRACTION
else {
start_meas(&eNB->dlsch_encoding_stats);
//dlsch_encoding_emul(eNB,
//DLSCH_pdu,
//dlsch);
stop_meas(&eNB->dlsch_encoding_stats);
}
#endif
ndlsch->active = 0;
}
......@@ -897,24 +815,23 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
int subframe = proc->subframe_tx;
uint32_t i,aa;
//uint8_t harq_pid; only one HARQ process
//DCI_PDU_NB *DCI_pdu; we already have inside Sched_Rsp
DCI_PDU_NB *dci_pdu = eNB->DCI_pdu;
//DCI_PDU_NB DCI_pdu_tmp;
NB_DL_FRAME_PARMS *fp = &eNB->frame_parms_nb_iot;
// DCI_ALLOC_t *dci_alloc = (DCI_ALLOC_t *)NULL;
// DCI_ALLOC_t *dci_alloc = (DCI_ALLOC_t *)NULL; (not used since we have already packed)
int8_t UE_id = 0;
uint8_t ul_subframe;
uint32_t ul_frame;
int **txdataF = eNB->common_vars.txdataF[0];
// are needed??? (maybe not)
//uint8_t num_npdcch_symbols = 0;
if(do_meas == 1)
start_meas(&eNB->phy_proc_tx);
/*called the original scheduler "eNB_dlsch_ulsch_scheduler" now is no more done here but is triggered directly from UL_Indication (IF-Module Function)*/
/*he original scheduler "eNB_dlsch_ulsch_scheduler" now is no more done here but is triggered directly from UL_Indication (IF-Module Function)*/
// clear the transmit data array for the current subframe
for (aa=0; aa<fp->nb_antenna_ports_eNB; aa++)
......@@ -923,19 +840,15 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
0,fp->ofdm_symbol_size*(fp->symbols_per_tti)*sizeof(int32_t));
}
//generate NPSS/NSSS
NB_common_signal_procedures(eNB,proc);
//generate NPSS/NSSS
NB_common_signal_procedures(eNB,proc);
/*Generate MIB
*
*
*Sched_Rsp_t content:
*
* DL_Config.request--> dl_config_request_pdu --> nfapi_dl_config_nbch_pdu_rel13_t --> NBCH PDU
* *the MIB pdu has been stored in the npbch structure of the PHY_vars_eNB during the schedule_response procedure
*
* TX.request --> nfapi_tx_request_pdu_t --> MAC PDU (MIB)
* TX.request --> nfapi_tx_request_pdu_t --> MAC PDU (MIB) //not used in our case
* Content of tx_request_pdu
* -pdu length 14 (bytes)???
* -pdu index = 1
......@@ -953,35 +866,48 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
*
*should add new condition here
*/
if(subframe==0)
{
/*generate_npbch(&eNB->npbch,
if(subframe==0 && (eNB->npbch != NULL))
{
if(eNB->npbch->pdu != NULL)
generate_npbch(&eNB->npbch,
txdataF,
AMP,
fp,
&sched_rsp->NB_DL.NB_BCH->MIB_pdu.segments[0].segment_data,
eNB->npbch->pdu,
frame%64,
fp->NB_IoT_RB_ID
);*/
}
);
else
LOG_E(PHY, "NB_phy_procedures_eNB_TX: missed mib pdu to be transmitted\n");
}
/*
* Generate BCCH transmission (System Information)
*/
/*TODO: NPDSCH procedures for BCCH for NB-IoT
npdsch_procedures(eNB,
proc,
eNB->dlsch_SI_NB, //should be filled ?? (in the old implementation was filled when from DCI we generate_dlsch_params
sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_length,
sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_data);*/
///check for BCCH transmission (System Information)
//XXX the scheduling of SI and also MIB ecc... we don-t care at phy layer??? is the scheduler that gives us the DL_config at proper time??
if(eNB->ndlsch_SI != NULL && (eNB->ndlsch_SI->harq_process->pdu != NULL))
{
npdsch_procedures(eNB,
proc,
eNB->ndlsch_SI, //since we have no DCI for system information, this is filled directly when we receive the DL_CONFIG.request message
eNB->ndlsch_SI->harq_process->pdu);
}
///check for RAR transmission
if(eNB->ndlsch_ra != NULL && eNB->ndlsch_ra->active == 1)
{
npdsch_procedures(eNB,
proc,
eNB->ndlsch_ra, //should be filled ?? (in the old implementation was filled when from DCI we generate_dlsch_params
eNB->ndlsch_ra->harq_process->pdu);
}
//no HARQ pid (we have only 1 single process for each user)
//clear previous possible allocation
for(int i = 0; i < NUMBER_OF_UE_MAX_NB_IoT; i++)
{
......@@ -997,20 +923,40 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if(eNB->nulsch[i])
{
eNB->nulsch[i]->harq_process->dci_alloc = 0; //flag for indicating that a DCI has been allocated for UL
eNB->nulsch[i]->harq_process->rar_alloc = 0; //Flag indicating that this ULSCH has been allocated by a RAR
eNB->nulsch[i]->harq_process->rar_alloc = 0; //Flag indicating that this ULSCH has been allocated by a RAR (for Msg3)
//no phich for NB-IoT so no DMRS should be utilized
}
}
//num_pdcch_symbols?? (maybe later when we have the DCI)
//transmission of UE specific ndlsch data
for (int UE_id = 0; i < NUMBER_OF_UE_MAX_NB_IoT; UE_id++)
{
if(eNB->ndlsch[(uint8_t)UE_id] != NULL && eNB->ndlsch[(uint8_t)UE_id]->active == 1)
{
npdsch_procedures(eNB,
proc,
eNB->ndlsch[(uint8_t)UE_id],
eNB->ndlsch[(uint8_t)UE_id]->harq_process->pdu);
}
/*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
//generate_dci_top_NB();
//we don't care about subframe TX for the PUCCH since not defined by NB-IoT
}
//num_pdcch_symbols?? (maybe later when we have the DCI)
//no SMBV
//no dedicated phy config
/*If we have DCI to generate do it now*/
generate_dci_top_NB(
dci_pdu->Num_dci,
dci_pdu->dci_alloc,
AMP,
fp,
eNB->common_vars.txdataF[0],
subframe);
}
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