diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index d2a814c1755940db4912dcf366c004cea0296231..56b23ea2b5cee744a74fb16a86553b6c89167334 100755 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -483,7 +483,8 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB) if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) { if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) { - + + eNB->soundingrs_ul_config_dedicated[UE_id].srsConfigDedicatedSetup = 1; eNB->soundingrs_ul_config_dedicated[UE_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration; eNB->soundingrs_ul_config_dedicated[UE_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift; eNB->soundingrs_ul_config_dedicated[UE_id].freqDomainPosition = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition; diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index 4fef74dd1cc2bb1a714b42081793001fd008f9cd..22ed10ebb7c2f3874c7a82f3af786f523361dd00 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -667,28 +667,28 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB, } extern uint16_t transmission_offset_tdd[16]; -#define DEBUG_SRS +//#define DEBUG_SRS int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, LTE_eNB_COMMON *common_vars, LTE_eNB_SRS *srs_vars, SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated, - unsigned char sub_frame_number, + unsigned char subframe, unsigned char eNB_id) { - int T_SFC,aa; + int aa; int N_symb,symbol; - uint8_t nb_antennas_rx = frame_parms->nb_antenna_ports_eNB; + uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; #ifdef DEBUG_SRS char fname[40], vname[40]; #endif - uint8_t Ssrs = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; + //uint8_t Ssrs = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; + //uint8_t T_SFC = (Ssrs<=7 ? 5 : 10); N_symb = 2*7-frame_parms->Ncp; - symbol = (sub_frame_number+1)*N_symb-1; //SRS is always in last symbol of subframe - T_SFC = (Ssrs<=7 ? 5 : 10); + symbol = N_symb-1; //SRS is always in last symbol of subframe /* msg("SRS channel estimation eNB %d, subframs %d, %d %d %d %d %d\n",eNB_id,sub_frame_number, @@ -699,19 +699,21 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, SRS_parms->Ssrs); */ - if ((1<<(sub_frame_number%T_SFC))&transmission_offset_tdd[Ssrs]) { + //if ((1<<(sub_frame_number%T_SFC))&transmission_offset_tdd[Ssrs]) { - if (generate_srs_rx(frame_parms, - soundingrs_ul_config_dedicated, - srs_vars->srs)==-1) { - msg("lte_srs_channel_estimation: Error in generate_srs_rx\n"); + if (generate_srs(frame_parms, + soundingrs_ul_config_dedicated, + &srs_vars->srs[eNB_id], + 0x7FFF, + subframe)==-1) { + LOG_E(PHY,"lte_srs_channel_estimation: Error in generate_srs_rx\n"); return(-1); } for (aa=0; aa<nb_antennas_rx; aa++) { #ifdef DEBUG_SRS msg("SRS channel estimation eNB %d, subframs %d, aarx %d, %p, %p, %p\n",eNB_id,sub_frame_number,aa, - &common_vars->rxdataF[eNB_id][aa][2*frame_parms->ofdm_symbol_size*symbol], + &common_vars->rxdataF[eNB_id][aa][frame_parms->ofdm_symbol_size*symbol], srs_vars->srs, srs_vars->srs_ch_estimates[eNB_id][aa]); #endif @@ -719,14 +721,15 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, //write_output("eNB_rxF.m","rxF",&common_vars->rxdataF[0][aa][2*frame_parms->ofdm_symbol_size*symbol],2*(frame_parms->ofdm_symbol_size),2,1); //write_output("eNB_srs.m","srs_eNB",common_vars->srs,(frame_parms->ofdm_symbol_size),1,1); - mult_cpx_conj_vector((int16_t*) &common_vars->rxdataF[eNB_id][aa][2*frame_parms->ofdm_symbol_size*symbol], - (int16_t*) srs_vars->srs, + //memcpy(srs_vars->srs_ch_estimates[eNB_id][aa],&srs_vars->srs[eNB_id],frame_parms->ofdm_symbol_size*sizeof(int32_t)); + //memcpy(srs_vars->srs_ch_estimates[eNB_id][aa],&common_vars->rxdataF[eNB_id][aa][frame_parms->ofdm_symbol_size*symbol],frame_parms->ofdm_symbol_size*sizeof(int32_t)); + mult_cpx_conj_vector((int16_t*) &common_vars->rxdataF[eNB_id][aa][frame_parms->ofdm_symbol_size*symbol], + (int16_t*) &srs_vars->srs[eNB_id], (int16_t*) srs_vars->srs_ch_estimates[eNB_id][aa], frame_parms->ofdm_symbol_size, 15, 0); - //msg("SRS channel estimation cmult out\n"); #ifdef USER_MODE #ifdef DEBUG_SRS sprintf(fname,"eNB_id%d_an%d_srs_ch_est.m",eNB_id,aa); @@ -735,7 +738,6 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, #endif #endif } - } /* else { diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 00e7d45b8c6a9614204d27135404153f55ac484f..2a8e44256351d1a1602fa8d5e66e81d677867007 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -8010,6 +8010,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, print_CQI(ulsch->o,ulsch->uci_format,eNB_id,ue->frame_parms.N_RB_DL); + ulsch->bundling = 1-AckNackFBMode; if (frame_parms->frame_type == FDD) { int dl_subframe = (subframe<4) ? (subframe+6) : (subframe-4); @@ -8041,7 +8042,6 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ulsch->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1); ulsch->srs_active = use_srs; - ulsch->bundling = 1-AckNackFBMode; if ((rnti >= cba_rnti) && (rnti < p_rnti)) ulsch->harq_processes[harq_pid]->status = CBA_ACTIVE; @@ -8644,6 +8644,8 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ulsch->harq_processes[harq_pid]->uci_format = HLC_subband_cqi_nopmi; } + ulsch->bundling = 1-AckNackFBMode; + if (frame_parms->frame_type == FDD) { int dl_subframe = (subframe<4) ? (subframe+6) : (subframe-4); @@ -8667,7 +8669,6 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB, ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1); ulsch->harq_processes[harq_pid]->srs_active = use_srs; - ulsch->bundling = 1-AckNackFBMode; //Mapping of cyclic shift field in DCI format0 to n_DMRS2 (3GPP 36.211, Table 5.5.2.1.1-1) if(cshift == 0) diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 409c41da4fe22725120f0ee55c9c6be195f8e458..46847d91e4a29f86540ffc6e03c7cc6d8304136f 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -1568,9 +1568,11 @@ uint8_t SE2I_TBS(float SE, @param soundingrs_ul_config_dedicated Dynamic configuration from RRC during Connection Establishment @param txdataF pointer to the frequency domain TX signal @returns 0 on success*/ -int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms, - SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated, - int *txdataF); +int generate_srs(LTE_DL_FRAME_PARMS *frame_parms, + SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated, + int *txdataF, + int16_t amp, + uint32_t subframe); int32_t generate_srs_tx_emul(PHY_VARS_UE *phy_vars_ue, uint8_t subframe); diff --git a/openair1/PHY/LTE_TRANSPORT/rar_tools.c b/openair1/PHY/LTE_TRANSPORT/rar_tools.c index 60fa52df16d06087a0a2513ac4cdd64999426090..2629c6ba7f2505c6944fa9b000e2a637b4ce4a48 100644 --- a/openair1/PHY/LTE_TRANSPORT/rar_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/rar_tools.c @@ -31,6 +31,7 @@ */ #include "PHY/defs.h" #include "PHY/extern.h" +#include "SCHED/defs.h" #include "SCHED/extern.h" #include "LAYER2/MAC/defs.h" #include "SCHED/defs.h" @@ -69,6 +70,7 @@ int generate_eNB_ulsch_params_from_rar(unsigned char *rar_pdu, uint8_t cqireq; uint16_t *RIV2nb_rb_LUT, *RIV2first_rb_LUT; uint16_t RIV_max; + uint16_t use_srs=0; LOG_D(PHY,"[eNB][RAPROC] generate_eNB_ulsch_params_from_rar: subframe %d (harq_pid %d)\n",subframe,harq_pid); @@ -133,8 +135,6 @@ int generate_eNB_ulsch_params_from_rar(unsigned char *rar_pdu, ulsch->beta_offset_ri_times8 = 10; ulsch->beta_offset_harqack_times8 = 16; - - ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1); ulsch->rnti = (((uint16_t)rar[4])<<8)+rar[5]; if (ulsch->harq_processes[harq_pid]->round == 0) { @@ -151,6 +151,19 @@ int generate_eNB_ulsch_params_from_rar(unsigned char *rar_pdu, ulsch->harq_processes[harq_pid]->round++; } + + ulsch->Msg3_active = 1; + + get_Msg3_alloc(frame_parms, + subframe, + frame, + &ulsch->Msg3_frame, + &ulsch->Msg3_subframe); + + use_srs = is_srs_occasion_common(frame_parms,ulsch->Msg3_frame,ulsch->Msg3_subframe); + ulsch->harq_processes[harq_pid]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)-(use_srs==0?0:1); + ulsch->harq_processes[harq_pid]->srs_active = use_srs; + #ifdef DEBUG_RAR msg("ulsch ra (eNB): harq_pid %d\n",harq_pid); msg("ulsch ra (eNB): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb); diff --git a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c index 7e29d998a10e30c49d96ba934d2822d86127fe75..8381eca5e411c95d9130f93eb1e3206fa1401aa1 100644 --- a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c @@ -120,17 +120,15 @@ int compareints (const void * a, const void * b) return ( *(unsigned short*)a - *(unsigned short*)b ); } - -int32_t generate_srs_tx(PHY_VARS_UE *ue, - uint8_t eNB_id, - int16_t amp, - uint32_t subframe) +#define DEBUG_SRS +int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms, + SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated, + int32_t *txptr, + int16_t amp, + uint32_t subframe) { - LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; - SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; - int32_t **txdataF = ue->common_vars.txdataF; - uint16_t msrsb=0,Nb=0,nb,b,msrs0=0,k,Msc_RS,Msc_RS_idx,carrier_pos,symbol_offset; + uint16_t msrsb=0,Nb=0,nb,b,msrs0=0,k,Msc_RS,Msc_RS_idx,carrier_pos; uint16_t *Msc_idx_ptr; int32_t k0; //uint32_t subframe_offset; @@ -178,7 +176,7 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, } if (k0<0) { - msg("generate_srs: invalid parameter set msrs0=%d, msrsb=%d, Nb=%d => nb=%d, k0=%d\n",msrs0,msrsb,Nb,nb,k0); + LOG_E(PHY,"generate_srs: invalid parameter set msrs0=%d, msrsb=%d, Nb=%d => nb=%d, k0=%d\n",msrs0,msrsb,Nb,nb,k0); return(-1); } @@ -188,7 +186,7 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, if (Msc_idx_ptr) Msc_RS_idx = Msc_idx_ptr - dftsizes; else { - msg("generate_srs: index for Msc_RS=%d not found\n",Msc_RS); + LOG_E(PHY,"generate_srs: index for Msc_RS=%d not found\n",Msc_RS); return(-1); } @@ -199,29 +197,20 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, else if (Msc_RS==144) Msc_RS_idx = 9; else { - msg("generate_srs: index for Msc_RS=%d not implemented\n",Msc_RS); + LOG_E(PHY,"generate_srs: index for Msc_RS=%d not implemented\n",Msc_RS); return(-1); } #endif #ifdef DEBUG_SRS - msg("generate_srs_tx: Msc_RS = %d, Msc_RS_idx = %d\n",Msc_RS, Msc_RS_idx); + LOG_D(PHY,"generate_srs_tx: Msc_RS = %d, Msc_RS_idx = %d, k0 = %d\n",Msc_RS, Msc_RS_idx,k0); #endif carrier_pos = (frame_parms->first_carrier_offset + k0); if (carrier_pos>frame_parms->ofdm_symbol_size) { carrier_pos -= frame_parms->ofdm_symbol_size; } - uint16_t nsymb = (frame_parms->Ncp==0) ? 14:12; - symbol_offset = (int)frame_parms->ofdm_symbol_size*((subframe*nsymb)+(nsymb-1)); - - //msg("carrier_pos = %d\n",carrier_pos); - //subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size; - //symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->ofdm_symbol_size; - - int32_t *txptr; - txptr = &txdataF[0][symbol_offset]; for (k=0; k<Msc_RS; k++) { int32_t real = ((int32_t) amp * (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][k<<1]) >> 15; @@ -245,6 +234,7 @@ int generate_srs_tx_emul(PHY_VARS_UE *phy_vars_ue,uint8_t subframe) return(0); } +#if 0 int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms, SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated, int *txdataF) @@ -285,7 +275,7 @@ int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms, } if (k0<0) { - msg("Invalid parameter set msrs0=%d, msrsb=%d, Nb=%d => nb=%d, k0=%d\n",msrs0,msrsb,Nb,nb,k0); + LOG_E(PHY,"Invalid parameter set msrs0=%d, msrsb=%d, Nb=%d => nb=%d, k0=%d\n",msrs0,msrsb,Nb,nb,k0); return(-1); } @@ -295,7 +285,7 @@ int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms, if (Msc_idx_ptr) Msc_RS_idx = Msc_idx_ptr - dftsizes; else { - msg("generate_srs: index for Msc_RS=%d not found\n",Msc_RS); + LOG_E(PHY,"generate_srs: index for Msc_RS=%d not found\n",Msc_RS); return(-1); } @@ -306,23 +296,21 @@ int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms, else if (Msc_RS==144) Msc_RS_idx = 9; else { - msg("generate_srs: index for Msc_RS=%d not implemented\n",Msc_RS); + LOG_E(PHY,"generate_srs: index for Msc_RS=%d not implemented\n",Msc_RS); return(-1); } #endif #ifdef DEBUG_SRS - msg("generate_srs_rx: Msc_RS = %d, Msc_RS_idx = %d, k0=%d\n",Msc_RS, Msc_RS_idx,k0); + LOG_I(PHY,"generate_srs_rx: Msc_RS = %d, Msc_RS_idx = %d, k0=%d\n",Msc_RS, Msc_RS_idx,k0); #endif carrier_pos = (frame_parms->first_carrier_offset + k0) % frame_parms->ofdm_symbol_size; for (k=0; k<Msc_RS; k++) { - ((short*) txdataF)[carrier_pos<<2] = ul_ref_sigs_rx[0][0][Msc_RS_idx][k<<2]; - ((short*) txdataF)[(carrier_pos<<2)+1] = ul_ref_sigs_rx[0][0][Msc_RS_idx][(k<<2)+1]; - ((short*) txdataF)[(carrier_pos<<2)+2] = ul_ref_sigs_rx[0][0][Msc_RS_idx][(k<<2)+2]; - ((short*) txdataF)[(carrier_pos<<2)+3] = ul_ref_sigs_rx[0][0][Msc_RS_idx][(k<<2)+3]; + ((short*) txdataF)[carrier_pos<<1] = ul_ref_sigs_rx[0][0][Msc_RS_idx][k<<1]; + ((short*) txdataF)[(carrier_pos<<1)+1] = ul_ref_sigs_rx[0][0][Msc_RS_idx][(k<<1)+1]; carrier_pos+=2; if (carrier_pos >= frame_parms->ofdm_symbol_size) @@ -365,7 +353,7 @@ int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms, // write_output("srs_rx.m","srsrx",txdataF,1024,2,1); return(0); } - +#endif #ifdef MAIN main() diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index 13beb469e426b6ae86ed769df59dc07af0f6e4a8..dd057f997513a2cc6a4bc45fe4545689dc5068a6 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -84,7 +84,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) fl_set_xyplot_ybounds(fdui->rxsig_t,10,70); // Time-domain channel response - fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" ); + fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "SRS Frequency Response (samples, abs)" ); fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX ); fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED ); fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color @@ -196,7 +196,8 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, bit = malloc(coded_bits_per_codeword*sizeof(float)); rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdata[eNB_id]; - chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; + //chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; + chest_t = (int16_t**) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates[eNB_id]; chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id]; pusch_llr = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->llr; pusch_comp = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0]; @@ -232,8 +233,10 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, if (chest_t[0] !=NULL) { for (i=0; i<(frame_parms->ofdm_symbol_size); i++) { - i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; - time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); + //i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; + i2=i; + //time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); + time2[i] = (float)i; chest_t_abs[0][i] = 10*log10((float) (1+chest_t[0][2*i2]*chest_t[0][2*i2]+chest_t[0][2*i2+1]*chest_t[0][2*i2+1])); if (chest_t_abs[0][i] > ymax) diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index e9604a36f649735e668407e431864ef9260cb186..5707aedd27ccdff32b079a7ce142d77522dddd5e 100755 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -320,7 +320,7 @@ typedef struct { uint16_t srs_ConfigIndex; /// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value. uint8_t cyclicShift; - // Parameter: ue srs subframe for internal implementation + // Parameter: internal implementation: UE SRS configured uint8_t srsConfigDedicatedSetup; // Parameter: cell srs subframe for internal implementation uint8_t srsCellSubframe; diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index fd4b868382af36dd9abaf5f82fc4d3ae0b473c05..283ae2db6ddd58a9a0d7fa2b4e2a05c2d2f3575d 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/defs.h @@ -514,6 +514,10 @@ void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id, void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe, unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid); +int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx); + +void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset); + /*@}*/ diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c index ae61f7be0dcd58017d1f7feacb99146b86f409f5..e5753483daf8c7966fd4684b985dc4d7c03f51f4 100644 --- a/openair1/SCHED/phy_procedures_lte_common.c +++ b/openair1/SCHED/phy_procedures_lte_common.c @@ -942,3 +942,148 @@ MU_MIMO_mode *get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti) return &PHY_vars_eNB_g[Mod_id][CC_id]->mu_mimo_mode[UE_id]; } + +int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx) +{ + uint8_t isSubframeSRS = 0; // SRS Cell Occasion + + //ue->ulsch[eNB_id]->srs_active = 0; + //ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; + if(frame_parms->soundingrs_ul_config_common.enabled_flag) + { + + LOG_D(PHY," SRS SUBFRAMECONFIG: %d\n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig); + + uint8_t TSFC; + uint16_t deltaTSFC; // bitmap + uint8_t srs_SubframeConfig; + + // table resuming TSFC (Period) and deltaSFC (offset) + const uint16_t deltaTSFCTabType1[15][2] = { {1,1},{1,2},{2,2},{1,5},{2,5},{4,5},{8,5},{3,5},{12,5},{1,10},{2,10},{4,10},{8,10},{351,10},{383,10} }; // Table 5.5.3.3-2 3GPP 36.211 FDD + const uint16_t deltaTSFCTabType2[14][2] = { {2,5},{6,5},{10,5},{18,5},{14,5},{22,5},{26,5},{30,5},{70,10},{74,10},{194,10},{326,10},{586,10},{210,10} }; // Table 5.5.3.3-2 3GPP 36.211 TDD + + srs_SubframeConfig = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; + if (FDD == frame_parms->frame_type) + { + // srs_SubframeConfig =< 14 + deltaTSFC = deltaTSFCTabType1[srs_SubframeConfig][0]; + TSFC = deltaTSFCTabType1[srs_SubframeConfig][1]; + } + else + { + // srs_SubframeConfig =< 13 + deltaTSFC = deltaTSFCTabType2[srs_SubframeConfig][0]; + TSFC = deltaTSFCTabType2[srs_SubframeConfig][1]; + } + + // Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC + uint16_t tmp = (subframe_tx % TSFC); + if((1<<tmp) & deltaTSFC) + { + // This is a Sounding reference signal subframes + isSubframeSRS = 1; + } + LOG_D(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d.%d\n", frame_parms->frame_type, TSFC, deltaTSFC, frame_tx, subframe_tx); + } + return(isSubframeSRS); +} + +void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) +{ + if(TDD == frameType) + { + if(isrs<10) + { + mac_xface->macphy_exit("2 ms SRS periodicity not supported"); + } + + if((isrs>9)&&(isrs<15)) + { + *psrsPeriodicity=5; + *psrsOffset=isrs-10; + } + if((isrs>14)&&(isrs<25)) + { + *psrsPeriodicity=10; + *psrsOffset=isrs-15; + } + if((isrs>24)&&(isrs<45)) + { + *psrsPeriodicity=20; + *psrsOffset=isrs-25; + } + if((isrs>44)&&(isrs<85)) + { + *psrsPeriodicity=40; + *psrsOffset=isrs-45; + } + if((isrs>84)&&(isrs<165)) + { + *psrsPeriodicity=80; + *psrsOffset=isrs-85; + } + if((isrs>164)&&(isrs<325)) + { + *psrsPeriodicity=160; + *psrsOffset=isrs-165; + } + if((isrs>324)&&(isrs<645)) + { + *psrsPeriodicity=320; + *psrsOffset=isrs-325; + } + + if(isrs>644) + { + mac_xface->macphy_exit("Isrs out of range"); + } + + } + else + { + if(isrs<2) + { + *psrsPeriodicity=2; + *psrsOffset=isrs; + } + if((isrs>1)&&(isrs<7)) + { + *psrsPeriodicity=5; + *psrsOffset=isrs-2; + } + if((isrs>6)&&(isrs<17)) + { + *psrsPeriodicity=10; + *psrsOffset=isrs-7; + } + if((isrs>16)&&(isrs<37)) + { + *psrsPeriodicity=20; + *psrsOffset=isrs-17; + } + if((isrs>36)&&(isrs<77)) + { + *psrsPeriodicity=40; + *psrsOffset=isrs-37; + } + if((isrs>76)&&(isrs<157)) + { + *psrsPeriodicity=80; + *psrsOffset=isrs-77; + } + if((isrs>156)&&(isrs<317)) + { + *psrsPeriodicity=160; + *psrsOffset=isrs-157; + } + if((isrs>316)&&(isrs<637)) + { + *psrsPeriodicity=320; + *psrsOffset=isrs-317; + } + if(isrs>636) + { + mac_xface->macphy_exit("Isrs out of range"); + } + } +} diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 97c8fb08375f97ee8abece1e91411712ac14b968..821cfef7dff0937cd0a95be061e2659374d8c1ea 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -307,8 +307,6 @@ void phy_procedures_emos_eNB_TX(unsigned char subframe, PHY_VARS_eNB *eNB) } #endif - - void phy_procedures_eNB_S_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type) { UNUSED(r_type); @@ -824,6 +822,13 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; int frame = proc->frame_tx; int subframe = proc->subframe_tx; + /* + uint16_t srsPeriodicity=0; + uint16_t srsOffset=0; + uint16_t srsConfigIndex=0; + uint16_t do_srs=0; + */ + uint16_t is_srs_pos=0; LOG_D(PHY, "[eNB %"PRIu8"][PUSCH %"PRIu8"] Frame %d subframe %d UL Frame %"PRIu32", UL Subframe %"PRIu8", Generated ULSCH (format0) DCI (rnti %"PRIx16", dci %"PRIx8"), aggregation %d\n", @@ -839,6 +844,20 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC dci_alloc->dci_pdu[0], 1<<dci_alloc->L); + is_srs_pos = is_srs_occasion_common(fp,pdcch_alloc2ul_frame(fp,frame,subframe),pdcch_alloc2ul_subframe(fp,subframe)); + /* + if (is_srs_pos && eNB->soundingrs_ul_config_dedicated[UE_id].srsConfigDedicatedSetup) { + srsConfigIndex = eNB->soundingrs_ul_config_dedicated[UE_id].srs_ConfigIndex; + compute_srs_pos(fp->frame_type, srsConfigIndex, &srsPeriodicity, &srsOffset); + if ((((10*pdcch_alloc2ul_frame(fp,frame,subframe)+pdcch_alloc2ul_subframe(fp,subframe)) % srsPeriodicity) == srsOffset)) { + do_srs = 1; + } + } + LOG_D(PHY,"frame %d (%d), subframe %d (%d), UE_id %d: is_srs_pos %d, do_SRS %d, index %d, period %d, offset %d \n", + frame,pdcch_alloc2ul_frame(fp,frame,subframe),subframe,pdcch_alloc2ul_subframe(fp,subframe), + UE_id,is_srs_pos,do_srs,srsConfigIndex,srsPeriodicity,srsOffset); + */ + generate_eNB_ulsch_params_from_dci(eNB, proc, &dci_alloc->dci_pdu[0], @@ -849,7 +868,7 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC 0, P_RNTI, CBA_RNTI, - 0); // do_srs + is_srs_pos); LOG_T(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resources for UE spec DCI (PUSCH %"PRIx16") => %d\n", eNB->Mod_id,frame,subframe,dci_alloc->rnti, @@ -989,17 +1008,10 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d generate_eNB_ulsch_params_from_rar(DLSCH_pdu, frame, - (subframe), + subframe, eNB->ulsch[(uint32_t)UE_id], fp); - eNB->ulsch[(uint32_t)UE_id]->Msg3_active = 1; - - get_Msg3_alloc(fp, - subframe, - frame, - &eNB->ulsch[(uint32_t)UE_id]->Msg3_frame, - &eNB->ulsch[(uint32_t)UE_id]->Msg3_subframe); LOG_D(PHY,"[eNB][RAPROC] Frame %d subframe %d, Activated Msg3 demodulation for UE %"PRId8" in frame %"PRIu32", subframe %"PRIu8"\n", frame, subframe, @@ -1344,7 +1356,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, // Apply physicalConfigDedicated if needed // This is for UEs that have received this IE, which changes these DL and UL configuration, we apply after a delay for the eNodeB UL parameters phy_config_dedicated_eNB_step2(eNB); - + // Now loop again over the DCIs for UL configuration for (i=0; i<DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci ; i++) { dci_alloc = &DCI_pdu->dci_alloc[i]; @@ -2071,7 +2083,7 @@ void prach_procedures(PHY_VARS_eNB *eNB) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0); } -void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq_pid) +void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq_pid,uint8_t do_srs) { LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; uint8_t SR_payload = 0,*pucch_payload=NULL,pucch_payload0[2]= {0,0},pucch_payload1[2]= {0,0}; @@ -2150,7 +2162,7 @@ void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq UE_id, eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex, 0, // n2_pucch - 0, // shortened format, should be use_srs flag, later + do_srs, // shortened format &SR_payload, frame, subframe, @@ -2190,7 +2202,7 @@ void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq UE_id, (uint16_t)n1_pucch0, 0, //n2_pucch - 0, // shortened format + do_srs, // shortened format pucch_payload0, frame, subframe, @@ -2220,7 +2232,7 @@ void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq UE_id, eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex, 0, //n2_pucch - 0, // shortened format + do_srs, // shortened format pucch_payload0, frame, subframe, @@ -2281,7 +2293,7 @@ void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq UE_id, eNB->scheduling_request_config[UE_id].sr_PUCCH_ResourceIndex, 0, //n2_pucch - 0, // shortened format + do_srs, // shortened format pucch_payload0, frame, subframe, @@ -2313,7 +2325,7 @@ void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq UE_id, (uint16_t)n1_pucch0, 0, // n2_pucch - 0, // shortened format + do_srs, // shortened format pucch_payload0, frame, subframe, @@ -2338,7 +2350,7 @@ void pucch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq UE_id, (uint16_t)n1_pucch1, 0, //n2_pucch - 0, // shortened format + do_srs, // shortened format pucch_payload1, frame, subframe, @@ -2866,6 +2878,16 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const const int frame = proc->frame_rx; int offset = eNB->CC_id;//(proc == &eNB->proc.proc_rxtx[0]) ? 0 : 1; + uint16_t srsPeriodicity; + uint16_t srsOffset; + uint16_t do_srs=0; + uint16_t is_srs_pos=0; + + T(T_ENB_PHY_UL_TICK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe)); + + T(T_ENB_PHY_INPUT_SIGNAL, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(0), + T_BUFFER(&eNB->common_vars.rxdata[0][0][subframe*eNB->frame_parms.samples_per_tti], + eNB->frame_parms.samples_per_tti * 4)); if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return; @@ -2875,19 +2897,12 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const LOG_D(PHY,"[eNB %d] Frame %d: Doing phy_procedures_eNB_uespec_RX(%d)\n",eNB->Mod_id,frame, subframe); #endif - T(T_ENB_PHY_UL_TICK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe)); - - T(T_ENB_PHY_INPUT_SIGNAL, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(0), - T_BUFFER(&eNB->common_vars.rxdata[0][0][subframe*eNB->frame_parms.samples_per_tti], - eNB->frame_parms.samples_per_tti * 4)); eNB->rb_mask_ul[0]=0; eNB->rb_mask_ul[1]=0; eNB->rb_mask_ul[2]=0; eNB->rb_mask_ul[3]=0; - - // Check for active processes in current subframe harq_pid = subframe2harq_pid(fp, frame,subframe); @@ -2897,13 +2912,36 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const eNB->cba_last_reception[i]=0; } - // Do PUCCH processing first - + is_srs_pos = is_srs_occasion_common(fp,frame,subframe); + for (i=0; i<NUMBER_OF_UE_MAX; i++) { - pucch_procedures(eNB,proc,i,harq_pid); - } - for (i=0; i<NUMBER_OF_UE_MAX; i++) { + // Do SRS processing + // check if there is SRS and we have to use shortened format + // TODO: check for exceptions in transmission of SRS together with ACK/NACK + do_srs=0; + if (is_srs_pos && eNB->soundingrs_ul_config_dedicated[i].srsConfigDedicatedSetup ) { + compute_srs_pos(fp->frame_type, eNB->soundingrs_ul_config_dedicated[i].srs_ConfigIndex, &srsPeriodicity, &srsOffset); + if (((10*frame+subframe) % srsPeriodicity) == srsOffset) { + do_srs = 1; + } + } + + if (do_srs==1) { + if (lte_srs_channel_estimation(fp, + &eNB->common_vars, + &eNB->srs_vars[i], + &eNB->soundingrs_ul_config_dedicated[i], + subframe, + 0/*eNB_id*/)) { + LOG_E(PHY,"problem processing SRS\n"); + } + } + + // Do PUCCH processing + + pucch_procedures(eNB,proc,i,harq_pid, do_srs); + // check for Msg3 if (eNB->mac_enabled==1) { diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index a94847f83fd47a3d9c6a05ba72fd44c4ebbe391f..b8a9159955025ab9f6b40a312099e1d85a6a3d8a 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -259,7 +259,6 @@ void dump_dlsch_ra(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t s write_output("dlsch_mag2.m","dlschmag2",ue->pdsch_vars_ra[0]->dl_ch_magb0,300*nsymb,1,1); } - void phy_reset_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { @@ -416,7 +415,9 @@ uint8_t is_cqi_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) // cqirep->cqi_PMI_ConfigIndex, // (((10*frame + subframe) % cqirep->Npd) == cqirep->N_OFFSET_CQI)); - if (((10*frame + subframe) % cqirep->Npd) == cqirep->N_OFFSET_CQI) + if (cqirep->cqi_PMI_ConfigIndex==-1) + return(0); + else if (((10*frame + subframe) % cqirep->Npd) == cqirep->N_OFFSET_CQI) return(1); else return(0); @@ -435,170 +436,34 @@ uint8_t is_ri_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) // ue->Mod_id,ue->pdcch_vars[eNB_id]->crnti,frame,subframe, // cqirep->ri_ConfigIndex, // (((10*frame + subframe + cqirep->N_OFFSET_CQI - N_OFFSET_RI) % (cqirep->Npd<<log2Mri)) == 0)); - - if (((10*frame + subframe + cqirep->N_OFFSET_CQI - N_OFFSET_RI) % (cqirep->Npd<<log2Mri)) == 0) + if (cqirep->ri_ConfigIndex==-1) + return(0); + else if (((10*frame + subframe + cqirep->N_OFFSET_CQI - N_OFFSET_RI) % (cqirep->Npd<<log2Mri)) == 0) return(1); else return(0); } -void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) -{ - if(TDD == frameType) - { - if(isrs<10) - { - mac_xface->macphy_exit("2 ms SRS periodicity not supported"); - } - if((isrs>9)&&(isrs<15)) - { - *psrsPeriodicity=5; - *psrsOffset=isrs-10; - } - if((isrs>14)&&(isrs<25)) - { - *psrsPeriodicity=10; - *psrsOffset=isrs-15; - } - if((isrs>24)&&(isrs<45)) - { - *psrsPeriodicity=20; - *psrsOffset=isrs-25; - } - if((isrs>44)&&(isrs<85)) - { - *psrsPeriodicity=40; - *psrsOffset=isrs-45; - } - if((isrs>84)&&(isrs<165)) - { - *psrsPeriodicity=80; - *psrsOffset=isrs-85; - } - if((isrs>164)&&(isrs<325)) - { - *psrsPeriodicity=160; - *psrsOffset=isrs-165; - } - if((isrs>324)&&(isrs<645)) - { - *psrsPeriodicity=320; - *psrsOffset=isrs-325; - } - - if(isrs>644) - { - mac_xface->macphy_exit("Isrs out of range"); - } - - } - else - { - if(isrs<2) - { - *psrsPeriodicity=2; - *psrsOffset=isrs; - } - if((isrs>1)&&(isrs<7)) - { - *psrsPeriodicity=5; - *psrsOffset=isrs-2; - } - if((isrs>6)&&(isrs<17)) - { - *psrsPeriodicity=10; - *psrsOffset=isrs-7; - } - if((isrs>16)&&(isrs<37)) - { - *psrsPeriodicity=20; - *psrsOffset=isrs-17; - } - if((isrs>36)&&(isrs<77)) - { - *psrsPeriodicity=40; - *psrsOffset=isrs-37; - } - if((isrs>76)&&(isrs<157)) - { - *psrsPeriodicity=80; - *psrsOffset=isrs-77; - } - if((isrs>156)&&(isrs<317)) - { - *psrsPeriodicity=160; - *psrsOffset=isrs-157; - } - if((isrs>316)&&(isrs<637)) - { - *psrsPeriodicity=320; - *psrsOffset=isrs-317; - } - if(isrs>636) - { - mac_xface->macphy_exit("Isrs out of range"); - } - } -} -void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) +void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t isSubframeSRS) { - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - int frame_tx = proc->frame_tx; - int subframe_tx = proc->subframe_tx; - uint8_t isSubframeSRS = 0; // SRS Cell Occasion - - uint8_t is_pucch2_subframe = 0; - uint8_t is_sr_an_subframe = 0; - - SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; + + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + int frame_tx = proc->frame_tx; + int subframe_tx = proc->subframe_tx; + SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; + uint16_t srsPeriodicity; + uint16_t srsOffset; + uint8_t is_pucch2_subframe = 0; + uint8_t is_sr_an_subframe = 0; // check for SRS opportunity pSoundingrs_ul_config_dedicated->srsUeSubframe = 0; - pSoundingrs_ul_config_dedicated->srsCellSubframe = 0; + pSoundingrs_ul_config_dedicated->srsCellSubframe = isSubframeSRS; - ue->ulsch[eNB_id]->srs_active = 0; - ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; - if(frame_parms->soundingrs_ul_config_common.enabled_flag) - { - - LOG_D(PHY," SRS SUBFRAMECONFIG: %d, Isrs: %d \n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig, pSoundingrs_ul_config_dedicated->srs_ConfigIndex); - - uint8_t TSFC; - uint16_t deltaTSFC; // bitmap - uint8_t srs_SubframeConfig; - uint16_t srsPeriodicity; - uint16_t srsOffset; - - // table resuming TSFC (Period) and deltaSFC (offset) - const uint16_t deltaTSFCTabType1[15][2] = { {1,1},{1,2},{2,2},{1,5},{2,5},{4,5},{8,5},{3,5},{12,5},{1,10},{2,10},{4,10},{8,10},{351,10},{383,10} }; // Table 5.5.3.3-2 3GPP 36.211 FDD - const uint16_t deltaTSFCTabType2[14][2] = { {2,5},{6,5},{10,5},{18,5},{14,5},{22,5},{26,5},{30,5},{70,10},{74,10},{194,10},{326,10},{586,10},{210,10} }; // Table 5.5.3.3-2 3GPP 36.211 TDD - - srs_SubframeConfig = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; - if (FDD == frame_parms->frame_type) - { - // srs_SubframeConfig =< 14 - deltaTSFC = deltaTSFCTabType1[srs_SubframeConfig][0]; - TSFC = deltaTSFCTabType1[srs_SubframeConfig][1]; - } - else - { - // srs_SubframeConfig =< 13 - deltaTSFC = deltaTSFCTabType2[srs_SubframeConfig][0]; - TSFC = deltaTSFCTabType2[srs_SubframeConfig][1]; - } - - // Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC - uint16_t tmp = (subframe_tx % TSFC); - if((1<<tmp) & deltaTSFC) - { - // This is a Sounding reference signal subframes - isSubframeSRS = 1; - pSoundingrs_ul_config_dedicated->srsCellSubframe = 1; - } - LOG_D(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d.%d, srsCellSubframe: %d \n", frame_parms->frame_type, TSFC, deltaTSFC, frame_tx, subframe_tx, pSoundingrs_ul_config_dedicated->srsCellSubframe); - LOG_D(PHY," SrsDedicatedSetup: %d \n",pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup); + if (isSubframeSRS) { + LOG_D(PHY," SrsDedicatedSetup: %d \n",pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup); if(pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup) { compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); @@ -673,6 +538,7 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id } } + void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id) { @@ -1732,7 +1598,13 @@ void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8 nb_rb_srs, tx_amp); - generate_srs_tx(ue, eNB_id, tx_amp, subframe_tx); + uint16_t nsymb = (ue->frame_parms.Ncp==0) ? 14:12; + uint16_t symbol_offset = (int)ue->frame_parms.ofdm_symbol_size*((subframe_tx*nsymb)+(nsymb-1)); + generate_srs(&ue->frame_parms, + &ue->soundingrs_ul_config_dedicated[eNB_id], + &ue->common_vars.txdataF[eNB_id][symbol_offset], + tx_amp, + subframe_tx); } } @@ -2144,9 +2016,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui int subframe_tx = proc->subframe_tx; int frame_tx = proc->frame_tx; unsigned int aa; - - - + uint8_t isSubframeSRS; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN); @@ -2174,7 +2044,9 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui if (ue->UE_mode[eNB_id] != PRACH) { // check cell srs subframe and ue srs subframe. This has an impact on pusch encoding - ue_compute_srs_occasion(ue,proc,eNB_id); + isSubframeSRS = is_srs_occasion_common(&ue->frame_parms,proc->frame_tx,proc->subframe_tx); + + ue_compute_srs_occasion(ue,proc,eNB_id,isSubframeSRS); ue_ulsch_uespec_procedures(ue,proc,eNB_id,abstraction_flag); diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 3564f597ef1594806809bed481b2576c9e57b0ef..d5f1407224eb4401614039d51dd73ed5008200c4 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -42,6 +42,7 @@ #include "SCHED/vars.h" #include "LAYER2/MAC/vars.h" #include "OCG_vars.h" +#include "intertask_interface_init.h" #include "unitary_defs.h" @@ -285,8 +286,15 @@ int main(int argc, char **argv) printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz); - logInit(); + /* + // enable these lines if you need debug info + // however itti will catch all signals, so ctrl-c won't work anymore + // alternatively you can disable ITTI completely in CMakeLists.txt + itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); + set_comp_log(PHY,LOG_DEBUG,LOG_MED,1); + set_glog(LOG_DEBUG,LOG_MED); + */ while ((c = getopt (argc, argv, "hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:LF")) != -1) { switch (c) { @@ -568,6 +576,11 @@ int main(int argc, char **argv) osf, 0); + // for a call to phy_reset_ue later we need PHY_vars_UE_g allocated and pointing to UE + PHY_vars_UE_g = (PHY_VARS_UE***)malloc(sizeof(PHY_VARS_UE**)); + PHY_vars_UE_g[0] = (PHY_VARS_UE**) malloc(sizeof(PHY_VARS_UE*)); + PHY_vars_UE_g[0][0] = UE; + if (nb_rb_set == 0) nb_rb = eNB->frame_parms.N_RB_UL; @@ -582,8 +595,6 @@ int main(int argc, char **argv) txdata = UE->common_vars.txdata; - - nsymb = (eNB->frame_parms.Ncp == NORMAL) ? 14 : 12; @@ -634,21 +645,29 @@ int main(int argc, char **argv) UE->pdcch_vars[0][0]->crnti = 14; + UE->frame_parms.soundingrs_ul_config_common.enabled_flag = srs_flag; UE->frame_parms.soundingrs_ul_config_common.srs_BandwidthConfig = 2; - UE->frame_parms.soundingrs_ul_config_common.srs_SubframeConfig = 7; + UE->frame_parms.soundingrs_ul_config_common.srs_SubframeConfig = 3; + UE->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = srs_flag; + UE->soundingrs_ul_config_dedicated[eNB_id].duration = 1; + UE->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex = 2; UE->soundingrs_ul_config_dedicated[eNB_id].srs_Bandwidth = 0; UE->soundingrs_ul_config_dedicated[eNB_id].transmissionComb = 0; UE->soundingrs_ul_config_dedicated[eNB_id].freqDomainPosition = 0; + UE->soundingrs_ul_config_dedicated[eNB_id].cyclicShift = 0; + eNB->frame_parms.soundingrs_ul_config_common.enabled_flag = srs_flag; eNB->frame_parms.soundingrs_ul_config_common.srs_BandwidthConfig = 2; - eNB->frame_parms.soundingrs_ul_config_common.srs_SubframeConfig = 7; - - eNB->soundingrs_ul_config_dedicated[UE_id].srs_ConfigIndex = 1; + eNB->frame_parms.soundingrs_ul_config_common.srs_SubframeConfig = 3; + eNB->soundingrs_ul_config_dedicated[UE_id].srsConfigDedicatedSetup = srs_flag; + eNB->soundingrs_ul_config_dedicated[UE_id].duration = 1; + eNB->soundingrs_ul_config_dedicated[UE_id].srs_ConfigIndex = 2; eNB->soundingrs_ul_config_dedicated[UE_id].srs_Bandwidth = 0; eNB->soundingrs_ul_config_dedicated[UE_id].transmissionComb = 0; eNB->soundingrs_ul_config_dedicated[UE_id].freqDomainPosition = 0; + eNB->soundingrs_ul_config_dedicated[UE_id].cyclicShift = 0; + eNB->cooperation_flag = cooperation_flag; - // eNB->eNB_UE_stats[0].SRS_parameters = UE->SRS_parameters; eNB->pusch_config_dedicated[UE_id].betaOffset_ACK_Index = beta_ACK; eNB->pusch_config_dedicated[UE_id].betaOffset_RI_Index = beta_RI; @@ -659,6 +678,11 @@ int main(int argc, char **argv) UE->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled = 1; + // disable periodic cqi/ri reporting + UE->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1; + UE->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1; + + printf("PUSCH Beta : ACK %f, RI %f, CQI %f\n",(double)beta_ack[beta_ACK]/8,(double)beta_ri[beta_RI]/8,(double)beta_cqi[beta_CQI]/8); UE2eNB = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx, @@ -700,8 +724,8 @@ int main(int argc, char **argv) } - - + UE->dlsch_SI[0] = new_ue_dlsch(1,1,1827072,MAX_TURBO_ITERATIONS,N_RB_DL,0); + UE->dlsch_ra[0] = new_ue_dlsch(1,1,1827072,MAX_TURBO_ITERATIONS,N_RB_DL,0); UE->measurements.rank[0] = 0; UE->transmission_mode[0] = 2; @@ -917,6 +941,10 @@ int main(int argc, char **argv) initialize(&time_vector_rx_dec); ndi=0; + + phy_reset_ue(0,0,0); + UE->UE_mode[eNB_id]=PUSCH; + for (trials = 0; trials<n_frames; trials++) { // printf("*"); // UE->frame++; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 36b9e039356bf6e7da931a5a67709290fcd39ac6..2db6c0840aa38887868b6a38204de35b84323e16 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -427,7 +427,7 @@ void enb_config_display(void) if (enb_properties.properties[i]->srs_enable[j]) { printf( "\tsrs_BandwidthConfig for CC %d:\t%ld:\n",j,enb_properties.properties[i]->srs_BandwidthConfig[j]); - printf( "\tsrs_BandwidthConfig for CC %d:\t%ld:\n",j,enb_properties.properties[i]->srs_SubframeConfig[j]); + printf( "\tsrs_SubframeConfig for CC %d:\t%ld:\n",j,enb_properties.properties[i]->srs_SubframeConfig[j]); printf( "\tsrs_ackNackST for CC %d:\t%d:\n",j,enb_properties.properties[i]->srs_ackNackST[j]); printf( "\tsrs_MaxUpPts for CC %d:\t%d:\n",j,enb_properties.properties[i]->srs_MaxUpPts[j]); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index dee7c51a6e514178f1521d8c7484fa7ddad7e395..cab865754ea3cc2eb069d79d9f4d8b2d5897f1ad 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -383,10 +383,10 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->frame_parms->frame_type == FDD) { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,0,4);//,calibration_flag); - } else if ((mac_xface->frame_parms->tdd_config == TDD) || //TDD + } else if ((mac_xface->frame_parms->tdd_config == 0) || //TDD (mac_xface->frame_parms->tdd_config == 3) || (mac_xface->frame_parms->tdd_config == 6)) { - //schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);//,calibration_flag); + schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);//,calibration_flag); } #ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 6d0044b346a2484aeccedb1a4932572eb8e1b7cd..585d9c2c1c7c7ac9443b60fb895553233d2d062d 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -885,7 +885,7 @@ abort(); rb_table_index=UE_template->pre_allocated_rb_table_index_ul; } else { mcs=10;//cmin (10, openair_daq_vars.target_ue_ul_mcs); - rb_table_index=5; // for PHR + rb_table_index=13; // for PHR } UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=mcs; diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 4537303fca9df1e906dd3520fe7b4c79d5fc5ed7..13fafcade8bc6f739aaa397ca128fe44672d0898 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -99,7 +99,7 @@ int errno; # endif #endif -//#define XER_PRINT +#define XER_PRINT extern Enb_properties_array_t enb_properties; typedef struct xer_sprint_string_s { @@ -1593,8 +1593,33 @@ do_RRCConnectionSetup( SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=45; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0; + if (frame_parms->frame_type==FDD) { + if (enb_properties.properties[ctxt_pP->module_id]->srs_SubframeConfig[CC_id]!=0) + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %d. Expect undefined behaviour!\n", + enb_properties.properties[ctxt_pP->module_id]->srs_SubframeConfig[CC_id]); + if (ue_context_pP->local_uid >=20) + LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n", + ue_context_pP->local_uid); + //the current code will allow for 20 UEs - to be revised for more + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=7+ue_context_pP->local_uid/2; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2; + } + else { + if (enb_properties.properties[ctxt_pP->module_id]->srs_SubframeConfig[CC_id]!=7) { + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %d and %d. Expect undefined behaviour!\n", + enb_properties.properties[ctxt_pP->module_id]->srs_SubframeConfig[CC_id], + enb_properties.properties[ctxt_pP->module_id]->tdd_config[CC_id]); + } + if (ue_context_pP->local_uid >=6) + LOG_W(RRC,"This code has been optimized for up to 6 UEs, but current UE_id is %d. Expect undefined behaviour!\n", + ue_context_pP->local_uid); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=17+ue_context_pP->local_uid/2; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2; + } + LOG_W(RRC,"local UID %d, srs ConfigIndex %d, TransmissionComb %d\n",ue_context_pP->local_uid, + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex, + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift= SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpb210.conf index 024be3b77535bde64d8c6d346509cf8e6948de6b..a33c2eb41b5b449604f51010719766f7399a8125 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpb210.conf @@ -62,11 +62,11 @@ eNBs = pusch_nDMRS1 = 1; phich_duration = "NORMAL"; phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ + srs_enable = "ENABLE"; + srs_BandwidthConfig = 2; + srs_SubframeConfig = 7; + srs_ackNackST = "DISABLE"; + srs_MaxUpPts = "DISABLE"; pusch_p0_Nominal = -90; pusch_alpha = "AL1"; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf index 5ef5a4f50b6e653a75f1c817cc6eeba3804d9d97..d563f3af7e1b681e9e220b96e1098aefae47d6f9 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf @@ -17,7 +17,7 @@ eNBs = mobile_country_code = "208"; - mobile_network_code = "94"; + mobile_network_code = "92"; ////////// Physical parameters: @@ -63,10 +63,10 @@ eNBs = phich_duration = "NORMAL"; phich_resource = "ONESIXTH"; srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ + srs_BandwidthConfig = 2; + srs_SubframeConfig = 0; + srs_ackNackST = "DISABLE"; + srs_MaxUpPts = "DISABLE"; pusch_p0_Nominal = -90; pusch_alpha = "AL1"; @@ -137,7 +137,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.70"; + mme_ip_address = ( { ipv4 = "192.168.12.26"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -147,10 +147,10 @@ eNBs = NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.147/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.147/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "eth6"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.82/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth6"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.82/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 };