Commit 58f4f155 authored by Khodr Saaifan's avatar Khodr Saaifan Committed by Thomas Schlichter

Enable beamforming for 2 tx antenna ports and fix corresponding segmentation error

parent e72d0483
...@@ -125,7 +125,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -125,7 +125,7 @@ int nr_phy_init_RU(RU_t *ru) {
int beam_count = 0; int beam_count = 0;
if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1 if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1
for (p=0;p<ru->nb_log_antennas;p++) { for (p=0;p<ru->nb_log_antennas;p++) {
if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0 //if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
beam_count++; beam_count++;
} }
AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
...@@ -133,7 +133,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -133,7 +133,7 @@ int nr_phy_init_RU(RU_t *ru) {
int l_ind = 0; int l_ind = 0;
for (i=0; i<RC.nb_nr_L1_inst; i++) { for (i=0; i<RC.nb_nr_L1_inst; i++) {
for (p=0;p<ru->nb_log_antennas;p++) { for (p=0;p<ru->nb_log_antennas;p++) {
if ((fp->L_ssb >> (63-p)) & 0x01) { //if ((fp->L_ssb >> (63-p)) & 0x01) {
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
for (j=0; j<ru->nb_tx; j++) { for (j=0; j<ru->nb_tx; j++) {
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
...@@ -142,8 +142,8 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -142,8 +142,8 @@ int nr_phy_init_RU(RU_t *ru) {
//printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j);
l_ind++; l_ind++;
} // for j } // for j
//}
} // for p } // for p
}
} //for i } //for i
} }
} // !=IF5 } // !=IF5
......
...@@ -145,7 +145,8 @@ int nr_beam_precoding(int32_t **txdataF, ...@@ -145,7 +145,8 @@ int nr_beam_precoding(int32_t **txdataF,
int slot, int slot,
int symbol, int symbol,
int aa, int aa,
int nb_antenna_ports) int nb_antenna_ports,
int offset)
{ {
...@@ -155,14 +156,14 @@ int nr_beam_precoding(int32_t **txdataF, ...@@ -155,14 +156,14 @@ int nr_beam_precoding(int32_t **txdataF,
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(int32_t)*(frame_parms->ofdm_symbol_size));
for (p=0; p<nb_antenna_ports; p++) { for (p=0; p<nb_antenna_ports; p++) {
if ((frame_parms->L_ssb >> (63-p)) & 0x01) { //if ((frame_parms->L_ssb >> (63-p)) & 0x01) {
multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size], multadd_cpx_vector((int16_t*)&txdataF[p][(symbol*frame_parms->ofdm_symbol_size)+offset],
(int16_t*)beam_weights[p][aa], (int16_t*)beam_weights[p][aa],
(int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],
0, 0,
frame_parms->ofdm_symbol_size, frame_parms->ofdm_symbol_size,
15); 15);
} //}
} }
return 0; return 0;
} }
...@@ -106,7 +106,8 @@ int nr_beam_precoding(int32_t **txdataF, ...@@ -106,7 +106,8 @@ int nr_beam_precoding(int32_t **txdataF,
int slot, int slot,
int symbol, int symbol,
int aa, int aa,
int nb_antenna_ports int nb_antenna_ports,
int offset
); );
void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
......
...@@ -285,7 +285,6 @@ static void *nr_feptx_thread(void *param) { ...@@ -285,7 +285,6 @@ static void *nr_feptx_thread(void *param) {
NR_DL_FRAME_PARMS *fp; NR_DL_FRAME_PARMS *fp;
int ofdm_mask_full; int ofdm_mask_full;
int txdataF_offset; int txdataF_offset;
int32_t *txdataF;
while (!oai_exit) { while (!oai_exit) {
ret = 0; ret = 0;
if (wait_on_condition(&feptx->mutex_feptx,&feptx->cond_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; if (wait_on_condition(&feptx->mutex_feptx,&feptx->cond_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break;
...@@ -314,16 +313,16 @@ static void *nr_feptx_thread(void *param) { ...@@ -314,16 +313,16 @@ static void *nr_feptx_thread(void *param) {
} }
else { else {
bw = ru->beam_weights[0]; bw = ru->beam_weights[0];
txdataF = &ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset];
for(i=0; i<fp->symbols_per_slot>>1; ++i){ for(i=0; i<fp->symbols_per_slot>>1; ++i){
nr_beam_precoding(&txdataF, nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF,
ru->common.txdataF_BF, ru->common.txdataF_BF,
fp, fp,
bw, bw,
slot, slot,
l+i, l+i,
aa, aa,
ru->nb_log_antennas); ru->nb_log_antennas,
txdataF_offset);//here
} }
} }
stop_meas(&ru->precoding_stats); stop_meas(&ru->precoding_stats);
...@@ -362,7 +361,8 @@ static void *nr_feptx_thread(void *param) { ...@@ -362,7 +361,8 @@ static void *nr_feptx_thread(void *param) {
slot, slot,
l, l,
aa, aa,
nb_antenna_ports); ru->nb_log_antennas,
0);
} }
stop_meas(&ru->precoding_stats); stop_meas(&ru->precoding_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 0);
...@@ -485,7 +485,8 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { ...@@ -485,7 +485,8 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) {
tti_tx, tti_tx,
l, l,
aa, aa,
ru->nb_log_antennas); ru->nb_log_antennas,
0);
}// for (aa=0;aa<ru->nb_tx;aa++) }// for (aa=0;aa<ru->nb_tx;aa++)
}// for (l=0;l<fp->symbols_per_slot;l++) }// for (l=0;l<fp->symbols_per_slot;l++)
}// if (ru->nb_tx == 1) }// if (ru->nb_tx == 1)
......
...@@ -249,11 +249,11 @@ RUs = ( ...@@ -249,11 +249,11 @@ RUs = (
max_rxgain = 75; max_rxgain = 75;
eNB_instances = [0]; eNB_instances = [0];
##beamforming 1x2 matrix: 1 layer x 2 antennas ##beamforming 1x2 matrix: 1 layer x 2 antennas
bf_weights = [0x00007fff, 0x00007fff]; #bf_weights = [0x00007fff, 0x00007fff];
##beamforming 1x4 matrix: 1 layer x 4 antennas ##beamforming 1x4 matrix: 1 layer x 4 antennas
#bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000];
## beamforming 2x2 matrix: ## beamforming 2x2 matrix:
# bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff];
## beamforming 4x4 matrix: ## beamforming 4x4 matrix:
#bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff];
......
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