Commit 564268d0 authored by Vincent Savaux's avatar Vincent Savaux

Merge branch 'develop-nb-iot' of...

Merge branch 'develop-nb-iot' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot
parents 73bfe44f 3ed2490e
......@@ -24,6 +24,7 @@
#include "PHY/defs.h"
#include "PHY/defs_NB_IoT.h"
#include "SystemInformationBlockType2.h"
//#include "RadioResourceConfigCommonSIB.h"
......@@ -338,6 +339,9 @@ void phy_cleanup(void);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
void lte_param_init(unsigned char N_tx_port_eNB,
......@@ -353,5 +357,30 @@ void lte_param_init(unsigned char N_tx_port_eNB,
uint8_t osf,
uint32_t perfect_ce);
/** @} */
// for NB-IoT
int init_frame_parms_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void phy_init_lte_top_NB_IoT(NB_IoT_DL_FRAME_PARMS *lte_frame_parms);
/*!
\brief Allocate and initialize the PHY variables relevant to the LTE implementation (eNB).
\details Only a subset of phy_vars_eNb is initialized.
@param[out] phy_vars_eNb Pointer to eNB Variables
@param is_secondary_eNb Flag to indicate this eNB gets synch from another
@param abstraction_flag 1 indicates memory should be allocated for abstracted MODEM
@returns 0 on success
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
*/
int phy_init_lte_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNb,
unsigned char is_secondary_eNb,
unsigned char abstraction_flag);
#endif
......@@ -76,5 +76,6 @@ void phy_config_dedicated_eNB_NB_IoT(module_id_t Mod_id,
#endif
This diff is collapsed.
......@@ -21,6 +21,7 @@
#include "defs.h"
#include "log.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
uint16_t dl_S_table_normal[10]={3,9,10,11,12,3,9,10,11,6};
uint16_t dl_S_table_extended[10]={3,8,9,10,3,8,9,5,0,0};
......@@ -219,3 +220,154 @@ void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
printf("frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti);
printf("frame_parms->symbols_per_tti=%d\n",frame_parms->symbols_per_tti);
}
// NB-IoT
int init_frame_parms_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint8_t osf)
{
uint8_t log2_osf;
#if DISABLE_LOG_X
printf("Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf);
#else
LOG_I(PHY,"Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf);
#endif
frame_parms->nb_prefix_samples0 = 160;
frame_parms->nb_prefix_samples = 144;
frame_parms->symbols_per_tti = 14;
switch(osf) {
case 1:
log2_osf = 0;
break;
case 2:
log2_osf = 1;
break;
case 4:
log2_osf = 2;
break;
case 8:
log2_osf = 3;
break;
case 16:
log2_osf = 4;
break;
default:
printf("Illegal oversampling %d\n",osf);
return(-1);
}
switch (frame_parms->N_RB_DL) {
case 100:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
if (frame_parms->threequarter_fs) {
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->first_carrier_offset = 1536-600;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
}
else {
frame_parms->ofdm_symbol_size = 2048;
frame_parms->samples_per_tti = 30720;
frame_parms->first_carrier_offset = 2048-600;
}
break;
case 75:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->first_carrier_offset = 1536-450;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
break;
case 50:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 1024*osf;
frame_parms->samples_per_tti = 15360*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 300;
frame_parms->nb_prefix_samples>>=(1-log2_osf);
frame_parms->nb_prefix_samples0>>=(1-log2_osf);
break;
case 25:
if (osf>2) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 512*osf;
frame_parms->samples_per_tti = 7680*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 150;
frame_parms->nb_prefix_samples>>=(2-log2_osf);
frame_parms->nb_prefix_samples0>>=(2-log2_osf);
break;
case 15:
frame_parms->ofdm_symbol_size = 256*osf;
frame_parms->samples_per_tti = 3840*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 90;
frame_parms->nb_prefix_samples>>=(3-log2_osf);
frame_parms->nb_prefix_samples0>>=(3-log2_osf);
break;
case 6:
frame_parms->ofdm_symbol_size = 128*osf;
frame_parms->samples_per_tti = 1920*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 36;
frame_parms->nb_prefix_samples>>=(4-log2_osf);
frame_parms->nb_prefix_samples0>>=(4-log2_osf);
break;
default:
printf("init_frame_parms: Error: Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms);
return(-1);
break;
}
printf("lte_parms.c: Setting N_RB_DL to %d, ofdm_symbol_size %d\n",frame_parms->N_RB_DL, frame_parms->ofdm_symbol_size);
// frame_parms->tdd_config=3;
return(0);
}
......@@ -217,7 +217,7 @@ typedef enum {
eNodeB_3GPP_BBU_NB_IoT, // eNodeB with NGFI IF5
NGFI_RCC_IF4p5_NB_IoT, // NGFI_RCC (NGFI radio cloud center)
NGFI_RAU_IF4p5_NB_IoT,
NGFI_RRU_IF5_Nb_IoT, // NGFI_RRU (NGFI remote radio-unit,IF5)
NGFI_RRU_IF5_NB_IoT, // NGFI_RRU (NGFI remote radio-unit,IF5)
NGFI_RRU_IF4p5_NB_IoT // NGFI_RRU (NGFI remote radio-unit,IF4p5)
} eNB_func_NB_IoT_t;
......
......@@ -533,7 +533,7 @@ typedef struct {
/// flag to indicate SISO transmission
uint8_t mode1_flag;
/// Indicator that 20 MHz channel uses 3/4 sampling frequency
//uint8_t threequarter_fs;
uint8_t threequarter_fs;
/// Size of FFT
uint16_t ofdm_symbol_size;
/// Number of prefix samples in all but first symbol of slot
......
......@@ -283,7 +283,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP);
const Enb_properties_array_t *enb_config_get(void);
// *** NB-IoT *** //
// ******************************************************** NB-IoT ********************************************************** //
typedef struct Enb_properties_NB_IoT_s {
/* Unique eNB_id to identify the eNB within EPC.
......@@ -409,18 +409,18 @@ typedef struct Enb_properties_NB_IoT_s {
long pcch_defaultPagingCycle_NB[1+MAX_NUM_CCs];
long nprach_CP_Length[1+MAX_NUM_CCs];
long nprach_rsrp_range[1+MAX_NUM_CCs];
const char* nprach_SubcarrierMSG3_RangeStart;
char* nprach_SubcarrierMSG3_RangeStart;
long maxNumPreambleAttemptCE_NB[1+MAX_NUM_CCs];
long npdsch_nrs_Power[1+MAX_NUM_CCs];
long npusch_ack_nack_numRepetitions_NB[1+MAX_NUM_CCs];
long npusch_srs_SubframeConfig_NB[1+MAX_NUM_CCs];
long npusch_threeTone_CyclicShift_r13[1+MAX_NUM_CCs];
long npusch_sixTone_CyclicShift_r13[1+MAX_NUM_CCs];
long npusch_groupHoppingEnabled[1+MAX_NUM_CCs];
BOOLEAN_t npusch_groupHoppingEnabled[1+MAX_NUM_CCs];
long npusch_groupAssignmentNPUSCH_r13[1+MAX_NUM_CCs];
long dl_GapThreshold_NB[1+MAX_NUM_CCs];
long dl_GapPeriodicity_NB[1+MAX_NUM_CCs];
const char* dl_GapDurationCoeff_NB;
char* dl_GapDurationCoeff_NB;
long npusch_p0_NominalNPUSCH[1+MAX_NUM_CCs];
long npusch_alpha[1+MAX_NUM_CCs];
long deltaPreambleMsg3[1+MAX_NUM_CCs];
......@@ -439,7 +439,7 @@ typedef struct Enb_properties_NB_IoT_s {
long numRepetitionsPerPreambleAttempt[1+MAX_NUM_CCs];
long npdcch_NumRepetitions_RA[1+MAX_NUM_CCs];
long npdcch_StartSF_CSS_RA[1+MAX_NUM_CCs];
const char* npdcch_Offset_RA;
char* npdcch_Offset_RA;
//****************************************
long srb1_timer_poll_retransmit;
......@@ -506,9 +506,16 @@ typedef struct Enb_properties_NB_IoT_s {
#endif
} Enb_properties_NB_IoT_t;
const Enb_properties_array_t *enb_config_init_NB_IoT(char* lib_config_file_name_pP);
typedef struct Enb_properties_array_NB_IoT_s {
int number;
Enb_properties_NB_IoT_t *properties[MAX_ENB];
} Enb_properties_array_NB_IoT_t;
void enb_config_display_NB_IoT(void);
const Enb_properties_array_NB_IoT_t *enb_config_init_NB_IoT(char* lib_config_file_name_pP);
const Enb_properties_array_NB_IoT_t *enb_config_get_NB_IoT(void);
#endif /* ENB_CONFIG_H_ */
/** @} */
This diff is collapsed.
This diff is collapsed.
......@@ -150,6 +150,123 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
PHY_VARS_eNB_NB_IoT* init_lte_eNB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
eNB_func_NB_IoT_t node_function,
uint8_t abstraction_flag)
{
int i;
PHY_VARS_eNB_NB_IoT* PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB_NB_IoT));
memset(PHY_vars_eNB,0,sizeof(PHY_VARS_eNB_NB_IoT));
PHY_vars_eNB->Mod_id=eNB_id;
PHY_vars_eNB->cooperation_flag=0;//cooperation_flag;
memcpy(&(PHY_vars_eNB->frame_parms), frame_parms, sizeof(NB_IoT_DL_FRAME_PARMS));
PHY_vars_eNB->frame_parms.Nid_cell = ((Nid_cell/3)*3)+((eNB_id+Nid_cell)%3);
PHY_vars_eNB->frame_parms.nushift = PHY_vars_eNB->frame_parms.Nid_cell%6;
phy_init_lte_eNB_NB_IoT(PHY_vars_eNB,0,abstraction_flag);
/*LOG_I(PHY,"init eNB: Node Function %d\n",node_function);
LOG_I(PHY,"init eNB: Nid_cell %d\n", frame_parms->Nid_cell);
LOG_I(PHY,"init eNB: frame_type %d,tdd_config %d\n", frame_parms->frame_type,frame_parms->tdd_config);
LOG_I(PHY,"init eNB: number of ue max %d number of enb max %d number of harq pid max %d\n",
NUMBER_OF_UE_MAX, NUMBER_OF_eNB_MAX, NUMBER_OF_HARQ_PID_MAX);
LOG_I(PHY,"init eNB: N_RB_DL %d\n", frame_parms->N_RB_DL);
LOG_I(PHY,"init eNB: prach_config_index %d\n", frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex);
*/
/*
if (node_function >= NGFI_RRU_IF5)
// For RRU, don't allocate DLSCH/ULSCH Transport channel buffers
return (PHY_vars_eNB);
*/
/*
for (i=0; i<NUMBER_OF_UE_MAX_NB_IoT; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i);
for (j=0; j<2; j++) {
PHY_vars_eNB->dlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL,abstraction_flag,frame_parms);
if (!PHY_vars_eNB->dlsch[i][j]) {
LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i);
exit(-1);
} else {
LOG_D(PHY,"dlsch[%d][%d] => %p\n",i,j,PHY_vars_eNB->dlsch[i][j]);
PHY_vars_eNB->dlsch[i][j]->rnti=0;
}
}
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n", i);
PHY_vars_eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,frame_parms->N_RB_UL, abstraction_flag);
if (!PHY_vars_eNB->ulsch[1+i]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
}
*/
// this is the transmission mode for the signalling channels
// this will be overwritten with the real transmission mode by the RRC once the UE is connected
PHY_vars_eNB->transmission_mode[0] = 1 ;
/*#ifdef LOCALIZATION
PHY_vars_eNB->ulsch[1+i]->aggregation_period_ms = 5000; // 5000 milliseconds // could be given as an argument (TBD))
struct timeval ts;
gettimeofday(&ts, NULL);
PHY_vars_eNB->ulsch[1+i]->reference_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
int j;
for (j=0; j<10; j++) {
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_rss_list[j]);
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_rssi_list[j]);
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_subcarrier_rss_list[j]);
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_timing_advance_list[j]);
initialize(&PHY_vars_eNB->ulsch[1+i]->loc_timing_update_list[j]);
}
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_rss_list);
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_rssi_list);
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_subcarrier_rss_list);
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_timing_advance_list);
initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_timing_update_list);
#endif*/
// }
/*
// ULSCH for RA
PHY_vars_eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, frame_parms->N_RB_UL, abstraction_flag);
if (!PHY_vars_eNB->ulsch[0]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
}
PHY_vars_eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, abstraction_flag, frame_parms);
LOG_D(PHY,"eNB %d : SI %p\n",eNB_id,PHY_vars_eNB->dlsch_SI);
PHY_vars_eNB->dlsch_ra = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, abstraction_flag, frame_parms);
LOG_D(PHY,"eNB %d : RA %p\n",eNB_id,PHY_vars_eNB->dlsch_ra);
PHY_vars_eNB->dlsch_MCH = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, 0, frame_parms);
LOG_D(PHY,"eNB %d : MCH %p\n",eNB_id,PHY_vars_eNB->dlsch_MCH);
*/
PHY_vars_eNB->rx_total_gain_dB=130;
/* for(i=0; i<NUMBER_OF_UE_MAX; i++)
PHY_vars_eNB->mu_mimo_mode[i].dl_pow_off = 2;
PHY_vars_eNB->check_for_total_transmissions = 0;
PHY_vars_eNB->check_for_MUMIMO_transmissions = 0;
PHY_vars_eNB->FULL_MUMIMO_transmissions = 0;
PHY_vars_eNB->check_for_SUMIMO_transmissions = 0;
PHY_vars_eNB->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
*/
return (PHY_vars_eNB);
}
/*this is a function just for initialization of NB-IoT stuff*/
/*
......
......@@ -50,3 +50,12 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
int nb_antennas_tx,
int nb_antennas_rx_ue,
uint8_t eMBMS_active_state);
// for NB-IoT testing
PHY_VARS_eNB_NB_IoT* init_lte_eNB_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
eNB_func_NB_IoT_t node_function,
uint8_t abstraction_flag);
\ No newline at end of file
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