From 9a857e4486ccb045fce53add8d50b2ddacc33a48 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein Date: Wed, 1 Apr 2020 16:28:44 +0200 Subject: [PATCH] Adopting the dynamic implementation of DMRS at the gNB side - Using the implemented DMRS functionalities at the MAC layer at the gNB side - Removing is_dmrs_symbol function - Temporary implemetation at the UE side considering DMRS symbol is at the 1st PUSCH symbol, until the nFAPI structs for DMRS is adopted at the UE side --- openair1/PHY/NR_REFSIG/dmrs_nr.c | 156 ------------------ openair1/PHY/NR_REFSIG/dmrs_nr.h | 13 -- openair1/PHY/NR_REFSIG/ptrs_nr.c | 27 +-- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 51 +++--- openair1/SIMULATION/NR_PHY/ulsim.c | 17 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 85 ++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 25 ++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 + 8 files changed, 142 insertions(+), 234 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index ed37a79d0f..8718fc8610 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -35,143 +35,6 @@ /***********************************************************************/ -// TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. -// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. -// When l' = l0, it is represented by 1 -// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10. - -int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols -{-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position) -{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position) -{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position) -{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position) -{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position) -{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position) -{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position) -{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position) -{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position) -}; - - -// TS 38.211 Table 6.4.1.1.3-4: PUSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled. -// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. -// When l' = l0, it is represented by 1 - -int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols -{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position) -{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position) -{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position) -{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position) -{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position) -{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position) -{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position) -{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position) -{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position) -}; - -int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) { - - uint8_t row, colomn; - int32_t l_prime; - - colomn = additional_pos; - - if (mapping_type == typeB) - colomn += 4; - - if (duration_in_symbols < 4) - row = 0; - else - row = duration_in_symbols - 3; - - if (pusch_maxLength == pusch_len1) - l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn]; - else - l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn]; - - AssertFatal(l_prime>0,"invalid l_prime < 0\n"); - - return l_prime; -} - -/******************************************************************* -* -* NAME : is_dmrs_symbol -* -* PARAMETERS : l ofdm symbol index within slot -* k subcarrier index -* start_sc first subcarrier index -* k_prime index alternating 0 and 1 -* n index starting 0,1,... -* delta see Table 6.4.1.1.3 -* duration_in_symbols number of scheduled PUSCH ofdm symbols -* dmrs_UplinkConfig DMRS uplink configuration -* mapping_type PUSCH mapping type (A or B) -* ofdm_symbol_size IFFT size -* -* RETURN : 0 if symbol(k,l) is data, or 1 if symbol(k,l) is dmrs -* -* DESCRIPTION : 3GPP TS 38.211 6.4.1.1 Demodulation reference signal for PUSCH -* -*********************************************************************/ - -uint8_t is_dmrs_symbol(uint8_t l, - uint16_t k, - uint16_t start_sc, - uint8_t k_prime, - uint16_t n, - uint8_t delta, - uint8_t duration_in_symbols, - uint8_t dmrs_type, - uint16_t ofdm_symbol_size) { - - uint8_t is_dmrs_freq, is_dmrs_time, l0; - int32_t l_prime_mask; - pusch_dmrs_AdditionalPosition_t additional_pos = pusch_dmrs_pos0; - pusch_maxLength_t pusch_maxLength = pusch_len1; - uint8_t mapping_type = typeB; - - is_dmrs_freq = 0; - is_dmrs_time = 0; - - - l0 = get_l0_ul(mapping_type, 2); - l_prime_mask = get_l_prime(duration_in_symbols, mapping_type, additional_pos, pusch_maxLength); - - if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%ofdm_symbol_size)) - is_dmrs_freq = 1; - - - if (l_prime_mask == 1){ - - if (l == l0) - is_dmrs_time = 1; - - } else if ( (l==l0) || (((l_prime_mask>>l)&1) == 1 && l!=0) ) - is_dmrs_time = 1; - - if (pusch_maxLength == pusch_len2){ - - if (((l_prime_mask>>(l-1))&1) == 1 && l!=0 && l!=1) - is_dmrs_time = 1; - - if (l-1 == l0) - is_dmrs_time = 1; - - } - - if (is_dmrs_time && is_dmrs_freq) - return 1; - else - return 0; - -} /******************************************************************* * @@ -364,25 +227,6 @@ void lte_gold_new(LTE_DL_FRAME_PARMS *frame_parms, uint32_t lte_gold_table[20][2 #endif } -/******************************************************************* -* -* NAME : get_l0_ul -* -* PARAMETERS : mapping_type : PUSCH mapping type -* dmrs_typeA_position : higher layer parameter -* -* RETURN : demodulation reference signal for PUSCH -* -* DESCRIPTION : see TS 38.211 V15.4.0 Demodulation reference signals for PUSCH -* -*********************************************************************/ - -uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position) { - - return ((mapping_type==typeA)?dmrs_typeA_position:0); - -} - /******************************************************************* * * NAME : get_dmrs_freq_idx_ul diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.h b/openair1/PHY/NR_REFSIG/dmrs_nr.h index f1dfffff8b..6badf71745 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.h +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.h @@ -54,21 +54,8 @@ int pseudo_random_sequence(int M_PN, uint32_t *c, uint32_t cinit); void lte_gold_new(LTE_DL_FRAME_PARMS *frame_parms, uint32_t lte_gold_table[20][2][14], uint16_t Nid_cell); void generate_dmrs_pbch(uint32_t dmrs_pbch_bitmap[DMRS_PBCH_I_SSB][DMRS_PBCH_N_HF][DMRS_BITMAP_SIZE], uint16_t Nid_cell); -uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); uint16_t get_dmrs_freq_idx_ul(uint16_t n, uint8_t k_prime, uint8_t delta, uint8_t dmrs_type); -int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength); - -uint8_t is_dmrs_symbol(uint8_t l, - uint16_t k, - uint16_t start_sc, - uint8_t k_prime, - uint16_t n, - uint8_t delta, - uint8_t duration_in_symbols, - uint8_t dmrs_type, - uint16_t ofdm_symbol_size); - #undef EXTERN #endif /* DMRS_NR_H */ diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index a488ff5a87..fbd0f1e62e 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -144,24 +144,15 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, last_symbol = start_symbol + duration_in_symbols - 1; while ( (l_ref + i*L_ptrs) <= last_symbol) { - is_dmrs_symbol1 = is_dmrs_symbol(max((l_ref + (i-1)*L_ptrs + 1), l_ref), - 0, - 0, - 0, - 0, - 0, - duration_in_symbols, - dmrs_type, - ofdm_symbol_size); - is_dmrs_symbol2 = is_dmrs_symbol(l_ref + i*L_ptrs, - 0, - 0, - 0, - 0, - 0, - duration_in_symbols, - dmrs_type, - ofdm_symbol_size); + + // [hna] Temporary implementation until nFAPI structs are adopted at UE side + // -------------------------- + if(max((l_ref + (i-1)*L_ptrs + 1), l_ref) == start_symbol) + is_dmrs_symbol1 = 1; + + if(l_ref + i*L_ptrs == start_symbol) + is_dmrs_symbol2 = 0; + // -------------------------- if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) { if (pusch_maxLength == 2) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 76beb9f351..d9cab95ca9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -136,16 +136,15 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, start_symbol = harq_process_ul_ue->start_symbol; - 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, - 0, - 0, - 0, - 0, - 0, - harq_process_ul_ue->number_of_symbols, - UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, - frame_parms->ofdm_symbol_size); + for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) { + + // [hna] Temporary implementation until nFAPI structs are adopted at UE side + // -------------------------- + if((mapping_type ? (i - start_symbol) : i) == start_symbol) + number_dmrs_symbols += 1; + // -------------------------- + + } 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 @@ -329,15 +328,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, for (l = start_symbol; l < start_symbol + harq_process_ul_ue->number_of_symbols; l++) { - is_dmrs = is_dmrs_symbol((mapping_type)?l-start_symbol:l, - 0, - 0, - 0, - 0, - 0, - harq_process_ul_ue->number_of_symbols, - dmrs_type, - frame_parms->ofdm_symbol_size); + // [hna] Temporary implementation until nFAPI structs are adopted at UE side + // -------------------------- + if(((mapping_type)?l-start_symbol:l) == start_symbol) + is_dmrs = 1; + else + is_dmrs = 0; + // -------------------------- if (is_dmrs == 1) nb_re_dmrs_per_rb = ulsch_ue->nb_re_dmrs; @@ -397,15 +394,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, is_dmrs = 0; is_ptrs = 0; - is_dmrs = is_dmrs_symbol(l_ref, - k, - start_sc, - k_prime, - n, - delta, - harq_process_ul_ue->number_of_symbols, - dmrs_type, - frame_parms->ofdm_symbol_size); + // [hna] Temporary implementation until nFAPI structs are adopted at UE side + // -------------------------- + if(l_ref == start_symbol) { + if (k == ((start_sc+get_dmrs_freq_idx_ul(n, k_prime, delta, dmrs_type))%frame_parms->ofdm_symbol_size)) + is_dmrs = 1; + } + // -------------------------- if (UE->ptrs_configured == 1){ is_ptrs = is_ptrs_symbol(l, diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 2adc67501a..3120f1d144 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -503,16 +503,11 @@ int main(int argc, char **argv) unsigned char mod_order; uint16_t code_rate; - for (i = start_symbol; i < nb_symb_sch; i++) - number_dmrs_symbols += is_dmrs_symbol(i, - 0, - 0, - 0, - 0, - 0, - nb_symb_sch, - UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, - frame_parms->ofdm_symbol_size); + uint16_t l_prime_mask = get_l_prime(nb_symb_sch, UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type, pusch_dmrs_pos0, length_dmrs); + + for (i = 0; i < nb_symb_sch; i++) { + number_dmrs_symbols += (l_prime_mask >> i) & 0x01; + } mod_order = nr_get_Qm_ul(Imcs, 0); nb_re_dmrs = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1) ? 6 : 4) * number_dmrs_symbols; @@ -560,7 +555,7 @@ int main(int argc, char **argv) pusch_pdu->transform_precoding = 0; pusch_pdu->data_scrambling_id = 0; pusch_pdu->nrOfLayers = 1; - pusch_pdu->ul_dmrs_symb_pos = 1; + pusch_pdu->ul_dmrs_symb_pos = l_prime_mask; pusch_pdu->dmrs_config_type = 0; pusch_pdu->ul_dmrs_scrambling_id = 0; pusch_pdu->scid = 0; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index ae23164194..26a08e9afb 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -79,6 +79,47 @@ nr_bandentry_t nr_bandtable[] = { {261,27500000,28350000,27500000,28350000, 2,2070833, 120} }; + +// TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. +// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. +// When l' = l0, it is represented by 1 +// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10. + +int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols +{-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position) +{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position) +{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position) +{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position) +{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position) +{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position) +{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position) +{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position) +{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position) +{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position) +}; + + +// TS 38.211 Table 6.4.1.1.3-4: PUSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled. +// The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. +// When l' = l0, it is represented by 1 + +int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols +{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position) +{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position) +{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position) +{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position) +{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position) +{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position) +{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position) +{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position) +{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position) +{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position) +}; + #define NR_BANDTABLE_SIZE (sizeof(nr_bandtable)/sizeof(nr_bandentry_t)) void get_band(uint64_t downlink_frequency, @@ -517,6 +558,50 @@ int get_num_dmrs(uint16_t dmrs_mask ) { return(num_dmrs); } +/******************************************************************* +* +* NAME : get_l0_ul +* +* PARAMETERS : mapping_type : PUSCH mapping type +* dmrs_typeA_position : higher layer parameter +* +* RETURN : demodulation reference signal for PUSCH +* +* DESCRIPTION : see TS 38.211 V15.4.0 Demodulation reference signals for PUSCH +* +*********************************************************************/ + +uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position) { + + return ((mapping_type==typeA)?dmrs_typeA_position:0); + +} + +int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) { + + uint8_t row, colomn; + int32_t l_prime; + + colomn = additional_pos; + + if (mapping_type == typeB) + colomn += 4; + + if (duration_in_symbols < 4) + row = 0; + else + row = duration_in_symbols - 3; + + if (pusch_maxLength == pusch_len1) + l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn]; + else + l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn]; + + AssertFatal(l_prime>0,"invalid l_prime < 0\n"); + + return l_prime; +} + uint16_t nr_dci_size(nr_dci_format_t format, nr_rnti_type_t rnti_type, uint16_t N_RB) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 1e0fd8d9a2..196bd3805b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -758,14 +758,6 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, pusch_pdu->transform_precoding = 0; pusch_pdu->data_scrambling_id = 0; //It equals the higher-layer parameter Data-scrambling-Identity if configured and the RNTI equals the C-RNTI, otherwise L2 needs to set it to physical cell id.; pusch_pdu->nrOfLayers = 1; - //DMRS - pusch_pdu->ul_dmrs_symb_pos = 1<<2; //for now the gnb assumes dmrs in the first symbol of the scheduled pusch resource - pusch_pdu->dmrs_config_type = 0; //dmrs-type 1 (the one with a single DMRS symbol in the beginning) - pusch_pdu->ul_dmrs_scrambling_id = 0; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id. - pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0. - //pusch_pdu->num_dmrs_cdm_grps_no_data; - //pusch_pdu->dmrs_ports; //DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports. Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011 and for each bit 0: DMRS port not used 1: DMRS port used - //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] pusch_pdu->resource_alloc = 1; //type 1 //pusch_pdu->rb_bitmap;// for ressource alloc type 0 pusch_pdu->rb_start = 0; @@ -777,6 +769,23 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, //Resource Allocation in time domain pusch_pdu->start_symbol_index = 2; pusch_pdu->nr_of_symbols = 12; + + // -------------------- + // ------- DMRS ------- + // -------------------- + uint16_t l_prime_mask = get_l_prime(pusch_pdu->nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); + pusch_pdu->ul_dmrs_symb_pos = l_prime_mask; + pusch_pdu->dmrs_config_type = 0; // dmrs-type 1 (the one with a single DMRS symbol in the beginning) + pusch_pdu->ul_dmrs_scrambling_id = 0; // If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id + pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1] + // Should match what is sent in DCI 0_1, otherwise set to 0 + //pusch_pdu->num_dmrs_cdm_grps_no_data; + //pusch_pdu->dmrs_ports; // DMRS ports. [TS38.212 7.3.1.1.2] provides description between DCI 0-1 content and DMRS ports + // Bitmap occupying the 11 LSBs with: bit 0: antenna port 1000 bit 11: antenna port 1011, + // and for each bit 0: DMRS port not used 1: DMRS port used + // -------------------------------------------------------------------------------------------------------------------------------------------- + + //Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2] //Optional Data only included if indicated in pduBitmap pusch_pdu->pusch_data.rv_index = 0; pusch_pdu->pusch_data.harq_process_id = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index d55a188817..6179335277 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -162,6 +162,8 @@ int find_nr_UE_id(module_id_t mod_idP, rnti_t rntiP); int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP); int get_num_dmrs(uint16_t dmrs_mask ); +uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); +int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength); uint16_t nr_dci_size(nr_dci_format_t format, nr_rnti_type_t rnti_type,