diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 3fb1d0c26b297ded1a882f2f13c777a63e6dada8..2f023f8235bf79160142eb89eebe17bd0b404212 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -29,7 +29,7 @@ #include "LAYER2/MAC/extern.h" #include "MBSFN-SubframeConfigList.h" #include "UTIL/LOG/vcd_signal_dumper.h" -//#define DEBUG_PHY +#define DEBUG_PHY #include "assertions.h" #include <math.h> @@ -1219,13 +1219,22 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, for (i=0; i<fp->nb_antennas_tx; i++) { if (eNB->node_function != NGFI_RCC_IF4p5) + // Allocate 10 subframes of I/Q TX signal data (time) if not common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) ); - common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) ); + if (eNB->node_function == NGFI_RRU_IF4p5) + // Allocate 2 subframes of I/Q signal data (frequency) + common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_tti*2*sizeof(int32_t) ); + else if (eNB->node_function != NGFI_RRU_IF5) + // Allocate 10 subframes of I/Q signal data (frequency) + common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) ); + #ifdef DEBUG_PHY - printf("[openair][LTE_PHY][INIT] common_vars->txdata[%d][%d] = %p\n",eNB_id,i,common_vars->txdata[eNB_id][i]); - printf("[openair][LTE_PHY][INIT] common_vars->txdataF[%d][%d] = %p (%d bytes)\n", - eNB_id,i,common_vars->txdataF[eNB_id][i], - fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t)); + printf("[openair][LTE_PHY][INIT] common_vars->txdata[%d][%d] = %p (%lu bytes)\n",eNB_id,i,common_vars->txdata[eNB_id][i], + fp->samples_per_tti*10*sizeof(int32_t)); + if (eNB->node_function != NGFI_RRU_IF5) + printf("[openair][LTE_PHY][INIT] common_vars->txdataF[%d][%d] = %p (%lu bytes)\n", + eNB_id,i,common_vars->txdataF[eNB_id][i], + fp->ofdm_symbol_size*fp->symbols_per_tti*(eNB->node_function==NGFI_RRU_IF4p5?2:10)*sizeof(int32_t)); #endif } @@ -1238,18 +1247,23 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, for (i=0; i<fp->nb_antennas_rx; i++) { if (eNB->node_function != NGFI_RCC_IF4p5) { + // allocate 2 subframes of I/Q signal data (time) if not an RCC (no time-domain signals) common_vars->rxdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) ); - common_vars->rxdata_7_5kHz[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*sizeof(int32_t) ); + if (eNB->node_function != NGFI_RRU_IF5) + // allocate 2 subframes of I/Q signal data (time, 7.5 kHz offset) + common_vars->rxdata_7_5kHz[eNB_id][i] = (int32_t*)malloc16_clear( 2*fp->samples_per_tti*2*sizeof(int32_t) ); } - - common_vars->rxdataF[eNB_id][i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(fp->ofdm_symbol_size*fp->symbols_per_tti) ); + if (eNB->node_function != NGFI_RRU_IF5) + // allocate 2 subframes of I/Q signal data (frequency) + common_vars->rxdataF[eNB_id][i] = (int32_t*)malloc16_clear(sizeof(int32_t)*(2*fp->ofdm_symbol_size*fp->symbols_per_tti) ); #ifdef DEBUG_PHY - printf("[openair][LTE_PHY][INIT] common_vars->rxdata[%d][%d] = %p\n",eNB_id,i,common_vars->rxdata[eNB_id][i]); - printf("[openair][LTE_PHY][INIT] common_vars->rxdata_7_5kHz[%d][%d] = %p\n",eNB_id,i,common_vars->rxdata_7_5kHz[eNB_id][i]); + printf("[openair][LTE_PHY][INIT] common_vars->rxdata[%d][%d] = %p (%lu bytes)\n",eNB_id,i,common_vars->rxdata[eNB_id][i],fp->samples_per_tti*2*sizeof(int32_t)); + if (eNB->node_function != NGFI_RRU_IF5) + printf("[openair][LTE_PHY][INIT] common_vars->rxdata_7_5kHz[%d][%d] = %p (%lu bytes)\n",eNB_id,i,common_vars->rxdata_7_5kHz[eNB_id][i],fp->samples_per_tti*2*sizeof(int32_t)); #endif } - if (eNB->node_function != NGFI_RRU_IF4p5) { + if ((eNB->node_function != NGFI_RRU_IF4p5)&&(eNB->node_function != NGFI_RRU_IF5)) { // Channel estimates for SRS for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { @@ -1272,7 +1286,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, if (abstraction_flag==0) { - if (eNB->node_function != NGFI_RRU_IF4p5) { + if ((eNB->node_function != NGFI_RRU_IF4p5)&&(eNB->node_function != NGFI_RRU_IF5)) { generate_ul_ref_sigs_rx(); // SRS @@ -1286,7 +1300,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, // ULSCH VARS, skip if NFGI_RRU_IF4 - if (eNB->node_function!=NGFI_RRU_IF4p5) + if ((eNB->node_function!=NGFI_RRU_IF4p5)&&(eNB->node_function != NGFI_RRU_IF5)) prach_vars->prachF = (int16_t*)malloc16_clear( 1024*2*sizeof(int16_t) ); /* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */ @@ -1299,7 +1313,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, #endif } - if (eNB->node_function != NGFI_RRU_IF4p5) { + if ((eNB->node_function != NGFI_RRU_IF4p5)&&(eNB->node_function != NGFI_RRU_IF5)) { AssertFatal(fp->nb_antennas_rx <= sizeof(prach_vars->prach_ifft) / sizeof(prach_vars->prach_ifft[0]), "nb_antennas_rx too large"); for (i=0; i<fp->nb_antennas_rx; i++) { diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index 04982a19e6b982f01758f565cc57f46629543556..93f6e121cb33e44089f339ce7c2e50476d451b13 100755 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -43,7 +43,7 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type int32_t **txdataF = (eNB->CC_id==0) ? eNB->common_vars.txdataF[0] : PHY_vars_eNB_g[0][0]->common_vars.txdataF[0]; int32_t **rxdataF = eNB->common_vars.rxdataF[0]; int16_t **rxsigF = eNB->prach_vars.rxsigF; - void *tx_buffer = eNB->ifbuffer.tx; + void *tx_buffer = eNB->ifbuffer.tx[subframe&1]; void *tx_buffer_prach = eNB->ifbuffer.tx_prach; uint16_t symbol_id=0, element_id=0; @@ -234,7 +234,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t LOG_D(PHY,"DL_IF4p5: CC_id %d : frame %d, subframe %d, symbol %d\n",eNB->CC_id,*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) + ((*subframe)&1)*(fp->ofdm_symbol_size)*((fp->Ncp==1) ? 12 : 14) + 1; blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1; for (element_id=0; element_id<db_halflength; element_id++) { @@ -331,12 +331,16 @@ void gen_IF4p5_prach_header(IF4p5_header_t *prach_packet, int frame, int subfram void malloc_IF4p5_buffer(PHY_VARS_eNB *eNB) { // Keep the size large enough eth_state_t *eth = (eth_state_t*) (eNB->ifdevice.priv); + int i; + if (eth->flags == ETH_RAW_IF4p5_MODE) { - eNB->ifbuffer.tx = malloc(RAW_IF4p5_PRACH_SIZE_BYTES); + for (i=0;i<10;i++) + eNB->ifbuffer.tx[i] = malloc(RAW_IF4p5_PRACH_SIZE_BYTES); eNB->ifbuffer.tx_prach = malloc(RAW_IF4p5_PRACH_SIZE_BYTES); eNB->ifbuffer.rx = malloc(RAW_IF4p5_PRACH_SIZE_BYTES); - } else { - eNB->ifbuffer.tx = malloc(UDP_IF4p5_PRACH_SIZE_BYTES); + } else { + for (i=0;i<10;i++) + eNB->ifbuffer.tx[i] = malloc(UDP_IF4p5_PRACH_SIZE_BYTES); eNB->ifbuffer.tx_prach = malloc(UDP_IF4p5_PRACH_SIZE_BYTES); eNB->ifbuffer.rx = malloc(UDP_IF4p5_PRACH_SIZE_BYTES); } diff --git a/openair1/PHY/LTE_TRANSPORT/pcfich.c b/openair1/PHY/LTE_TRANSPORT/pcfich.c index 8af540eea16ec035f8ba451e25cdec6fe6a0033b..f7e4fe58b55066ab2accace2167d6b00818f0730 100644 --- a/openair1/PHY/LTE_TRANSPORT/pcfich.c +++ b/openair1/PHY/LTE_TRANSPORT/pcfich.c @@ -191,7 +191,7 @@ void generate_pcfich(uint8_t num_pdcch_symbols, // mapping nsymb = (frame_parms->Ncp==0) ? 14:12; - symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*((subframe*nsymb)); + symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(subframe*nsymb); re_offset = frame_parms->first_carrier_offset; // loop over 4 quadruplets and lookup REGs diff --git a/openair1/PHY/MODULATION/slot_fep_ul.c b/openair1/PHY/MODULATION/slot_fep_ul.c index b0798965807c1a8ac8511f775fded7dd2bff0615..e05f5361de0d21de4e198d91e6c5c34c724e475c 100644 --- a/openair1/PHY/MODULATION/slot_fep_ul.c +++ b/openair1/PHY/MODULATION/slot_fep_ul.c @@ -79,10 +79,10 @@ int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms, if (no_prefix) { // subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1); - slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns%2); + slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns&1); } else { // subframe_offset = frame_parms->samples_per_tti * (Ns>>1); - slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2); + slot_offset = (frame_parms->samples_per_tti>>1) * (Ns&1); } if (l<0 || l>=7-frame_parms->Ncp) { @@ -108,18 +108,22 @@ int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms, 1 ); } else { + rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l; + /* should never happen for eNB if(rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size)) { memcpy((void *)&eNB_common_vars->rxdata_7_5kHz[eNB_id][aa][frame_length_samples], (void *)&eNB_common_vars->rxdata_7_5kHz[eNB_id][aa][0], frame_parms->ofdm_symbol_size*sizeof(int)); } + */ - if( (rx_offset & 7) != 0){ + // check for 256-bit alignment of input buffer and do DFT directly, else do via intermediate buffer + if( (rx_offset & 15) != 0){ memcpy((void *)&tmp_dft_in, - (void *)&eNB_common_vars->rxdata_7_5kHz[eNB_id][aa][(rx_offset % frame_length_samples)], - frame_parms->ofdm_symbol_size*sizeof(int)); + (void *)&eNB_common_vars->rxdata_7_5kHz[eNB_id][aa][(rx_offset % frame_length_samples)], + frame_parms->ofdm_symbol_size*sizeof(int)); dft( (short *) tmp_dft_in, (short*) &eNB_common_vars->rxdataF[eNB_id][aa][frame_parms->ofdm_symbol_size*symbol], 1 diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index 66ff465708c8378125fb7550f8157fb89a8be1c2..7922fb131ed12a33f9b1214de851583e40999e5b 100644 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -437,7 +437,7 @@ typedef struct PHY_VARS_eNB_s { // indicator for master/slave (RRU) int is_slave; void (*do_prach)(struct PHY_VARS_eNB_s *eNB,int frame,int subframe); - void (*fep)(struct PHY_VARS_eNB_s *eNB); + void (*fep)(struct PHY_VARS_eNB_s *eNB,eNB_rxtx_proc_t *proc); int (*td)(struct PHY_VARS_eNB_s *eNB,int UE_id,int harq_pid,int llr8_flag); int (*te)(struct PHY_VARS_eNB_s *,uint8_t *,uint8_t,LTE_eNB_DLSCH_t *,int,uint8_t,time_stats_t *,time_stats_t *,time_stats_t *); void (*proc_uespec_rx)(struct PHY_VARS_eNB_s *eNB,eNB_rxtx_proc_t *proc,const relaying_type_t r_type); diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index ba5f4cc8b551efbc018b5d328400538822f13ee0..2a502f923a70fb8370ca5c5d4f69f8339b40c88f 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/defs.h @@ -177,7 +177,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *pr @param phy_vars_eNB Pointer to eNB variables on which to act @param abstraction_flag Indicator of PHY abstraction */ -void phy_procedures_eNB_common_RX(PHY_VARS_eNB *phy_vars_eNB); +void phy_procedures_eNB_common_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc); /*! \brief Scheduling for eNB TX procedures in TDD S-subframes. @param phy_vars_eNB Pointer to eNB variables on which to act diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 5e0c750b10e620806f57acecea4a82914fcf47b4..89ae2304e37cd880dd63fbfa304af417e48a0465 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -2623,7 +2623,7 @@ void init_te_thread(PHY_VARS_eNB *eNB,pthread_attr_t *attr_te) { } -void eNB_fep_full_2thread(PHY_VARS_eNB *eNB) { +void eNB_fep_full_2thread(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) { eNB_proc_t *proc = &eNB->proc; @@ -2669,28 +2669,27 @@ void eNB_fep_full_2thread(PHY_VARS_eNB *eNB) { -void eNB_fep_full(PHY_VARS_eNB *eNB) { +void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) { - eNB_proc_t *proc = &eNB->proc; int l; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_SLOT_FEP,1); start_meas(&eNB->ofdm_demod_stats); - remove_7_5_kHz(eNB,proc->subframe_rx<<1); - remove_7_5_kHz(eNB,1+(proc->subframe_rx<<1)); + remove_7_5_kHz(eNB,proc_rxtx->subframe_rx<<1); + remove_7_5_kHz(eNB,1+(proc_rxtx->subframe_rx<<1)); for (l=0; l<fp->symbols_per_tti/2; l++) { slot_fep_ul(fp, &eNB->common_vars, l, - proc->subframe_rx<<1, + (proc_rxtx->subframe_rx)<<1, 0, 0 ); slot_fep_ul(fp, &eNB->common_vars, l, - 1+(proc->subframe_rx<<1), + 1+((proc_rxtx->subframe_rx)<<1), 0, 0 ); @@ -2701,11 +2700,11 @@ void eNB_fep_full(PHY_VARS_eNB *eNB) { if (eNB->node_function == NGFI_RRU_IF4p5) { /// **** send_IF4 of rxdataF to RCC (no prach now) **** /// - send_IF4p5(eNB, proc->frame_rx, proc->subframe_rx, IF4p5_PULFFT, 0); + send_IF4p5(eNB, proc_rxtx->frame_rx, proc_rxtx->subframe_rx, IF4p5_PULFFT, 0); } } -void eNB_fep_rru_if5(PHY_VARS_eNB *eNB) { +void eNB_fep_rru_if5(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) { eNB_proc_t *proc=&eNB->proc; uint8_t seqno=0; @@ -2759,14 +2758,14 @@ void do_prach(PHY_VARS_eNB *eNB,int frame,int subframe) { } -void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB){ +void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc){ - eNB_proc_t *proc = &eNB->proc; + // eNB_proc_t *proc = &eNB->proc; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; const int subframe = proc->subframe_rx; const int frame = proc->frame_rx; - int offset = eNB->CC_id;//(eNB->single_thread_flag==1) ? 0 : (subframe&1); + int offset = (eNB->single_thread_flag==1) ? 0 : (subframe&1); if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return; @@ -2778,7 +2777,7 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB){ LOG_D(PHY,"[eNB %d] Frame %d: Doing phy_procedures_eNB_common_RX(%d)\n",eNB->Mod_id,frame,subframe); - if (eNB->fep) eNB->fep(eNB); + if (eNB->fep) eNB->fep(eNB,proc); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_COMMON+offset, 0 ); } diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 79993dc52c42d6969036d5acc3bf2cfcd575567c..98f383cb61b057a51bff618b66e385c5a86de874 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -247,8 +247,8 @@ typedef struct { typedef struct { - //! Tx buffer for if device - void *tx; + //! Tx buffer for if device, keep one per subframe now to allow multithreading + void *tx[10]; //! Tx buffer (PRACH) for if device void *tx_prach; //! Rx buffer for if device diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index a12e374e8a1372091e721b2e5cdbb020acd3c0e6..3d0674c73ed281ddcab80d55f96f781ce4cda35d 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -759,7 +759,10 @@ extern "C" { // create tx & rx streamer uhd::stream_args_t stream_args_rx("sc16", "sc16"); - //stream_args_rx.args["spp"] = str(boost::format("%d") % 2048);//(openair0_cfg[0].rx_num_channels*openair0_cfg[0].samples_per_packet)); + int samples=openair0_cfg[0].sample_rate; + samples/=24000; + // stream_args_rx.args["spp"] = str(boost::format("%d") % samples); + for (i = 0; i<openair0_cfg[0].rx_num_channels; i++) stream_args_rx.channels.push_back(i); s->rx_stream = s->usrp->get_rx_stream(stream_args_rx); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.if4p5.100PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.if4p5.100PRB.usrpb210.conf index 664bbec846c844bfa334a90224436c1b65976290..aa731c8d8a23ee2e269682c3ccf3f2fc522b31e3 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.if4p5.100PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.band7.tm1.if4p5.100PRB.usrpb210.conf @@ -159,7 +159,7 @@ eNBs = rrh_gw_config = ( { local_if_name = "eth0"; - remote_address = "10.10.10.155"; + remote_address = "10.10.10.215"; local_address = "10.10.10.60"; local_port = 50000; #for raw option local port must be the same to remote remote_port = 50000; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index eccb09758c7b7dc663bc5844fbc6ac4a16cb5cd2..49f820a8b4e548b7f4d84afa75df10203b68e0e5 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -286,7 +286,8 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_SFGEN , 1 ); - slot_offset_F = (subframe<<1)*slot_sizeF; + // compute subframe modulo-2 + slot_offset_F = ((subframe&1)<<1)*slot_sizeF; slot_offset = subframe*phy_vars_eNB->frame_parms.samples_per_tti; @@ -554,7 +555,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam if ((eNB->do_prach)&&((eNB->node_function != NGFI_RCC_IF4p5))) eNB->do_prach(eNB,proc->frame_rx,proc->subframe_rx); - phy_procedures_eNB_common_RX(eNB); + phy_procedures_eNB_common_RX(eNB,proc); // UE-specific RX processing for subframe n if (eNB->proc_uespec_rx) eNB->proc_uespec_rx(eNB, proc, no_relay ); @@ -864,7 +865,7 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { unsigned int rxs,txs; int i; int tx_sfoffset = 3;//(eNB->single_thread_flag == 1) ? 3 : 3; - openair0_timestamp old_ts; + openair0_timestamp ts,old_ts; if (proc->first_rx==0) { @@ -878,7 +879,7 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { txp[i] = (void*)&eNB->common_vars.txdata[0][i][((proc->subframe_rx+tx_sfoffset)%10)*fp->samples_per_tti]; txs = eNB->rfdevice.trx_write_func(&eNB->rfdevice, - proc->timestamp_rx+(tx_sfoffset*fp->samples_per_tti)-openair0_cfg[0].tx_sample_advance, + proc->timestamp_rx+eNB->ts_offset+(tx_sfoffset*fp->samples_per_tti)-openair0_cfg[0].tx_sample_advance, txp, fp->samples_per_tti, fp->nb_antennas_tx, @@ -902,26 +903,32 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { old_ts = proc->timestamp_rx; rxs = eNB->rfdevice.trx_read_func(&eNB->rfdevice, - &(proc->timestamp_rx), + &ts, rxp, fp->samples_per_tti, fp->nb_antennas_rx); + proc->timestamp_rx = ts-eNB->ts_offset; + if (rxs != fp->samples_per_tti) LOG_E(PHY,"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); - if (proc->first_rx == 1) + if (proc->first_rx == 1) { eNB->ts_offset = proc->timestamp_rx; + proc->timestamp_rx=0; + } else { + if (proc->timestamp_rx - old_ts != fp->samples_per_tti) { LOG_I(PHY,"rx_rf: rfdevice timing drift of %d samples\n",proc->timestamp_rx - old_ts - fp->samples_per_tti); eNB->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti); + proc->timestamp_rx = ts-eNB->ts_offset; } } - proc->frame_rx = ((proc->timestamp_rx-eNB->ts_offset) / (fp->samples_per_tti*10))&1023; - proc->subframe_rx = ((proc->timestamp_rx-eNB->ts_offset) / fp->samples_per_tti)%10; + proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_tti*10))&1023; + proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10; proc->frame_rx = (proc->frame_rx+proc->frame_offset)&1023; proc->frame_tx = proc->frame_rx; if (proc->subframe_rx > 5) proc->frame_tx=(proc->frame_tx+1)&1023; @@ -1860,8 +1867,8 @@ int start_rf(PHY_VARS_eNB *eNB) { } extern void eNB_fep_rru_if5(PHY_VARS_eNB *eNB); -extern void eNB_fep_full(PHY_VARS_eNB *eNB); -extern void eNB_fep_full_2thread(PHY_VARS_eNB *eNB); +extern void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc); +extern void eNB_fep_full_2thread(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc); extern void do_prach(PHY_VARS_eNB *eNB,int frame,int subframe); void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst,eth_params_t *eth_params,int single_thread_flag,int wait_for_sync) { @@ -1933,6 +1940,7 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst } eNB->rfdevice.host_type = RRH_HOST; eNB->ifdevice.host_type = RRH_HOST; + printf("loading transport interface ...\n"); ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], (eth_params+CC_id)); printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id); if (ret<0) { diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index d7a440790483cc3f44bca92f2980a6eab1b4d205..453b5934d651c20003b8969dbc1b277217798bf3 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1622,35 +1622,34 @@ int main( int argc, char **argv ) PHY_vars_eNB_g[0] = malloc(sizeof(PHY_VARS_eNB*)); for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag); - PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id; - + PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag); PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff; PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs; PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6; PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs; - + if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0; else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1; - + if (PHY_vars_eNB_g[0][CC_id]->mac_enabled == 0) { //set default parameters for testing mode for (i=0; i<NUMBER_OF_UE_MAX; i++) { - PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK; - PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI; - PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI; - - PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = i; - PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3); - PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4; + PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK; + PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI; + PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI; + + PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = i; + PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3); + PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4; } } - + compute_prach_seq(&PHY_vars_eNB_g[0][CC_id]->frame_parms.prach_config_common, - PHY_vars_eNB_g[0][CC_id]->frame_parms.frame_type, - PHY_vars_eNB_g[0][CC_id]->X_u); - + PHY_vars_eNB_g[0][CC_id]->frame_parms.frame_type, + PHY_vars_eNB_g[0][CC_id]->X_u); + + PHY_vars_eNB_g[0][CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0]; - + if (frame_parms[CC_id]->frame_type==FDD) { PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0; } @@ -1663,7 +1662,7 @@ int main( int argc, char **argv ) PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/4; } } - + NB_eNB_INST=1; NB_INST=1; @@ -1843,6 +1842,7 @@ int main( int argc, char **argv ) } } else { + printf("Initializing eNB threads\n"); init_eNB(node_function,node_timing,1,eth_params,single_thread_flag,wait_for_sync); number_of_cards = 1; diff --git a/targets/RT/USER/rru_if4p5_usrp.gtkw b/targets/RT/USER/rru_if4p5_usrp.gtkw index df8de754db63657dad91a994779180c2e6dae4a8..62744addfea187f440841cf57d8a5bc7f4ce6d5c 100644 --- a/targets/RT/USER/rru_if4p5_usrp.gtkw +++ b/targets/RT/USER/rru_if4p5_usrp.gtkw @@ -1,12 +1,12 @@ [*] [*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI -[*] Mon Aug 1 18:43:22 2016 +[*] Tue Jan 3 00:00:25 2017 [*] [dumpfile] "/tmp/openair_dump_eNB.vcd" -[dumpfile_mtime] "Mon Aug 1 18:41:49 2016" -[dumpfile_size] 22622 -[savefile] "/home/papillon/openairinterface5g/targets/RT/USER/rru_if4p5_usrp.gtkw" -[timestart] 0 +[dumpfile_mtime] "Mon Jan 2 23:59:11 2017" +[dumpfile_size] 93728 +[savefile] "/home/uprru1/oai/openairinterface5g/targets/RT/USER/rru_if4p5_usrp.gtkw" +[timestart] 23491157000 [size] 1301 716 [pos] 309 0 *-19.793451 29983948856 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 @@ -20,7 +20,6 @@ functions.trx_write functions.trx_write_if functions.send_if4 functions.trx_read_if -@29 functions.recv_if4 @24 variables.trx_ts[63:0] @@ -43,118 +42,5 @@ variables.subframe_number_TX1_eNB[63:0] functions.phy_enb_sfgen functions.phy_eNB_slot_fep functions.phy_enb_prach_rx -@24 -variables.dci_info[63:0] -variables.ue0_BO[63:0] -@420 -variables.ue0_BSR[63:0] -variables.ue0_timing_advance[63:0] -@28 -functions.macxface_initiate_ra_proc -functions.macxface_terminate_ra_proc -functions.phy_enb_ulsch_msg3 -functions.macxface_SR_indication -@420 -variables.ue0_SR_ENERGY[63:0] -variables.ue0_SR_THRES[63:0] -@28 -functions.phy_enb_ulsch_decoding0 -@24 -variables.ue0_res0[63:0] -@420 -variables.ue0_rssi0[63:0] -variables.ue0_MCS0[63:0] -variables.ue0_RB0[63:0] -@24 -variables.ue0_ROUND0[63:0] -variables.ue0_SFN0[63:0] -@28 -functions.phy_enb_ulsch_decoding1 -@24 -variables.ue0_res1[63:0] -@420 -variables.ue0_rssi1[63:0] -variables.ue0_MCS1[63:0] -variables.ue0_RB1[63:0] -@24 -variables.ue0_ROUND1[63:0] -variables.ue0_SFN1[63:0] -@28 -functions.phy_enb_ulsch_decoding2 -@24 -variables.ue0_res2[63:0] -@420 -variables.ue0_rssi2[63:0] -variables.ue0_MCS2[63:0] -variables.ue0_RB2[63:0] -@24 -variables.ue0_ROUND2[63:0] -variables.ue0_SFN2[63:0] -@28 -functions.phy_enb_ulsch_decoding3 -@24 -variables.ue0_res3[63:0] -@420 -variables.ue0_rssi3[63:0] -variables.ue0_MCS3[63:0] -variables.ue0_RB3[63:0] -@24 -variables.ue0_ROUND3[63:0] -variables.ue0_SFN3[63:0] -@28 -functions.phy_enb_ulsch_decoding4 -@420 -variables.ue0_rssi4[63:0] -@24 -variables.ue0_res4[63:0] -@420 -variables.ue0_MCS4[63:0] -variables.ue0_RB4[63:0] -@24 -variables.ue0_ROUND4[63:0] -variables.ue0_SFN4[63:0] -@28 -functions.phy_enb_ulsch_decoding5 -@24 -variables.ue0_res5[63:0] -@420 -variables.ue0_rssi5[63:0] -variables.ue0_MCS5[63:0] -variables.ue0_RB5[63:0] -@24 -variables.ue0_ROUND5[63:0] -variables.ue0_SFN5[63:0] -@28 -functions.phy_enb_ulsch_decoding6 -@24 -variables.ue0_res6[63:0] -@420 -variables.ue0_rssi6[63:0] -variables.ue0_MCS6[63:0] -variables.ue0_RB6[63:0] -@24 -variables.ue0_ROUND6[63:0] -variables.ue0_SFN6[63:0] -@28 -functions.phy_enb_ulsch_decoding7 -@24 -variables.ue0_res7[63:0] -@420 -variables.ue0_rssi7[63:0] -variables.ue0_MCS7[63:0] -variables.ue0_RB7[63:0] -@24 -variables.ue0_ROUND7[63:0] -variables.ue0_SFN7[63:0] -@28 -functions.phy_enb_prach_rx -functions.phy_eNB_dlsch_encoding -functions.phy_eNB_dlsch_modulation -functions.phy_eNB_dlsch_scrambling -functions.phy_enb_pdcch_tx -functions.phy_enb_rs_tx -functions.rrc_mac_config_req -functions.rlc_data_req -functions.udp_enb_task [pattern_trace] 1 [pattern_trace] 0 diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c index 5a742e9e610cd9d41f61038c23733f7d4687ccaf..7071702c282649c3e95d4cac18001fd0345ad773 100644 --- a/targets/SIMU/USER/init_lte.c +++ b/targets/SIMU/USER/init_lte.c @@ -41,6 +41,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, uint8_t eNB_id, uint8_t Nid_cell, + eNB_func_t node_function, uint8_t abstraction_flag) { @@ -54,6 +55,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, PHY_vars_eNB->frame_parms.nushift = PHY_vars_eNB->frame_parms.Nid_cell%6; phy_init_lte_eNB(PHY_vars_eNB,0,abstraction_flag); + LOG_I(PHY,"init eNB: Node Function %d\n",node_function); LOG_I(PHY,"init eNB: Nid_cell %d\n", frame_parms->Nid_cell); LOG_I(PHY,"init eNB: frame_type %d,tdd_config %d\n", frame_parms->frame_type,frame_parms->tdd_config); LOG_I(PHY,"init eNB: number of ue max %d number of enb max %d number of harq pid max %d\n", @@ -61,27 +63,33 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, LOG_I(PHY,"init eNB: N_RB_DL %d\n", frame_parms->N_RB_DL); LOG_I(PHY,"init eNB: prach_config_index %d\n", frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex); + if (node_function >= NGFI_RRU_IF5) + // For RRU, don't allocate DLSCH/ULSCH Transport channel buffers + return (PHY_vars_eNB); + for (i=0; i<NUMBER_OF_UE_MAX; i++) { + LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i); for (j=0; j<2; j++) { PHY_vars_eNB->dlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL,abstraction_flag); - + if (!PHY_vars_eNB->dlsch[i][j]) { - LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i); - exit(-1); + LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i); + exit(-1); } else { - LOG_D(PHY,"dlsch[%d][%d] => %p\n",i,j,PHY_vars_eNB->dlsch[i][j]); - PHY_vars_eNB->dlsch[i][j]->rnti=0; + LOG_D(PHY,"dlsch[%d][%d] => %p\n",i,j,PHY_vars_eNB->dlsch[i][j]); + PHY_vars_eNB->dlsch[i][j]->rnti=0; } } - + + LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n"); PHY_vars_eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,frame_parms->N_RB_UL, abstraction_flag); - + if (!PHY_vars_eNB->ulsch[1+i]) { LOG_E(PHY,"Can't get eNB ulsch structures\n"); exit(-1); } - + // this is the transmission mode for the signalling channels // this will be overwritten with the real transmission mode by the RRC once the UE is connected PHY_vars_eNB->transmission_mode[i] = frame_parms->nb_antennas_tx_eNB==1 ? 1 : 2; @@ -91,7 +99,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, gettimeofday(&ts, NULL); PHY_vars_eNB->ulsch[1+i]->reference_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000; int j; - + for (j=0; j<10; j++) { initialize(&PHY_vars_eNB->ulsch[1+i]->loc_rss_list[j]); initialize(&PHY_vars_eNB->ulsch[1+i]->loc_rssi_list[j]); @@ -99,7 +107,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, initialize(&PHY_vars_eNB->ulsch[1+i]->loc_timing_advance_list[j]); initialize(&PHY_vars_eNB->ulsch[1+i]->loc_timing_update_list[j]); } - + initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_rss_list); initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_rssi_list); initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_subcarrier_rss_list); @@ -107,37 +115,37 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, initialize(&PHY_vars_eNB->ulsch[1+i]->tot_loc_timing_update_list); #endif } - + // ULSCH for RA PHY_vars_eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, frame_parms->N_RB_UL, abstraction_flag); - + if (!PHY_vars_eNB->ulsch[0]) { LOG_E(PHY,"Can't get eNB ulsch structures\n"); exit(-1); } - + PHY_vars_eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, abstraction_flag); LOG_D(PHY,"eNB %d : SI %p\n",eNB_id,PHY_vars_eNB->dlsch_SI); PHY_vars_eNB->dlsch_ra = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, abstraction_flag); LOG_D(PHY,"eNB %d : RA %p\n",eNB_id,PHY_vars_eNB->dlsch_ra); PHY_vars_eNB->dlsch_MCH = new_eNB_dlsch(1,8,NSOFT,frame_parms->N_RB_DL, 0); LOG_D(PHY,"eNB %d : MCH %p\n",eNB_id,PHY_vars_eNB->dlsch_MCH); - - + + PHY_vars_eNB->rx_total_gain_dB=130; - + for(i=0; i<NUMBER_OF_UE_MAX; i++) PHY_vars_eNB->mu_mimo_mode[i].dl_pow_off = 2; - + PHY_vars_eNB->check_for_total_transmissions = 0; - + PHY_vars_eNB->check_for_MUMIMO_transmissions = 0; - + PHY_vars_eNB->FULL_MUMIMO_transmissions = 0; - + PHY_vars_eNB->check_for_SUMIMO_transmissions = 0; - - PHY_vars_eNB->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1; + + PHY_vars_eNB->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1; return (PHY_vars_eNB); } @@ -271,7 +279,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], PHY_vars_eNB_g[eNB_id] = (PHY_VARS_eNB**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_eNB*)); for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - PHY_vars_eNB_g[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,abstraction_flag); + PHY_vars_eNB_g[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,eNodeB_3GPP,abstraction_flag); PHY_vars_eNB_g[eNB_id][CC_id]->Mod_id=eNB_id; PHY_vars_eNB_g[eNB_id][CC_id]->CC_id=CC_id; } diff --git a/targets/SIMU/USER/init_lte.h b/targets/SIMU/USER/init_lte.h index bcb257056502c0bcab711555e3e93a805a2b0745..e49c24a15b75c82a568ccdfd4ea79d9aa64a39e0 100644 --- a/targets/SIMU/USER/init_lte.h +++ b/targets/SIMU/USER/init_lte.h @@ -25,6 +25,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, uint8_t eNB_id, uint8_t Nid_cell, + eNB_func_t node_function, uint8_t abstraction_flag); PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,