Radio: add individual Rx gain and integrate in srsue

Fix compilation

Fix compilation

Add missing variable. Wasn't compiling

Radio: revert some changes
master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 04d7267734
commit df2c949417

@ -47,6 +47,7 @@ typedef struct {
float ul_freq;
float freq_offset;
float rx_gain;
float rx_gain_ch[SRSLTE_MAX_CARRIERS];
float tx_gain;
float tx_gain_ch[SRSLTE_MAX_CARRIERS];
float tx_max_power;

@ -198,6 +198,26 @@ int radio::init(const rf_args_t& args, phy_interface_radio* phy_)
}
}
// Set individual gains
for (uint32_t i = 0; i < args.nof_carriers; i++) {
if (args.rx_gain_ch[i] > 0) {
for (uint32_t j = 0; j < nof_antennas; j++) {
uint32_t phys_antenna_idx = i * nof_antennas + j;
// From channel number deduce RF device index and channel
uint32_t rf_device_idx = phys_antenna_idx / nof_channels_x_dev;
uint32_t rf_channel_idx = phys_antenna_idx % nof_channels_x_dev;
log_h->info(
"Setting individual rx_gain=%.1f on dev=%d ch=%d\n", args.rx_gain_ch[i], rf_device_idx, rf_channel_idx);
if (srslte_rf_set_rx_gain_ch(&rf_devices[rf_device_idx], rf_channel_idx, args.rx_gain_ch[i]) < 0) {
log_h->error(
"Setting channel rx_gain=%.1f on dev=%d ch=%d\n", args.rx_gain_ch[i], rf_device_idx, rf_channel_idx);
}
}
}
}
// Set resampler buffers to 5 ms
if (std::isnormal(fix_srate_hz)) {
for (auto& buf : rx_buffer) {

@ -87,6 +87,11 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
("rf.tx_gain[2]", bpo::value<float>(&args->rf.tx_gain_ch[2])->default_value(-1), "Front-end transmitter gain CH2")
("rf.tx_gain[3]", bpo::value<float>(&args->rf.tx_gain_ch[3])->default_value(-1), "Front-end transmitter gain CH3")
("rf.tx_gain[4]", bpo::value<float>(&args->rf.tx_gain_ch[4])->default_value(-1), "Front-end transmitter gain CH4")
("rf.rx_gain[0]", bpo::value<float>(&args->rf.rx_gain_ch[0])->default_value(-1), "Front-end receiver gain CH0")
("rf.rx_gain[1]", bpo::value<float>(&args->rf.rx_gain_ch[1])->default_value(-1), "Front-end receiver gain CH1")
("rf.rx_gain[2]", bpo::value<float>(&args->rf.rx_gain_ch[2])->default_value(-1), "Front-end receiver gain CH2")
("rf.rx_gain[3]", bpo::value<float>(&args->rf.rx_gain_ch[3])->default_value(-1), "Front-end receiver gain CH3")
("rf.rx_gain[4]", bpo::value<float>(&args->rf.rx_gain_ch[4])->default_value(-1), "Front-end receiver gain CH4")
("rf.nof_carriers", bpo::value<uint32_t>(&args->rf.nof_carriers)->default_value(1), "Number of carriers")
("rf.nof_antennas", bpo::value<uint32_t>(&args->rf.nof_antennas)->default_value(1), "Number of antennas per carrier")

Loading…
Cancel
Save