diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index e9d9e5fa4ac2a2066c3f79c6a97a792b934e3e8c..37f29ce1eadaf6d508f0a4e27e68c91b32366e0a 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -558,7 +558,7 @@ void init_eNB_afterRU(void) { for (i=0; i<gNB->RU_list[ru_id]->nb_rx; aa++,i++) { LOG_I(PHY,"Attaching RU %d antenna %d to gNB antenna %d\n",gNB->RU_list[ru_id]->idx,i,aa); gNB->prach_vars.rxsigF[aa] = gNB->RU_list[ru_id]->prach_rxsigF[0][i]; - gNB->common_vars.rxdataF[aa] = gNB->RU_list[ru_id]->common.rxdataF[i]; + gNB->common_vars.rxdataF[aa] = (c16_t *)gNB->RU_list[ru_id]->common.rxdataF[i]; } } diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 2e6e85f1d5e489b7e9538a4e46af4c926fd7248c..b02c2e039721b83eea29c17fd2f9ff1ae2df0216 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -632,17 +632,17 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) } } - common_vars->txdataF = (int32_t **)malloc16(Ptx*sizeof(int32_t*)); - common_vars->rxdataF = (int32_t **)malloc16(Prx*sizeof(int32_t*)); + common_vars->txdataF = (c16_t **)malloc16(Ptx*sizeof(c16_t*)); + common_vars->rxdataF = (c16_t **)malloc16(Prx*sizeof(c16_t*)); /* Do NOT allocate per-antenna txdataF/rxdataF: the gNB gets a pointer to the * RU to copy/recover freq-domain memory from there */ common_vars->beam_id = (uint8_t **)malloc16(Ptx*sizeof(uint8_t*)); for (i=0;i<Ptx;i++){ - common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP + common_vars->txdataF[i] = (c16_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(c16_t)); // [hna] samples_per_frame without CP LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n", i,common_vars->txdataF[i], - fp->samples_per_frame_wCP*sizeof(int32_t)); + fp->samples_per_frame_wCP*sizeof(c16_t)); common_vars->beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t)); memset(common_vars->beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame); } diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 20cc35ffb014113c07c159017724add73b8d025d..32e5647b693d2e3e5278d272dba21437a3dbf11f 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -298,19 +298,21 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ue->tx_power_dBm[i]=-127; // init TX buffers - common_vars->txdata = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) ); - common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) ); + common_vars->txdata = (c16_t **)malloc16(fp->nb_antennas_tx*sizeof(c16_t *)); + common_vars->txdataF = (c16_t **)malloc16(fp->nb_antennas_tx*sizeof(c16_t *)); for (i=0; i<fp->nb_antennas_tx; i++) { - common_vars->txdata[i] = (int32_t *)malloc16_clear( fp->samples_per_subframe*10*sizeof(int32_t) ); - common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->samples_per_slot_wCP*sizeof(int32_t) ); + common_vars->txdata[i] = (c16_t *)malloc16_clear((fp->samples_per_frame) * sizeof(c16_t)); + common_vars->txdataF[i] = (c16_t *)malloc16_clear((fp->samples_per_frame) * sizeof(c16_t)); } // init RX buffers - common_vars->rxdata = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + common_vars->rxdata = (c16_t **)malloc16( fp->nb_antennas_rx*sizeof(c16_t *)); + common_vars->rxdataF = (c16_t **)malloc16( fp->nb_antennas_rx*sizeof(c16_t *)); for (i=0; i<fp->nb_antennas_rx; i++) { - common_vars->rxdata[i] = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+fp->ofdm_symbol_size)*sizeof(int32_t) ); + common_vars->rxdata[i] = (c16_t *)malloc16_clear((2 * (fp->samples_per_frame)+fp->ofdm_symbol_size) * sizeof(c16_t)); + common_vars->rxdataF[i] = (c16_t *)malloc16_clear((2 * (fp->samples_per_frame)+fp->ofdm_symbol_size) * sizeof(c16_t)); } // ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK) @@ -426,8 +428,10 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) for (int i = 0; i < fp->nb_antennas_rx; i++) { free_and_zero(common_vars->rxdata[i]); + free_and_zero(common_vars->rxdataF[i]); } free_and_zero(common_vars->rxdata); + free_and_zero(common_vars->rxdataF); for (int slot = 0; slot < fp->slots_per_frame; slot++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index d592aa466e416da54d805dd279de0519158594c0..12517d0a9730590907208670779fab771cd3bbc6 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -137,8 +137,8 @@ int beam_precoding_one_eNB(int32_t **txdataF, } -int nr_beam_precoding(int32_t **txdataF, - int32_t **txdataF_BF, +int nr_beam_precoding(c16_t **txdataF, + c16_t **txdataF_BF, NR_DL_FRAME_PARMS *frame_parms, int32_t ***beam_weights, int slot, @@ -152,7 +152,7 @@ int nr_beam_precoding(int32_t **txdataF, uint8_t p; // clear txdata_BF[aa][re] for each call of ue_spec_beamforming - memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); + memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 0, sizeof(c16_t) *(frame_parms->ofdm_symbol_size)); for (p=0; p<nb_antenna_ports; p++) { //if ((frame_parms->L_ssb >> (63-p)) & 0x01) { diff --git a/openair1/PHY/MODULATION/modulation_common.h b/openair1/PHY/MODULATION/modulation_common.h index 1a19bec78c83ea5b2772f91685d6235a0d5a994d..7c214fa8212e116d8f78d5e8d33fdd0cd5ca7a2b 100644 --- a/openair1/PHY/MODULATION/modulation_common.h +++ b/openair1/PHY/MODULATION/modulation_common.h @@ -49,7 +49,7 @@ void PHY_ofdm_mod(int *input, void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms); -void nr_normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,NR_DL_FRAME_PARMS *frame_parms, uint32_t slot); +void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, NR_DL_FRAME_PARMS *frame_parms, uint32_t slot); void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 435251868e63f1d3967a4d410b7c543f6bc8727d..086ad19afc65b73412445e69d0869278a1cad4dc 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -97,8 +97,8 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, */ void nr_dft(int32_t *z,int32_t *d, uint32_t Msc_PUSCH); -int nr_beam_precoding(int32_t **txdataF, - int32_t **txdataF_BF, +int nr_beam_precoding(c16_t **txdataF, + c16_t **txdataF_BF, NR_DL_FRAME_PARMS *frame_parms, int32_t ***beam_weights, int slot, @@ -109,7 +109,7 @@ int nr_beam_precoding(int32_t **txdataF, ); void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, - int16_t* txdata, + c16_t* txdata, int slot, int first_symbol, int nsymb); @@ -119,7 +119,7 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp); void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp); void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, - int32_t *rxdataF, + c16_t *rxdataF, int slot, int first_symbol, int nsymb); diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 93994b9ab6f867beab8655a5b691812ff2ccaeed..8e17fc0a4a5b355c91983a383ff3822c6826e1f0 100644 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -63,60 +63,60 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA } -void nr_normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,NR_DL_FRAME_PARMS *frame_parms, uint32_t slot) +void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, NR_DL_FRAME_PARMS *frame_parms, uint32_t slot) { // This function works only slot wise. For more generic symbol generation refer nr_feptx0() if (frame_parms->numerology_index != 0) { // case where numerology != 0 if (!(slot%(frame_parms->slots_per_subframe/2))) { - PHY_ofdm_mod(txdataF, - txdata, - frame_parms->ofdm_symbol_size, - 1, - frame_parms->nb_prefix_samples0, - CYCLIC_PREFIX); - PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size, - txdata + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0, - frame_parms->ofdm_symbol_size, - nsymb - 1, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); + PHY_ofdm_mod((int *)txdataF, + (int *)txdata, + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples0, + CYCLIC_PREFIX); + PHY_ofdm_mod((int *)txdataF + frame_parms->ofdm_symbol_size, + (int *)txdata + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0, + frame_parms->ofdm_symbol_size, + nsymb - 1, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); } else { - PHY_ofdm_mod(txdataF, - txdata, - frame_parms->ofdm_symbol_size, - nsymb, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); + PHY_ofdm_mod((int *)txdataF, + (int *)txdata, + frame_parms->ofdm_symbol_size, + nsymb, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); } } else { // numerology = 0, longer CP for every 7th symbol - PHY_ofdm_mod(txdataF, - txdata, - frame_parms->ofdm_symbol_size, - 1, - frame_parms->nb_prefix_samples0, - CYCLIC_PREFIX); - PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size, - txdata + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0, - frame_parms->ofdm_symbol_size, - 6, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); - PHY_ofdm_mod(txdataF + 7*frame_parms->ofdm_symbol_size, - txdata + 6*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples) + - frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0, - frame_parms->ofdm_symbol_size, - 1, - frame_parms->nb_prefix_samples0, - CYCLIC_PREFIX); - PHY_ofdm_mod(txdataF + 8*frame_parms->ofdm_symbol_size, - txdata + 6*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples) + - 2*(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0), - frame_parms->ofdm_symbol_size, - 6, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); + PHY_ofdm_mod((int *)txdataF, + (int *)txdata, + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples0, + CYCLIC_PREFIX); + PHY_ofdm_mod((int *)txdataF + frame_parms->ofdm_symbol_size, + (int *)txdata + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0, + frame_parms->ofdm_symbol_size, + 6, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); + PHY_ofdm_mod((int *)txdataF + 7*frame_parms->ofdm_symbol_size, + (int *)txdata + 6*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples) + + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0, + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples0, + CYCLIC_PREFIX); + PHY_ofdm_mod((int *)txdataF + 8 * frame_parms->ofdm_symbol_size, + (int *)txdata + 6 * (frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples) + + 2*(frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0), + frame_parms->ofdm_symbol_size, + 6, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); } } @@ -334,7 +334,7 @@ void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t ne } void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, - int16_t* txdataF, + c16_t *txdataF, int slot, int first_symbol, int nsymb) @@ -345,7 +345,7 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, for (int sidx = first_symbol; sidx < first_symbol + nsymb; sidx++) { c16_t *this_rotation = symbol_rotation + sidx; - c16_t *this_symbol = ((c16_t*) txdataF) + sidx * fp->ofdm_symbol_size; + c16_t *this_symbol = (txdataF) + sidx * fp->ofdm_symbol_size; LOG_D(PHY,"Rotating symbol %d, slot %d, symbol_subframe_index %d (%d,%d)\n", sidx, diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index d902c2af479d8e92dda6a62592070725bbe0690a..dee825338896e6d76a2b95654711cbe9940f0ecb 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -72,7 +72,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, //#ifdef DEBUG_FEP // if (ue->frame <100) LOG_D(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n", - Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy(&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size))); + Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size))); //#endif for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) { @@ -311,7 +311,7 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms, } void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, - int32_t *rxdataF, + c16_t *rxdataF, int slot, int first_symbol, int nsymb) @@ -326,7 +326,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, LOG_D(PHY,"slot %d, symb_offset %d rotating by %d.%d\n",slot,symb_offset,rot2.r,rot2.i); c16_t *shift_rot = frame_parms->timeshift_symbol_rotation; - c16_t *this_symbol = (c16_t *)&rxdataF[soffset+(frame_parms->ofdm_symbol_size*symbol)]; + c16_t *this_symbol = &rxdataF[soffset+(frame_parms->ofdm_symbol_size*symbol)]; if (frame_parms->N_RB_UL & 1) { rotate_cpx_vector(this_symbol, &rot2, this_symbol, diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index 83444f4ee6c42e59c3285446e522a98ccb2be3db..ddd5d33a86935880b23d24d8d0a6fd902427740d 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -156,12 +156,12 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb int offset = offset0 + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size; nb_symb[rb]++; for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - int32_t *ul_ch = &common_vars->rxdataF[aarx][offset]; + int32_t *ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset]; int32_t signal_energy; if (((frame_parms->N_RB_UL&1) == 1) && (rb==(frame_parms->N_RB_UL>>1))) { signal_energy = signal_energy_nodc(ul_ch, 6); - ul_ch = &common_vars->rxdataF[aarx][offset0]; + ul_ch = (int32_t *)&common_vars->rxdataF[aarx][offset0]; signal_energy += signal_energy_nodc(ul_ch, 6); } else { signal_energy = signal_energy_nodc(ul_ch, 12); diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h index b78a89b12c8085304c26b6f2bee0345b09557269..3b0e87109e6e8c1a71617a7a41052bf0afcc7613 100644 --- a/openair1/PHY/NR_REFSIG/pss_nr.h +++ b/openair1/PHY/NR_REFSIG/pss_nr.h @@ -126,7 +126,7 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue); void free_context_pss_nr(void); int set_pss_nr(int ofdm_symbol_size); int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change); -int pss_search_time_nr(int **rxdata, ///rx data in time domain +int pss_search_time_nr(c16_t **rxdata, ///rx data in time domain NR_DL_FRAME_PARMS *frame_parms, int fo_flag, int is, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 9b6adb870235457533b3e336b394759172ffdd0f..47ef721befdef0fc3a63fe0d6ecf31c555754b50 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -59,7 +59,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, PHY_VARS_gNB *gNB = msgTx->gNB; NR_gNB_DLSCH_t *dlsch; - int32_t** txdataF = gNB->common_vars.txdataF; + c16_t** txdataF = gNB->common_vars.txdataF; int16_t amp = AMP; int xOverhead = 0; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index 64c1d31902791ce0101a123279fba62c8712312c..e34102e0c7316516e9a771d21b1011b7c434170c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -48,7 +48,7 @@ const uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, }; int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, - int32_t *txdataF, + c16_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t *config, @@ -222,7 +222,7 @@ void nr_init_pbch_interleaver(uint8_t *interleaver) { int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, uint8_t *interleaver, - int32_t *txdataF, + c16_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, uint8_t n_hf, diff --git a/openair1/PHY/NR_TRANSPORT/nr_prs.c b/openair1/PHY/NR_TRANSPORT/nr_prs.c index 2167990abfc6c0d96110a54af7bf41577bb9e684..4a93e4d66a49651e862921605a895ef337504032 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prs.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prs.c @@ -10,7 +10,7 @@ extern short nr_qpsk_mod_table[8]; int nr_generate_prs(uint32_t **nr_gold_prs, - int32_t *txdataF, + c16_t *txdataF, int16_t amp, prs_config_t *prs_cfg, nfapi_nr_config_request_scf_t *config, diff --git a/openair1/PHY/NR_TRANSPORT/nr_pss.c b/openair1/PHY/NR_TRANSPORT/nr_pss.c index 8564efe3de0d4fd73a45fe1610b0f07938e2c6be..965ac51c21bfc9942e2d8e39e4f4bc8d1a03b431 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pss.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pss.c @@ -24,7 +24,7 @@ //#define NR_PSS_DEBUG -int nr_generate_pss( int32_t *txdataF, +int nr_generate_pss( c16_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t* config, diff --git a/openair1/PHY/NR_TRANSPORT/nr_sss.c b/openair1/PHY/NR_TRANSPORT/nr_sss.c index 5181f6bac18de7af72c174310e5811459ebb28b8..45835f82069a2533982db1132585e789717fe8a1 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_sss.c +++ b/openair1/PHY/NR_TRANSPORT/nr_sss.c @@ -23,7 +23,7 @@ //#define NR_SSS_DEBUG -int nr_generate_sss( int32_t *txdataF, +int nr_generate_sss( c16_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t* config, diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index 75bf46d243f5fd9076ddcdd5e8ec0b2333691ad4..2f0e46a13fbcad88cd6438d9a31d4b859b857df6 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -40,7 +40,7 @@ int nr_generate_prs(uint32_t **nr_gold_prs, - int32_t *txdataF, + c16_t *txdataF, int16_t amp, prs_config_t *prs_cfg, nfapi_nr_config_request_scf_t *config, @@ -52,7 +52,7 @@ int nr_generate_prs(uint32_t **nr_gold_prs, @param @returns 0 on success */ -int nr_generate_pss(int32_t *txdataF, +int nr_generate_pss(c16_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t *config, @@ -64,7 +64,7 @@ int nr_generate_pss(int32_t *txdataF, @param @returns 0 on success */ -int nr_generate_sss(int32_t *txdataF, +int nr_generate_sss(c16_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t *config, @@ -77,7 +77,7 @@ int nr_generate_sss(int32_t *txdataF, @returns 0 on success */ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, - int32_t *txdataF, + c16_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, nfapi_nr_config_request_scf_t *config, @@ -91,7 +91,7 @@ int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs, */ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, uint8_t *interleaver, - int32_t *txdataF, + c16_t *txdataF, int16_t amp, uint8_t ssb_start_symbol, uint8_t n_hf, @@ -140,7 +140,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, @param nb_rb_pusch The number of RBs allocated (used for Resource Allocation Type 1 in NR) @param frame_parms, Pointer to frame descriptor structure */ -void nr_ulsch_extract_rbs(int32_t **rxdataF, +void nr_ulsch_extract_rbs(c16_t **rxdataF, NR_gNB_PUSCH *pusch_vars, int slot, unsigned char symbol, @@ -359,7 +359,7 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms, void free_nr_prach_entry(PHY_VARS_gNB *gNB, int prach_id); -void nr_decode_pucch1(int32_t **rxdataF, +void nr_decode_pucch1(c16_t **rxdataF, pucch_GroupHopping_t pucch_GroupHopping, uint32_t n_id, // hoppingID higher layer parameter uint64_t *payload, diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 24b4e21e3ae09c6975409c1926922f297c82550c..47d778903e216384468d007ca28434f4568ffc9c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -302,7 +302,7 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH) } -void nr_ulsch_extract_rbs(int32_t **rxdataF, +void nr_ulsch_extract_rbs(c16_t **rxdataF, NR_gNB_PUSCH *pusch_vars, int slot, unsigned char symbol, diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 03ed927c37015df3804ff2df3897282672983cc7..99a343942027363795c8e09fd6406051ed5fefe5 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -183,7 +183,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { - int32_t **rxdataF = gNB->common_vars.rxdataF; + c16_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; int soffset=(slot&3)*frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size; int nr_sequences; @@ -295,7 +295,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, re_offset[l]-=frame_parms->ofdm_symbol_size; for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++) { - tmp_rp = &rxdataF[aa][soffset + l2*frame_parms->ofdm_symbol_size]; + tmp_rp = (int32_t *)&rxdataF[aa][soffset + l2*frame_parms->ofdm_symbol_size]; if(re_offset[l] + nb_re_pucch > frame_parms->ofdm_symbol_size) { int neg_length = frame_parms->ofdm_symbol_size-re_offset[l]; int pos_length = nb_re_pucch-neg_length; @@ -502,7 +502,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, -void nr_decode_pucch1( int32_t **rxdataF, +void nr_decode_pucch1( c16_t **rxdataF, pucch_GroupHopping_t pucch_GroupHopping, uint32_t n_id, // hoppingID higher layer parameter uint64_t *payload, @@ -1148,7 +1148,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { - int32_t **rxdataF = gNB->common_vars.rxdataF; + c16_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; //pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1); @@ -1720,7 +1720,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, // estimate CQI for MAC (from antenna port 0 only) // TODO this computation is wrong -> to be ignored at MAC for now - int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]], + int SNRtimes10 = dB_fixed_times10(signal_energy_nodc((int32_t *)&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]], 12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB); int cqi,bit_left; @@ -1735,7 +1735,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, uci_pdu->pucch_format=0; uci_pdu->ul_cqi=cqi; uci_pdu->timing_advance=0xffff; // currently not valid - uci_pdu->rssi=1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc(&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]],12*pucch_pdu->prb_size))); + uci_pdu->rssi=1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc((int32_t *)&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]],12*pucch_pdu->prb_size))); if (pucch_pdu->bit_len_harq>0) { int harq_bytes=pucch_pdu->bit_len_harq>>3; if ((pucch_pdu->bit_len_harq&7) > 0) harq_bytes++; diff --git a/openair1/PHY/NR_TRANSPORT/srs_rx.c b/openair1/PHY/NR_TRANSPORT/srs_rx.c index 94f1e29993e1a3cacce665bb2025145992336b42..5521619a8f92772cc17d73a89b92797990645447 100644 --- a/openair1/PHY/NR_TRANSPORT/srs_rx.c +++ b/openair1/PHY/NR_TRANSPORT/srs_rx.c @@ -106,7 +106,7 @@ int nr_get_srs_signal(PHY_VARS_gNB *gNB, LOG_I(NR_PHY,"Calling %s function\n", __FUNCTION__); #endif - int32_t **rxdataF = gNB->common_vars.rxdataF; + c16_t **rxdataF = gNB->common_vars.rxdataF; const NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; const uint16_t n_symbols = (slot&3)*frame_parms->symbols_per_slot; // number of symbols until this slot @@ -124,7 +124,7 @@ int nr_get_srs_signal(PHY_VARS_gNB *gNB, for (int ant = 0; ant < frame_parms->nb_antennas_rx; ant++) { memset(srs_received_signal[ant], 0, frame_parms->ofdm_symbol_size*sizeof(int32_t)); - rx_signal = &rxdataF[ant][symbol_offset]; + rx_signal = (int32_t *)&rxdataF[ant][symbol_offset]; for (int p_index = 0; p_index < N_ap; p_index++) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 6b62fe4f84e7ea76343b4d064e906e8baffd2236..9d0982689bc94ad4c68f292a4b4bb4193b5427ca 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -122,7 +122,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int sample_offsetF, N_RE_prime; NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms; - int32_t **txdataF = UE->common_vars.txdataF; + c16_t **txdataF = UE->common_vars.txdataF; int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig uint16_t number_dmrs_symbols = 0; @@ -595,8 +595,8 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, uint8_t n_antenna_ports) { int tx_offset, ap; - int32_t **txdata; - int32_t **txdataF; + c16_t **txdata; + c16_t **txdataF; /////////////////////////IFFT/////////////////////// /////////// @@ -616,7 +616,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, int symb_offset = (slot%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; for(ap = 0; ap < n_antenna_ports; ap++) { for (int s=0;s<NR_NUMBER_OF_SYMBOLS_PER_SLOT;s++){ - c16_t *this_symbol = (c16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size * s]; + c16_t *this_symbol = &txdataF[ap][frame_parms->ofdm_symbol_size * s]; c16_t rot=frame_parms->symbol_rotation[1][s + symb_offset]; LOG_D(PHY,"rotating txdataF symbol %d (%d) => (%d.%d)\n", s, @@ -643,8 +643,8 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, for (ap = 0; ap < n_antenna_ports; ap++) { if (frame_parms->Ncp == 1) { // extended cyclic prefix - PHY_ofdm_mod(txdataF[ap], - &txdata[ap][tx_offset], + PHY_ofdm_mod((int *)txdataF[ap], + (int *)&txdata[ap][tx_offset], frame_parms->ofdm_symbol_size, 12, frame_parms->nb_prefix_samples, diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 9031ad3f12b5b6ae54af29bce3b1db4a51d6423d..fbb4a8a625caf5c5086df0a1c9043a584e2408c4 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -512,7 +512,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change) { NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); int synchro_position; - int **rxdata = NULL; + c16_t **rxdata = NULL; int fo_flag = PHY_vars_UE->UE_fo_compensation; // flag to enable freq offset estimation and compensation VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PSS_SYNCHRO_NR, VCD_FUNCTION_IN); @@ -524,10 +524,10 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change) if (rate_change != 1) { - rxdata = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*)); + rxdata = (c16_t**)malloc16(frame_parms->nb_antennas_rx * sizeof(c16_t*)); - for (int aa=0; aa < frame_parms->nb_antennas_rx; aa++) { - rxdata[aa] = (int32_t*) malloc16_clear( (frame_parms->samples_per_frame+8192)*sizeof(int32_t)); + for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { + rxdata[aa] = (c16_t*)malloc16_clear((frame_parms->samples_per_frame + 8192) * sizeof(c16_t)); } #ifdef SYNCHRO_DECIMAT @@ -651,7 +651,7 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change) * *********************************************************************/ -int pss_search_time_nr(int **rxdata, ///rx data in time domain +int pss_search_time_nr(c16_t **rxdata, ///rx data in time domain NR_DL_FRAME_PARMS *frame_parms, int fo_flag, int is, @@ -701,7 +701,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain for (ar=0; ar<frame_parms->nb_antennas_rx; ar++) { /* perform correlation of rx data and pss sequence ie it is a dot product */ - const c32_t result = dot_product((c16_t *)primary_synchro_time_nr[pss_index], (c16_t *)&(rxdata[ar][n + is * frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size, shift); + const c32_t result = dot_product((c16_t *)primary_synchro_time_nr[pss_index], &(rxdata[ar][n + is * frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size, shift); const c64_t r64 = {.r = result.r, .i = result.i}; pss_corr_ue += squaredMod(r64); //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */ @@ -731,11 +731,11 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain // Shoujun Huang, Yongtao Su, Ying He and Shan Tang, "Joint time and frequency offset estimation in LTE downlink," 7th International Conference on Communications and Networking in China, 2012. // Computing cross-correlation at peak on half the symbol size for first half of data - c32_t r1 = dot_product((c16_t *)primary_synchro_time_nr[pss_source], (c16_t *)&(rxdata[0][peak_position + is * frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size >> 1, shift); + c32_t r1 = dot_product((c16_t *)primary_synchro_time_nr[pss_source], &(rxdata[0][peak_position + is * frame_parms->samples_per_frame]), frame_parms->ofdm_symbol_size >> 1, shift); // Computing cross-correlation at peak on half the symbol size for data shifted by half symbol size // as it is real and complex it is necessary to shift by a value equal to symbol size to obtain such shift c32_t r2 = dot_product((c16_t *)primary_synchro_time_nr[pss_source] + (frame_parms->ofdm_symbol_size >> 1), - (c16_t *)&(rxdata[0][peak_position + is * frame_parms->samples_per_frame]) + (frame_parms->ofdm_symbol_size >> 1), + &(rxdata[0][peak_position + is * frame_parms->samples_per_frame]) + (frame_parms->ofdm_symbol_size >> 1), frame_parms->ofdm_symbol_size >> 1, shift); cd_t r1d = {r1.r, r1.i}, r2d = {r2.r, r2.i}; diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c index 10d7b7d98d3444b894ab8ecb47e02908e95cd91e..b443c4dfbf6fc99fdc0f5ff813932faaf8344c50 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c @@ -51,7 +51,7 @@ //#define ONE_OVER_SQRT2 23170 // 32767/sqrt(2) = 23170 (ONE_OVER_SQRT2) void nr_generate_pucch0(PHY_VARS_NR_UE *ue, - int32_t **txdataF, + c16_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, int16_t amp, int nr_slot_tx, @@ -169,7 +169,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, } void nr_generate_pucch1(PHY_VARS_NR_UE *ue, - int32_t **txdataF, + c16_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, int16_t amp, int nr_slot_tx, @@ -955,7 +955,7 @@ static void nr_uci_encoding(uint64_t payload, } //#if 0 void nr_generate_pucch2(PHY_VARS_NR_UE *ue, - int32_t **txdataF, + c16_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, int16_t amp, int nr_slot_tx, @@ -1125,7 +1125,7 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue, } //#if 0 void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, - int32_t **txdataF, + c16_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, int16_t amp, int nr_slot_tx, diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h index 078a95605f59f36bb561e9fbf564122a0b1d0e5b..7eb836505ee22ad22ff8606a78999ef9e1e2bf3c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h +++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h @@ -46,28 +46,28 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue, - int32_t **txdataF, + c16_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, int16_t amp, int nr_slot_tx, fapi_nr_ul_config_pucch_pdu *pucch_pdu); void nr_generate_pucch1(PHY_VARS_NR_UE *ue, - int32_t **txdataF, + c16_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, int16_t amp, int nr_slot_tx, fapi_nr_ul_config_pucch_pdu *pucch_pdu); void nr_generate_pucch2(PHY_VARS_NR_UE *ue, - int32_t **txdataF, + c16_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, int16_t amp, int nr_slot_tx, fapi_nr_ul_config_pucch_pdu *pucch_pdu); void nr_generate_pucch3_4(PHY_VARS_NR_UE *ue, - int32_t **txdataF, + c16_t **txdataF, NR_DL_FRAME_PARMS *frame_parms, int16_t amp, int nr_slot_tx, diff --git a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c index 5e60ae29407502b266dfcb8f7aff69f588e07642..7b602c2e81ae7208c7425fed852102c45d16fa57 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c @@ -471,7 +471,7 @@ int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc) NR_DL_FRAME_PARMS *frame_parms = &(ue->frame_parms); uint16_t symbol_offset = (frame_parms->symbols_per_slot - 1 - srs_config_pdu->time_start_position)*frame_parms->ofdm_symbol_size; - if (generate_srs_nr(srs_config_pdu, frame_parms, ue->common_vars.txdataF, symbol_offset, ue->nr_srs_info, + if (generate_srs_nr(srs_config_pdu, frame_parms, (int32_t **)ue->common_vars.txdataF, symbol_offset, ue->nr_srs_info, AMP, proc->frame_tx, proc->nr_slot_tx) == 0) { return 0; } else { diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 9c338b5d3f09b9821f708a17b059d753273f701e..2badbd0868ed252bc0824df2008559f371fdfede 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -265,13 +265,13 @@ typedef struct { /// \brief Pointers (dynamic) to the received data in the frequency domain. /// - first index: rx antenna [0..nb_antennas_rx[ /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ - int32_t **rxdataF; + c16_t **rxdataF; /// \brief holds the transmit data in the frequency domain. /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //? /// - first index: eNB id [0..2] (hard coded) /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports. /// - third index: sample [0..samples_per_frame_woCP] - int32_t **txdataF; + c16_t **txdataF; /// \brief Anaglogue beam ID for each OFDM symbol (used when beamforming not done in RU) /// - first index: antenna port /// - second index: beam_id [0.. symbols_per_frame[ diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index e8259b5dae06e03e05375cd4254da454b102eb03..79e75ee3250435bccbc64d625d8531cc6c251ad7 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -217,18 +217,24 @@ typedef struct { /// For IFFT_FPGA this points to the same memory as PHY_vars->tx_vars[a].TX_DMA_BUFFER. /// - first index: tx antenna [0..nb_antennas_tx[ /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES[ - int32_t **txdata; + c16_t **txdata; /// \brief Holds the transmit data in the frequency domain. /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. /// - first index: tx antenna [0..nb_antennas_tx[ /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX[ - int32_t **txdataF; + c16_t **txdataF; /// \brief Holds the received data in time domain. /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. /// - first index: rx antenna [0..nb_antennas_rx[ /// - second index: sample [0..2*FRAME_LENGTH_COMPLEX_SAMPLES+2048[ - int32_t **rxdata; + c16_t **rxdata; + + /// \brief Holds the received data in time domain. + /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. + /// - first index: rx antenna [0..nb_antennas_rx[ + /// - second index: sample [0..2*FRAME_LENGTH_COMPLEX_SAMPLES+2048[ + c16_t **rxdataF; /// holds output of the sync correlator int32_t *sync_corr; diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 551bc60d950b2e272b2ed085b0d8d36f0e408c59..08ed56db8d8ac9169be1e17ccc2e8c1d0ac94fbd 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -212,8 +212,8 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { bw = ru->beam_weights[0]; for (l=0;l<fp->symbols_per_slot;l++) { for (aa=0;aa<ru->nb_tx;aa++) { - nr_beam_precoding(ru->common.txdataF, - ru->common.txdataF_BF, + nr_beam_precoding((c16_t **)ru->common.txdataF, + (c16_t **)ru->common.txdataF_BF, fp, bw, tti_tx, @@ -307,8 +307,8 @@ void nr_feptx(void *arg) { AssertFatal(1==0,"This needs to be fixed, do not use beamforming.\n"); int32_t ***bw = ru->beam_weights[0]; for(int i=0; i<fp->symbols_per_slot; ++i){ - nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF, - ru->common.txdataF_BF, + nr_beam_precoding((c16_t **)ru->gNB_list[0]->common_vars.txdataF, + (c16_t **)ru->common.txdataF_BF, fp, bw, slot, diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index f1a4c518a2f83dc9f7f11b592cad6f3f84ca3cba..fc36ad3f79edb6fed94c439542645c46afda0ac8 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -55,7 +55,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ NR_DL_FRAME_PARMS *fp=&gNB->frame_parms; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; - int **txdataF = gNB->common_vars.txdataF; + c16_t **txdataF = gNB->common_vars.txdataF; uint8_t ssb_index, n_hf; uint16_t ssb_start_symbol; int txdataF_offset = slot*fp->samples_per_slot_wCP; @@ -170,7 +170,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,1); nr_generate_dci_top(msgTx, slot, - &gNB->common_vars.txdataF[0][txdataF_offset], + (int32_t *)&gNB->common_vars.txdataF[0][txdataF_offset], AMP, fp); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,0); @@ -188,7 +188,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, if (csirs->active == 1) { LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot); nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csi_params = &csirs->csirs_pdu.csi_rs_pdu_rel15; - nr_generate_csi_rs(&gNB->frame_parms, gNB->common_vars.txdataF, AMP, gNB->nr_csi_info, csi_params, slot, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + nr_generate_csi_rs(&gNB->frame_parms, (int32_t **)gNB->common_vars.txdataF, AMP, gNB->nr_csi_info, csi_params, slot, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); csirs->active = 0; } } @@ -197,7 +197,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, //apply the OFDM symbol rotation here for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) { - apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[aa][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14); + apply_nr_rotation(fp, &gNB->common_vars.txdataF[aa][txdataF_offset], slot, 0, fp->Ncp == EXTENDED ? 12 : 14); T(T_GNB_PHY_DL_OUTPUT_SIGNAL, T_INT(0), T_INT(frame), T_INT(slot), @@ -707,7 +707,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { const int soffset = (slot_rx&3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size; int offset = 10*gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset; - int power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset+offset+(47*12)],12*18); + int power_rxF = signal_energy_nodc((int32_t *)&gNB->common_vars.rxdataF[0][soffset+offset+(47*12)],12*18); LOG_D(PHY,"frame %d, slot %d: UL signal energy %d\n",frame_rx,slot_rx,power_rxF); start_meas(&gNB->phy_proc_rx); @@ -736,7 +736,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1; offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12); - power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset+offset],12); + power_rxF = signal_energy_nodc((int32_t *)&gNB->common_vars.rxdataF[0][soffset+offset],12); LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF); nr_decode_pucch0(gNB, diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 077490c3a955be817f8b820b9c92a30ea448583d..cea43b673a971b696e18a1ccdb1a6ce62b6cd3a2 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -250,7 +250,7 @@ int main(int argc, char **argv) //float psnr; float eff_tp_check = 0.7; uint32_t TBS = 0; - int **txdata; + c16_t **txdata; double **s_re,**s_im,**r_re,**r_im; //double iqim = 0.0; //unsigned char pbch_pdu[6]; @@ -1031,8 +1031,8 @@ int main(int argc, char **argv) for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) { if (cyclic_prefix_type == 1) { - PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][txdataF_offset], - &txdata[aa][tx_offset], + PHY_ofdm_mod((int *)&gNB->common_vars.txdataF[aa][txdataF_offset], + (int *)&txdata[aa][tx_offset], frame_parms->ofdm_symbol_size, 12, frame_parms->nb_prefix_samples, @@ -1062,7 +1062,7 @@ int main(int argc, char **argv) int txlev_sum = 0; int l_ofdm = 6; for (aa=0; aa<n_tx; aa++) { - txlev[aa] = signal_energy(&txdata[aa][tx_offset+l_ofdm*frame_parms->ofdm_symbol_size + (l_ofdm-1)*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], + txlev[aa] = signal_energy((int32_t *)&txdata[aa][tx_offset+l_ofdm*frame_parms->ofdm_symbol_size + (l_ofdm-1)*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); txlev_sum += txlev[aa]; if (n_trials==1) printf("txlev[%d] = %d (%f dB) txlev_sum %d\n",aa,txlev[aa],10*log10((double)txlev[aa]),txlev_sum); diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index f127c74818a83b9325f2019139ee6a2be9b60fef..ee67e8d52ed633630695cf755100704c4f5015b9 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -636,12 +636,12 @@ int main(int argc, char **argv) for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) { if (cyclic_prefix_type == 1) { apply_nr_rotation(frame_parms, - (int16_t*)gNB->common_vars.txdataF[aa], + gNB->common_vars.txdataF[aa], slot, 0, 12); - PHY_ofdm_mod(gNB->common_vars.txdataF[aa], + PHY_ofdm_mod((int *)gNB->common_vars.txdataF[aa], &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], frame_parms->ofdm_symbol_size, 12, @@ -649,7 +649,7 @@ int main(int argc, char **argv) CYCLIC_PREFIX); } else { apply_nr_rotation(frame_parms, - (int16_t*)gNB->common_vars.txdataF[aa], + gNB->common_vars.txdataF[aa], slot, 0, 14); @@ -659,14 +659,14 @@ int main(int argc, char **argv) 14, frame_parms);*/ - PHY_ofdm_mod(gNB->common_vars.txdataF[aa], + PHY_ofdm_mod((int *)gNB->common_vars.txdataF[aa], (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], frame_parms->ofdm_symbol_size, 1, frame_parms->nb_prefix_samples0, CYCLIC_PREFIX); - PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size], + PHY_ofdm_mod((int *)&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size], (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 13, diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index cd346ded3abf34e775810e693aa8ec42a106fcfd..d72bf2ed4f8eb0dc38b9235f3ed5a06d00dc1a3f 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -129,7 +129,8 @@ int main(int argc, char **argv){ double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0; double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs=-1, bw; - int i, l, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; + int i, l, aa, aarx, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; + c16_t **txdata; int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0; uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0; uint8_t config_index = 98, prach_sequence_length = 1, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol; @@ -759,8 +760,8 @@ int main(int argc, char **argv){ for (l = 0; l < frame_parms->symbols_per_slot; l++) { for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { nr_slot_fep_ul(frame_parms, - ru->common.rxdata[aa], - ru->common.rxdataF[aa], + (int32_t *)ru->common.rxdata[aa], + (int32_t *)ru->common.rxdataF[aa], l, slot, ru->N_TA_offset); diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 29a8b7cbe6be1233628f2e13fe6a6ecbbee0b935..68ba96ab88365b60d62c3910ba5866ddca4826ea 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -415,7 +415,7 @@ int main(int argc, char **argv) /* RU handles rxdataF, and gNB just has a pointer. Here, we don't have an RU, * so we need to allocate that memory as well. */ for (i = 0; i < n_rx; i++) - gNB->common_vars.rxdataF[i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t)); + gNB->common_vars.rxdataF[i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP*sizeof(c16_t)); double fs,txbw,rxbw; uint32_t samples; @@ -523,7 +523,7 @@ int main(int argc, char **argv) ack_nack_errors=0; sr_errors=0; n_errors = 0; - int **txdataF = gNB->common_vars.txdataF; + c16_t **txdataF = gNB->common_vars.txdataF; for (trial=0; trial<n_trials; trial++) { for (int aatx=0;aatx<1;aatx++) bzero(txdataF[aatx],frame_parms->ofdm_symbol_size*sizeof(int)); @@ -538,7 +538,7 @@ int main(int argc, char **argv) // SNR Computation // standard says: SNR = S / N, where S is the total signal energy, N is the noise energy in the transmission bandwidth (i.e. N_RB_DL resource blocks) // txlev = S. - int txlev = signal_energy(&txdataF[0][startingSymbolIndex*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size); + int txlev = signal_energy((int32_t *)&txdataF[0][startingSymbolIndex*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size); // sigma2 is variance per dimension, so N/(N_RB*12) // so, sigma2 = N/(N_RB_DL*12) => (S/SNR)/(N_RB*12) @@ -548,7 +548,7 @@ int main(int argc, char **argv) if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB); - c16_t **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF; + c16_t **rxdataF = gNB->common_vars.rxdataF; for (int symb=0; symb<gNB->frame_parms.symbols_per_slot;symb++) { if (symb<startingSymbolIndex || symb >= startingSymbolIndex+nrofSymbols) { int i0 = symb*gNB->frame_parms.ofdm_symbol_size; @@ -669,7 +669,7 @@ int main(int argc, char **argv) free(uci_pdu.harq); } else if (format==1) { - nr_decode_pucch1((int32_t **)rxdataF,PUCCH_GroupHopping,hopping_id, + nr_decode_pucch1((c16_t **)rxdataF,PUCCH_GroupHopping,hopping_id, &(payload_received),frame_parms,amp,nr_slot_tx, m0,nrofSymbols,startingSymbolIndex,startingPRB, startingPRB_intraSlotHopping,timeDomainOCC,nr_bit); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index cdeba14486e8af015b1820c8b465c6275049eb97..4ec8fc3ccacef03011071d6e5885f998a63bff38 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1272,8 +1272,8 @@ int main(int argc, char **argv) for(uint8_t symbol = 0; symbol < (gNB->frame_parms.Ncp == EXTENDED ? 12 : 14); symbol++) { for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) nr_slot_fep_ul(&gNB->frame_parms, - (int32_t*) rxdata[aa], - gNB->common_vars.rxdataF[aa], + (int32_t *)rxdata[aa], + (int32_t *)gNB->common_vars.rxdataF[aa], symbol, slot, 0); diff --git a/openair1/SIMULATION/TOOLS/multipath_channel.c b/openair1/SIMULATION/TOOLS/multipath_channel.c index 433021970684ad678c6b0248577346eab2e4f024..22cd5ce01c1643d6a35385784434e9748b84d6ef 100644 --- a/openair1/SIMULATION/TOOLS/multipath_channel.c +++ b/openair1/SIMULATION/TOOLS/multipath_channel.c @@ -220,15 +220,18 @@ void __attribute__ ((no_sanitize_address)) multipath_channel(channel_desc_t *des rx_tmp.r += (tx.r * chan[l].r) - (tx.i * chan[l].i); rx_tmp.i += (tx.i * chan[l].r) + (tx.r * chan[l].i); } + #if 0 if (i==0 && log_channel == 1) { printf("channel[%d][%d][%d] = %f dB \t(%e, %e)\n", ii, j, l, 10 * log10(pow(chan[l].r, 2.0) + pow(chan[l].i, 2.0)), chan[l].r, chan[l].i); } + #endif } //l } // j - +#if 0 if (desc->max_Doppler != 0.0) rx_tmp = cdMul(rx_tmp, cexp_doppler[i]); +#endif #ifdef DOPPLER_DEBUG printf("[k %2i] cexp_doppler = (%7.4f, %7.4f), abs(cexp_doppler) = %.4f\n",