diff --git a/executables/nr-ru.c b/executables/nr-ru.c index cd3911832d..46cfa131ef 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -759,7 +759,11 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { // bit 11 enables the gpio programming // currently we switch beams every 10 slots (should = 1 TDD period in FR2) and we take the beam index of the first symbol of the first slot of this period int beam=0; - if (slot%10==0) beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] & 8; + if (slot%10==0) { + if (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8) { + beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] & 8; + } + } /* if (slot==0 || slot==40) beam=0&8; if (slot==10 || slot==50) beam=1&8; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 4461edb33b..96cc3dd637 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -333,7 +333,25 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, } // symbol loop }// layer loop dlsch->slot_tx[slot]=0; + + // TODO: handle precoding + // this maps the layers onto antenna ports + + // handle beamforming ID + // each antenna port is assigned a beam_index + // since PHY can only handle BF on slot basis we set the whole slot + + // first check if this slot has not already been allocated to another beam + if (gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot]!=255) { + for (int j=0;jsymbols_per_slot;j++) + gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot+j] = rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx; + } + else { + LOG_W(PHY,"beam index for PDSCH allocation already taken\n"); + } }// dlsch loop + + return 0; } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 7e87ba2242..2365d11061 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -160,9 +160,10 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (do_meas==1) start_meas(&gNB->phy_proc_tx); - // clear the transmit data array for the current subframe + // clear the transmit data array and beam index for the current slot for (aa=0; aacarrier_config.num_tx_ant.value; aa++) { memset(&gNB->common_vars.txdataF[aa][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t)); + memset(&gNB->common_vars.beam_id[aa][slot*fp->symbols_per_slot],255,fp->symbols_per_slot*sizeof(uint8_t)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);