Commit 32aa59e0 authored by Michele Paffetti's avatar Michele Paffetti

modify PHY TX procedure. still npdsch_procedure to be completed. Code compile but lots of warnings.

parents c6df27ba 6010c7fd
......@@ -1003,6 +1003,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_nb_iot.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c
${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c
......
......@@ -100,7 +100,7 @@ void NB_phy_config_mib_eNB(
fp->NB_IoT_RB_ID = prb_index; //XXX to be better understand how should be managed
//fp->nb_rx_antenna_ports_eNB
fp->control_region_size = control_region_size; //(assume that this value is negative if not used)
fp->eutra_NumCRS_ports = eutra_NumCRS_ports //(valid only for in-band operating mode with different PCI)
fp->eutra_NumCRS_ports = eutra_NumCRS_ports; //(valid only for in-band operating mode with different PCI)
//TODO
......
......@@ -2045,7 +2045,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
uint32_t n_rnti,
int16_t amp,
LTE_DL_FRAME_PARMS *frame_parms,
//NB_IoT_eNB_NPDCCH_t npdcch,
int32_t **txdataF,
uint32_t subframe)
{
......@@ -2132,24 +2131,11 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
#endif
if (dci_alloc[i].firstCCE>=0) {
//encoding
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length,
dci_alloc[i].L,
dci_alloc[i].rnti);
//new NB-IoT
npdcch_encoding_NB_IoT(
dci_alloc[i].dci_pdu,
frame_parms,
npdcch, //see when function dci_top is called
//no frame
subframe
//rm_stats, te_stats, i_stats
);
}
}
}
......@@ -2188,31 +2174,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
//NB-IoT--------------------------
/*
* switch(npdcch_start_index)
* case 0
* G = 272
* case 1
* G = 248
* case 2
* G = 224
* case 3
* G = 200
*/
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
);
// Now do modulation
if (frame_parms->mode1_flag==1)
......@@ -2274,18 +2235,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
}
//NB-IoT
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)
);
#ifdef DEBUG_DCI_ENCODING
printf(" PDCCH Interleaving\n");
#endif
......@@ -2294,9 +2243,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
// 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
mprime=0;
nsymb = (frame_parms->Ncp==0) ? 14:12;
re_offset = frame_parms->first_carrier_offset;
......@@ -2422,7 +2368,6 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci,
return(num_pdcch_symbols);
}
#ifdef PHY_ABSTRACTION
uint8_t generate_dci_top_emul(PHY_VARS_eNB *phy_vars_eNB,
uint8_t num_ue_spec_dci,
......
......@@ -53,22 +53,8 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
uint32_t subframe)
{
uint8_t *e_ptr,num_pdcch_symbols;
int8_t L;
uint32_t i, lprime;
uint32_t gain_lin_QPSK,kprime,kprime_mod12,mprime,nsymb,symbol_offset,tti_offset;
int16_t re_offset;
uint8_t mi = get_mi(frame_parms,subframe);
static uint8_t e[DCI_BITS_MAX];
static int32_t yseq0[Msymb],yseq1[Msymb],wbar0[Msymb],wbar1[Msymb];
int32_t *y[2];
int32_t *wbar[2];
int nushiftmod3 = frame_parms->nushift%3;
int split_flag=0;
int i,L;
/*
**e_ptr : store the encoding result, and as a input to modulation
*num_pdcch_symbols : to calculate the resource allocation for pdcch
......@@ -82,18 +68,6 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
//num_pdcch_symbols = get_num_pdcch_symbols(num_ue_spec_dci+num_common_dci,dci_alloc,frame_parms,subframe);
wbar[0] = &wbar0[0];
wbar[1] = &wbar1[0];
y[0] = &yseq0[0];
y[1] = &yseq1[0];
// reset all bits to <NIL>, here we set <NIL> elements as 2
// memset(e, 2, DCI_BITS_MAX);
// here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
for (i=0; i<DCI_BITS_MAX; i++)
e[i]=taus()&1;
e_ptr = e;
// 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
......@@ -104,25 +78,16 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
if (dci_alloc[i].L == (uint8_t)L) {
if (dci_alloc[i].firstCCE>=0) {
//encoding
e_ptr = generate_dci0(
dci_alloc[i].dci_pdu, //we should pass the two DCI pdu (if exist)
//second pdu
//aggregation level
e+(72*dci_alloc[i].firstCCE),
dci_alloc[i].dci_length,
dci_alloc[i].L,
dci_alloc[i].rnti);
//new NB-IoT
npdcch_encoding_NB_IoT(
dci_alloc[i].dci_pdu,
//NB-IoT encoding
/*npdcch_encoding_NB_IoT(dci_alloc[i].dci_pdu,
frame_parms,
npdcch, //see when function dci_top is called
//no frame
subframe
//rm_stats, te_stats, i_stats
);
);*/
}
......@@ -150,7 +115,8 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
* G = 200
*/
/*
// NB-IoT scrambling
npdcch_scrambling_NB_IoT(
frame_parms,
npdcch,
......@@ -161,7 +127,7 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
//NB-IoT
//NB-IoT modulation
npdcch_modulation_NB_IoT(
txdataF,
AMP,
......@@ -169,7 +135,7 @@ uint8_t generate_dci_top_NB(uint8_t Num_dci,
//no symbol
//npdcch0???
//RB_ID --> statically get from the higher layer (may included in the dl_frame params)
);
);*/
......
......@@ -29,6 +29,9 @@
* \note
* \warning
*/
#ifndef __DCI_NB_IOT_H__
#define __DCI_NB_IOT_H__
#ifndef USER_MODE
#include "PHY/types.h"
#else
......@@ -281,3 +284,7 @@ struct DCIN2_Pag{
typedef struct DCIN2_Pag DCIN2_Pag_t;
#define sizeof_DCIN2_Pag_t 15
#define MAX_DCI_SIZE_BITS_NB_IOT 23
#endif
\ No newline at end of file
......@@ -62,8 +62,8 @@ void NB_add_dci(DCI_PDU_NB *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_size
}
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB_NB *eNB,
eNB_rxtx_proc_NB_t *proc,
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_t dci_format,
......@@ -137,12 +137,13 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB_NB *eNB,
}
}
int NB_generate_eNB_dlsch_params_from_dci(int frame,
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,
LTE_eNB_DLSCH_t *dlsch,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t Num_dci
......
......@@ -901,7 +901,7 @@ typedef struct {
/// Pointers to 8 HARQ processes for the ULSCH
LTE_UL_eNB_HARQ_t *harq_process;
/// 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;
//boundling not exist in NB-IoT since we are not using TDD and only 1 HARQ process
......
......@@ -31,36 +31,13 @@
*/
#ifndef __LTE_TRANSPORT_DEFS_NB_IOT__H__
#define __LTE_TRANSPORT_DEFS_NB_IOT__H__
#include "PHY/defs.h"
#include "dci_nb_iot.h"
#include "PHY/defs.h"
#ifndef STANDALONE_COMPILE
#include "UTIL/LISTS/list.h"
#endif
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 1
uint32_t num_npdcch_symbols;
uint8_t Num_dci;
DCI_ALLOC_NB_t dci_alloc[2] ;
} DCI_PDU_NB;
// to be created LTE_eNB_DLSCH_t --> is duplicated for each number of UE and then indexed in the table
......
......@@ -93,8 +93,8 @@ void npbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
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);
/*Use the UL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB_NB *eNB,
eNB_rxtx_proc_NB_t *proc,
int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
DCI_CONTENT *DCI_Content,
uint16_t rnti,
DCI_format_NB_t dci_format,
......@@ -103,14 +103,17 @@ int NB_generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB_NB *eNB,
uint8_t Num_dci
);
/*Use the DL DCI Information to configure PHY and also Packed*/
int NB_generate_eNB_dlsch_params_from_dci(int frame,
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,
LTE_eNB_DLSCH_t *dlsch,
NB_DL_FRAME_PARMS *frame_parms,
uint8_t aggregation,
uint8_t Num_dci
);
#endif
......@@ -216,6 +216,7 @@ typedef struct {
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
} eNB_rxtx_proc_t;
typedef struct {
......@@ -428,6 +429,30 @@ 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 1
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
typedef struct PHY_VARS_eNB_s {
......@@ -701,7 +726,7 @@ typedef struct PHY_VARS_eNB_s {
NB_IoT_eNB_NDLSCH_t *dlsch_SI_NB,*dlsch_ra_NB;
NB_DL_FRAME_PARMS frame_parms_nb_iot;
DCI_PDU_NB DCI_pdu;
DCI_PDU_NB *DCI_pdu;
......@@ -988,6 +1013,7 @@ void exit_fun(const char* s);
static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
// lock the mutex, if lock successfully, it would return the 0, the other value means failed
if (pthread_mutex_lock(mutex) != 0) {
LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
exit_fun("nothing to add");
......
......@@ -4,7 +4,7 @@
//to be integrated in the scheduling procedure of L1
void schedule_response(Sched_Rsp_t Sched_INFO){
void schedule_response(Sched_Rsp_t *Sched_INFO){
//todo
}
......
......@@ -7,7 +7,7 @@
#define __IF_MODULE_L1_PRIMITIVES_NB_IOT_H__
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void schedule_response(Sched_Rsp_t Sched_INFO);
void schedule_response(Sched_Rsp_t *Sched_INFO);
/*Interface for PHY Configuration
* Trigger the phy_config_xxx functions using parameters from the shared PHY_Config structure
......
......@@ -7,8 +7,12 @@
#include "PHY/defs_nb_iot.h"
#include "openair2/PHY_INTERFACE/IF_Module_nb_iot.h"
void process_schedule_rsp(Sched_Rsp_t *sched_rsp,
PHY_VARS_eNB *eNB,
eNB_rxtx_proc_NB_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);
void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, UL_IND_t *UL_INFO);
/* For NB-IoT, we put NPBCH in later part, since it would be scheduled by MAC scheduler,this generates NRS/NPSS/NSSS*/
void NB_common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
......
......@@ -42,8 +42,6 @@
#include <asm/page.h>
#ifdef RTAI_ENABLED
#include <rtai.h>
//#include <rtai_posix.h>
......@@ -59,6 +57,7 @@
#endif /* USER_MODE */
#include "defs.h"
#include "openair2/PHY_INTERFACE/IF_Module_nb_iot.h"
//#include "dlc_engine.h"
extern int openair_sched_status;
......@@ -78,7 +77,9 @@ extern fifo_dump_emos_eNB emos_dump_eNB;
#endif
*/
extern Sched_Rsp_t* Sched_Rsp;
#endif /*__SCHED_EXTERN_H__ */
......@@ -1086,6 +1086,7 @@ LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti)
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *eNB)
{
uint8_t i;
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
......@@ -1110,6 +1111,25 @@ int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *eNB)
return(-1);
}
int8_t find_ue_NB(uint16_t rnti, PHY_VARS_eNB *eNB)
{
uint8_t i;
for (i=0; i<NUMBER_OF_UE_MAX_NB_IoT; i++) {
if ((eNB->ndlsch[i]) &&
(eNB->ndlsch[i]->rnti==rnti)) {
return(i);
}
}
return(-1);
}
LTE_DL_FRAME_PARMS* get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id)
{
......
......@@ -126,7 +126,7 @@ void NB_common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
}
void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,UL_IND_t *UL_INFO)
{
//RX processing for ue-specific resources (i
......@@ -142,12 +142,10 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
/*NB-IoT IF module Common setting*/
UL_IND_t UL_INFO;
UL_INFO.module_id = eNB->Mod_id;
UL_INFO.CC_id = eNB->CC_id;
UL_INFO.frame = frame;
UL_INFO.subframe = subframe;
UL_INFO->module_id = eNB->Mod_id;
UL_INFO->CC_id = eNB->CC_id;
UL_INFO->frame = frame;
UL_INFO->subframe = subframe;
T(T_ENB_PHY_UL_TICK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe));
......@@ -302,13 +300,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
if (eNB->mac_enabled == 1)
{
//instead rx_sdu to report The Uplink data not received successfully to MAC
(UL_INFO.crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 1;
UL_INFO.crc_ind.number_of_crcs++;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->data= NULL;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = 0;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO.RX_NPUSCH.number_of_pdus++;
(UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 1;
UL_INFO->crc_ind.number_of_crcs++;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data= NULL;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = 0;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO->RX_NPUSCH.number_of_pdus++;
}
}
}
......@@ -344,13 +342,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
if (eNB->mac_enabled)
{
// store successful MSG3 in UL_Info instead rx_sdu
(UL_INFO.crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0;
UL_INFO.crc_ind.number_of_crcs++;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->data = eNB->ulsch[i]->harq_processes[harq_pid]->b;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO.RX_NPUSCH.number_of_pdus++;
(UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0;
UL_INFO->crc_ind.number_of_crcs++;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data = eNB->ulsch[i]->harq_processes[harq_pid]->b;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO->RX_NPUSCH.number_of_pdus++;
}
/* Need check if this needed in NB-IoT
......@@ -404,13 +402,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
if (eNB->mac_enabled==1)
{
// store successful Uplink data in UL_Info instead rx_sdu
(UL_INFO.crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0;
UL_INFO.crc_ind.number_of_crcs++;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->data = eNB->ulsch[i]->harq_processes[harq_pid]->b;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO.RX_NPUSCH.number_of_pdus++;
(UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag= 0;
UL_INFO->crc_ind.number_of_crcs++;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti= eNB->ulsch[i]->rnti;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data = eNB->ulsch[i]->harq_processes[harq_pid]->b;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid = harq_pid;
UL_INFO->RX_NPUSCH.number_of_pdus++;
} // mac_enabled==1
} // Msg3_flag == 0
......@@ -443,11 +441,6 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
} // loop i=0 ... NUMBER_OF_UE_MAX-1
/*Exact not here, but use to debug*/
if_inst->UL_indication(UL_INFO);
}
#undef DEBUG_PHY_PROC
......@@ -456,7 +449,7 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched_Rsp_t *Sched_Rsp,const int UE_id)
{
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
NB_DL_FRAME_PARMS *fp=&eNB->frame_parms_nb_iot;
int frame = proc->frame_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)
......@@ -467,54 +460,58 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched
//mapping the fapi parameters to the oai parameters
for (int i = 0; i< Sched_Rsp->NB_DL.NB_DCI.DL_DCI.number_dci; i++){
switch (Sched_Rsp->NB_DL.NB_DCI.DCI_Format){
for (int i = 0; i< Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci; i++){
switch (Sched_Rsp->NB_DL.NB_DCI->DCI_Format){
case DCIFormatN1_RAR:
//DCI format N1 to RAR
DCI_Content[i]->DCIN1_RAR.type = 1;
DCI_Content[i].DCIN1_RAR.type = 1;
//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_Content[i]->DCIN1_RAR.Scheddly = Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.scheduling_delay;
DCI_Content[i]->DCIN1_RAR.ResAssign = Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->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->npdcch_pdu.npdcch_pdu_rel13.mcs;
DCI_Content[i]->DCIN1_RAR.ndi = Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->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->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->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number;
// configure dlsch parameters and CCE index
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_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;
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;
// configure dlsch parameters and CCE index (fill the dlsch_ra structure???)
LOG_D(PHY,"Generating dlsch params for RA_RNTI\n");
NB_generate_eNB_dlsch_params_from_dci(frame,
NB_generate_eNB_dlsch_params_from_dci(eNB,
frame,
subframe,
DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.rnti,
&DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCIFormatN1_RAR,
&eNB->dlsch_ra,
&eNB->dlsch_ra_NB,
fp,
Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI.DL_DCI.number_dci
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci
);
break;
case DCIFormatN1:
//DCI format N1 to DLSCH
DCI_Content[i]->DCIN1_RAR.type = 1;
DCI_Content[i]->DCIN1_RAR.orderIndicator = Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication;
DCI_Content[i]->DCIN1_RAR.Scheddly = Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.scheduling_delay;
DCI_Content[i]->DCIN1_RAR.ResAssign = Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->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->npdcch_pdu.npdcch_pdu_rel13.mcs;
DCI_Content[i]->DCIN1_RAR.ndi = Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->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->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->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number;
NB_generate_eNB_dlsch_params_from_dci(frame,
DCI_Content[i].DCIN1.type = 1;
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;
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;
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;
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;
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;
//fill the dlsch[] structure???
NB_generate_eNB_dlsch_params_from_dci(eNB,
frame,
subframe,
DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCIFormatN0,
eNB->dlsch[(uint8_t)UE_id],
&DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.rnti,
DCIFormatN1,
eNB->ndlsch[(uint8_t)UE_id],
fp,
Sched_Rsp->NB_DL.NB_DCI.DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI.DL_DCI.number_dci
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.dl_config_pdu_list->npdcch_pdu.npdcch_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI->DL_DCI.number_dci
);
break;
/*TODO reserve for the N2 DCI*/
......@@ -537,31 +534,31 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_
DCI_CONTENT DCI_Content[2]; //max number of DCI in a single subframe = 2 (may put this as a global variable)
for(int i = 0; i<Sched_Rsp->NB_DL.NB_DCI.UL_DCI.number_of_dci; i++)
for(int i = 0; i<Sched_Rsp->NB_DL.NB_DCI->UL_DCI.number_of_dci; i++)
{
//mapping the fapi parameters to the OAI parameters
DCI_Content[i]->DCIN0.type = 0;
DCI_Content[i]->DCIN0.scind = Sched_Rsp->NB_DL.NB_DCI.UL_DCI.hi_dci0_pdu_list->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->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->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->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->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->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->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->npdcch_dci_pdu.npdcch_dci_pdu_rel13.dci_subframe_repetition_number;
DCI_Content[i].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[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[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[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[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[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[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[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;
/*Log for generate ULSCH DCI*/
NB_generate_eNB_ulsch_params_from_dci(eNB,
proc,
DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI.UL_DCI.hi_dci0_pdu_list->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti,
&DCI_Content[i],
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list->npdcch_dci_pdu.npdcch_dci_pdu_rel13.rnti,
DCIFormatN0,
UE_id,
Sched_Rsp->NB_DL.NB_DCI.UL_DCI.hi_dci0_pdu_list->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI.UL_DCI.number_of_dci
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.hi_dci0_pdu_list->npdcch_dci_pdu.npdcch_dci_pdu_rel13.aggregation_level,
Sched_Rsp->NB_DL.NB_DCI->UL_DCI.number_of_dci
);
......@@ -576,291 +573,401 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_
}
}
/*
* for NB-IoT
* this function is called by the PHy procedure TX in 3 possible occasion:
* 1) we manage BCCH pdu
* 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_DLSCH_t *dlsch,
//NB_IoT_eNB_DLSCH_t *dlsch1,//this is the second colum of the UE specific LTE_eNB_DLSCH_t (see the PHY/defs.h line 471) 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"/HARQ proc%"PRIu8"] 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,
harq_pid,
frame, subframe, input_buffer_length,
get_G(fp,dlsch_harq->nb_rb,dlsch_harq->rb_alloc,get_Qm(dlsch_harq->mcs),dlsch_harq->Nl, num_pdcch_symbols, frame, subframe, dlsch_harq->mimo_mode==TM7?7:0),
dlsch_harq->nb_rb, //in NB_IoT we not need it??? (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
/* 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)
// 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;
int UE_id = 0;
}
else { //manage the RAR
//First check for DCI
if(sched_rsp->NB_DL.NB_DCI != NULL)
{
/*
* 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)
* 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
*
*/
// int16_t crnti = mac_xface->fill_rar(eNB->Mod_id,
// eNB->CC_id,
// frame,
// DLSCH_pdu_rar,
// fp->N_RB_UL,
// input_buffer_length);
if(Sched_Rsp->NB_DL.NB_DCI->DCI_Format != DCIFormatN0) //this is a DLSCH allocation
{
DLSCH_pdu = segment_data; //the proper PDU should be passed in the function when the RA flag is activated
int UE_id;
/*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 (crnti!=0)
UE_id = add_ue(crnti,eNB);
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 = -1;
UE_id=0;
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;
//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);*/
generate_eNB_ulsch_params_from_rar(DLSCH_pdu,
frame,
subframe,
eNB->ulsch[(uint32_t)UE_id],
fp);
//HI_DCI0_request
for (int i = 0; Sched_Rsp->NB_DL.NB_DCI->UL_DCI.number_of_dci; i ++)
{
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);
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);
/* 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;
if (UE_id<0)
LOG_E(PHY, "process_schedule_rsp: UE_id for UL_DCI is negative\n");
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);
NB_generate_eNB_ulsch_params(eNB,proc,Sched_Rsp,UE_id);
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]++;
else if(sched_rsp->NB_DL.NB_DLSCH != NULL)
{
#ifdef DEBUG_PHY_PROC
#ifdef DEBUG_DLSCH
LOG_D(PHY,"[eNB] This DLSCH is a retransmission\n");
#endif
#endif
//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
}
if (eNB->abstraction_flag==0) { // used for simulation of the PHY??
LOG_D(PHY,"Generating NDLSCH/NPDSCH %d\n",ra_flag);
// 36-212
//encoding---------------------------
}
else if(sched_rsp->NB_DL.NB_UL_config != NULL)
{
//TODO : manage the configuration for UL
/*
* 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
* UL_CONFIG.request body
* pdu_type = 16 (NULSCH PDU)
* pdu_type = 17 (NRACH PDU) just for nprach configuration change (not managed here)
*
* Nsf needed as an input (number of subframe)
*/
start_meas(&eNB->dlsch_encoding_stats);
LOG_I(PHY, "NB-IoT Encoding step\n");
eNB->te(eNB,
DLSCH_pdu,
num_pdcch_symbols,
dlsch,
frame,subframe,
&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");
dlsch_scrambling(fp,
0,
dlsch,
get_G(fp,
dlsch_harq->nb_rb,
dlsch_harq->rb_alloc,
get_Qm(dlsch_harq->mcs),
dlsch_harq->Nl,
num_pdcch_symbols,
frame,subframe,
0),
0,
subframe<<1);
stop_meas(&eNB->dlsch_scrambling_stats);
//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");
//modulation-------------------------------------------
start_meas(&eNB->dlsch_modulation_stats);
LOG_I(PHY, "NB-IoT Modulation step\n");
dlsch_modulation(eNB,
eNB->common_vars.txdataF[0],
AMP,
subframe,
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;
}
/*
* for NB-IoT ndlsch procedure
* this function is called by the PHy procedure TX in 3 possible occasion:
* 1) we manage BCCH pdu
* 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");
//
// eNB->te(eNB,
// DLSCH_pdu,
// num_pdcch_symbols,
// dlsch,
// frame,subframe,
// &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");
//
// dlsch_scrambling(fp,
// 0,
// dlsch,
// get_G(fp,
// dlsch_harq->nb_rb,
// dlsch_harq->rb_alloc,
// get_Qm(dlsch_harq->mcs),
// dlsch_harq->Nl,
// num_pdcch_symbols,
// frame,subframe,
// 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");
//
// dlsch_modulation(eNB,
// eNB->common_vars.txdataF[0],
// AMP,
// subframe,
// 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;
//}
......@@ -892,8 +999,6 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
// are needed??? (maybe not)
//uint8_t num_npdcch_symbols = 0;
Sched_Rsp_t *sched_rsp;
if(do_meas == 1)
start_meas(&eNB->phy_proc_tx);
......@@ -919,9 +1024,12 @@ 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
NB_common_signal_procedures(eNB,proc);
......@@ -965,33 +1073,40 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
**allowed indexes for Nb-IoT PRBs are reported in R&Shwartz pag 9
*
*/
if((subframe==0) && (sched_rsp->NB_DL.NB_BCH.MIB_pdu.segments[0].segment_data)!=NULL)
if((subframe==0) && (sched_rsp->NB_DL.NB_BCH->MIB_pdu.segments[0].segment_data)!=NULL)
{
generate_npbch(&eNB->npbch,
txdataF,
AMP,
fp,
&sched_rsp->NB_DL.NB_BCH.MIB_pdu.segments[0].segment_data,
&sched_rsp->NB_DL.NB_BCH->MIB_pdu.segments[0].segment_data,
frame%64,
fp->NB_IoT_RB_ID
);
}
/*process the schedule response
* fill the PHY config structures
* */
process_schedule_rsp(sched_rsp, eNB, proc);
/*
* Generate BCCH transmission (System Information)
*/
// check for BCCH
//rnti_type = 0 BCCH information
//rnti_type = 1 Other
if(sched_rsp->NB_DL.NB_DLSCH.ndlsch.rnti_type == 0 && (sched_rsp->NB_DL.NB_DLSCH.NPDSCH_pdu.segments[0].segment_data)!= NULL)
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,
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);
sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_length,
sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_data);
}
......@@ -1006,6 +1121,7 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB->ndlsch[i]->subframe_tx[subframe] = 0;
}
/*clear the DCI allocation maps for new subframe*/
if(eNB->nulsch[i])
{
......@@ -1021,50 +1137,11 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
/*Loop over all the dci to generate DLSCH allocation, there is only 1 or 2 DCIs for NB-IoT in the same time*/
// 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->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((int16_t)Sched_Rsp->NB_DL.NB_DCI.DL_DCI.npdcch_pdu_rel13.rnti,eNB);
}
else
UE_id=0;
//inside we have nFAPI to OAI parameters
NB_generate_eNB_dlsch_params(eNB,proc,Sched_Rsp,UE_id);
}
/* 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);*/
for (int i = 0; Sched_Rsp->NB_DL.NB_DCI.UL_DCI.number_of_dci; i ++)
{
if (Sched_Rsp->NB_DL.NB_DCI.DCI_Format == DCIFormatN0) // this is a ULSCH allocation
{
UE_id = find_ue((int16_t)Sched_Rsp->NB_DL.NB_DCI.UL_DCI.npdcch_dci_pdu_rel13.rnti,eNB);
NB_generate_eNB_ulsch_params(eNB,proc,Sched_Rsp,UE_id);
}
}
/*If we have DCI to generate do it now TODO : have a generate dci top for NB_IoT */
//to be modified but inside we have the nuew function for dci transmission
generate_dci_top();
//now we should check if Sched_Rsp contains data
//rnti_type = 0 BCCH information
//rnti_type = 1 Other
if(Sched_Rsp->NB_DL.NB_DLSCH.ndlsch.rnti_type == 0)
if(Sched_Rsp->NB_DL.NB_DLSCH->ndlsch.rnti_type == 1 && (sched_rsp->NB_DL.NB_DLSCH->NPDSCH_pdu.segments[0].segment_data)!= NULL)
{
//we not need between RAR PDUS
......@@ -1073,8 +1150,16 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
}
/*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();
//maybe not needed
if (release_thread(&proc->mutex_l2,&proc->instance_cnt_l2,"eNB_L2_thread") < 0) break;
}
}
#include "IF_Module_L2_primitives_nb_iot.h"
void UL_indication(UL_IND_t UL_INFO)
// Sched_INFO as a input for the scheduler
void UL_indication(UL_IND_t *UL_INFO)
{
int i=0;
/*If there is a preamble, do the initiate RA procedure*/
if(UL_INFO.NRACH.number_of_initial_scs_detected>0)
if(UL_INFO->NRACH.number_of_initial_scs_detected>0)
{
for(i=0;i<UL_INFO.NRACH.number_of_initial_scs_detected;i++)
for(i=0;i<UL_INFO->NRACH.number_of_initial_scs_detected;i++)
{
NB_initiate_ra_proc(UL_INFO.module_id,
UL_INFO.CC_id,
UL_INFO.frame,
(UL_INFO.NRACH.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
NB_initiate_ra_proc(UL_INFO->module_id,
UL_INFO->CC_id,
UL_INFO->frame,
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
//timing_offset = Timing_advance * 16
(UL_INFO.NRACH.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance * 16,
UL_INFO.subframe
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance * 16,
UL_INFO->subframe
);
}
}
if(UL_INFO.RX_NPUSCH.number_of_pdus>0)
if(UL_INFO->RX_NPUSCH.number_of_pdus>0)
{
/*If there is a Uplink SDU (even MSG3, NAK) need to send to MAC*/
for(i=0;i<UL_INFO.RX_NPUSCH.number_of_pdus;i++)
for(i=0;i<UL_INFO->RX_NPUSCH.number_of_pdus;i++)
{
/*For MSG3, Normal Uplink Data, NAK*/
NB_rx_sdu(UL_INFO.module_id,
UL_INFO.CC_id,
UL_INFO.frame,
UL_INFO.subframe,
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti,
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->data,
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length,
(UL_INFO.RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid
NB_rx_sdu(UL_INFO->module_id,
UL_INFO->CC_id,
UL_INFO->frame,
UL_INFO->subframe,
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.rnti,
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data,
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length,
(UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_ue_information.harq_pid
);
......
......@@ -8,6 +8,6 @@
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
void UL_indication(UL_IND_t UL_INFO);
void UL_indication(UL_IND_t *UL_INFO);
#endif
......@@ -18,7 +18,7 @@
// P5 FAPI-like configuration structures
// P5 FAPI-like configuration structures-------------------------------------------------------------------------------
/*MP: MISSED COMMON CONFIG. of SIB2-NB in FAPI SPECS (may non needed)*/
typedef struct{
......@@ -99,9 +99,7 @@ typedef struct{
// uplink subframe P7
// uplink subframe P7---------------------------------------------------------------------------------
/*UL_IND_t:
......@@ -169,24 +167,22 @@ typedef struct{
}npdcch_t;
typedef struct{
//for indicate receiving the NPUSCH
nfapi_ul_config_nulsch_pdu nulsch_pdu;
//for indicate receiving the NPRACH
nfapi_ul_config_nrach_pdu nrach_pdu;
nfapi_ul_config_request_pdu_t ulsch_pdu;
}nulsch_t;
typedef union{
typedef struct{
// these structures contains both instruction and PDUs itself
npdcch_t NB_DCI;
npdcch_t *NB_DCI;
npdsch_t NB_DLSCH;
npdsch_t *NB_DLSCH;
npbch_t NB_BCH;
npbch_t *NB_BCH;
nulsch_t NB_UL;
nulsch_t *NB_UL_config;
}NB_DL_u;
}NB_DL_t;
typedef struct{
......@@ -202,7 +198,7 @@ typedef struct{
//subframe
sub_frame_t subframeP;
NB_DL_u NB_DL;
NB_DL_t NB_DL;
}Sched_Rsp_t;
......@@ -211,8 +207,8 @@ typedef struct{
It should be allocated at the main () in lte-softmodem.c*/
typedef struct IF_Module_s{
//define the function pointer
void (*UL_indication)(UL_IND_t UL_INFO);
void (*schedule_response)(Sched_Rsp_t Sched_INFO);
void (*UL_indication)(UL_IND_t *UL_INFO);
void (*schedule_response)(Sched_Rsp_t *Sched_INFO);
void (*PHY_config_req)(PHY_Config_t* config_INFO);
}IF_Module_t;
......
......@@ -575,13 +575,18 @@ int wait_CCs(eNB_rxtx_proc_t *proc) {
return(0);
}
/*NB-IoT rxtx
* IMPORTANT
* When we run the rxtx thread for NB-IoT we should not run at the same time otherwise we fill the same buffers in PHY_Vars_eNB
* */
static inline int NB_rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
UL_IND_t *UL_INFO;
Sched_Rsp_t *Sched_Rsp;
UL_INFO = (UL_IND_t*) malloc(sizeof(UL_IND_t));
Sched_Rsp = (Sched_Rsp_t*) malloc(sizeof(Sched_Rsp_t));
start_meas(&softmodem_stats_rxtx_sf);
......@@ -591,11 +596,13 @@ 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);
// skip the comment for this moment
/*UE-specific RX processing for subframe n*/
NB_phy_procedures_eNB_uespec_RX(eNB,proc);
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
......@@ -620,6 +627,51 @@ 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);
......
......@@ -171,7 +171,7 @@ void init_lte_eNB_NB(
LOG_I(PHY,"init eNB NB_IoT: Nid_cell %d\n", frame_parms->Nid_cell);
LOG_I(PHY,"init eNB NB_IoT: number of ue max %d number of enb max %d \n",
NUMBER_OF_UE_MAX, NUMBER_OF_eNB_MAX);
LOG_I(PHY,"init eNB NB_IoT: N_RB_DL %d\n", frame_parms->N_RB_DL);
//LOG_I(PHY,"init eNB NB_IoT: N_RB_DL %d\n", frame_parms->N_RB_DL);
//LOG_I(PHY,"init eNB NB_IoT: prach_config_index %d\n", frame_parms->nprach_config_common.prach_ConfigInfo.prach_ConfigIndex);
if (node_function >= NGFI_RRU_IF5)
......@@ -185,15 +185,15 @@ 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_NB_IOT; 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);
PHY_vars_eNB->ndlsch[i] = new_eNB_dlsch_NB(NSOFT,abstraction_flag,frame_parms);
if (!PHY_vars_eNB->ndlsch[i]) {
LOG_E(PHY,"Can't get eNB ndlsch structures for UE %d \n", i);
exit(-1);
} else {
LOG_D(PHY,"dlsch[%d] => %p\n",i,PHY_vars_eNB->dlsch[i]);
PHY_vars_eNB->dlsch[i]->rnti=0;
LOG_D(PHY,"dlsch[%d] => %p\n",i,PHY_vars_eNB->ndlsch[i]);
PHY_vars_eNB->ndlsch[i]->rnti=0;
}
......
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