Commit 972a0892 authored by francescomani's avatar francescomani

improvements in RU beamforming handling procedures

parent 4891e809
...@@ -61,6 +61,7 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1}; ...@@ -61,6 +61,7 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1};
#include "ENB_APP/enb_paramdef.h" #include "ENB_APP/enb_paramdef.h"
#include "GNB_APP/gnb_paramdef.h" #include "GNB_APP/gnb_paramdef.h"
#include "GNB_APP/MACRLC_nr_paramdef.h"
#include "common/config/config_userapi.h" #include "common/config/config_userapi.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h" #include "SIMULATION/ETH_TRANSPORT/proto.h"
...@@ -746,12 +747,12 @@ static radio_tx_gpio_flag_t get_gpio_flags(RU_t *ru, int slot) ...@@ -746,12 +747,12 @@ static radio_tx_gpio_flag_t get_gpio_flags(RU_t *ru, int slot)
return flags_gpio; return flags_gpio;
} }
void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { void tx_rf(RU_t *ru, int frame,int slot, uint64_t timestamp)
{
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
nfapi_nr_config_request_scf_t *cfg = &ru->config; nfapi_nr_config_request_scf_t *cfg = &ru->config;
void *txp[ru->nb_tx]; void *txp[ru->nb_tx];
unsigned int txs;
int i; int i;
T(T_ENB_PHY_OUTPUT_SIGNAL, T(T_ENB_PHY_OUTPUT_SIGNAL,
T_INT(0), T_INT(0),
...@@ -807,7 +808,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { ...@@ -807,7 +808,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
flags_burst = proc->first_tx == 1 ? TX_BURST_START : TX_BURST_MIDDLE; flags_burst = proc->first_tx == 1 ? TX_BURST_START : TX_BURST_MIDDLE;
} }
if (fp->freq_range == FR2) if (ru->openair0_cfg.gpio_controller != RU_GPIO_CONTROL_NONE)
flags_gpio = get_gpio_flags(ru, slot); flags_gpio = get_gpio_flags(ru, slot);
const int flags = flags_burst | (flags_gpio << 4); const int flags = flags_burst | (flags_gpio << 4);
...@@ -825,8 +826,11 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { ...@@ -825,8 +826,11 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp + ru->ts_offset) & 0xffffffff); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp + ru->ts_offset) & 0xffffffff);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1);
// prepare tx buffer pointers // prepare tx buffer pointers
txs = ru->rfdevice uint32_t txs = ru->rfdevice.trx_write_func(&ru->rfdevice,
.trx_write_func(&ru->rfdevice, timestamp + ru->ts_offset - sf_extension, txp, siglen + sf_extension, ru->nb_tx, flags); timestamp + ru->ts_offset - sf_extension,
txp,
siglen + sf_extension,
ru->nb_tx, flags);
LOG_D(PHY, LOG_D(PHY,
"[TXPATH] RU %d aa %d tx_rf, writing to TS %llu, %d.%d, unwrapped_frame %d, slot %d, flags %d, siglen+sf_extension %d, " "[TXPATH] RU %d aa %d tx_rf, writing to TS %llu, %d.%d, unwrapped_frame %d, slot %d, flags %d, siglen+sf_extension %d, "
"returned %d, E %f\n", "returned %d, E %f\n",
...@@ -1060,7 +1064,8 @@ void *ru_stats_thread(void *param) { ...@@ -1060,7 +1064,8 @@ void *ru_stats_thread(void *param) {
return(NULL); return(NULL);
} }
void ru_tx_func(void *param) { void ru_tx_func(void *param)
{
processingData_RU_t *info = (processingData_RU_t *) param; processingData_RU_t *info = (processingData_RU_t *) param;
RU_t *ru = info->ru; RU_t *ru = info->ru;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
...@@ -1660,7 +1665,8 @@ void init_precoding_weights(PHY_VARS_gNB *gNB) { ...@@ -1660,7 +1665,8 @@ void init_precoding_weights(PHY_VARS_gNB *gNB) {
} }
}*/ }*/
void set_function_spec_param(RU_t *ru) { void set_function_spec_param(RU_t *ru)
{
switch (ru->if_south) { switch (ru->if_south) {
case LOCAL_RF: // this is an RU with integrated RF (RRU, gNB) case LOCAL_RF: // this is an RU with integrated RF (RRU, gNB)
reset_meas(&ru->rx_fhaul); reset_meas(&ru->rx_fhaul);
...@@ -1877,6 +1883,17 @@ void stop_RU(int nb_ru) { ...@@ -1877,6 +1883,17 @@ void stop_RU(int nb_ru) {
/* from here function to use configuration module */ /* from here function to use configuration module */
static void NRRCconfig_RU(configmodule_interface_t *cfg) static void NRRCconfig_RU(configmodule_interface_t *cfg)
{ {
paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC;
paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST, NULL, 0};
config_getlist(config_get_if(), &MacRLC_ParamList, MacRLC_Params, sizeofArray(MacRLC_Params), NULL);
bool analog = false;
for (int n = 0; n < MacRLC_ParamList.numelt; n++) {
if (n != 0)
AssertFatal(analog == *MacRLC_ParamList.paramarray[n][MACRLC_ANALOG_BEAMFORMING_IDX].u8ptr,
"Configuration error! Impossible to have different beamforming type in different instances\n");
analog = *MacRLC_ParamList.paramarray[n][MACRLC_ANALOG_BEAMFORMING_IDX].u8ptr;
}
paramdef_t RUParams[] = RUPARAMS_DESC; paramdef_t RUParams[] = RUPARAMS_DESC;
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST, NULL, 0}; paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST, NULL, 0};
config_getlist(cfg, &RUParamList, RUParams, sizeofArray(RUParams), NULL); config_getlist(cfg, &RUParamList, RUParams, sizeofArray(RUParams), NULL);
...@@ -1887,18 +1904,19 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) ...@@ -1887,18 +1904,19 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg)
printf("Set RU mask to %lx\n",RC.ru_mask); printf("Set RU mask to %lx\n",RC.ru_mask);
for (int j = 0; j < RC.nb_RU; j++) { for (int j = 0; j < RC.nb_RU; j++) {
RC.ru[j] = (RU_t *)malloc(sizeof(RU_t)); RC.ru[j] = (RU_t *)malloc(sizeof(RU_t));
memset((void *)RC.ru[j],0,sizeof(RU_t)); memset((void *)RC.ru[j],0,sizeof(RU_t));
RC.ru[j]->idx = j; RC.ru[j]->idx = j;
RC.ru[j]->nr_frame_parms = (NR_DL_FRAME_PARMS *)malloc(sizeof(NR_DL_FRAME_PARMS)); RC.ru[j]->nr_frame_parms = (NR_DL_FRAME_PARMS *)malloc(sizeof(NR_DL_FRAME_PARMS));
RC.ru[j]->frame_parms = (LTE_DL_FRAME_PARMS *)malloc(sizeof(LTE_DL_FRAME_PARMS)); RC.ru[j]->frame_parms = (LTE_DL_FRAME_PARMS *)malloc(sizeof(LTE_DL_FRAME_PARMS));
printf("Creating RC.ru[%d]:%p\n", j, RC.ru[j]); printf("Creating RC.ru[%d]:%p\n", j, RC.ru[j]);
RC.ru[j]->if_timing = synch_to_ext_device; RC.ru[j]->if_timing = synch_to_ext_device;
RC.ru[j]->analog_beamforming = analog;
if (RC.nb_nr_L1_inst > 0) if (RC.nb_nr_L1_inst > 0)
RC.ru[j]->num_gNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt; RC.ru[j]->num_gNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt;
else else
RC.ru[j]->num_gNB = 0; RC.ru[j]->num_gNB = 0;
for (int i = 0; i < RC.ru[j]->num_gNB; i++) for (int i = 0; i < RC.ru[j]->num_gNB; i++)
RC.ru[j]->gNB_list[i] = RC.gNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]]; RC.ru[j]->gNB_list[i] = RC.gNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]];
...@@ -1919,10 +1937,8 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) ...@@ -1919,10 +1937,8 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg)
"bad GPIO controller in configuration file: '%s'\n", "bad GPIO controller in configuration file: '%s'\n",
*(RUParamList.paramarray[j][RU_GPIO_CONTROL].strptr)); *(RUParamList.paramarray[j][RU_GPIO_CONTROL].strptr));
} }
} else { } else
RC.ru[j]->openair0_cfg.gpio_controller = RU_GPIO_CONTROL_GENERIC; RC.ru[j]->openair0_cfg.gpio_controller = RU_GPIO_CONTROL_NONE;
LOG_I(PHY, "RU GPIO control set as 'generic'\n");
}
if (config_isparamset(RUParamList.paramarray[j], RU_TX_SUBDEV)) { if (config_isparamset(RUParamList.paramarray[j], RU_TX_SUBDEV)) {
RC.ru[j]->openair0_cfg.tx_subdev = strdup(*(RUParamList.paramarray[j][RU_TX_SUBDEV].strptr)); RC.ru[j]->openair0_cfg.tx_subdev = strdup(*(RUParamList.paramarray[j][RU_TX_SUBDEV].strptr));
......
...@@ -29,22 +29,22 @@ ...@@ -29,22 +29,22 @@
void init_prach_ru_list(RU_t *ru); void init_prach_ru_list(RU_t *ru);
int nr_phy_init_RU(RU_t *ru) { int nr_phy_init_RU(RU_t *ru)
{
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
int i,j;
int p;
int re;
LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d, nb_rx %d\n",ru_if_types[ru->if_south],ru->nb_tx, ru->nb_rx); LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d, nb_rx %d\n",ru_if_types[ru->if_south],ru->nb_tx, ru->nb_rx);
nfapi_nr_config_request_scf_t *cfg; nfapi_nr_config_request_scf_t *cfg;
ru->nb_log_antennas=0; ru->nb_log_antennas = 0;
for (int n=0;n<ru->num_gNB;n++) { for (int n=0;n<ru->num_gNB;n++) {
cfg = &ru->config; cfg = &ru->config;
if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value; if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas)
ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value;
} }
// copy configuration from gNB[0] in to RU, assume that all gNB instances sharing RU use the same configuration (at least the parts that are needed by the RU, numerology and PRACH)
// copy configuration from gNB[0] in to RU, assume that all gNB instances sharing RU use the same configuration
// (at least the parts that are needed by the RU, numerology and PRACH)
AssertFatal(ru->nb_log_antennas > 0 && ru->nb_log_antennas < 13, "ru->nb_log_antennas %d ! \n",ru->nb_log_antennas); AssertFatal(ru->nb_log_antennas > 0 && ru->nb_log_antennas < 13, "ru->nb_log_antennas %d ! \n",ru->nb_log_antennas);
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals
...@@ -53,7 +53,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -53,7 +53,7 @@ int nr_phy_init_RU(RU_t *ru) {
ru->common.rxdata = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) ); ru->common.rxdata = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
for (i=0; i<ru->nb_tx; i++) { for (int i = 0; i < ru->nb_tx; i++) {
// Allocate 10 subframes of I/Q TX signal data (time) if not // Allocate 10 subframes of I/Q TX signal data (time) if not
ru->common.txdata[i] = (int32_t*)malloc16_clear((ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t)); ru->common.txdata[i] = (int32_t*)malloc16_clear((ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t));
LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes,sf_extension %d)\n",i,ru->common.txdata[i], LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes,sf_extension %d)\n",i,ru->common.txdata[i],
...@@ -63,7 +63,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -63,7 +63,7 @@ int nr_phy_init_RU(RU_t *ru) {
LOG_I(PHY,"[INIT] common.txdata[%d] = %p \n",i,ru->common.txdata[i]); LOG_I(PHY,"[INIT] common.txdata[%d] = %p \n",i,ru->common.txdata[i]);
} }
for (i=0;i<ru->nb_rx;i++) { for (int i = 0; i < ru->nb_rx; i++) {
ru->common.rxdata[i] = (int32_t*)malloc16_clear( fp->samples_per_frame*sizeof(int32_t) ); ru->common.rxdata[i] = (int32_t*)malloc16_clear( fp->samples_per_frame*sizeof(int32_t) );
} }
} // IF5 or local RF } // IF5 or local RF
...@@ -76,7 +76,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -76,7 +76,7 @@ int nr_phy_init_RU(RU_t *ru) {
if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing
LOG_I(PHY,"nb_tx %d\n",ru->nb_tx); LOG_I(PHY,"nb_tx %d\n",ru->nb_tx);
ru->common.rxdata_7_5kHz = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) ); ru->common.rxdata_7_5kHz = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
for (i=0;i<ru->nb_rx;i++) { for (int i = 0; i < ru->nb_rx; i++) {
ru->common.rxdata_7_5kHz[i] = (int32_t*)malloc16_clear( 2*fp->samples_per_subframe*2*sizeof(int32_t) ); ru->common.rxdata_7_5kHz[i] = (int32_t*)malloc16_clear( 2*fp->samples_per_subframe*2*sizeof(int32_t) );
LOG_I(PHY,"rxdata_7_5kHz[%d] %p for RU %d\n",i,ru->common.rxdata_7_5kHz[i],ru->idx); LOG_I(PHY,"rxdata_7_5kHz[%d] %p for RU %d\n",i,ru->common.rxdata_7_5kHz[i],ru->idx);
} }
...@@ -84,31 +84,33 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -84,31 +84,33 @@ int nr_phy_init_RU(RU_t *ru) {
// allocate precoding input buffers (TX) // allocate precoding input buffers (TX)
ru->common.txdataF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*)); ru->common.txdataF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*));
for(i=0; i< ru->nb_tx; ++i) ru->common.txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP // [hna] samples_per_frame without CP
for(int i = 0; i < ru->nb_tx; ++i)
ru->common.txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t));
// allocate IFFT input buffers (TX) // allocate IFFT input buffers (TX)
ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*)); ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*));
LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n",ru->common.txdataF_BF, LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n", ru->common.txdataF_BF, ru->nb_tx*sizeof(int32_t*));
ru->nb_tx*sizeof(int32_t*)); for (int i = 0; i < ru->nb_tx; i++) {
for (i=0; i<ru->nb_tx; i++) {
ru->common.txdataF_BF[i] = (int32_t*)malloc16_clear(fp->samples_per_subframe_wCP*sizeof(int32_t) ); ru->common.txdataF_BF[i] = (int32_t*)malloc16_clear(fp->samples_per_subframe_wCP*sizeof(int32_t) );
LOG_I(PHY,"txdataF_BF[%d] %p for RU %d\n",i,ru->common.txdataF_BF[i],ru->idx); LOG_I(PHY,"txdataF_BF[%d] %p for RU %d\n",i,ru->common.txdataF_BF[i],ru->idx);
} }
// allocate FFT output buffers (RX) // allocate FFT output buffers (RX)
ru->common.rxdataF = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) ); ru->common.rxdataF = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
for (i=0; i<ru->nb_rx; i++) { for (int i = 0; i < ru->nb_rx; i++) {
// allocate 4 slots of I/Q signal data (frequency) // allocate 4 slots of I/Q signal data (frequency)
ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(**ru->common.rxdataF)*(RU_RX_SLOT_DEPTH*fp->symbols_per_slot*fp->ofdm_symbol_size) ); int size = RU_RX_SLOT_DEPTH * fp->symbols_per_slot * fp->ofdm_symbol_size;
ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(**ru->common.rxdataF) * size);
LOG_I(PHY,"rxdataF[%d] %p for RU %d\n",i,ru->common.rxdataF[i],ru->idx); LOG_I(PHY,"rxdataF[%d] %p for RU %d\n",i,ru->common.rxdataF[i],ru->idx);
} }
/* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */ /* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
// AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]), // AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
// "nb_antennas_rx too large"); // "nb_antennas_rx too large");
for (j=0;j<NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX;j++) { for (int j = 0; j < NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX; j++) {
ru->prach_rxsigF[j] = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*)); ru->prach_rxsigF[j] = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
for (i=0; i<ru->nb_rx; i++) { for (int i = 0; i < ru->nb_rx; i++) {
// largest size for PRACH FFT is 4x98304 (16*24576) // largest size for PRACH FFT is 4x98304 (16*24576)
ru->prach_rxsigF[j][i] = (int16_t*)malloc16_clear( 4*98304*2*sizeof(int16_t) ); ru->prach_rxsigF[j][i] = (int16_t*)malloc16_clear( 4*98304*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[j][i]); LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[j][i]);
...@@ -120,44 +122,8 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -120,44 +122,8 @@ int nr_phy_init_RU(RU_t *ru) {
LOG_I(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB); LOG_I(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB);
if (ru->do_precoding == 1) {
int beam_count = 0;
if (ru->nb_tx>1) { //Enable beamforming when nb_tx > 1
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
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));
for (i=0; i<ru->num_gNB; i++) {
int l_ind = 0;
for (p=0;p<ru->nb_log_antennas;p++) {
//if ((fp->L_ssb >> (63-p)) & 0x01) {
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
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));
AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i);
for (re=0; re<fp->ofdm_symbol_size; re++)
ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind];
//printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j);
l_ind++;
} // for j
//}
} // for p
} // for i
}
ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*));
for(i=0; i< ru->nb_tx; ++i) {
ru->common.beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
memset(ru->common.beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame);
}
}
} // !=IF5 } // !=IF5
ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP );
init_prach_ru_list(ru); init_prach_ru_list(ru);
return(0); return(0);
...@@ -216,5 +182,4 @@ void nr_phy_free_RU(RU_t *ru) ...@@ -216,5 +182,4 @@ void nr_phy_free_RU(RU_t *ru)
free_and_zero(ru->common.beam_id); free_and_zero(ru->common.beam_id);
} }
} }
free_and_zero(ru->common.sync_corr);
} }
...@@ -662,6 +662,7 @@ typedef struct RU_t_s { ...@@ -662,6 +662,7 @@ typedef struct RU_t_s {
int num_tpcores; int num_tpcores;
/// structure for analyzing high-level RT measurements /// structure for analyzing high-level RT measurements
rt_ru_profiling_t rt_ru_profiling; rt_ru_profiling_t rt_ru_profiling;
bool analog_beamforming;
} RU_t; } RU_t;
......
...@@ -52,28 +52,37 @@ ...@@ -52,28 +52,37 @@
extern int oai_exit; extern int oai_exit;
// OFDM modulation core routine, generates a first_symbol to first_symbol+num_symbols on a particular slot and TX antenna port // OFDM modulation core routine, generates a first_symbol to first_symbol+num_symbols on a particular slot and TX antenna port
void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) { void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa)
{
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
unsigned int slot_offset,slot_offsetF; unsigned int slot_offset,slot_offsetF;
int slot = tti_tx; int slot = tti_tx;
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0) , 1 ); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0) , 1 );
if (aa==0 && first_symbol == 0) start_meas(&ru->ofdm_mod_stats); if (aa == 0 && first_symbol == 0)
slot_offset = fp->get_samples_slot_timestamp(slot,fp,0); start_meas(&ru->ofdm_mod_stats);
slot_offsetF = first_symbol*fp->ofdm_symbol_size; slot_offset = fp->get_samples_slot_timestamp(slot, fp, 0);
slot_offsetF = first_symbol * fp->ofdm_symbol_size;
int abs_first_symbol = slot*fp->symbols_per_slot; int abs_first_symbol = slot * fp->symbols_per_slot;
for (uint16_t idx_sym=abs_first_symbol; idx_sym<abs_first_symbol+first_symbol; idx_sym++) for (int idx_sym = abs_first_symbol; idx_sym < abs_first_symbol + first_symbol; idx_sym++)
slot_offset += (idx_sym%(0x7<<fp->numerology_index)) ? fp->nb_prefix_samples : fp->nb_prefix_samples0; slot_offset += (idx_sym % (0x7 << fp->numerology_index)) ? fp->nb_prefix_samples : fp->nb_prefix_samples0;
slot_offset += fp->ofdm_symbol_size*first_symbol; slot_offset += fp->ofdm_symbol_size * first_symbol;
LOG_D(PHY,"SFN/SF:RU:TX:%d/%d aa %d Generating slot %d (first_symbol %d num_symbols %d) slot_offset %d, slot_offsetF %d\n",ru->proc.frame_tx, ru->proc.tti_tx,aa,slot,first_symbol,num_symbols,slot_offset,slot_offsetF); LOG_D(PHY,
"SFN/SF:RU:TX:%d/%d aa %d Generating slot %d (first_symbol %d num_symbols %d) slot_offset %d, slot_offsetF %d\n",
ru->proc.frame_tx,
ru->proc.tti_tx,
aa,
slot,
first_symbol,
num_symbols,
slot_offset,
slot_offsetF);
if (fp->Ncp == 1) { if (fp->Ncp == 1) {
PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF], PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF],
...@@ -110,8 +119,8 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) { ...@@ -110,8 +119,8 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
} }
} // numerology_index!=0 } // numerology_index!=0
else { //numerology_index == 0 else { //numerology_index == 0
for (uint16_t idx_sym=abs_first_symbol; idx_sym<abs_first_symbol+num_symbols; idx_sym++) { for (int idx_sym = abs_first_symbol; idx_sym < abs_first_symbol+num_symbols; idx_sym++) {
if (idx_sym%0x7) { if (idx_sym % 0x7) {
PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF], PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF],
(int*)&ru->common.txdata[aa][slot_offset], (int*)&ru->common.txdata[aa][slot_offset],
fp->ofdm_symbol_size, fp->ofdm_symbol_size,
...@@ -135,7 +144,8 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) { ...@@ -135,7 +144,8 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
} // numerology 0 } // numerology 0
} }
if (aa==0 && first_symbol==0) stop_meas(&ru->ofdm_mod_stats); if (aa == 0 && first_symbol == 0)
stop_meas(&ru->ofdm_mod_stats);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0), 0); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0), 0);
} }
...@@ -261,48 +271,42 @@ void nr_fep_full(RU_t *ru, int slot) { ...@@ -261,48 +271,42 @@ void nr_fep_full(RU_t *ru, int slot) {
} }
// core routine for FEP TX, called from threads in RU TX thread-pool // core routine for FEP TX, called from threads in RU TX thread-pool
void nr_feptx(void *arg) { void nr_feptx(void *arg)
{
feptx_cmd_t *feptx = (feptx_cmd_t *)arg; feptx_cmd_t *feptx = (feptx_cmd_t *)arg;
RU_t *ru = feptx->ru; RU_t *ru = feptx->ru;
int slot = feptx->slot; int slot = feptx->slot;
int aa = feptx->aid; int aa = feptx->aid;
int startSymbol = feptx->startSymbol; int startSymbol = feptx->startSymbol;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
int numSymbols = feptx->numSymbols; int numSymbols = feptx->numSymbols;
int numSamples = feptx->numSymbols*fp->ofdm_symbol_size; int numSamples = feptx->numSymbols * fp->ofdm_symbol_size;
int txdataF_offset = (slot*fp->samples_per_slot_wCP) + startSymbol*fp->ofdm_symbol_size; int txdataF_offset = (slot * fp->samples_per_slot_wCP) + startSymbol * fp->ofdm_symbol_size;
int txdataF_BF_offset = startSymbol*fp->ofdm_symbol_size; int txdataF_BF_offset = startSymbol * fp->ofdm_symbol_size;
////////////precoding////////////
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->aid , 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->aid , 1);
if (aa==0) start_meas(&ru->precoding_stats);
if (ru->do_precoding == 1) { if (aa == 0)
for(int i=0; i<ru->nb_log_antennas; ++i) { start_meas(&ru->precoding_stats);
if (ru->config.dbt_config.num_dig_beams != 0) {
for(int i = 0; i < ru->nb_log_antennas; ++i) {
memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot], 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], (void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot],
(fp->symbols_per_slot)*sizeof(uint8_t)); (fp->symbols_per_slot)*sizeof(uint8_t));
} }
} }
if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { // If there is no digital beamforming we just need to copy the data to RU
memcpy((void*)&ru->common.txdataF_BF[0][txdataF_BF_offset], if (ru->config.dbt_config.num_dig_beams == 0 || ru->analog_beamforming)
(void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset],
numSamples*sizeof(int32_t));
}
else if (ru->do_precoding == 0) {
int gNB_tx = ru->gNB_list[0]->frame_parms.nb_antennas_tx;
memcpy((void*)&ru->common.txdataF_BF[aa][txdataF_BF_offset], memcpy((void*)&ru->common.txdataF_BF[aa][txdataF_BF_offset],
(void*)&ru->gNB_list[0]->common_vars.txdataF[aa%gNB_tx][txdataF_offset], (void*)&ru->gNB_list[0]->common_vars.txdataF[aa][txdataF_offset],
numSamples*sizeof(int32_t)); numSamples * sizeof(int32_t));
}
else { else {
AssertFatal(1==0,"This needs to be fixed, do not use beamforming.\n"); AssertFatal(1 == 0, "This needs to be fixed, do not use beamforming.\n");
int32_t ***bw = ru->beam_weights[0]; int32_t ***bw = ru->beam_weights[0];
for(int i=0; i<fp->symbols_per_slot; ++i){ for(int i = 0; i < fp->symbols_per_slot; ++i) {
nr_beam_precoding((c16_t **)ru->gNB_list[0]->common_vars.txdataF, nr_beam_precoding((c16_t **)ru->gNB_list[0]->common_vars.txdataF,
(c16_t **)ru->common.txdataF_BF, (c16_t **)ru->common.txdataF_BF,
fp, fp,
...@@ -311,55 +315,60 @@ void nr_feptx(void *arg) { ...@@ -311,55 +315,60 @@ void nr_feptx(void *arg) {
i, i,
aa, aa,
ru->nb_log_antennas, ru->nb_log_antennas,
txdataF_offset);//here txdataF_offset);
} }
} }
if (aa==0) stop_meas(&ru->precoding_stats);
if (aa==0)
stop_meas(&ru->precoding_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->aid , 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->aid , 0);
////////////FEPTX//////////// ////////////FEPTX////////////
nr_feptx0(ru,slot,startSymbol,numSymbols,aa); nr_feptx0(ru, slot, startSymbol, numSymbols, aa);
} }
// RU FEP TX using thread-pool // RU FEP TX using thread-pool
void nr_feptx_tp(RU_t *ru, int frame_tx, int slot) { void nr_feptx_tp(RU_t *ru, int frame_tx, int slot)
{
nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config; nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
int nbfeptx=0; int nbfeptx = 0;
if (nr_slot_select(cfg,frame_tx,slot) == NR_UPLINK_SLOT) return; if (nr_slot_select(cfg, frame_tx, slot) == NR_UPLINK_SLOT)
// for (int aa=0; aa<ru->nb_tx; aa++) memset(ru->common.txdataF[aa],0,ru->nr_frame_parms->samples_per_slot_wCP*sizeof(int32_t)); return;
if (ru->idx == 0)
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 1);
start_meas(&ru->ofdm_total_stats); start_meas(&ru->ofdm_total_stats);
for (int aid=0;aid<ru->nb_tx;aid++) { for (int aid = 0; aid < ru->nb_tx; aid++) {
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid,ru->respfeptx,nr_feptx); notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid, ru->respfeptx, nr_feptx);
feptx_cmd_t *feptx_cmd=(feptx_cmd_t*)NotifiedFifoData(req); feptx_cmd_t *feptx_cmd = (feptx_cmd_t*)NotifiedFifoData(req);
feptx_cmd->aid = aid; feptx_cmd->aid = aid;
feptx_cmd->ru = ru; feptx_cmd->ru = ru;
feptx_cmd->slot = slot; feptx_cmd->slot = slot;
feptx_cmd->startSymbol = 0; feptx_cmd->startSymbol = 0;
feptx_cmd->numSymbols = (ru->half_slot_parallelization>0)?ru->nr_frame_parms->symbols_per_slot>>1:ru->nr_frame_parms->symbols_per_slot; feptx_cmd->numSymbols = (ru->half_slot_parallelization > 0) ?
pushTpool(ru->threadPool,req); ru->nr_frame_parms->symbols_per_slot >> 1 :
ru->nr_frame_parms->symbols_per_slot;
pushTpool(ru->threadPool, req);
nbfeptx++; nbfeptx++;
if (ru->half_slot_parallelization>0) { if (ru->half_slot_parallelization > 0) {
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid + ru->nb_tx,ru->respfeptx,nr_feptx); notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid + ru->nb_tx, ru->respfeptx, nr_feptx);
feptx_cmd_t *feptx_cmd=(feptx_cmd_t*)NotifiedFifoData(req); feptx_cmd_t *feptx_cmd = (feptx_cmd_t*)NotifiedFifoData(req);
feptx_cmd->aid = aid; feptx_cmd->aid = aid;
feptx_cmd->ru = ru; feptx_cmd->ru = ru;
feptx_cmd->slot = slot; feptx_cmd->slot = slot;
feptx_cmd->startSymbol = ru->nr_frame_parms->symbols_per_slot>>1; feptx_cmd->startSymbol = ru->nr_frame_parms->symbols_per_slot >> 1;
feptx_cmd->numSymbols = ru->nr_frame_parms->symbols_per_slot>>1; feptx_cmd->numSymbols = ru->nr_frame_parms->symbols_per_slot >> 1;
pushTpool(ru->threadPool,req); pushTpool(ru->threadPool, req);
nbfeptx++; nbfeptx++;
} }
} }
while (nbfeptx>0) { while (nbfeptx > 0) {
notifiedFIFO_elt_t *req=pullTpool(ru->respfeptx, ru->threadPool); notifiedFIFO_elt_t *req=pullTpool(ru->respfeptx, ru->threadPool);
delNotifiedFIFO_elt(req); delNotifiedFIFO_elt(req);
nbfeptx--; nbfeptx--;
} }
stop_meas(&ru->ofdm_total_stats); stop_meas(&ru->ofdm_total_stats);
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 0 ); if (ru->idx == 0)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 0);
} }
// core RX FEP routine, called by threads in RU thread-pool // core RX FEP routine, called by threads in RU thread-pool
......
...@@ -169,7 +169,7 @@ typedef enum { ...@@ -169,7 +169,7 @@ typedef enum {
#define RU_NUM_INTERFACES 39 #define RU_NUM_INTERFACES 39
#define RU_HALF_SLOT_PARALLELIZATION 40 #define RU_HALF_SLOT_PARALLELIZATION 40
#define RU_RU_THREAD_CORE 41 #define RU_RU_THREAD_CORE 41
#define RU_GPIO_CONTROL 42 #define RU_GPIO_CONTROL 42
/*-----------------------------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------------------------*/
/* RU configuration parameters */ /* RU configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
......
...@@ -2412,7 +2412,7 @@ ngran_node_t get_node_type(void) ...@@ -2412,7 +2412,7 @@ ngran_node_t get_node_type(void)
char aprefix[MAX_OPTNAME_SIZE*2 + 8]; char aprefix[MAX_OPTNAME_SIZE*2 + 8];
sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0);
config_getlist(config_get_if(), &GNBE1ParamList, GNBE1Params, sizeofArray(GNBE1Params), aprefix); config_getlist(config_get_if(), &GNBE1ParamList, GNBE1Params, sizeofArray(GNBE1Params), aprefix);
if ( MacRLC_ParamList.numelt > 0) { if (MacRLC_ParamList.numelt > 0) {
RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt; RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt;
for (int j = 0; j < RC.nb_nr_macrlc_inst; j++) { for (int j = 0; j < RC.nb_nr_macrlc_inst; j++) {
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) { if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) {
......
...@@ -596,17 +596,19 @@ static void config_common(gNB_MAC_INST *nrmac, ...@@ -596,17 +596,19 @@ static void config_common(gNB_MAC_INST *nrmac,
cfg->pmi_list = init_DL_MIMO_codebook(nrmac, pdsch_AntennaPorts); cfg->pmi_list = init_DL_MIMO_codebook(nrmac, pdsch_AntennaPorts);
// beamforming matrix configuration // beamforming matrix configuration
cfg->dbt_config.num_dig_beams = nb_beams; cfg->dbt_config.num_dig_beams = nb_beams;
cfg->dbt_config.num_txrus = nb_tx; if (nb_beams > 0) {
cfg->dbt_config.dig_beam_list = malloc16(nb_beams * sizeof(*cfg->dbt_config.dig_beam_list)); cfg->dbt_config.num_txrus = nb_tx;
AssertFatal(cfg->dbt_config.dig_beam_list, "out of memory\n"); cfg->dbt_config.dig_beam_list = malloc16(nb_beams * sizeof(*cfg->dbt_config.dig_beam_list));
for (int i = 0; i < nb_beams; i++) { AssertFatal(cfg->dbt_config.dig_beam_list, "out of memory\n");
nfapi_nr_dig_beam_t *beam = &cfg->dbt_config.dig_beam_list[i]; for (int i = 0; i < nb_beams; i++) {
beam->beam_idx = i; nfapi_nr_dig_beam_t *beam = &cfg->dbt_config.dig_beam_list[i];
beam->txru_list = malloc16(nb_tx * sizeof(*beam->txru_list)); beam->beam_idx = i;
for (int j = 0; j < nb_tx; j++) { beam->txru_list = malloc16(nb_tx * sizeof(*beam->txru_list));
beam->txru_list[j].dig_beam_weight_Re = bw_list[j + i * nb_tx] & 0xffff; for (int j = 0; j < nb_tx; j++) {
beam->txru_list[j].dig_beam_weight_Im = (bw_list[j + i * nb_tx] >> 16) & 0xffff; beam->txru_list[j].dig_beam_weight_Re = bw_list[j + i * nb_tx] & 0xffff;
LOG_D(NR_MAC, "Beam %d Tx %d Weight (%d, %d)\n", i, j, beam->txru_list[j].dig_beam_weight_Re, beam->txru_list[j].dig_beam_weight_Im); beam->txru_list[j].dig_beam_weight_Im = (bw_list[j + i * nb_tx] >> 16) & 0xffff;
LOG_D(NR_MAC, "Beam %d Tx %d Weight (%d, %d)\n", i, j, beam->txru_list[j].dig_beam_weight_Re, beam->txru_list[j].dig_beam_weight_Im);
}
} }
} }
} }
......
...@@ -174,6 +174,7 @@ typedef struct { ...@@ -174,6 +174,7 @@ typedef struct {
} udp_ctx_t; } udp_ctx_t;
typedef enum { typedef enum {
RU_GPIO_CONTROL_NONE,
RU_GPIO_CONTROL_GENERIC, RU_GPIO_CONTROL_GENERIC,
RU_GPIO_CONTROL_INTERDIGITAL, RU_GPIO_CONTROL_INTERDIGITAL,
} gpio_control_t; } gpio_control_t;
......
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