Commit b9148d63 authored by Ahmed Hussein's avatar Ahmed Hussein
Browse files

Migrating members from NR_UL_UE_HARQ_t to the new added NFAPI structs

parent d3cbf146
......@@ -388,6 +388,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
start_symbol = 2;
precod_nbr_layers = 1;
mcs = 9;
mcs_table = 0;
harq_pid = 0;
rvidx = 0;
l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, pusch_len1);
......@@ -403,6 +404,7 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.start_symbol = start_symbol;
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ul_dmrs_symb_pos = l_prime_mask;
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs = mcs;
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.mcs_table = mcs_table;
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.ndi = 0;
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = rvidx;
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = precod_nbr_layers;
......
......@@ -22,6 +22,8 @@
#include "fapi_nr_ue_constants.h"
#include "PHY/impl_defs_nr.h"
#define NFAPI_UE_MAX_NUM_CB 8
/*
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
......@@ -260,7 +262,127 @@ typedef struct {
typedef struct{
uint8_t aperiodicSRS_ResourceTrigger;
} fapi_nr_ul_srs_config_t;
typedef struct {
typedef struct
{
uint8_t rv_index;
uint8_t harq_process_id;
uint8_t new_data_indicator;
uint32_t tb_size;
uint16_t num_cb;
uint8_t cb_present_and_position[(NFAPI_UE_MAX_NUM_CB+7) / 8];
} nfapi_nr_ue_pusch_data_t;
typedef struct
{
uint16_t harq_ack_bit_length;
uint16_t csi_part1_bit_length;
uint16_t csi_part2_bit_length;
uint8_t alpha_scaling;
uint8_t beta_offset_harq_ack;
uint8_t beta_offset_csi1;
uint8_t beta_offset_csi2;
} nfapi_nr_ue_pusch_uci_t;
typedef struct
{
uint16_t ptrs_port_index;//PT-RS antenna ports [TS38.214, sec6.2.3.1 and 38.212, section 7.3.1.1.2] Bitmap occupying the 12 LSBs with: bit 0: antenna port 0 bit 11: antenna port 11 and for each bit 0: PTRS port not used 1: PTRS port used
uint8_t ptrs_dmrs_port;//DMRS port corresponding to PTRS.
uint8_t ptrs_re_offset;//PT-RS resource element offset value taken from 0~11
} nfapi_nr_ue_ptrs_ports_t;
typedef struct
{
uint8_t num_ptrs_ports;
nfapi_nr_ue_ptrs_ports_t* ptrs_ports_list;
uint8_t ptrs_time_density;
uint8_t ptrs_freq_density;
uint8_t ul_ptrs_power;
}nfapi_nr_ue_pusch_ptrs_t;
typedef struct
{
uint8_t low_papr_group_number;//Group number for Low PAPR sequence generation.
uint16_t low_papr_sequence_number;//[TS38.211, sec 5.2.2] For DFT-S-OFDM.
uint8_t ul_ptrs_sample_density;//Number of PTRS groups [But I suppose this sentence is misplaced, so as the next one. --Chenyu]
uint8_t ul_ptrs_time_density_transform_precoding;//Number of samples per PTRS group
} nfapi_nr_ue_dfts_ofdm_t;
typedef struct
{
uint16_t beam_idx;//Index of the digital beam weight vector pre-stored at cell configuration. The vector maps this input port to output TXRUs. Value: 0->65535
}nfapi_nr_ue_dig_bf_interface_t;
typedef struct
{
nfapi_nr_ue_dig_bf_interface_t* dig_bf_interface_list;
} nfapi_nr_ue_ul_beamforming_number_of_prgs_t;
typedef struct
{
uint16_t num_prgs;
uint16_t prg_size;
//watchout: dig_bf_interface here, in table 3-43 it's dig_bf_interfaces
uint8_t dig_bf_interface;
nfapi_nr_ue_ul_beamforming_number_of_prgs_t* prgs_list;//
} nfapi_nr_ue_ul_beamforming_t;
typedef struct
{
uint16_t pdu_bit_map;//Bitmap indicating presence of optional PDUs (see above)
uint16_t rnti;
uint32_t handle;//An opaque handling returned in the RxData.indication and/or UCI.indication message
//BWP
uint16_t bwp_size;
uint16_t bwp_start;
uint8_t subcarrier_spacing;
uint8_t cyclic_prefix;
//pusch information always include
uint16_t target_code_rate;
uint8_t qam_mod_order;
uint8_t mcs_index;
uint8_t mcs_table;
uint8_t transform_precoding;
uint16_t data_scrambling_id;
uint8_t nrOfLayers;
//DMRS
uint16_t ul_dmrs_symb_pos;
uint8_t dmrs_config_type;
uint16_t ul_dmrs_scrambling_id;
uint8_t scid;
uint8_t num_dmrs_cdm_grps_no_data;
uint16_t 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]
uint8_t resource_alloc;
uint8_t rb_bitmap[36];//
uint16_t rb_start;
uint16_t rb_size;
uint8_t vrb_to_prb_mapping;
uint8_t frequency_hopping;
uint16_t tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE]
uint8_t uplink_frequency_shift_7p5khz;
//Resource Allocation in time domain
uint8_t start_symbol_index;
uint8_t nr_of_symbols;
//Optional Data only included if indicated in pduBitmap
nfapi_nr_ue_pusch_data_t pusch_data;
nfapi_nr_ue_pusch_uci_t pusch_uci;
nfapi_nr_ue_pusch_ptrs_t pusch_ptrs;
nfapi_nr_ue_dfts_ofdm_t dfts_ofdm;
//beamforming
nfapi_nr_ue_ul_beamforming_t beamforming;
} nfapi_nr_ue_pusch_pdu_t;
typedef struct {
uint32_t TBS;
uint8_t bandwidth_part_ind;
uint16_t number_rbs;
uint16_t start_rb;
......@@ -269,6 +391,7 @@ typedef struct {
uint16_t start_symbol;
pusch_freq_hopping_t pusch_freq_hopping;
uint8_t mcs;
uint8_t mcs_table;
uint8_t ndi;
uint8_t rv;
uint8_t harq_process_nbr;
......@@ -286,7 +409,7 @@ typedef struct {
uint8_t maxCodeBlockGroupsPerTransportBlock;
uint8_t ptrs_dmrs_association_port;
uint8_t beta_offset_ind;
} fapi_nr_ul_config_pusch_pdu_rel15_t;
} fapi_nr_ul_config_pusch_pdu_rel15_t;
typedef struct {
uint16_t rnti;
......
......@@ -43,7 +43,7 @@
#endif
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
//#include "../LTE_TRANSPORT/transport_common.h"
// structures below implement 36-211 and 36-212
......@@ -86,40 +86,26 @@ typedef struct {
#endif
typedef struct {
/// NDAPI struct for UE
nfapi_nr_ue_pusch_pdu_t pusch_pdu;
/// Indicator of first transmission
uint8_t first_tx;
/// Last Ndi received for this process on DCI (used for C-RNTI only)
uint8_t DCINdi;
/// HARQ tx status
harq_result_t tx_status;
/// Flag indicating that this ULSCH has a new packet (start of new round)
// uint8_t Ndi;
/// Status Flag indicating for this ULSCH (idle,active,disabled)
SCH_status_t status;
/// Subframe scheduling indicator (i.e. Transmission opportunity indicator)
uint8_t subframe_scheduling_flag;
/// Subframe cba scheduling indicator (i.e. Transmission opportunity indicator)
uint8_t subframe_cba_scheduling_flag;
/// First Allocated RB
uint16_t first_rb;
/// Current Number of RBs
uint16_t nb_rb;
/// number of layers
uint8_t Nl;
/// Last TPC command
uint8_t TPC;
/// Transport block size
uint32_t TBS;
/// The payload + CRC size in bits, "B" from 36-212
uint32_t B;
/// Length of ACK information (bits)
uint8_t O_ACK;
/// Index of current HARQ round for this ULSCH
uint8_t round;
/// MCS format of this ULSCH
uint8_t mcs;
/// Redundancy-version of the current sub-frame
uint8_t rvidx;
/// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
unsigned char *a;
/// Pointer to the payload + CRC
......@@ -152,11 +138,6 @@ typedef struct {
uint32_t G;
// Number of modulated symbols carrying data
uint32_t num_of_mod_symbols;
// This is "L" in TS 38.214 V15.4.0 subclause 6.1.2.1
uint8_t number_of_symbols;
// This is "S" in TS 38.214 V15.4.0 subclause 6.1.2.1
uint8_t start_symbol;
uint16_t ul_dmrs_symb_pos;
// decode phich
uint8_t decode_phich;
} NR_UL_UE_HARQ_t;
......@@ -223,8 +204,6 @@ typedef struct {
uint8_t power_offset;
// for cooperative communication
uint8_t cooperation_flag;
/// RNTI attributed to this ULSCH
uint16_t rnti;
/// RNTI type
uint8_t rnti_type;
/// Cell ID
......
......@@ -248,11 +248,11 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
crc = 1;
harq_process = ulsch->harq_processes[harq_pid];
nb_rb = harq_process->nb_rb;
A = harq_process->TBS;
nb_rb = harq_process->pusch_pdu.rb_size;
A = harq_process->pusch_pdu.pusch_data.tb_size;
pz = &Z;
mod_order = nr_get_Qm_ul(harq_process->mcs,0);
R = nr_get_code_rate_ul(harq_process->mcs, 0);
mod_order = nr_get_Qm_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table);
R = nr_get_code_rate_ul(harq_process->pusch_pdu.mcs_index, harq_process->pusch_pdu.mcs_table);
Kr=0;
r_offset=0;
BG = 1;
......@@ -267,7 +267,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->Nl);
LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers);
LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
// if (harq_process->Ndi == 1) { // this is a new packet
......@@ -424,15 +424,15 @@ opp_enabled=0;
//start_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING
printf("rvidx in encoding = %d\n", harq_process->rvidx);
printf("rvidx in encoding = %d\n", harq_process->pusch_pdu.pusch_data.rv_index);
#endif
///////////////////////// d---->| Rate matching bit selection |---->e /////////////////////////
///////////
E = nr_get_E(G, harq_process->C, mod_order, harq_process->Nl, r);
E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r);
Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->Nl,harq_process->C);
Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers,harq_process->C);
nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
......@@ -443,7 +443,7 @@ opp_enabled=0;
harq_process->C,
F,
Kr-F-2*(*pz),
harq_process->rvidx,
harq_process->pusch_pdu.pusch_data.rv_index,
E);
......
......@@ -98,7 +98,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t thread_id,
int gNB_id) {
uint32_t available_bits;
uint32_t available_bits, TBS;
uint8_t mod_order, cwd_index, num_of_codewords, l;
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
uint32_t ***pusch_dmrs;
......@@ -106,8 +106,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
int32_t **txdataF;
uint16_t start_sc, start_rb;
int8_t Wf[2], Wt[2], l_prime[2], delta;
uint16_t n_dmrs, code_rate, number_dmrs_symbols, k;
uint8_t dmrs_type, nb_dmrs_re_per_rb;
uint16_t rnti, n_dmrs, code_rate, number_dmrs_symbols, nb_rb, k;
uint8_t dmrs_type, nb_dmrs_re_per_rb, number_of_symbols, mcs, Nl;
int ap, start_symbol, Nid_cell, i;
int sample_offsetF, N_RE_prime, N_PRB_oh;
uint16_t n_rnti, ul_dmrs_symb_pos;
......@@ -123,7 +123,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
ptrs_UplinkConfig_t *ptrs_Uplink_Config = &UE->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
num_of_codewords = 1; // tmp assumption
n_rnti = 0x1234;
Nid_cell = 0;
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
number_dmrs_symbols = 0;
......@@ -134,35 +133,41 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
ulsch_ue = UE->ulsch[thread_id][gNB_id][cwd_index];
harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
start_symbol = harq_process_ul_ue->start_symbol;
ul_dmrs_symb_pos = harq_process_ul_ue->ul_dmrs_symb_pos;
start_symbol = harq_process_ul_ue->pusch_pdu.start_symbol_index;
ul_dmrs_symb_pos = harq_process_ul_ue->pusch_pdu.ul_dmrs_symb_pos;
number_of_symbols = harq_process_ul_ue->pusch_pdu.nr_of_symbols;
for (i = start_symbol; i < start_symbol + harq_process_ul_ue->number_of_symbols; i++) {
for (i = start_symbol; i < start_symbol + number_of_symbols; i++) {
if((ul_dmrs_symb_pos >> (mapping_type ? (i - start_symbol) : i)) & 0x01)
number_dmrs_symbols += 1;
}
ulsch_ue->rnti = n_rnti;
rnti = harq_process_ul_ue->pusch_pdu.rnti;
ulsch_ue->Nid_cell = Nid_cell;
nb_dmrs_re_per_rb = ((UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4);
N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*harq_process_ul_ue->nb_rb*num_of_codewords;
nb_rb = harq_process_ul_ue->pusch_pdu.rb_size;
mod_order = nr_get_Qm_ul(harq_process_ul_ue->mcs, 0);
code_rate = nr_get_code_rate_ul(harq_process_ul_ue->mcs, 0);
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*num_of_codewords;
harq_process_ul_ue->TBS = nr_compute_tbs(mod_order,
mcs = harq_process_ul_ue->pusch_pdu.mcs_index;
Nl = harq_process_ul_ue->pusch_pdu.nrOfLayers;
mod_order = nr_get_Qm_ul(mcs, 0);
code_rate = nr_get_code_rate_ul(mcs, 0);
harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = nr_compute_tbs(mod_order,
code_rate,
harq_process_ul_ue->nb_rb,
harq_process_ul_ue->number_of_symbols,
nb_rb,
number_of_symbols,
nb_dmrs_re_per_rb*number_dmrs_symbols,
0,
harq_process_ul_ue->Nl);
harq_process_ul_ue->pusch_pdu.nrOfLayers);
TBS = harq_process_ul_ue->pusch_pdu.pusch_data.tb_size;
uint8_t access_mode = SCHEDULED_ACCESS;
//-----------------------------------------------------//
......@@ -172,16 +177,16 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
data_existing = 0;
if (IS_SOFTMODEM_NOS1){
data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame,
slot, 0, ulsch_input_buffer, harq_process_ul_ue->TBS/8, &access_mode);
data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame,
slot, 0, ulsch_input_buffer, TBS/8, &access_mode);
//IP traffic to be transmitted
if(data_existing){
//harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char));
memcpy(harq_process_ul_ue->a, ulsch_input_buffer, harq_process_ul_ue->TBS/8);
if(data_existing){
//harq_process_ul_ue->a = (unsigned char*)calloc(TBS/8, sizeof(unsigned char));
memcpy(harq_process_ul_ue->a, ulsch_input_buffer, TBS/8);
#ifdef DEBUG_MAC_PDU
LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", harq_process_ul_ue->TBS/8);
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", TBS/8);
for (i = 0; i < TBS / 8; i++) {
printf("0x%02x",harq_process_ul_ue->a[i]);
}
printf("\n");
......@@ -198,7 +203,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
for (i = 0; i<payload_offset; i++)
harq_process_ul_ue->a[i] = 0;
for (i = payload_offset; i < harq_process_ul_ue->TBS / 8; i++) {
for (i = payload_offset; i < TBS / 8; i++) {
harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
}
......@@ -213,8 +218,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH coding/////////////////////////
///////////
unsigned int G = nr_get_G(harq_process_ul_ue->nb_rb, harq_process_ul_ue->number_of_symbols,
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, harq_process_ul_ue->Nl);
unsigned int G = nr_get_G(nb_rb, number_of_symbols,
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl);
nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G);
......@@ -224,8 +229,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH scrambling/////////////////////////
///////////
available_bits = nr_get_G(harq_process_ul_ue->nb_rb,
harq_process_ul_ue->number_of_symbols,
available_bits = nr_get_G(nb_rb,
number_of_symbols,
nb_dmrs_re_per_rb,
number_dmrs_symbols,
mod_order,
......@@ -236,7 +241,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
nr_pusch_codeword_scrambling(ulsch_ue->g,
available_bits,
ulsch_ue->Nid_cell,
ulsch_ue->rnti,
rnti,
scrambled_output[cwd_index]); // assume one codeword for the moment
......@@ -264,7 +269,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////DMRS Modulation/////////////////////////
///////////
pusch_dmrs = UE->nr_gold_pusch_dmrs[slot];
n_dmrs = (harq_process_ul_ue->nb_rb*nb_dmrs_re_per_rb*number_dmrs_symbols);
n_dmrs = (nb_rb*nb_dmrs_re_per_rb*number_dmrs_symbols);
int16_t mod_dmrs[n_dmrs<<1];
dmrs_type = UE->pusch_config.dmrs_UplinkConfig.pusch_dmrs_type;
///////////
......@@ -274,21 +279,21 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////PTRS parameters' initialization/////////////////////////
///////////
int16_t mod_ptrs[(harq_process_ul_ue->nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation
int16_t mod_ptrs[(nb_rb/2)*(NR_SYMBOLS_PER_SLOT-1)*2]; // assume maximum number of PTRS per pusch allocation
K_ptrs = 0; // just to avoid a warning
if (UE->ptrs_configured == 1) {
K_ptrs = get_K_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->nb_rb);
K_ptrs = get_K_ptrs(ptrs_Uplink_Config, nb_rb);
L_ptrs = get_L_ptrs(ptrs_Uplink_Config, harq_process_ul_ue->mcs);
L_ptrs = get_L_ptrs(ptrs_Uplink_Config, mcs);
beta_ptrs = 1; // temp value until power control is implemented
ulsch_ue->ptrs_symbols = 0;
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
harq_process_ul_ue->number_of_symbols,
number_of_symbols,
start_symbol,
dmrs_type,
L_ptrs,
......@@ -306,7 +311,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
tx_layers = (int16_t **)pusch_ue->txdataF_layers;
nr_ue_layer_mapping(UE->ulsch[thread_id][gNB_id],
harq_process_ul_ue->Nl,
Nl,
available_bits/mod_order,
tx_layers);
......@@ -323,7 +328,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint32_t nb_re_pusch, nb_re_dmrs_per_rb;
uint32_t y_offset = 0;
for (l = start_symbol; l < start_symbol + harq_process_ul_ue->number_of_symbols; l++) {
for (l = start_symbol; l < start_symbol + number_of_symbols; l++) {
if((ul_dmrs_symb_pos >> ((mapping_type)?l-start_symbol:l)) & 0x01)
is_dmrs = 1;
......@@ -335,7 +340,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
else
nb_re_dmrs_per_rb = 0;
nb_re_pusch = harq_process_ul_ue->nb_rb * (NR_NB_SC_PER_RB - nb_re_dmrs_per_rb);
nb_re_pusch = nb_rb * (NR_NB_SC_PER_RB - nb_re_dmrs_per_rb);
nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch);
......@@ -355,13 +360,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
txdataF = UE->common_vars.txdataF;
start_rb = harq_process_ul_ue->first_rb;
start_rb = harq_process_ul_ue->pusch_pdu.rb_start;
start_sc = frame_parms->first_carrier_offset + start_rb*NR_NB_SC_PER_RB;
if (start_sc >= frame_parms->ofdm_symbol_size)
start_sc -= frame_parms->ofdm_symbol_size;
for (ap=0; ap<harq_process_ul_ue->Nl; ap++) {
for (ap=0; ap< Nl; ap++) {
// DMRS params for this ap
get_Wt(Wt, ap, dmrs_type);
......@@ -374,14 +379,14 @@ 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; l<start_symbol+harq_process_ul_ue->number_of_symbols; l++) {
for (l=start_symbol; l<start_symbol+number_of_symbols; l++) {
k = start_sc;
n = 0;
dmrs_idx = 0;
l_ref = (mapping_type) ? l-start_symbol : l;
for (i=0; i<harq_process_ul_ue->nb_rb*NR_NB_SC_PER_RB; i++) {
for (i=0; i< nb_rb*NR_NB_SC_PER_RB; i++) {
sample_offsetF = l*frame_parms->ofdm_symbol_size + k;
......@@ -396,9 +401,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
if (UE->ptrs_configured == 1){
is_ptrs = is_ptrs_symbol(l,
k,
ulsch_ue->rnti,
harq_process_ul_ue->nb_rb,
harq_process_ul_ue->number_of_symbols,
rnti,
nb_rb,
number_of_symbols,
ap,
K_ptrs,
ulsch_ue->ptrs_symbols,
......@@ -432,7 +437,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
} else if (is_ptrs == 1) {
if (k == start_sc){
nr_modulation(pusch_dmrs[l][0], harq_process_ul_ue->nb_rb, DMRS_MOD_ORDER, mod_ptrs);
nr_modulation(pusch_dmrs[l][0], nb_rb, DMRS_MOD_ORDER, mod_ptrs);
}
((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15;
......@@ -480,7 +485,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
int32_t **txdata;
int32_t **txdataF;
int timing_advance;
uint8_t Nl = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->Nl; // cw 0
uint8_t Nl = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->pusch_pdu.nrOfLayers; // cw 0
/////////////////////////IFFT///////////////////////
///////////
......
......@@ -118,15 +118,21 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response)
// pusch config pdu
fapi_nr_ul_config_pusch_pdu_rel15_t *pusch_config_pdu = &ul_config->ul_config_list[i].ulsch_config_pdu.ulsch_pdu_rel15;
uint8_t current_harq_pid = pusch_config_pdu->harq_process_nbr;
ulsch0->harq_processes[current_harq_pid]->nb_rb = pusch_config_pdu->number_rbs;
ulsch0->harq_processes[current_harq_pid]->first_rb = pusch_config_pdu->start_rb;
ulsch0->harq_processes[current_harq_pid]->number_of_symbols = pusch_config_pdu->number_symbols;
ulsch0->harq_processes[current_harq_pid]->start_symbol = pusch_config_pdu->start_symbol;
ulsch0->harq_processes[current_harq_pid]->ul_dmrs_symb_pos = pusch_config_pdu->ul_dmrs_symb_pos;
ulsch0->harq_processes[current_harq_pid]->mcs = pusch_config_pdu->mcs;
ulsch0->harq_processes[current_harq_pid]->DCINdi = pusch_config_pdu->ndi;
ulsch0->harq_processes[current_harq_pid]->rvidx = pusch_config_pdu->rv;
ulsch0->harq_processes[current_harq_pid]->Nl = pusch_config_pdu->n_layers;
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch0->harq_processes[current_harq_pid]->pusch_pdu;
pusch_pdu->rnti = ul_config->ul_config_list[i].ulsch_config_pdu.rnti;
pusch_pdu->rb_size = pusch_config_pdu->number_rbs;
pusch_pdu->rb_start = pusch_config_pdu->start_rb;
pusch_pdu->nr_of_symbols = pusch_config_pdu->number_symbols;
pusch_pdu->start_symbol_index = pusch_config_pdu->start_symbol;
pusch_pdu->ul_dmrs_symb_pos = pusch_config_pdu->ul_dmrs_symb_pos;
pusch_pdu->mcs_index = pusch_config_pdu->mcs;
pusch_pdu->mcs_table = pusch_config_pdu->mcs_table;
pusch_pdu->nrOfLayers = pusch_config_pdu->n_layers;
pusch_pdu->pusch_data.new_data_indicator = pusch_config_pdu->ndi;
pusch_pdu->pusch_data.rv_index = pusch_config_pdu->rv;
pusch_pdu->pusch_data.tb_size = pusch_config_pdu->TBS;
ulsch0->f_pusch = pusch_config_pdu->absolute_delta_PUSCH;
}
if(ul_config->ul_config_list[i].pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUCCH){
......
......@@ -296,7 +296,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
/* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */
if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */
ulsch->harq_processes[harq_pid]->first_tx = 0;
ulsch->harq_processes[harq_pid]->DCINdi = ndi; /* store first value of ndi */