1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-26 15:03:14 +00:00

Allow a receiver compiled with -DENABLE_FPGA=ON to execute regular flowgraphs

This commit is contained in:
Carles Fernandez 2021-02-23 16:48:18 +01:00
parent 3ec9749852
commit df8cdc678d
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 51 additions and 32 deletions

View File

@ -75,6 +75,7 @@ GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configurati
configuration_ = std::move(configuration); configuration_ = std::move(configuration);
queue_ = std::move(queue); queue_ = std::move(queue);
multiband_ = GNSSFlowgraph::is_multiband(); multiband_ = GNSSFlowgraph::is_multiband();
enable_fpga_offloading_ = configuration_->property("GNSS-SDR.enable_FPGA", false);
init(); init();
} }
@ -107,8 +108,8 @@ void GNSSFlowgraph::init()
{ {
std::cout << "Creating source " << i << '\n'; std::cout << "Creating source " << i << '\n';
sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), i)); sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), i));
#if ENABLE_FPGA if (enable_fpga_offloading_ == false)
#else {
auto& src = sig_source_.back(); auto& src = sig_source_.back();
auto RF_Channels = src->getRfChannels(); auto RF_Channels = src->getRfChannels();
std::cout << "RF Channels " << RF_Channels << '\n'; std::cout << "RF Channels " << RF_Channels << '\n';
@ -117,7 +118,7 @@ void GNSSFlowgraph::init()
sig_conditioner_.push_back(block_factory->GetSignalConditioner(configuration_.get(), signal_conditioner_ID)); sig_conditioner_.push_back(block_factory->GetSignalConditioner(configuration_.get(), signal_conditioner_ID));
signal_conditioner_ID++; signal_conditioner_ID++;
} }
#endif }
} }
if (!sig_conditioner_.empty()) if (!sig_conditioner_.empty())
{ {
@ -247,13 +248,14 @@ void GNSSFlowgraph::start()
return; return;
} }
#if ENABLE_FPGA if (enable_fpga_offloading_ == true)
{
// start the DMA if the receiver is in post-processing mode // start the DMA if the receiver is in post-processing mode
if (configuration_->property(sig_source_.at(0)->role() + ".switch_position", 0) == 0) if (configuration_->property(sig_source_.at(0)->role() + ".switch_position", 0) == 0)
{ {
sig_source_.at(0)->start(); sig_source_.at(0)->start();
} }
#endif }
running_ = true; running_ = true;
} }
@ -266,10 +268,12 @@ void GNSSFlowgraph::stop()
chan->stop_channel(); // stop the acquisition or tracking operation chan->stop_channel(); // stop the acquisition or tracking operation
} }
top_block_->stop(); top_block_->stop();
#if ENABLE_FPGA
#else if (enable_fpga_offloading_ == false)
{
top_block_->wait(); top_block_->wait();
#endif }
running_ = false; running_ = false;
} }
@ -298,12 +302,24 @@ void GNSSFlowgraph::connect()
} }
#if ENABLE_FPGA #if ENABLE_FPGA
if (enable_fpga_offloading_ == true)
{
if (connect_fpga_flowgraph() != 0) if (connect_fpga_flowgraph() != 0)
{ {
LOG(ERROR) << "Unable to connect flowgraph with FPFA off-loading"; LOG(ERROR) << "Unable to connect flowgraph with FPFA off-loading";
print_help(); print_help();
return; return;
} }
}
else
{
if (connect_desktop_flowgraph() != 0)
{
LOG(ERROR) << "Unable to connect flowgraph";
print_help();
return;
}
}
#else #else
if (connect_desktop_flowgraph() != 0) if (connect_desktop_flowgraph() != 0)
{ {
@ -331,10 +347,20 @@ void GNSSFlowgraph::disconnect()
connected_ = false; connected_ = false;
#if ENABLE_FPGA #if ENABLE_FPGA
if (enable_fpga_offloading_ == true)
{
if (disconnect_fpga_flowgraph() != 0) if (disconnect_fpga_flowgraph() != 0)
{ {
return; return;
} }
}
else
{
if (disconnect_desktop_flowgraph() != 0)
{
return;
}
}
#else #else
if (disconnect_desktop_flowgraph() != 0) if (disconnect_desktop_flowgraph() != 0)
{ {
@ -348,9 +374,6 @@ void GNSSFlowgraph::disconnect()
int GNSSFlowgraph::connect_desktop_flowgraph() int GNSSFlowgraph::connect_desktop_flowgraph()
{ {
#if ENABLE_FPGA
return 0;
#else
// Connect blocks to the top_block // Connect blocks to the top_block
if (connect_signal_sources() != 0) if (connect_signal_sources() != 0)
{ {
@ -429,15 +452,11 @@ int GNSSFlowgraph::connect_desktop_flowgraph()
LOG(INFO) << "The GNU Radio flowgraph for the current GNSS-SDR configuration has been successfully connected"; LOG(INFO) << "The GNU Radio flowgraph for the current GNSS-SDR configuration has been successfully connected";
return 0; return 0;
#endif
} }
int GNSSFlowgraph::disconnect_desktop_flowgraph() int GNSSFlowgraph::disconnect_desktop_flowgraph()
{ {
#if ENABLE_FPGA
return 0;
#else
// Disconnect blocks between them // Disconnect blocks between them
if (disconnect_signal_sources_from_signal_conditioners() != 0) if (disconnect_signal_sources_from_signal_conditioners() != 0)
{ {
@ -496,7 +515,6 @@ int GNSSFlowgraph::disconnect_desktop_flowgraph()
} }
return 0; return 0;
#endif
} }

View File

@ -297,6 +297,7 @@ private:
bool enable_monitor_; bool enable_monitor_;
bool enable_acquisition_monitor_; bool enable_acquisition_monitor_;
bool enable_tracking_monitor_; bool enable_tracking_monitor_;
bool enable_fpga_offloading_;
}; };