From 453c0cd2494b578131cc2ed7685eb241a9cc384a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 28 Sep 2019 21:59:05 +0200 Subject: [PATCH 01/11] Inject file(s) via DMA if switch_position=0 in Ad9361_Fpga_Signal_Source --- .../adapters/ad9361_fpga_signal_source.cc | 334 ++++++++++++++++-- .../adapters/ad9361_fpga_signal_source.h | 10 +- 2 files changed, 310 insertions(+), 34 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index f63a1ba81..dbad2d35b 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -37,13 +37,242 @@ #include "configuration_interface.h" #include #include +#include // for assert #include +#include // for open, O_WRONLY +#include // for std::ifstream #include // for cout, endl +#include +#include // for write #include +#include -Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration, - const std::string& role, unsigned int in_stream, unsigned int out_stream, +void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2) +{ + const int MAX_INPUT_SAMPLES_TOTAL = 8192; + int max_value = 0; + int tx_fd; // DMA descriptor + std::ifstream infile1; + infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); + + try + { + infile1.open(Filename1, std::ios::binary); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception opening file " << Filename1 << std::endl; + return; + } + + std::ifstream infile2; + infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit); + try + { + infile2.open(Filename2, std::ios::binary); + } + catch (const std::ifstream::failure &e) + { + // could not exist + } + + // rx signal + std::vector input_samples(MAX_INPUT_SAMPLES_TOTAL * 2); + std::vector input_samples2(MAX_INPUT_SAMPLES_TOTAL * 2); + std::vector input_samples_dma(MAX_INPUT_SAMPLES_TOTAL * 2 * 2); + + int nread_elements; + int nread_elements2; + int file_completed = 0; + int num_transferred_bytes; + + //************************************************************************** + // Open DMA device + //************************************************************************** + tx_fd = open("/dev/loop_tx", O_WRONLY); + if (tx_fd < 0) + { + std::cout << "Cannot open loop device" << std::endl; + return; + } + + //************************************************************************** + // Open input file + //************************************************************************** + int nsamples = 0; + + while (file_completed == 0) + { + unsigned int dma_index = 0; + + if (FreqBand == "L1") + { + try + { + infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << Filename1 << std::endl; + } + if (infile1) + { + nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; + } + else + { + nread_elements = 0; + } + nsamples += (nread_elements / 2); + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + // channel 1 (queue 1) + input_samples_dma[dma_index] = 0; + input_samples_dma[dma_index + 1] = 0; + // channel 0 (queue 0) + input_samples_dma[dma_index + 2] = input_samples[index0]; + input_samples_dma[dma_index + 3] = input_samples[index0 + 1]; + + dma_index += 4; + } + } + else if (FreqBand == "L2") + { + try + { + infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << Filename1 << std::endl; + } + if (infile1) + { + nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; + } + else + { + nread_elements = 0; + } + nsamples += (nread_elements / 2); + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + // channel 1 (queue 1) + input_samples_dma[dma_index] = input_samples[index0]; + input_samples_dma[dma_index + 1] = input_samples[index0 + 1]; + // channel 0 (queue 0) + input_samples_dma[dma_index + 2] = 0; + input_samples_dma[dma_index + 3] = 0; + + dma_index += 4; + } + } + else if (FreqBand == "L1L2") + { + try + { + infile1.read(reinterpret_cast(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << Filename1 << std::endl; + } + if (infile1) + { + nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2; + } + else + { + nread_elements = 0; + } + try + { + infile2.read(reinterpret_cast(input_samples2.data()), MAX_INPUT_SAMPLES_TOTAL * 2); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << Filename1 << std::endl; + } + if (infile2) + { + nread_elements2 = MAX_INPUT_SAMPLES_TOTAL * 2; + } + else + { + nread_elements2 = 0; + } + + if (nread_elements > nread_elements2) + { + nread_elements = nread_elements2; // take the smallest + } + + nsamples += (nread_elements / 2); + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + input_samples[index0] = input_samples[index0]; + input_samples[index0 + 1] = input_samples[index0 + 1]; + + if (input_samples[index0] > max_value) + { + max_value = input_samples[index0]; + } + else if (-input_samples[index0] > max_value) + { + max_value = -input_samples[index0]; + } + + if (input_samples[index0 + 1] > max_value) + { + max_value = input_samples[index0 + 1]; + } + else if (-input_samples[index0 + 1] > max_value) + { + max_value = -input_samples[index0 + 1]; + } + + // channel 1 (queue 1) + input_samples_dma[dma_index] = input_samples2[index0]; + input_samples_dma[dma_index + 1] = input_samples2[index0 + 1]; + // channel 0 (queue 0) + input_samples_dma[dma_index + 2] = input_samples[index0]; + input_samples_dma[dma_index + 3] = input_samples[index0 + 1]; + + dma_index += 4; + } + } + + if (nread_elements > 0) + { + num_transferred_bytes = nread_elements * 2; + assert(num_transferred_bytes == + write(tx_fd, input_samples_dma.data(), nread_elements * 2)); + } + + if (nread_elements != MAX_INPUT_SAMPLES_TOTAL * 2) + { + file_completed = 1; + } + } + + try + { + infile1.close(); + infile2.close(); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception closing files " << Filename1 << " and " << Filename2 << std::endl; + } +} + + +Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_dump_file = "./data/signal_source.dat"; @@ -74,38 +303,74 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configura phase_dds_deg_ = configuration->property(role + ".phase_dds_deg", 0.0); tx_attenuation_db_ = configuration->property(role + ".tx_attenuation_db", 0.0); - item_size_ = sizeof(gr_complex); - - std::cout << "device address: " << uri_ << std::endl; - std::cout << "LO frequency : " << freq_ << " Hz" << std::endl; - std::cout << "sample rate: " << sample_rate_ << " Hz" << std::endl; - - config_ad9361_rx_local(bandwidth_, - sample_rate_, - freq_, - rf_port_select_, - gain_mode_rx1_, - gain_mode_rx2_, - rf_gain_rx1_, - rf_gain_rx2_); - - // LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION - if (enable_dds_lo_ == true) - { - config_ad9361_lo_local(bandwidth_, - sample_rate_, - freq_rf_tx_hz_, - tx_attenuation_db_, - freq_dds_tx_hz_, - scale_dds_dbfs_); - } - // turn switch to A/D position std::string default_device_name = "/dev/uio1"; std::string device_name = configuration->property(role + ".devicename", default_device_name); - int32_t switch_position = configuration->property(role + ".switch_position", 0); + switch_position = configuration->property(role + ".switch_position", 0); switch_fpga = std::make_shared(device_name); switch_fpga->set_switch_position(switch_position); + + item_size_ = sizeof(gr_complex); + + std::cout << "Sample rate: " << sample_rate_ << " Sps" << std::endl; + + if (switch_position == 0) // Inject file(s) via DMA + { + std::string empty_string; + filename_rx1 = configuration->property(role + ".filename_rx1", empty_string); + filename_rx2 = configuration->property(role + ".filename_rx2", empty_string); + int l1_band = configuration->property("Channels_1C.count", 0) + + configuration->property("Channels_1B.count", 0) + + configuration->property("Channels_L5.count", 0) + + configuration->property("Channels_2S.count", 0) + + configuration->property("Channels_5X.count", 0); + + int l2_band = configuration->property("Channels_L5.count", 0) * configuration->property("Channels_1C.count", 0) + + configuration->property("Channels_5X.count", 0) * configuration->property("Channels_1B.count", 0) + + configuration->property("Channels_2S.count", 0) * configuration->property("Channels_1C.count", 0); + + if (l1_band != 0) + { + freq_band = "L1"; + } + if (l2_band != 0 && l1_band == 0) + { + freq_band = "L2"; + } + if (l1_band != 0 && l2_band != 0) + { + freq_band = "L1L2"; + } + + thread_file_to_dma = std::thread([&] { run_DMA_process(freq_band, filename_rx1, filename_rx2); }); + } + if (switch_position == 2) // Real-time via AD9361 + { + std::cout << "LO frequency : " << freq_ << " Hz" << std::endl; + config_ad9361_rx_local(bandwidth_, + sample_rate_, + freq_, + rf_port_select_, + gain_mode_rx1_, + gain_mode_rx2_, + rf_gain_rx1_, + rf_gain_rx2_); + + // LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION + if (enable_dds_lo_ == true) + { + config_ad9361_lo_local(bandwidth_, + sample_rate_, + freq_rf_tx_hz_, + tx_attenuation_db_, + freq_dds_tx_hz_, + scale_dds_dbfs_); + } + } + 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" << std::endl; + } if (in_stream_ > 0) { LOG(ERROR) << "A signal source does not have an input stream"; @@ -130,12 +395,18 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() { ad9361_disable_lo_local(); } - catch (const std::exception& e) + catch (const std::exception &e) { LOG(WARNING) << "Problem closing the Ad9361FpgaSignalSource: " << e.what(); } } - + if (switch_position == 0) // read samples from a file via DMA + { + if (thread_file_to_dma.joinable()) + { + thread_file_to_dma.join(); + } + } // std::cout<<"* AD9361 Destroying context\n"; // if (ctx) { iio_context_destroy(ctx); } } @@ -168,6 +439,5 @@ gr::basic_block_sptr Ad9361FpgaSignalSource::get_left_block() gr::basic_block_sptr Ad9361FpgaSignalSource::get_right_block() { - LOG(WARNING) << "Trying to get AD9361 FPGA signal source right block."; return gr::basic_block_sptr(); } diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index 114351788..04d0ccb75 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -40,6 +40,7 @@ #include #include #include +#include class ConfigurationInterface; @@ -79,8 +80,7 @@ private: std::string role_; // Front-end settings - std::string uri_; // device direction - uint64_t freq_; // frequency of local oscillator + uint64_t freq_; // frequency of local oscillator uint64_t sample_rate_; uint64_t bandwidth_; uint64_t buffer_size_; // reception buffer @@ -116,6 +116,12 @@ private: std::shared_ptr> queue_; std::shared_ptr switch_fpga; + int32_t switch_position; + + std::thread thread_file_to_dma; + std::string filename_rx1; + std::string filename_rx2; + std::string freq_band; }; #endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_ From 03cc2698bdc7a9cefc5313ceee37f7b08014f4bf Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 1 Oct 2019 15:53:45 +0200 Subject: [PATCH 02/11] removed the assert() function, which did not work properly. --- .../adapters/ad9361_fpga_signal_source.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index dbad2d35b..43fd56874 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -37,12 +37,11 @@ #include "configuration_interface.h" #include #include -#include // for assert #include #include // for open, O_WRONLY #include // for std::ifstream #include // for cout, endl -#include +#include // for string manipulation #include // for write #include #include @@ -249,8 +248,11 @@ void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, if (nread_elements > 0) { num_transferred_bytes = nread_elements * 2; - assert(num_transferred_bytes == - write(tx_fd, input_samples_dma.data(), nread_elements * 2)); + int num_bytes_sent = write(tx_fd, input_samples_dma.data(), nread_elements * 2); + if (num_bytes_sent != num_transferred_bytes) + { + std::cerr << "Error: DMA could not send all the required samples " << std::endl; + } } if (nread_elements != MAX_INPUT_SAMPLES_TOTAL * 2) From d379a3ed6cea4601d2887b1d9b9ededf69424c00 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 1 Oct 2019 16:01:44 +0200 Subject: [PATCH 03/11] When using the FPGA, the Ad9361FpgaSignalSource is instantiated after the acquisition and tracking classes. In this way, when using the receiver in post-processing mode, when the DMA starts sending signal samples to the receiver, the acquisition and tracking classes are already configured and ready. --- src/core/receiver/gnss_block_factory.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 08c7f47ee..43cc4794b 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -1446,15 +1446,6 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif -#if AD9361_DRIVER - else if (implementation == "Ad9361_Fpga_Signal_Source") - { - std::unique_ptr block_(new Ad9361FpgaSignalSource(configuration.get(), role, in_streams, - out_streams, queue)); - block = std::move(block_); - } -#endif - #if FLEXIBAND_DRIVER else if (implementation == "Flexiband_Signal_Source") { @@ -1927,6 +1918,18 @@ std::unique_ptr GNSSBlockFactory::GetBlock( out_streams)); block = std::move(block_); } + +#if AD9361_DRIVER + // The AD9361_DRIVER Driver is instantiated last. In this way, when using the FPGA, and when using the GNSS receiver + // in post-processing mode, the receiver is configured and ready when the DMA starts sending samples to the receiver. + else if (implementation == "Ad9361_Fpga_Signal_Source") + { + std::unique_ptr block_(new Ad9361FpgaSignalSource(configuration.get(), role, in_streams, + out_streams, queue)); + block = std::move(block_); + } +#endif + else { // Log fatal. This causes execution to stop. From b932c5ef98b5b275b21c57d54d199bca627db141 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 1 Oct 2019 22:26:30 +0200 Subject: [PATCH 04/11] added the enable_DMA_ flag, which is used to stop the DMA when the user quits gnss-sdr, and the receiver is using the FPGA and the receiver is working in post-processing mode. --- .../adapters/ad9361_fpga_signal_source.cc | 12 ++++++++---- .../adapters/ad9361_fpga_signal_source.h | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 43fd56874..7726a32bb 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -47,7 +47,7 @@ #include -void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2) +void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2, const bool &enable_DMA) { const int MAX_INPUT_SAMPLES_TOTAL = 8192; int max_value = 0; @@ -101,7 +101,7 @@ void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, //************************************************************************** int nsamples = 0; - while (file_completed == 0) + while ((file_completed == 0) && (enable_DMA == true)) { unsigned int dma_index = 0; @@ -318,6 +318,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura if (switch_position == 0) // Inject file(s) via DMA { + enable_DMA_ = true; std::string empty_string; filename_rx1 = configuration->property(role + ".filename_rx1", empty_string); filename_rx2 = configuration->property(role + ".filename_rx2", empty_string); @@ -344,7 +345,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura freq_band = "L1L2"; } - thread_file_to_dma = std::thread([&] { run_DMA_process(freq_band, filename_rx1, filename_rx2); }); + thread_file_to_dma = std::thread([&] { run_DMA_process(freq_band, filename_rx1, filename_rx2, enable_DMA_); }); } if (switch_position == 2) // Real-time via AD9361 { @@ -387,10 +388,13 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() { /* cleanup and exit */ - // std::cout<<"* AD9361 Disabling streaming channels\n"; + + // std::cout<<"* AD9361 Disabling streaming channels\n"; // if (rx0_i) { iio_channel_disable(rx0_i); } // if (rx0_q) { iio_channel_disable(rx0_q); } + enable_DMA_ = false; // disable the DMA + if (enable_dds_lo_) { try diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index 04d0ccb75..c2742a4d0 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -122,6 +122,8 @@ private: std::string filename_rx1; std::string filename_rx2; std::string freq_band; + + bool enable_DMA_; }; #endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_ From e9470f566e7ab5d89fa7eaa14091ddc26e0dbd1f Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 1 Oct 2019 23:13:28 +0200 Subject: [PATCH 05/11] fixed L1 and L2/L5 frequency band selection. --- .../adapters/ad9361_fpga_signal_source.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 7726a32bb..ed8f6c52c 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -323,14 +323,11 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura filename_rx1 = configuration->property(role + ".filename_rx1", empty_string); filename_rx2 = configuration->property(role + ".filename_rx2", empty_string); int l1_band = configuration->property("Channels_1C.count", 0) + - configuration->property("Channels_1B.count", 0) + - configuration->property("Channels_L5.count", 0) + - configuration->property("Channels_2S.count", 0) + - configuration->property("Channels_5X.count", 0); + configuration->property("Channels_1B.count", 0); - int l2_band = configuration->property("Channels_L5.count", 0) * configuration->property("Channels_1C.count", 0) + - configuration->property("Channels_5X.count", 0) * configuration->property("Channels_1B.count", 0) + - configuration->property("Channels_2S.count", 0) * configuration->property("Channels_1C.count", 0); + int l2_band = configuration->property("Channels_L5.count", 0) + + configuration->property("Channels_5X.count", 0) + + configuration->property("Channels_2S.count", 0); if (l1_band != 0) { From 3a9e48c31c8260297b68a055057ec116fabb503a Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 1 Oct 2019 23:44:07 +0200 Subject: [PATCH 06/11] applied clang-format --- .../adapters/ad9361_fpga_signal_source.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index ed8f6c52c..7011be188 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -41,7 +41,7 @@ #include // for open, O_WRONLY #include // for std::ifstream #include // for cout, endl -#include // for string manipulation +#include // for string manipulation #include // for write #include #include @@ -248,11 +248,11 @@ void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, if (nread_elements > 0) { num_transferred_bytes = nread_elements * 2; - int num_bytes_sent = write(tx_fd, input_samples_dma.data(), nread_elements * 2); - if (num_bytes_sent != num_transferred_bytes) - { - std::cerr << "Error: DMA could not send all the required samples " << std::endl; - } + int num_bytes_sent = write(tx_fd, input_samples_dma.data(), nread_elements * 2); + if (num_bytes_sent != num_transferred_bytes) + { + std::cerr << "Error: DMA could not send all the required samples " << std::endl; + } } if (nread_elements != MAX_INPUT_SAMPLES_TOTAL * 2) @@ -318,7 +318,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura if (switch_position == 0) // Inject file(s) via DMA { - enable_DMA_ = true; + enable_DMA_ = true; std::string empty_string; filename_rx1 = configuration->property(role + ".filename_rx1", empty_string); filename_rx2 = configuration->property(role + ".filename_rx2", empty_string); @@ -386,11 +386,11 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() { /* cleanup and exit */ - // std::cout<<"* AD9361 Disabling streaming channels\n"; + // std::cout<<"* AD9361 Disabling streaming channels\n"; // if (rx0_i) { iio_channel_disable(rx0_i); } // if (rx0_q) { iio_channel_disable(rx0_q); } - enable_DMA_ = false; // disable the DMA + enable_DMA_ = false; // disable the DMA if (enable_dds_lo_) { From d20284fbc01faa40142518604ec3265b85f6f142 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 24 Sep 2019 19:52:14 +0200 Subject: [PATCH 07/11] removed unused parameters --- .../adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc | 3 --- .../acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc | 4 ---- .../acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc | 3 --- .../acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc | 2 -- .../acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc | 3 --- .../acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc | 2 +- .../acquisition/gnuradio_blocks/pcps_acquisition_fpga.h | 3 --- src/algorithms/acquisition/libs/fpga_acquisition.cc | 1 - src/algorithms/acquisition/libs/fpga_acquisition.h | 1 - .../signal_source/adapters/ad9361_fpga_signal_source.cc | 4 ---- .../signal_source/adapters/ad9361_fpga_signal_source.h | 2 -- 11 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 75d217e8f..23adf89d6 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -74,8 +74,6 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; - uint32_t sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 4); - acq_parameters.sampled_ms = sampled_ms; acquire_pilot_ = configuration_->property(role + ".acquire_pilot", false); // could be true in future versions @@ -92,7 +90,6 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( std::string default_device_name = "/dev/uio0"; std::string device_name = configuration_->property(role + ".devicename", default_device_name); acq_parameters.device_name = device_name; - acq_parameters.samples_per_ms = nsamples_total / sampled_ms; acq_parameters.samples_per_code = nsamples_total; acq_parameters.excludelimit = static_cast(1 + ceil((1.0 / GALILEO_E1_CODE_CHIP_RATE_CPS) * static_cast(fs_in))); diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 87e7dd699..9f5ede948 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -72,9 +72,6 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; - uint32_t sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1); - acq_parameters.sampled_ms = sampled_ms; - acq_pilot_ = configuration_->property(role + ".acquire_pilot", false); acq_iq_ = configuration_->property(role + ".acquire_iq", false); if (acq_iq_) @@ -93,7 +90,6 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf std::string default_device_name = "/dev/uio0"; std::string device_name = configuration_->property(role + ".devicename", default_device_name); acq_parameters.device_name = device_name; - acq_parameters.samples_per_ms = nsamples_total / sampled_ms; acq_parameters.samples_per_code = nsamples_total; acq_parameters.excludelimit = static_cast(1 + ceil((1.0 / GALILEO_E5A_CODE_CHIP_RATE_CPS) * static_cast(fs_in))); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 9775dd08d..44f19fae4 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -73,8 +73,6 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; - uint32_t sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1); - acq_parameters.sampled_ms = sampled_ms; auto code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); acq_parameters.code_length = code_length; // The FPGA can only use FFT lengths that are a power of two. @@ -85,7 +83,6 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( std::string default_device_name = "/dev/uio0"; std::string device_name = configuration_->property(role + ".devicename", default_device_name); acq_parameters.device_name = device_name; - acq_parameters.samples_per_ms = nsamples_total / sampled_ms; acq_parameters.samples_per_code = nsamples_total; acq_parameters.excludelimit = static_cast(1 + ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast(fs_in))); diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index daf8c20d5..a4a01b27e 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -71,7 +71,6 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; - acq_parameters.sampled_ms = 20; unsigned int code_length = std::round(static_cast(fs_in_) / (GPS_L2_M_CODE_RATE_CPS / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS))); acq_parameters.code_length = code_length; // The FPGA can only use FFT lengths that are a power of two. @@ -82,7 +81,6 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( std::string default_device_name = "/dev/uio0"; std::string device_name = configuration_->property(role + ".devicename", default_device_name); acq_parameters.device_name = device_name; - acq_parameters.samples_per_ms = nsamples_total / acq_parameters.sampled_ms; acq_parameters.samples_per_code = nsamples_total; acq_parameters.downsampling_factor = configuration_->property(role + ".downsampling_factor", 1.0); diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 15e615624..8b50c1caf 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -75,8 +75,6 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; - uint32_t sampled_ms = configuration_->property(role + ".coherent_integration_time_ms", 1); - acq_parameters.sampled_ms = sampled_ms; // -- Find number of samples per spreading code ------------------------- auto code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L5I_CODE_RATE_CPS / static_cast(GPS_L5I_CODE_LENGTH_CHIPS)))); @@ -89,7 +87,6 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( std::string default_device_name = "/dev/uio0"; std::string device_name = configuration_->property(role + ".devicename", default_device_name); acq_parameters.device_name = device_name; - acq_parameters.samples_per_ms = nsamples_total / sampled_ms; acq_parameters.samples_per_code = nsamples_total; acq_parameters.excludelimit = static_cast(1 + ceil((1.0 / GPS_L5I_CODE_RATE_CPS) * static_cast(fs_in))); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index e3b1aadc9..494c137c4 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -79,7 +79,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) d_max_num_acqs = acq_parameters.max_num_acqs; acquisition_fpga = std::make_shared(acq_parameters.device_name, acq_parameters.code_length, acq_parameters.doppler_max, d_fft_size, - acq_parameters.fs_in, acq_parameters.sampled_ms, acq_parameters.select_queue_Fpga, acq_parameters.all_fft_codes, acq_parameters.excludelimit); + acq_parameters.fs_in, acq_parameters.select_queue_Fpga, acq_parameters.all_fft_codes, acq_parameters.excludelimit); } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index 88106ef3f..ee97a7502 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -54,16 +54,13 @@ class Gnss_Synchro; typedef struct { /* pcps acquisition configuration */ - uint32_t sampled_ms; uint32_t doppler_max; int64_t fs_in; - int32_t samples_per_ms; int32_t samples_per_code; int32_t code_length; uint32_t select_queue_Fpga; std::string device_name; uint32_t* all_fft_codes; // pointer to memory that contains all the code ffts - // float downsampling_factor; uint32_t downsampling_factor; uint32_t total_block_exp; uint32_t excludelimit; diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index 00c176730..bf4ebe98d 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -63,7 +63,6 @@ Fpga_Acquisition::Fpga_Acquisition(std::string device_name, uint32_t doppler_max, uint32_t nsamples_total, int64_t fs_in, - uint32_t sampled_ms __attribute__((unused)), uint32_t select_queue, uint32_t *all_fft_codes, uint32_t excludelimit) diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.h b/src/algorithms/acquisition/libs/fpga_acquisition.h index 507a9ae77..e7097b11d 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.h +++ b/src/algorithms/acquisition/libs/fpga_acquisition.h @@ -54,7 +54,6 @@ public: uint32_t doppler_max, uint32_t nsamples_total, int64_t fs_in, - uint32_t sampled_ms, uint32_t select_queue, uint32_t *all_fft_codes, uint32_t excludelimit); diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 7011be188..2a056d367 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -277,7 +277,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura const std::string &role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { - std::string default_dump_file = "./data/signal_source.dat"; freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ); sample_rate_ = configuration->property(role + ".sampling_frequency", 12500000); bandwidth_ = configuration->property(role + ".bandwidth", 12500000); @@ -295,9 +294,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configura filter_file_ = configuration->property(role + ".filter_file", std::string("")); filter_auto_ = configuration->property(role + ".filter_auto", true); samples_ = configuration->property(role + ".samples", 0); - dump_ = configuration->property(role + ".dump", false); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false); freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - 1000); freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", 1000); diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index c2742a4d0..dd807308d 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -110,8 +110,6 @@ private: size_t item_size_; long samples_; - bool dump_; - std::string dump_filename_; std::shared_ptr> queue_; From f2b2eb2f1a63db35087740c1c92391051f37236a Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 2 Oct 2019 15:53:57 +0200 Subject: [PATCH 08/11] replaced .device_base by .dev_file_num parameter. The .dev_file_num parameter points for each type of GNSS signal, the number of the first uio device file that is used for the tracking process. --- .../galileo_e1_dll_pll_veml_tracking_fpga.cc | 9 +++++++-- .../adapters/galileo_e5a_dll_pll_tracking_fpga.cc | 10 ++++++++-- .../adapters/gps_l1_ca_dll_pll_tracking_fpga.cc | 7 +++++-- .../adapters/gps_l2_m_dll_pll_tracking_fpga.cc | 15 ++++++--------- .../adapters/gps_l5_dll_pll_tracking_fpga.cc | 8 ++++++-- .../gnuradio_blocks/dll_pll_veml_tracking_fpga.cc | 5 +++-- src/algorithms/tracking/libs/dll_pll_conf_fpga.cc | 3 ++- src/algorithms/tracking/libs/dll_pll_conf_fpga.h | 3 ++- .../tracking/libs/fpga_multicorrelator.cc | 8 +++++--- .../tracking/libs/fpga_multicorrelator.h | 6 ++++-- 10 files changed, 48 insertions(+), 26 deletions(-) diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index 9b6f31a03..c00089830 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -181,8 +181,13 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - int32_t device_base = configuration->property(role + ".device_base", 15); - trk_param_fpga.device_base = device_base; + // obtain the number of the first uio device file that is assigned to the FPGA E1 tracking multicorrelator HW accelerators + trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 15); + // compute the number of tracking channels that have already been instantiated. The order in which + // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a + trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + + configuration->property("Channels_2S.count", 0) + + configuration->property("Channels_L5.count", 0); //################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 2; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index 397377f64..cf8697038 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -176,8 +176,14 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - int32_t device_base = configuration->property(role + ".device_base", 27); - trk_param_fpga.device_base = device_base; + // obtain the number of the first uio device file that is assigned to the FPGA E5a tracking multicorrelator HW accelerators + trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 38); + // compute the number of tracking channels that have already been instantiated. The order in which + // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a + trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + + configuration->property("Channels_2S.count", 0) + + configuration->property("Channels_L5.count", 0) + + configuration->property("Channels_1B.count", 0); // ################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 1; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index 399b6113b..a3f74dc42 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -182,8 +182,11 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - int32_t device_base = configuration->property(role + ".device_base", 3); - trk_param_fpga.device_base = device_base; + // obtain the number of the first uio device file that is assigned to the FPGA L1 tracking multicorrelator HW accelerators + trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 3); + // compute the number of tracking channels that have already been instantiated. The order in which + // GNSS-SDR instantiates the tracking channels i L1, l2, L5, E1, E5a + trk_param_fpga.num_prev_assigned_ch = 0; // ################# PRE-COMPUTE ALL THE CODES ################# d_ca_codes = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS * NUM_PRNs) * sizeof(int32_t), volk_gnsssdr_get_alignment())); diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index 310667eb7..4e1a7508e 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -107,19 +107,16 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); - // int32_t max_lock_fail = configuration->property(role + ".max_lock_fail", 50); - // if (FLAGS_max_lock_fail != 50) - // { - // max_lock_fail = FLAGS_max_lock_fail; - // } - // trk_param_fpga.max_lock_fail = max_lock_fail; - // FPGA configuration parameters std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - unsigned int device_base = configuration->property(role + ".device_base", 1); - trk_param_fpga.device_base = device_base; + // obtain the number of the first uio device file that is assigned to the FPGA L2 tracking multicorrelator HW accelerators + trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); + // compute the number of tracking channels that have already been instantiated. The order in which + // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a + trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0); + auto* ca_codes_f = static_cast(volk_gnsssdr_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(float), volk_gnsssdr_get_alignment())); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 507d475f0..0f59ba5ea 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -175,8 +175,12 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - int32_t device_base = configuration->property(role + ".device_base", 27); - trk_param_fpga.device_base = device_base; + // obtain the number of the first uio device file that is assigned to the FPGA L5 tracking multicorrelator HW accelerators + trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); + // compute the number of tracking channels that have already been instantiated. The order in which + // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a + trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + + configuration->property("Channels_2S.count", 0); // tracking lock tests smoother parameters trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 5f85b0c16..bbd67ecf5 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -453,10 +453,11 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & } // create multicorrelator class std::string device_name = trk_parameters.device_name; - int32_t device_base = trk_parameters.device_base; + uint32_t dev_file_num = trk_parameters.dev_file_num; + uint32_t num_prev_assigned_ch = trk_parameters.num_prev_assigned_ch; int32_t *ca_codes = trk_parameters.ca_codes; int32_t *data_codes = trk_parameters.data_codes; - multicorrelator_fpga = std::make_shared(d_n_correlator_taps, device_name, device_base, ca_codes, data_codes, d_code_length_chips, trk_parameters.track_pilot, d_code_samples_per_chip); + multicorrelator_fpga = std::make_shared(d_n_correlator_taps, device_name, dev_file_num, num_prev_assigned_ch, ca_codes, data_codes, d_code_length_chips, trk_parameters.track_pilot, d_code_samples_per_chip); multicorrelator_fpga->set_output_vectors(d_correlator_outs, d_Prompt_Data); d_sample_counter_next = 0ULL; diff --git a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc index 5f096a2ab..7d1361a4e 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc @@ -81,7 +81,8 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() signal[1] = 'C'; signal[2] = '\0'; device_name = "/dev/uio"; - device_base = 1; + dev_file_num = 3; + num_prev_assigned_ch = 0; code_length_chips = 0U; code_samples_per_chip = 0U; ca_codes = nullptr; diff --git a/src/algorithms/tracking/libs/dll_pll_conf_fpga.h b/src/algorithms/tracking/libs/dll_pll_conf_fpga.h index e713e936a..dcc3f9847 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf_fpga.h +++ b/src/algorithms/tracking/libs/dll_pll_conf_fpga.h @@ -87,7 +87,8 @@ public: char system; char signal[3]; std::string device_name; - int32_t device_base; + uint32_t dev_file_num; + uint32_t num_prev_assigned_ch; uint32_t code_length_chips; uint32_t code_samples_per_chip; int32_t* ca_codes; diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index a8da466de..0a79bc514 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -61,13 +61,15 @@ const float PHASE_CARR_MAX_DIV_PI = 683565275.5764316; // 2^(31)/pi const float TWO_PI = 6.283185307179586; Fpga_Multicorrelator_8sc::Fpga_Multicorrelator_8sc(int32_t n_correlators, - const std::string &device_name, int32_t device_base, int32_t *ca_codes, int32_t *data_codes, uint32_t code_length_chips, bool track_pilot, + const std::string &device_name, uint32_t dev_file_num, uint32_t num_prev_assigned_ch, int32_t *ca_codes, int32_t *data_codes, uint32_t code_length_chips, bool track_pilot, uint32_t code_samples_per_chip) { d_n_correlators = n_correlators; d_device_name = device_name; - d_device_base = device_base; + d_dev_file_num = dev_file_num; + d_num_prev_assigned_ch = num_prev_assigned_ch; + d_track_pilot = track_pilot; d_device_descriptor = 0; d_map_base = nullptr; @@ -243,7 +245,7 @@ void Fpga_Multicorrelator_8sc::set_channel(uint32_t channel) // open the device corresponding to the assigned channel std::string mergedname; std::stringstream devicebasetemp; - int32_t numdevice = d_device_base + d_channel; + uint32_t numdevice = d_dev_file_num + d_channel - d_num_prev_assigned_ch; devicebasetemp << numdevice; mergedname = d_device_name + devicebasetemp.str(); diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.h b/src/algorithms/tracking/libs/fpga_multicorrelator.h index a16eb8612..b3a581a10 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.h +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.h @@ -53,7 +53,8 @@ public: */ Fpga_Multicorrelator_8sc(int32_t n_correlators, const std::string &device_name, - int32_t device_base, + uint32_t dev_file_num, + uint32_t num_prev_assigned_ch, int32_t *ca_codes, int32_t *data_codes, uint32_t code_length_chips, @@ -236,7 +237,8 @@ private: // driver std::string d_device_name; - int32_t d_device_base; + uint32_t d_dev_file_num; + uint32_t d_num_prev_assigned_ch; // PRN codes int32_t *d_ca_codes; From 5d2047c3005d949b9f519a7c27d3fee33a1efac3 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 3 Oct 2019 15:26:58 +0200 Subject: [PATCH 09/11] replaced the device_base parameter by the dev_file_num parameter. dev_file_num specifies for each GNSS signal the first /dev/uio driver that is associated to an FPGA HW accelerator that can be used for the tracking process of that GNSS signal. This parameter depends on the FPGA compilation and it is independant of the number of channels that are used for the tracking of other GNSS signals. --- .../adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc | 3 ++- .../tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc | 5 +++-- .../tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc | 3 ++- .../tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index c00089830..78fecbdb6 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -181,7 +181,8 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - // obtain the number of the first uio device file that is assigned to the FPGA E1 tracking multicorrelator HW accelerators + // obtain the number of the first uio device corresponding to a HW accelerator in the FPGA + // that can be assigned to the tracking of the E1 signal trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 15); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index cf8697038..a2ce08e24 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -176,8 +176,9 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - // obtain the number of the first uio device file that is assigned to the FPGA E5a tracking multicorrelator HW accelerators - trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 38); + // obtain the number of the first uio device corresponding to a HW accelerator in the FPGA + // that can be assigned to the tracking of the E5a signal + trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index a3f74dc42..184ab71d4 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -182,7 +182,8 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - // obtain the number of the first uio device file that is assigned to the FPGA L1 tracking multicorrelator HW accelerators + // obtain the number of the first uio device corresponding to a HW accelerator in the FPGA + // that can be assigned to the tracking of the L1 signal trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 3); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, l2, L5, E1, E5a diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 0f59ba5ea..7ad9503d2 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -175,7 +175,8 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( std::string default_device_name = "/dev/uio"; std::string device_name = configuration->property(role + ".devicename", default_device_name); trk_param_fpga.device_name = device_name; - // obtain the number of the first uio device file that is assigned to the FPGA L5 tracking multicorrelator HW accelerators + // obtain the number of the first uio device corresponding to a HW accelerator in the FPGA + // that can be assigned to the tracking of the L5 signal trk_param_fpga.dev_file_num = configuration->property(role + ".dev_file_num", 27); // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a From dbf0c38d378a91e39a2c717aa4e65761bd757dc3 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 3 Oct 2019 15:36:14 +0200 Subject: [PATCH 10/11] applied clang-format --- .../adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc | 4 ++-- .../adapters/galileo_e5a_dll_pll_tracking_fpga.cc | 6 +++--- .../tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc | 2 +- src/algorithms/tracking/libs/fpga_multicorrelator.cc | 4 ++-- src/algorithms/tracking/libs/fpga_multicorrelator.h | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index 78fecbdb6..f296aee9d 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -187,8 +187,8 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + - configuration->property("Channels_2S.count", 0) + - configuration->property("Channels_L5.count", 0); + configuration->property("Channels_2S.count", 0) + + configuration->property("Channels_L5.count", 0); //################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 2; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index a2ce08e24..990890720 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -182,9 +182,9 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + - configuration->property("Channels_2S.count", 0) + - configuration->property("Channels_L5.count", 0) + - configuration->property("Channels_1B.count", 0); + configuration->property("Channels_2S.count", 0) + + configuration->property("Channels_L5.count", 0) + + configuration->property("Channels_1B.count", 0); // ################# PRE-COMPUTE ALL THE CODES ################# uint32_t code_samples_per_chip = 1; diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 7ad9503d2..98d8ef03a 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -181,7 +181,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( // compute the number of tracking channels that have already been instantiated. The order in which // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a trk_param_fpga.num_prev_assigned_ch = configuration->property("Channels_1C.count", 0) + - configuration->property("Channels_2S.count", 0); + configuration->property("Channels_2S.count", 0); // tracking lock tests smoother parameters trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index 0a79bc514..9567f12bd 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -67,8 +67,8 @@ Fpga_Multicorrelator_8sc::Fpga_Multicorrelator_8sc(int32_t n_correlators, { d_n_correlators = n_correlators; d_device_name = device_name; - d_dev_file_num = dev_file_num; - d_num_prev_assigned_ch = num_prev_assigned_ch; + d_dev_file_num = dev_file_num; + d_num_prev_assigned_ch = num_prev_assigned_ch; d_track_pilot = track_pilot; d_device_descriptor = 0; diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.h b/src/algorithms/tracking/libs/fpga_multicorrelator.h index b3a581a10..476d3d922 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.h +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.h @@ -53,8 +53,8 @@ public: */ Fpga_Multicorrelator_8sc(int32_t n_correlators, const std::string &device_name, - uint32_t dev_file_num, - uint32_t num_prev_assigned_ch, + uint32_t dev_file_num, + uint32_t num_prev_assigned_ch, int32_t *ca_codes, int32_t *data_codes, uint32_t code_length_chips, @@ -237,8 +237,8 @@ private: // driver std::string d_device_name; - uint32_t d_dev_file_num; - uint32_t d_num_prev_assigned_ch; + uint32_t d_dev_file_num; + uint32_t d_num_prev_assigned_ch; // PRN codes int32_t *d_ca_codes; From 4c9416e05fa634cda81bbc20d9503a6634432dcf Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 3 Oct 2019 16:41:15 +0200 Subject: [PATCH 11/11] Update Protocol Buffers to 3.10.0 --- CMakeLists.txt | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf0f50472..b06cf7141 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -407,7 +407,7 @@ set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GPSTK_LOCAL_VERSION "2.12") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.17") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.9.2") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.10.0") if(CMAKE_VERSION VERSION_LESS "3.0.2") # Fix for CentOS 7 set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.1") diff --git a/README.md b/README.md index 1f1f8f642..07a86d4e4 100644 --- a/README.md +++ b/README.md @@ -305,9 +305,9 @@ $ sudo apt-get install autoconf automake libtool curl make g++ unzip and then: ~~~~~~ -$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.9.2/protobuf-cpp-3.9.2.tar.gz -$ tar xvfz protobuf-cpp-3.9.2.tar.gz -$ cd protobuf-3.9.2 +$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.10.0/protobuf-cpp-3.10.0.tar.gz +$ tar xvfz protobuf-cpp-3.10.0.tar.gz +$ cd protobuf-3.10.0 $ ./autogen.sh $ ./configure $ make