From 5c0ea2b4469a1a6ec8b0f25b1628732186cbb993 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Thu, 17 Aug 2017 00:51:23 -0700 Subject: [PATCH 1/4] addition of MPDCCH format 5. X_u_br sequences for BL/CE UE support and bugfixes in rx_prach0 for eMTC. --- cmake_targets/CMakeLists.txt | 1 + openair1/PHY/INIT/lte_init.c | 54 ++++- openair1/PHY/LTE_TRANSPORT/dci.c | 9 +- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 2 +- openair1/PHY/LTE_TRANSPORT/defs.h | 19 +- openair1/PHY/LTE_TRANSPORT/dlsch_coding.c | 2 +- openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c | 38 ++- openair1/PHY/LTE_TRANSPORT/pmch.c | 3 +- openair1/PHY/LTE_TRANSPORT/prach.c | 41 ++-- openair1/PHY/LTE_TRANSPORT/proto.h | 17 +- openair1/PHY/defs.h | 4 +- openair1/PHY/impl_defs_lte.h | 14 +- openair1/SCHED/phy_procedures_lte_eNb.c | 223 ++++++------------ openair2/LAYER2/MAC/eNB_scheduler_RA.c | 4 +- targets/RT/USER/lte-softmodem.c | 4 - 15 files changed, 238 insertions(+), 197 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a48590ad55..8375eb71d5 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -989,6 +989,7 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/edci.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 4c68021325..e45792abf2 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -145,6 +145,13 @@ void phy_config_request(PHY_Config_t *phy_config) { LOG_I(PHY,"prach_config_common.prach_ConfigInfo.prach_FreqOffset = %d\n",cfg->prach_config.frequency_offset.value); init_prach_tables(839); + compute_prach_seq(fp->prach_config_common.rootSequenceIndex, + fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, + fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig, + fp->prach_config_common.prach_ConfigInfo.highSpeedFlag, + fp->frame_type, + RC.eNB[Mod_id][CC_id]->X_u); + #ifdef Rel14 fp->prach_emtc_config_common.prach_Config_enabled=1; @@ -160,10 +167,18 @@ void phy_config_request(PHY_Config_t *phy_config) { AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[3]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[3], "prach_starting_subframe_periodicity[3] < prach_numPetitionPerPreambleAttempt[3]\n"); + fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3] = cfg->emtc_config.prach_ce_level_3_configuration_index.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[3] = cfg->emtc_config.prach_ce_level_3_frequency_offset.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[3] = cfg->emtc_config.prach_ce_level_3_hopping_enable.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[3] = cfg->emtc_config.prach_ce_level_3_hopping_offset.value; + if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[3] == 1) + compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex, + fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3], + fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig, + fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag, + fp->frame_type, + RC.eNB[Mod_id][CC_id]->X_u_br[3]); // CE Level 2 parameters fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2] = cfg->emtc_config.prach_ce_level_2_enable.value; @@ -175,6 +190,13 @@ void phy_config_request(PHY_Config_t *phy_config) { fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[2] = cfg->emtc_config.prach_ce_level_2_frequency_offset.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[2] = cfg->emtc_config.prach_ce_level_2_hopping_enable.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[2] = cfg->emtc_config.prach_ce_level_2_hopping_offset.value; + if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[2] == 1) + compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex, + fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3], + fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig, + fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag, + fp->frame_type, + RC.eNB[Mod_id][CC_id]->X_u_br[2]); // CE Level 1 parameters fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1] = cfg->emtc_config.prach_ce_level_1_enable.value; @@ -182,11 +204,19 @@ void phy_config_request(PHY_Config_t *phy_config) { fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1] = cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value; AssertFatal(fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[1]>=fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[1], "prach_starting_subframe_periodicity[1] < prach_numPetitionPerPreambleAttempt[1]\n"); + fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[1] = cfg->emtc_config.prach_ce_level_1_configuration_index.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[1] = cfg->emtc_config.prach_ce_level_1_frequency_offset.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[1] = cfg->emtc_config.prach_ce_level_1_hopping_enable.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[1] = cfg->emtc_config.prach_ce_level_1_hopping_offset.value; - + if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[1] == 1) + compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex, + fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3], + fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig, + fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag, + fp->frame_type, + RC.eNB[Mod_id][CC_id]->X_u_br[1]); + // CE Level 0 parameters fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] = cfg->emtc_config.prach_ce_level_0_enable.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_starting_subframe_periodicity[0] = cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value; @@ -197,11 +227,16 @@ void phy_config_request(PHY_Config_t *phy_config) { fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[0] = cfg->emtc_config.prach_ce_level_0_frequency_offset.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_enable[0] = cfg->emtc_config.prach_ce_level_0_hopping_enable.value; fp->prach_emtc_config_common.prach_ConfigInfo.prach_hopping_offset[0] = cfg->emtc_config.prach_ce_level_0_hopping_offset.value; - + if (fp->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] == 1) + compute_prach_seq(fp->prach_emtc_config_common.rootSequenceIndex, + fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[3], + fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig, + fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag, + fp->frame_type, + RC.eNB[Mod_id][CC_id]->X_u_br[0]); #endif - compute_prach_seq(&fp->prach_config_common,fp->frame_type, - RC.eNB[Mod_id][CC_id]->X_u); + fp->pucch_config_common.deltaPUCCH_Shift = 1+cfg->pucch_config.delta_pucch_shift.value; fp->pucch_config_common.nRB_CQI = cfg->pucch_config.n_cqi_rb.value; @@ -441,7 +476,11 @@ void phy_config_sib2_ue(uint8_t Mod_id,int CC_id, fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig; fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset; - compute_prach_seq(&fp->prach_config_common,fp->frame_type,ue->X_u); + compute_prach_seq(fp->prach_config_common.rootSequenceIndex, + fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, + fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig, + fp->prach_config_common.prach_ConfigInfo.highSpeedFlag, + fp->frame_type,ue->X_u); @@ -729,7 +768,10 @@ void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, Mobility // prach_root_sequence_map4[fp->prach_config_common.rootSequenceIndex]; //compute_prach_seq(u,N_ZC, PHY_vars_UE_g[Mod_id]->X_u); - compute_prach_seq(&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common, + compute_prach_seq(PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.rootSequenceIndex, + PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex, + PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig, + PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag, fp->frame_type, PHY_vars_UE_g[Mod_id][CC_id]->X_u); diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 1ade246945..b9576e9c9d 100755 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -219,7 +219,14 @@ uint8_t *generate_dci0(uint8_t *dci, AssertFatal((aggregation_level==1) || (aggregation_level==2) || (aggregation_level==4) || - (aggregation_level==8), + (aggregation_level==8) +#ifdef Rel14 // Added for EPDCCH/MPDCCH + || + (aggregation_level==16) || + (aggregation_level==24) || + (aggregation_level==32) +#endif + , "generate_dci FATAL, illegal aggregation_level %d\n",aggregation_level); diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index d75827db4a..2a43455e25 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -2005,7 +2005,7 @@ int fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *dc dci_alloc->start_symbol = rel13->start_symbol; dci_alloc->ce_mode = rel13->ce_mode; dci_alloc->dmrs_scrambling_init = rel13->drms_scrambling_init; - dci_alloc->initial_transmission_sf_io = rel13->initial_transmission_sf_io; + dci_alloc->i0 = rel13->initial_transmission_sf_io; dci_alloc->ra_flag = 0; if (rel13->rnti_type == 2 ) dci_alloc->ra_flag = 1; diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h index 9d3d9c2b40..e8be4facd4 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/defs.h @@ -148,6 +148,8 @@ typedef struct { uint16_t nb_rb; /// downlink power offset field uint8_t dl_power_off; + /// start symbold of pdsch + uint8_t pdsch_start; /// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) uint8_t e[MAX_NUM_CHANNEL_BITS] __attribute__((aligned(32))); /// Turbo-code outputs (36-212 V8.6 2009-03, p.12 @@ -172,7 +174,7 @@ typedef struct { uint8_t Nlayers; /// First layer for this PSCH transmission uint8_t first_layer; - /// codeword this transport block is mapped to + /// codeword this transport block is mapped to uint8_t codeword; } LTE_DL_eNB_HARQ_t; @@ -250,6 +252,13 @@ typedef struct { uint8_t decode_phich; } LTE_UL_UE_HARQ_t; +#ifdef Rel14 +typedef enum { + CEmodeA = 0, + CEmodeB = 1 +} CEmode_t; +#endif + typedef struct { /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) int32_t *txdataF[8]; @@ -291,7 +300,13 @@ typedef struct { int16_t sqrt_rho_a; /// amplitude of PDSCH (compared to RS) in symbols containing pilots int16_t sqrt_rho_b; - +#ifdef Rel14 + /// indicator that this DLSCH corresponds to SIB1-BR, needed for c_init for scrambling + uint8_t sib1_br_flag; + /// initial absolute subframe (see 36.211 Section 6.3.1), needed for c_init for scrambling + uint16_t i0; + CEmode_t CEmode; +#endif } LTE_eNB_DLSCH_t; #define PUSCH_x 2 diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 18df5c3b44..fc0c3d61fa 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -145,7 +145,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_ bzero(dlsch,sizeof(LTE_eNB_DLSCH_t)); dlsch->Kmimo = Kmimo; dlsch->Mdlharq = Mdlharq; - dlsch->Mlimit = 4; + dlsch->Mlimit = 8; dlsch->Nsoft = Nsoft; for (layer=0; layer<4; layer++) { diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c index eaaddb0c07..bbd29e6d70 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c @@ -74,10 +74,12 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, int harq_pid, int G, uint8_t q, + uint16_t frame, uint8_t Ns) { - int i; + int n; + // uint8_t reset; uint32_t x1, x2, s=0; uint8_t *dlsch_e=dlsch->harq_processes[harq_pid]->e; @@ -85,12 +87,40 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_IN); +#ifdef Rel14 + // Rule for accumulation of subframes for BL/CE UEs + uint8_t Nacc=4; + uint16_t j0,j,idelta; + uint16_t i = (Ns>>1) + (10*frame); + uint16_t i0 = dlsch->i0; + + if (dlsch->sib1_br_flag==1) Nacc=1; + else if (dlsch->rnti == 0xFFFF || dlsch->rnti == 0xFFFE) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4; + // Note: above SC-RNTI will also have to be added when/if implemented + else if (dlsch->CEmode == CEmodeA) Nacc=1; + else if (dlsch->CEmode == CEmodeB) Nacc = (frame_parms->frame_type == TDD) ? 10 : 4; + + if (frame_parms->frame_type == FDD || Nacc == 1) idelta = 0; + else idelta = Nacc-2; + + j0 = (i0+idelta)/Nacc; + j = (i - i0)/Nacc; +#endif + // reset = 1; // x1 is set in lte_gold_generic if (mbsfn_flag == 0) { - x2 = (dlsch->rnti<<14) + (q<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1 +#ifdef Rel14 + if (dlsch->i0 != 0xFFFF) { + // rule for BL/CE UEs from Section 6.3.1 in 36.211 + x2= (dlsch->rnti<<14) + (q<<13) + ((((j0+j)*Nacc)%10)<<9) + frame_parms->Nid_cell; + if ((frame&1023) < 200) LOG_D(PHY,"Scrambling init for (i0 %d, i %d, j0 %d, j %d, Nacc %d) => x2 %d\n",i0,i,j0,j,Nacc,x2); + } + else +#endif + x2 = (dlsch->rnti<<14) + (q<<13) + ((Ns>>1)<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1 for PDSCH } else { - x2 = ((Ns>>1)<<9) + frame_parms->Nid_cell_mbsfn; //this is c_init in 36.211 Sec 6.3.1 + x2 = ((Ns>>1)<<9) + frame_parms->Nid_cell_mbsfn; //this is c_init in 36.211 Sec 6.3.1 for PMCH } #ifdef DEBUG_SCRAMBLING @@ -98,7 +128,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, #endif s = lte_gold_scram(&x1, &x2, 1); - for (i=0; i<(1+(G>>5)); i++) { + for (n=0; n<(1+(G>>5)); n++) { #ifdef DEBUG_SCRAMBLING printf("scrambling %d : %d => ",k,e[k]); diff --git a/openair1/PHY/LTE_TRANSPORT/pmch.c b/openair1/PHY/LTE_TRANSPORT/pmch.c index 3aa14d924c..40f157e56b 100644 --- a/openair1/PHY/LTE_TRANSPORT/pmch.c +++ b/openair1/PHY/LTE_TRANSPORT/pmch.c @@ -285,6 +285,7 @@ void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a) int G; int subframe = proc->subframe_tx; + int frame = proc->frame_tx; if (eNB->abstraction_flag != 0) { if (eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]!=0) @@ -324,7 +325,7 @@ void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a) &eNB->dlsch_interleaving_stats)==0, "problem in dlsch_encoding"); - dlsch_scrambling(&eNB->frame_parms,1,eNB->dlsch_MCH,0,G,0,subframe<<1); + dlsch_scrambling(&eNB->frame_parms,1,eNB->dlsch_MCH,0,G,0,frame,subframe<<1); mch_modulation(eNB->common_vars.txdataF, diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index e616741e13..e477b4a4da 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -1596,16 +1596,17 @@ void rx_prach0(PHY_VARS_eNB *eNB, if (new_dft == 1) { new_dft = 0; - Xu=(int16_t*)eNB->X_u[preamble_offset-first_nonzero_root_idx]; #ifdef Rel14 if (br_flag == 1) { + Xu=(int16_t*)eNB->X_u_br[ce_level][preamble_offset-first_nonzero_root_idx]; prach_ifft = prach_ifftp[prach_ifft_cnt++]; if (eNB->prach_vars_br.repetition_number[ce_level]==1) memset(prach_ifft,0,((N_ZC==839)?2048:256)*sizeof(int32_t)); } else #endif { + Xu=(int16_t*)eNB->X_u[preamble_offset-first_nonzero_root_idx]; prach_ifft = prach_ifftp[0]; memset(prach_ifft,0,((N_ZC==839) ? 2048 : 256)*sizeof(int32_t)); } @@ -1781,15 +1782,18 @@ void init_prach_tables(int N_ZC) } } -void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common, - lte_frame_type_t frame_type, - uint32_t X_u[64][839]) +void compute_prach_seq(uint16_t rootSequenceIndex, + uint8_t prach_ConfigIndex, + uint8_t zeroCorrelationZoneConfig, + uint8_t highSpeedFlag, + lte_frame_type_t frame_type, + uint32_t X_u[64][839]) { // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC) unsigned int k,inv_u,i,NCS=0,num_preambles; int N_ZC; - uint8_t prach_fmt = get_prach_fmt(prach_config_common->prach_ConfigInfo.prach_ConfigIndex,frame_type); + uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); uint16_t *prach_root_sequence_map; uint16_t u, preamble_offset; uint16_t n_shift_ra,n_shift_ra_bar, d_start,numshift; @@ -1798,7 +1802,7 @@ void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN); #ifdef PRACH_DEBUG - LOG_I(PHY,"compute_prach_seq: NCS_config %d, prach_fmt %d\n",prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig, prach_fmt); + LOG_I(PHY,"compute_prach_seq: NCS_config %d, prach_fmt %d\n",zeroCorrelationZoneConfig, prach_fmt); #endif AssertFatal(prach_fmt<4, @@ -1818,15 +1822,15 @@ void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common, LOG_I( PHY, "compute_prach_seq: done init prach_tables\n" ); #endif - if (prach_config_common->prach_ConfigInfo.highSpeedFlag== 0) { + if (highSpeedFlag== 0) { #ifdef PRACH_DEBUG - LOG_I(PHY,"Low speed prach : NCS_config %d\n",prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig); + LOG_I(PHY,"Low speed prach : NCS_config %d\n",zeroCorrelationZoneConfig); #endif - AssertFatal(prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig<=15, - "FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig ); - NCS = NCS_unrestricted[prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig]; + AssertFatal(zeroCorrelationZoneConfig<=15, + "FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", zeroCorrelationZoneConfig ); + NCS = NCS_unrestricted[zeroCorrelationZoneConfig]; num_preambles = (NCS==0) ? 64 : ((64*NCS)/N_ZC); @@ -1836,12 +1840,12 @@ void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common, } else { #ifdef PRACH_DEBUG - LOG_I( PHY, "high speed prach : NCS_config %"PRIu8"\n", prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig ); + LOG_I( PHY, "high speed prach : NCS_config %"PRIu8"\n", zeroCorrelationZoneConfig ); #endif - AssertFatal(prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig<=14, - "FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig ); - NCS = NCS_restricted[prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig]; + AssertFatal(zeroCorrelationZoneConfig<=14, + "FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", zeroCorrelationZoneConfig ); + NCS = NCS_restricted[zeroCorrelationZoneConfig]; fill_du(prach_fmt); num_preambles = 64; // compute ZC sequence for 64 possible roots @@ -1851,7 +1855,7 @@ void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common, while (not_found == 1) { // current root depending on rootSequenceIndex - int index = (prach_config_common->rootSequenceIndex + preamble_offset) % N_ZC; + int index = (rootSequenceIndex + preamble_offset) % N_ZC; if (prach_fmt<4) { // prach_root_sequence_map points to prach_root_sequence_map0_3 @@ -1895,12 +1899,12 @@ void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common, if (NCS>0) LOG_I( PHY, "Initializing %u preambles for PRACH (NCS_config %"PRIu8", NCS %u, N_ZC/NCS %u)\n", - num_preambles, prach_config_common->prach_ConfigInfo.zeroCorrelationZoneConfig, NCS, N_ZC/NCS ); + num_preambles, zeroCorrelationZoneConfig, NCS, N_ZC/NCS ); #endif for (i=0; irootSequenceIndex+i+preamble_offset) % N_ZC; + int index = (rootSequenceIndex+i+preamble_offset) % N_ZC; if (prach_fmt<4) { // prach_root_sequence_map points to prach_root_sequence_map0_3 @@ -1921,7 +1925,6 @@ void compute_prach_seq(PRACH_CONFIG_COMMON *prach_config_common, for (k=0; kframe_tx; int subframe=proc->subframe_tx; @@ -715,128 +714,57 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; int i; - LOG_D(PHY, - "[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx64", rv %"PRIu8" (round %"PRIu8")\n", - eNB->Mod_id, dlsch->rnti,harq_pid, - frame, subframe, input_buffer_length, - get_G(fp, - dlsch_harq->nb_rb, - dlsch_harq->rb_alloc, - get_Qm(dlsch_harq->mcs), - dlsch_harq->Nl, - num_pdcch_symbols, - frame, - subframe, - dlsch_harq->mimo_mode==TM7?7:0), - dlsch_harq->nb_rb, - dlsch_harq->mcs, - pmi2hex_2Ar1(dlsch_harq->pmi_alloc), - dlsch_harq->rvidx, - dlsch_harq->round); - + if (frame < 20) { + LOG_I(PHY, + "[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", pdsch_start %d, G %d, nb_rb %"PRIu16", rb0 %x, rb1 %x, TBS %"PRIu16", pmi_alloc %"PRIx64", rv %"PRIu8" (round %"PRIu8")\n", + eNB->Mod_id, dlsch->rnti,harq_pid, + frame, subframe, input_buffer_length, dlsch_harq->pdsch_start, + get_G(fp, + dlsch_harq->nb_rb, + dlsch_harq->rb_alloc, + dlsch_harq->Qm, + dlsch_harq->Nl, + dlsch_harq->pdsch_start, + frame, + subframe, + dlsch_harq->mimo_mode==TM7?7:0), + dlsch_harq->nb_rb, + dlsch_harq->rb_alloc[0], + dlsch_harq->rb_alloc[1], + dlsch_harq->TBS, + pmi2hex_2Ar1(dlsch_harq->pmi_alloc), + dlsch_harq->rvidx, + dlsch_harq->round); + } #if defined(MESSAGE_CHART_GENERATOR_PHY) MSC_LOG_TX_MESSAGE( MSC_PHY_ENB,MSC_PHY_UE, NULL,0, - "%05u:%02u PDSCH/DLSCH input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx16", rv %"PRIu8" (round %"PRIu8")", + "%05u:%02u PDSCH/DLSCH input size = %"PRIu16", G %d, nb_rb %"PRIu16", TBS %"PRIu16", pmi_alloc %"PRIx16", rv %"PRIu8" (round %"PRIu8")", frame, subframe, input_buffer_length, get_G(fp, dlsch_harq->nb_rb, dlsch_harq->rb_alloc, - get_Qm(dlsch_harq->mcs), + dlsch_harq->Qm, dlsch_harq->Nl, - num_pdcch_symbols, + dlsch_harq->pdsch_start, frame, subframe, dlsch_harq->mimo_mode==TM7?7:0), dlsch_harq->nb_rb, - dlsch_harq->mcs, + dlsch_harq->TBS, pmi2hex_2Ar1(dlsch_harq->pmi_alloc), dlsch_harq->rvidx, dlsch_harq->round); #endif - + + if (ue_stats) ue_stats->dlsch_sliding_cnt++; - + if (dlsch_harq->round == 0) { - if (ue_stats) ue_stats->dlsch_trials[harq_pid][0]++; - - - if (eNB->mac_enabled==1) { - - - /* - // if (ra_flag == 0) { - DLSCH_pdu = get_dlsch_pdu(eNB->Mod_id, - eNB->CC_id, - dlsch->rnti); - - - } - - else { - int16_t crnti = mac_xface->fill_rar(eNB->Mod_id, - eNB->CC_id, - frame, - DLSCH_pdu_rar, - fp->N_RB_UL, - input_buffer_length); - DLSCH_pdu = DLSCH_pdu_rar; - - int UE_id; - - if (crnti!=0) - UE_id = add_ue(crnti,eNB); - else - UE_id = -1; - - if (UE_id==-1) { - LOG_W(PHY,"[eNB] Max user count reached.\n"); - mac_xface->cancel_ra_proc(eNB->Mod_id, - eNB->CC_id, - frame, - crnti); - } else { - eNB->UE_stats[(uint32_t)UE_id].mode = RA_RESPONSE; - // Initialize indicator for first SR (to be cleared after ConnectionSetup is acknowledged) - eNB->first_sr[(uint32_t)UE_id] = 1; - - generate_eNB_ulsch_params_from_rar(DLSCH_pdu, - frame, - subframe, - eNB->ulsch[(uint32_t)UE_id], - fp); - - LOG_D(PHY,"[eNB][RAPROC] Frame %d subframe %d, Activated Msg3 demodulation for UE %"PRId8" in frame %"PRIu32", subframe %"PRIu8"\n", - frame, - subframe, - UE_id, - eNB->ulsch[(uint32_t)UE_id]->Msg3_frame, - eNB->ulsch[(uint32_t)UE_id]->Msg3_subframe); - - - LOG_D(PHY, "hack: set phich_active to 0 for UE %d fsf %d %d all HARQs\n", UE_id, frame, subframe); - for (i = 0; i < 8; i++) - eNB->ulsch[(uint32_t)UE_id]->harq_processes[i]->phich_active = 0; - - mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, (uint16_t)crnti, - eNB->ulsch[UE_id]->Msg3_frame, eNB->ulsch[UE_id]->Msg3_subframe); - - T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), - T_INT(UE_id), T_INT((uint16_t)crnti), T_INT(1 // 1 is for initial transmission - ), - T_INT(eNB->ulsch[UE_id]->Msg3_frame), T_INT(eNB->ulsch[UE_id]->Msg3_subframe)); - } - if (ue_stats) ue_stats->total_TBS_MAC += dlsch_harq->TBS; - */ - } - else { - for (i=0; ipdu[i] = (unsigned char)(taus()&0xff); - } } else { ue_stats->dlsch_trials[harq_pid][dlsch_harq->round]++; #ifdef DEBUG_PHY_PROC @@ -852,7 +780,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, start_meas(&eNB->dlsch_encoding_stats); eNB->te(eNB, dlsch_harq->pdu, - num_pdcch_symbols, + dlsch_harq->pdsch_start, dlsch, frame,subframe, &eNB->dlsch_rate_matching_stats, @@ -868,12 +796,13 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, get_G(fp, dlsch_harq->nb_rb, dlsch_harq->rb_alloc, - get_Qm(dlsch_harq->mcs), + dlsch_harq->Qm, dlsch_harq->Nl, - num_pdcch_symbols, + dlsch_harq->pdsch_start, frame,subframe, 0), 0, + frame, subframe<<1); stop_meas(&eNB->dlsch_scrambling_stats); @@ -884,7 +813,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, eNB->common_vars.txdataF, AMP, subframe, - num_pdcch_symbols, + dlsch_harq->pdsch_start, dlsch, dlsch1); @@ -986,6 +915,9 @@ handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, uint8_t *sdu) { nfapi_dl_config_dlsch_pdu_rel8_t *rel8 = &dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8; +#ifndef Rel8 + nfapi_dl_config_dlsch_pdu_rel10_t *rel10 = &dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10; +#endif #ifdef Rel14 nfapi_dl_config_dlsch_pdu_rel13_t *rel13 = &dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13; #endif @@ -993,17 +925,17 @@ handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, LTE_DL_eNB_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL; int UE_id; int harq_pid; - + UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); - + dlsch0 = eNB->dlsch[UE_id][0]; dlsch1 = eNB->dlsch[UE_id][1]; #ifdef Rel14 - if ((rel13->pdsch_payload_type == 0) && (rel13->ue_type>0)) dlsch0->harq_ids[proc->subframe_tx] = 0; + if ((rel13->pdsch_payload_type < 2) && (rel13->ue_type>0)) dlsch0->harq_ids[proc->subframe_tx] = 0; #endif harq_pid = dlsch0->harq_ids[proc->subframe_tx]; @@ -1012,13 +944,27 @@ handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, dlsch1_harq = dlsch1->harq_processes[harq_pid]; AssertFatal(dlsch0_harq!=NULL,"dlsch_harq is null\n"); + dlsch0_harq->pdsch_start = eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols; + LOG_D(PHY,"NFAPI: frame %d, subframe %d: programming dlsch, rnti %x, UE_id %d, harq_pid %d\n", - proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid); + proc->frame_tx,proc->subframe_tx,rel8->rnti,UE_id,harq_pid); if (codeword_index == 0) dlsch0_harq->pdu = sdu; else dlsch1_harq->pdu = sdu; #ifdef Rel14 + dlsch0->sib1_br_flag=0; + if ((rel13->pdsch_payload_type <2) && (rel13->ue_type>0)) { // this is a BR/CE UE and SIB1-BR/SI-BR + + dlsch0->rnti = 0xFFFF; + dlsch0->Kmimo = 1; + dlsch0->Mdlharq = 4; + dlsch0->Nsoft = 25344; + dlsch0->i0 = rel13->initial_transmission_sf_io; + dlsch0_harq->pdsch_start = rel10->pdsch_start; + + if (rel13->pdsch_payload_type == 0) dlsch0->sib1_br_flag=1; + // configure PDSCH switch (eNB->frame_parms.N_RB_DL) { case 6: @@ -1055,8 +1001,8 @@ handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, dlsch0_harq->round = 0; dlsch0_harq->status = ACTIVE; dlsch0_harq->TBS = rel8->length<<3; - - + dlsch0_harq->Qm = rel8->modulation; + dlsch0_harq->codeword = 0; } else { @@ -1338,27 +1284,6 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, common_signal_procedures(eNB,proc); } - /* - if (eNB->mac_enabled==1) { - // Parse DCI received from MAC - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,1); - DCI_pdu = mac_xface->get_dci_sdu(eNB->Mod_id, - eNB->CC_id, - frame, - subframe); - } - else { - DCI_pdu = &DCI_pdu_tmp; - fill_dci(DCI_pdu,eNB,proc); - // clear previous allocation information for all UEs - for (i=0; idlsch[i][0]){ - for (j=0; j<8; j++) - eNB->dlsch[i][0]->harq_processes[j]->round = 0; - } - } - } -*/ // clear existing ulsch dci allocations before applying info from MAC (this is table ul_subframe = pdcch_alloc2ul_subframe(fp,subframe); ul_frame = pdcch_alloc2ul_frame(fp,frame,subframe); @@ -1437,34 +1362,37 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0); // Now scan UE specific DLSCH + LTE_eNB_DLSCH_t *dlsch0,*dlsch1; for (UE_id=0; UE_iddlsch[(uint8_t)UE_id][0])&& - (eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&& - (eNB->dlsch[(uint8_t)UE_id][0]->active == 1)) { + dlsch0 = eNB->dlsch[(uint8_t)UE_id][0]; + dlsch1 = eNB->dlsch[(uint8_t)UE_id][1]; + + if ((dlsch0)&& + (dlsch0->rnti>0)&& + (dlsch0->active == 1)) { // get harq_pid - harq_pid = eNB->dlsch[(uint8_t)UE_id][0]->harq_ids[subframe]; + harq_pid = dlsch0->harq_ids[subframe]; AssertFatal(harq_pid>=0,"harq_pid is negative\n"); // generate pdsch pdsch_procedures(eNB, proc, harq_pid, - eNB->dlsch[(uint8_t)UE_id][0], - eNB->dlsch[(uint8_t)UE_id][1], + dlsch0, + dlsch1, &eNB->UE_stats[(uint32_t)UE_id], - 0, - num_pdcch_symbols); + 0); } - else if ((eNB->dlsch[(uint8_t)UE_id][0])&& - (eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&& - (eNB->dlsch[(uint8_t)UE_id][0]->active == 0)) { + else if ((dlsch0)&& + (dlsch0->rnti>0)&& + (dlsch0->active == 0)) { // clear subframe TX flag since UE is not scheduled for PDSCH in this subframe (so that we don't look for PUCCH later) - eNB->dlsch[(uint8_t)UE_id][0]->subframe_tx[subframe]=0; + dlsch0->subframe_tx[subframe]=0; } } @@ -1696,11 +1624,10 @@ void process_HARQ_feedback(uint8_t UE_id, if (dl_harq_pid[m]Mdlharq) { dlsch_harq_proc = dlsch->harq_processes[dl_harq_pid[m]]; #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[eNB %d][PDSCH %x/%d] subframe %d, status %d, round %d (mcs %d, rv %d, TBS %d)\n",eNB->Mod_id, + LOG_D(PHY,"[eNB %d][PDSCH %x/%d] subframe %d, status %d, round %d (rv %d, TBS %d)\n",eNB->Mod_id, dlsch->rnti,dl_harq_pid[m],dl_subframe, dlsch_harq_proc->status,dlsch_harq_proc->round, - dlsch->harq_processes[dl_harq_pid[m]]->mcs, - dlsch->harq_processes[dl_harq_pid[m]]->rvidx, + dlsch->harq_processes[dl_harq_pid[m]]->rvidx, dlsch->harq_processes[dl_harq_pid[m]]->TBS); if (dlsch_harq_proc->status==DISABLED) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 88ee3d14ae..a47159a079 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -290,7 +290,7 @@ void generate_Msg2(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu)); dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_idP]; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = RA_template->RA_rnti; - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL,first_rb,6); dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK @@ -538,7 +538,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t if (RA_template->rach_resource_type>0) { // Generate DCI + repetitions first - // This uses an MPDCCH Type 2 allocation according to Section 9.1.5 36-213 : Note: Assumption that this is still Type 2 Common Search + // This uses an MPDCCH Type 2 allocation according to Section 9.1.5 36-213, Type2 common allocation according to Table 7.1-8 (36-213) // Parameters: // p=2+4 PRB set (number of PRB pairs 6) // rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3 diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 319465072c..a9bc2f032c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1504,10 +1504,6 @@ int main( int argc, char **argv ) UE[CC_id]->mode = mode; printf("UE[%d]->mode = %d\n",CC_id,mode); - compute_prach_seq(&UE[CC_id]->frame_parms.prach_config_common, - UE[CC_id]->frame_parms.frame_type, - UE[CC_id]->X_u); - if (UE[CC_id]->mac_enabled == 1) { UE[CC_id]->pdcch_vars[0][0]->crnti = 0x1234; UE[CC_id]->pdcch_vars[1][0]->crnti = 0x1234; From fc283a321fcbfe2e3d67dd6db15e9155abe808f0 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Thu, 17 Aug 2017 01:15:46 -0700 Subject: [PATCH 2/4] added edci.c, forgotten on last commit --- openair1/PHY/LTE_TRANSPORT/edci.c | 203 ++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100755 openair1/PHY/LTE_TRANSPORT/edci.c diff --git a/openair1/PHY/LTE_TRANSPORT/edci.c b/openair1/PHY/LTE_TRANSPORT/edci.c new file mode 100755 index 0000000000..49a60ae9e8 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/edci.c @@ -0,0 +1,203 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/dci.c +* \brief Implements PDCCH physical channel TX/RX procedures (36.211) and DCI encoding/decoding (36.212/36.213). Current LTE compliance V8.6 2009-03. +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ +#ifdef USER_MODE +#include +#include +#include +#endif +#include "PHY/defs.h" +#include "PHY/extern.h" +#include "SCHED/defs.h" +#include "SIMULATION/TOOLS/defs.h" // for taus +#include "PHY/sse_intrin.h" + +#include "assertions.h" +#include "T.h" +#include "UTIL/LOG/log.h" + +//#define DEBUG_DCI_ENCODING 1 +//#define DEBUG_DCI_DECODING 1 +//#define DEBUG_PHY + +#ifdef Rel14 +void generate_edci_top(PHY_VARS_eNB *eNB, int frame, int subframe) { + +} + +void mpdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, + mDCI_ALLOC_t *mdci, + uint16_t i, + uint8_t *e, + uint32_t length) +{ + int n; + uint8_t reset; + uint32_t x1, x2, s=0; + uint8_t Nacc=4; + uint16_t j0,j,idelta; + uint16_t i0 = mdci->i0; + + // Note: we could actually not do anything if i-i0 < Nacc, save it for later + + reset = 1; + // x1 is set in lte_gold_generic + + if ((mdci->rnti == 0xFFFE) || + (mdci->ce_mode == 2)) // CEModeB Note: also for mdci->rnti==SC_RNTI + Nacc=frame_parms->frame_type == FDD ? 4 : 10; + else Nacc=1; + + if (frame_parms->frame_type == FDD || Nacc == 1) idelta = 0; + else idelta = Nacc-2; + + j0 = (i0+idelta)/Nacc; + j = (i - i0)/Nacc; + + + // rule for BL/CE UEs from Section 6.8.B2 in 36.211 + x2= ((((j0+j)*Nacc)%10)<<9) + mdci->dmrs_scrambling_init; + + for (n=0; n>(i&0x1f))&1); + } +} + +// this table is the allocation of modulated MPDCCH format 5 symbols to REs +// There are in total 36 REs/ECCE * 4 ECCE/PRB_pair = 144 REs in total/PRB_pair, total is 168 REs => 24 REs for DMRS +// For format 5 there are 6 PRB pairs => 864 REs for 24 total ECCE +static uint16_t mpdcch5tab[864]; + +void init_mpdcch5tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB *eNB) { + int l,k,kmod,re; + + LOG_I(PHY,"Inititalizing mpdcch5tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n"); + for (l=0,re=0;l<14;l++) { + for (k=0;k<72;k++){ + kmod = k % 12; + if (((l!=5) && (l!=6) && (l!=12) && (l!=13)) || + (((l==5)||(l==6)||(l==12)||(l==13))&&(kmod!=0)&&(kmod!=5)&&(kmod!=10))) + mpdcch5tab[re++]=(l*eNB->frame_parms.ofdm_symbol_size)+k; + } + } + AssertFatal(re==864,"RE count not equal to 864\n"); +} + +extern uint8_t *generate_dci0(uint8_t *dci, + uint8_t *e, + uint8_t DCI_LENGTH, + uint8_t aggregation_level, + uint16_t rnti); + +void generate_mdci_top(PHY_VARS_eNB *eNB, int frame, int subframe,int16_t amp,int32_t **txdataF) { + + LTE_eNB_MPDCCH *mpdcch= &eNB->mpdcch_vars[subframe&2]; + mDCI_ALLOC_t *mdci; + int coded_bits; + LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; + int i; + int gain_lin_QPSK; + + for (i=0;inum_dci;i++) { + mdci = &mpdcch->mdci_alloc[i]; + + + AssertFatal(fp->frame_type==FDD,"TDD is not yet supported for MPDCCH\n"); + AssertFatal(fp->Ncp == NORMAL,"Extended Prefix not yet supported for MPDCCH\n"); + AssertFatal(mdci->L<=24,"L is %d\n",mdci->L); + AssertFatal(fp->N_RB_DL==50 || fp->N_RB_DL==100,"Only N_RB_DL=50,100 for MPDCCH\n"); + // Force MPDDCH format 5 + AssertFatal(mdci->number_of_prb_pairs==6,"2 or 4 PRB pairs not support yet for MPDCCH\n"); + AssertFatal(mdci->reps>0,"mdci->reps==0\n"); + + // 9 REs/EREG * 4 EREG/ECCE => 36 REs/ECCE => 72 bits/ECCE, so same as regular PDCCH channel encoding + + // Note: We only have to run this every Nacc subframes during repetitions, data and scrambling are constant, but we do it for now to simplify during testing + + generate_dci0(mdci->dci_pdu, + mpdcch->e+(72*mdci->firstCCE), + mdci->dci_length, + mdci->L, + mdci->rnti); + + + coded_bits = 72 * mdci->L; + + // scrambling + uint16_t absSF = (frame*10)+subframe; + + AssertFatal(absSF < 1024, + "Absolute subframe %d = %d*10 + %d > 1023\n", + absSF,frame,subframe); + + mpdcch_scrambling(fp, + mdci, + absSF, + mpdcch->e+(72*mdci->firstCCE), + coded_bits); + + // Modulation for PDCCH + if (fp->nb_antenna_ports_eNB==1) + gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15); + else + gain_lin_QPSK = amp/2; + + uint8_t *e_ptr = mpdcch->e; + + // if (mdci->transmission_type==0) nprime=mdci->rnti&3; // for Localized 2+4 we use 6.8B.5 rule + // map directly to one antenna port for now + // Note: aside from the antenna port mapping, there is no difference between localized and distributed transmission for MPDCCH format 5 + + // first RE of narrowband + // mpdcchtab5 below contains the mapping from each coded symbol to relative RE avoiding the DMRS + + + int re_offset = fp->first_carrier_offset + 1 + ((fp->N_RB_DL==100)?1:0) + mdci->narrowband*12*6; + if (re_offset>fp->ofdm_symbol_size) re_offset-=(fp->ofdm_symbol_size-1); + int32_t *txF = &txdataF[0][re_offset]; + int32_t yIQ; + + for (i=0; i<(coded_bits>>1); i++) { + // QPSK modulation to yIQ + ((int16_t*)&yIQ)[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK; e_ptr++; + ((int16_t*)&yIQ)[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK; e_ptr++; + txF[mpdcch5tab[i+(36*mdci->firstCCE)]] = yIQ; + } + + } +} + +#endif From 874e0cf9e57058b523f1112812baa3482881efba Mon Sep 17 00:00:00 2001 From: "mohamed.said" Date: Thu, 17 Aug 2017 12:52:20 +0200 Subject: [PATCH 3/4] Reviewing do_RRCConnectionSetup_BR --- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 94 ++++++++++++++------------- 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index e48db1d483..36f8b575dc 100755 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -2171,7 +2171,7 @@ do_RRCConnectionReconfigurationComplete( return((enc_rval.encoded+7)/8); } -#ifdef Rel14 +//#ifdef Rel14 uint8_t do_RRCConnectionSetup_BR( const protocol_ctxt_t* const ctxt_pP, @@ -2225,11 +2225,11 @@ do_RRCConnectionSetup_BR( SRB1_config = CALLOC(1,sizeof(*SRB1_config)); SRB1_config->srb_Identity = 1; - SRB1_rlc_config = CALLOC(1,sizeof(*SRB1_rlc_config)); - SRB1_config->rlc_Config = SRB1_rlc_config; + SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); + SRB1_config->rlc_Config = SRB1_rlc_config; // check this SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am; + SRB1_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; #if defined(ENABLE_ITTI) SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = rrc->srb1_poll_pdu; @@ -2238,23 +2238,23 @@ do_RRCConnectionSetup_BR( SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = rrc->srb1_timer_reordering; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit; #else - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20;; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p4;; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20; // FIXME should be 80 + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p4; // FIXME should be infinity SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0; #endif - SRB1_lchan_config = CALLOC(1,sizeof(*SRB1_lchan_config)); - SRB1_config->logicalChannelConfig = SRB1_lchan_config; + SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); + SRB1_config->logicalChannelConfig = SRB1_lchan_config; SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - SRB1_ul_SpecificParameters = CALLOC(1,sizeof(*SRB1_ul_SpecificParameters)); + SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; - SRB1_ul_SpecificParameters->priority = 1; //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); @@ -2286,9 +2286,9 @@ do_RRCConnectionSetup_BR( physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); if (rrc->srs_enable[CC_id]) - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); else - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); #ifdef CBA @@ -2298,9 +2298,9 @@ do_RRCConnectionSetup_BR( //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, // PDSCH_ConfigDedicated__p_a_dB0); if (carrier->p_eNB==2) - physicalConfigDedicated2->pdsch_ConfigDedicated->p_a= PDSCH_ConfigDedicated__p_a_dB_3; + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB_3; else - physicalConfigDedicated2->pdsch_ConfigDedicated->p_a= PDSCH_ConfigDedicated__p_a_dB0; + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; // PUCCH physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present=PUCCH_ConfigDedicated__ackNackRepetition_PR_release; @@ -2309,7 +2309,7 @@ do_RRCConnectionSetup_BR( if (carrier->sib1->tdd_Config == NULL) { physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode=NULL;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; } else { //TDD - physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode= CALLOC(1,sizeof(long)); + physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = CALLOC(1,sizeof(long)); *(physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode) = PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_bundling;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; } @@ -2616,7 +2616,7 @@ do_RRCConnectionSetup_BR( return((enc_rval.encoded+7)/8); } -#endif +//#endif //------------------------------------------------------------------------------ @@ -2760,9 +2760,9 @@ do_RRCConnectionSetup( } // Pusch_config_dedicated - physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 - physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 - physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 // FIXME should be 10 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 // FIXME should be 9 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 // FIXME should be 10 // UplinkPowerControlDedicated physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB @@ -2797,19 +2797,21 @@ do_RRCConnectionSetup( physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused=0; - // CQI ReportConfig - + // CQI ReportConfig // FIXME -- reportModeAperiodic should be rm20 physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); #if defined(Rel10) || defined(Rel14) - *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic= CQI_ReportModeAperiodic_rm30; + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic = CQI_ReportModeAperiodic_rm30; #else - *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CQI_ReportConfig__cqi_ReportModeAperiodic_rm30; // HLC CQI, no PMI + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic = CQI_ReportConfig__cqi_ReportModeAperiodic_rm30; // HLC CQI, no PMI #endif physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=NULL; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); + // FIXME -- release = NULL + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_release; + + /* physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch @@ -2823,23 +2825,23 @@ do_RRCConnectionSetup( //soundingRS-UL-ConfigDedicated if (rrc->srs_enable[CC_id]==1) { - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; - if (carrier->sib1->tdd_Config==NULL) { // FDD - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present - == SoundingRS_UL_ConfigCommon_PR_setup) - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) - LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %d. Expect undefined behaviour!\n", - carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); - 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->present = SoundingRS_UL_ConfigDedicated_PR_setup; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + if (carrier->sib1->tdd_Config==NULL) { // FDD + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present + == SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %d. Expect undefined behaviour!\n", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); + 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; } @@ -2866,7 +2868,7 @@ do_RRCConnectionSetup( } - //AntennaInfoDedicated + //AntennaInfoDedicated // FIXME -- check this physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode, @@ -2876,11 +2878,11 @@ do_RRCConnectionSetup( default: LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n"); case 1: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode = AntennaInfoDedicated__transmissionMode_tm1; break; case 2: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode = AntennaInfoDedicated__transmissionMode_tm2; break; /* case 3: @@ -2921,10 +2923,12 @@ do_RRCConnectionSetup( // SchedulingRequestConfig physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; + // FIXME -- sr_PUCCH_resourceIndex should be 18 physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 3;//ue_context_pP->local_uid; if (carrier->sib1->tdd_Config == NULL) { // FDD - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) + // FIXME -- check this -- 5 + (ue_context_pP->local_uid % 10) should produce 76 + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5 + (ue_context_pP->local_uid % 10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) } else { switch (carrier->sib1->tdd_Config->subframeAssignment) { case 1: From 0a4fd473343cbec255e16c45701c062a5bc87980 Mon Sep 17 00:00:00 2001 From: "mohamed.said" Date: Thu, 17 Aug 2017 14:06:00 +0200 Subject: [PATCH 4/4] updated fill_rar_brY --- openair2/LAYER2/MAC/rar_tools.c | 43 ++++++++----- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 92 ++++++++++++++------------- 2 files changed, 73 insertions(+), 62 deletions(-) diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c index f9ccd4f9ed..008cadec08 100755 --- a/openair2/LAYER2/MAC/rar_tools.c +++ b/openair2/LAYER2/MAC/rar_tools.c @@ -132,12 +132,12 @@ unsigned short fill_rar( #ifdef Rel14 //------------------------------------------------------------------------------ unsigned short fill_rar_br(eNB_MAC_INST *eNB, - int CC_id, - RA_TEMPLATE *RA_template, - const frame_t frameP, - const sub_frame_t subframeP, - uint8_t* const dlsch_buffer, - const uint8_t ce_level + int CC_id, + RA_TEMPLATE *RA_template, + const frame_t frameP, + const sub_frame_t subframeP, + uint8_t* const dlsch_buffer, + const uint8_t ce_level ) //------------------------------------------------------------------------------ { @@ -147,7 +147,7 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB, uint8_t *rar = (uint8_t *)(dlsch_buffer+1); int i; uint8_t nb,rballoc,reps; - uint8_t mcs,TPC,ULdelay,cqireq; + uint8_t mcs,TPC,ULdelay,cqireq,mpdcch_nb_index; int input_buffer_length; @@ -163,10 +163,10 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB, int N_NB_index; - AssertFatal(1==0,"RAR for BL/CE Still to be finished ...\n"); + AssertFatal(1==0,"RAR for BL/CE Still to be finished ...\n"); // Copy the Msg2 narrowband - RA_template->msg34_narrowband = RA_template->msg2_narrowband; + RA_template->msg34_narrowband = RA_template->msg2_narrowband; if (ce_level<2) { //CE Level 0,1, CEmodeA input_buffer_length =6; @@ -177,16 +177,25 @@ unsigned short fill_rar_br(eNB_MAC_INST *eNB, rar[5] = (uint8_t)(RA_template->rnti&0xff); //cc->RA_template[ra_idx].timing_offset = 0; nb = 0; - rballoc = mac_computeRIV(6,1+ce_level,1); // one PRB only for UL Grant in position 1+ce_level within Narrowband - rar[1] |= (rballoc&15)<<(4-N_NB_index); // Hopping = 0 (bit 3), 3 MSBs of rballoc - - reps = 4; - mcs = 7; - TPC = 3; // no power increase + reps = 0; + mcs = 7; + TPC = 3; // no power increase ULdelay = 0; cqireq = 0; - rar[2] |= ((mcs&0x8)>>3); // mcs 10 - rar[3] = (((mcs&0x7)<<5)) | ((TPC&7)<<2) | ((ULdelay&1)<<1) | (cqireq&1); + mpdcch_nb_index = 0; + rballoc = mac_computeRIV(6,1+ce_level,1); // one PRB only for UL Grant in position 1+ce_level within Narrowband + unsigned int buffer = 0; + buffer |= N_NB_index << (16 + (4 - N_NB_index)); + buffer |= ((rballoc & 0xFF) << (12 + (4 - N_NB_index))); + buffer |= ((reps & 0x03) << (10 + (4 - N_NB_index))); + buffer |= ((mcs & 0x07) << (7 + (4 - N_NB_index))); + buffer |= ((TPC & 0x07) << (4 + (4 - N_NB_index))); + buffer |= ((cqireq & 0x01) << (3 + (4 - N_NB_index))); + buffer |= ((ULdelay & 0x01) << (2 + (4 - N_NB_index))); + buffer |= ((ULdelay & 0x01) << (4 - N_NB_index)); + rar[1] = (buffer>>12) & 0x0F; + rar[2] = (buffer>>8) & 0xFF; + rar[3] = buffer&0xFF; } else { // CE level 2,3 => CEModeB diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 36f8b575dc..e8d0e8d90b 100755 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -2333,17 +2333,17 @@ do_RRCConnectionSetup_BR( // CQI ReportConfig /// TODO to be reviewed - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); #if defined(Rel10) || defined(Rel14) - *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic= CQI_ReportModeAperiodic_rm30; + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic = CQI_ReportModeAperiodic_rm30; #else *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CQI_ReportConfig__cqi_ReportModeAperiodic_rm30; // HLC CQI, no PMI #endif physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=NULL; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_release; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_release; /* physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch @@ -2357,46 +2357,46 @@ do_RRCConnectionSetup_BR( /// TODO to be reviewed if (rrc->srs_enable[CC_id]) { - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; - if (carrier->sib1->tdd_Config==NULL) { // FDD - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present - == SoundingRS_UL_ConfigCommon_PR_setup) - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) - LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %d. Expect undefined behaviour!\n", - carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); - 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 (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present - == SoundingRS_UL_ConfigCommon_PR_setup) - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=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", - carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig, - carrier->sib1->tdd_Config->subframeAssignment); - } - 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->present = SoundingRS_UL_ConfigDedicated_PR_setup; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + if (carrier->sib1->tdd_Config==NULL) { // FDD + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present + == SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %d. Expect undefined behaviour!\n", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); + 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 (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present + == SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=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", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig, + carrier->sib1->tdd_Config->subframeAssignment); + } + 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; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift= + SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; } //AntennaInfoDedicated @@ -2530,11 +2530,13 @@ do_RRCConnectionSetup_BR( // FIXME allocate physicalConfigDedicated2->ext7 physicalConfigDedicated2->ext7 = CALLOC(1, sizeof(struct PhysicalConfigDedicated__ext7)); - physicalConfigDedicated2->ext7->pdsch_ConfigDedicated_v1310 = NULL; + + physicalConfigDedicated2->ext7->pdsch_ConfigDedicated_v1310 = NULL; // has some parameters to be filled + physicalConfigDedicated2->ext7->pusch_ConfigDedicated_r13 = NULL; + physicalConfigDedicated2->ext7->pucch_ConfigDedicated_r13 = NULL; physicalConfigDedicated2->ext7->pdcch_CandidateReductions_r13 = NULL; - physicalConfigDedicated2->ext7->pucch_ConfigDedicated_r13 = NULL; physicalConfigDedicated2->ext7->cqi_ReportConfig_v1310 = NULL;