From e451ff54effe3ccc399fac4cc99ee006f58e6b89 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 26 Mar 2020 09:34:07 +0100 Subject: [PATCH] fixing compilation errors and one file left behind --- openair1/PHY/NR_REFSIG/dmrs_nr.c | 3 - .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 10 +- openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 111 ++---------------- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 - openair2/LAYER2/NR_MAC_UE/mac_proto.h | 3 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 3 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 28 ++++- 8 files changed, 41 insertions(+), 121 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index ea1e0a639a..34c887be30 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -141,9 +141,6 @@ uint8_t is_dmrs_symbol(uint8_t l, is_dmrs_freq = 0; is_dmrs_time = 0; - if (mapping_type==typeB) - l -= start_symbol; - AssertFatal(l >= 0,"Check DMRS configuration (start_symbol) !\n"); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 20d03485b2..d304f26d02 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -307,12 +307,6 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, printf("re = %d, symbol = %d\n", re, symbol); #endif - if (symbol == dmrs_symbol) - is_dmrs_re = (re == get_dmrs_freq_idx_ul(n, k_prime, delta, pusch_pdu->dmrs_config_type)); - else - is_dmrs_re = 0; - - if ( is_dmrs_re == 0 && is_ptrs_symbol_flag == 0) { rxF_ext[rxF_ext_index] = (rxF[ ((start_re + re)*2) % (frame_parms->ofdm_symbol_size*2)]); @@ -1027,7 +1021,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, unsigned char harq_pid) { - uint8_t first_symbol_flag, aarx, aatx, dmrs_symbol_flag, ptrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol + uint8_t aarx, aatx, dmrs_symbol_flag, ptrs_symbol_flag; // dmrs_symbol_flag, a flag to indicate DMRS REs in current symbol uint32_t nb_re_pusch, bwp_start_subcarrier; uint8_t L_ptrs = 0; // PTRS parameter int avgs; @@ -1038,7 +1032,6 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, dmrs_symbol_flag = 0; ptrs_symbol_flag = 0; - first_symbol_flag = 0; gNB->pusch_vars[UE_id]->ptrs_sc_per_ofdm_symbol = 0; if(symbol == rel15_ul->start_symbol_index){ @@ -1046,7 +1039,6 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, gNB->pusch_vars[UE_id]->dmrs_symbol = 0; gNB->pusch_vars[UE_id]->cl_done = 0; gNB->pusch_vars[UE_id]->ptrs_symbols = 0; - first_symbol_flag = 1; if ( ((rel15_ul->pdu_bit_map)>>2)& 0x01 ) { // if there is ptrs pdu L_ptrs = 1<<(rel15_ul->pusch_ptrs.ptrs_time_density); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index fb80f0e124..6326ed9446 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -90,7 +90,7 @@ void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue, uint32_t rx_power_fil_dB, uint8_t eNB_id); -int16_t get_nr_PL(PHY_VARS_NR_UE *ue,uint8_t gNB_index); +int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index); #endif diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 19bd3c6f24..f262400f5d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -126,14 +126,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, n_rnti = 0x1234; Nid_cell = 0; N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig -<<<<<<< HEAD - - mapping_type = UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; - int dmrs_symb; -======= number_dmrs_symbols = 0; uint8_t mapping_type = UE->pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; ->>>>>>> develop + for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) { @@ -142,47 +137,23 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, start_symbol = harq_process_ul_ue->start_symbol; -<<<<<<< HEAD - dmrs_symb=-1; - number_dmrs_symbols = 0; - - for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) { - number_dmrs_symbols += is_dmrs_symbol(i, -======= for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) number_dmrs_symbols += is_dmrs_symbol((mapping_type)?i-start_symbol:i, ->>>>>>> develop 0, 0, 0, 0, 0, harq_process_ul_ue->number_of_symbols, -<<<<<<< HEAD - start_symbol, - &UE->dmrs_UplinkConfig, - mapping_type, -======= UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, ->>>>>>> develop frame_parms->ofdm_symbol_size); - if (dmrs_symb == -1 && number_dmrs_symbols == 1) dmrs_symb = i; - } - AssertFatal(number_dmrs_symbols ==1,"number_dmrs_symbols != 1\n"); - AssertFatal(dmrs_symb >=0,"dmrs_symb < 0\n"); - LOG_D(PHY,"pusch: start_symbol %d, dmrs_symbol %d, num_symbols %d\n", - start_symbol,dmrs_symb,harq_process_ul_ue->number_of_symbols); ulsch_ue->length_dmrs = number_dmrs_symbols; // pusch.MaxLenght is redundant here as number_dmrs_symbols // contains all dmrs symbols even for double symbol dmrs ulsch_ue->rnti = n_rnti; ulsch_ue->Nid_cell = Nid_cell; -<<<<<<< HEAD ulsch_ue->nb_re_dmrs = 12;//((UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; -======= - ulsch_ue->nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4); ->>>>>>> develop N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs*number_dmrs_symbols - N_PRB_oh; @@ -415,17 +386,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t l_ref; uint16_t m=0, n=0, dmrs_idx=0, ptrs_idx = 0; - for (l=start_symbol; lnumber_of_symbols; l++) { + for (l=start_symbol; lnumber_of_symbols; l++) { k = start_sc; n = 0; dmrs_idx = 0; l_ref = (mapping_type) ? l-start_symbol : l; -<<<<<<< HEAD - if (l!=dmrs_symb) { - for (i=0; inb_rb*NR_NB_SC_PER_RB; i++) { -======= for (i=0; inb_rb*NR_NB_SC_PER_RB; i++) { sample_offsetF = l*frame_parms->ofdm_symbol_size + k; @@ -491,81 +458,21 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ptrs_idx++; } else { ->>>>>>> develop - sample_offsetF = l*frame_parms->ofdm_symbol_size + k; ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1]; ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1]; -#ifdef DEBUG_PUSCH_MAPPING - printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", + #ifdef DEBUG_PUSCH_MAPPING + printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); -#endif - + #endif + m++; - if (++k >= frame_parms->ofdm_symbol_size) - k -= frame_parms->ofdm_symbol_size; - - } - } - else { + } - for (i=0; inb_rb*NR_NB_SC_PER_RB; i++) { - - sample_offsetF = l*frame_parms->ofdm_symbol_size + k; - is_dmrs = 0; - - is_dmrs = is_dmrs_symbol(l, - k, - start_sc, - k_prime, - n, - delta, - harq_process_ul_ue->number_of_symbols, - start_symbol, - &UE->dmrs_UplinkConfig, - mapping_type, - frame_parms->ofdm_symbol_size); - if (is_dmrs == 1) { - - nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated - - ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; - -#ifdef DEBUG_PUSCH_MAPPING - printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n", - dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); -#endif - - - dmrs_idx++; - k_prime++; - k_prime&=1; - n+=(k_prime)?0:1; - } - - else { - //remove PDSCH REs from DMRS symbols for now - /* - ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = ((int16_t *) ulsch_ue->y)[m<<1]; - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = ((int16_t *) ulsch_ue->y)[(m<<1) + 1]; - - #ifdef DEBUG_PUSCH_MAPPING - printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1], - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]); - #endif - - m++; - */ - } - - if (++k >= frame_parms->ofdm_symbol_size) - k -= frame_parms->ofdm_symbol_size; - } + if (++k >= frame_parms->ofdm_symbol_size) + k -= frame_parms->ofdm_symbol_size; } } } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 027954a5a5..4c1ece8c5f 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -235,8 +235,6 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH G = nr_get_G(pusch_pdu->rb_size, number_symbols, nb_re_dmrs, - pusch_pdu->qam_mod_order, - pusch_pdu->nrOfLayers); number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs pusch_pdu->qam_mod_order, pusch_pdu->nrOfLayers); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index afb161b337..d6a586b1c9 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -163,7 +163,8 @@ unsigned char nr_generate_ulsch_pdu(uint8_t *sdus_payload, uint16_t truncated_bsr, uint16_t short_bsr, uint16_t long_bsr, - unsigned short post_padding); + unsigned short post_padding, + uint16_t buflen); int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 138d37d394..decdddbe31 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -470,7 +470,8 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, 0, // truncated bsr 0, // short bsr 0, // long_bsr - post_padding); // post_padding + post_padding, + 0); // Padding: fill remainder with 0 if (post_padding > 0){ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 5adb71d8d8..7a46ce8d85 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -33,6 +33,7 @@ #include "executables/softmodem-common.h" //#define ENABLE_MAC_PAYLOAD_DEBUG 1 + void nr_process_mac_pdu( module_id_t module_idP, uint8_t CC_id, @@ -88,7 +89,13 @@ void nr_process_mac_pdu( /*#ifdef DEBUG_HEADER_PARSING LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len); #endif*/ - + case UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY: + // 38.321 Ch6.1.3.20 + mac_ce_len = 2; + break; + case UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION: + // 38.321 Ch6.1.3.7 + break; case UL_SCH_LCID_S_BSR: //38.321 section 6.1.3.1 //fixed length @@ -171,6 +178,24 @@ void nr_process_mac_pdu( // end of MAC PDU, can ignore the rest. break; + // MAC SDUs + case UL_SCH_LCID_SRB1: + // todo + break; + case UL_SCH_LCID_SRB2: + // todo + break; + case UL_SCH_LCID_SRB3: + // todo + break; + case UL_SCH_LCID_CCCH_MSG3: + // todo + break; + case UL_SCH_LCID_CCCH: + // todo + mac_subheader_len = 2; + break; + case UL_SCH_LCID_DTCH: // check if LCID is valid at current time. if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){ @@ -230,7 +255,6 @@ void nr_process_mac_pdu( } } - /* * When data are received on PHY and transmitted to MAC */