Commit 63a18b81 authored by Raymond Knopp's avatar Raymond Knopp

first time UE connection established

parent ca2c8357
...@@ -49,7 +49,7 @@ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms); ...@@ -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. \details Only a subset of phy_vars_ue is initialized.
@param[out] phy_vars_ue Pointer to UE Variables @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 @param nb_connected_eNB Number of eNB that UE can process in one PDSCH demodulation subframe
...@@ -58,10 +58,17 @@ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms); ...@@ -58,10 +58,17 @@ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
@returns -1 if any memory allocation failed @returns -1 if any memory allocation failed
@note The current implementation will never return -1, but segfault. @note The current implementation will never return -1, but segfault.
*/ */
int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue, int phy_init_lte_ue_signal(PHY_VARS_UE *phy_vars_ue,
int nb_connected_eNB, int nb_connected_eNB,
uint8_t abstraction_flag); 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). \brief Allocate and initialize the PHY variables relevant to the LTE implementation (eNB).
\details Only a subset of phy_vars_eNb is initialized. \details Only a subset of phy_vars_eNb is initialized.
...@@ -304,7 +311,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_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); 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); //void copy_lte_parms_to_phy_framing(LTE_DL_FRAME_PARMS *frame_parm, PHY_FRAMING *phy_framing);
......
...@@ -73,6 +73,8 @@ void phy_config_mib_eNB(int Mod_id, ...@@ -73,6 +73,8 @@ void phy_config_mib_eNB(int Mod_id,
RC.eNB[Mod_id][CC_id]->CC_id = CC_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 = &RC.eNB[Mod_id][CC_id]->frame_parms;
fp->N_RB_DL = N_RB_DL_array[dl_Bandwidth]; fp->N_RB_DL = N_RB_DL_array[dl_Bandwidth];
...@@ -92,7 +94,7 @@ void phy_config_mib_eNB(int Mod_id, ...@@ -92,7 +94,7 @@ void phy_config_mib_eNB(int Mod_id,
fp->frame_type = FDD; fp->frame_type = FDD;
init_frame_parms(fp,1); 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 ...@@ -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(); crcTableInit();
...@@ -1047,6 +1049,7 @@ void phy_init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) ...@@ -1047,6 +1049,7 @@ void phy_init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
init_scrambling_lut(); init_scrambling_lut();
//set_taus_seed(1328); //set_taus_seed(1328);
} }
/*! \brief Helper function to allocate memory for DLSCH data structures. /*! \brief Helper function to allocate memory for DLSCH data structures.
...@@ -1100,7 +1103,7 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS ...@@ -1100,7 +1103,7 @@ 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 init_lte_ue_signal(PHY_VARS_UE *ue,
int nb_connected_eNB, int nb_connected_eNB,
uint8_t abstraction_flag) uint8_t abstraction_flag)
{ {
...@@ -1123,6 +1126,13 @@ int phy_init_lte_ue(PHY_VARS_UE *ue, ...@@ -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,"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); 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 // 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( 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" ); 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, ...@@ -1324,6 +1334,30 @@ int phy_init_lte_ue(PHY_VARS_UE *ue,
return 0; 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) { int phy_init_RU(RU_t *ru) {
......
...@@ -96,7 +96,7 @@ void lte_param_init(unsigned char N_tx_port_eNB, ...@@ -96,7 +96,7 @@ void lte_param_init(unsigned char N_tx_port_eNB,
eNB->transmission_mode[0] = transmission_mode; eNB->transmission_mode[0] = transmission_mode;
UE->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); dump_frame_parms(frame_parms);
UE->measurements.n_adj_cells=0; UE->measurements.n_adj_cells=0;
...@@ -106,7 +106,7 @@ void lte_param_init(unsigned char N_tx_port_eNB, ...@@ -106,7 +106,7 @@ void lte_param_init(unsigned char N_tx_port_eNB,
for (i=0; i<3; i++) for (i=0; i<3; i++)
lte_gold(frame_parms,UE->lte_gold_table[i],Nid_cell+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); phy_init_lte_eNB(eNB,0,0);
generate_pcfich_reg_mapping(&UE->frame_parms); generate_pcfich_reg_mapping(&UE->frame_parms);
......
...@@ -80,17 +80,15 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) ...@@ -80,17 +80,15 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break; break;
default: default:
printf("Illegal oversampling %d\n",osf); AssertFatal(1==0,"Illegal oversampling %d\n",osf);
return(-1);
} }
switch (frame_parms->N_RB_DL) { switch (frame_parms->N_RB_DL) {
case 100: case 100:
if (osf>1) { AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
if (frame_parms->threequarter_fs) { if (frame_parms->threequarter_fs) {
frame_parms->ofdm_symbol_size = 1536; frame_parms->ofdm_symbol_size = 1536;
...@@ -109,11 +107,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) ...@@ -109,11 +107,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break; break;
case 75: case 75:
if (osf>1) { AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
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->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040; frame_parms->samples_per_tti = 23040;
...@@ -125,10 +119,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) ...@@ -125,10 +119,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break; break;
case 50: case 50:
if (osf>1) { AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
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->ofdm_symbol_size = 1024*osf;
frame_parms->samples_per_tti = 15360*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) ...@@ -140,10 +131,8 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break; break;
case 25: case 25:
if (osf>2) { AssertFatal(osf<=2,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
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->ofdm_symbol_size = 512*osf;
...@@ -179,12 +168,12 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) ...@@ -179,12 +168,12 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break; break;
default: 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); AssertFatal(1==0,"Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms);
return(-1);
break; 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); 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) ...@@ -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) void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
{ {
printf("frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL); LOG_I(PHY,"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); LOG_I(PHY,"frame_parms->N_RB_UL=%d\n",frame_parms->N_RB_UL);
printf("frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell); LOG_I(PHY,"frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell);
printf("frame_parms->Ncp=%d\n",frame_parms->Ncp); LOG_I(PHY,"frame_parms->Ncp=%d\n",frame_parms->Ncp);
printf("frame_parms->Ncp_UL=%d\n",frame_parms->Ncp_UL); LOG_I(PHY,"frame_parms->Ncp_UL=%d\n",frame_parms->Ncp_UL);
printf("frame_parms->nushift=%d\n",frame_parms->nushift); LOG_I(PHY,"frame_parms->nushift=%d\n",frame_parms->nushift);
printf("frame_parms->frame_type=%d\n",frame_parms->frame_type); LOG_I(PHY,"frame_parms->frame_type=%d\n",frame_parms->frame_type);
printf("frame_parms->tdd_config=%d\n",frame_parms->tdd_config); LOG_I(PHY,"frame_parms->tdd_config=%d\n",frame_parms->tdd_config);
printf("frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S); LOG_I(PHY,"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); LOG_I(PHY,"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); LOG_I(PHY,"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); LOG_I(PHY,"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); LOG_I(PHY,"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); LOG_I(PHY,"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); LOG_I(PHY,"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); LOG_I(PHY,"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); LOG_I(PHY,"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->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 ...@@ -378,18 +378,6 @@ int lte_sync_time(int **rxdata, ///rx data in time domain
for (n=0; n<length; n+=4) { 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] = 0;
sync_corr_ue0[n+length] = 0; sync_corr_ue0[n+length] = 0;
sync_corr_ue1[n] = 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_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_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}; 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) ...@@ -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_fulllength = 12*fp->N_RB_DL;
db_halflength = (db_fulllength)>>1; 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; 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 ...@@ -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); 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; blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
for (element_id=0; element_id<db_halflength; element_id++) { for (element_id=0; element_id<db_halflength; element_id++) {
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "common_lib.h" #include "common_lib.h"
extern openair0_config_t openair0_cfg[]; extern openair0_config_t openair0_cfg[];
//#define DEBUG_INITIAL_SYNCH #define DEBUG_INITIAL_SYNCH
int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
{ {
...@@ -282,6 +282,8 @@ int initial_sync(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 // First try FDD normal prefix
frame_parms->Ncp=NORMAL; frame_parms->Ncp=NORMAL;
frame_parms->frame_type=FDD; frame_parms->frame_type=FDD;
frame_parms->nb_antenna_ports_eNB = 2;
init_frame_parms(frame_parms,1); init_frame_parms(frame_parms,1);
/* /*
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,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, ...@@ -793,7 +793,6 @@ void pbch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
// take the quarter of the PBCH that corresponds to this frame // take the quarter of the PBCH that corresponds to this frame
if ((i>=(frame_mod4*(length>>2))) && (i<((1+frame_mod4)*(length>>2)))) { if ((i>=(frame_mod4*(length>>2))) && (i<((1+frame_mod4)*(length>>2)))) {
// if (((s>>(i%32))&1)==1)
if (((s>>(i%32))&1)==0) if (((s>>(i%32))&1)==0)
llr[i] = -llr[i]; llr[i] = -llr[i];
...@@ -936,8 +935,6 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars, ...@@ -936,8 +935,6 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
if (mimo_mode == ALAMOUTI) { if (mimo_mode == ALAMOUTI) {
pbch_alamouti(frame_parms,lte_ue_pbch_vars->rxdataF_comp,symbol); 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) { } else if (mimo_mode != SISO) {
LOG_D(PHY,"[PBCH][RX] Unsupported MIMO mode\n"); LOG_D(PHY,"[PBCH][RX] Unsupported MIMO mode\n");
return(-1); return(-1);
...@@ -1008,12 +1005,12 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars, ...@@ -1008,12 +1005,12 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
#ifdef DEBUG_PBCH #ifdef DEBUG_PBCH
for (i=0; i<(PBCH_A>>3); i++) 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 #endif //DEBUG_PBCH
#ifdef 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), crc16(pbch_a,PBCH_A),
((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]); ((uint16_t)pbch_a[PBCH_A>>3]<<8)+pbch_a[(PBCH_A>>3)+1]);
#endif #endif
......
...@@ -1256,6 +1256,79 @@ extern pthread_cond_t sync_cond; ...@@ -1256,6 +1256,79 @@ extern pthread_cond_t sync_cond;
extern pthread_mutex_t sync_mutex; extern pthread_mutex_t sync_mutex;
extern int sync_var; 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) { 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) { ...@@ -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){ 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) { ...@@ -184,7 +184,7 @@ void feptx_ofdm(RU_t *ru) {
ru->common.txdata[aa][tx_offset] = 0x00000000; 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)), 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))); dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[aa],2*slot_sizeF)));
} }
...@@ -200,6 +200,16 @@ void feptx_prec(RU_t *ru) { ...@@ -200,6 +200,16 @@ void feptx_prec(RU_t *ru) {
int32_t ***bw; int32_t ***bw;
int subframe = ru->proc.subframe_tx; int subframe = ru->proc.subframe_tx;
if (ru->num_eNB == 1) {
eNB = eNB_list[0];
fp = &eNB->frame_parms;
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++) { for (i=0;i<ru->num_eNB;i++) {
eNB = eNB_list[i]; eNB = eNB_list[i];
fp = &eNB->frame_parms; fp = &eNB->frame_parms;
...@@ -220,6 +230,7 @@ void feptx_prec(RU_t *ru) { ...@@ -220,6 +230,7 @@ void feptx_prec(RU_t *ru) {
ru->proc.frame_tx,subframe, ru->proc.frame_tx,subframe,
dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[0],2*fp->symbols_per_tti*fp->ofdm_symbol_size))); dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[0],2*fp->symbols_per_tti*fp->ofdm_symbol_size)));
} }
}
} }
typedef struct { typedef struct {
......
...@@ -239,8 +239,10 @@ ...@@ -239,8 +239,10 @@
#define CONFIG_STRING_RU_LOCAL_IF_NAME "local_if_name" #define CONFIG_STRING_RU_LOCAL_IF_NAME "local_if_name"
#define CONFIG_STRING_RU_LOCAL_ADDRESS "local_address" #define CONFIG_STRING_RU_LOCAL_ADDRESS "local_address"
#define CONFIG_STRING_RU_REMOTE_ADDRESS "remote_address" #define CONFIG_STRING_RU_REMOTE_ADDRESS "remote_address"
#define CONFIG_STRING_RU_LOCAL_PORT "local_port" #define CONFIG_STRING_RU_LOCAL_PORTC "local_portc"
#define CONFIG_STRING_RU_REMOTE_PORT "remote_port" #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_LOCAL_RF "local_rf"
#define CONFIG_STRING_RU_TRANSPORT_PREFERENCE "tr_preference" #define CONFIG_STRING_RU_TRANSPORT_PREFERENCE "tr_preference"
#define CONFIG_STRING_RU_BAND_LIST "bands" #define CONFIG_STRING_RU_BAND_LIST "bands"
...@@ -397,8 +399,10 @@ void RCconfig_RU() { ...@@ -397,8 +399,10 @@ void RCconfig_RU() {
char *local_rf = NULL; char *local_rf = NULL;
char* tr_preference = NULL; char* tr_preference = NULL;
libconfig_int local_port = 0; libconfig_int local_portc = 0;
libconfig_int remote_port = 0; libconfig_int remote_portc = 0;
libconfig_int local_portd = 0;
libconfig_int remote_portd = 0;
libconfig_int nb_tx = 0; libconfig_int nb_tx = 0;
libconfig_int nb_rx = 0; libconfig_int nb_rx = 0;
...@@ -436,8 +440,10 @@ void RCconfig_RU() { ...@@ -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_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_LOCAL_ADDRESS, (const char **)&ipv4)
&& config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_REMOTE_ADDRESS, (const char **)&ipv4_remote) && 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_LOCAL_PORTC, &local_portc)
&& config_setting_lookup_int (setting_ru, CONFIG_STRING_RU_REMOTE_PORT, &remote_port) && 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_TRANSPORT_PREFERENCE, (const char **)&tr_preference)
&& config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_LOCAL_RF, (const char **)&local_rf) && config_setting_lookup_string(setting_ru, CONFIG_STRING_RU_LOCAL_RF, (const char **)&local_rf)
) )
...@@ -508,8 +514,10 @@ void RCconfig_RU() { ...@@ -508,8 +514,10 @@ void RCconfig_RU() {
RC.ru[j]->eth_params.local_if_name = strdup(if_name); 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.my_addr = strdup(ipv4);
RC.ru[j]->eth_params.remote_addr = strdup(ipv4_remote); RC.ru[j]->eth_params.remote_addr = strdup(ipv4_remote);
RC.ru[j]->eth_params.my_port = local_port; RC.ru[j]->eth_params.my_portc = local_portc;
RC.ru[j]->eth_params.remote_port = remote_port; 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]->if_timing = synch_to_ext_device;
RC.ru[j]->num_eNB = num_eNB4RU; RC.ru[j]->num_eNB = num_eNB4RU;
if (strcmp(local_rf, "yes") == 0) { if (strcmp(local_rf, "yes") == 0) {
......
...@@ -135,14 +135,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP, ...@@ -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); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
if (mib!=NULL) { if (mib!=NULL) {
if (RC.mac == NULL) if (RC.mac == NULL) l2_init_eNB();
l2_init_eNB(
#ifdef Rel10
MBMS_Flag,
#else
0,
#endif
NULL,0,0);
mac_top_init_eNB(); mac_top_init_eNB();
......
This diff is collapsed.
This diff is collapsed.
...@@ -69,8 +69,6 @@ schedule_SI( ...@@ -69,8 +69,6 @@ schedule_SI(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
int8_t bcch_sdu_length; int8_t bcch_sdu_length;
int mcs = -1; int mcs = -1;
void *BCCH_alloc_pdu; void *BCCH_alloc_pdu;
...@@ -79,22 +77,26 @@ schedule_SI( ...@@ -79,22 +77,26 @@ schedule_SI(
uint8_t *vrb_map; uint8_t *vrb_map;
int first_rb = -1; int first_rb = -1;
int rballoc[MAX_NUM_CCs]; int rballoc[MAX_NUM_CCs];
int sizeof1A_bytes,sizeof1A_bits = -1; int sizeof1A_bytes;
int sizeof1A_bits = -1;
DCI_PDU *DCI_pdu; DCI_PDU *DCI_pdu;
COMMON_channels_t *cc;
int N_RB_DL;
start_meas(&eNB->schedule_si); start_meas(&eNB->schedule_si);
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
BCCH_alloc_pdu = (void*)&eNB->common_channels[CC_id].BCCH_alloc_pdu; cc = &eNB->common_channels[CC_id];
DCI_pdu = (void*)&eNB->common_channels[CC_id].DCI_pdu; BCCH_alloc_pdu = (void*)&cc->BCCH_alloc_pdu;
vrb_map = (void*)&eNB->common_channels[CC_id].vrb_map; DCI_pdu = (void*)&cc->DCI_pdu;
vrb_map = (void*)&cc->vrb_map;
N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
bcch_sdu_length = mac_rrc_data_req(module_idP, bcch_sdu_length = mac_rrc_data_req(module_idP,
CC_id, CC_id,
frameP, frameP,
BCCH,1, BCCH,1,
&eNB->common_channels[CC_id].BCCH_pdu.payload[0], &cc->BCCH_pdu.payload[0],
1, 1,
module_idP, module_idP,
0); // not used in this case 0); // not used in this case
...@@ -113,7 +115,7 @@ schedule_SI( ...@@ -113,7 +115,7 @@ schedule_SI(
break; break;
} }
*/ */
switch (RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL) { switch (N_RB_DL) {
case 6: case 6:
first_rb = 0; first_rb = 0;
break; break;
...@@ -159,11 +161,11 @@ schedule_SI( ...@@ -159,11 +161,11 @@ schedule_SI(
if (RC.eNB[module_idP][CC_id]->frame_parms.frame_type == TDD) { if (cc->tdd_Config!=NULL) { // TDD
switch (RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL) { switch (N_RB_DL) {
case 6: case 6:
((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->mcs = mcs; ((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->mcs = mcs;
((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL,first_rb,4); ((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(N_RB_DL,first_rb,4);
((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->type = 1; ((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->type = 1;
((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->vrb_type = 0; ((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->vrb_type = 0;
((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->ndi = 1; ((DCI1A_1_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->ndi = 1;
...@@ -178,7 +180,7 @@ schedule_SI( ...@@ -178,7 +180,7 @@ schedule_SI(
case 25: case 25:
((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->mcs = mcs; ((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->mcs = mcs;
((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL,first_rb,4); ((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(N_RB_DL,first_rb,4);
((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->type = 1; ((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->type = 1;
((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->vrb_type = 0; ((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->vrb_type = 0;
((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->ndi = 1; ((DCI1A_5MHz_TDD_1_6_t*)BCCH_alloc_pdu)->ndi = 1;
...@@ -193,7 +195,7 @@ schedule_SI( ...@@ -193,7 +195,7 @@ schedule_SI(
case 50: case 50:
((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->mcs = mcs; ((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->mcs = mcs;
((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL,first_rb,4); ((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(N_RB_DL,first_rb,4);
((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->type = 1; ((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->type = 1;
((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->vrb_type = 0; ((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->vrb_type = 0;
((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->ndi = 1; ((DCI1A_10MHz_TDD_1_6_t*)BCCH_alloc_pdu)->ndi = 1;
...@@ -208,7 +210,7 @@ schedule_SI( ...@@ -208,7 +210,7 @@ schedule_SI(
case 100: case 100:
((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->mcs = mcs; ((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->mcs = mcs;
((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL,first_rb,4); ((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(N_RB_DL,first_rb,4);
((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->type = 1; ((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->type = 1;
((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->vrb_type = 0; ((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->vrb_type = 0;
((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->ndi = 1; ((DCI1A_20MHz_TDD_1_6_t*)BCCH_alloc_pdu)->ndi = 1;
...@@ -223,10 +225,10 @@ schedule_SI( ...@@ -223,10 +225,10 @@ schedule_SI(
} }
} else { } else {
switch (RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL) { switch (N_RB_DL) {
case 6: case 6:
((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->mcs = mcs; ((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->mcs = mcs;
((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL,first_rb,4); ((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(N_RB_DL,first_rb,4);
((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->type = 1; ((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->type = 1;
((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->vrb_type = 0; ((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->vrb_type = 0;
((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->ndi = 1; ((DCI1A_1_5MHz_FDD_t*)BCCH_alloc_pdu)->ndi = 1;
...@@ -242,7 +244,7 @@ schedule_SI( ...@@ -242,7 +244,7 @@ schedule_SI(
case 25: case 25:
((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->mcs = mcs; ((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->mcs = mcs;
((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL,first_rb,4); ((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(N_RB_DL,first_rb,4);
((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->type = 1; ((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->type = 1;
((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->vrb_type = 0; ((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->vrb_type = 0;
((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->ndi = 1; ((DCI1A_5MHz_FDD_t*)BCCH_alloc_pdu)->ndi = 1;
...@@ -258,7 +260,7 @@ schedule_SI( ...@@ -258,7 +260,7 @@ schedule_SI(
case 50: case 50:
((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->mcs = mcs; ((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->mcs = mcs;
((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL,first_rb,4); ((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(N_RB_DL,first_rb,4);
((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->type = 1; ((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->type = 1;
((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->vrb_type = 0; ((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->vrb_type = 0;
((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->ndi = 1; ((DCI1A_10MHz_FDD_t*)BCCH_alloc_pdu)->ndi = 1;
...@@ -274,7 +276,7 @@ schedule_SI( ...@@ -274,7 +276,7 @@ schedule_SI(
case 100: case 100:
((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->mcs = mcs; ((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->mcs = mcs;
((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(RC.eNB[module_idP][CC_id]->frame_parms.N_RB_DL,first_rb,4); ((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->rballoc = mac_xface->computeRIV(N_RB_DL,first_rb,4);
((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->type = 1; ((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->type = 1;
((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->vrb_type = 0; ((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->vrb_type = 0;
((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->ndi = 1; ((DCI1A_20MHz_FDD_t*)BCCH_alloc_pdu)->ndi = 1;
...@@ -306,7 +308,7 @@ schedule_SI( ...@@ -306,7 +308,7 @@ schedule_SI(
if (opt_enabled == 1) { if (opt_enabled == 1) {
trace_pdu(1, trace_pdu(1,
&eNB->common_channels[CC_id].BCCH_pdu.payload[0], &cc->BCCH_pdu.payload[0],
bcch_sdu_length, bcch_sdu_length,
0xffff, 0xffff,
4, 4,
...@@ -318,7 +320,7 @@ schedule_SI( ...@@ -318,7 +320,7 @@ schedule_SI(
LOG_D(OPT,"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n", LOG_D(OPT,"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
module_idP, frameP, CC_id, 0xffff, bcch_sdu_length); module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
} }
if (RC.eNB[module_idP][CC_id]->frame_parms.frame_type == TDD) { if (cc->tdd_Config!=NULL) { //TDD
LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3, TBS %d)\n", LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH->DLSCH (TDD) for CC_id %d SI %d bytes (mcs %d, rb 3, TBS %d)\n",
frameP, frameP,
CC_id, CC_id,
......
This diff is collapsed.
This diff is collapsed.
...@@ -59,7 +59,19 @@ ...@@ -59,7 +59,19 @@
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1 #define DEBUG_eNB_SCHEDULER 1
int to_prb(int dl_Bandwidth) {
int prbmap[6] = {6,15,25,50,75,100};
AssertFatal(dl_Bandwidth < 6,"dl_Bandwidth is 0..5\n");
return(prbmap[dl_Bandwidth]);
}
int to_rbg(int dl_Bandwidth) {
int rbgmap[6] = {6,8,13,17,19,25};
AssertFatal(dl_Bandwidth < 6,"dl_Bandwidth is 0..5\n");
return(rbgmap[dl_Bandwidth]);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void init_ue_sched_info(void) void init_ue_sched_info(void)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -715,14 +727,14 @@ uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id) ...@@ -715,14 +727,14 @@ uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id)
uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, uint32_t *rballoc) uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, int N_RB_DL, uint32_t *rballoc)
{ {
int i; int i;
uint32_t rballoc_dci=0; uint32_t rballoc_dci=0;
unsigned char nb_rb_alloc=0; unsigned char nb_rb_alloc=0;
for (i=0; i<(mac_xface->frame_parms->N_RB_DL-2); i+=2) { for (i=0; i<(N_RB_DL-2); i+=2) {
if (((*rballoc>>i)&3)==0) { if (((*rballoc>>i)&3)==0) {
*rballoc |= (3<<i); *rballoc |= (3<<i);
rballoc_dci |= (1<<((12-i)>>1)); rballoc_dci |= (1<<((12-i)>>1));
...@@ -734,10 +746,10 @@ uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, uint32_t *rballoc) ...@@ -734,10 +746,10 @@ uint32_t allocate_prbs(int UE_id,unsigned char nb_rb, uint32_t *rballoc)
} }
} }
if ((mac_xface->frame_parms->N_RB_DL&1)==1) { if ((N_RB_DL&1)==1) {
if ((*rballoc>>(mac_xface->frame_parms->N_RB_DL-1)&1)==0) { if ((*rballoc>>(N_RB_DL-1)&1)==0) {
*rballoc |= (1<<(mac_xface->frame_parms->N_RB_DL-1)); *rballoc |= (1<<(N_RB_DL-1));
rballoc_dci |= 1;//(1<<(mac_xface->frame_parms->N_RB_DL>>1)); rballoc_dci |= 1;
} }
} }
...@@ -748,9 +760,10 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id) ...@@ -748,9 +760,10 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id)
{ {
int bw_index=0; int bw_index=0;
LTE_DL_FRAME_PARMS* frame_parms = mac_xface->get_lte_frame_parms(module_id,CC_id);
switch (frame_parms->N_RB_DL) { int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
switch (N_RB_DL) {
case 6: // 1.4 MHz case 6: // 1.4 MHz
bw_index=0; bw_index=0;
break; break;
...@@ -769,7 +782,7 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id) ...@@ -769,7 +782,7 @@ int get_bw_index(module_id_t module_id, uint8_t CC_id)
default: default:
bw_index=1; bw_index=1;
LOG_W(MAC,"[eNB %d] N_DL_RB %d unknown for CC_id %d, setting bw_index to 1\n", module_id, CC_id); LOG_W(MAC,"[eNB %d] N_RB_DL %d unknown for CC_id %d, setting bw_index to 1\n", module_id, N_RB_DL,CC_id);
break; break;
} }
...@@ -780,9 +793,9 @@ int get_min_rb_unit(module_id_t module_id, uint8_t CC_id) ...@@ -780,9 +793,9 @@ int get_min_rb_unit(module_id_t module_id, uint8_t CC_id)
{ {
int min_rb_unit=0; int min_rb_unit=0;
LTE_DL_FRAME_PARMS* frame_parms = mac_xface->get_lte_frame_parms(module_id,CC_id); int N_RB_DL = to_prb(RC.mac[module_id]->common_channels[CC_id].mib->message.dl_Bandwidth);
switch (frame_parms->N_RB_DL) { switch (N_RB_DL) {
case 6: // 1.4 MHz case 6: // 1.4 MHz
min_rb_unit=1; min_rb_unit=1;
break; break;
...@@ -802,14 +815,14 @@ int get_min_rb_unit(module_id_t module_id, uint8_t CC_id) ...@@ -802,14 +815,14 @@ int get_min_rb_unit(module_id_t module_id, uint8_t CC_id)
default: default:
min_rb_unit=2; min_rb_unit=2;
LOG_W(MAC,"[eNB %d] N_DL_RB %d unknown for CC_id %d, setting min_rb_unit to 2\n", LOG_W(MAC,"[eNB %d] N_DL_RB %d unknown for CC_id %d, setting min_rb_unit to 2\n",
module_id, frame_parms->N_RB_DL, CC_id); module_id, N_RB_DL, CC_id);
break; break;
} }
return min_rb_unit; return min_rb_unit;
} }
uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc) uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t *rballoc)
{ {
int check=0;//check1=0,check2=0; int check=0;//check1=0,check2=0;
...@@ -817,20 +830,20 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc) ...@@ -817,20 +830,20 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc)
//uint8_t number_of_subbands=13; //uint8_t number_of_subbands=13;
LOG_T(MAC,"*****Check1RBALLOC****: %d%d%d%d (nb_rb %d,N_RBG %d)\n", LOG_T(MAC,"*****Check1RBALLOC****: %d%d%d%d (nb_rb %d,N_RBG %d)\n",
rballoc[3],rballoc[2],rballoc[1],rballoc[0],nb_rb,mac_xface->frame_parms->N_RBG); rballoc[3],rballoc[2],rballoc[1],rballoc[0],nb_rb,N_RBG);
while((nb_rb >0) && (check < mac_xface->frame_parms->N_RBG)) { while((nb_rb >0) && (check < N_RBG)) {
//printf("rballoc[%d] %d\n",check,rballoc[check]); //printf("rballoc[%d] %d\n",check,rballoc[check]);
if(rballoc[check] == 1) { if(rballoc[check] == 1) {
rballoc_dci |= (1<<((mac_xface->frame_parms->N_RBG-1)-check)); rballoc_dci |= (1<<((N_RBG-1)-check));
switch (mac_xface->frame_parms->N_RB_DL) { switch (N_RB_DL) {
case 6: case 6:
nb_rb--; nb_rb--;
break; break;
case 25: case 25:
if ((check == mac_xface->frame_parms->N_RBG-1)) { if ((check == N_RBG-1)) {
nb_rb--; nb_rb--;
} else { } else {
nb_rb-=2; nb_rb-=2;
...@@ -839,7 +852,7 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc) ...@@ -839,7 +852,7 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc)
break; break;
case 50: case 50:
if ((check == mac_xface->frame_parms->N_RBG-1)) { if ((check == N_RBG-1)) {
nb_rb-=2; nb_rb-=2;
} else { } else {
nb_rb-=3; nb_rb-=3;
...@@ -865,12 +878,12 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc) ...@@ -865,12 +878,12 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc)
} }
int get_nb_subband(void) int get_nb_subband(int N_RB_DL)
{ {
int nb_sb=0; int nb_sb=0;
switch (mac_xface->frame_parms->N_RB_DL) { switch (N_RB_DL) {
case 6: case 6:
nb_sb=0; nb_sb=0;
break; break;
......
...@@ -709,29 +709,29 @@ void schedule_ulsch_rnti(module_id_t module_idP, ...@@ -709,29 +709,29 @@ void schedule_ulsch_rnti(module_id_t module_idP,
uint8_t status = 0; uint8_t status = 0;
uint8_t rb_table_index = -1; uint8_t rb_table_index = -1;
uint16_t TBS = 0; uint16_t TBS = 0;
// int32_t buffer_occupancy=0;
uint32_t cqi_req,cshift,ndi,mcs=0,rballoc,tpc; uint32_t cqi_req,cshift,ndi,mcs=0,rballoc,tpc;
int32_t normalized_rx_power, target_rx_power=-90; int32_t normalized_rx_power;
int32_t target_rx_power=-90;
static int32_t tpc_accumulated=0; static int32_t tpc_accumulated=0;
int n;
int n,CC_id = 0; int CC_id = 0;
eNB_MAC_INST *eNB=RC.mac[module_idP]; int drop_ue=0;
int N_RB_UL;
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = eNB->common_channels;
UE_list_t *UE_list=&eNB->UE_list; UE_list_t *UE_list=&eNB->UE_list;
UE_TEMPLATE *UE_template; UE_TEMPLATE *UE_template;
UE_sched_ctrl *UE_sched_ctrl; UE_sched_ctrl *UE_sched_ctrl;
// int rvidx_tab[4] = {0,2,3,1};
LTE_DL_FRAME_PARMS *frame_parms;
int drop_ue=0;
// LOG_I(MAC,"entering ulsch preprocesor\n"); LOG_D(MAC,"entering ulsch preprocesor\n");
ulsch_scheduler_pre_processor(module_idP, ulsch_scheduler_pre_processor(module_idP,
frameP, frameP,
subframeP, subframeP,
first_rb); first_rb);
// LOG_I(MAC,"exiting ulsch preprocesor\n"); LOG_D(MAC,"exiting ulsch preprocesor\n");
// loop over all active UEs // loop over all active UEs
for (UE_id=UE_list->head_ul; UE_id>=0; UE_id=UE_list->next_ul[UE_id]) { for (UE_id=UE_list->head_ul; UE_id>=0; UE_id=UE_list->next_ul[UE_id]) {
...@@ -787,7 +787,7 @@ abort(); ...@@ -787,7 +787,7 @@ abort();
for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) { for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) {
// This is the actual CC_id in the list // This is the actual CC_id in the list
CC_id = UE_list->ordered_ULCCids[n][UE_id]; CC_id = UE_list->ordered_ULCCids[n][UE_id];
frame_parms = mac_xface->get_lte_frame_parms(module_idP,CC_id); N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth);
eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti); eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti);
aggregation=get_aggregation(get_bw_index(module_idP,CC_id), aggregation=get_aggregation(get_bw_index(module_idP,CC_id),
...@@ -891,7 +891,7 @@ abort(); ...@@ -891,7 +891,7 @@ abort();
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs; UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs;
// buffer_occupancy = UE_template->ul_total_buffer; // buffer_occupancy = UE_template->ul_total_buffer;
while (((rb_table[rb_table_index]>(frame_parms->N_RB_UL-1-first_rb[CC_id])) || while (((rb_table[rb_table_index]>(N_RB_UL-1-first_rb[CC_id])) ||
(rb_table[rb_table_index]>45)) && (rb_table[rb_table_index]>45)) &&
(rb_table_index>0)) { (rb_table_index>0)) {
rb_table_index--; rb_table_index--;
...@@ -901,7 +901,7 @@ abort(); ...@@ -901,7 +901,7 @@ abort();
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=rb_table[rb_table_index]; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=rb_table[rb_table_index];
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=TBS; UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=TBS;
// buffer_occupancy -= TBS; // buffer_occupancy -= TBS;
rballoc = mac_xface->computeRIV(frame_parms->N_RB_UL, rballoc = mac_xface->computeRIV(N_RB_UL,
first_rb[CC_id], first_rb[CC_id],
rb_table[rb_table_index]); rb_table[rb_table_index]);
...@@ -934,8 +934,8 @@ abort(); ...@@ -934,8 +934,8 @@ abort();
// Cyclic shift for DM RS // Cyclic shift for DM RS
cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1) cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
if (frame_parms->frame_type == TDD) { if (cc[CC_id].tdd_Config!= NULL) { // TDD
switch (frame_parms->N_RB_UL) { switch (N_RB_UL) {
case 6: case 6:
ULSCH_dci = UE_template->ULSCH_DCI[harq_pid]; ULSCH_dci = UE_template->ULSCH_DCI[harq_pid];
...@@ -1035,7 +1035,7 @@ abort(); ...@@ -1035,7 +1035,7 @@ abort();
} }
} // TDD } // TDD
else { //FDD else { //FDD
switch (frame_parms->N_RB_UL) { switch (N_RB_UL) {
case 25: case 25:
default: default:
...@@ -1141,9 +1141,6 @@ abort(); ...@@ -1141,9 +1141,6 @@ abort();
S_UL_SCHEDULED); S_UL_SCHEDULED);
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP,CC_id,frameP,subframeP,UE_id); LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP,CC_id,frameP,subframeP,UE_id);
#ifdef DEBUG
dump_dci(frame_parms, &DCI_pdu->dci_alloc[DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci-1]);
#endif
} }
else { else {
......
...@@ -103,7 +103,7 @@ int mac_top_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, ...@@ -103,7 +103,7 @@ int mac_top_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
int CC_id; int CC_id;
int list_el; int list_el;
UE_list_t *UE_list; UE_list_t *UE_list;
COMMON_channels_t *cc;
LOG_I(MAC,"[MAIN] Init function start:Nb_UE_INST=%d\n",NB_UE_INST); LOG_I(MAC,"[MAIN] Init function start:Nb_UE_INST=%d\n",NB_UE_INST);
if (NB_UE_INST>0) { if (NB_UE_INST>0) {
...@@ -174,11 +174,13 @@ int mac_top_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, ...@@ -174,11 +174,13 @@ int mac_top_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
LOG_D(MAC,"[MAIN][eNB %d] CC_id %d initializing RA_template\n",i, CC_id); LOG_D(MAC,"[MAIN][eNB %d] CC_id %d initializing RA_template\n",i, CC_id);
LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", i); LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", i);
RA_template = (RA_TEMPLATE *)&RC.mac[i]->common_channels[CC_id].RA_template[0]; cc = &RC.mac[i]->common_channels[CC_id];
RA_template = &cc->RA_template[0];
for (j=0; j<NB_RA_PROC_MAX; j++) { for (j=0; j<NB_RA_PROC_MAX; j++) {
if (mac_xface->frame_parms->frame_type == TDD) { if (cc->tdd_Config != NULL) { // TDD
switch (mac_xface->frame_parms->N_RB_DL) { switch (to_prb(cc->mib->message.dl_Bandwidth)) {
case 6: case 6:
size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t); size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t); size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
...@@ -216,7 +218,7 @@ int mac_top_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, ...@@ -216,7 +218,7 @@ int mac_top_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
} }
} else { } else {
switch (mac_xface->frame_parms->N_RB_DL) { switch (to_prb(cc->mib->message.dl_Bandwidth)) {
case 6: case 6:
size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t); size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t); size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
......
This diff is collapsed.
...@@ -346,9 +346,9 @@ boolean_t CCE_allocation_infeasible(int module_idP, ...@@ -346,9 +346,9 @@ boolean_t CCE_allocation_infeasible(int module_idP,
int rnti); int rnti);
void set_ue_dai(sub_frame_t subframeP, void set_ue_dai(sub_frame_t subframeP,
uint8_t tdd_config,
int UE_id, int UE_id,
uint8_t CC_id, uint8_t CC_id,
uint8_t tdd_config,
UE_list_t *UE_list); UE_list_t *UE_list);
uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_id); uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_id);
...@@ -370,10 +370,11 @@ int schedule_next_dlue(module_id_t module_idP, int CC_id, sub_frame_t subframe); ...@@ -370,10 +370,11 @@ int schedule_next_dlue(module_id_t module_idP, int CC_id, sub_frame_t subframe);
/* \brief Allocates a set of PRBS for a particular UE. This is a simple function for the moment, later it should process frequency-domain CQI information and/or PMI information. Currently it just returns the first PRBS that are available in the subframe based on the number requested. /* \brief Allocates a set of PRBS for a particular UE. This is a simple function for the moment, later it should process frequency-domain CQI information and/or PMI information. Currently it just returns the first PRBS that are available in the subframe based on the number requested.
@param UE_id Index of UE on which to act @param UE_id Index of UE on which to act
@param nb_rb Number of PRBs allocated to UE by scheduler @param nb_rb Number of PRBs allocated to UE by scheduler
@param N_RB_DL Number of PRBs on DL
@param rballoc Pointer to bit-map of current PRB allocation given to previous users/control channels. This is updated for subsequent calls to the routine. @param rballoc Pointer to bit-map of current PRB allocation given to previous users/control channels. This is updated for subsequent calls to the routine.
@returns an rballoc bitmap for resource type 0 allocation (DCI). @returns an rballoc bitmap for resource type 0 allocation (DCI).
*/ */
uint32_t allocate_prbs(int UE_id,uint8_t nb_rb, uint32_t *rballoc); uint32_t allocate_prbs(int UE_id,uint8_t nb_rb, int N_RB_DL, uint32_t *rballoc);
/* \fn uint32_t req_new_ulsch(module_id_t module_idP) /* \fn uint32_t req_new_ulsch(module_id_t module_idP)
\brief check for a new transmission in any drb \brief check for a new transmission in any drb
...@@ -515,7 +516,8 @@ uint8_t *parse_ulsch_header(uint8_t *mac_header, ...@@ -515,7 +516,8 @@ uint8_t *parse_ulsch_header(uint8_t *mac_header,
uint16_t *rx_lengths, uint16_t *rx_lengths,
uint16_t tx_lenght); uint16_t tx_lenght);
int to_prb(int);
int to_rbg(int);
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active); int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
int mac_init(void); int mac_init(void);
int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti,int harq_pid); int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti,int harq_pid);
...@@ -693,7 +695,7 @@ void add_common_dci(DCI_PDU *DCI_pdu, ...@@ -693,7 +695,7 @@ void add_common_dci(DCI_PDU *DCI_pdu,
unsigned char dci_fmt, unsigned char dci_fmt,
uint8_t ra_flag); uint8_t ra_flag);
uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc); uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, uint8_t *rballoc);
void update_ul_dci(module_id_t module_idP,uint8_t CC_id,rnti_t rnti,uint8_t dai); void update_ul_dci(module_id_t module_idP,uint8_t CC_id,rnti_t rnti,uint8_t dai);
......
This diff is collapsed.
...@@ -218,24 +218,20 @@ typedef struct { ...@@ -218,24 +218,20 @@ typedef struct {
typedef struct { typedef struct {
char *remote_addr; char *remote_addr;
//! remote port number for Ethernet interface //! remote port number for Ethernet interface (control)
uint16_t remote_port; uint16_t remote_portc;
//! remote port number for Ethernet interface (user)
uint16_t remote_portd;
//! local IP/MAC addr for Ethernet interface (eNB/RAU, UE) //! local IP/MAC addr for Ethernet interface (eNB/RAU, UE)
char *my_addr; char *my_addr;
//! local port number for Ethernet interface (eNB/RAU, UE) //! local port number (control) for Ethernet interface (eNB/RAU, UE)
uint16_t my_port; uint16_t my_portc;
//! local port number (user) for Ethernet interface (eNB/RAU, UE)
uint16_t my_portd;
//! local Ethernet interface (eNB/RAU, UE) //! local Ethernet interface (eNB/RAU, UE)
char *local_if_name; char *local_if_name;
//! tx_sample_advance for RF + ETH
uint8_t tx_sample_advance;
//! tx_scheduling_advance for RF + ETH
uint8_t tx_scheduling_advance;
//! iq_txshift for RF + ETH
uint8_t iq_txshift;
//! transport type preference (RAW/UDP) //! transport type preference (RAW/UDP)
uint8_t transp_preference; uint8_t transp_preference;
//! radio front end preference (EXMIMO,USRP, BALDERF,LMSSDR)
uint8_t rf_preference;
} eth_params_t; } eth_params_t;
...@@ -282,19 +278,19 @@ struct openair0_device_t { ...@@ -282,19 +278,19 @@ struct openair0_device_t {
*/ */
int (*trx_start_func)(openair0_device *device); int (*trx_start_func)(openair0_device *device);
/*! \brief Called to send a request message between RAU-RRU /*! \brief Called to send a request message between RAU-RRU on control port
@param device pointer to the device structure specific to the RF hardware target @param device pointer to the device structure specific to the RF hardware target
@param msg pointer to the message structure passed between RAU-RRU @param msg pointer to the message structure passed between RAU-RRU
@param msg_len length of the message @param msg_len length of the message
*/ */
int (*trx_request_func)(openair0_device *device, void *msg, ssize_t msg_len); int (*trx_ctlsend_func)(openair0_device *device, void *msg, ssize_t msg_len);
/*! \brief Called to send a reply message between RAU-RRU /*! \brief Called to receive a reply message between RAU-RRU on control port
@param device pointer to the device structure specific to the RF hardware target @param device pointer to the device structure specific to the RF hardware target
@param msg pointer to the message structure passed between RAU-RRU @param msg pointer to the message structure passed between RAU-RRU
@param msg_len length of the message @param msg_len length of the message
*/ */
int (*trx_reply_func)(openair0_device *device, void *msg, ssize_t msg_len); int (*trx_ctlrecv_func)(openair0_device *device, void *msg, ssize_t msg_len);
/*! \brief Called to send samples to the RF target /*! \brief Called to send samples to the RF target
@param device pointer to the device structure specific to the RF hardware target @param device pointer to the device structure specific to the RF hardware target
......
...@@ -58,11 +58,13 @@ int trx_eth_start(openair0_device *device) { ...@@ -58,11 +58,13 @@ int trx_eth_start(openair0_device *device) {
printf("Setting Timenout to 999999 usecs\n"); printf("Setting Timenout to 999999 usecs\n");
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1; if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
/*
if (device->host_type == RAU_HOST) { if (device->host_type == RAU_HOST) {
if(eth_set_dev_conf_raw(device)!=0) return -1; if(eth_set_dev_conf_raw(device)!=0) return -1;
} else { } else {
if(eth_get_dev_conf_raw(device)!=0) return -1; if(eth_get_dev_conf_raw(device)!=0) return -1;
} }*/
/* adjust MTU wrt number of samples per packet */ /* adjust MTU wrt number of samples per packet */
if(ethernet_tune (device,MTU_SIZE,RAW_PACKET_SIZE_BYTES(device->openair0_cfg->samples_per_packet))!=0) return -1; if(ethernet_tune (device,MTU_SIZE,RAW_PACKET_SIZE_BYTES(device->openair0_cfg->samples_per_packet))!=0) return -1;
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1; if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
...@@ -74,12 +76,14 @@ int trx_eth_start(openair0_device *device) { ...@@ -74,12 +76,14 @@ int trx_eth_start(openair0_device *device) {
printf("Setting Timenout to 999999 usecs\n"); printf("Setting Timenout to 999999 usecs\n");
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1; if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
/* RRU gets openair0 device configuration - RAU sets openair0 device configuration*/ /*
if (device->host_type == RAU_HOST) { if (device->host_type == RAU_HOST) {
if(eth_set_dev_conf_raw_IF4p5(device)!=0) return -1; if(eth_set_dev_conf_raw_IF4p5(device)!=0) return -1;
} else { } else {
if(eth_get_dev_conf_raw_IF4p5(device)!=0) return -1; if(eth_get_dev_conf_raw_IF4p5(device)!=0) return -1;
} }
*/
/* adjust MTU wrt number of samples per packet */ /* adjust MTU wrt number of samples per packet */
if(ethernet_tune (device,MTU_SIZE,RAW_IF4p5_PRACH_SIZE_BYTES)!=0) return -1; if(ethernet_tune (device,MTU_SIZE,RAW_IF4p5_PRACH_SIZE_BYTES)!=0) return -1;
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1; if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
...@@ -87,15 +91,16 @@ int trx_eth_start(openair0_device *device) { ...@@ -87,15 +91,16 @@ int trx_eth_start(openair0_device *device) {
printf("Setting ETHERNET to UDP_IF4p5_MODE\n"); printf("Setting ETHERNET to UDP_IF4p5_MODE\n");
if (eth_socket_init_udp(device)!=0) return -1; if (eth_socket_init_udp(device)!=0) return -1;
// printf("Setting Timeout to 999999 usecs\n"); printf("Setting Timeout to 999999 usecs\n");
// if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1; if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
/*
if (device->host_type == RAU_HOST) { if (device->host_type == RAU_HOST) {
if(eth_set_dev_conf_udp(device)!=0) return -1; if(eth_set_dev_conf_udp(device)!=0) return -1;
} else { } else {
if(eth_get_dev_conf_udp(device)!=0) return -1; if(eth_get_dev_conf_udp(device)!=0) return -1;
} }
*/
/* adjust MTU wrt number of samples per packet */ /* adjust MTU wrt number of samples per packet */
/*if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0) return -1; /*if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0) return -1;
...@@ -111,12 +116,13 @@ int trx_eth_start(openair0_device *device) { ...@@ -111,12 +116,13 @@ int trx_eth_start(openair0_device *device) {
} else { } else {
printf("Setting ETHERNET to UDP_IF5_MODE\n"); printf("Setting ETHERNET to UDP_IF5_MODE\n");
if (eth_socket_init_udp(device)!=0) return -1; if (eth_socket_init_udp(device)!=0) return -1;
/* RRU gets openair0 device configuration - RAU sets openair0 device configuration*/
/*
if (device->host_type == RAU_HOST) { if (device->host_type == RAU_HOST) {
if(eth_set_dev_conf_udp(device)!=0) return -1; if(eth_set_dev_conf_udp(device)!=0) return -1;
} else { } else {
if(eth_get_dev_conf_udp(device)!=0) return -1; if(eth_get_dev_conf_udp(device)!=0) return -1;
} }*/
/* adjust MTU wrt number of samples per packet */ /* adjust MTU wrt number of samples per packet */
if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0) return -1; if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0) return -1;
...@@ -135,7 +141,7 @@ void trx_eth_end(openair0_device *device) { ...@@ -135,7 +141,7 @@ void trx_eth_end(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
/* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */ /* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */
if ( close(eth->sockfd) <0 ) { if ( close(eth->sockfdd) <0 ) {
perror("ETHERNET: Failed to close socket"); perror("ETHERNET: Failed to close socket");
exit(0); exit(0);
} else { } else {
...@@ -144,43 +150,6 @@ void trx_eth_end(openair0_device *device) { ...@@ -144,43 +150,6 @@ void trx_eth_end(openair0_device *device) {
} }
int trx_eth_request(openair0_device *device, void *msg, ssize_t msg_len) {
eth_state_t *eth = (eth_state_t*)device->priv;
/* RAU sends a message to RRU */
if (sendto(eth->sockfd,msg,msg_len,0,(struct sockaddr *)&eth->dest_addr,eth->addr_len)==-1) {
perror("ETHERNET: ");
exit(0);
}
return 0;
}
int trx_eth_reply(openair0_device *device, void *msg, ssize_t msg_len) {
eth_state_t *eth = (eth_state_t*)device->priv;
/* RRU receives from RAU a message */
if (recvfrom(eth->sockfd,
msg,
msg_len,
0,
(struct sockaddr *)&eth->dest_addr,
(socklen_t *)&eth->addr_len)==-1) {
perror("ETHERNET: recv_from in trx_eth_reply ");
exit(0);
}
return 0;
}
int trx_eth_stop(openair0_device *device) { int trx_eth_stop(openair0_device *device) {
return(0); return(0);
} }
...@@ -217,7 +186,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -217,7 +186,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
/****************** socket level options ************************/ /****************** socket level options ************************/
switch(option) { switch(option) {
case SND_BUF_SIZE: /* transmit socket buffer size */ case SND_BUF_SIZE: /* transmit socket buffer size */
if (setsockopt(eth->sockfd, if (setsockopt(eth->sockfdd,
SOL_SOCKET, SOL_SOCKET,
SO_SNDBUF, SO_SNDBUF,
&value,sizeof(value))) { &value,sizeof(value))) {
...@@ -228,7 +197,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -228,7 +197,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
break; break;
case RCV_BUF_SIZE: /* receive socket buffer size */ case RCV_BUF_SIZE: /* receive socket buffer size */
if (setsockopt(eth->sockfd, if (setsockopt(eth->sockfdd,
SOL_SOCKET, SOL_SOCKET,
SO_RCVBUF, SO_RCVBUF,
&value,sizeof(value))) { &value,sizeof(value))) {
...@@ -241,7 +210,15 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -241,7 +210,15 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
case RCV_TIMEOUT: case RCV_TIMEOUT:
timeout.tv_sec = value/1000000; timeout.tv_sec = value/1000000;
timeout.tv_usec = value%1000000;//less than rt_period? timeout.tv_usec = value%1000000;//less than rt_period?
if (setsockopt(eth->sockfd, if (setsockopt(eth->sockfdc,
SOL_SOCKET,
SO_RCVTIMEO,
(char *)&timeout,sizeof(timeout))) {
perror("[ETHERNET] setsockopt()");
} else {
printf( "receive timeout= %u usec\n",(unsigned int)timeout.tv_usec);
}
if (setsockopt(eth->sockfdd,
SOL_SOCKET, SOL_SOCKET,
SO_RCVTIMEO, SO_RCVTIMEO,
(char *)&timeout,sizeof(timeout))) { (char *)&timeout,sizeof(timeout))) {
...@@ -254,7 +231,15 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -254,7 +231,15 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
case SND_TIMEOUT: case SND_TIMEOUT:
timeout.tv_sec = value/1000000000; timeout.tv_sec = value/1000000000;
timeout.tv_usec = value%1000000000;//less than rt_period? timeout.tv_usec = value%1000000000;//less than rt_period?
if (setsockopt(eth->sockfd, if (setsockopt(eth->sockfdc,
SOL_SOCKET,
SO_SNDTIMEO,
(char *)&timeout,sizeof(timeout))) {
perror("[ETHERNET] setsockopt()");
} else {
printf( "send timeout= %d,%d sec\n",(int)timeout.tv_sec,(int)timeout.tv_usec);
}
if (setsockopt(eth->sockfdd,
SOL_SOCKET, SOL_SOCKET,
SO_SNDTIMEO, SO_SNDTIMEO,
(char *)&timeout,sizeof(timeout))) { (char *)&timeout,sizeof(timeout))) {
...@@ -270,7 +255,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -270,7 +255,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
ifr.ifr_addr.sa_family = AF_INET; ifr.ifr_addr.sa_family = AF_INET;
strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name)); strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name));
ifr.ifr_mtu =value; ifr.ifr_mtu =value;
if (ioctl(eth->sockfd,SIOCSIFMTU,(caddr_t)&ifr) < 0 ) if (ioctl(eth->sockfdd,SIOCSIFMTU,(caddr_t)&ifr) < 0 )
perror ("[ETHERNET] Can't set the MTU"); perror ("[ETHERNET] Can't set the MTU");
else else
printf("[ETHERNET] %s MTU size has changed to %d\n",eth->if_name,ifr.ifr_mtu); printf("[ETHERNET] %s MTU size has changed to %d\n",eth->if_name,ifr.ifr_mtu);
...@@ -280,7 +265,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -280,7 +265,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
ifr.ifr_addr.sa_family = AF_INET; ifr.ifr_addr.sa_family = AF_INET;
strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name)); strncpy(ifr.ifr_name,eth->if_name, sizeof(ifr.ifr_name));
ifr.ifr_qlen =value; ifr.ifr_qlen =value;
if (ioctl(eth->sockfd,SIOCSIFTXQLEN,(caddr_t)&ifr) < 0 ) if (ioctl(eth->sockfdd,SIOCSIFTXQLEN,(caddr_t)&ifr) < 0 )
perror ("[ETHERNET] Can't set the txqueuelen"); perror ("[ETHERNET] Can't set the txqueuelen");
else else
printf("[ETHERNET] %s txqueuelen size has changed to %d\n",eth->if_name,ifr.ifr_qlen); printf("[ETHERNET] %s txqueuelen size has changed to %d\n",eth->if_name,ifr.ifr_qlen);
...@@ -366,8 +351,6 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -366,8 +351,6 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
device->Mod_id = 0;//num_devices_eth++; device->Mod_id = 0;//num_devices_eth++;
device->transp_type = ETHERNET_TP; device->transp_type = ETHERNET_TP;
device->trx_start_func = trx_eth_start; device->trx_start_func = trx_eth_start;
device->trx_request_func = trx_eth_request;
device->trx_reply_func = trx_eth_reply;
device->trx_get_stats_func = trx_eth_get_stats; device->trx_get_stats_func = trx_eth_get_stats;
device->trx_reset_stats_func = trx_eth_reset_stats; device->trx_reset_stats_func = trx_eth_reset_stats;
device->trx_end_func = trx_eth_end; device->trx_end_func = trx_eth_end;
...@@ -381,12 +364,16 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -381,12 +364,16 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
} else if (eth->flags == ETH_UDP_MODE) { } else if (eth->flags == ETH_UDP_MODE) {
device->trx_write_func = trx_eth_write_udp; device->trx_write_func = trx_eth_write_udp;
device->trx_read_func = trx_eth_read_udp; device->trx_read_func = trx_eth_read_udp;
device->trx_ctlsend_func = trx_eth_ctlsend_udp;
device->trx_ctlrecv_func = trx_eth_ctlrecv_udp;
} else if (eth->flags == ETH_RAW_IF4p5_MODE) { } else if (eth->flags == ETH_RAW_IF4p5_MODE) {
device->trx_write_func = trx_eth_write_raw_IF4p5; device->trx_write_func = trx_eth_write_raw_IF4p5;
device->trx_read_func = trx_eth_read_raw_IF4p5; device->trx_read_func = trx_eth_read_raw_IF4p5;
} else if (eth->flags == ETH_UDP_IF4p5_MODE) { } else if (eth->flags == ETH_UDP_IF4p5_MODE) {
device->trx_write_func = trx_eth_write_udp_IF4p5; device->trx_write_func = trx_eth_write_udp_IF4p5;
device->trx_read_func = trx_eth_read_udp_IF4p5; device->trx_read_func = trx_eth_read_udp_IF4p5;
device->trx_ctlsend_func = trx_eth_ctlsend_udp;
device->trx_ctlrecv_func = trx_eth_ctlrecv_udp;
} else if (eth->flags == ETH_RAW_IF5_MOBIPASS) { } else if (eth->flags == ETH_RAW_IF5_MOBIPASS) {
device->trx_write_func = trx_eth_write_raw_IF4p5; device->trx_write_func = trx_eth_write_raw_IF4p5;
device->trx_read_func = trx_eth_read_raw_IF5_mobipass; device->trx_read_func = trx_eth_read_raw_IF5_mobipass;
...@@ -399,9 +386,9 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -399,9 +386,9 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
device->priv = eth; device->priv = eth;
/* device specific */ /* device specific */
openair0_cfg[0].iq_rxrescale = 15;//rescale iqs // openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
openair0_cfg[0].iq_txshift = eth_params->iq_txshift;// shift // openair0_cfg[0].iq_txshift = eth_params->iq_txshift;// shift
openair0_cfg[0].tx_sample_advance = eth_params->tx_sample_advance; // openair0_cfg[0].tx_sample_advance = eth_params->tx_sample_advance;
/* RRU does not have any information to make this configuration atm */ /* RRU does not have any information to make this configuration atm */
/* /*
......
...@@ -54,22 +54,32 @@ ...@@ -54,22 +54,32 @@
/*!\brief opaque ethernet data structure */ /*!\brief opaque ethernet data structure */
typedef struct { typedef struct {
/*!\brief socket file desc */ /*!\brief socket file desc (control)*/
int sockfd; int sockfdc;
/*!\brief socket file desc (user)*/
int sockfdd;
/*!\brief interface name */ /*!\brief interface name */
char *if_name; char *if_name;
/*!\brief buffer size */ /*!\brief buffer size */
unsigned int buffer_size; unsigned int buffer_size;
/*!\brief destination address for UDP socket*/ /*!\brief destination address (control) for UDP socket*/
struct sockaddr_in dest_addr; struct sockaddr_in dest_addrc;
/*!\brief local address for UDP socket*/ /*!\brief local address (control) for UDP socket*/
struct sockaddr_in local_addr; struct sockaddr_in local_addrc;
/*!\brief destination address (user) for UDP socket*/
struct sockaddr_in dest_addrd;
/*!\brief local address (user) for UDP socket*/
struct sockaddr_in local_addrd;
/*!\brief address length for both UDP and RAW socket*/ /*!\brief address length for both UDP and RAW socket*/
int addr_len; int addr_len;
/*!\brief destination address for RAW socket*/ /*!\brief destination address (control) for RAW socket*/
struct sockaddr_ll dest_addr_ll; struct sockaddr_ll dest_addrc_ll;
/*!\brief local address for RAW socket*/ /*!\brief local address (control) for RAW socket*/
struct sockaddr_ll local_addr_ll; struct sockaddr_ll local_addrc_ll;
/*!\brief destination address (user) for RAW socket*/
struct sockaddr_ll dest_addrd_ll;
/*!\brief local address (user) for RAW socket*/
struct sockaddr_ll local_addrd_ll;
/*!\brief inteface index for RAW socket*/ /*!\brief inteface index for RAW socket*/
struct ifreq if_index; struct ifreq if_index;
/*!\brief timeout ms */ /*!\brief timeout ms */
...@@ -117,9 +127,10 @@ typedef struct { ...@@ -117,9 +127,10 @@ typedef struct {
uint64_t tx_count; uint64_t tx_count;
/*!\brief number of packets received */ /*!\brief number of packets received */
uint64_t rx_count; uint64_t rx_count;
/*!\brief precomputed ethernet header (control) */
struct ether_header eh; struct ether_header ehc;
/*!\brief precomputed ethernet header (data) */
struct ether_header ehd;
} eth_state_t; } eth_state_t;
...@@ -158,79 +169,6 @@ typedef enum { ...@@ -158,79 +169,6 @@ typedef enum {
MAX_OPT MAX_OPT
} eth_opt_t; } eth_opt_t;
#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;
/* /*
#define SND_BUF_SIZE 1 #define SND_BUF_SIZE 1
...@@ -286,19 +224,8 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value); ...@@ -286,19 +224,8 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value);
int eth_socket_init_udp(openair0_device *device); int eth_socket_init_udp(openair0_device *device);
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags); int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
//int trx_eth_write_udp_IF4(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
//int trx_eth_read_udp_IF4(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
int eth_get_dev_conf_udp(openair0_device *device);
/*! \fn static int eth_set_dev_conf_udp(openair0_device *device)
* \brief
* \param[in] *device openair device
* \param[out]
* \return 0 on success, otherwise -1
* \note
* @ingroup _oai
*/
int eth_set_dev_conf_udp(openair0_device *device);
int eth_socket_init_raw(openair0_device *device); int eth_socket_init_raw(openair0_device *device);
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags); int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
...@@ -307,6 +234,9 @@ int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestam ...@@ -307,6 +234,9 @@ int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestam
int trx_eth_read_raw_IF5_mobipass(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); int trx_eth_read_raw_IF5_mobipass(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags); int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
int trx_eth_ctlsend_udp(openair0_device *device, void *msg, ssize_t msg_len);
int trx_eth_ctlrecv_udp(openair0_device *device, void *msg, ssize_t msg_len);
int eth_get_dev_conf_raw(openair0_device *device); int eth_get_dev_conf_raw(openair0_device *device);
int eth_set_dev_conf_raw(openair0_device *device); int eth_set_dev_conf_raw(openair0_device *device);
int eth_get_dev_conf_raw_IF4p5(openair0_device *device); int eth_get_dev_conf_raw_IF4p5(openair0_device *device);
......
...@@ -181,8 +181,10 @@ RUs = ( ...@@ -181,8 +181,10 @@ RUs = (
local_if_name = "lo"; local_if_name = "lo";
remote_address = "127.0.0.1"; remote_address = "127.0.0.1";
local_address = "127.0.0.2"; local_address = "127.0.0.2";
local_port = 50000; #for raw option local port must be the same to remote local_portc = 50000;
remote_port = 50001; remote_portc = 50000;
local_portd = 50001;
remote_portd = 50001;
local_rf = "no" local_rf = "no"
tr_preference = "udp_if4p5" tr_preference = "udp_if4p5"
nb_tx = 1 nb_tx = 1
......
...@@ -3,8 +3,10 @@ RUs = ( ...@@ -3,8 +3,10 @@ RUs = (
local_if_name = "lo"; local_if_name = "lo";
remote_address = "127.0.0.2"; remote_address = "127.0.0.2";
local_address = "127.0.0.1"; local_address = "127.0.0.1";
local_port = 50001; local_portc = 50000;
remote_port = 50000; remote_portc = 50000;
local_portd = 50001;
remote_portd = 50001;
local_rf = "yes" local_rf = "yes"
tr_preference = "udp_if4p5"; tr_preference = "udp_if4p5";
nb_tx = 1; nb_tx = 1;
......
...@@ -104,7 +104,8 @@ struct timing_info_t { ...@@ -104,7 +104,8 @@ struct timing_info_t {
// Fix per CC openair rf/if device update // Fix per CC openair rf/if device update
// extern openair0_device openair0; // extern openair0_device openair0;
extern void do_prach(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe); void do_prach(PHY_VARS_eNB *eNB,int frame,int subframe);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
extern volatile int start_eNB; extern volatile int start_eNB;
extern volatile int start_UE; extern volatile int start_UE;
...@@ -123,12 +124,6 @@ time_stats_t softmodem_stats_mt; // main thread ...@@ -123,12 +124,6 @@ time_stats_t softmodem_stats_mt; // main thread
time_stats_t softmodem_stats_hw; // hw acquisition time_stats_t softmodem_stats_hw; // hw acquisition
time_stats_t softmodem_stats_rxtx_sf; // total tx time time_stats_t softmodem_stats_rxtx_sf; // total tx time
time_stats_t softmodem_stats_rx_sf; // total rx time time_stats_t softmodem_stats_rx_sf; // total rx time
//int32_t **rxdata;
//int32_t **txdata;
uint8_t seqno; //sequence number
static int time_offset[4] = {0,0,0,0};
/* mutex, cond and variable to serialize phy proc TX calls /* mutex, cond and variable to serialize phy proc TX calls
* (this mechanism may be relaxed in the future for better * (this mechanism may be relaxed in the future for better
...@@ -155,8 +150,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam ...@@ -155,8 +150,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
// **************************************** // ****************************************
// Common RX procedures subframe n // Common RX procedures subframe n
do_prach(eNB,proc->frame_rx,proc->subframe_rx);
do_prach(eNB,NULL,proc->frame_rx,proc->subframe_rx);
// phy_procedures_eNB_common_RX(eNB,proc); // phy_procedures_eNB_common_RX(eNB,proc);
// UE-specific RX processing for subframe n // UE-specific RX processing for subframe n
...@@ -263,10 +257,8 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) { ...@@ -263,10 +257,8 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) {
if (!oai_exit) { if (!oai_exit) {
LOG_D(PHY,"eNB_top in %p (proc %p, CC_id %d), frame %d, subframe %d, instance_cnt_prach %d\n",
if (eNB->CC_id==1) pthread_self(), proc, eNB->CC_id, proc->frame_rx,proc->subframe_rx,proc->instance_cnt_prach);
LOG_D(PHY,"eNB thread single %p (proc %p, CC_id %d), frame %d, subframe %d\n",
pthread_self(), proc, eNB->CC_id, proc->frame_rx,proc->subframe_rx);
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx)); T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx));
...@@ -279,6 +271,8 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) { ...@@ -279,6 +271,8 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) {
proc_rxtx->timestamp_tx = proc->timestamp_tx; proc_rxtx->timestamp_tx = proc->timestamp_tx;
if (rxtx(eNB,proc_rxtx,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id); if (rxtx(eNB,proc_rxtx,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id);
LOG_D(PHY,"eNB_top out %p (proc %p, CC_id %d), frame %d, subframe %d, instance_cnt_prach %d\n",
pthread_self(), proc, eNB->CC_id, proc->frame_rx,proc->subframe_rx,proc->instance_cnt_prach);
} }
} }
...@@ -336,6 +330,45 @@ int wakeup_rxtx(eNB_proc_t *proc,eNB_rxtx_proc_t *proc_rxtx,LTE_DL_FRAME_PARMS * ...@@ -336,6 +330,45 @@ int wakeup_rxtx(eNB_proc_t *proc,eNB_rxtx_proc_t *proc_rxtx,LTE_DL_FRAME_PARMS *
return(0); return(0);
} }
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) {
LOG_D(PHY,"Triggering prach processing, frame %d, subframe %d\n",frame,subframe);
if (proc->instance_cnt_prach == 0) {
LOG_W(PHY,"[eNB] Frame %d Subframe %d, dropping PRACH\n", frame,subframe);
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 );
}
}
/*! /*!
* \brief The prach receive thread of eNB. * \brief The prach receive thread of eNB.
* \param param is a \ref eNB_proc_t structure which contains the info what to process. * \param param is a \ref eNB_proc_t structure which contains the info what to process.
...@@ -357,14 +390,16 @@ static void* eNB_thread_prach( void* param ) { ...@@ -357,14 +390,16 @@ static void* eNB_thread_prach( void* param ) {
if (oai_exit) break; if (oai_exit) break;
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break; if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
LOG_D(PHY,"Running eNB prach procedures\n");
prach_procedures(eNB); prach_procedures(eNB);
if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break; if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
} }
printf( "Exiting eNB thread PRACH\n"); LOG_I(PHY, "Exiting eNB thread PRACH\n");
eNB_thread_prach_status = 0; eNB_thread_prach_status = 0;
return &eNB_thread_prach_status; return &eNB_thread_prach_status;
...@@ -384,7 +419,7 @@ void init_eNB_proc(int inst) { ...@@ -384,7 +419,7 @@ void init_eNB_proc(int inst) {
eNB_rxtx_proc_t *proc_rxtx; eNB_rxtx_proc_t *proc_rxtx;
pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_FH=NULL,*attr_prach=NULL,*attr_asynch=NULL,*attr_single=NULL,*attr_fep=NULL,*attr_td=NULL,*attr_te=NULL,*attr_synch=NULL; pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_FH=NULL,*attr_prach=NULL,*attr_asynch=NULL,*attr_single=NULL,*attr_fep=NULL,*attr_td=NULL,*attr_te=NULL,*attr_synch=NULL;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<RC.nb_CC[inst]; CC_id++) {
eNB = RC.eNB[inst][CC_id]; eNB = RC.eNB[inst][CC_id];
#ifndef OCP_FRAMEWORK #ifndef OCP_FRAMEWORK
LOG_I(PHY,"Initializing eNB processes %d CC_id %d \n",inst,CC_id); LOG_I(PHY,"Initializing eNB processes %d CC_id %d \n",inst,CC_id);
...@@ -441,6 +476,9 @@ void init_eNB_proc(int inst) { ...@@ -441,6 +476,9 @@ void init_eNB_proc(int inst) {
// snprintf( name, sizeof(name), "FH %d", i ); // snprintf( name, sizeof(name), "FH %d", i );
// pthread_setname_np( proc->pthread_FH, name ); // pthread_setname_np( proc->pthread_FH, name );
AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach);
} }
//for multiple CCs: setup master and slaves //for multiple CCs: setup master and slaves
...@@ -483,9 +521,8 @@ void kill_eNB_proc(int inst) { ...@@ -483,9 +521,8 @@ void kill_eNB_proc(int inst) {
proc = &eNB->proc; proc = &eNB->proc;
proc_rxtx = &proc->proc_rxtx[0]; proc_rxtx = &proc->proc_rxtx[0];
#ifdef DEBUG_THREADS
printf( "Killing TX CC_id %d thread %d\n", CC_id, i ); LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst );
#endif
proc_rxtx[0].instance_cnt_rxtx = 0; // FIXME data race! proc_rxtx[0].instance_cnt_rxtx = 0; // FIXME data race!
proc_rxtx[1].instance_cnt_rxtx = 0; // FIXME data race! proc_rxtx[1].instance_cnt_rxtx = 0; // FIXME data race!
...@@ -607,7 +644,6 @@ void init_eNB_afterRU() { ...@@ -607,7 +644,6 @@ void init_eNB_afterRU() {
for (CC_id=0;CC_id<RC.nb_CC[inst];CC_id++) { for (CC_id=0;CC_id<RC.nb_CC[inst];CC_id++) {
eNB = RC.eNB[inst][CC_id]; eNB = RC.eNB[inst][CC_id];
phy_init_lte_eNB(eNB,0,0); phy_init_lte_eNB(eNB,0,0);
// map antennas and PRACH signals to eNB RX // map antennas and PRACH signals to eNB RX
AssertFatal(eNB->num_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id); AssertFatal(eNB->num_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id);
LOG_I(PHY,"Mapping RX ports from %d RUs to eNB %d\n",eNB->num_RU,eNB->Mod_id); LOG_I(PHY,"Mapping RX ports from %d RUs to eNB %d\n",eNB->num_RU,eNB->Mod_id);
...@@ -645,11 +681,10 @@ void init_eNB(int single_thread_flag,int wait_for_sync) { ...@@ -645,11 +681,10 @@ void init_eNB(int single_thread_flag,int wait_for_sync) {
int CC_id; int CC_id;
int inst; int inst;
PHY_VARS_eNB *eNB; PHY_VARS_eNB *eNB;
int ret;
if (RC.eNB == NULL) RC.eNB = (PHY_VARS_eNB***) malloc(RC.nb_inst*sizeof(PHY_VARS_eNB **)); if (RC.eNB == NULL) RC.eNB = (PHY_VARS_eNB***) malloc(RC.nb_inst*sizeof(PHY_VARS_eNB **));
for (inst=0;inst<RC.nb_inst;inst++) { for (inst=0;inst<RC.nb_inst;inst++) {
if (RC.eNB[inst] == NULL) RC.eNB[inst] = (PHY_VARS_eNB*) malloc(RC.nb_CC[inst]*sizeof(PHY_VARS_eNB *)); if (RC.eNB[inst] == NULL) RC.eNB[inst] = (PHY_VARS_eNB**) malloc(RC.nb_CC[inst]*sizeof(PHY_VARS_eNB *));
for (CC_id=0;CC_id<RC.nb_CC[inst];CC_id++) { for (CC_id=0;CC_id<RC.nb_CC[inst];CC_id++) {
if (RC.eNB[inst][CC_id] == NULL) RC.eNB[inst][CC_id] = (PHY_VARS_eNB*) malloc(sizeof(PHY_VARS_eNB)); if (RC.eNB[inst][CC_id] == NULL) RC.eNB[inst][CC_id] = (PHY_VARS_eNB*) malloc(sizeof(PHY_VARS_eNB));
eNB = RC.eNB[inst][CC_id]; eNB = RC.eNB[inst][CC_id];
...@@ -679,7 +714,7 @@ void init_eNB(int single_thread_flag,int wait_for_sync) { ...@@ -679,7 +714,7 @@ void init_eNB(int single_thread_flag,int wait_for_sync) {
void stop_eNB(int nb_inst) { void stop_eNB(int nb_inst) {
for (int inst=0;inst<nb_inst;inst++) { for (int inst=0;inst<nb_inst;inst++) {
printf("Killing eNB %d processing threads\n",inst); LOG_I(PHY,"Killing eNB %d processing threads\n",inst);
kill_eNB_proc(inst); kill_eNB_proc(inst);
} }
} }
This diff is collapsed.
...@@ -1444,10 +1444,6 @@ int main( int argc, char **argv ) ...@@ -1444,10 +1444,6 @@ int main( int argc, char **argv )
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
init_ul_hopping(frame_parms[CC_id]);
init_frame_parms(frame_parms[CC_id],1);
// phy_init_top(frame_parms[CC_id]);
phy_init_lte_top(frame_parms[CC_id]);
} }
} }
...@@ -1468,7 +1464,7 @@ int main( int argc, char **argv ) ...@@ -1468,7 +1464,7 @@ int main( int argc, char **argv )
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[0][CC_id] = init_lte_UE(frame_parms[CC_id], 0,abstraction_flag); PHY_vars_UE_g[0][CC_id] = init_ue_vars(frame_parms[CC_id], 0,abstraction_flag);
UE[CC_id] = PHY_vars_UE_g[0][CC_id]; UE[CC_id] = PHY_vars_UE_g[0][CC_id];
printf("PHY_vars_UE_g[0][%d] = %p\n",CC_id,UE[CC_id]); printf("PHY_vars_UE_g[0][%d] = %p\n",CC_id,UE[CC_id]);
...@@ -1761,12 +1757,9 @@ int main( int argc, char **argv ) ...@@ -1761,12 +1757,9 @@ int main( int argc, char **argv )
sleep(3);
printf("Sending sync to all threads\n"); printf("Sending sync to all threads\n");
pthread_mutex_lock(&sync_mutex); pthread_mutex_lock(&sync_mutex);
sync_var=0; sync_var=0;
pthread_cond_broadcast(&sync_cond); pthread_cond_broadcast(&sync_cond);
......
...@@ -171,53 +171,34 @@ pthread_t main_ue_thread; ...@@ -171,53 +171,34 @@ pthread_t main_ue_thread;
pthread_attr_t attr_UE_thread; pthread_attr_t attr_UE_thread;
struct sched_param sched_param_UE_thread; struct sched_param sched_param_UE_thread;
void phy_init_lte_ue_transport(PHY_VARS_UE *ue,int absraction_flag);
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms, PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id, uint8_t UE_id,
uint8_t abstraction_flag) uint8_t abstraction_flag)
{ {
int i,j; int i,j;
PHY_VARS_UE* PHY_vars_UE = malloc(sizeof(PHY_VARS_UE)); PHY_VARS_UE* ue;
memset(PHY_vars_UE,0,sizeof(PHY_VARS_UE));
PHY_vars_UE->Mod_id=UE_id;
memcpy(&(PHY_vars_UE->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
phy_init_lte_ue(PHY_vars_UE,1,abstraction_flag);
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
for (j=0; j<2; j++) {
PHY_vars_UE->dlsch[i][j] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
if (!PHY_vars_UE->dlsch[i][j]) {
LOG_E(PHY,"Can't get ue dlsch structures\n");
exit(-1);
} else
LOG_D(PHY,"dlsch[%d][%d] => %p\n",UE_id,i,PHY_vars_UE->dlsch[i][j]);
}
PHY_vars_UE->ulsch[i] = new_ue_ulsch(frame_parms->N_RB_UL, abstraction_flag); if (frame_parms!=(PHY_VARS_UE *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in
ue = (PHY_VARS_UE *)malloc(sizeof(PHY_VARS_UE));
if (!PHY_vars_UE->ulsch[i]) { memset(ue,0,sizeof(PHY_VARS_UE));
LOG_E(PHY,"Can't get ue ulsch structures\n"); memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
exit(-1);
} }
else ue = PHY_vars_UE_g[UE_id][0];
PHY_vars_UE->dlsch_SI[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag); ue->Mod_id=UE_id;
PHY_vars_UE->dlsch_ra[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag); // initialize all signal buffers
init_lte_ue_signal(ue,1,abstraction_flag);
// intialize transport
init_lte_ue_transport(ue,abstraction_flag);
PHY_vars_UE->transmission_mode[i] = frame_parms->nb_antenna_ports_eNB==1 ? 1 : 2; return(ue);
}
PHY_vars_UE->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
PHY_vars_UE->dlsch_MCH[0] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,frame_parms->N_RB_DL,0);
return (PHY_vars_UE);
} }
char uecap_xer[1024]; char uecap_xer[1024];
void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) { void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) {
...@@ -237,9 +218,11 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) { ...@@ -237,9 +218,11 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) {
for (inst=0;inst<nb_inst;inst++) { for (inst=0;inst<nb_inst;inst++) {
printf("Intializing UE Threads for instance %d ...\n",inst); LOG_I(PHY,"Initializing memory for UE instance %d\n",inst);
PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
LOG_I(PHY,"Intializing UE Threads for instance %d ...\n",inst);
init_UE_threads(inst); init_UE_threads(inst);
sleep(1);
UE = PHY_vars_UE_g[inst][0]; UE = PHY_vars_UE_g[inst][0];
if (oaisim_flag == 0) { if (oaisim_flag == 0) {
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#include "oaisim.h" #include "oaisim.h"
#define RF #define RF
#define DEBUG_SIM //#define DEBUG_SIM
int number_rb_ul; int number_rb_ul;
int first_rbUL ; int first_rbUL ;
...@@ -251,10 +251,10 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM ...@@ -251,10 +251,10 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM
frame_parms->N_RB_DL*12); frame_parms->N_RB_DL*12);
#ifdef DEBUG_SIM #ifdef DEBUG_SIM
LOG_I(PHY,"[SIM][DL] subframe %d: txp (time) %d dB\n", LOG_D(PHY,"[SIM][DL] subframe %d: txp (time) %d dB\n",
subframe,dB_fixed(signal_energy(&txdata[0][sf_offset],frame_parms->samples_per_tti))); subframe,dB_fixed(signal_energy(&txdata[0][sf_offset],frame_parms->samples_per_tti)));
LOG_I(OCM,"[SIM][DL] RU %d (CCid %d): tx_pwr %.1f dBm/RE (target %d dBm/RE), for subframe %d\n", LOG_D(OCM,"[SIM][DL] RU %d (CCid %d): tx_pwr %.1f dBm/RE (target %d dBm/RE), for subframe %d\n",
ru_id,CC_id, ru_id,CC_id,
10*log10(tx_pwr), 10*log10(tx_pwr),
frame_parms->pdsch_config_common.referenceSignalPower, frame_parms->pdsch_config_common.referenceSignalPower,
...@@ -333,7 +333,7 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM ...@@ -333,7 +333,7 @@ void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM
} }
} }
RU_output_mask[UE_id] |= (1<<ru_id); RU_output_mask[UE_id] |= (1<<ru_id);
if (RU_output_mask[UE_id] == (1<<NB_eNB_INST)-1) { if (RU_output_mask[UE_id] == (1<<RC.nb_RU)-1) {
RU_output_mask[UE_id]=0; RU_output_mask[UE_id]=0;
......
...@@ -1216,18 +1216,26 @@ void wait_RUs() { ...@@ -1216,18 +1216,26 @@ void wait_RUs() {
PHY_vars_UE_g[i][0]->frame_parms.N_RB_DL = RC.ru[0]->frame_parms.N_RB_DL; PHY_vars_UE_g[i][0]->frame_parms.N_RB_DL = RC.ru[0]->frame_parms.N_RB_DL;
PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_tx = 1; PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_tx = 1;
PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_rx = 1; PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_rx = 1;
PHY_vars_UE_g[i][0]->frame_parms.nb_antenna_ports_eNB = RC.ru[0]->frame_parms.nb_antenna_ports_eNB; // set initially to 2, it will be revised after initial synchronization
PHY_vars_UE_g[i][0]->frame_parms.nb_antenna_ports_eNB = 2;
PHY_vars_UE_g[i][0]->frame_parms.dl_CarrierFreq = RC.ru[0]->frame_parms.dl_CarrierFreq; PHY_vars_UE_g[i][0]->frame_parms.dl_CarrierFreq = RC.ru[0]->frame_parms.dl_CarrierFreq;
PHY_vars_UE_g[i][0]->frame_parms.ul_CarrierFreq = RC.ru[0]->frame_parms.ul_CarrierFreq; PHY_vars_UE_g[i][0]->frame_parms.ul_CarrierFreq = RC.ru[0]->frame_parms.ul_CarrierFreq;
PHY_vars_UE_g[i][0]->frame_parms.eutra_band = RC.ru[0]->frame_parms.eutra_band; PHY_vars_UE_g[i][0]->frame_parms.eutra_band = RC.ru[0]->frame_parms.eutra_band;
init_ul_hopping(&PHY_vars_UE_g[i][0]->frame_parms); LOG_I(PHY,"Initializing UE %d frame parameters from RU information: N_RB_DL %d, p %d, dl_Carrierfreq %u, ul_CarrierFreq %u, eutra_band %d\n",
init_frame_parms(&PHY_vars_UE_g[i][0]->frame_parms,1); i,
phy_init_lte_top(&PHY_vars_UE_g[i][0]->frame_parms); PHY_vars_UE_g[i][0]->frame_parms.N_RB_DL,
phy_init_lte_ue(PHY_vars_UE_g[i][0],1,0); PHY_vars_UE_g[i][0]->frame_parms.nb_antenna_ports_eNB,
current_UE_rx_timestamp[i][0] = PHY_vars_UE_g[i][0]->frame_parms.samples_per_tti; PHY_vars_UE_g[i][0]->frame_parms.dl_CarrierFreq,
PHY_vars_UE_g[i][0]->frame_parms.ul_CarrierFreq,
PHY_vars_UE_g[i][0]->frame_parms.eutra_band);
current_UE_rx_timestamp[i][0] = RC.ru[0]->frame_parms.samples_per_tti;
} }
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) current_ru_rx_timestamp[ru_id][0] = RC.ru[ru_id]->frame_parms.samples_per_tti; for (ru_id=0;ru_id<RC.nb_RU;ru_id++) current_ru_rx_timestamp[ru_id][0] = RC.ru[ru_id]->frame_parms.samples_per_tti;
printf("RUs are ready, let's go\n"); printf("RUs are ready, let's go\n");
...@@ -1236,6 +1244,7 @@ void wait_RUs() { ...@@ -1236,6 +1244,7 @@ void wait_RUs() {
void init_UE(int,int,int); void init_UE(int,int,int);
void init_RU(const char*); void init_RU(const char*);
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
int int
main (int argc, char **argv) main (int argc, char **argv)
...@@ -1252,6 +1261,7 @@ main (int argc, char **argv) ...@@ -1252,6 +1261,7 @@ main (int argc, char **argv)
int node_id; int node_id;
int port,Process_Flag=0,wgt,Channel_Flag=0,temp; int port,Process_Flag=0,wgt,Channel_Flag=0,temp;
#endif #endif
int i;
//default parameters //default parameters
oai_emulation.info.n_frames = MAX_FRAME_NUMBER; //1024; //10; oai_emulation.info.n_frames = MAX_FRAME_NUMBER; //1024; //10;
...@@ -1327,7 +1337,7 @@ main (int argc, char **argv) ...@@ -1327,7 +1337,7 @@ main (int argc, char **argv)
init_devices (); init_devices ();
init_RU(NULL); init_RU(NULL);
init_UE(NB_UE_INST,0,0);
// init_openair2 (); // init_openair2 ();
...@@ -1342,6 +1352,9 @@ main (int argc, char **argv) ...@@ -1342,6 +1352,9 @@ main (int argc, char **argv)
printf("Waiting for RUs to get set up\n"); printf("Waiting for RUs to get set up\n");
wait_RUs(); wait_RUs();
init_UE(NB_UE_INST,0,0);
init_ocm (); init_ocm ();
printf("Sending sync to all threads\n"); printf("Sending sync to all threads\n");
......
This diff is collapsed.
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