1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

cleaned source code

This commit is contained in:
Marc Majoral 2019-12-21 13:25:17 +01:00
parent 431739a767
commit 7bc0ce35c4
4 changed files with 76 additions and 119 deletions

View File

@ -29,36 +29,45 @@
* -------------------------------------------------------------------------
*/
#include "Galileo_E1.h"
#include "acquisition_dump_reader.h"
#include "concurrent_queue.h"
#include "fpga_switch.h"
#include "galileo_e1_pcps_ambiguous_acquisition_fpga.h"
#include "gnss_block_factory.h"
#include "gnss_block_interface.h"
#include "gnss_sdr_valve.h"
#include "gnss_signal.h"
#include "gnss_synchro.h"
#include "galileo_e1_pcps_ambiguous_acquisition_fpga.h"
//#include "gps_l1_ca_pcps_acquisition_fpga.h"
#include "in_memory_configuration.h"
#include "test_flags.h"
#include <boost/make_shared.hpp>
#include <boost/thread.hpp>
#include <gnuradio/analog/sig_source_waveform.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/blocks/throttle.h>
#include <gnuradio/top_block.h>
#include <gtest/gtest.h>
#include <chrono>
#include <cstdlib>
#include <cmath> // for abs, pow, floor
#include <fcntl.h> // for O_WRONLY
#include <unistd.h>
#include <glog/logging.h>
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#include <pthread.h>
#include <chrono>
#include <utility>
#include <pthread.h> // for pthread stuff
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#include <filesystem>
namespace fs = std::filesystem;
#endif
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
struct DMA_handler_args_galileo_e1_pcps_ambiguous_acq_test
{
std::string file;
@ -89,11 +98,8 @@ protected:
void init();
gr::top_block_sptr top_block;
std::shared_ptr<GNSSBlockFactory> factory;
std::shared_ptr<InMemoryConfiguration> config;
Gnss_Synchro gnss_synchro;
size_t item_size;
unsigned int doppler_max;
unsigned int doppler_step;
unsigned int nsamples_to_transfer;
@ -104,17 +110,15 @@ protected:
GalileoE1PcpsAmbiguousAcquisitionTestFpga::GalileoE1PcpsAmbiguousAcquisitionTestFpga()
{
factory = std::make_shared<GNSSBlockFactory>();
config = std::make_shared<InMemoryConfiguration>();
item_size = sizeof(gr_complex);
gnss_synchro = Gnss_Synchro();
doppler_max = 5000;
doppler_step = 100;
}
void* handler_DMA_galileo_e1_pcps_ambiguous_acq_test(void* arguments)
{
//const float MAX_SAMPLE_VALUE = 0.097781330347061;
const float MAX_SAMPLE_VALUE = 0.096257761120796;
const int DMA_BITS_PER_SAMPLE = 8;
const float DMA_SCALING_FACTOR = (pow(2, DMA_BITS_PER_SAMPLE - 1) - 1) / MAX_SAMPLE_VALUE;
@ -349,7 +353,6 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal()
std::shared_ptr<AcquisitionInterface> acquisition;
// std::string System_and_Signal;
std::string signal;
struct DMA_handler_args_galileo_e1_pcps_ambiguous_acq_test args;
struct acquisition_handler_args_galileo_e1_pcps_ambiguous_acq_test args_acq;
@ -439,11 +442,6 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal()
void GalileoE1PcpsAmbiguousAcquisitionTestFpga::init()
{
gnss_synchro.Channel_ID = 0;
gnss_synchro.System = 'E';
std::string signal = "1B";
signal.copy(gnss_synchro.Signal, 2, 0);
gnss_synchro.PRN = 1;
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga");
config->set_property("Acquisition.threshold", "0.00001");

View File

@ -29,35 +29,43 @@
* -------------------------------------------------------------------------
*/
#include "GPS_L1_CA.h"
#include "acquisition_dump_reader.h"
#include "concurrent_queue.h"
#include "fpga_switch.h"
#include "gnss_block_factory.h"
#include "gnss_block_interface.h"
#include "gnss_sdr_valve.h"
#include "gnss_synchro.h"
#include "gps_l1_ca_pcps_acquisition_fpga.h"
#include "in_memory_configuration.h"
#include "test_flags.h"
#include <boost/make_shared.hpp>
#include <boost/thread.hpp>
#include <gnuradio/analog/sig_source_waveform.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/blocks/throttle.h>
#include <gnuradio/top_block.h>
#include <cmath> // for abs, pow, floor
#include <glog/logging.h>
#include <gtest/gtest.h>
#include <chrono>
#include <cstdlib>
#include <cmath> // for abs, pow, floor
#include <fcntl.h> // for O_WRONLY
#include <unistd.h>
#include <pthread.h>
#include <utility>
#include <pthread.h> // for pthread stuff
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#include <filesystem>
namespace fs = std::filesystem;
#endif
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
struct DMA_handler_args_gps_l1_acq_test
{
std::string file;
@ -88,11 +96,8 @@ protected:
void init();
gr::top_block_sptr top_block;
std::shared_ptr<GNSSBlockFactory> factory;
std::shared_ptr<InMemoryConfiguration> config;
Gnss_Synchro gnss_synchro;
size_t item_size;
unsigned int doppler_max;
unsigned int doppler_step;
unsigned int nsamples_to_transfer;
@ -103,10 +108,9 @@ protected:
GpsL1CaPcpsAcquisitionTestFpga::GpsL1CaPcpsAcquisitionTestFpga()
{
factory = std::make_shared<GNSSBlockFactory>();
config = std::make_shared<InMemoryConfiguration>();
item_size = sizeof(gr_complex);
gnss_synchro = Gnss_Synchro();
doppler_max = 5000;
doppler_step = 100;
}
@ -435,11 +439,6 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal()
void GpsL1CaPcpsAcquisitionTestFpga::init()
{
gnss_synchro.Channel_ID = 0;
gnss_synchro.System = 'G';
std::string signal = "1C";
signal.copy(gnss_synchro.Signal, 2, 0);
gnss_synchro.PRN = 1;
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition_Fpga");
config->set_property("Acquisition.threshold", "0.00001");

View File

@ -30,43 +30,23 @@
* -------------------------------------------------------------------------
*/
#include "gnss_sdr_fpga_sample_counter.h"
#include "gps_l1_ca_dll_pll_tracking_fpga.h"
#include "fpga_switch.h"
// threads
#include <pthread.h> // for pthread stuff
#include "GPS_L1_CA.h"
#include "GPS_L2C.h"
#include "GPS_L5.h"
#include "Galileo_E1.h"
#include "Galileo_E5a.h"
#include "acquisition_msg_rx.h"
#include "galileo_e1_pcps_ambiguous_acquisition.h"
#include "galileo_e5a_noncoherent_iq_acquisition_caf.h"
#include "galileo_e5a_pcps_acquisition.h"
#include "glonass_l1_ca_pcps_acquisition.h"
#include "glonass_l2_ca_pcps_acquisition.h"
#include "fpga_switch.h"
#include "galileo_e1_pcps_ambiguous_acquisition_fpga.h"
#include "galileo_e5a_pcps_acquisition_fpga.h"
#include "gnss_block_factory.h"
#include "gnss_block_interface.h"
#include "gnss_satellite.h"
#include "gnss_sdr_sample_counter.h"
#include "gnss_synchro.h"
#include "gnuplot_i.h"
#include "gps_l1_ca_pcps_acquisition.h"
#include "gps_l2_m_pcps_acquisition.h"
#include "gps_l5i_pcps_acquisition.h"
#include "gps_l1_ca_dll_pll_tracking_fpga.h"
#include "gps_l1_ca_pcps_acquisition_fpga.h"
#include "gps_l5i_pcps_acquisition_fpga.h"
#include "hybrid_observables.h"
#include "in_memory_configuration.h"
#include "observable_tests_flags.h"
@ -97,6 +77,7 @@
#include <chrono>
#include <cmath>
#include <exception>
#include <pthread.h>
#include <unistd.h>
#include <utility>
#ifdef GR_GREATER_38
@ -760,9 +741,6 @@ bool HybridObservablesTestFpga::acquire_signal()
// wait to give time for the acquisition thread to set up the acquisition HW accelerator in the FPGA
usleep(1000000);
// args.skip_used_samples = 0;
// args.nsamples_tx = nsamples_to_transfer + TEST_OBS_SKIP_SAMPLES;
// create DMA child process
if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, reinterpret_cast<void*>(&args)) < 0)
{
@ -781,11 +759,6 @@ bool HybridObservablesTestFpga::acquire_signal()
{
std::cout << " " << PRN << " ";
// tmp_gnss_synchro.Acq_doppler_hz = tmp_gnss_synchro.Acq_doppler_hz;
// tmp_gnss_synchro.Acq_delay_samples = tmp_gnss_synchro.Acq_delay_samples;
// //tmp_gnss_synchro.Acq_samplestamp_samples = 0; // do not take into account the filter internal state initialisation
// tmp_gnss_synchro.Acq_samplestamp_samples = tmp_gnss_synchro.Acq_samplestamp_samples; // delay due to the downsampling filter in the acquisition
gnss_synchro_vec.push_back(tmp_gnss_synchro);
}
else
@ -2019,7 +1992,6 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
top_block->connect(observables->get_right_block(), n, null_sink_vec.at(n), 0);
}
// connect sample counter and timmer to the last channel in observables block (extra channel)
// top_block->connect(samp_counter, 0, observables->get_left_block(), tracking_ch_vec.size());
top_block->connect(ch_out_fpga_sample_counter, 0, observables->get_left_block(), tracking_ch_vec.size()); // extra port for the sample counter pulse
}) << "Failure connecting the blocks.";
@ -2063,28 +2035,9 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
}) << "Failure connecting tracking to the top_block.";
}
// // send some samples to allow the receiver to exit the tracking loops
// args.file = file;
// args.nsamples_tx = baseband_sampling_freq * 1; // 1 s
// args.skip_used_samples = baseband_sampling_freq * FLAGS_duration;
// if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, reinterpret_cast<void*>(&args)) < 0)
// {
// std::cout << "ERROR cannot create DMA Process" << std::endl;
// }
// wait for the child DMA process to finish
// pthread_join(thread_DMA, nullptr);
//std::this_thread::sleep_for(std::chrono::milliseconds(500));
// reset the HW in order to produce an interrupt to the tracking
// modules that are in a waiting state
acquisition->stop_acquisition();
// // stop the top block
// top_block->stop();
EXPECT_NO_THROW({
end = std::chrono::system_clock::now();
elapsed_seconds = end - start;

View File

@ -31,13 +31,20 @@
*/
#include "GPS_L1_CA.h"
//#include "GPS_L2C.h"
#include "GPS_L5.h"
#include "Galileo_E1.h"
#include "Galileo_E5a.h"
#include "acquisition_msg_rx.h"
#include "concurrent_queue.h"
#include "galileo_e1_pcps_ambiguous_acquisition_fpga.h"
#include "galileo_e5a_noncoherent_iq_acquisition_caf.h"
#include "galileo_e5a_pcps_acquisition.h"
//#include "galileo_e5a_noncoherent_iq_acquisition_caf.h"
#include "galileo_e5a_pcps_acquisition_fpga.h"
#include "gnss_block_factory.h"
#include "gnuplot_i.h"
#include "gps_l1_ca_pcps_acquisition_fpga.h"
//#include "gps_l1_ca_pcps_acquisition_fine_doppler.h"
//#include "gps_l2_m_pcps_acquisition.h"
#include "gps_l5i_pcps_acquisition_fpga.h"
#include "in_memory_configuration.h"
#include "signal_generator_flags.h"
@ -52,13 +59,22 @@
#include <gnuradio/blocks/interleaved_char_to_complex.h>
#include <gnuradio/blocks/null_sink.h>
#include <gnuradio/blocks/skiphead.h>
#include <gnuradio/filter/firdes.h>
#include <gnuradio/top_block.h>
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#include <pthread.h>
#include <chrono>
#include <unistd.h>
#include <cstdint>
#include <utility>
#include <vector>
#ifdef GR_GREATER_38
#include <gnuradio/filter/fir_filter_blk.h>
#else
#include <gnuradio/filter/fir_filter_ccf.h>
#endif
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
@ -72,12 +88,6 @@ namespace fs = std::filesystem;
namespace fs = boost::filesystem;
#endif
// threads
#include <fcntl.h> // for open, O_RDWR, O_SYNC
#include <iostream> // for cout, endl
#include <pthread.h> // for pthread stuff
#include <sys/mman.h> // for mmap
// ######## GNURADIO TRACKING BLOCK MESSAGE RECEVER #########
class TrackingPullInTest_msg_rx_Fpga;
@ -492,7 +502,6 @@ void TrackingPullInTestFpga::configure_receiver(
config->set_property("Tracking.dump", "true");
config->set_property("Tracking.dump_filename", "./tracking_ch_");
config->set_property("Tracking.implementation", implementation);
//config->set_property("Tracking.item_type", "gr_complex");
config->set_property("Tracking.pll_bw_hz", std::to_string(PLL_wide_bw_hz));
config->set_property("Tracking.dll_bw_hz", std::to_string(DLL_wide_bw_hz));
config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols));
@ -937,8 +946,6 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults)
<< " Acquisition SampleStamp is " << acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second << std::endl;
}
// create the msg queue for valve
//queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
long long int acq_to_trk_delay_samples = ceil(static_cast<double>(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s);