Commit 63a18b81 authored by knopp's avatar knopp

first time UE connection established

parent ca2c8357
......@@ -49,7 +49,7 @@ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
/*!
\brief Allocate and Initialize the PHY variables relevant to the LTE implementation.
\brief Allocate and Initialize the PHY variables relevant to the LTE ue signal buffers.
\details Only a subset of phy_vars_ue is initialized.
@param[out] phy_vars_ue Pointer to UE Variables
@param nb_connected_eNB Number of eNB that UE can process in one PDSCH demodulation subframe
......@@ -58,9 +58,16 @@ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
@returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault.
*/
int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
int nb_connected_eNB,
uint8_t abstraction_flag);
int phy_init_lte_ue_signal(PHY_VARS_UE *phy_vars_ue,
int nb_connected_eNB,
uint8_t abstraction_flag);
/*!
\brief Allocate and initialize the PHY variables releated to the transport channel buffers (UL/DL)
@param ue Pointer to UE L1 context
@param abstraction flag Indicates that abstraction is used in L1
*/
void init_lte_ue_transport(PHY_VARS_UE *ue,int absraction_flag);
/*!
\brief Allocate and initialize the PHY variables relevant to the LTE implementation (eNB).
......@@ -304,7 +311,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB);
int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb);
void phy_init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms);
void init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms);
//void copy_lte_parms_to_phy_framing(LTE_DL_FRAME_PARMS *frame_parm, PHY_FRAMING *phy_framing);
......
......@@ -57,22 +57,24 @@ void phy_config_mib_eNB(int Mod_id,
Mod_id, CC_id, eutra_band, N_RB_DL_array[dl_Bandwidth], Nid_cell, p_eNB,dl_CarrierFreq);
if (RC.eNB == NULL) {
RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
}
if (RC.eNB[Mod_id] == NULL) {
RC.eNB[Mod_id] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**));
RC.eNB[Mod_id] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**));
LOG_I(PHY,"RC.eNB[%d] = %p\n",Mod_id,RC.eNB[Mod_id]);
memset(RC.eNB[Mod_id],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***));
}
if (RC.eNB[Mod_id][CC_id] == NULL) {
RC.eNB[Mod_id][CC_id] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",Mod_id,CC_id,RC.eNB[Mod_id][CC_id]);
RC.eNB[Mod_id][CC_id]->Mod_id = Mod_id;
RC.eNB[Mod_id][CC_id]->CC_id = CC_id;
RC.eNB[Mod_id][CC_id]->Mod_id = Mod_id;
RC.eNB[Mod_id][CC_id]->CC_id = CC_id;
}
RC.eNB[Mod_id][CC_id]->mac_enabled = 1;
fp = &RC.eNB[Mod_id][CC_id]->frame_parms;
fp->N_RB_DL = N_RB_DL_array[dl_Bandwidth];
......@@ -92,7 +94,7 @@ void phy_config_mib_eNB(int Mod_id,
fp->frame_type = FDD;
init_frame_parms(fp,1);
phy_init_lte_top(fp);
init_lte_top(fp);
}
......@@ -1014,7 +1016,7 @@ void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uin
}
}
void phy_init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
{
crcTableInit();
......@@ -1047,6 +1049,7 @@ void phy_init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
init_scrambling_lut();
//set_taus_seed(1328);
}
/*! \brief Helper function to allocate memory for DLSCH data structures.
......@@ -1100,9 +1103,9 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS
}
int phy_init_lte_ue(PHY_VARS_UE *ue,
int nb_connected_eNB,
uint8_t abstraction_flag)
int init_lte_ue_signal(PHY_VARS_UE *ue,
int nb_connected_eNB,
uint8_t abstraction_flag)
{
// create shortcuts
......@@ -1123,6 +1126,13 @@ int phy_init_lte_ue(PHY_VARS_UE *ue,
LOG_D(PHY,"Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
init_frame_parms(&ue->frame_parms,1);
init_lte_top(&ue->frame_parms);
init_ul_hopping(&ue->frame_parms);
// many memory allocation sizes are hard coded
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
AssertFatal( ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
......@@ -1324,6 +1334,30 @@ int phy_init_lte_ue(PHY_VARS_UE *ue,
return 0;
}
void init_lte_ue_transport(PHY_VARS_UE *ue,int abstraction_flag) {
int i,j;
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
for (j=0; j<2; j++) {
AssertFatal((ue->dlsch[i][j] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
LOG_D(PHY,"dlsch[%d][%d] => %p\n",ue->Mod_id,i,ue->dlsch[i][j]);
}
AssertFatal((ue->ulsch[i] = new_ue_ulsch(ue->frame_parms.N_RB_UL, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n");
ue->dlsch_SI[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_ra[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_eNB==1 ? 1 : 2;
}
ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
ue->dlsch_MCH[0] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
}
int phy_init_RU(RU_t *ru) {
......
......@@ -96,7 +96,7 @@ void lte_param_init(unsigned char N_tx_port_eNB,
eNB->transmission_mode[0] = transmission_mode;
UE->transmission_mode[0] = transmission_mode;
phy_init_lte_top(frame_parms);
init_lte_top(frame_parms);
dump_frame_parms(frame_parms);
UE->measurements.n_adj_cells=0;
......@@ -106,7 +106,7 @@ void lte_param_init(unsigned char N_tx_port_eNB,
for (i=0; i<3; i++)
lte_gold(frame_parms,UE->lte_gold_table[i],Nid_cell+i);
phy_init_lte_ue(UE,1,0);
init_lte_ue(UE,1,0);
phy_init_lte_eNB(eNB,0,0);
generate_pcfich_reg_mapping(&UE->frame_parms);
......
......@@ -80,17 +80,15 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break;
default:
printf("Illegal oversampling %d\n",osf);
return(-1);
AssertFatal(1==0,"Illegal oversampling %d\n",osf);
}
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);
}
AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
if (frame_parms->threequarter_fs) {
frame_parms->ofdm_symbol_size = 1536;
......@@ -109,11 +107,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break;
case 75:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
......@@ -125,10 +119,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break;
case 50:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
frame_parms->ofdm_symbol_size = 1024*osf;
frame_parms->samples_per_tti = 15360*osf;
......@@ -140,10 +131,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t 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);
}
AssertFatal(osf<=2,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
frame_parms->ofdm_symbol_size = 512*osf;
......@@ -179,12 +168,12 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t 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);
AssertFatal(1==0,"Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms);
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);
LOG_I(PHY,"lte_parms.c: Setting N_RB_DL to %d, ofdm_symbol_size %d\n",frame_parms->N_RB_DL, frame_parms->ofdm_symbol_size);
if (frame_parms->frame_type == TDD) set_S_config(frame_parms);
......@@ -195,22 +184,22 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
{
printf("frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL);
printf("frame_parms->N_RB_UL=%d\n",frame_parms->N_RB_UL);
printf("frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell);
printf("frame_parms->Ncp=%d\n",frame_parms->Ncp);
printf("frame_parms->Ncp_UL=%d\n",frame_parms->Ncp_UL);
printf("frame_parms->nushift=%d\n",frame_parms->nushift);
printf("frame_parms->frame_type=%d\n",frame_parms->frame_type);
printf("frame_parms->tdd_config=%d\n",frame_parms->tdd_config);
printf("frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S);
printf("frame_parms->nb_antenna_ports_eNB=%d\n",frame_parms->nb_antenna_ports_eNB);
printf("frame_parms->nb_antennas_tx=%d\n",frame_parms->nb_antennas_tx);
printf("frame_parms->nb_antennas_rx=%d\n",frame_parms->nb_antennas_rx);
printf("frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size);
printf("frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples);
printf("frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0);
printf("frame_parms->first_carrier_offset=%d\n",frame_parms->first_carrier_offset);
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);
LOG_I(PHY,"frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL);
LOG_I(PHY,"frame_parms->N_RB_UL=%d\n",frame_parms->N_RB_UL);
LOG_I(PHY,"frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell);
LOG_I(PHY,"frame_parms->Ncp=%d\n",frame_parms->Ncp);
LOG_I(PHY,"frame_parms->Ncp_UL=%d\n",frame_parms->Ncp_UL);
LOG_I(PHY,"frame_parms->nushift=%d\n",frame_parms->nushift);
LOG_I(PHY,"frame_parms->frame_type=%d\n",frame_parms->frame_type);
LOG_I(PHY,"frame_parms->tdd_config=%d\n",frame_parms->tdd_config);
LOG_I(PHY,"frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S);
LOG_I(PHY,"frame_parms->nb_antenna_ports_eNB=%d\n",frame_parms->nb_antenna_ports_eNB);
LOG_I(PHY,"frame_parms->nb_antennas_tx=%d\n",frame_parms->nb_antennas_tx);
LOG_I(PHY,"frame_parms->nb_antennas_rx=%d\n",frame_parms->nb_antennas_rx);
LOG_I(PHY,"frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size);
LOG_I(PHY,"frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples);
LOG_I(PHY,"frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0);
LOG_I(PHY,"frame_parms->first_carrier_offset=%d\n",frame_parms->first_carrier_offset);
LOG_I(PHY,"frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti);
LOG_I(PHY,"frame_parms->symbols_per_tti=%d\n",frame_parms->symbols_per_tti);
}
......@@ -378,18 +378,6 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
for (n=0; n<length; n+=4) {
#ifdef RTAI_ENABLED
// This is necessary since the sync takes a long time and it seems to block all other threads thus screwing up RTAI. If we pause it for a little while during its execution we give RTAI a chance to catch up with its other tasks.
if ((n%frame_parms->samples_per_tti == 0) && (n>0) && (openair_daq_vars.sync_state==0)) {
#ifdef DEBUG_PHY
LOG_E(PHY,"[SYNC TIME] pausing for 1000ns, n=%d\n",n);
#endif
rt_sleep(nano2count(1000));
}
#endif
sync_corr_ue0[n] = 0;
sync_corr_ue0[n+length] = 0;
sync_corr_ue1[n] = 0;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0};
short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0};
short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0};
......
......@@ -69,7 +69,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type, int k)
db_fulllength = 12*fp->N_RB_DL;
db_halflength = (db_fulllength)>>1;
slotoffsetF = 0;//(subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
slotoffsetF = 1;//(subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
......@@ -263,7 +263,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
LOG_D(PHY,"DL_IF4p5: RU %d frame %d, subframe %d, symbol %d\n",ru->idx,*frame,*subframe,*symbol_number);
slotoffsetF = (*symbol_number)*(fp->ofdm_symbol_size);// + (*subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
slotoffsetF = (*symbol_number)*(fp->ofdm_symbol_size)+1;// + (*subframe)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
for (element_id=0; element_id<db_halflength; element_id++) {
......
......@@ -41,7 +41,7 @@
#include "common_lib.h"
extern openair0_config_t openair0_cfg[];
//#define DEBUG_INITIAL_SYNCH
#define DEBUG_INITIAL_SYNCH
int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
{
......@@ -282,6 +282,8 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
// First try FDD normal prefix
frame_parms->Ncp=NORMAL;
frame_parms->frame_type=FDD;
frame_parms->nb_antenna_ports_eNB = 2;
init_frame_parms(frame_parms,1);
/*
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
......
......@@ -793,7 +793,6 @@ void pbch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
// take the quarter of the PBCH that corresponds to this frame
if ((i>=(frame_mod4*(length>>2))) && (i<((1+frame_mod4)*(length>>2)))) {
// if (((s>>(i%32))&1)==1)
if (((s>>(i%32))&1)==0)
llr[i] = -llr[i];
......@@ -936,8 +935,6 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
if (mimo_mode == ALAMOUTI) {
pbch_alamouti(frame_parms,lte_ue_pbch_vars->rxdataF_comp,symbol);
// LOG_D(PHY,"[PBCH][RX] Alamouti receiver not yet implemented!\n");
// return(-1);
} else if (mimo_mode != SISO) {
LOG_D(PHY,"[PBCH][RX] Unsupported MIMO mode\n");
return(-1);
......@@ -1008,12 +1005,12 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
#ifdef DEBUG_PBCH
for (i=0; i<(PBCH_A>>3); i++)
LOG_D(PHY,"[PBCH] pbch_a[%d] = %x\n",i,decoded_output[i]);
LOG_I(PHY,"[PBCH] pbch_a[%d] = %x\n",i,decoded_output[i]);
#endif //DEBUG_PBCH
#ifdef DEBUG_PBCH
LOG_D(PHY,"PBCH CRC %x : %x\n",
LOG_I(PHY,"PBCH CRC %x : %x\n",
crc16(pbch_a,PBCH_A),
((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]);
#endif
......
......@@ -1256,6 +1256,79 @@ extern pthread_cond_t sync_cond;
extern pthread_mutex_t sync_mutex;
extern int sync_var;
#define MAX_RRU_CONFIG_SIZE 1024
typedef enum {
RAU_tick=0,
RRU_capabilities=1,
RRU_config=2,
RRU_MSG_max_num=3
} rru_config_msg_type_t;
typedef struct RRU_CONFIG_msg_s {
rru_config_msg_type_t type;
ssize_t len;
uint8_t msg[MAX_RRU_CONFIG_SIZE];
} RRU_CONFIG_msg_t;
typedef enum {
OAI_IF5_only =0,
OAI_IF4p5_only =1,
OAI_IF5_and_IF4p5 =2,
MBP_IF5 =3,
MAX_FH_FMTs =4
} FH_fmt_options_t;
#define MAX_BANDS_PER_RRU 4
typedef struct RRU_capabilities_s {
/// Fronthaul format
FH_fmt_options_t FH_fmt;
/// number of EUTRA bands (<=4) supported by RRU
uint8_t num_bands;
/// EUTRA band list supported by RRU
uint8_t band_list[MAX_BANDS_PER_RRU];
/// Number of concurrent bands (component carriers)
uint8_t num_concurrent_bands;
/// Maximum TX EPRE of each band
int8_t max_pdschReferenceSignalPower[MAX_BANDS_PER_RRU];
/// Maximum RX gain of each band
uint8_t max_rxgain[MAX_BANDS_PER_RRU];
/// Number of RX ports of each band
uint8_t nb_rx[MAX_BANDS_PER_RRU];
/// Number of TX ports of each band
uint8_t nb_tx[MAX_BANDS_PER_RRU];
/// max DL bandwidth (1,6,15,25,50,75,100)
uint8_t N_RB_DL[MAX_BANDS_PER_RRU];
/// max UL bandwidth (1,6,15,25,50,75,100)
uint8_t N_RB_UL[MAX_BANDS_PER_RRU];
} RRU_capabilities_t;
typedef struct RRU_config_s {
/// Fronthaul format
RU_if_south_t FH_fmt;
/// number of EUTRA bands (<=4) configured in RRU
uint8_t num_bands;
/// EUTRA band list configured in RRU
uint8_t band_list[MAX_BANDS_PER_RRU];
/// TX frequency
uint32_t tx_freq[MAX_BANDS_PER_RRU];
/// RX frequency
uint32_t rx_freq[MAX_BANDS_PER_RRU];
/// TX attenation w.r.t. max
uint8_t att_tx[MAX_BANDS_PER_RRU];
/// RX attenuation w.r.t. max
uint8_t att_rx[MAX_BANDS_PER_RRU];
/// DL bandwidth
uint8_t N_RB_DL[MAX_BANDS_PER_RRU];
/// UL bandwidth
uint8_t N_RB_UL[MAX_BANDS_PER_RRU];
/// 3/4 sampling rate
uint8_t threequarter_fs[MAX_BANDS_PER_RRU];
/// prach_FreqOffset for IF4p5
int prach_FreqOffset[MAX_BANDS_PER_RRU];
/// prach_ConfigIndex for IF4p5
int prach_ConfigIndex[MAX_BANDS_PER_RRU];
} RRU_config_t;
static inline void wait_sync(char *thread_name) {
......
......@@ -2602,47 +2602,7 @@ void init_te_thread(PHY_VARS_eNB *eNB,pthread_attr_t *attr_te) {
}
void do_prach(PHY_VARS_eNB *eNB,int frame,int subframe) {
eNB_proc_t *proc = &eNB->proc;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
// check if we have to detect PRACH first
if (is_prach_subframe(fp,frame,subframe)>0) {
/* accept some delay in processing - up to 5ms */
int i;
for (i = 0; i < 10 && proc->instance_cnt_prach == 0; i++) {
LOG_W(PHY,"[eNB] Frame %d Subframe %d, eNB PRACH thread busy (IC %d)!!\n", frame,subframe,proc->instance_cnt_prach);
usleep(500);
}
if (proc->instance_cnt_prach == 0) {
exit_fun( "PRACH thread busy" );
return;
}
// wake up thread for PRACH RX
if (pthread_mutex_lock(&proc->mutex_prach) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach);
exit_fun( "error locking mutex_prach" );
return;
}
++proc->instance_cnt_prach;
// set timing for prach thread
proc->frame_prach = frame;
proc->subframe_prach = subframe;
// the thread can now be woken up
if (pthread_cond_signal(&proc->cond_prach) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB PRACH thread %d\n", proc->thread_index);
exit_fun( "ERROR pthread_cond_signal" );
return;
}
pthread_mutex_unlock( &proc->mutex_prach );
}
}
/*
void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc){
......
......@@ -184,7 +184,7 @@ void feptx_ofdm(RU_t *ru) {
ru->common.txdata[aa][tx_offset] = 0x00000000;
}
}
LOG_I(PHY,"feptx_ofdm: frame %d, subframe %d: txp (time) %d dB, txp (freq) %d dB\n",
LOG_D(PHY,"feptx_ofdm: frame %d, subframe %d: txp (time) %d dB, txp (freq) %d dB\n",
ru->proc.frame_tx,subframe,dB_fixed(signal_energy(txdata,fp->samples_per_tti)),
dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[aa],2*slot_sizeF)));
}
......@@ -200,25 +200,36 @@ void feptx_prec(RU_t *ru) {
int32_t ***bw;
int subframe = ru->proc.subframe_tx;
for (i=0;i<ru->num_eNB;i++) {
eNB = eNB_list[i];
if (ru->num_eNB == 1) {
eNB = eNB_list[0];
fp = &eNB->frame_parms;
bw = ru->beam_weights[i];
for (l=0;l<fp->symbols_per_tti;l++) {
for (aa=0;aa<ru->nb_tx;aa++) {
beam_precoding(eNB->common_vars.txdataF,
ru->common.txdataF_BF,
fp,
bw,
subframe<<1,
l,
aa);
for (aa=0;aa<ru->nb_tx;aa++)
memcpy((void*)ru->common.txdataF_BF[aa],
(void*)&eNB->common_vars.txdataF[aa][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size],
fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t));
}
else {
for (i=0;i<ru->num_eNB;i++) {
eNB = eNB_list[i];
fp = &eNB->frame_parms;
bw = ru->beam_weights[i];
for (l=0;l<fp->symbols_per_tti;l++) {
for (aa=0;aa<ru->nb_tx;aa++) {
beam_precoding(eNB->common_vars.txdataF,
ru->common.txdataF_BF,
fp,
bw,
subframe<<1,
l,
aa);
}
}
LOG_D(PHY,"feptx_prec: frame %d, subframe %d: txp (freq) %d dB\n",
ru->proc.frame_tx,subframe,
dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[0],2*fp->symbols_per_tti*fp->ofdm_symbol_size)));
}
LOG_D(PHY,"feptx_prec: frame %d, subframe %d: txp (freq) %d dB\n",
ru->proc.frame_tx,subframe,
dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[0],2*fp->symbols_per_tti*fp->ofdm_symbol_size)));
}
}
......
......@@ -239,8 +239,10 @@
#define CONFIG_STRING_RU_LOCAL_IF_NAME "local_if_name"
#define CONFIG_STRING_RU_LOCAL_ADDRESS "local_address"
#define CONFIG_STRING_RU_REMOTE_ADDRESS "remote_address"
#define CONFIG_STRING_RU_LOCAL_PORT "local_port"
#define CONFIG_STRING_RU_REMOTE_PORT "remote_port"
#define CONFIG_STRING_RU_LOCAL_PORTC "local_portc"
#define CONFIG_STRING_RU_REMOTE_PORTC "remote_portc"
#define CONFIG_STRING_RU_LOCAL_PORTD "local_portd"
#define CONFIG_STRING_RU_REMOTE_PORTD "remote_portd"
#define CONFIG_STRING_RU_LOCAL_RF "local_rf"
#define CONFIG_STRING_RU_TRANSPORT_PREFERENCE "tr_preference"
#define CONFIG_STRING_RU_BAND_LIST "bands"
......@@ -397,8 +399,10 @@ void RCconfig_RU() {
char *local_rf = NULL;
char* tr_preference = NULL;
libconfig_int local_port = 0;
libconfig_int remote_port = 0;
libconfig_int local_portc = 0;
libconfig_int remote_portc = 0;
libconfig_int local_portd = 0;
libconfig_int remote_portd = 0;
libconfig_int nb_tx = 0;
libconfig_int nb_rx = 0;
......@@ -436,8 +440,10 @@ void RCconfig_RU() {
config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_LOCAL_IF_NAME, (const char **)&if_name)
&& config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_LOCAL_ADDRESS, (const char **)&ipv4)
&& config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_REMOTE_ADDRESS, (const char **)&ipv4_remote)
&& config_setting_lookup_int (setting_ru, CONFIG_STRING_RU_LOCAL_PORT, &local_port)
&& config_setting_lookup_int (setting_ru, CONFIG_STRING_RU_REMOTE_PORT, &remote_port)
&& config_setting_lookup_int (setting_ru, CONFIG_STRING_RU_LOCAL_PORTC, &local_portc)
&& config_setting_lookup_int (setting_ru, CONFIG_STRING_RU_REMOTE_PORTC, &remote_portc)
&& config_setting_lookup_int (setting_ru, CONFIG_STRING_RU_LOCAL_PORTD, &local_portd)
&& config_setting_lookup_int (setting_ru, CONFIG_STRING_RU_REMOTE_PORTD, &remote_portd)
&& config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_TRANSPORT_PREFERENCE, (const char **)&tr_preference)
&& config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_LOCAL_RF, (const char **)&local_rf)
)
......@@ -508,8 +514,10 @@ void RCconfig_RU() {
RC.ru[j]->eth_params.local_if_name = strdup(if_name);
RC.ru[j]->eth_params.my_addr = strdup(ipv4);
RC.ru[j]->eth_params.remote_addr = strdup(ipv4_remote);
RC.ru[j]->eth_params.my_port = local_port;
RC.ru[j]->eth_params.remote_port = remote_port;
RC.ru[j]->eth_params.my_portc = local_portc;
RC.ru[j]->eth_params.remote_portc = remote_portc;
RC.ru[j]->eth_params.my_portd = local_portd;
RC.ru[j]->eth_params.remote_portd = remote_portd;
RC.ru[j]->if_timing = synch_to_ext_device;
RC.ru[j]->num_eNB = num_eNB4RU;
if (strcmp(local_rf, "yes") == 0) {
......
......@@ -135,14 +135,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
if (mib!=NULL) {
if (RC.mac == NULL)
l2_init_eNB(
#ifdef Rel10
MBMS_Flag,
#else
0,
#endif
NULL,0,0);
if (RC.mac == NULL) l2_init_eNB();
mac_top_init_eNB();
......
This diff is collapsed.
This diff is collapsed.
......@@ -69,32 +69,34 @@ schedule_SI(
//------------------------------------------------------------------------------
{
int8_t bcch_sdu_length;
int mcs = -1;
void *BCCH_alloc_pdu;
int CC_id;
eNB_MAC_INST *eNB = RC.mac[module_idP];
uint8_t *vrb_map;
int first_rb = -1;
int rballoc[MAX_NUM_CCs];
int sizeof1A_bytes,sizeof1A_bits = -1;
DCI_PDU *DCI_pdu;
int8_t bcch_sdu_length;
int mcs = -1;
void *BCCH_alloc_pdu;