From f1e380b8905da4d60c5a73135fcd8222526a59d4 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Wed, 3 Sep 2014 14:07:37 +0000 Subject: [PATCH] git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5774 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair1/PHY/INIT/lte_init.c | 10 +- openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c | 4 +- .../PHY/LTE_ESTIMATION/lte_ue_measurements.c | 10 +- openair1/PHY/LTE_TRANSPORT/dci.c | 12 +- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 10 +- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 2 +- openair1/PHY/LTE_TRANSPORT/drs_modulation.c | 2 +- openair1/PHY/LTE_TRANSPORT/initial_sync.c | 14 +- openair1/PHY/LTE_TRANSPORT/pbch.c | 2 +- openair1/PHY/LTE_TRANSPORT/phich.c | 16 +- openair1/PHY/LTE_TRANSPORT/print_stats.c | 4 +- openair1/PHY/LTE_TRANSPORT/pucch.c | 2 +- openair1/PHY/LTE_TRANSPORT/rar_tools.c | 6 +- openair1/PHY/defs.h | 8 +- openair1/SCHED/defs.h | 10 +- openair1/SCHED/phy_procedures_lte_ue.c | 857 +++++++++--------- openair1/SCHED/pucch_pc.c | 4 +- openair1/SCHED/pusch_pc.c | 6 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 6 +- openair1/SIMULATION/LTE_PHY/ulsim.c | 16 +- 20 files changed, 515 insertions(+), 486 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index f74f0b8562..6f0edf27a1 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -242,7 +242,7 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id, vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_IN); - LOG_I(PHY,"[UE%d] Frame %d: Applying radioResourceConfigCommon from eNB%d\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame,CH_index); + LOG_I(PHY,"[UE%d] Frame %d: Applying radioResourceConfigCommon from eNB%d\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame_rx,CH_index); lte_frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex; @@ -348,7 +348,7 @@ void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index,int mbsfn_Are LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms; - LOG_I(PHY,"[UE%d] Frame %d: Applying MBSFN_Area_id %d for index %d\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame,mbsfn_AreaId_r9,mbsfn_Area_idx); + LOG_I(PHY,"[UE%d] Frame %d: Applying MBSFN_Area_id %d for index %d\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame_rx,mbsfn_AreaId_r9,mbsfn_Area_idx); if (mbsfn_Area_idx == 0) { lte_frame_parms->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9; @@ -489,7 +489,7 @@ void phy_config_afterHO_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, MobilityCont // int u; LOG_I(PHY,"[UE%d] Frame %d: Handover triggered: Applying radioResourceConfigCommon from eNB %d\n", - Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame,eNB_id); + Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame_rx,eNB_id); lte_frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex; lte_frame_parms->prach_config_common.prach_Config_enabled=1; @@ -712,7 +712,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index, if (physicalConfigDedicated) { - LOG_D(PHY,"[UE %d] Frame %d: Received physicalConfigDedicated from eNB %d\n",Mod_id, phy_vars_ue->frame,CH_index); + LOG_D(PHY,"[UE %d] Frame %d: Received physicalConfigDedicated from eNB %d\n",Mod_id, phy_vars_ue->frame_rx,CH_index); LOG_D(PHY,"------------------------------------------------------------------------\n"); if (physicalConfigDedicated->pdsch_ConfigDedicated) { @@ -797,7 +797,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index, #endif } else { - LOG_D(PHY,"[PHY][UE %d] Frame %d: Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, phy_vars_ue->frame,CH_index); + LOG_D(PHY,"[PHY][UE %d] Frame %d: Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, phy_vars_ue->frame_rx,CH_index); return; } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c index 3df38cf91a..efbfad45bc 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c @@ -53,7 +53,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, ncoef = 32767 - coef; #ifdef DEBUG_PHY - LOG_D(PHY,"frame %d: rx_offset (before) = %d\n",phy_vars_ue->frame,phy_vars_ue->rx_offset); + LOG_D(PHY,"frame %d: rx_offset (before) = %d\n",phy_vars_ue->frame_rx,phy_vars_ue->rx_offset); #endif //DEBUG_PHY @@ -95,7 +95,7 @@ void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms, #ifdef DEBUG_PHY LOG_D(PHY,"frame %d: rx_offset (after) = %d : max_pos = %d,max_pos_fil = %d (peak %d)\n", - phy_vars_ue->frame,phy_vars_ue->rx_offset,max_pos,max_pos_fil,temp); + phy_vars_ue->frame_rx,phy_vars_ue->rx_offset,max_pos,max_pos_fil,temp); #endif //DEBUG_PHY diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index 26b937fd6b..4e6c28d596 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -91,7 +91,7 @@ int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { RSoffset = 3; - LOG_D(PHY,"get_PL : Frame %d : rssi %f dBm, eNB power %d dBm/RE\n", phy_vars_ue->frame, + LOG_D(PHY,"get_PL : Frame %d : rssi %f dBm, eNB power %d dBm/RE\n", phy_vars_ue->frame_rx, (1.0*dB_fixed_times10(phy_vars_ue->PHY_measurements.rssi/RSoffset)-(10.0*phy_vars_ue->rx_total_gain_dB))/10.0, phy_vars_ue->lte_frame_parms.pdsch_config_common.referenceSignalPower); @@ -204,7 +204,7 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, for (l=0,nu=0;l<=(4-phy_vars_ue->lte_frame_parms.Ncp);l+=(4-phy_vars_ue->lte_frame_parms.Ncp),nu=3) { k = (nu + nushift)%6; #ifdef DEBUG_MEAS - LOG_D(PHY,"[UE %d] Frame %d slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,slot,Nid_cell,nushift,eNB_offset,k); + LOG_D(PHY,"[UE %d] Frame %d slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,slot,Nid_cell,nushift,eNB_offset,k); #endif for (aarx=0;aarx<phy_vars_ue->lte_frame_parms.nb_antennas_rx;aarx++) { rxF = (int16_t *)&phy_vars_ue->lte_ue_common_vars.rxdataF[aarx][(l*phy_vars_ue->lte_frame_parms.ofdm_symbol_size)]; @@ -265,16 +265,16 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue, phy_vars_ue->PHY_measurements.rsrq[eNB_offset] = 3; } - if (((phy_vars_ue->frame %10) == 0) && (slot == 0)) { + if (((phy_vars_ue->frame_rx %10) == 0) && (slot == 0)) { #ifdef DEBUG_MEAS if (eNB_offset == 0) LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d)\n",phy_vars_ue->Mod_id, - phy_vars_ue->frame,slot,10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, + phy_vars_ue->frame_rx,slot,10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB, 10*log10(phy_vars_ue->PHY_measurements.rssi), phy_vars_ue->rx_total_gain_dB); LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f (%3.1f) dBm, rsrq: %3.1f dB\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame,slot,eNB_offset, + phy_vars_ue->frame_rx,slot,eNB_offset, (eNB_offset>0) ? phy_vars_ue->PHY_measurements.adj_cell_id[eNB_offset-1] : phy_vars_ue->lte_frame_parms.Nid_cell, (dB_fixed_times10(phy_vars_ue->PHY_measurements.rsrp[eNB_offset])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12), (10*log10(phy_vars_ue->PHY_measurements.rx_power_avg[0])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12), diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 664257caee..d95ff88401 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -1693,12 +1693,12 @@ void pdcch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, int32_t avgP[4]; int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars, - LTE_UE_PDCCH **lte_ue_pdcch_vars, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - uint8_t eNB_id, - MIMO_mode_t mimo_mode, - uint8_t is_secondary_ue) { + LTE_UE_PDCCH **lte_ue_pdcch_vars, + LTE_DL_FRAME_PARMS *frame_parms, + uint8_t subframe, + uint8_t eNB_id, + MIMO_mode_t mimo_mode, + uint8_t is_secondary_ue) { uint8_t log2_maxh,aatx,aarx; #ifdef MU_RECEIVER diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 96f4bf4112..ae9ec7c2c9 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -4032,12 +4032,12 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, harq_pid = 0; else harq_pid = subframe2harq_pid(frame_parms, - pdcch_alloc2ul_frame(frame_parms,phy_vars_ue->frame,subframe), + pdcch_alloc2ul_frame(frame_parms,phy_vars_ue->frame_rx,subframe), pdcch_alloc2ul_subframe(frame_parms,subframe)); if (harq_pid == 255) { LOG_E(PHY, "frame %d, subframe %d, rnti %x, format %d: illegal harq_pid!\n", - phy_vars_ue->frame, subframe, rnti, dci_format); + phy_vars_ue->frame_rx, subframe, rnti, dci_format); return(-1); } @@ -4165,7 +4165,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, if (rballoc > RIV_max) { LOG_E(PHY,"frame %d, subframe %d, rnti %x, format %d: FATAL ERROR: generate_ue_ulsch_params_from_dci, rb_alloc > RIV_max\n", - phy_vars_ue->frame, subframe, rnti, dci_format); + phy_vars_ue->frame_rx, subframe, rnti, dci_format); return(-1); } @@ -4238,7 +4238,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ulsch->harq_processes[harq_pid]->n_DMRS2 = 9; LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d, subframe %d : Programming PUSCH with n_DMRS2 %d (cshift %d)\n", - phy_vars_ue->Mod_id,harq_pid,phy_vars_ue->frame,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift); + phy_vars_ue->Mod_id,harq_pid,phy_vars_ue->frame_rx,subframe,ulsch->harq_processes[harq_pid]->n_DMRS2,cshift); //reserved for cooperative communication /* @@ -4473,7 +4473,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, } else { LOG_E(PHY,"frame %d, subframe %d: FATAL ERROR, generate_ue_ulsch_params_from_dci, Illegal dci_format %d\n", - phy_vars_ue->frame, subframe,dci_format); + phy_vars_ue->frame_rx, subframe,dci_format); return(-1); } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index c535ce8e45..bb22990d59 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -154,7 +154,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, msg("dlsch_demodulation.c: Null lte_frame_parms\n"); return(-1); } - // printf("rx_dlsch : eNB_id %d, eNB_id_i %d, dual_stream_flag %d\n",eNB_id,eNB_id_i,dual_stream_flag); + // printf("rx_dlsch subframe %d symbol %d: eNB_id %d, eNB_id_i %d, dual_stream_flag %d\n",subframe,symbol,eNB_id,eNB_id_i,dual_stream_flag); // symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; /* diff --git a/openair1/PHY/LTE_TRANSPORT/drs_modulation.c b/openair1/PHY/LTE_TRANSPORT/drs_modulation.c index e2d06545d6..fa73a9ec75 100644 --- a/openair1/PHY/LTE_TRANSPORT/drs_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/drs_modulation.c @@ -70,7 +70,7 @@ int generate_drs_pusch(PHY_VARS_UE *phy_vars_ue, uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; int32_t ref_re,ref_im; - uint8_t harq_pid = subframe2harq_pid(frame_parms,phy_vars_ue->frame,subframe); + uint8_t harq_pid = subframe2harq_pid(frame_parms,phy_vars_ue->frame_tx,subframe); cyclic_shift0 = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift + phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->n_DMRS2 + diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index b1fbe64837..de430d0d15 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -204,20 +204,20 @@ int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) { break; } - phy_vars_ue->frame = (((phy_vars_ue->lte_ue_pbch_vars[0]->decoded_output[2]&3)<<6) + (phy_vars_ue->lte_ue_pbch_vars[0]->decoded_output[1]>>2))<<2; - phy_vars_ue->frame += frame_mod4; - + phy_vars_ue->frame_rx = (((phy_vars_ue->lte_ue_pbch_vars[0]->decoded_output[2]&3)<<6) + (phy_vars_ue->lte_ue_pbch_vars[0]->decoded_output[1]>>2))<<2; + phy_vars_ue->frame_rx += frame_mod4; + #ifndef USER_MODE // one frame delay - phy_vars_ue->frame ++; + phy_vars_ue->frame_rx ++; #endif - + phy_vars_ue->frame_tx = phy_vars_ue->frame_rx; #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully mode1_flag %d, tx_ant %d, frame %d, N_RB_DL %d, phich_duration %d, phich_resource %s!\n", phy_vars_ue->Mod_id, frame_parms->mode1_flag, pbch_tx_ant, - phy_vars_ue->frame, + phy_vars_ue->frame_rx, frame_parms->N_RB_DL, frame_parms->phich_config_common.phich_duration, phich_resource); //frame_parms->phich_config_common.phich_resource); @@ -458,7 +458,7 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) { #ifdef OPENAIR2 LOG_I(PHY,"[PHY][UE%d] Sending synch status to higher layers\n",phy_vars_ue->Mod_id); //mac_resynch(); - mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,phy_vars_ue->frame,0,1);//phy_vars_ue->lte_ue_common_vars.eNb_id); + mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,0,1);//phy_vars_ue->lte_ue_common_vars.eNb_id); #endif //OPENAIR2 generate_pcfich_reg_mapping(frame_parms); diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c index d30ac6775c..9aaf3a4f84 100755 --- a/openair1/PHY/LTE_TRANSPORT/pbch.c +++ b/openair1/PHY/LTE_TRANSPORT/pbch.c @@ -933,7 +933,7 @@ uint16_t rx_pbch_emul(PHY_VARS_UE *phy_vars_ue, sinr, bler); - if (pbch_phase == (phy_vars_ue->frame % 4)) { + if (pbch_phase == (phy_vars_ue->frame_rx % 4)) { if (uniformrandom() >= bler) { memcpy(phy_vars_ue->lte_ue_pbch_vars[eNB_id]->decoded_output,PHY_vars_eNB_g[eNB_id][CC_id]->pbch_pdu,PBCH_PDU_SIZE); return(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.nb_antennas_tx_eNB); diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index 4b862ffb5a..cdbcea5fac 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -982,7 +982,7 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue, LTE_UE_PDCCH **lte_ue_pdcch_vars = phy_vars_ue->lte_ue_pdcch_vars; // uint8_t HI; - uint8_t harq_pid = phich_subframe_to_harq_pid(frame_parms,phy_vars_ue->frame,subframe); + uint8_t harq_pid = phich_subframe_to_harq_pid(frame_parms,phy_vars_ue->frame_rx,subframe); LTE_UE_ULSCH_t *ulsch = phy_vars_ue->ulsch_ue[eNB_id]; int16_t phich_d[24],*phich_d_ptr,HI16; // unsigned int i,aa; @@ -1000,9 +1000,9 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue, uint8_t pusch_subframe; // check if we're expecting a PHICH in this subframe - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX\n",phy_vars_ue->Mod_id,harq_pid,phy_vars_ue->frame,subframe); + LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX\n",phy_vars_ue->Mod_id,harq_pid,phy_vars_ue->frame_rx,subframe); if (ulsch->harq_processes[harq_pid]->status == ACTIVE) { - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX ACTIVE\n",phy_vars_ue->Mod_id,harq_pid,phy_vars_ue->frame,subframe); + LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX ACTIVE\n",phy_vars_ue->Mod_id,harq_pid,phy_vars_ue->frame_rx,subframe); Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48; if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0) Ngroup_PHICH++; @@ -1247,14 +1247,14 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue, if (phy_vars_ue->ulsch_ue_Msg3_active[eNB_id] == 1) { LOG_I(PHY,"[UE %d][PUSCH %d][RAPROC] Frame %d subframe %d Msg3 PHICH, received NAK (%d) nseq %d, ngroup %d\n", phy_vars_ue->Mod_id,harq_pid, - phy_vars_ue->frame, + phy_vars_ue->frame_rx, subframe, HI16, nseq_PHICH, ngroup_PHICH); get_Msg3_alloc_ret(&phy_vars_ue->lte_frame_parms, subframe, - phy_vars_ue->frame, + phy_vars_ue->frame_rx, &phy_vars_ue->ulsch_ue_Msg3_frame[eNB_id], &phy_vars_ue->ulsch_ue_Msg3_subframe[eNB_id]); ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; @@ -1272,7 +1272,7 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue, //#ifdef DEBUG_PHICH LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received NAK (%d) nseq %d, ngroup %d\n", phy_vars_ue->Mod_id,harq_pid, - phy_vars_ue->frame, + phy_vars_ue->frame_rx, subframe, HI16, nseq_PHICH, @@ -1290,7 +1290,7 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue, if (phy_vars_ue->ulsch_ue_Msg3_active[eNB_id] == 1) { LOG_I(PHY,"[UE %d][PUSCH %d][RAPROC] Frame %d subframe %d Msg3 PHICH, received ACK (%d) nseq %d, ngroup %d\n\n", phy_vars_ue->Mod_id,harq_pid, - phy_vars_ue->frame, + phy_vars_ue->frame_rx, subframe, HI16, nseq_PHICH,ngroup_PHICH); @@ -1299,7 +1299,7 @@ void rx_phich(PHY_VARS_UE *phy_vars_ue, //#ifdef PHICH_DEBUG LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH, received ACK (%d) nseq %d, ngroup %d\n\n", phy_vars_ue->Mod_id,harq_pid, - phy_vars_ue->frame, + phy_vars_ue->frame_rx, subframe, HI16, nseq_PHICH,ngroup_PHICH); //#endif diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c index 2a5c6c7e2e..c0285e2d33 100644 --- a/openair1/PHY/LTE_TRANSPORT/print_stats.c +++ b/openair1/PHY/LTE_TRANSPORT/print_stats.c @@ -79,7 +79,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t if ((mode == normal_txrx) || (mode == no_L2_connect)) { len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",phy_vars_ue->Mod_id, phy_vars_ue->lte_ue_pdcch_vars[0]->crnti); len += sprintf(&buffer[len], "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm (%d dB, %d dB)\neNB1 RSSI %d dBm (%d dB, %d dB)\neNB2 RSSI %d dBm (%d dB, %d dB)\nN0 %d dBm (%d dB, %d dB)\n", - phy_vars_ue->frame, + phy_vars_ue->frame_rx, phy_vars_ue->PHY_measurements.rx_rssi_dBm[0], phy_vars_ue->PHY_measurements.rx_power_dB[0][0], phy_vars_ue->PHY_measurements.rx_power_dB[0][1], @@ -235,7 +235,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t } else { len += sprintf(&buffer[len], "[UE PROC] Frame count: %d, RSSI %3.2f dB (%d dB, %d dB), N0 %3.2f dB (%d dB, %d dB)\n", - phy_vars_ue->frame, + phy_vars_ue->frame_rx, 10*log10(phy_vars_ue->PHY_measurements.rssi), phy_vars_ue->PHY_measurements.rx_power_dB[0][0], phy_vars_ue->PHY_measurements.rx_power_dB[0][1], diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index 43f901f347..9b808efc7f 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -422,7 +422,7 @@ void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue, UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pucch_payload = pucch_payload[0] + (pucch_payload[1]<<1); } else if (format == pucch_format1) { - LOG_D(PHY,"[UE %d] Frame %d subframe %d Generating PUCCH for SR %d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,subframe,sr); + LOG_D(PHY,"[UE %d] Frame %d subframe %d Generating PUCCH for SR %d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame_tx,subframe,sr); } phy_vars_ue->sr[subframe] = sr; diff --git a/openair1/PHY/LTE_TRANSPORT/rar_tools.c b/openair1/PHY/LTE_TRANSPORT/rar_tools.c index 832d5af9a0..e2cf7ddf8a 100644 --- a/openair1/PHY/LTE_TRANSPORT/rar_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/rar_tools.c @@ -181,14 +181,14 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue, // int current_dlsch_cqi = phy_vars_ue->current_dlsch_cqi[eNB_id]; uint8_t *rar = (uint8_t *)(rar_pdu+1); - uint8_t harq_pid = subframe2harq_pid(frame_parms,((subframe==0)?1:0) + phy_vars_ue->frame,subframe); + uint8_t harq_pid = subframe2harq_pid(frame_parms,phy_vars_ue->frame_tx,subframe); uint16_t rballoc; uint8_t cqireq; double sinr_eff; uint16_t *RIV2nb_rb_LUT, *RIV2first_rb_LUT; uint16_t RIV_max = 0; - LOG_D(PHY,"[eNB][RAPROC] Frame %d: generate_ue_ulsch_params_from_rar: subframe %d (harq_pid %d)\n",phy_vars_ue->frame,subframe,harq_pid); + LOG_D(PHY,"[eNB][RAPROC] Frame %d: generate_ue_ulsch_params_from_rar: subframe %d (harq_pid %d)\n",phy_vars_ue->frame_tx,subframe,harq_pid); switch (frame_parms->N_RB_DL) { case 6: @@ -267,7 +267,7 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue, // } // else // fill_CQI(ulsch->o,ulsch->uci_format,meas,eNB_id,transmission_mode); - if (((phy_vars_ue->frame % 100) == 0) || (phy_vars_ue->frame < 10)) + if (((phy_vars_ue->frame_tx % 100) == 0) || (phy_vars_ue->frame_tx < 10)) print_CQI(ulsch->o,ulsch->uci_format,eNB_id); } else { diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index 7417d6393e..4cbe912843 100755 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -356,10 +356,16 @@ typedef struct uint8_t local_flag; int instance_cnt_tx; int instance_cnt_rx; + int instance_cnt_synch; pthread_cond_t cond_tx; pthread_cond_t cond_rx; + pthread_cond_t cond_synch; pthread_mutex_t mutex_tx; pthread_mutex_t mutex_rx; + pthread_mutex_t mutex_synch; + pthread_t thread_rx; + pthread_t thread_tx; + pthread_t thread_synch; uint32_t tx_total_gain_dB; uint32_t rx_total_gain_dB; ///this is a function of rx_gain_mode (and the corresponding gain) and the rx_gain of the card uint32_t rx_gain_max[4]; @@ -370,7 +376,7 @@ typedef struct int8_t tx_power_dBm; int tx_total_RE; int8_t tx_power_max_dBm; - uint32_t frame; + // uint32_t frame; uint32_t frame_rx,frame_tx; uint32_t slot_tx,slot_rx; uint8_t n_connected_eNB; diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index 10ddadf8fa..599eca9bb9 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/defs.h @@ -169,7 +169,7 @@ void phy_procedures_eNB_lte(uint8_t subframe,PHY_VARS_eNB **phy_vars_eNB,uint8_t @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying @param *phy_vars_rn pointer to RN variables */ -void phy_procedures_UE_lte(uint8_t last_slot, uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn); +void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn); #ifdef Rel10 /*! @@ -190,14 +190,13 @@ int phy_procedures_RN_UE_RX(unsigned char last_slot, unsigned char next_slot, re /*! \brief Scheduling for UE TX procedures in normal subframes. - @param next_slot Index of next slot (0-19) @param phy_vars_ue Pointer to UE variables on which to act @param eNB_id Local id of eNB on which to act @param abstraction_flag Indicator of PHY abstraction @param mode calib/normal mode @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying */ -void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type); +void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type); /*! \brief Scheduling for UE RX procedures in normal subframes. @param last_slot Index of last slot (0-19) @@ -208,17 +207,16 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying @param phy_vars_rn pointer to RN variables */ -int phy_procedures_UE_RX(uint8_t last_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn); +int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn); /*! \brief Scheduling for UE TX procedures in TDD S-subframes. - @param next_slot Index of next slot (0-19) @param phy_vars_ue Pointer to UE variables on which to act @param eNB_id Local id of eNB on which to act @param abstraction_flag Indicator of PHY abstraction @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying */ -void phy_procedures_UE_S_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,relaying_type_t r_type); +void phy_procedures_UE_S_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,relaying_type_t r_type); /*! \brief Scheduling for UE RX procedures in TDD S-subframes. diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index f80719677d..4a43fd65db 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -152,7 +152,7 @@ void dump_dlsch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint8_t get_Qm(phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs), phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->Nl, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame,subframe); + phy_vars_ue->frame_rx,subframe); write_output("rxsigF0.m","rxsF0", phy_vars_ue->lte_ue_common_vars.rxdataF[0],2*nsymb*phy_vars_ue->lte_frame_parms.ofdm_symbol_size,2,1); write_output("rxsigF0_ext.m","rxsF0_ext", phy_vars_ue->lte_ue_pdsch_vars[0]->rxdataF_ext[0],2*nsymb*phy_vars_ue->lte_frame_parms.ofdm_symbol_size,1,1); @@ -180,7 +180,7 @@ void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) { get_Qm(phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->mcs), 1, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame,subframe); + phy_vars_ue->frame_rx,subframe); LOG_D(PHY,"[UE %d] Dumping dlsch_SI : nb_rb %d, mcs %d, nb_rb %d, num_pdcch_symbols %d,G %d\n", phy_vars_ue->Mod_id, phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->nb_rb, @@ -234,7 +234,7 @@ void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) { get_Qm(phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->mcs), 1, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame,subframe); + phy_vars_ue->frame_rx,subframe); LOG_D(PHY,"[UE %d] Dumping dlsch_ra : nb_rb %d, mcs %d, nb_rb %d, num_pdcch_symbols %d,G %d\n", phy_vars_ue->Mod_id, phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->nb_rb, @@ -297,7 +297,7 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { // if contention resolution fails, go back to PRACH PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH; - LOG_E(PHY,"[UE %d] Frame %d Random-access procedure fails, going back to PRACH, setting SIStatus = 0 and State RRC_IDLE\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame); + LOG_E(PHY,"[UE %d] Frame %d Random-access procedure fails, going back to PRACH, setting SIStatus = 0 and State RRC_IDLE\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame_rx); //mac_xface->macphy_exit(""); // exit(-1); } @@ -306,7 +306,7 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { int i; - LOG_I(PHY,"[UE %d][RAPROC] Frame %d Random-access procedure succeeded\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame); + LOG_I(PHY,"[UE %d][RAPROC] Frame %d Random-access procedure succeeded\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame_rx); PHY_vars_UE_g[Mod_id][CC_id]->ulsch_ue_Msg3_active[eNB_index] = 0; PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PUSCH; @@ -339,7 +339,7 @@ void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,uint16_t timing_advance } #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d] Frame %d, received (rar) timing_advance %d, HW timing advance %d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame, phy_vars_ue->timing_advance,openair_daq_vars.timing_advance); + LOG_I(PHY,"[UE %d] Frame %d, received (rar) timing_advance %d, HW timing advance %d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame_rx, phy_vars_ue->timing_advance,openair_daq_vars.timing_advance); #endif } @@ -367,7 +367,7 @@ void process_timing_advance(uint8_t Mod_id,uint8_t CC_id,int16_t timing_advance) uint8_t is_SR_TXOp(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) { LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Checking for SR TXOp (sr_ConfigIndex %d)\n", - phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame+(subframe==0)?1:0,subframe, + phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame_tx,subframe, phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex); if (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex <= 4) { // 5 ms SR period @@ -379,15 +379,15 @@ uint8_t is_SR_TXOp(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) { return(1); } else if (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex <= 34) { // 20 ms SR period - if ((10*(phy_vars_ue->frame&1)+subframe) == (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex-15)) + if ((10*(phy_vars_ue->frame_tx&1)+subframe) == (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex-15)) return(1); } else if (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex <= 74) { // 40 ms SR period - if ((10*(phy_vars_ue->frame&3)+subframe) == (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex-35)) + if ((10*(phy_vars_ue->frame_tx&3)+subframe) == (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex-35)) return(1); } else if (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex <= 154) { // 80 ms SR period - if ((10*(phy_vars_ue->frame&7)+subframe) == (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex-75)) + if ((10*(phy_vars_ue->frame_tx&7)+subframe) == (phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex-75)) return(1); } @@ -424,11 +424,11 @@ uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue, bundling_flag = phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; #ifdef DEBUG_PHY_PROC if (bundling_flag==bundling){ - LOG_D(PHY,"[UE%d] Frame %d subframe %d : get_n1_pucch, bundling, SR %d/%d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,subframe,SR, + LOG_D(PHY,"[UE%d] Frame %d subframe %d : get_n1_pucch, bundling, SR %d/%d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame_tx,subframe,SR, phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); } else { - LOG_D(PHY,"[UE%d] Frame %d subframe %d : get_n1_pucch, multiplexing, SR %d/%d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,subframe,SR, + LOG_D(PHY,"[UE%d] Frame %d subframe %d : get_n1_pucch, multiplexing, SR %d/%d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame_tx,subframe,SR, phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex); } #endif @@ -454,7 +454,7 @@ uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue, } else { LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, illegal subframe %d for tdd_config %d\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,subframe,frame_parms->tdd_config); + phy_vars_ue->Mod_id,phy_vars_ue->frame_tx,subframe,frame_parms->tdd_config); return(0); } @@ -562,7 +562,7 @@ uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue, } // switch tdd_config } - LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, exit without proper return\n",phy_vars_ue->frame); + LOG_E(PHY,"[UE%d] : Frame %d phy_procedures_lte.c: get_n1pucch, exit without proper return\n",phy_vars_ue->frame_tx); return(-1); } @@ -604,7 +604,7 @@ int dummy_tx_buffer[3840*4] __attribute__((aligned(16))); PRACH_RESOURCES_t prach_resources_local; #endif -void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) { +void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) { // int i_d; uint16_t first_rb, nb_rb; @@ -618,7 +618,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB PUCCH_FMT_t format; uint8_t SR_payload; int32_t prach_power; - uint8_t subframe,nsymb; + uint8_t nsymb; LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms; uint8_t generate_ul_signal = 0; uint8_t ack_status=0; @@ -628,8 +628,11 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB int ulsch_end=0,overflow=0; int k,l; #endif - uint8_t CC_id=phy_vars_ue->CC_id; - + int slot_tx = phy_vars_ue->slot_tx; + int subframe_tx = phy_vars_ue->slot_tx>>1; + int frame_tx = phy_vars_ue->frame_tx; + int Mod_id = phy_vars_ue->Mod_id; + int CC_id = phy_vars_ue->CC_id; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN); start_meas(&phy_vars_ue->phy_proc_tx); @@ -638,15 +641,12 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB //phy_procedures_emos_UE_TX(next_slot); #endif - if ((next_slot%2)==0) { + if ((slot_tx%2)==0) { phy_vars_ue->tx_power_dBm=-127; - subframe = next_slot>>1; - // printf("[PHY][UE] Frame %d, subframe %d Clearing TX buffer\n",phy_vars_ue->frame,next_slot>>1); if ((abstraction_flag==0)) { for (aa=0;aa<frame_parms->nb_antennas_tx;aa++){ - // printf("[PHY][UE][RAROC] frame %d subframe %d Clearing TX buffer\n",phy_vars_ue->frame,next_slot>>1); - memset(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti], + memset(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti], 0,frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*sizeof(int32_t)); } } @@ -654,32 +654,32 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB if (phy_vars_ue->UE_mode[eNB_id] != PRACH) { /* #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[UE %d] Frame %d, slot %d: Generating SRS\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot); + LOG_D(PHY,"[UE %d] Frame %d, slot %d: Generating SRS\n",Mod_id,phy_vars_ue->frame,slot_tx); #endif if (abstraction_flag == 0) { #ifdef OFDMA_ULSCH - generate_srs_tx(phy_vars_ue,eNB_id,AMP,next_slot>>1); + generate_srs_tx(phy_vars_ue,eNB_id,AMP,subframe_tx); #else - generate_srs_tx(phy_vars_ue,eNB_id,AMP,next_slot>>1); + generate_srs_tx(phy_vars_ue,eNB_id,AMP,subframe_tx); #endif } #ifdef PHY_ABSTRACTION else { - generate_srs_tx_emul(phy_vars_ue,next_slot>>1); + generate_srs_tx_emul(phy_vars_ue,subframe_tx); } #endif */ // get harq_pid from subframe relationship harq_pid = subframe2harq_pid(&phy_vars_ue->lte_frame_parms, - (((next_slot>>1)==0)?1:0) + phy_vars_ue->frame, - (next_slot>>1)); + frame_tx, + subframe_tx); #ifdef OPENAIR2 if ((phy_vars_ue->ulsch_ue_Msg3_active[eNB_id] == 1) && - (phy_vars_ue->ulsch_ue_Msg3_frame[eNB_id] == (((next_slot>>1)==0)?1:0) + phy_vars_ue->frame) && - (phy_vars_ue->ulsch_ue_Msg3_subframe[eNB_id] == (next_slot>>1))) { // Initial Transmission of Msg3 + (phy_vars_ue->ulsch_ue_Msg3_frame[eNB_id] == frame_tx) && + (phy_vars_ue->ulsch_ue_Msg3_subframe[eNB_id] == subframe_tx)) { // Initial Transmission of Msg3 phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1; if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->round==0) @@ -688,9 +688,9 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB phy_vars_ue->ulsch_ue[eNB_id]->power_offset = 14; LOG_I(PHY,"[UE %d][RAPROC] Frame %d: Setting Msg3_flag in subframe %d, for harq_pid %d\n", - phy_vars_ue->Mod_id, - phy_vars_ue->frame, - next_slot>>1, + Mod_id, + frame_tx, + subframe_tx, harq_pid); Msg3_flag = 1; } @@ -698,7 +698,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB if (harq_pid==255) { LOG_E(PHY,"[UE%d] Frame %d ulsch_decoding.c: FATAL ERROR: illegal harq_pid, returning\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame); + Mod_id,frame_tx); mac_xface->macphy_exit(""); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); stop_meas(&phy_vars_ue->phy_proc_tx); @@ -712,7 +712,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB generate_ul_signal = 1; #ifdef OPENAIR2 - pusch_power_cntl(phy_vars_ue,(next_slot>>1),eNB_id,1, abstraction_flag); + pusch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,1, abstraction_flag); phy_vars_ue->tx_power_dBm = phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH; #else phy_vars_ue->tx_power_dBm = UE_TX_POWER; @@ -720,14 +720,14 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB phy_vars_ue->tx_total_RE = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->nb_rb*12; LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d harq pid %d, Po_PUSCH : %d dBm\n", - phy_vars_ue->Mod_id,harq_pid,(((next_slot>>1)==0)?1:0)+phy_vars_ue->frame,next_slot>>1,harq_pid, phy_vars_ue->tx_power_dBm); + Mod_id,harq_pid,frame_tx,subframe_tx,harq_pid, phy_vars_ue->tx_power_dBm); // deactivate service request phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; ack_status = get_ack(&phy_vars_ue->lte_frame_parms, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_ack, - (next_slot>>1), + subframe_tx, phy_vars_ue->ulsch_ue[eNB_id]->o_ACK); first_rb = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->first_rb; @@ -742,24 +742,24 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #ifdef DEBUG_PHY_PROC LOG_I(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d\n", - phy_vars_ue->Mod_id,harq_pid,(((next_slot>>1)==0)?1:0)+phy_vars_ue->frame,next_slot>>1, + Mod_id,harq_pid,frame_tx,subframe_tx, first_rb,nb_rb, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->round, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->mcs, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->rvidx, (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift+ phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->n_DMRS2+ - frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[next_slot])%12, + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[slot_tx])%12, frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->n_DMRS2, - frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[next_slot], + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[slot_tx], phy_vars_ue->ulsch_ue[eNB_id]->o_ACK[0],phy_vars_ue->ulsch_ue[eNB_id]->o_ACK[1], phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->O_ACK); if (ack_status > 0) { LOG_I(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating ACK (%d,%d) for %d bits on PUSCH\n", - phy_vars_ue->Mod_id, + Mod_id, phy_vars_ue->ulsch_ue[eNB_id]->rnti, - phy_vars_ue->frame,next_slot>>1, + frame_tx,subframe_tx, phy_vars_ue->ulsch_ue[eNB_id]->o_ACK[0],phy_vars_ue->ulsch_ue[eNB_id]->o_ACK[1], phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->O_ACK); } @@ -769,20 +769,20 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #ifdef EXMIMO if (abstraction_flag==0) { for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++) - generate_drs_pusch(phy_vars_ue,eNB_id,get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),next_slot>>1,first_rb,nb_rb,aa); + generate_drs_pusch(phy_vars_ue,eNB_id,get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),subframe_tx,first_rb,nb_rb,aa); } #else if (abstraction_flag==0) { for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++) - generate_drs_pusch(phy_vars_ue,eNB_id,AMP,next_slot>>1,first_rb,nb_rb,aa); + generate_drs_pusch(phy_vars_ue,eNB_id,AMP,subframe_tx,first_rb,nb_rb,aa); } #endif //#ifdef DEBUG_PHY_PROC - // debug_LOG_D(PHY,"[UE %d] Frame %d, Subframe %d ulsch harq_pid %d : O %d, O_ACK %d, O_RI %d, TBS %d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1,harq_pid,phy_vars_ue->ulsch_ue[eNB_id]->O,phy_vars_ue->ulsch_ue[eNB_id]->O_ACK,phy_vars_ue->ulsch_ue[eNB_id]->O_RI,phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS); + // debug_LOG_D(PHY,"[UE %d] Frame %d, Subframe %d ulsch harq_pid %d : O %d, O_ACK %d, O_RI %d, TBS %d\n",Mod_id,phy_vars_ue->frame,subframe_tx,harq_pid,phy_vars_ue->ulsch_ue[eNB_id]->O,phy_vars_ue->ulsch_ue[eNB_id]->O_ACK,phy_vars_ue->ulsch_ue[eNB_id]->O_RI,phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS); //#endif if (Msg3_flag == 1) { - LOG_I(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d next slot %d Generating (RRCConnectionRequest) Msg3 (nb_rb %d, first_rb %d, round %d, rvidx %d) Msg3: %x.%x.%x|%x.%x.%x.%x.%x.%x\n",phy_vars_ue->Mod_id,(((next_slot>>1)==0)?1:0)+phy_vars_ue->frame,next_slot>>1, next_slot, + LOG_I(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d next slot %d Generating (RRCConnectionRequest) Msg3 (nb_rb %d, first_rb %d, round %d, rvidx %d) Msg3: %x.%x.%x|%x.%x.%x.%x.%x.%x\n",Mod_id,frame_tx,subframe_tx, slot_tx, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->nb_rb, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->first_rb, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->round, @@ -821,9 +821,9 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #ifdef OPENAIR2 // signal MAC that Msg3 was sent - mac_xface->Msg3_transmitted(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame, + mac_xface->Msg3_transmitted(Mod_id, + CC_id, + frame_tx, eNB_id); #endif } @@ -831,14 +831,14 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB input_buffer_length = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS/8; #ifdef OPENAIR2 - // LOG_D(PHY,"[UE %d] ULSCH : Searching for MAC SDUs\n",phy_vars_ue->Mod_id); + // LOG_D(PHY,"[UE %d] ULSCH : Searching for MAC SDUs\n",Mod_id); if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->round==0) { //if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->calibration_flag == 0) { access_mode=SCHEDULED_ACCESS; - mac_xface->ue_get_sdu(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame, - (next_slot>>1), + mac_xface->ue_get_sdu(Mod_id, + CC_id, + frame_tx, + subframe_tx, eNB_id, ulsch_input_buffer, input_buffer_length, @@ -849,7 +849,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB else { // Get calibration information from TDD procedures LOG_D(PHY,"[UE %d] Frame %d, subframe %d : ULSCH: Getting TDD Auto-Calibration information\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1); + Mod_id,phy_vars_ue->frame,subframe_tx); for (i=0;i<input_buffer_length;i++) ulsch_input_buffer[i]= i; @@ -858,7 +858,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB } //#ifdef DEBUG_PHY_PROC //#ifdef DEBUG_ULSCH - LOG_I(PHY,"[UE] Frame %d, subframe %d : ULSCH SDU (TX harq_pid %d) (%d bytes) : \n",phy_vars_ue->frame,next_slot>>1,harq_pid, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3); + LOG_I(PHY,"[UE] Frame %d, subframe %d : ULSCH SDU (TX harq_pid %d) (%d bytes) : \n",frame_tx,subframe_tx,harq_pid, phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3); for (i=0;i<phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3;i++) LOG_T(PHY,"%x.",ulsch_input_buffer[i]); LOG_T(PHY,"\n"); @@ -924,7 +924,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB phy_vars_ue->tx_total_RE = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->nb_rb*12; LOG_I(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d, generating PUSCH, Po_PUSCH: %d dBm, amp %d\n", - phy_vars_ue->Mod_id,harq_pid,(((next_slot>>1)==0)?1:0)+phy_vars_ue->frame,next_slot>>1,phy_vars_ue->tx_power_dBm, + Mod_id,harq_pid,frame_tx,subframe_tx,phy_vars_ue->tx_power_dBm, #ifdef EXMIMO get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm) #else @@ -939,8 +939,8 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #else AMP, #endif - phy_vars_ue->frame, - (next_slot>>1), + frame_tx, + subframe_tx, &phy_vars_ue->lte_frame_parms, phy_vars_ue->ulsch_ue[eNB_id]); @@ -951,8 +951,8 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #else AMP, #endif - phy_vars_ue->frame, - (next_slot>>1), + frame_tx, + subframe_tx, &phy_vars_ue->lte_frame_parms, phy_vars_ue->ulsch_ue[eNB_id]); @@ -961,7 +961,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB } if (abstraction_flag==1) { // clear SR - phy_vars_ue->sr[next_slot>>1]=0; + phy_vars_ue->sr[subframe_tx]=0; } } // ULSCH is active else if ((phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->subframe_cba_scheduling_flag == 1) && @@ -974,19 +974,19 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB access_mode=CBA_ACCESS; LOG_I(PHY,"[UE %d] Frame %d, subframe %d: CBA num dci %d \n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,(next_slot>>1), - phy_vars_ue->ulsch_ue[eNB_id]->num_cba_dci[(next_slot>>1)]); + Mod_id,frame_tx,subframe_tx, + phy_vars_ue->ulsch_ue[eNB_id]->num_cba_dci[subframe_tx]); - mac_xface->ue_get_sdu(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame, - (next_slot>>1), + mac_xface->ue_get_sdu(Mod_id, + CC_id, + frame_tx, + subframe_tx, eNB_id, ulsch_input_buffer, input_buffer_length, &access_mode); - phy_vars_ue->ulsch_ue[eNB_id]->num_cba_dci[(next_slot>>1)]=0; + phy_vars_ue->ulsch_ue[eNB_id]->num_cba_dci[subframe_tx]=0; if (access_mode > UNKNOWN_ACCESS){ @@ -1012,17 +1012,17 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->status= IDLE; //reset_cba_uci(phy_vars_ue->ulsch_ue[eNB_id]->o); LOG_N(PHY,"[UE %d] Frame %d, subframe %d: CBA transmission cancelled or postponed\n", - phy_vars_ue->Mod_id, phy_vars_ue->frame,(next_slot>>1)); + Mod_id, frame_tx,subframe_tx); } } #ifdef PUCCH else if (phy_vars_ue->UE_mode[eNB_id] == PUSCH){ // check if we need to use PUCCH 1a/1b - // debug_LOG_D(PHY,"[UE%d] Frame %d, subframe %d: Checking for PUCCH 1a/1b\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1); + // debug_LOG_D(PHY,"[UE%d] Frame %d, subframe %d: Checking for PUCCH 1a/1b\n",Mod_id,frame_tx,subframe_tx); bundling_flag = phy_vars_ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; if ((frame_parms->frame_type==FDD) || (bundling_flag==bundling) || - ((frame_parms->frame_type==TDD)&&(frame_parms->tdd_config==1)&&((next_slot!=4)||(next_slot!=14)))) { + ((frame_parms->frame_type==TDD)&&(frame_parms->tdd_config==1)&&((slot_tx!=4)||(slot_tx!=14)))) { format = pucch_format1a; LOG_D(PHY,"[UE] PUCCH 1a\n"); } @@ -1032,16 +1032,16 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB } // Check for SR and do ACK/NACK accordingly - if (is_SR_TXOp(phy_vars_ue,eNB_id,next_slot>>1)==1) { + if (is_SR_TXOp(phy_vars_ue,eNB_id,subframe_tx)==1) { LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d: got SR_TXOp, Checking for SR for PUSCH from MAC\n", - phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame+(next_slot==0)?1:0,next_slot>>1); + Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,frame_tx,subframe_tx); #ifdef OPENAIR2 - SR_payload = mac_xface->ue_get_SR(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame, + SR_payload = mac_xface->ue_get_SR(Mod_id, + CC_id, + frame_tx, eNB_id, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti, - next_slot>>1); // subframe used for meas gap + subframe_tx); // subframe used for meas gap #else SR_payload = 1; #endif @@ -1049,10 +1049,10 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB if (SR_payload>0) { generate_ul_signal = 1; LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d got the SR for PUSCH is %d\n", - phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame+(next_slot==0)?1:0,next_slot>>1,SR_payload); + Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,frame_tx,subframe_tx,SR_payload); } else { - phy_vars_ue->sr[next_slot>>1]=0; + phy_vars_ue->sr[subframe_tx]=0; } } else @@ -1060,19 +1060,19 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB if (get_ack(&phy_vars_ue->lte_frame_parms, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_ack, - (next_slot>>1),pucch_ack_payload) > 0) { + subframe_tx,pucch_ack_payload) > 0) { // we need to transmit ACK/NAK in this subframe generate_ul_signal = 1; n1_pucch = get_n1_pucch(phy_vars_ue, eNB_id, - next_slot>>1, + subframe_tx, pucch_ack_payload, SR_payload); #ifdef OPENAIR2 - Po_PUCCH = pucch_power_cntl(phy_vars_ue,(next_slot>>1),eNB_id,format); + Po_PUCCH = pucch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,format); phy_vars_ue->tx_power_dBm = Po_PUCCH; #else phy_vars_ue->tx_power_dBm = UE_TX_POWER; @@ -1081,9 +1081,9 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB if (SR_payload>0) { LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b (with SR for PUSCH), n1_pucch %d, Po_PUCCH, amp %d\n", - phy_vars_ue->Mod_id, + Mod_id, phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, - phy_vars_ue->frame+(next_slot==0)?1:0, next_slot>>1, + frame_tx, subframe_tx, phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, Po_PUCCH, #ifdef EXMIMO @@ -1095,9 +1095,9 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB } else { LOG_I(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH 1a/1b, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", - phy_vars_ue->Mod_id, + Mod_id, phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, - phy_vars_ue->frame, next_slot>>1, + frame_tx, subframe_tx, n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload, Po_PUCCH, #ifdef EXMIMO @@ -1124,7 +1124,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #else AMP, #endif - next_slot>>1); + subframe_tx); } else { @@ -1135,14 +1135,14 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB phy_vars_ue->lte_frame_parms.pucch_config_common.nCS_AN, pucch_ack_payload, SR_payload, - next_slot>>1); + subframe_tx); #endif } } else if (SR_payload==1) { // no ACK/NAK but SR is triggered by MAC #ifdef OPENAIR2 - Po_PUCCH = pucch_power_cntl(phy_vars_ue,(next_slot>>1),eNB_id,pucch_format1); + Po_PUCCH = pucch_power_cntl(phy_vars_ue,subframe_tx,eNB_id,pucch_format1); phy_vars_ue->tx_power_dBm = Po_PUCCH; #else phy_vars_ue->tx_power_dBm = UE_TX_POWER; @@ -1150,9 +1150,9 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB phy_vars_ue->tx_total_RE = 12; LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), n1_pucch %d, Po_PUCCH %d\n", - phy_vars_ue->Mod_id, + Mod_id, phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, - phy_vars_ue->frame+(next_slot==0)?1:0, next_slot>>1, + frame_tx, subframe_tx, phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, Po_PUCCH); @@ -1172,7 +1172,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #else AMP, #endif - next_slot>>1); + subframe_tx); } else { LOG_D(PHY,"Calling generate_pucch_emul ...\n"); @@ -1181,7 +1181,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB phy_vars_ue->lte_frame_parms.pucch_config_common.nCS_AN, pucch_ack_payload, SR_payload, - next_slot>>1); + subframe_tx); } } } @@ -1191,19 +1191,18 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB if (abstraction_flag == 0) { if (generate_ul_signal == 1 ) { - subframe = next_slot>>1; nsymb = (frame_parms->Ncp == 0) ? 14 : 12; #ifdef EXMIMO //this is the EXPRESS MIMO case - ulsch_start = (phy_vars_ue->rx_offset+subframe*frame_parms->samples_per_tti-openair_daq_vars.timing_advance-phy_vars_ue->timing_advance+5)%(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); + ulsch_start = (phy_vars_ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-openair_daq_vars.timing_advance-phy_vars_ue->timing_advance+5)%(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); #else //this is the normal case - ulsch_start = (frame_parms->samples_per_tti*subframe); + ulsch_start = (frame_parms->samples_per_tti*subframe_tx); #endif //else EXMIMO start_meas(&phy_vars_ue->ofdm_mod_stats); for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++) { if (frame_parms->Ncp == 1) - PHY_ofdm_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe*nsymb*frame_parms->ofdm_symbol_size], + PHY_ofdm_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], #ifdef EXMIMO dummy_tx_buffer, #else @@ -1216,7 +1215,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB frame_parms->rev, CYCLIC_PREFIX); else - normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe*nsymb*frame_parms->ofdm_symbol_size], + normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], #ifdef EXMIMO dummy_tx_buffer, #else @@ -1226,7 +1225,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB &phy_vars_ue->lte_frame_parms); /* - if ((next_slot>>1) == 8) { + if (subframe_tx == 8) { printf("Symbol 0 %p (offset %d) base %p\n", &phy_vars_ue->lte_ue_common_vars.txdataF[0][nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*subframe], nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*subframe, @@ -1246,7 +1245,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB apply_7_5_kHz(phy_vars_ue,&phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],1); #endif /* - if ((next_slot>>1) == 8) { + if (subframe_tx == 8) { write_output("txsig8_mod.m","txs8_mod", &phy_vars_ue->lte_ue_common_vars.txdata[0][phy_vars_ue->lte_frame_parms.samples_per_tti*subframe], phy_vars_ue->lte_frame_parms.samples_per_tti,1,1); } @@ -1255,7 +1254,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #ifdef EXMIMO overflow = ulsch_start - 9*frame_parms->samples_per_tti; - //if ((next_slot==4) && (aa==0)) printf("ulsch_start %d, overflow %d\n",ulsch_start,overflow); + //if ((slot_tx==4) && (aa==0)) printf("ulsch_start %d, overflow %d\n",ulsch_start,overflow); for (k=ulsch_start,l=0; k<cmin(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,ulsch_start+frame_parms->samples_per_tti); k++,l++) { ((short*)phy_vars_ue->lte_ue_common_vars.txdata[aa])[2*k] = ((short*)dummy_tx_buffer)[2*l]<<4; @@ -1273,8 +1272,8 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB } // generate_ul_signal == 1 } } // mode != PRACH - // }// next_slot is even - // else { // next_slot is odd, do the PRACH here + // }// slot_tx is even + // else { // slot_tx is odd, do the PRACH here #ifdef OPENAIR2 if ((phy_vars_ue->UE_mode[eNB_id] == PRACH) && (phy_vars_ue->lte_frame_parms.prach_config_common.prach_Config_enabled==1)) { @@ -1282,18 +1281,18 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB if (1) { #endif // check if we have PRACH opportunity - if (is_prach_subframe(&phy_vars_ue->lte_frame_parms,phy_vars_ue->frame,next_slot>>1)) { - LOG_D(PHY,"UE %d: Frame %d, SF %d Clearing generate_prach\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1); + if (is_prach_subframe(&phy_vars_ue->lte_frame_parms,frame_tx,subframe_tx)) { + LOG_D(PHY,"UE %d: Frame %d, SF %d Clearing generate_prach\n",Mod_id,frame_tx,subframe_tx); phy_vars_ue->generate_prach=0; #ifdef OPENAIR2 // ask L2 for RACH transport if ((mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) && (mode != no_L2_connect) ){ - phy_vars_ue->prach_resources[eNB_id] = mac_xface->ue_get_rach(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame, + phy_vars_ue->prach_resources[eNB_id] = mac_xface->ue_get_rach(Mod_id, + CC_id, + frame_tx, eNB_id, - next_slot>>1); - LOG_D(PHY,"Got prach_resources for eNB %d address %d, RRCCommon %d\n",eNB_id,phy_vars_ue->prach_resources[eNB_id],UE_mac_inst[phy_vars_ue->Mod_id].radioResourceConfigCommon); + subframe_tx); + LOG_D(PHY,"Got prach_resources for eNB %d address %d, RRCCommon %d\n",eNB_id,phy_vars_ue->prach_resources[eNB_id],UE_mac_inst[Mod_id].radioResourceConfigCommon); } #endif if (phy_vars_ue->prach_resources[eNB_id]!=NULL) { @@ -1308,16 +1307,16 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB #endif if (abstraction_flag == 0) { LOG_D(PHY,"[UE %d][RAPROC] Frame %d, Subframe %d : Generating PRACH, preamble %d, TARGET_RECEIVED_POWER %d dBm, PRACH TDD Resource index %d, RA-RNTI %d\n", - phy_vars_ue->Mod_id, - phy_vars_ue->frame, - next_slot>>1, + Mod_id, + frame_tx, + subframe_tx, phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex, phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER, phy_vars_ue->prach_resources[eNB_id]->ra_TDD_map_index, phy_vars_ue->prach_resources[eNB_id]->ra_RNTI); #ifdef OPENAIR2 - phy_vars_ue->tx_power_dBm = phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(phy_vars_ue->Mod_id,CC_id,eNB_id); + phy_vars_ue->tx_power_dBm = phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(Mod_id,CC_id,eNB_id); #else phy_vars_ue->tx_power_dBm = UE_TX_POWER; #endif @@ -1330,35 +1329,35 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = AMP; #endif start_meas(&phy_vars_ue->tx_prach); - prach_power = generate_prach(phy_vars_ue,eNB_id,next_slot>>1,phy_vars_ue->frame); + prach_power = generate_prach(phy_vars_ue,eNB_id,subframe_tx,frame_tx); stop_meas(&phy_vars_ue->tx_prach); LOG_D(PHY,"[UE %d][RAPROC] PRACH PL %d dB, power %d dBm, digital power %d dB (amp %d)\n", - phy_vars_ue->Mod_id, - get_PL(phy_vars_ue->Mod_id,CC_id,eNB_id), + Mod_id, + get_PL(Mod_id,CC_id,eNB_id), phy_vars_ue->tx_power_dBm, dB_fixed(prach_power), phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp); } else { - UE_transport_info[phy_vars_ue->Mod_id][CC_id].cntl.prach_flag=1; - UE_transport_info[phy_vars_ue->Mod_id][CC_id].cntl.prach_id=phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex; + UE_transport_info[Mod_id][CC_id].cntl.prach_flag=1; + UE_transport_info[Mod_id][CC_id].cntl.prach_id=phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex; #ifdef OPENAIR2 - mac_xface->Msg1_transmitted(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame, + mac_xface->Msg1_transmitted(Mod_id, + CC_id, + frame_tx, eNB_id); #endif } LOG_D(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1,eNB_id, + Mod_id,frame_tx,subframe_tx,eNB_id, phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex, - phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(phy_vars_ue->Mod_id,CC_id,eNB_id), - get_PL(phy_vars_ue->Mod_id,CC_id,eNB_id)); + phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(Mod_id,CC_id,eNB_id), + get_PL(Mod_id,CC_id,eNB_id)); } } LOG_D(PHY,"[UE %d] frame %d subframe %d : generate_prach %d, prach_cnt %d\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1,phy_vars_ue->generate_prach,phy_vars_ue->prach_cnt); + Mod_id,frame_tx,subframe_tx,phy_vars_ue->generate_prach,phy_vars_ue->prach_cnt); phy_vars_ue->prach_cnt++; if (phy_vars_ue->prach_cnt==3) @@ -1367,12 +1366,12 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB else { phy_vars_ue->generate_prach=0; } - } // next_slot is even + } // slot_tx is even vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); stop_meas(&phy_vars_ue->phy_proc_tx); } -void phy_procedures_UE_S_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,relaying_type_t r_type) { +void phy_procedures_UE_S_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,relaying_type_t r_type) { int aa;//i,aa; LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms; @@ -1399,7 +1398,7 @@ void phy_procedures_UE_S_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t e } } -void lte_ue_measurement_procedures(uint8_t last_slot, uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode) { +void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode) { LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms; // int aa; @@ -1407,6 +1406,10 @@ void lte_ue_measurement_procedures(uint8_t last_slot, uint16_t l, PHY_VARS_UE *p exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr; int aa; #endif + int Mod_id=phy_vars_ue->Mod_id; + int frame_rx = phy_vars_ue->frame_rx; + int slot_rx = phy_vars_ue->slot_rx; + int subframe_rx = slot_rx>>1; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_MEASUREMENT_PROCEDURES, VCD_FUNCTION_IN); @@ -1415,14 +1418,14 @@ void lte_ue_measurement_procedures(uint8_t last_slot, uint16_t l, PHY_VARS_UE *p uint8_t aa; // first slot in frame is special - if (((last_slot==0) || (last_slot==1) || (last_slot==12) || (last_slot==13)) && + if (((slot_rx==0) || (slot_rx==1) || (slot_rx==12) || (slot_rx==13)) && ((l==0) || (l==4-frame_parms->Ncp))) { for (eNB_id=0; eNB_id<3; eNB_id++) for (aa=0;aa<frame_parms->nb_antennas_tx_eNB;aa++) lte_dl_channel_estimation_emos(emos_dump_UE.channel[eNB_id], phy_vars_ue->lte_ue_common_vars->rxdataF, &phy_vars_ue->lte_frame_parms, - last_slot, + slot_rx, aa, l, eNB_id); @@ -1436,8 +1439,8 @@ void lte_ue_measurement_procedures(uint8_t last_slot, uint16_t l, PHY_VARS_UE *p //LOG_D(PHY,"Calling measurements with rxdata %p\n",phy_vars_ue->lte_ue_common_vars.rxdata); lte_ue_measurements(phy_vars_ue, - ((last_slot>>1)*frame_parms->samples_per_tti+phy_vars_ue->rx_offset)%(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME), - (last_slot == 2) ? 1 : 0, + (subframe_rx*frame_parms->samples_per_tti+phy_vars_ue->rx_offset)%(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME), + (slot_rx == 2) ? 1 : 0, 0); } else { @@ -1448,12 +1451,12 @@ void lte_ue_measurement_procedures(uint8_t last_slot, uint16_t l, PHY_VARS_UE *p } #ifdef DEBUG_PHY_PROC - if ((last_slot == 2)) { // && (phy_vars_ue->frame%100==0)) { + if ((slot_rx == 2)) { // && (phy_vars_ue->frame%100==0)) { - LOG_D(PHY,"[UE %d] frame %d, slot %d, freq_offset_filt = %d \n",phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot, phy_vars_ue->lte_ue_common_vars.freq_offset); + LOG_D(PHY,"[UE %d] frame %d, slot %d, freq_offset_filt = %d \n",Mod_id,phy_vars_ue->frame_tx, slot_rx, phy_vars_ue->lte_ue_common_vars.freq_offset); /* LOG_I(PHY,"[UE %d] frame %d, slot %d, RX RSSI (%d,%d,%d) dBm, digital (%d,%d)(%d,%d)(%d,%d) dB, linear (%d,%d), avg rx power %d dB (%d lin), N0 %d dB (%d lin), RX gain %d dB\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot, + Mod_id,phy_vars_ue->frame, slot_rx, phy_vars_ue->PHY_measurements.rx_rssi_dBm[0], phy_vars_ue->PHY_measurements.rx_rssi_dBm[1], phy_vars_ue->PHY_measurements.rx_rssi_dBm[2], @@ -1472,7 +1475,7 @@ void lte_ue_measurement_procedures(uint8_t last_slot, uint16_t l, PHY_VARS_UE *p phy_vars_ue->rx_total_gain_dB); LOG_I(PHY,"[UE %d] frame %d, slot %d, N0 %d dBm digital (%d, %d) dB, linear (%d, %d), avg noise power %d dB (%d lin)\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot, + Mod_id,phy_vars_ue->frame, slot_rx, phy_vars_ue->PHY_measurements.n0_power_tot_dBm, phy_vars_ue->PHY_measurements.n0_power_dB[0], phy_vars_ue->PHY_measurements.n0_power_dB[1], @@ -1488,14 +1491,14 @@ void lte_ue_measurement_procedures(uint8_t last_slot, uint16_t l, PHY_VARS_UE *p ue_rrc_measurements(phy_vars_ue, - last_slot, + slot_rx, abstraction_flag); phy_vars_ue->sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, 0); } - if ((last_slot==1) && (l==(4-frame_parms->Ncp))) { + if ((slot_rx==1) && (l==(4-frame_parms->Ncp))) { // AGC #ifdef EXMIMO @@ -1520,7 +1523,7 @@ void lte_ue_measurement_procedures(uint8_t last_slot, uint16_t l, PHY_VARS_UE *p 16384); if (openair_daq_vars.auto_freq_correction == 1) { - if (phy_vars_ue->frame % 100 == 0) { + if (frame_rx % 100 == 0) { if ((phy_vars_ue->lte_ue_common_vars.freq_offset>100) && (openair_daq_vars.freq_offset < 1000)) { openair_daq_vars.freq_offset+=100; #if defined(EXMIMO) && defined(DRIVER2013) @@ -1552,6 +1555,7 @@ void phy_procedures_emos_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t last_slot,uint8_ uint8_t i,j; //uint16_t last_slot_emos; uint32_t bytes; + int Mod_id = phy_vars_ue->Mod_id; /* if (last_slot<2) @@ -1616,11 +1620,11 @@ void phy_procedures_emos_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t last_slot,uint8_ bytes = rtf_put(CHANSOUNDER_FIFO_MINOR, &emos_dump_UE, sizeof(fifo_dump_emos_UE)); if (bytes!=sizeof(fifo_dump_emos_UE)) { - LOG_W(PHY,"[UE %d] frame %d, slot %d, Problem writing EMOS data to FIFO\n",phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot); + LOG_W(PHY,"[UE %d] frame %d, slot %d, Problem writing EMOS data to FIFO\n",Mod_id,phy_vars_ue->frame, last_slot); } else { if (phy_vars_ue->frame%100==0) { - LOG_I(PHY,"[UE %d] frame %d, slot %d, Writing %d bytes EMOS data to FIFO\n",phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot, bytes); + LOG_I(PHY,"[UE %d] frame %d, slot %d, Writing %d bytes EMOS data to FIFO\n",Mod_id,phy_vars_ue->frame, last_slot, bytes); } } } @@ -1633,7 +1637,7 @@ void restart_phy(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_fla // uint8_t last_slot; uint8_t i; - LOG_D(PHY,"[UE %d] frame %d, slot %d, restarting PHY!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame); + LOG_D(PHY,"[UE %d] frame %d, slot %d, restarting PHY!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,phy_vars_ue->slot_rx); mac_xface->macphy_exit(""); // first_run = 1; @@ -1646,7 +1650,8 @@ void restart_phy(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_fla phy_vars_ue->UE_mode[eNB_id] = PRACH; phy_vars_ue->prach_resources[eNB_id]=NULL; } - phy_vars_ue->frame = -1; + phy_vars_ue->frame_rx = -1; + phy_vars_ue->frame_tx = -1; openair_daq_vars.synch_wait_cnt=0; openair_daq_vars.sched_cnt=-1; #if defined(EXMIMO) || defined(CBMIMO1) @@ -1688,7 +1693,7 @@ void restart_phy(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_fla } -void lte_ue_pbch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_vars_ue,uint8_t abstraction_flag) { +void lte_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abstraction_flag) { // int i; int pbch_tx_ant=0; @@ -1696,15 +1701,17 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v uint16_t frame_tx; static uint8_t first_run = 1; uint8_t pbch_trials = 0; + int slot_rx = phy_vars_ue->slot_rx; + int frame_rx = phy_vars_ue->frame_rx; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN); - pbch_phase=(phy_vars_ue->frame%4); + pbch_phase=(frame_rx%4); if (pbch_phase>=4) pbch_phase=0; for (pbch_trials=0;pbch_trials<4;pbch_trials++) { //for (pbch_phase=0;pbch_phase<4;pbch_phase++) { - //LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,pbch_phase,phy_vars_ue->lte_frame_parms.Nid_cell,eNB_id); + //LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, eNB_id %d)\n",phy_vars_ue->Mod_id,frame_rx,pbch_phase,phy_vars_ue->lte_frame_parms.Nid_cell,eNB_id); if (abstraction_flag == 0) { pbch_tx_ant = rx_pbch(&phy_vars_ue->lte_ue_common_vars, phy_vars_ue->lte_ue_pbch_vars[eNB_id], @@ -1749,7 +1756,7 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v frame_tx += pbch_phase; #ifdef OPENAIR2 - mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,phy_vars_ue->frame,eNB_id, + mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,frame_rx,eNB_id, phy_vars_ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0); #endif @@ -1762,40 +1769,44 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v first_run = 0; LOG_I(PHY,"[UE %d] frame %d, slot %d: Adjusting frame counter (PBCH ant_tx=%d, frame_tx=%d, phase %d).\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame, - last_slot, + frame_rx, + slot_rx, pbch_tx_ant, frame_tx, pbch_phase); - phy_vars_ue->frame = (phy_vars_ue->frame & 0xFFFFFC00) | (frame_tx & 0x000003FF); + phy_vars_ue->frame_rx = (phy_vars_ue->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF); + phy_vars_ue->frame_tx = phy_vars_ue->frame_rx; + frame_rx = phy_vars_ue->frame_rx; } else - if (((frame_tx & 0x03FF) != (phy_vars_ue->frame & 0x03FF))) { + if (((frame_tx & 0x03FF) != (phy_vars_ue->frame_rx & 0x03FF))) { //(pbch_tx_ant != phy_vars_ue->lte_frame_parms.nb_antennas_tx)) { - LOG_D(PHY,"[UE %d] frame %d, slot %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_tx=%d, frame%1024=%d, phase %d).\n", + LOG_D(PHY,"[UE %d] frame %d, slot %d: Re-adjusting frame counter (PBCH ant_tx=%d, frame_rx=%d, frame%1024=%d, phase %d).\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame, - last_slot, + phy_vars_ue->frame_rx, + slot_rx, pbch_tx_ant, frame_tx, - phy_vars_ue->frame & 0x03FF, + frame_rx & 0x03FF, pbch_phase); /* #if defined(CBMIMO) || defined(EXMIMO) for (i=0;i<20;i++){ - LOG_D(PHY,"slot %d: frame %d, hw_slot %d, last_slot %d, next_slot %d, time0 %llu, time1 %llu, time2 %llu, mbox0 %d, mbox1 %d, mbox2 %d, mbox_target %d\n", - i, timing_info[i].frame, timing_info[i].hw_slot, timing_info[i].last_slot, timing_info[i].next_slot, + LOG_D(PHY,"slot %d: frame %d, hw_slot %d, slot_rx %d, next_slot %d, time0 %llu, time1 %llu, time2 %llu, mbox0 %d, mbox1 %d, mbox2 %d, mbox_target %d\n", + i, timing_info[i].frame, timing_info[i].hw_slot, timing_info[i].slot_rx, timing_info[i].next_slot, timing_info[i].time0, timing_info[i].time1, timing_info[i].time2, timing_info[i].mbox0, timing_info[i].mbox1, timing_info[i].mbox2, timing_info[i].mbox_target); } #endif */ - phy_vars_ue->frame = (phy_vars_ue->frame & 0xFFFFFC00) | (frame_tx & 0x000003FF); + phy_vars_ue->frame_rx = (phy_vars_ue->frame_rx & 0xFFFFFC00) | (frame_tx & 0x000003FF); + phy_vars_ue->frame_tx = phy_vars_ue->frame_rx; + frame_rx = phy_vars_ue->frame_rx; /* LOG_D(PHY,"[UE %d] frame %d, slot %d: PBCH PDU does not match, ignoring it (PBCH ant_tx=%d, frame_tx=%d).\n", phy_vars_ue->Mod_id, phy_vars_ue->frame, - last_slot, + slot_rx, pbch_tx_ant, frame_tx); */ @@ -1806,19 +1817,19 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifdef DEBUG_PHY_PROC LOG_D(PHY,"[UE %d] frame %d, slot %d, Received PBCH (MIB): mode1_flag %d, tx_ant %d, frame_tx %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6!\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame, - last_slot, + frame_rx, + slot_rx, phy_vars_ue->lte_frame_parms.mode1_flag, pbch_tx_ant, frame_tx, phy_vars_ue->lte_frame_parms.N_RB_DL, phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration, phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource); - if ((phy_vars_ue->frame%100==0)&&(phy_vars_ue!=NULL)) { + if ((frame_rx%100==0)&&(phy_vars_ue!=NULL)) { LOG_I(PHY,"[UE %d] frame %d, slot %d, PBCH: mode1_flag %d, tx_ant %d, frame_tx %d, phase %d. N_RB_DL %d, phich_duration %d, phich_resource %d/6\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame, - last_slot, + frame_rx, + slot_rx, phy_vars_ue->lte_frame_parms.mode1_flag, pbch_tx_ant, frame_tx, @@ -1833,11 +1844,11 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } else { LOG_E(PHY,"[UE %d] frame %d, slot %d, Error decoding PBCH!\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot); + phy_vars_ue->Mod_id,frame_rx, slot_rx); phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_conseq++; phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors++; #ifdef OPENAIR2 - mac_xface->out_of_sync_ind(phy_vars_ue->Mod_id,phy_vars_ue->frame,eNB_id); + mac_xface->out_of_sync_ind(phy_vars_ue->Mod_id,frame_rx,eNB_id); #else if (phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_conseq>=100) { LOG_E(PHY,"More that 100 consecutive PBCH errors! Exiting!\n"); @@ -1846,34 +1857,38 @@ void lte_ue_pbch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #endif } - if (phy_vars_ue->frame % 100 == 0) { + if (frame_rx % 100 == 0) { phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_fer = phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors - phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_last; phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_last = phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors; } #ifdef DEBUG_PHY_PROC LOG_D(PHY,"[UE %d] frame %d, slot %d, PBCH errors = %d, consecutive errors = %d!\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot, + phy_vars_ue->Mod_id,frame_rx, slot_rx, phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors, phy_vars_ue->lte_ue_pbch_vars[eNB_id]->pdu_errors_conseq); #endif vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT); } -int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_vars_ue,uint8_t abstraction_flag) { +int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abstraction_flag) { unsigned int dci_cnt=0, i; //DCI_PDU *DCI_pdu; //uint16_t ra_RNTI; uint8_t harq_pid; - int8_t UE_id; - uint8_t CC_id; + int UE_id; + int CC_id; + int frame_rx = phy_vars_ue->frame_rx; + int slot_rx = phy_vars_ue->slot_rx; + int subframe_rx = slot_rx>>1; + vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_IN); /* #ifdef DEBUG_PHY_PROC - debug_LOG_D(PHY,"[UE %d] Frame %d, slot %d (%d): DCI decoding crnti %x (mi %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot,last_slot>>1,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,get_mi(&phy_vars_ue->lte_frame_parms,last_slot>>1)); + debug_LOG_D(PHY,"[UE %d] Frame %d, slot %d (%d): DCI decoding crnti %x (mi %d)\n",phy_vars_ue->Mod_id,frame_rx,slot_rx,subframe_rx,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,get_mi(&phy_vars_ue->lte_frame_parms,subframe_rx)); #endif */ if (abstraction_flag == 0) { @@ -1882,7 +1897,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v rx_pdcch(&phy_vars_ue->lte_ue_common_vars, phy_vars_ue->lte_ue_pdcch_vars, &phy_vars_ue->lte_frame_parms, - last_slot>>1, + subframe_rx, eNB_id, (phy_vars_ue->lte_frame_parms.mode1_flag == 1) ? SISO : ALAMOUTI, phy_vars_ue->is_secondary_ue); @@ -1892,13 +1907,13 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v dci_alloc_rx, (phy_vars_ue->UE_mode[eNB_id] < PUSCH)? 1 : 0, // if we're in PUSCH don't listen to common search space, // later when we need paging or RA during connection, update this ... - eNB_id,last_slot>>1); + eNB_id,subframe_rx); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT); - //LOG_D(PHY,"[UE %d][PUSCH] Frame %d subframe %d PHICH RX\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1); + //LOG_D(PHY,"[UE %d][PUSCH] Frame %d subframe %d PHICH RX\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx); - if (is_phich_subframe(&phy_vars_ue->lte_frame_parms,last_slot>>1)) { + if (is_phich_subframe(&phy_vars_ue->lte_frame_parms,subframe_rx)) { rx_phich(phy_vars_ue, - last_slot>>1,eNB_id); + subframe_rx,eNB_id); } } #ifdef PHY_ABSTRACTION @@ -1918,17 +1933,17 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } LOG_D(PHY,"Calling dci_decoding_proc_emul ...\n"); dci_cnt = dci_decoding_procedure_emul(phy_vars_ue->lte_ue_pdcch_vars, - PHY_vars_eNB_g[i][CC_id]->num_ue_spec_dci[(last_slot>>1)&1], - PHY_vars_eNB_g[i][CC_id]->num_common_dci[(last_slot>>1)&1], - PHY_vars_eNB_g[i][CC_id]->dci_alloc[(last_slot>>1)&1], + PHY_vars_eNB_g[i][CC_id]->num_ue_spec_dci[subframe_rx&1], + PHY_vars_eNB_g[i][CC_id]->num_common_dci[subframe_rx&1], + PHY_vars_eNB_g[i][CC_id]->dci_alloc[subframe_rx&1], dci_alloc_rx, eNB_id); // printf("DCI: dci_cnt %d\n",dci_cnt); UE_id = (uint32_t)find_ue((int16_t)phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,PHY_vars_eNB_g[i][CC_id]); if (UE_id>=0) { // msg("Checking PHICH for UE %d (eNB %d)\n",UE_id,i); - if (is_phich_subframe(&phy_vars_ue->lte_frame_parms,last_slot>>1)) { - harq_pid = phich_subframe_to_harq_pid(&phy_vars_ue->lte_frame_parms,phy_vars_ue->frame,last_slot>>1); + if (is_phich_subframe(&phy_vars_ue->lte_frame_parms,subframe_rx)) { + harq_pid = phich_subframe_to_harq_pid(&phy_vars_ue->lte_frame_parms,frame_rx,subframe_rx); if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->status == ACTIVE) { // phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->phich_ACK=1; phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag =0; @@ -1942,12 +1957,12 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifdef DEBUG_PHY_PROC LOG_D(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Msg3 PHICH, received NAK\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame, - last_slot>>1); + frame_rx, + subframe_rx); #endif get_Msg3_alloc_ret(&phy_vars_ue->lte_frame_parms, - last_slot>>1, - phy_vars_ue->frame, + subframe_rx, + frame_rx, &phy_vars_ue->ulsch_ue_Msg3_frame[eNB_id], &phy_vars_ue->ulsch_ue_Msg3_subframe[eNB_id]); } @@ -1960,8 +1975,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v if (phy_vars_ue->ulsch_ue_Msg3_active[eNB_id] == 1) LOG_D(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Msg3 PHICH, received ACK\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame, - last_slot>>1); + frame_rx, + subframe_rx); #endif PHY_vars_eNB_g[i][CC_id]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag =0; PHY_vars_eNB_g[i][CC_id]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->status = IDLE; @@ -1975,15 +1990,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #endif #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[UE %d] Frame %d, slot %d, Mode %s: DCI found %i\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot,mode_string[phy_vars_ue->UE_mode[eNB_id]],dci_cnt); + LOG_D(PHY,"[UE %d] Frame %d, slot %d, Mode %s: DCI found %i\n",phy_vars_ue->Mod_id,frame_rx,slot_rx,mode_string[phy_vars_ue->UE_mode[eNB_id]],dci_cnt); #endif phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_received += dci_cnt; /* #ifdef DEBUG_PHY_PROC - if (last_slot==18) + if (slot_rx==18) debug_LOG_D(PHY,"[UE %d] Frame %d, slot %d: PDCCH: DCI errors %d, DCI received %d, DCI missed %d, DCI False Detection %d \n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot, + phy_vars_ue->Mod_id,frame_rx,slot_rx, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_errors, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_received, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_missed, @@ -1991,18 +2006,18 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #endif */ #ifdef EMOS - //emos_dump_UE.dci_cnt[last_slot>>1] = dci_cnt; + //emos_dump_UE.dci_cnt[subframe_rx] = dci_cnt; #endif /* #ifdef DIAG_PHY //if (phy_vars_ue->UE_mode[eNB_id] == PUSCH) if (dci_cnt > 1) { - LOG_D(PHY,"[UE %d][DIAG] frame %d, subframe %d: received %d>1 DCI!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1,dci_cnt); + LOG_D(PHY,"[UE %d][DIAG] frame %d, subframe %d: received %d>1 DCI!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx,dci_cnt); phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_false++; } else if (dci_cnt==0) { - LOG_D(PHY,"[UE %d][DIAG] frame %d, subframe %d: received %d DCI!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1,dci_cnt); + LOG_D(PHY,"[UE %d][DIAG] frame %d, subframe %d: received %d DCI!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx,dci_cnt); phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_missed++; } #endif @@ -2013,8 +2028,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v for (i=0;i<dci_cnt;i++){ #ifdef DEBUG_PHY_PROC - if ((last_slot>>1) == 9) { //( phy_vars_ue->frame % 100 == 0) { - LOG_D(PHY,"frame %d, subframe %d, rnti %x: dci %d/%d\n",phy_vars_ue->frame,last_slot>>1,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,i,dci_cnt); + if (subframe_rx == 9) { //( frame_rx % 100 == 0) { + LOG_D(PHY,"frame %d, subframe %d, rnti %x: dci %d/%d\n",frame_rx,subframe_rx,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,i,dci_cnt); //dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); } #endif @@ -2026,22 +2041,22 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifdef DEBUG_PHY_PROC LOG_I(PHY,"[UE %d][DCI][PDSCH %x] frame %d, subframe %d: format %d, num_pdcch_symbols %d, nCCE %d, total CCEs %d\n", phy_vars_ue->Mod_id,dci_alloc_rx[i].rnti, - phy_vars_ue->frame,last_slot>>1, + frame_rx,subframe_rx, dci_alloc_rx[i].format, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->nCCE[last_slot>>1], + phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->nCCE[subframe_rx], get_nCCE(3,&phy_vars_ue->lte_frame_parms,get_mi(&phy_vars_ue->lte_frame_parms,0))); /* - if (((phy_vars_ue->frame%100) == 0) || (phy_vars_ue->frame < 20)) + if (((frame_rx%100) == 0) || (frame_rx < 20)) dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); */ #endif #ifdef DIAG_PHY - if (!((((last_slot>>1) == 7) && (dci_alloc_rx[i].format == format1E_2A_M10PRB)) || - (((last_slot>>1) == 7) && (dci_alloc_rx[i].format == format1)))) { - LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received C_RNTI Format %d!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1,dci_alloc_rx[i].format); + if (!(((subframe_rx == 7) && (dci_alloc_rx[i].format == format1E_2A_M10PRB)) || + ((subframe_rx == 7) && (dci_alloc_rx[i].format == format1)))) { + LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received C_RNTI Format %d!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format); phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_errors++; phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_false++; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT); @@ -2050,7 +2065,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #endif - if (generate_ue_dlsch_params_from_dci(last_slot>>1, + if (generate_ue_dlsch_params_from_dci(subframe_rx, (void *)&dci_alloc_rx[i].dci_pdu, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti, dci_alloc_rx[i].format, @@ -2062,8 +2077,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v P_RNTI)==0) { #ifdef DIAG_PHY - if (phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->mcs != (((phy_vars_ue->frame%1024)%28))){ - LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: wrong mcs!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1,phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->mcs); + if (phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->mcs != (((frame_rx%1024)%28))){ + LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: wrong mcs!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx,phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->mcs); dump_dci(&phy_vars_ue->lte_frame_parms,(void *)&dci_alloc_rx[i]); } #endif @@ -2074,13 +2089,13 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifdef DEBUG_PHY_PROC LOG_D(PHY,"[UE %d] Generated UE DLSCH C_RNTI format %d\n",phy_vars_ue->Mod_id,dci_alloc_rx[i].format); dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); - LOG_D(PHY,"[UE %d] *********** dlsch->active in subframe %d (%d)=> %d\n",phy_vars_ue->Mod_id,(last_slot>>1),last_slot,phy_vars_ue->dlsch_ue[eNB_id][0]->active); + LOG_D(PHY,"[UE %d] *********** dlsch->active in subframe %d (%d)=> %d\n",phy_vars_ue->Mod_id,subframe_rx,slot_rx,phy_vars_ue->dlsch_ue[eNB_id][0]->active); #endif // we received a CRNTI, so we're in PUSCH if (phy_vars_ue->UE_mode[eNB_id] != PUSCH) { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti); + LOG_I(PHY,"[UE %d] Frame %d, subframe %d: Received DCI with CRNTI %x => Mode PUSCH\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti); #endif //dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); phy_vars_ue->UE_mode[eNB_id] = PUSCH; @@ -2088,7 +2103,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } } else { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Problem in DCI!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1); + LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Problem in DCI!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx); dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); } } @@ -2097,15 +2112,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v (dci_alloc_rx[i].format == format1A)) { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d] subframe %d: Found rnti %x, format 1A, dci_cnt %d\n",phy_vars_ue->Mod_id,last_slot>>1,dci_alloc_rx[i].rnti,i); + LOG_I(PHY,"[UE %d] subframe %d: Found rnti %x, format 1A, dci_cnt %d\n",phy_vars_ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,i); /* - if (((phy_vars_ue->frame%100) == 0) || (phy_vars_ue->frame < 20)) + if (((frame_rx%100) == 0) || (frame_rx < 20)) dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); */ #endif #ifdef DIAG_PHY - if (((last_slot>>1) != 5)) { - LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received SI_RNTI!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1); + if ((subframe_rx != 5)) { + LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received SI_RNTI!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx); phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_errors++; phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_false++; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT); @@ -2113,7 +2128,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } #endif - if (generate_ue_dlsch_params_from_dci(last_slot>>1, + if (generate_ue_dlsch_params_from_dci(subframe_rx, (void *)&dci_alloc_rx[i].dci_pdu, SI_RNTI, format1A, @@ -2136,15 +2151,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v (dci_alloc_rx[i].rnti == phy_vars_ue->prach_resources[eNB_id]->ra_RNTI) && (dci_alloc_rx[i].format == format1A)) { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d][RAPROC] subframe %d: Found RA rnti %x, format 1A, dci_cnt %d\n",phy_vars_ue->Mod_id,last_slot>>1,dci_alloc_rx[i].rnti,i); + LOG_I(PHY,"[UE %d][RAPROC] subframe %d: Found RA rnti %x, format 1A, dci_cnt %d\n",phy_vars_ue->Mod_id,subframe_rx,dci_alloc_rx[i].rnti,i); - //if (((phy_vars_ue->frame%100) == 0) || (phy_vars_ue->frame < 20)) + //if (((frame_rx%100) == 0) || (frame_rx < 20)) //dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); //mac_xface->macphy_exit("so far so good...\n"); #endif #ifdef DIAG_PHY - if ((last_slot>>1) != 9) { - LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received RA_RNTI!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1); + if (subframe_rx != 9) { + LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received RA_RNTI!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx); phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_errors++; phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_false++; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT); @@ -2152,7 +2167,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } #endif - if (generate_ue_dlsch_params_from_dci(last_slot>>1, + if (generate_ue_dlsch_params_from_dci(subframe_rx, (DCI1A_5MHz_TDD_1_6_t *)&dci_alloc_rx[i].dci_pdu, phy_vars_ue->prach_resources[eNB_id]->ra_RNTI, format1A, @@ -2175,15 +2190,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v (dci_alloc_rx[i].format == format0)) { #ifdef DEBUG_PHY_PROC LOG_I(PHY,"[UE %d][PUSCH] Frame %d subframe %d: Found rnti %x, format 0, dci_cnt %d\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1,dci_alloc_rx[i].rnti,i); + phy_vars_ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].rnti,i); /* - if (((phy_vars_ue->frame%100) == 0) || (phy_vars_ue->frame < 20)) + if (((frame_rx%100) == 0) || (frame_rx < 20)) dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); */ #endif #ifdef DIAG_PHY - if ((last_slot>>1) != 9) { - LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received C_RNTI Format 0!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1); + if (subframe_rx != 9) { + LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received C_RNTI Format 0!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx); phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_errors++; phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_false++; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT); @@ -2196,7 +2211,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v if (generate_ue_ulsch_params_from_dci((void *)&dci_alloc_rx[i].dci_pdu, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti, - last_slot>>1, + subframe_rx, format0, phy_vars_ue, SI_RNTI, @@ -2207,7 +2222,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v 0)==0) { #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",phy_vars_ue->Mod_id,last_slot>>1); + LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",phy_vars_ue->Mod_id,subframe_rx); #endif } @@ -2218,17 +2233,17 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v // phy_vars_ue->Mod_id%phy_vars_ue->ulsch_ue[eNB_id]->num_active_cba_groups] #ifdef DEBUG_PHY_PROC LOG_I(PHY,"[UE %d][PUSCH] Frame %d subframe %d: Found cba rnti %x, format 0, dci_cnt %d\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1,dci_alloc_rx[i].rnti,i); + phy_vars_ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].rnti,i); /* - if (((phy_vars_ue->frame%100) == 0) || (phy_vars_ue->frame < 20)) + if (((frame_rx%100) == 0) || (frame_rx < 20)) dump_dci(&phy_vars_ue->lte_frame_parms, &dci_alloc_rx[i]); */ #endif /* #ifdef DIAG_PHY - if ((last_slot>>1) != 8) { + if (subframe_rx != 8) { LOG_E(PHY,"[UE %d][DIAG] frame %d, subframe %d: should not have received CBA RNTI Format 0!\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1); + phy_vars_ue->Mod_id,frame_rx,subframe_rx); phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_errors++; phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->dci_false++; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT); @@ -2242,7 +2257,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v if (generate_ue_ulsch_params_from_dci((void *)&dci_alloc_rx[i].dci_pdu, phy_vars_ue->ulsch_ue[eNB_id]->cba_rnti[0], - last_slot>>1, + subframe_rx, format0, phy_vars_ue, SI_RNTI, @@ -2253,15 +2268,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v 0)==0) { #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[UE %d] Generate UE ULSCH CBA_RNTI format 0 (subframe %d)\n",phy_vars_ue->Mod_id,last_slot>>1); + LOG_D(PHY,"[UE %d] Generate UE ULSCH CBA_RNTI format 0 (subframe %d)\n",phy_vars_ue->Mod_id,subframe_rx); #endif - phy_vars_ue->ulsch_ue[eNB_id]->num_cba_dci[((last_slot>>1)+4)%10]++; + phy_vars_ue->ulsch_ue[eNB_id]->num_cba_dci[(subframe_rx+4)%10]++; } } else { #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[UE %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1,i,dci_alloc_rx[i].rnti, + LOG_D(PHY,"[UE %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",phy_vars_ue->Mod_id,frame_rx,subframe_rx,i,dci_alloc_rx[i].rnti, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti, phy_vars_ue->ulsch_ue[eNB_id]->cba_rnti[0], dci_alloc_rx[i].format); @@ -2281,7 +2296,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } - int phy_procedures_UE_RX(uint8_t last_slot, PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode, + int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode, relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn) { uint16_t l,m,n_symb; @@ -2301,21 +2316,27 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v uint8_t sync_area=255; int pmch_mcs=-1; uint8_t mcch_active=0; + int frame_rx = phy_vars_ue->frame_rx; + int slot_rx = phy_vars_ue->slot_rx; + int subframe_rx = slot_rx>>1; + int subframe_prev = (subframe_rx+9)%10; + int CC_id = phy_vars_ue->CC_id; + vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); start_meas(&phy_vars_ue->phy_proc_rx); #ifdef DEBUG_PHY_PROC LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX(%d)\n", (r_type == multicast_relay) ? "RN/UE" : "UE", - phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot>>1, last_slot); + phy_vars_ue->Mod_id,frame_rx, subframe_rx, slot_rx); #endif #ifdef EMOS - if ((last_slot == 0)) { - if (phy_vars_ue->frame%1024 == 0) + if ((slot_rx == 0)) { + if (frame_rx%1024 == 0) openair_daq_vars.use_ia_receiver = 0; else openair_daq_vars.use_ia_receiver = (openair_daq_vars.use_ia_receiver+1)%3; LOG_I(PHY,"[MYEMOS] frame %d, IA receiver %d, MCS %d, bitrate %d\n", - phy_vars_ue->frame, + frame_rx, openair_daq_vars.use_ia_receiver, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->mcs, phy_vars_ue->bitrate[eNB_id]); @@ -2334,15 +2355,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - if (subframe_select(&phy_vars_ue->lte_frame_parms,last_slot>>1) == SF_S) { - if ((last_slot%2)==0) + if (subframe_select(&phy_vars_ue->lte_frame_parms,subframe_rx) == SF_S) { + if ((slot_rx%2)==0) n_symb = 5;//3; else n_symb = 0; } else { - if (is_pmch_subframe(phy_vars_ue->frame,last_slot>>1,&phy_vars_ue->lte_frame_parms)) { - if ((last_slot%2)==0) { + if (is_pmch_subframe(frame_rx,subframe_rx,&phy_vars_ue->lte_frame_parms)) { + if ((slot_rx%2)==0) { n_symb=2; pmch_flag=1; } @@ -2354,26 +2375,26 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - LOG_D(PHY,"[UE %d] *********** dlsch->active in subframe %d (%d)=> %d\n",phy_vars_ue->Mod_id,(last_slot>>1),last_slot,phy_vars_ue->dlsch_ue[eNB_id][0]->active); + LOG_D(PHY,"[UE %d] *********** dlsch->active in subframe %d (%d)=> %d\n",phy_vars_ue->Mod_id,subframe_rx,slot_rx,phy_vars_ue->dlsch_ue[eNB_id][0]->active); // This is normal processing (i.e. not MBSFN) - // RX processing of symbols in last_slot + // RX processing of symbols in slot_rx for (l=0;l<n_symb;l++) { if (abstraction_flag == 0) { start_meas(&phy_vars_ue->ofdm_demod_stats); slot_fep(phy_vars_ue, l, - last_slot, + slot_rx, phy_vars_ue->rx_offset, 0); stop_meas(&phy_vars_ue->ofdm_demod_stats); } - //if (subframe_select(&phy_vars_ue->lte_frame_parms,last_slot>>1) == SF_DL) - lte_ue_measurement_procedures(last_slot,l,phy_vars_ue,eNB_id,abstraction_flag,mode); + //if (subframe_select(&phy_vars_ue->lte_frame_parms,subframe_rx) == SF_DL) + lte_ue_measurement_procedures(l,phy_vars_ue,eNB_id,abstraction_flag,mode); - if ((last_slot==1) && (l==4-phy_vars_ue->lte_frame_parms.Ncp)) { + if ((slot_rx==1) && (l==4-phy_vars_ue->lte_frame_parms.Ncp)) { /* phy_vars_ue->ulsch_no_allocation_counter[eNB_id]++; @@ -2387,15 +2408,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } */ - lte_ue_pbch_procedures(eNB_id,last_slot,phy_vars_ue,abstraction_flag); + lte_ue_pbch_procedures(eNB_id,phy_vars_ue,abstraction_flag); /* if (phy_vars_ue->UE_mode[eNB_id] == RA_RESPONSE) { phy_vars_ue->Msg3_timer[eNB_id]--; - msg("[UE RAR] frame %d: Msg3_timer %d\n",phy_vars_ue->frame,phy_vars_ue->Msg3_timer); + msg("[UE RAR] frame %d: Msg3_timer %d\n",frame_rx,phy_vars_ue->Msg3_timer); if (phy_vars_ue->Msg3_timer[eNB_id] == 0) { - LOG_D(PHY,"[UE %d] Frame %d: Msg3_timer = 0 : setting mode to PRACH\n",phy_vars_ue->Mod_id,phy_vars_ue->frame); + LOG_D(PHY,"[UE %d] Frame %d: Msg3_timer = 0 : setting mode to PRACH\n",phy_vars_ue->Mod_id,frame_rx); // I guess here we also need to tell the RRC phy_vars_ue->UE_mode[eNB_id] = PRACH; phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti = 0x1234; @@ -2406,15 +2427,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifdef DLSCH_THREAD if (phy_vars_ue->dlsch_ue[eNB_id][0]->active == 1) { - // activate thread since Chest is now done for slot before last_slot + // activate thread since Chest is now done for slot before slot_rx if (l==0) { - LOG_D(PHY,"frame %d, last_slot %d: Calling rx_pdsch_thread for harq_pid %d\n",phy_vars_ue->frame,last_slot, phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid); + LOG_D(PHY,"frame %d, slot_rx %d: Calling rx_pdsch_thread for harq_pid %d\n",frame_rx,slot_rx, phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid); if (pthread_mutex_lock (&rx_pdsch_mutex) != 0) { // Signal MAC_PHY Scheduler LOG_E(PHY,"[UE %d] ERROR pthread_mutex_lock\n",phy_vars_ue->Mod_id); // lock before accessing shared resource vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); } else { rx_pdsch_instance_cnt++; - (last_slot == 0) ? (rx_pdsch_slot = 19) : (rx_pdsch_slot = (last_slot-1)); + (slot_rx == 0) ? (rx_pdsch_slot = 19) : (rx_pdsch_slot = (slot_rx-1)); pthread_mutex_unlock (&rx_pdsch_mutex); if (rx_pdsch_instance_cnt == 0) { @@ -2424,33 +2445,32 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } } else { - LOG_W(PHY,"[UE %d] Frame=%d, Slot=%d, RX_PDSCH thread for rx_pdsch_thread busy!!!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot); + LOG_W(PHY,"[UE %d] Frame=%d, Slot=%d, RX_PDSCH thread for rx_pdsch_thread busy!!!\n",phy_vars_ue->Mod_id,frame_rx,slot_rx); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); } } // trigger DLSCH decoding thread - if ((last_slot%2)==1) // odd slots + if ((slot_rx%2)==1) // odd slots phy_vars_ue->dlsch_ue[eNB_id][0]->active = 0; } } #endif // process last DLSCH symbols + invoke decoding - if (((last_slot%2)==0) && (l==0)) { + if (((slot_rx%2)==0) && (l==0)) { // Regular PDSCH - - LOG_D(PHY,"[UE %d] dlsch->active in subframe %d => %d\n",phy_vars_ue->Mod_id,((last_slot>>1)+9)%10,phy_vars_ue->dlsch_ue[eNB_id][0]->active); + LOG_D(PHY,"[UE %d] dlsch->active in subframe %d => %d\n",phy_vars_ue->Mod_id,subframe_prev,phy_vars_ue->dlsch_ue[eNB_id][0]->active); if (phy_vars_ue->dlsch_ue[eNB_id][0]->active == 1) { #ifndef DLSCH_THREAD //USER_MODE harq_pid = phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid; - LOG_D(PHY,"[UE %d] PDSCH active in subframe %d, harq_pid %d\n",phy_vars_ue->Mod_id,((last_slot>>1)+1)%10,harq_pid); + LOG_D(PHY,"[UE %d] PDSCH active in subframe %d, harq_pid %d\n",phy_vars_ue->Mod_id,subframe_prev,harq_pid); if ((phy_vars_ue->transmission_mode[eNB_id] == 5) && (phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off==0) && (openair_daq_vars.use_ia_receiver ==1)) { dual_stream_UE = 1; eNB_id_i = phy_vars_ue->n_connected_eNB; i_mod = get_Qm(phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs); - if (phy_vars_ue->frame%100==0) { + if (frame_rx%100==0) { LOG_I(PHY,"using IA receiver\n"); } } @@ -2470,7 +2490,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v PDSCH, eNB_id, eNB_id_i, - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), // subframe + subframe_prev, // subframe m, // symbol 0, // first_symbol_flag dual_stream_UE, @@ -2487,7 +2507,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->Mod_id, phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, harq_pid, - phy_vars_ue->frame,((last_slot>>1)==0)?9:(last_slot>>1)-1); + frame_rx,subframe_prev); #endif if (phy_vars_ue->dlsch_ue[eNB_id][0]) { @@ -2498,7 +2518,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v get_Qm(phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs), phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->Nl, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame,(((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1))); + frame_rx,subframe_prev); start_meas(&phy_vars_ue->dlsch_unscrambling_stats); dlsch_unscrambling(&phy_vars_ue->lte_frame_parms, 0, @@ -2506,7 +2526,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->G, phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->llr[0], 0, - ((((last_slot>>1)==0) ? 9 : ((last_slot>>1))-1))<<1); + subframe_prev<<1); stop_meas(&phy_vars_ue->dlsch_unscrambling_stats); start_meas(&phy_vars_ue->dlsch_decoding_stats); @@ -2515,7 +2535,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v &phy_vars_ue->lte_frame_parms, phy_vars_ue->dlsch_ue[eNB_id][0], phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid], - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), + subframe_prev, harq_pid, 1,0); stop_meas(&phy_vars_ue->dlsch_decoding_stats); @@ -2525,7 +2545,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v LOG_D(PHY,"Calling dlsch_decoding_emul ...\n"); #ifdef PHY_ABSTRACTION ret = dlsch_decoding_emul(phy_vars_ue, - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), + subframe_prev, 2, eNB_id); #endif @@ -2537,18 +2557,18 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifdef DEBUG_PHY_PROC LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d DLSCH in error (rv %d,mcs %d)\n", phy_vars_ue->Mod_id,phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, - harq_pid,phy_vars_ue->frame,((last_slot>>1)==0)?9:(last_slot>>1)-1, + harq_pid,frame_rx,subframe_prev, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->rvidx, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs); // if (abstraction_flag ==0 ) - // dump_dlsch(phy_vars_ue,eNB_id,(((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)),harq_pid); + // dump_dlsch(phy_vars_ue,eNB_id,subframe_prev,harq_pid); #endif } else { - LOG_I(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d (last_slot %d): Received DLSCH (rv %d,mcs %d,TBS %d)\n", + LOG_I(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d (slot_rx %d): Received DLSCH (rv %d,mcs %d,TBS %d)\n", phy_vars_ue->Mod_id,phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, - harq_pid,phy_vars_ue->frame,((last_slot>>1)==0)?9:(last_slot>>1)-1,last_slot, + harq_pid,frame_rx,subframe_prev,slot_rx, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->rvidx, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS); @@ -2563,8 +2583,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #endif #ifdef OPENAIR2 mac_xface->ue_send_sdu(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame, + CC_id, + frame_rx, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->b, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->TBS>>3, eNB_id); @@ -2581,14 +2601,14 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v LOG_I(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: PDSCH/DLSCH decoding iter %d (mcs %d, rv %d, TBS %d)\n", phy_vars_ue->Mod_id, phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,harq_pid, - phy_vars_ue->frame,((last_slot>>1)==0)?9:(last_slot>>1)-1,ret, + frame_rx,subframe_prev,ret, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->rvidx, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS); - if (phy_vars_ue->frame%100==0) { + if (frame_rx%100==0) { LOG_I(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d dlsch_errors %d, dlsch_received %d, dlsch_fer %d, current_dlsch_cqi %d\n", phy_vars_ue->Mod_id,phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, - phy_vars_ue->frame,last_slot>>1, + frame_rx,subframe_prev, phy_vars_ue->dlsch_errors[eNB_id], phy_vars_ue->dlsch_received[eNB_id], phy_vars_ue->dlsch_fer[eNB_id], @@ -2598,14 +2618,14 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #endif //DLSCH_THREAD } else { - // printf("PDSCH inactive in subframe %d\n",(last_slot>>1)-1); - phy_vars_ue->dlsch_ue[eNB_id][0]->harq_ack[(((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1))].send_harq_status = 0; + // printf("PDSCH inactive in subframe %d\n",subframe_rx-1); + phy_vars_ue->dlsch_ue[eNB_id][0]->harq_ack[subframe_prev].send_harq_status = 0; } // SI_DLSCH if (phy_vars_ue->dlsch_ue_SI[eNB_id]->active == 1) { #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"SI is active\n"); + LOG_I(PHY,"SI is active in subframe %d\n",subframe_prev); #endif // process symbols 10,11,12 (13) of last SF and trigger DLSCH decoding @@ -2613,21 +2633,21 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v start_meas(&phy_vars_ue->dlsch_llr_stats); for (m=pilot3;m<phy_vars_ue->lte_frame_parms.symbols_per_tti;m++) { #ifdef DEBUG_PHY_PROC - /* - debug_LOG_D(PHY,"[UE %d] Frame %d, slot %d: DLSCH (SI) demod between pilot 3 and 4 (2nd slot), m %d\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot,m); - */ + + LOG_D(PHY,"[UE %d] Frame %d, slot %d: DLSCH (SI) demod between pilot 3 and 4 (2nd slot), m %d\n", + phy_vars_ue->Mod_id,frame_rx,slot_rx,m); + #endif rx_pdsch(phy_vars_ue, SI_PDSCH, eNB_id, eNB_id+1, - last_slot>>1, // subframe, + subframe_prev, // subframe, m, 0, 0, - phy_vars_ue->is_secondary_ue, - phy_vars_ue->dlsch_ue_SI[eNB_id]->current_harq_pid); + phy_vars_ue->is_secondary_ue, + phy_vars_ue->dlsch_ue_SI[eNB_id]->current_harq_pid); } stop_meas(&phy_vars_ue->dlsch_llr_stats); } @@ -2635,7 +2655,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->dlsch_ue_SI[eNB_id]->active = 0; - if (phy_vars_ue->frame < phy_vars_ue->dlsch_SI_errors[eNB_id]) + if (frame_rx < phy_vars_ue->dlsch_SI_errors[eNB_id]) phy_vars_ue->dlsch_SI_errors[eNB_id]=0; if (phy_vars_ue->dlsch_ue_SI[eNB_id]) { @@ -2649,7 +2669,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->rb_alloc, get_Qm(phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->mcs),1, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame,(((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1))); + frame_rx,subframe_prev); #ifdef DEBUG_PHY_PROC LOG_I(PHY,"Decoding DLSCH_SI : rb_alloc %x : nb_rb %d G %d TBS %d\n",phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->rb_alloc[0], @@ -2660,20 +2680,20 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v dlsch_unscrambling(&phy_vars_ue->lte_frame_parms, - 0, - phy_vars_ue->dlsch_ue_SI[eNB_id], - phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->G, - phy_vars_ue->lte_ue_pdsch_vars_SI[eNB_id]->llr[0], - 0, - ((((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)))<<1); + 0, + phy_vars_ue->dlsch_ue_SI[eNB_id], + phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->G, + phy_vars_ue->lte_ue_pdsch_vars_SI[eNB_id]->llr[0], + 0, + subframe_prev<<1); ret = dlsch_decoding(phy_vars_ue, phy_vars_ue->lte_ue_pdsch_vars_SI[eNB_id]->llr[0], &phy_vars_ue->lte_frame_parms, phy_vars_ue->dlsch_ue_SI[eNB_id], phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0], - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), - harq_pid, + subframe_prev, + phy_vars_ue->dlsch_ue_SI[eNB_id]->current_harq_pid, 0,0); #ifdef DEBUG_PHY_PROC @@ -2686,7 +2706,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v else { LOG_D(PHY,"Calling dlsch_decoding_emul ...\n"); ret = dlsch_decoding_emul(phy_vars_ue, - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), + subframe_prev, 0, eNB_id); } @@ -2695,11 +2715,11 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v if (ret == (1+phy_vars_ue->dlsch_ue_SI[eNB_id]->max_turbo_iterations)) { phy_vars_ue->dlsch_SI_errors[eNB_id]++; #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE %d] Frame %d, subframe %d, received SI in error\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,((last_slot==0)?9 : ((last_slot>>1)-1))); + LOG_I(PHY,"[UE %d] Frame %d, subframe %d, received SI in error\n",phy_vars_ue->Mod_id,frame_rx,subframe_prev); #endif #ifdef USER_MODE - // dump_dlsch_SI(phy_vars_ue,eNB_id,(((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1))); + // dump_dlsch_SI(phy_vars_ue,eNB_id,subframe_prev); #endif vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); stop_meas(&phy_vars_ue->phy_proc_rx); @@ -2709,9 +2729,9 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifdef DEBUG_PHY_PROC - //if ((phy_vars_ue->frame % 100) == 0) + //if ((frame_rx % 100) == 0) LOG_I(PHY,"[UE %d] Frame %d, subframe %d, received SI for TBS %d\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,(((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)),phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->TBS); + phy_vars_ue->Mod_id,frame_rx,subframe_prev,phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->TBS); #endif #ifdef OPENAIR2 @@ -2721,14 +2741,14 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v printf("\n"); */ mac_xface->ue_decode_si(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame, + CC_id, + frame_rx, eNB_id, phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->b, phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->TBS>>3); /* - if ((phy_vars_ue->frame % 160) < 10) - printf("sending SI to L2 in frame %d\n",phy_vars_ue->frame); + if ((frame_rx % 160) < 10) + printf("sending SI to L2 in frame %d\n",frame_rx); */ #endif } @@ -2736,7 +2756,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v /* #ifdef DEBUG_PHY_PROC debug_LOG_D(PHY,"[UE %d] Frame %d, slot %d: dlsch_decoding (SI) ret %d (%d errors)\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot,ret,phy_vars_ue->dlsch_SI_errors[eNB_id]); + phy_vars_ue->Mod_id,frame_rx,slot_rx,ret,phy_vars_ue->dlsch_SI_errors[eNB_id]); #endif */ } @@ -2744,7 +2764,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v if (phy_vars_ue->dlsch_ue_ra[eNB_id]->active == 1) { #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[UE %d] Frame %d, slot %d: DLSCH (RA) demod symbols 10,11,12\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot); + LOG_D(PHY,"[UE %d] Frame %d, slot %d: DLSCH (RA) demod symbols 10,11,12\n",phy_vars_ue->Mod_id,frame_rx,slot_rx); #endif // process symbols 10,11,12 and trigger DLSCH decoding @@ -2755,7 +2775,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v RA_PDSCH, eNB_id, eNB_id+1, - last_slot>>1, // subframe, + subframe_prev, // subframe, m, // symbol 0, // first_symbol_flag 0, @@ -2766,13 +2786,13 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->dlsch_ue_ra[eNB_id]->active = 0; - if (phy_vars_ue->frame < phy_vars_ue->dlsch_ra_errors[eNB_id]) + if (frame_rx < phy_vars_ue->dlsch_ra_errors[eNB_id]) phy_vars_ue->dlsch_ra_errors[eNB_id]=0; if (phy_vars_ue->prach_resources[eNB_id]!=NULL) phy_vars_ue->dlsch_ue_ra[eNB_id]->rnti = phy_vars_ue->prach_resources[eNB_id]->ra_RNTI; else { - LOG_E(PHY,"[UE %d] Frame %d, subframe %d: FATAL, prach_resources is NULL\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot>>1); + LOG_E(PHY,"[UE %d] Frame %d, subframe %d: FATAL, prach_resources is NULL\n",phy_vars_ue->Mod_id,frame_rx,subframe_prev); mac_xface->macphy_exit(""); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); stop_meas(&phy_vars_ue->phy_proc_rx); @@ -2785,11 +2805,11 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->rb_alloc, get_Qm(phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->mcs),1, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame, - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1))); + frame_rx, + subframe_prev); #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[UE] decoding RA (subframe %d): G %d,rnti %x\n" ,last_slot>>1, + LOG_I(PHY,"[UE] decoding RA (subframe %d): G %d,rnti %x\n" ,subframe_prev, phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->G, phy_vars_ue->dlsch_ue_ra[eNB_id]->rnti); #endif @@ -2800,14 +2820,14 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->G, phy_vars_ue->lte_ue_pdsch_vars_ra[eNB_id]->llr[0], 0, - ((((last_slot>>1)==0) ?9 : ((last_slot>>1)-1)))<<1); + subframe_prev<<1); ret = dlsch_decoding(phy_vars_ue, phy_vars_ue->lte_ue_pdsch_vars_ra[eNB_id]->llr[0], &phy_vars_ue->lte_frame_parms, phy_vars_ue->dlsch_ue_ra[eNB_id], phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0], - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), // subframe + subframe_prev, // subframe harq_pid, 0,0); } @@ -2816,7 +2836,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v else { LOG_D(PHY,"Calling dlsch_decoding_emul ...\n"); ret = dlsch_decoding_emul(phy_vars_ue, - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), + subframe_prev, 1, eNB_id); } @@ -2824,9 +2844,9 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v if (ret == (1+phy_vars_ue->dlsch_ue_ra[eNB_id]->max_turbo_iterations)) { phy_vars_ue->dlsch_ra_errors[eNB_id]++; - LOG_D(PHY,"[UE %d] Frame %d, subframe %d, received RA in error\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,((last_slot==0)?9 : ((last_slot>>1)-1))); + LOG_D(PHY,"[UE %d] Frame %d, subframe %d, received RA in error\n",phy_vars_ue->Mod_id,frame_rx,subframe_prev); #ifdef USER_MODE - //dump_dlsch_ra(phy_vars_ue,eNB_id,(((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1))); + //dump_dlsch_ra(phy_vars_ue,eNB_id,subframe_prev); #endif // oai_exit=1; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); @@ -2838,20 +2858,20 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifdef DEBUG_PHY_PROC LOG_I(PHY,"[UE %d][RAPROC] Frame %d subframe %d Received RAR mode %d\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame-(((last_slot>>1)==0) ? 1 : 0), - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), phy_vars_ue->UE_mode[eNB_id]); + frame_rx, + subframe_prev, phy_vars_ue->UE_mode[eNB_id]); #endif #ifdef OPENAIR2 if ((phy_vars_ue->UE_mode[eNB_id] != PUSCH) && (phy_vars_ue->prach_resources[eNB_id]->Msg3!=NULL)) { LOG_I(PHY,"[UE %d][RAPROC] Frame %d subframe %d Invoking MAC for RAR (current preamble %d)\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame-(((last_slot>>1)==0) ? 1 : 0), - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), + phy_vars_ue->Mod_id,frame_rx-((subframe_prev==9) ? 1 : 0), + subframe_prev, phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex); timing_advance = mac_xface->ue_process_rar(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - phy_vars_ue->frame-(((last_slot>>1)==0) ? 1 : 0), + CC_id, + frame_rx-((subframe_prev==0) ? 1 : 0), phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->b, &phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti, phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex); @@ -2861,8 +2881,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v LOG_I(PHY,"[UE %d][RAPROC] Frame %d subframe %d Got rnti %x and timing advance %d from RAR\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame-(((last_slot>>1)==0) ? 1 : 0), - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), + frame_rx-((subframe_prev==9) ? 1 : 0), + subframe_prev, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti, timing_advance); @@ -2871,15 +2891,15 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v if (mode!=debug_prach) { phy_vars_ue->ulsch_ue_Msg3_active[eNB_id]=1; get_Msg3_alloc(&phy_vars_ue->lte_frame_parms, - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), - phy_vars_ue->frame-(((last_slot>>1)==0) ? 1 : 0), + subframe_prev, + frame_rx-((subframe_prev==9) ? 1 : 0), &phy_vars_ue->ulsch_ue_Msg3_frame[eNB_id], &phy_vars_ue->ulsch_ue_Msg3_subframe[eNB_id]); LOG_I(PHY,"[UE %d][RAPROC] Got Msg3_alloc Frame %d subframe %d: Msg3_frame %d, Msg3_subframe %d\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame-(((last_slot>>1)==0) ? 1 : 0), - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), + frame_rx-((subframe_prev==9) ? 1 : 0), + subframe_prev, phy_vars_ue->ulsch_ue_Msg3_frame[eNB_id], phy_vars_ue->ulsch_ue_Msg3_subframe[eNB_id]); harq_pid = subframe2harq_pid(&phy_vars_ue->lte_frame_parms, @@ -2910,7 +2930,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v /* #ifdef DEBUG_PHY_PROC debug_LOG_D(PHY,"[UE %d] Frame %d, slot %d: dlsch_decoding (RA) ret %d (%d errors)\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot,ret,phy_vars_ue->dlsch_ra_errors[eNB_id]); + phy_vars_ue->Mod_id,frame_rx,slot_rx,ret,phy_vars_ue->dlsch_ra_errors[eNB_id]); #endif */ } // dlsch_ue_ra[eNB_id]->active == 1 @@ -2918,20 +2938,20 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } - if ((((last_slot%2)==0) && ((l==pilot1))) || + if ((((slot_rx%2)==0) && ((l==pilot1))) || ((pmch_flag==1)&&(l==1))) { #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[UE %d] Frame %d, slot %d: Calling pdcch procedures (eNB %d)\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot,eNB_id); + LOG_D(PHY,"[UE %d] Frame %d, slot %d: Calling pdcch procedures (eNB %d)\n",phy_vars_ue->Mod_id,frame_rx,slot_rx,eNB_id); #endif - // rt_printk("[PDCCH] Frame %d, slot %d, start %llu\n",phy_vars_ue->frame,last_slot,rt_get_time_ns()); - if (lte_ue_pdcch_procedures(eNB_id,last_slot,phy_vars_ue,abstraction_flag) == -1) { + // rt_printk("[PDCCH] Frame %d, slot %d, start %llu\n",frame_rx,slot_rx,rt_get_time_ns()); + if (lte_ue_pdcch_procedures(eNB_id,phy_vars_ue,abstraction_flag) == -1) { #ifdef DEBUG_PHY_PROC - LOG_E(PHY,"[UE %d] Frame %d, slot %d: Error in pdcch procedures\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,last_slot); + LOG_E(PHY,"[UE %d] Frame %d, slot %d: Error in pdcch procedures\n",phy_vars_ue->Mod_id,frame_rx,slot_rx); #endif return(-1); } - // rt_printk("[PDCCH] Frame %d, slot %d, stop %llu\n",phy_vars_ue->frame,last_slot,rt_get_time_ns()); + // rt_printk("[PDCCH] Frame %d, slot %d, stop %llu\n",frame_rx,slot_rx,rt_get_time_ns()); #ifdef DEBUG_PHY_PROC LOG_D(PHY,"num_pdcch_symbols %d\n",phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols); #endif @@ -2939,7 +2959,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v if (abstraction_flag==0) { - if (((last_slot%2)==1) && (l==0)) { + if (((slot_rx%2)==1) && (l==0)) { start_meas(&phy_vars_ue->dlsch_llr_stats); for (m=phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols; m<pilot2; @@ -2948,7 +2968,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v #ifndef DLSCH_THREAD if (phy_vars_ue->dlsch_ue[eNB_id][0]->active == 1) { harq_pid = phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid; - LOG_D(PHY,"[UE %d] PDSCH active in subframe %d (%d), harq_pid %d\n",phy_vars_ue->Mod_id,(last_slot>>1),last_slot,harq_pid); + LOG_D(PHY,"[UE %d] PDSCH active in subframe %d (%d), harq_pid %d\n",phy_vars_ue->Mod_id,subframe_rx,slot_rx,harq_pid); if ((phy_vars_ue->transmission_mode[eNB_id] == 5) && (phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off==0) && (openair_daq_vars.use_ia_receiver ==1)) { @@ -2967,7 +2987,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v PDSCH, eNB_id, eNB_id_i, - last_slot>>1, // subframe, + subframe_rx, // subframe, m, (m==phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols)?1:0, // first_symbol_flag dual_stream_UE, @@ -2982,7 +3002,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v SI_PDSCH, eNB_id, eNB_id+1, - last_slot>>1, // subframe, + subframe_rx, // subframe, m, (m==phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols)?1:0, // first_symbol_flag 0, @@ -2995,7 +3015,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v RA_PDSCH, eNB_id, eNB_id+1, - last_slot>>1, // subframe, + subframe_rx, // subframe, m, (m==phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols)?1:0, 0, @@ -3006,7 +3026,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v stop_meas(&phy_vars_ue->dlsch_llr_stats); } // 2nd quarter - if (((last_slot%2)==1) && (l==pilot1)) { + if (((slot_rx%2)==1) && (l==pilot1)) { start_meas(&phy_vars_ue->dlsch_llr_stats); for (m=pilot2;m<pilot3;m++) { @@ -3030,7 +3050,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v PDSCH, eNB_id, eNB_id_i, - last_slot>>1, // subframe, + subframe_rx, // subframe, m, 0, dual_stream_UE, @@ -3043,7 +3063,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v SI_PDSCH, eNB_id, eNB_id+1, - last_slot>>1, // subframe, + subframe_rx, // subframe, m, 0, // first_symbol_flag 0, @@ -3056,7 +3076,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v RA_PDSCH, eNB_id, eNB_id+1, - last_slot>>1, // subframe, + subframe_rx, // subframe, m, 0, // first_symbol_flag 0, @@ -3071,8 +3091,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v }// l loop // calculate some statistics - if (last_slot==19) { - if (phy_vars_ue->frame % 10 == 0) { + if (slot_rx==19) { + if (frame_rx % 10 == 0) { if ((phy_vars_ue->dlsch_received[eNB_id] - phy_vars_ue->dlsch_received_last[eNB_id]) != 0) phy_vars_ue->dlsch_fer[eNB_id] = (100*(phy_vars_ue->dlsch_errors[eNB_id] - phy_vars_ue->dlsch_errors_last[eNB_id]))/(phy_vars_ue->dlsch_received[eNB_id] - phy_vars_ue->dlsch_received_last[eNB_id]); @@ -3083,56 +3103,56 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->bitrate[eNB_id] = (phy_vars_ue->total_TBS[eNB_id] - phy_vars_ue->total_TBS_last[eNB_id])*100; phy_vars_ue->total_TBS_last[eNB_id] = phy_vars_ue->total_TBS[eNB_id]; LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,phy_vars_ue->total_TBS[eNB_id], + phy_vars_ue->Mod_id,frame_rx,phy_vars_ue->total_TBS[eNB_id], phy_vars_ue->total_TBS_last[eNB_id],(float) phy_vars_ue->bitrate[eNB_id]/1000.0); - if ((phy_vars_ue->frame % 100 == 0)) { + if ((frame_rx % 100 == 0)) { LOG_I(PHY,"Throughput %5.1f kbps\n",(float) phy_vars_ue->bitrate[eNB_id]/1000.0); } } - if (is_pmch_subframe(((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,&phy_vars_ue->lte_frame_parms)) { + if (is_pmch_subframe((subframe_rx==9?-1:0)+frame_rx,subframe_rx,&phy_vars_ue->lte_frame_parms)) { LOG_I(PHY,"ue calling pmch subframe ..\n "); - if ((last_slot%2)==1) { + if ((slot_rx%2)==1) { LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation(%d)\n", - phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,last_slot); + phy_vars_ue->Mod_id,(subframe_rx==9?-1:0)+frame_rx,subframe_rx,slot_rx); #ifdef Rel10 pmch_mcs = mac_xface->ue_query_mch(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - ((last_slot>>1)==9?-1:0)+phy_vars_ue->frame, - last_slot>>1, + CC_id, + (subframe_rx==9?-1:0)+frame_rx, + subframe_rx, eNB_id, &sync_area, &mcch_active); if (phy_vars_rn) - phy_vars_rn->mch_avtive[last_slot>>1]=0; + phy_vars_rn->mch_avtive[subframe_rx]=0; #else pmch_mcs=-1; #endif if (pmch_mcs>=0) { - LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Programming PMCH demodulation for mcs %d\n",phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,pmch_mcs); + LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Programming PMCH demodulation for mcs %d\n",phy_vars_ue->Mod_id,(subframe_rx==9?-1:0)+frame_rx,subframe_rx,pmch_mcs); fill_UE_dlsch_MCH(phy_vars_ue,pmch_mcs,1,0,0); if (abstraction_flag == 0 ) { for (l=2;l<12;l++) { slot_fep_mbsfn(phy_vars_ue, l, - last_slot>>1, + subframe_rx, 0,0);//phy_vars_ue->rx_offset,0); } for (l=2;l<12;l++) { rx_pmch(phy_vars_ue, 0, - last_slot>>1, + subframe_rx, l); } /* printf("PMCH decoding, Frame %d, subframe %d, G %d\n", - ((last_slot>>1)==9?-1:0)+phy_vars_ue->frame, - last_slot>>1, + (subframe_rx==9?-1:0)+frame_rx, + subframe_rx, phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G); */ phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G = get_G(&phy_vars_ue->lte_frame_parms, @@ -3141,24 +3161,24 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v get_Qm(phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->mcs), 1, 2, - ((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1); + (subframe_rx==9?-1:0)+frame_rx,subframe_rx); dlsch_unscrambling(&phy_vars_ue->lte_frame_parms,1,phy_vars_ue->dlsch_ue_MCH[0], phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G, - phy_vars_ue->lte_ue_pdsch_vars_MCH[0]->llr[0],0,last_slot-1); + phy_vars_ue->lte_ue_pdsch_vars_MCH[0]->llr[0],0,subframe_prev<<1); ret = dlsch_decoding(phy_vars_ue, phy_vars_ue->lte_ue_pdsch_vars_MCH[0]->llr[0], &phy_vars_ue->lte_frame_parms, phy_vars_ue->dlsch_ue_MCH[0], phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0], - last_slot>>1, + subframe_prev, 0, 0,0); } else { // abstraction ret = dlsch_decoding_emul(phy_vars_ue, - (((last_slot>>1)==0) ? 9 : ((last_slot>>1)-1)), + subframe_rx, 5, // PMCH eNB_id); } @@ -3174,27 +3194,27 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->dlsch_mtch_errors[sync_area][0]++; LOG_D(PHY,"[%s %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n", (r_type == no_relay)? "UE": "RN/UE", phy_vars_ue->Mod_id, - ((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1, + (subframe_rx==9?-1:0)+frame_rx,subframe_rx, phy_vars_ue->dlsch_mcch_errors[sync_area][0], phy_vars_ue->dlsch_mtch_errors[sync_area][0], phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3, phy_vars_ue->dlsch_ue_MCH[0]->max_turbo_iterations, phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G); - dump_mch(phy_vars_ue,0,phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G,(last_slot>>1)); + dump_mch(phy_vars_ue,0,phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G,subframe_rx); #ifdef DEBUG_DLSCH for (i=0;i<phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3;i++){ LOG_T(PHY,"%2x.",phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->c[0][i]); } LOG_T(PHY,"\n"); #endif - if ((last_slot>>1)==9) exit(-1); + if (subframe_rx==9) exit(-1); } else { #ifdef Rel10 if ((r_type == no_relay) || (mcch_active == 1)) { mac_xface->ue_send_mch_sdu(phy_vars_ue->Mod_id, - phy_vars_ue->CC_id, - ((last_slot>>1)==9?-1:0)+phy_vars_ue->frame, + CC_id, + frame_rx, phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->b, phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3, eNB_id,// not relevant in eMBMS context @@ -3210,35 +3230,35 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v phy_vars_ue->dlsch_mtch_received[sync_area][0]++; - if (phy_vars_ue->dlsch_mch_received_sf[(last_slot>>1)%5][0] == 1 ){ - phy_vars_ue->dlsch_mch_received_sf[(last_slot>>1)%5][0]=0; + if (phy_vars_ue->dlsch_mch_received_sf[subframe_rx%5][0] == 1 ){ + phy_vars_ue->dlsch_mch_received_sf[subframe_rx%5][0]=0; } else { phy_vars_ue->dlsch_mch_received[0]+=1; - phy_vars_ue->dlsch_mch_received_sf[last_slot>>1][0]=1; + phy_vars_ue->dlsch_mch_received_sf[subframe_rx][0]=1; } } else if (r_type == multicast_relay) { // mcch is not active here // only 1 harq process exists // Fix me: this could be a pointer copy - memcpy (phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->b, + memcpy (phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->b, phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->b, phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3); // keep the tbs - phy_vars_rn->mch_avtive[last_slot>>1] = 1; - phy_vars_rn->sync_area[last_slot>>1] = sync_area; // this could also go the harq data struct - phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->TBS = phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS; - phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->mcs = phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->mcs; + phy_vars_rn->mch_avtive[subframe_rx] = 1; + phy_vars_rn->sync_area[subframe_rx] = sync_area; // this could also go the harq data struct + phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->TBS = phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS; + phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->mcs = phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->mcs; LOG_I(PHY,"[RN/UE %d] Frame %d subframe %d: store the MCH PDU for MBSFN sync area %d (MCS %d, TBS %d)\n", - phy_vars_ue->Mod_id, phy_vars_ue->frame,last_slot>>1,sync_area, - phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->mcs, - phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->TBS>>3); + phy_vars_ue->Mod_id, frame_rx,subframe_rx,sync_area, + phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->mcs, + phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->TBS>>3); #ifdef DEBUG_PHY - for (i=0;i<phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->TBS>>3;i++) - msg("%2x.",phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->b[i]); + for (i=0;i<phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->TBS>>3;i++) + msg("%2x.",phy_vars_rn->dlsch_rn_MCH[subframe_rx]->harq_processes[0]->b[i]); msg("\n"); #endif } else - LOG_W(PHY,"[UE %d] Frame %d: not supported option\n",phy_vars_ue->Mod_id, phy_vars_ue->frame); + LOG_W(PHY,"[UE %d] Frame %d: not supported option\n",phy_vars_ue->Mod_id, frame_rx); #endif } } @@ -3250,7 +3270,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v } #ifdef Rel10 -int phy_procedures_RN_UE_RX(uint8_t last_slot, uint8_t next_slot, relaying_type_t r_type) { +int phy_procedures_RN_UE_RX(uint8_t slot_rx, uint8_t next_slot, relaying_type_t r_type) { int do_proc =0; // do nothing by default switch(r_type){ @@ -3258,7 +3278,7 @@ int phy_procedures_RN_UE_RX(uint8_t last_slot, uint8_t next_slot, relaying_type_ do_proc=no_relay; // perform the normal UE operation break; case multicast_relay: - if (last_slot > 12) + if (slot_rx > 12) do_proc = 0; // do nothing else // SF#1, SF#2, SF3, SF#3, SF#4, SF#5, SF#6(do rx slot 12) do_proc = multicast_relay ; // do PHY procedures UE RX @@ -3373,7 +3393,7 @@ void phy_UE_lte_check_measurement_thresholds(instance_t instanceP, ral_threshold # endif #endif - void phy_procedures_UE_lte(uint8_t last_slot, uint8_t next_slot, PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode, + void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode, relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn) { #if defined(ENABLE_ITTI) MessageDef *msg_p; @@ -3381,9 +3401,14 @@ void phy_UE_lte_check_measurement_thresholds(instance_t instanceP, ral_threshold instance_t instance; unsigned int Mod_id; int result; - int CC_id =0; #endif - + int CC_id =0; + int frame_rx = phy_vars_ue->frame_rx; + int frame_tx = phy_vars_ue->frame_tx; + int slot_rx = phy_vars_ue->slot_rx; + int slot_tx = phy_vars_ue->slot_tx; + int subframe_tx = slot_tx>>1; + int subframe_rx = slot_rx>>1; #undef DEBUG_PHY_PROC #ifdef OPENAIR2 @@ -3396,8 +3421,8 @@ void phy_UE_lte_check_measurement_thresholds(instance_t instanceP, ral_threshold prach_resources_local.ra_PreambleIndex = 0; #endif - vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_UE, (last_slot + 1) % 20); - vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_UE, phy_vars_ue->frame); + vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_UE, (slot_rx + 1) % 20); + vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_UE, frame_rx); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1); #ifdef EXMIMO @@ -3557,63 +3582,63 @@ void phy_UE_lte_check_measurement_thresholds(instance_t instanceP, ral_threshold } while(msg_p != NULL); #endif - if ((subframe_select(&phy_vars_ue->lte_frame_parms,next_slot>>1)==SF_UL)|| + if ((subframe_select(&phy_vars_ue->lte_frame_parms,subframe_tx)==SF_UL)|| (phy_vars_ue->lte_frame_parms.frame_type == 0)){ - phy_procedures_UE_TX(next_slot,phy_vars_ue,eNB_id,abstraction_flag,mode,r_type); + phy_procedures_UE_TX(phy_vars_ue,eNB_id,abstraction_flag,mode,r_type); } - if ((subframe_select(&phy_vars_ue->lte_frame_parms,last_slot>>1)==SF_DL) || + if ((subframe_select(&phy_vars_ue->lte_frame_parms,subframe_rx)==SF_DL) || (phy_vars_ue->lte_frame_parms.frame_type == 0)){ #ifdef Rel10 - if (phy_procedures_RN_UE_RX(last_slot, next_slot, r_type) != 0 ) + if (phy_procedures_RN_UE_RX(slot_rx, slot_tx, r_type) != 0 ) #endif - phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn); + phy_procedures_UE_RX(phy_vars_ue,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn); #ifdef EMOS - phy_procedures_emos_UE_RX(phy_vars_ue,last_slot,eNB_id); + phy_procedures_emos_UE_RX(phy_vars_ue,slot_rx,eNB_id); #endif } - if ((subframe_select(&phy_vars_ue->lte_frame_parms,next_slot>>1)==SF_S) && - ((next_slot&1)==1)) { - phy_procedures_UE_S_TX(next_slot,phy_vars_ue,eNB_id,abstraction_flag,r_type); + if ((subframe_select(&phy_vars_ue->lte_frame_parms,subframe_tx)==SF_S) && + ((slot_tx&1)==1)) { + phy_procedures_UE_S_TX(phy_vars_ue,eNB_id,abstraction_flag,r_type); } - if ((subframe_select(&phy_vars_ue->lte_frame_parms,last_slot>>1)==SF_S) && - ((last_slot&1)==0)) { + if ((subframe_select(&phy_vars_ue->lte_frame_parms,subframe_rx)==SF_S) && + ((slot_rx&1)==0)) { #ifdef Rel10 - if (phy_procedures_RN_UE_RX(last_slot, next_slot, r_type) != 0 ) + if (phy_procedures_RN_UE_RX(slot_rx, slot_tx, r_type) != 0 ) #endif - phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn); + phy_procedures_UE_RX(phy_vars_ue,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn); } #ifdef OPENAIR2 - if (last_slot%2==0) { + if (slot_rx%2==0) { ret = mac_xface->ue_scheduler(phy_vars_ue->Mod_id, - phy_vars_ue->frame, - last_slot>>1, - subframe_select(&phy_vars_ue->lte_frame_parms,next_slot>>1), + frame_tx, + subframe_rx, + subframe_select(&phy_vars_ue->lte_frame_parms,subframe_tx), eNB_id); if (ret == CONNECTION_LOST) { LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",phy_vars_ue->Mod_id, - phy_vars_ue->frame,next_slot>>1); + frame_rx,subframe_tx); phy_vars_ue->UE_mode[eNB_id] = PRACH; // mac_xface->macphy_exit("Connection lost"); } else if (ret == PHY_RESYNCH) { LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n", phy_vars_ue->Mod_id, - phy_vars_ue->frame,next_slot>>1); + frame_rx,subframe_tx); phy_vars_ue->UE_mode[eNB_id] = RESYNCH; // mac_xface->macphy_exit("Connection lost"); //exit(-1); } else if (ret == PHY_HO_PRACH) { LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n", - phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1); + phy_vars_ue->Mod_id,frame_rx,subframe_tx); phy_vars_ue->UE_mode[eNB_id] = PRACH; } } #endif - if (last_slot == 19) - phy_vars_ue->frame++; + // if (last_slot == 19) + // phy_vars_ue->frame++; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,0); stop_meas(&phy_vars_ue->phy_proc); diff --git a/openair1/SCHED/pucch_pc.c b/openair1/SCHED/pucch_pc.c index c4bf5f0eb0..fbf2a61d2d 100644 --- a/openair1/SCHED/pucch_pc.c +++ b/openair1/SCHED/pucch_pc.c @@ -90,7 +90,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id if (pucch_fmt!=pucch_format1) { LOG_D(PHY,"[UE %d][PDSCH %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n", phy_vars_ue->Mod_id, - phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,phy_vars_ue->frame,subframe, + phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,phy_vars_ue->frame_tx,subframe, Po_PUCCH, phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH, get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,eNB_id), @@ -99,7 +99,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id else { LOG_D(PHY,"[UE %d][SR %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n", phy_vars_ue->Mod_id, - phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,phy_vars_ue->frame,subframe, + phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,phy_vars_ue->frame_tx,subframe, Po_PUCCH, phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH, get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,eNB_id), diff --git a/openair1/SCHED/pusch_pc.c b/openair1/SCHED/pusch_pc.c index 16d6227c1c..99ec638240 100644 --- a/openair1/SCHED/pusch_pc.c +++ b/openair1/SCHED/pusch_pc.c @@ -73,7 +73,7 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u uint8_t harq_pid = subframe2harq_pid(&phy_vars_ue->lte_frame_parms, - ((subframe==0)?1:0) + phy_vars_ue->frame, + phy_vars_ue->frame_tx, subframe); uint8_t nb_rb = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->nb_rb; @@ -96,7 +96,7 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH += (mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id,0) + PL); LOG_D(PHY,"[UE %d][RAPROC] frame %d, subframe %d: Msg3 Po_PUSCH %d dBm (%d,%d,%d,%d,%d)\n", - phy_vars_ue->Mod_id,((subframe==0)?1:0)+phy_vars_ue->frame,subframe,phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH, + phy_vars_ue->Mod_id,phy_vars_ue->frame_tx,subframe,phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH, 100*mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id,0), hundred_times_log10_NPRB[nb_rb-1], 100*PL, @@ -117,7 +117,7 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u phy_vars_ue->ulsch_ue[eNB_id]->PHR = 40; LOG_D(PHY,"[UE %d][PUSCH %d] frame %d, subframe %d: Po_PUSCH %d dBm : Po_NOMINAL_PUSCH %d,log10(NPRB) %f,PHR %d, PL %d, alpha*PL %f,delta_IF %f,f_pusch %d\n", - phy_vars_ue->Mod_id,harq_pid,((subframe==0)?1:0) + phy_vars_ue->frame,subframe, + phy_vars_ue->Mod_id,harq_pid,phy_vars_ue->frame_tx,subframe, phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH, phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUSCH, hundred_times_log10_NPRB[nb_rb-1]/100.0, diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 7e563eb25a..b34f9c2296 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1571,7 +1571,7 @@ int main(int argc, char **argv) { } for (SNR=snr0;SNR<snr1;SNR+=snr_step) { - PHY_vars_UE->frame=0; + PHY_vars_UE->frame_rx=0; errs[0]=0; errs[1]=0; errs[2]=0; @@ -2656,14 +2656,14 @@ PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, //len = chbch_stats_read(stats_buffer,NULL,0,4096); //printf("%s\n\n",stats_buffer); - if (PHY_vars_UE->frame % 10 == 0) { + if (PHY_vars_UE->frame_rx % 10 == 0) { PHY_vars_UE->bitrate[eNB_id] = (PHY_vars_UE->total_TBS[eNB_id] - PHY_vars_UE->total_TBS_last[eNB_id])*10; LOG_D(PHY,"[UE %d] Calculating bitrate: total_TBS = %d, total_TBS_last = %d, bitrate = %d kbits/s\n",PHY_vars_UE->Mod_id,PHY_vars_UE->total_TBS[eNB_id],PHY_vars_UE->total_TBS_last[eNB_id],PHY_vars_UE->bitrate[eNB_id]/1000); PHY_vars_UE->total_TBS_last[eNB_id] = PHY_vars_UE->total_TBS[eNB_id]; } - PHY_vars_UE->frame++; + PHY_vars_UE->frame_rx++; } //trials // round_trials[0]: number of code word : goodput the protocol diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index c92171f275..7562aeceef 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -728,7 +728,7 @@ int main(int argc, char **argv) { PHY_vars_eNB->lte_frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0; PHY_vars_UE->lte_frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0; PHY_vars_eNB->lte_frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0; - PHY_vars_UE->frame=1; + PHY_vars_UE->frame_tx=1; for (sf=0;sf<10;sf++) { PHY_vars_eNB->proc[sf].frame_tx=1; @@ -742,12 +742,12 @@ int main(int argc, char **argv) { msg("Init UL hopping eNB\n"); init_ul_hopping(&PHY_vars_eNB->lte_frame_parms); - PHY_vars_eNB->proc[subframe].frame_rx = PHY_vars_UE->frame; + PHY_vars_eNB->proc[subframe].frame_rx = PHY_vars_UE->frame_tx; if (ul_subframe2pdcch_alloc_subframe(&PHY_vars_eNB->lte_frame_parms,subframe) > subframe) // allocation was in previous frame - PHY_vars_eNB->proc[ul_subframe2pdcch_alloc_subframe(&PHY_vars_eNB->lte_frame_parms,subframe)].frame_tx = (PHY_vars_UE->frame-1)&1023; + PHY_vars_eNB->proc[ul_subframe2pdcch_alloc_subframe(&PHY_vars_eNB->lte_frame_parms,subframe)].frame_tx = (PHY_vars_UE->frame_tx-1)&1023; // printf("UE frame %d, eNB frame %d (eNB frame_tx %d)\n",PHY_vars_UE->frame,PHY_vars_eNB->proc[subframe].frame_rx,PHY_vars_eNB->proc[ul_subframe2pdcch_alloc_subframe(&PHY_vars_eNB->lte_frame_parms,subframe)].frame_tx); - PHY_vars_UE->frame = (PHY_vars_UE->frame-1)&1023; + PHY_vars_UE->frame_tx = (PHY_vars_UE->frame_tx-1)&1023; generate_ue_ulsch_params_from_dci((void *)&UL_alloc_pdu, 14, @@ -777,7 +777,7 @@ int main(int argc, char **argv) { - PHY_vars_UE->frame = (PHY_vars_UE->frame+1)&1023; + PHY_vars_UE->frame_tx = (PHY_vars_UE->frame_tx+1)&1023; for (ch_realization=0;ch_realization<n_ch_rlz;ch_realization++){ @@ -816,7 +816,7 @@ int main(int argc, char **argv) { //randominit(0); - harq_pid = subframe2harq_pid(&PHY_vars_UE->lte_frame_parms,PHY_vars_UE->frame,subframe); + harq_pid = subframe2harq_pid(&PHY_vars_UE->lte_frame_parms,PHY_vars_UE->frame_tx,subframe); // printf("UL frame %d/subframe %d, harq_pid %d\n",PHY_vars_UE->frame,subframe,harq_pid); if (input_fdUL == NULL) { input_buffer_length = PHY_vars_UE->ulsch_ue[0]->harq_processes[harq_pid]->TBS/8; @@ -978,11 +978,11 @@ int main(int argc, char **argv) { start_meas(&PHY_vars_UE->ulsch_modulation_stats); #ifdef OFDMA_ULSCH ulsch_modulation(PHY_vars_UE->lte_ue_common_vars.txdataF,AMP, - PHY_vars_UE->frame,subframe,&PHY_vars_UE->lte_frame_parms,PHY_vars_UE->ulsch_ue[0]); + PHY_vars_UE->frame_tx,subframe,&PHY_vars_UE->lte_frame_parms,PHY_vars_UE->ulsch_ue[0]); #else // printf("Generating PUSCH in subframe %d with amp %d, nb_rb %d\n",subframe,AMP,nb_rb); ulsch_modulation(PHY_vars_UE->lte_ue_common_vars.txdataF,AMP, - PHY_vars_UE->frame,subframe,&PHY_vars_UE->lte_frame_parms, + PHY_vars_UE->frame_tx,subframe,&PHY_vars_UE->lte_frame_parms, PHY_vars_UE->ulsch_ue[0]); #endif stop_meas(&PHY_vars_UE->ulsch_modulation_stats); -- 2.26.2