mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 21:23:02 +00:00
Prefer initialization to assignment in constructors in some signal sources
This commit is contained in:
parent
26964a365a
commit
05a7d2413d
@ -1,8 +1,11 @@
|
||||
/*!
|
||||
* \file ad9361_fpga_signal_source.cc
|
||||
* \brief signal source for Analog Devices front-end AD9361 connected directly to FPGA accelerators.
|
||||
* This source implements only the AD9361 control. It is NOT compatible with conventional SDR acquisition and tracking blocks.
|
||||
* Please use the fmcomms2 source if conventional SDR acquisition and tracking is selected in the configuration file.
|
||||
* \brief signal source for Analog Devices front-end AD9361 connected directly
|
||||
* to FPGA accelerators.
|
||||
* This source implements only the AD9361 control. It is NOT compatible with
|
||||
* conventional SDR acquisition and tracking blocks.
|
||||
* Please use the fmcomms2 source if conventional SDR acquisition and tracking
|
||||
* is selected in the configuration file.
|
||||
* \authors <ul>
|
||||
* <li> Javier Arribas, jarribas(at)cttc.es
|
||||
* <li> Marc Majoral, mmajoral(at)cttc.es
|
||||
@ -30,19 +33,16 @@
|
||||
#include "uio_fpga.h"
|
||||
#include <glog/logging.h>
|
||||
#include <iio.h>
|
||||
#include <algorithm> // for max
|
||||
#include <chrono> // for std::this_thread
|
||||
#include <cmath> // for abs
|
||||
#include <exception> // for exceptions
|
||||
#include <algorithm> // for std::max
|
||||
#include <chrono> // for std::chrono
|
||||
#include <cmath> // for std::floor
|
||||
#include <exception> // for std::exception
|
||||
#include <fcntl.h> // for open, O_WRONLY
|
||||
#include <fstream> // for std::ifstream
|
||||
#include <iomanip> // for std::setprecision
|
||||
#include <iostream> // for cout
|
||||
#include <string> // for string manipulation
|
||||
#include <thread> // for std::chrono
|
||||
#include <iostream> // for std::cout
|
||||
#include <unistd.h> // for write
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <vector> // fr std::vector
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
@ -50,32 +50,53 @@ using namespace std::string_literals;
|
||||
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *configuration,
|
||||
const std::string &role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t> *queue __attribute__((unused)))
|
||||
: SignalSourceBase(configuration, role, "Ad9361_Fpga_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
: SignalSourceBase(configuration, role, "Ad9361_Fpga_Signal_Source"s),
|
||||
queue_(queue),
|
||||
gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)),
|
||||
gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)),
|
||||
rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)),
|
||||
filter_filename_(configuration->property(role + ".filter_filename", filter_file_)),
|
||||
rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)),
|
||||
rf_gain_rx2_(configuration->property(role + ".gain_rx1", default_manual_gain_rx2)),
|
||||
freq_(configuration->property(role + ".freq", static_cast<uint64_t>(GPS_L1_FREQ_HZ))),
|
||||
sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)),
|
||||
bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)),
|
||||
samples_to_skip_(0),
|
||||
samples_(configuration->property(role + ".samples", static_cast<int64_t>(0))),
|
||||
Fpass_(configuration->property(role + ".Fpass", static_cast<float>(0.0))),
|
||||
Fstop_(configuration->property(role + ".Fstop", static_cast<float>(0.0))),
|
||||
num_freq_bands_(2),
|
||||
dma_buff_offset_pos_(0),
|
||||
scale_dds_dbfs_(configuration->property(role + ".scale_dds_dbfs", -3.0)),
|
||||
phase_dds_deg_(configuration->property(role + ".phase_dds_deg", 0.0)),
|
||||
tx_attenuation_db_(configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db)),
|
||||
freq_dds_tx_hz_(configuration->property(role + ".freq_dds_tx_hz", uint64_t(10000))),
|
||||
freq_rf_tx_hz_(configuration->property(role + ".freq_rf_tx_hz", static_cast<uint64_t>(GPS_L1_FREQ_HZ - GPS_L5_FREQ_HZ - freq_dds_tx_hz_))),
|
||||
tx_bandwidth_(configuration->property(role + ".tx_bandwidth", static_cast<uint64_t>(500000))),
|
||||
item_size_(sizeof(int8_t)),
|
||||
in_stream_(in_stream),
|
||||
out_stream_(out_stream),
|
||||
switch_position_(configuration->property(role + ".switch_position", 0)),
|
||||
enable_dds_lo_(configuration->property(role + ".enable_dds_lo", false)),
|
||||
filter_auto_(configuration->property(role + ".filter_auto", false)),
|
||||
quadrature_(configuration->property(role + ".quadrature", true)),
|
||||
rf_dc_(configuration->property(role + ".rf_dc", true)),
|
||||
bb_dc_(configuration->property(role + ".bb_dc", true)),
|
||||
rx1_enable_(configuration->property(role + ".rx1_enable", true)),
|
||||
rx2_enable_(configuration->property(role + ".rx2_enable", true)),
|
||||
enable_DMA_(false),
|
||||
enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)),
|
||||
enable_ovf_check_buffer_monitor_active_(false),
|
||||
dump_(configuration->property(role + ".dump", false)),
|
||||
rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)),
|
||||
repeat_(configuration->property(role + ".repeat", false))
|
||||
{
|
||||
// initialize the variables that are used in real-time mode
|
||||
const int l1_band = configuration->property("Channels_1C.count", 0) +
|
||||
configuration->property("Channels_1B.count", 0);
|
||||
|
||||
const double seconds_to_skip = configuration->property(role + ".seconds_to_skip", 0.0);
|
||||
const size_t header_size = configuration->property(role + ".header_size", 0);
|
||||
|
||||
const std::string default_gain_mode("slow_attack");
|
||||
const double default_tx_attenuation_db = -10.0;
|
||||
const double default_manual_gain_rx1 = 64.0;
|
||||
const double default_manual_gain_rx2 = 64.0;
|
||||
const uint64_t default_bandwidth = 12500000;
|
||||
const std::string default_rf_port_select("A_BALANCED");
|
||||
freq_ = configuration->property(role + ".freq", static_cast<uint64_t>(GPS_L1_FREQ_HZ));
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", static_cast<uint64_t>(12500000));
|
||||
bandwidth_ = configuration->property(role + ".bandwidth", default_bandwidth);
|
||||
quadrature_ = configuration->property(role + ".quadrature", true);
|
||||
rf_dc_ = configuration->property(role + ".rf_dc", true);
|
||||
bb_dc_ = configuration->property(role + ".bb_dc", true);
|
||||
rx1_enable_ = configuration->property(role + ".rx1_enable", true);
|
||||
rx2_enable_ = configuration->property(role + ".rx2_enable", true);
|
||||
gain_mode_rx1_ = configuration->property(role + ".gain_mode_rx1", default_gain_mode);
|
||||
gain_mode_rx2_ = configuration->property(role + ".gain_mode_rx2", default_gain_mode);
|
||||
rf_gain_rx1_ = configuration->property(role + ".gain_rx1", default_manual_gain_rx1);
|
||||
rf_gain_rx2_ = configuration->property(role + ".gain_rx2", default_manual_gain_rx2);
|
||||
rf_port_select_ = configuration->property(role + ".rf_port_select", default_rf_port_select);
|
||||
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||
filter_filename_ = configuration->property(role + ".filter_filename", filter_file_);
|
||||
filter_auto_ = configuration->property(role + ".filter_auto", false);
|
||||
if (filter_auto_)
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Auto"));
|
||||
@ -84,29 +105,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Off"));
|
||||
}
|
||||
Fpass_ = configuration->property(role + ".Fpass", static_cast<float>(0.0));
|
||||
Fstop_ = configuration->property(role + ".Fstop", static_cast<float>(0.0));
|
||||
enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false);
|
||||
freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", static_cast<uint64_t>(10000));
|
||||
freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", static_cast<uint64_t>(GPS_L1_FREQ_HZ - GPS_L5_FREQ_HZ - freq_dds_tx_hz_));
|
||||
scale_dds_dbfs_ = configuration->property(role + ".scale_dds_dbfs", -3.0);
|
||||
tx_attenuation_db_ = configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db);
|
||||
tx_bandwidth_ = configuration->property(role + ".tx_bandwidth", static_cast<uint64_t>(500000));
|
||||
phase_dds_deg_ = configuration->property(role + ".phase_dds_deg", 0.0);
|
||||
|
||||
rf_shutdown_ = configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown);
|
||||
|
||||
// initialize the variables that are used in post-processing mode
|
||||
|
||||
enable_DMA_ = false;
|
||||
|
||||
const int l1_band = configuration->property("Channels_1C.count", 0) +
|
||||
configuration->property("Channels_1B.count", 0);
|
||||
|
||||
const double default_seconds_to_skip = 0.0;
|
||||
|
||||
const std::string empty_string;
|
||||
filename0 = configuration->property(role + ".filename", empty_string);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source != "-")
|
||||
@ -118,16 +116,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
|
||||
filename0 = FLAGS_s;
|
||||
}
|
||||
|
||||
if (filename0.empty())
|
||||
{
|
||||
filename0 = configuration->property(role + ".filename0", empty_string);
|
||||
filename1 = configuration->property(role + ".filename1", empty_string);
|
||||
}
|
||||
|
||||
// by default the DMA transfers samples corresponding to two frequency bands to the FPGA
|
||||
num_freq_bands_ = 2;
|
||||
dma_buff_offset_pos_ = 0;
|
||||
|
||||
// if only one input file is specified in the configuration file then:
|
||||
// if there is at least one channel assigned to frequency band 1 then the DMA transfers the samples to the L1 frequency band channels
|
||||
// otherwise the DMA transfers the samples to the L2/L5 frequency band channels
|
||||
@ -145,15 +133,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
|
||||
dma_buff_offset_pos_ = 2;
|
||||
}
|
||||
|
||||
samples_ = configuration->property(role + ".samples", static_cast<int64_t>(0));
|
||||
|
||||
const double seconds_to_skip = configuration->property(role + ".seconds_to_skip", default_seconds_to_skip);
|
||||
const size_t header_size = configuration->property(role + ".header_size", 0);
|
||||
std::string item_type = "ibyte"; // for now only the ibyte format is supported
|
||||
item_size_ = sizeof(int8_t);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
|
||||
samples_to_skip_ = 0;
|
||||
if (seconds_to_skip > 0)
|
||||
{
|
||||
samples_to_skip_ = static_cast<uint64_t>(seconds_to_skip * sample_rate_) * 2;
|
||||
@ -163,10 +142,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
|
||||
samples_to_skip_ += header_size;
|
||||
}
|
||||
|
||||
// check the switch status (determines real-time mode or post-processing mode)
|
||||
|
||||
std::string device_io_name; // Switch UIO device file
|
||||
|
||||
// find the uio device file corresponding to the switch.
|
||||
if (find_uio_dev_file_name(device_io_name, switch_device_name, 0) < 0)
|
||||
{
|
||||
@ -175,7 +151,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
|
||||
return;
|
||||
}
|
||||
|
||||
switch_position_ = configuration->property(role + ".switch_position", 0);
|
||||
if (switch_position_ != 0 && switch_position_ != 2)
|
||||
{
|
||||
std::cout << "SignalSource.switch_position configuration parameter must be either 0: read from file(s) via DMA, or 2: read from AD9361\n";
|
||||
@ -272,7 +247,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
|
||||
}
|
||||
DLOG(INFO) << "Samples " << samples_;
|
||||
DLOG(INFO) << "Sampling frequency " << sample_rate_;
|
||||
DLOG(INFO) << "Item type " << item_type;
|
||||
DLOG(INFO) << "Item type " << std::string("ibyte");
|
||||
DLOG(INFO) << "Item size " << item_size_;
|
||||
DLOG(INFO) << "Repeat " << repeat_;
|
||||
}
|
||||
@ -429,7 +404,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
|
||||
|
||||
std::string device_io_name_buffer_monitor;
|
||||
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
|
||||
// find the uio device file corresponding to the buffer monitor
|
||||
@ -445,7 +419,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con
|
||||
}
|
||||
|
||||
// dynamic bits selection
|
||||
enable_dynamic_bit_selection_ = configuration->property(role + ".enable_dynamic_bit_selection", true);
|
||||
if (enable_dynamic_bit_selection_)
|
||||
{
|
||||
std::string device_io_name_dyn_bit_sel_0;
|
||||
@ -616,7 +589,6 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0, const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// rx signal vectors
|
||||
std::vector<int8_t> input_samples(sample_block_size * 2); // complex samples
|
||||
std::vector<int8_t> input_samples_dma(sample_block_size * 4); // complex samples, two frequency bands
|
||||
|
@ -1,8 +1,11 @@
|
||||
/*!
|
||||
* \file ad9361_fpga_signal_source.h
|
||||
* \brief signal source for Analog Devices front-end AD9361 connected directly to FPGA accelerators.
|
||||
* This source implements only the AD9361 control. It is NOT compatible with conventional SDR acquisition and tracking blocks.
|
||||
* Please use the fmcomms2 source if conventional SDR acquisition and tracking is selected in the configuration file.
|
||||
* \brief signal source for Analog Devices front-end AD9361 connected directly
|
||||
* to FPGA accelerators.
|
||||
* This source implements only the AD9361 control. It is NOT compatible with
|
||||
* conventional SDR acquisition and tracking blocks.
|
||||
* Please use the fmcomms2 source if conventional SDR acquisition and tracking
|
||||
* is selected in the configuration file.
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
@ -62,10 +65,17 @@ public:
|
||||
gr::basic_block_sptr get_right_block() override;
|
||||
|
||||
private:
|
||||
const std::string switch_device_name = "AXIS_Switch_v1_0_0"; // Switch UIO device name
|
||||
const std::string dyn_bit_sel_device_name = "dynamic_bits_selector"; // Switch dhnamic bit selector device name
|
||||
const std::string buffer_monitor_device_name = "buffer_monitor"; // buffer monitor device name
|
||||
const std::string switch_device_name = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name
|
||||
const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name
|
||||
const std::string buffer_monitor_device_name = std::string("buffer_monitor"); // buffer monitor device name
|
||||
const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat");
|
||||
const std::string default_rf_port_select = std::string("A_BALANCED");
|
||||
const std::string default_gain_mode = std::string("slow_attack");
|
||||
const double default_tx_attenuation_db = -10.0;
|
||||
const double default_manual_gain_rx1 = 64.0;
|
||||
const double default_manual_gain_rx2 = 64.0;
|
||||
const uint64_t default_bandwidth = 12500000;
|
||||
|
||||
// perform dynamic bit selection every 500 ms by default
|
||||
const uint32_t Gain_control_period_ms = 500;
|
||||
// check buffer overflow and perform buffer monitoring every 1s by default
|
||||
@ -95,6 +105,12 @@ private:
|
||||
std::shared_ptr<Fpga_dynamic_bit_selection> dynamic_bit_selection_fpga;
|
||||
std::shared_ptr<Fpga_buffer_monitor> buffer_monitor_fpga;
|
||||
|
||||
std::mutex dma_mutex;
|
||||
std::mutex dynamic_bit_selection_mutex;
|
||||
std::mutex buffer_monitor_mutex;
|
||||
|
||||
Concurrent_Queue<pmt::pmt_t> *queue_;
|
||||
|
||||
// Front-end settings
|
||||
std::string gain_mode_rx1_;
|
||||
std::string gain_mode_rx2_;
|
||||
@ -105,24 +121,24 @@ private:
|
||||
std::string filename0;
|
||||
std::string filename1;
|
||||
|
||||
std::mutex dma_mutex;
|
||||
std::mutex dynamic_bit_selection_mutex;
|
||||
std::mutex buffer_monitor_mutex;
|
||||
|
||||
double rf_gain_rx1_;
|
||||
double rf_gain_rx2_;
|
||||
uint64_t freq_; // frequency of local oscillator
|
||||
uint64_t sample_rate_;
|
||||
uint64_t bandwidth_;
|
||||
uint64_t samples_to_skip_;
|
||||
int64_t samples_;
|
||||
float Fpass_;
|
||||
float Fstop_;
|
||||
uint32_t num_freq_bands_;
|
||||
uint32_t dma_buff_offset_pos_;
|
||||
|
||||
// DDS configuration for LO generation for external mixer
|
||||
double scale_dds_dbfs_;
|
||||
double phase_dds_deg_;
|
||||
double tx_attenuation_db_;
|
||||
uint64_t freq_rf_tx_hz_;
|
||||
uint64_t freq_dds_tx_hz_;
|
||||
uint64_t freq_rf_tx_hz_;
|
||||
uint64_t tx_bandwidth_;
|
||||
size_t item_size_;
|
||||
uint32_t in_stream_;
|
||||
@ -141,15 +157,7 @@ private:
|
||||
bool enable_ovf_check_buffer_monitor_active_;
|
||||
bool dump_;
|
||||
bool rf_shutdown_;
|
||||
|
||||
// post-processing mode
|
||||
int64_t samples_;
|
||||
uint64_t samples_to_skip_;
|
||||
bool repeat_;
|
||||
uint32_t num_freq_bands_;
|
||||
uint32_t dma_buff_offset_pos_;
|
||||
|
||||
Concurrent_Queue<pmt::pmt_t> *queue_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <algorithm> // for max
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace std::string_literals;
|
||||
@ -36,30 +35,44 @@ using namespace std::string_literals;
|
||||
Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configuration,
|
||||
const std::string &role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t> *queue)
|
||||
: SignalSourceBase(configuration, role, "Fmcomms2_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
: SignalSourceBase(configuration, role, "Fmcomms2_Signal_Source"s),
|
||||
item_type_(configuration->property(role + ".item_type", std::string("gr_complex"))),
|
||||
dump_filename_(configuration->property(role + ".dump_filename", std::string("./data/signal_source.dat"))),
|
||||
uri_(configuration->property(role + ".device_address", std::string("192.168.2.1"))),
|
||||
gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)),
|
||||
gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)),
|
||||
rf_port_select_(configuration->property(role + ".rf_port_select", std::string("A_BALANCED"))),
|
||||
filter_file_(configuration->property(role + ".filter_file", std::string(""))),
|
||||
filter_filename_(configuration->property(role + ".filter_filename", filter_file_)),
|
||||
samples_(configuration->property(role + ".samples", static_cast<int64_t>(0))),
|
||||
item_size_(sizeof(gr_complex)),
|
||||
rf_gain_rx1_(configuration->property(role + ".gain_rx1", 64.0)),
|
||||
rf_gain_rx2_(configuration->property(role + ".gain_rx2", 64.0)),
|
||||
freq_(configuration->property(role + ".freq", static_cast<uint64_t>(GPS_L1_FREQ_HZ))),
|
||||
sample_rate_(configuration->property(role + ".sampling_frequency", static_cast<uint64_t>(2600000))),
|
||||
bandwidth_(configuration->property(role + ".bandwidth", static_cast<uint64_t>(2000000))),
|
||||
buffer_size_(configuration->property(role + ".buffer_size", 0xA0000)),
|
||||
Fpass_(configuration->property(role + ".Fpass", 0.0)),
|
||||
Fstop_(configuration->property(role + ".Fstop", 0.0)),
|
||||
in_stream_(in_stream),
|
||||
out_stream_(out_stream),
|
||||
RF_channels_(configuration->property(role + ".RF_channels", 1)),
|
||||
scale_dds_dbfs_(configuration->property(role + ".scale_dds_dbfs", 0.0)),
|
||||
phase_dds_deg_(configuration->property(role + ".phase_dds_deg", 0.0)),
|
||||
tx_attenuation_db_(configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db)),
|
||||
freq_dds_tx_hz_(configuration->property(role + ".freq_dds_tx_hz", static_cast<uint64_t>(10000))),
|
||||
freq_rf_tx_hz_(configuration->property(role + ".freq_rf_tx_hz", static_cast<uint64_t>(GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - freq_dds_tx_hz_))),
|
||||
tx_bandwidth_(configuration->property(role + ".tx_bandwidth", static_cast<uint64_t>(500000))),
|
||||
enable_dds_lo_(configuration->property(role + ".enable_dds_lo", false)),
|
||||
rx1_en_(configuration->property(role + ".rx1_enable", true)),
|
||||
rx2_en_(configuration->property(role + ".rx2_enable", false)),
|
||||
quadrature_(configuration->property(role + ".quadrature", true)),
|
||||
rf_dc_(configuration->property(role + ".rf_dc", true)),
|
||||
bb_dc_(configuration->property(role + ".bb_dc", true)),
|
||||
filter_auto_(configuration->property(role + ".filter_auto", false)),
|
||||
rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)),
|
||||
dump_(configuration->property(role + ".dump", false))
|
||||
{
|
||||
const std::string default_item_type("gr_complex");
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
const std::string default_gain_mode("slow_attack");
|
||||
const double default_tx_attenuation_db = -10.0;
|
||||
uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1"));
|
||||
freq_ = configuration->property(role + ".freq", static_cast<uint64_t>(GPS_L1_FREQ_HZ));
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", static_cast<uint64_t>(2600000));
|
||||
bandwidth_ = configuration->property(role + ".bandwidth", static_cast<uint64_t>(2000000));
|
||||
rx1_en_ = configuration->property(role + ".rx1_enable", true);
|
||||
rx2_en_ = configuration->property(role + ".rx2_enable", false);
|
||||
buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000);
|
||||
quadrature_ = configuration->property(role + ".quadrature", true);
|
||||
rf_dc_ = configuration->property(role + ".rf_dc", true);
|
||||
bb_dc_ = configuration->property(role + ".bb_dc", true);
|
||||
RF_channels_ = configuration->property(role + ".RF_channels", 1);
|
||||
gain_mode_rx1_ = configuration->property(role + ".gain_mode_rx1", default_gain_mode);
|
||||
gain_mode_rx2_ = configuration->property(role + ".gain_mode_rx2", default_gain_mode);
|
||||
rf_gain_rx1_ = configuration->property(role + ".gain_rx1", 64.0);
|
||||
rf_gain_rx2_ = configuration->property(role + ".gain_rx2", 64.0);
|
||||
rf_port_select_ = configuration->property(role + ".rf_port_select", std::string("A_BALANCED"));
|
||||
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||
filter_auto_ = configuration->property(role + ".filter_auto", false);
|
||||
if (filter_auto_)
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Auto"));
|
||||
@ -68,27 +81,6 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configu
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Off"));
|
||||
}
|
||||
filter_filename_ = configuration->property(role + ".filter_filename", filter_file_);
|
||||
Fpass_ = configuration->property(role + ".Fpass", 0.0);
|
||||
Fstop_ = configuration->property(role + ".Fstop", 0.0);
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
samples_ = configuration->property(role + ".samples", static_cast<int64_t>(0));
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||
|
||||
// AD9361 Local Oscillator generation for dual band operation
|
||||
enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false);
|
||||
freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", static_cast<uint64_t>(10000));
|
||||
freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", static_cast<uint64_t>(GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - freq_dds_tx_hz_));
|
||||
scale_dds_dbfs_ = configuration->property(role + ".scale_dds_dbfs", 0.0);
|
||||
phase_dds_deg_ = configuration->property(role + ".phase_dds_deg", 0.0);
|
||||
tx_attenuation_db_ = configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db);
|
||||
tx_bandwidth_ = configuration->property(role + ".tx_bandwidth", static_cast<uint64_t>(500000));
|
||||
|
||||
rf_shutdown_ = configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown);
|
||||
|
||||
item_size_ = sizeof(gr_complex);
|
||||
|
||||
// some basic checks
|
||||
if ((rf_port_select_ != "A_BALANCED") && (rf_port_select_ != "B_BALANCED") && (rf_port_select_ != "A_N") && (rf_port_select_ != "B_N") && (rf_port_select_ != "B_P") && (rf_port_select_ != "C_N") && (rf_port_select_ != "C_P") && (rf_port_select_ != "TX_MONITOR1") && (rf_port_select_ != "TX_MONITOR2") && (rf_port_select_ != "TX_MONITOR1_2"))
|
||||
@ -181,6 +173,10 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configu
|
||||
{
|
||||
LOG(FATAL) << "Configuration error: both rx1 and rx2 are enabled but RF_channels=1 !";
|
||||
}
|
||||
else if (!rx1_en_ && !rx2_en_)
|
||||
{
|
||||
LOG(FATAL) << "Configuration error: both rx1 and rx2 are disabled.";
|
||||
}
|
||||
else
|
||||
{
|
||||
#if GNURADIO_API_IIO
|
||||
|
@ -61,6 +61,9 @@ public:
|
||||
gr::basic_block_sptr get_right_block() override;
|
||||
|
||||
private:
|
||||
const std::string default_gain_mode = std::string("slow_attack");
|
||||
const double default_tx_attenuation_db = -10.0;
|
||||
|
||||
#if GNURADIO_API_IIO
|
||||
#if GR_IIO_TEMPLATIZED_API
|
||||
gr::iio::fmcomms2_source<gr_complex>::sptr fmcomms2_source_f32c_;
|
||||
@ -88,9 +91,6 @@ private:
|
||||
int64_t samples_;
|
||||
size_t item_size_;
|
||||
|
||||
unsigned int in_stream_;
|
||||
unsigned int out_stream_;
|
||||
|
||||
double rf_gain_rx1_;
|
||||
double rf_gain_rx2_;
|
||||
uint64_t freq_; // frequency of local oscilator
|
||||
@ -99,14 +99,16 @@ private:
|
||||
uint64_t buffer_size_; // reception buffer
|
||||
float Fpass_;
|
||||
float Fstop_;
|
||||
unsigned int in_stream_;
|
||||
unsigned int out_stream_;
|
||||
int RF_channels_;
|
||||
|
||||
// DDS configuration for LO generation for external mixer
|
||||
double scale_dds_dbfs_;
|
||||
double phase_dds_deg_;
|
||||
double tx_attenuation_db_;
|
||||
uint64_t freq_rf_tx_hz_;
|
||||
uint64_t freq_dds_tx_hz_;
|
||||
uint64_t freq_rf_tx_hz_;
|
||||
uint64_t tx_bandwidth_;
|
||||
bool enable_dds_lo_;
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
|
||||
#include "limesdr_signal_source.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_frequencies.h"
|
||||
#include "gnss_sdr_string_literals.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
@ -31,33 +31,25 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura
|
||||
unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Limesdr_Signal_Source"s),
|
||||
item_type_(configuration->property(role + ".item_type", std::string("gr_complex"))),
|
||||
dump_filename_(configuration->property(role + ".dump_filename", std::string("./data/signal_source.dat"))),
|
||||
limesdr_serial_(configuration->property(role + ".limesdr_serial", std::string())),
|
||||
limesdr_file_(configuration->property(role + ".limesdr_file", std::string())),
|
||||
sample_rate_(configuration->property(role + ".sampling_frequency", 2.0e6)),
|
||||
freq_(configuration->property(role + ".freq", FREQ1)),
|
||||
gain_(configuration->property(role + ".gain", 40.0)),
|
||||
analog_bw_hz_(configuration->property(role + ".analog_bw", sample_rate_ / 2.0)), // LPF analog filters in I,Q branches
|
||||
digital_bw_hz_(configuration->property(role + ".digital_bw", 0.0)), // disable by default
|
||||
ext_clock_MHz_(configuration->property(role + ".ext_clock_MHz", 0.0)), // external clock: 0.0 MHz will enable the internal clock
|
||||
samples_(configuration->property(role + ".samples", int64_t(0))),
|
||||
in_stream_(in_stream),
|
||||
out_stream_(out_stream)
|
||||
out_stream_(out_stream),
|
||||
limechannel_mode_(configuration->property(role + ".limechannel_mode", 0)),
|
||||
antenna_(configuration->property(role + ".antenna", 255)),
|
||||
channel_(configuration->property(role + ".channel", 0)),
|
||||
PPS_mode_(configuration->property(role + ".PPS_mode", false)),
|
||||
dump_(configuration->property(role + ".dump", false))
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
const std::string empty;
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
const std::string default_item_type("gr_complex");
|
||||
samples_ = configuration->property(role + ".samples", static_cast<int64_t>(0));
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||
|
||||
// Driver parameters
|
||||
channel_ = configuration->property(role + ".channel", 0);
|
||||
freq_ = configuration->property(role + ".freq", 1575420000);
|
||||
gain_ = configuration->property(role + ".gain", 40.0);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", 2.0e6);
|
||||
// todo: check if bw is within limits
|
||||
analog_bw_hz_ = configuration->property(role + ".analog_bw", sample_rate_ / 2); // LPF analog filters in I,Q branches
|
||||
digital_bw_hz_ = configuration->property(role + ".digital_bw", 0); // disable by default
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
limesdr_serial_ = configuration->property(role + ".limesdr_serial", std::string());
|
||||
limesdr_file_ = configuration->property(role + ".limesdr_file", std::string());
|
||||
antenna_ = configuration->property(role + ".antenna", 255);
|
||||
|
||||
PPS_mode_ = configuration->property(role + ".PPS_mode", false);
|
||||
ext_clock_MHz_ = configuration->property(role + ".ext_clock_MHz", 0.0); // external clock: 0.0 MHz will enable the internal clock
|
||||
limechannel_mode_ = configuration->property(role + ".limechannel_mode", 0);
|
||||
if ((limechannel_mode_ < 0) || (limechannel_mode_ > 2))
|
||||
{
|
||||
std::cerr << "ERROR: source_impl::source_impl(): ChannelMode must be A(0), B(1) or (A+B) MIMO(2)\n";
|
||||
|
@ -63,13 +63,10 @@ private:
|
||||
gnss_shared_ptr<gr::block> valve_;
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string limesdr_serial_;
|
||||
std::string limesdr_file_;
|
||||
int antenna_;
|
||||
int channel_;
|
||||
|
||||
// Front-end settings
|
||||
double sample_rate_;
|
||||
@ -85,6 +82,8 @@ private:
|
||||
unsigned int out_stream_;
|
||||
|
||||
int limechannel_mode_;
|
||||
int antenna_;
|
||||
int channel_;
|
||||
|
||||
bool PPS_mode_;
|
||||
bool dump_;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
@ -32,28 +31,22 @@ using namespace std::string_literals;
|
||||
OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Osmosdr_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
: SignalSourceBase(configuration, role, "Osmosdr_Signal_Source"s),
|
||||
item_type_(configuration->property(role + ".item_type", std::string("gr_complex"))),
|
||||
dump_filename_(configuration->property(role + ".dump_filename", std::string("./data/signal_source.dat"))),
|
||||
osmosdr_args_(configuration->property(role + ".osmosdr_args", std::string())),
|
||||
antenna_(configuration->property(role + ".antenna", std::string())),
|
||||
sample_rate_(configuration->property(role + ".sampling_frequency", 2.0e6)),
|
||||
freq_(configuration->property(role + ".freq", GPS_L1_FREQ_HZ)),
|
||||
gain_(configuration->property(role + ".gain", 40.0)),
|
||||
if_gain_(configuration->property(role + ".if_gain", 40.0)),
|
||||
rf_gain_(configuration->property(role + ".rf_gain", 40.0)),
|
||||
samples_(configuration->property(role + ".samples", static_cast<int64_t>(0))),
|
||||
in_stream_(in_stream),
|
||||
out_stream_(out_stream),
|
||||
AGC_enabled_(configuration->property(role + ".AGC_enabled", true)),
|
||||
dump_(configuration->property(role + ".dump", false))
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
const std::string empty;
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
const std::string default_item_type("gr_complex");
|
||||
samples_ = configuration->property(role + ".samples", static_cast<int64_t>(0));
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename",
|
||||
default_dump_file);
|
||||
|
||||
// OSMOSDR Driver parameters
|
||||
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
|
||||
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
||||
gain_ = configuration->property(role + ".gain", 40.0);
|
||||
rf_gain_ = configuration->property(role + ".rf_gain", 40.0);
|
||||
if_gain_ = configuration->property(role + ".if_gain", 40.0);
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", 2.0e6);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string());
|
||||
antenna_ = configuration->property(role + ".antenna", empty);
|
||||
|
||||
if (item_type_ == "short")
|
||||
{
|
||||
item_size_ = sizeof(int16_t);
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include <glog/logging.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
@ -31,23 +30,30 @@ using namespace std::string_literals;
|
||||
PlutosdrSignalSource::PlutosdrSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Plutosdr_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
: SignalSourceBase(configuration, role, "Plutosdr_Signal_Source"s),
|
||||
dump_filename_(configuration->property(role + ".dump_filename", std::string("./data/signal_source.dat"))),
|
||||
uri_(configuration->property(role + ".device_address", std::string("192.168.2.1"))),
|
||||
gain_mode_(configuration->property(role + ".gain_mode", default_gain_mode)),
|
||||
filter_file_(configuration->property(role + ".filter_file", std::string(""))),
|
||||
filter_filename_(configuration->property(role + ".filter_filename", filter_file_)),
|
||||
item_type_(configuration->property(role + ".item_type", std::string("gr_complex"))),
|
||||
rf_gain_(configuration->property(role + ".gain", 50.0)),
|
||||
samples_(configuration->property(role + ".samples", static_cast<int64_t>(0))),
|
||||
freq_(configuration->property(role + ".freq", static_cast<uint64_t>(GPS_L1_FREQ_HZ))),
|
||||
sample_rate_(configuration->property(role + ".sampling_frequency", static_cast<uint64_t>(3000000))),
|
||||
bandwidth_(configuration->property(role + ".bandwidth", static_cast<uint64_t>(2000000))),
|
||||
buffer_size_(configuration->property(role + ".buffer_size", 0xA0000)),
|
||||
item_size_(sizeof(gr_complex)),
|
||||
Fpass_(configuration->property(role + ".Fpass", 0.0)),
|
||||
Fstop_(configuration->property(role + ".Fstop", 0.0)),
|
||||
in_stream_(in_stream),
|
||||
out_stream_(out_stream),
|
||||
quadrature_(configuration->property(role + ".quadrature", true)),
|
||||
rf_dc_(configuration->property(role + ".rf_dc", true)),
|
||||
bb_dc_(configuration->property(role + ".bb_dc", true)),
|
||||
filter_auto_(configuration->property(role + ".filter_auto", false)),
|
||||
dump_(configuration->property(role + ".dump", false))
|
||||
{
|
||||
const std::string default_item_type("gr_complex");
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
const std::string default_gain_mode("slow_attack");
|
||||
uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1"));
|
||||
freq_ = configuration->property(role + ".freq", static_cast<uint64_t>(GPS_L1_FREQ_HZ));
|
||||
sample_rate_ = configuration->property(role + ".sampling_frequency", static_cast<uint64_t>(3000000));
|
||||
bandwidth_ = configuration->property(role + ".bandwidth", static_cast<uint64_t>(2000000));
|
||||
buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000);
|
||||
quadrature_ = configuration->property(role + ".quadrature", true);
|
||||
rf_dc_ = configuration->property(role + ".rf_dc", true);
|
||||
bb_dc_ = configuration->property(role + ".bb_dc", true);
|
||||
gain_mode_ = configuration->property(role + ".gain_mode", default_gain_mode);
|
||||
rf_gain_ = configuration->property(role + ".gain", 50.0);
|
||||
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||
filter_auto_ = configuration->property(role + ".filter_auto", false);
|
||||
if (filter_auto_)
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Auto"));
|
||||
@ -56,13 +62,6 @@ PlutosdrSignalSource::PlutosdrSignalSource(const ConfigurationInterface* configu
|
||||
{
|
||||
filter_source_ = configuration->property(role + ".filter_source", std::string("Off"));
|
||||
}
|
||||
filter_filename_ = configuration->property(role + ".filter_filename", filter_file_);
|
||||
Fpass_ = configuration->property(role + ".Fpass", 0.0);
|
||||
Fstop_ = configuration->property(role + ".Fstop", 0.0);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
samples_ = configuration->property(role + ".samples", static_cast<int64_t>(0));
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||
|
||||
if (item_type_ != "gr_complex")
|
||||
{
|
||||
@ -117,8 +116,6 @@ PlutosdrSignalSource::PlutosdrSignalSource(const ConfigurationInterface* configu
|
||||
LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=2000000";
|
||||
}
|
||||
|
||||
item_size_ = sizeof(gr_complex);
|
||||
|
||||
std::cout << "device address: " << uri_ << '\n';
|
||||
std::cout << "frequency : " << freq_ << " Hz\n";
|
||||
std::cout << "sample rate: " << sample_rate_ << " Sps\n";
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
gr::basic_block_sptr get_right_block() override;
|
||||
|
||||
private:
|
||||
const std::string default_gain_mode = std::string("slow_attack");
|
||||
#if GR_IIO_TEMPLATIZED_API
|
||||
gr::iio::fmcomms2_source<gr_complex>::sptr plutosdr_source_;
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user