Commit 358815f6 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Passing PDSCH beam from MAC->PHY->RU

parent 6a5f782d
...@@ -62,8 +62,9 @@ uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx); ...@@ -62,8 +62,9 @@ uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx);
uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx); uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx);
int get_subband_size(int NPRB,int size); int get_subband_size(int NPRB,int size);
void SLIV2SL(int SLIV,int *S,int *L); void SLIV2SL(int SLIV,int *S,int *L);
int get_tdd_period_in_slots(int tdd_period, int slots_per_frame);
#define NR_FRAME_DURATION 10000
#define CEILIDIV(a,b) ((a+b-1)/b) #define CEILIDIV(a,b) ((a+b-1)/b)
#define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1))
......
...@@ -757,20 +757,16 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { ...@@ -757,20 +757,16 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
// bit 11 enables the gpio programming // 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 // 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; int beam=0;
if (slot%10==0) { if ((ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8) || (ru->common.beam_id[0][slot*fp->symbols_per_slot] == 255)) {
if (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8) {
beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8; beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8;
} }
else {
LOG_E(HW,"Beam index cannot be greater than 7. Attemping beam index is %d\n",ru->common.beam_id[0][slot*fp->symbols_per_slot]);
} }
/*
if (slot==0 || slot==40) beam=0|8;
if (slot==10 || slot==50) beam=1|8;
if (slot==20 || slot==60) beam=2|8;
if (slot==30 || slot==70) beam=3|8;
*/
flags |= beam<<8; flags |= beam<<8;
LOG_D(HW,"slot %d, beam %d\n",slot,ru->common.beam_id[0][slot*fp->symbols_per_slot]); LOG_D(HW,"slot %d, beam %d\n",slot,beam);
} }
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "PHY/NR_REFSIG/dmrs_nr.h" #include "PHY/NR_REFSIG/dmrs_nr.h"
#include "PHY/NR_REFSIG/ptrs_nr.h" #include "PHY/NR_REFSIG/ptrs_nr.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/nr/nr_common.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
//#define DEBUG_DLSCH //#define DEBUG_DLSCH
...@@ -513,9 +514,15 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -513,9 +514,15 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
// since PHY can only handle BF on slot basis we set the whole slot // 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 // 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) { if ((gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot] == 255) ||
for (int j=0;j<frame_parms->symbols_per_slot;j++) (gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot] ==
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; rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx)) {
printf("pdsch beam %d\n",rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx);
memset(&gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot],
rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx,
frame_parms->symbols_per_slot*get_tdd_period_in_slots(
gNB->gNB_config.tdd_table.tdd_period.value,frame_parms->slots_per_frame)*sizeof(uint8_t));
} }
else { else {
LOG_W(PHY,"beam index for PDSCH allocation already taken\n"); LOG_W(PHY,"beam index for PDSCH allocation already taken\n");
......
...@@ -306,9 +306,9 @@ static void *nr_feptx_thread(void *param) { ...@@ -306,9 +306,9 @@ static void *nr_feptx_thread(void *param) {
start_meas(&ru->precoding_stats); start_meas(&ru->precoding_stats);
for(i=0; i<ru->nb_log_antennas; ++i) { for(i=0; i<ru->nb_log_antennas; ++i) {
memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot+l], memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot],
(void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot+l], (void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot],
(fp->symbols_per_slot>>1)*sizeof(uint8_t)); (fp->symbols_per_slot)*sizeof(uint8_t));
} }
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "T.h" #include "T.h"
#include "executables/nr-softmodem.h" #include "executables/nr-softmodem.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "common/utils/nr/nr_common.h"
#include "assertions.h" #include "assertions.h"
#include "msc.h" #include "msc.h"
...@@ -110,8 +111,11 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ ...@@ -110,8 +111,11 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_
// Beam_id is currently used only for FR2 // Beam_id is currently used only for FR2
if (fp->freq_range==nr_FR2){ if (fp->freq_range==nr_FR2){
LOG_D(PHY,"slot %d, ssb_index %d, beam %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value); LOG_D(PHY,"slot %d, ssb_index %d, beam %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value);
for (int j=0;j<fp->symbols_per_slot;j++) // PHY can switch beams only once per TDD
gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value; memset(&gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot],
cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value,
fp->symbols_per_slot*get_tdd_period_in_slots(
gNB->gNB_config.tdd_table.tdd_period.value,fp->slots_per_frame)*sizeof(uint8_t));
} }
nr_generate_pbch(&gNB->pbch, nr_generate_pbch(&gNB->pbch,
...@@ -143,7 +147,12 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -143,7 +147,12 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
// clear the transmit data array and beam index for the current slot // clear the transmit data array and beam index for the current slot
for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) { for (aa=0; aa<cfg->carrier_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.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)); }
//clear the beam index array every frame
if (slot == 0) {
for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) {
memset(&gNB->common_vars.beam_id[aa][0],255,fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
}
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
......
...@@ -3668,3 +3668,7 @@ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, ...@@ -3668,3 +3668,7 @@ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config,
return valid; return valid;
} }
int get_tdd_period_in_slots(int tdd_period, int slots_per_frame) {
int tdd_periods_per_frame = NR_FRAME_DURATION / tdd_period_to_num[tdd_period];
return (slots_per_frame/tdd_periods_per_frame);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment