1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-30 23:03:05 +00:00

updated the handling of the scoped_lock mutex in the fpga tracking loops + used clang-format.

This commit is contained in:
Marc Majoral
2019-07-24 11:26:16 +02:00
parent f30d8a60ec
commit 48fe6086e4
14 changed files with 27 additions and 37 deletions

View File

@@ -50,7 +50,6 @@ class ConfigurationInterface;
class GalileoE1PcpsAmbiguousAcquisitionFpga : public AcquisitionInterface class GalileoE1PcpsAmbiguousAcquisitionFpga : public AcquisitionInterface
{ {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */
@@ -184,14 +183,13 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private: private:
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
static const uint32_t quant_bits_local_code = 16; static const uint32_t quant_bits_local_code = 16;
static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word
static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word
static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_; pcps_acquisition_fpga_sptr acquisition_fpga_;

View File

@@ -50,7 +50,6 @@ class ConfigurationInterface;
class GalileoE5aPcpsAcquisitionFpga : public AcquisitionInterface class GalileoE5aPcpsAcquisitionFpga : public AcquisitionInterface
{ {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */
@@ -191,14 +190,13 @@ public:
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
private: private:
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
static const uint32_t quant_bits_local_code = 16; static const uint32_t quant_bits_local_code = 16;
static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word
static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word
static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
static const uint32_t shl_code_bits = 65536; // shift left by 10 bits static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_fpga_sptr acquisition_fpga_; pcps_acquisition_fpga_sptr acquisition_fpga_;

View File

@@ -52,7 +52,6 @@ class ConfigurationInterface;
class GpsL1CaPcpsAcquisitionFpga : public AcquisitionInterface class GpsL1CaPcpsAcquisitionFpga : public AcquisitionInterface
{ {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */

View File

@@ -50,7 +50,6 @@ class ConfigurationInterface;
class GpsL5iPcpsAcquisitionFpga : public AcquisitionInterface class GpsL5iPcpsAcquisitionFpga : public AcquisitionInterface
{ {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */

View File

@@ -175,7 +175,6 @@ void Fpga_Acquisition::run_acquisition(void)
std::cout << "acquisition module Read failed to retrieve 4 bytes!" << std::endl; std::cout << "acquisition module Read failed to retrieve 4 bytes!" << std::endl;
std::cout << "acquisition module Interrupt number " << irq_count << std::endl; std::cout << "acquisition module Interrupt number " << irq_count << std::endl;
} }
} }

View File

@@ -45,8 +45,7 @@
class Fpga_Acquisition class Fpga_Acquisition
{ {
public: public:
/*!
/*!
* \brief Constructor * \brief Constructor
*/ */
Fpga_Acquisition( Fpga_Acquisition(

View File

@@ -46,8 +46,7 @@
class Fpga_Switch class Fpga_Switch
{ {
public: public:
/*!
/*!
* \brief Constructor * \brief Constructor
*/ */
Fpga_Switch(const std::string& device_name); Fpga_Switch(const std::string& device_name);

View File

@@ -51,7 +51,6 @@ class ConfigurationInterface;
class GalileoE1DllPllVemlTrackingFpga : public TrackingInterface class GalileoE1DllPllVemlTrackingFpga : public TrackingInterface
{ {
public: public:
/*! /*!
* \brief Constructor * \brief Constructor
*/ */
@@ -132,7 +131,6 @@ public:
void stop_tracking() override; void stop_tracking() override;
private: private:
// the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA // the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA

View File

@@ -123,7 +123,6 @@ public:
void stop_tracking() override; void stop_tracking() override;
private: private:
// the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA // the following flags are FPGA-specific and they are using arrange the values of the local code in the way the FPGA
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA

View File

@@ -128,12 +128,11 @@ public:
void stop_tracking() override; void stop_tracking() override;
private: private:
static const uint32_t NUM_PRNs = 32; // total number of PRNs
static const uint32_t NUM_PRNs = 32; // total number of PRNs static const int32_t GPS_CA_BIT_DURATION_MS = 20;
static const int32_t GPS_CA_BIT_DURATION_MS = 20; // the following flag is FPGA-specific and they are using arrange the values of the local code in the way the FPGA
// the following flag is FPGA-specific and they are using arrange the values of the local code in the way the FPGA // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA
static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA
dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc; dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc;

View File

@@ -1286,6 +1286,8 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile()
void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel) void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel)
{ {
gr::thread::scoped_lock l(d_setlock);
d_channel = channel; d_channel = channel;
multicorrelator_fpga->set_channel(d_channel); multicorrelator_fpga->set_channel(d_channel);
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@@ -1458,19 +1460,20 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
d_cn0_smoother.reset(); d_cn0_smoother.reset();
d_carrier_lock_test_smoother.reset(); d_carrier_lock_test_smoother.reset();
} }
} }
void dll_pll_veml_tracking_fpga::stop_tracking() void dll_pll_veml_tracking_fpga::stop_tracking()
{ {
// interrupt the tracking loops
d_stop_tracking = true; d_stop_tracking = true;
} }
void dll_pll_veml_tracking_fpga::reset(void) void dll_pll_veml_tracking_fpga::reset(void)
{ {
gr::thread::scoped_lock l(d_setlock);
multicorrelator_fpga->unlock_channel(); multicorrelator_fpga->unlock_channel();
} }
@@ -1480,6 +1483,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
gr_vector_const_void_star &input_items __attribute__((unused)), gr_vector_const_void_star &input_items __attribute__((unused)),
gr_vector_void_star &output_items) gr_vector_void_star &output_items)
{ {
gr::thread::scoped_lock l(d_setlock);
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
Gnss_Synchro current_synchro_data = Gnss_Synchro(); Gnss_Synchro current_synchro_data = Gnss_Synchro();
current_synchro_data.Flag_valid_symbol_output = false; current_synchro_data.Flag_valid_symbol_output = false;

View File

@@ -62,12 +62,12 @@ dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Co
class dll_pll_veml_tracking_fpga : public gr::block class dll_pll_veml_tracking_fpga : public gr::block
{ {
public: public:
/*! /*!
* \brief Destructor * \brief Destructor
*/ */
~dll_pll_veml_tracking_fpga(); ~dll_pll_veml_tracking_fpga();
/*! /*!
* \brief Set the channel number and configure some multicorrelator parameters * \brief Set the channel number and configure some multicorrelator parameters
*/ */
void set_channel(uint32_t channel); void set_channel(uint32_t channel);
@@ -82,23 +82,23 @@ public:
*/ */
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
/*! /*!
* \brief This function starts the tracking process * \brief This function starts the tracking process
*/ */
void start_tracking(); void start_tracking();
/*! /*!
* \brief This function sets a flag that makes general_work to stop in order to finish the tracking process. * \brief This function sets a flag that makes general_work to stop in order to finish the tracking process.
*/ */
void stop_tracking(); void stop_tracking();
/*! /*!
* \brief General Work * \brief General Work
*/ */
int general_work(int noutput_items, gr_vector_int &ninput_items, int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
/*! /*!
* \brief This function disables the HW multicorrelator in the FPGA in order to stop the tracking process * \brief This function disables the HW multicorrelator in the FPGA in order to stop the tracking process
*/ */
void reset(void); void reset(void);

View File

@@ -50,8 +50,7 @@
class Fpga_Multicorrelator_8sc class Fpga_Multicorrelator_8sc
{ {
public: public:
/*!
/*!
* \brief Constructor * \brief Constructor
*/ */
Fpga_Multicorrelator_8sc(int32_t n_correlators, std::string device_name, Fpga_Multicorrelator_8sc(int32_t n_correlators, std::string device_name,

View File

@@ -29,6 +29,7 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "concurrent_queue.h"
#include "gnss_block_factory.h" #include "gnss_block_factory.h"
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include "gnss_sdr_valve.h" #include "gnss_sdr_valve.h"
@@ -41,7 +42,6 @@
#include <gnuradio/blocks/file_source.h> #include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/null_sink.h> #include <gnuradio/blocks/null_sink.h>
#include <gnuradio/blocks/throttle.h> #include <gnuradio/blocks/throttle.h>
#include "concurrent_queue.h"
#include <gnuradio/top_block.h> #include <gnuradio/top_block.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <chrono> #include <chrono>