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:
		| @@ -50,7 +50,6 @@ class ConfigurationInterface; | ||||
| class GalileoE1PcpsAmbiguousAcquisitionFpga : public AcquisitionInterface | ||||
| { | ||||
| public: | ||||
|  | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
| @@ -184,14 +183,13 @@ public: | ||||
|     void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; | ||||
|  | ||||
| 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 | ||||
|     // 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 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_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 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 shl_code_bits = 65536;              // shift left by 10 bits | ||||
|  | ||||
|     ConfigurationInterface* configuration_; | ||||
|     pcps_acquisition_fpga_sptr acquisition_fpga_; | ||||
|   | ||||
| @@ -50,7 +50,6 @@ class ConfigurationInterface; | ||||
| class GalileoE5aPcpsAcquisitionFpga : public AcquisitionInterface | ||||
| { | ||||
| public: | ||||
|  | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
| @@ -191,14 +190,13 @@ public: | ||||
|     void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; | ||||
|  | ||||
| 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 | ||||
|     // 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 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_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 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_all_code_bits = 0xFFFFFFFF;  // Select a 20 bit word | ||||
|     static const uint32_t shl_code_bits = 65536;              // shift left by 10 bits | ||||
|  | ||||
|     ConfigurationInterface* configuration_; | ||||
|     pcps_acquisition_fpga_sptr acquisition_fpga_; | ||||
|   | ||||
| @@ -52,7 +52,6 @@ class ConfigurationInterface; | ||||
| class GpsL1CaPcpsAcquisitionFpga : public AcquisitionInterface | ||||
| { | ||||
| public: | ||||
|  | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
|   | ||||
| @@ -50,7 +50,6 @@ class ConfigurationInterface; | ||||
| class GpsL5iPcpsAcquisitionFpga : public AcquisitionInterface | ||||
| { | ||||
| public: | ||||
|  | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
|   | ||||
| @@ -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 Interrupt number " << irq_count << std::endl; | ||||
|         } | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -45,8 +45,7 @@ | ||||
| class Fpga_Acquisition | ||||
| { | ||||
| public: | ||||
|  | ||||
| 	/*! | ||||
|     /*! | ||||
| 	 * \brief Constructor | ||||
| 	 */ | ||||
|     Fpga_Acquisition( | ||||
|   | ||||
| @@ -46,8 +46,7 @@ | ||||
| class Fpga_Switch | ||||
| { | ||||
| public: | ||||
|  | ||||
| 	/*! | ||||
|     /*! | ||||
| 	 * \brief Constructor | ||||
| 	 */ | ||||
|     Fpga_Switch(const std::string& device_name); | ||||
|   | ||||
| @@ -51,7 +51,6 @@ class ConfigurationInterface; | ||||
| class GalileoE1DllPllVemlTrackingFpga : public TrackingInterface | ||||
| { | ||||
| public: | ||||
|  | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
| @@ -132,7 +131,6 @@ public: | ||||
|     void stop_tracking() override; | ||||
|  | ||||
| private: | ||||
|  | ||||
|     // 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. | ||||
|     static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000;      // flag that enables WE (Write Enable) of the local code FPGA | ||||
|   | ||||
| @@ -123,7 +123,6 @@ public: | ||||
|     void stop_tracking() override; | ||||
|  | ||||
| private: | ||||
|  | ||||
|     // 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. | ||||
|     static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000;      // flag that enables WE (Write Enable) of the local code FPGA | ||||
|   | ||||
| @@ -128,12 +128,11 @@ public: | ||||
|     void stop_tracking() override; | ||||
|  | ||||
| private: | ||||
|  | ||||
| 	static const uint32_t NUM_PRNs = 32;  // total number of PRNs | ||||
| 	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 | ||||
| 	// 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 uint32_t NUM_PRNs = 32;  // total number of PRNs | ||||
|     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 | ||||
|     // 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 | ||||
|  | ||||
|  | ||||
|     dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc; | ||||
|   | ||||
| @@ -1286,6 +1286,8 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile() | ||||
|  | ||||
| void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel) | ||||
| { | ||||
|     gr::thread::scoped_lock l(d_setlock); | ||||
|  | ||||
|     d_channel = channel; | ||||
|     multicorrelator_fpga->set_channel(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_carrier_lock_test_smoother.reset(); | ||||
|  | ||||
|         } | ||||
| } | ||||
|  | ||||
|  | ||||
| void dll_pll_veml_tracking_fpga::stop_tracking() | ||||
| { | ||||
|     // interrupt the tracking loops | ||||
|     d_stop_tracking = true; | ||||
| } | ||||
|  | ||||
|  | ||||
| void dll_pll_veml_tracking_fpga::reset(void) | ||||
| { | ||||
|     gr::thread::scoped_lock l(d_setlock); | ||||
|     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_void_star &output_items) | ||||
| { | ||||
|     gr::thread::scoped_lock l(d_setlock); | ||||
|     auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); | ||||
|     Gnss_Synchro current_synchro_data = Gnss_Synchro(); | ||||
|     current_synchro_data.Flag_valid_symbol_output = false; | ||||
|   | ||||
| @@ -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 | ||||
| { | ||||
| public: | ||||
| 	/*! | ||||
|     /*! | ||||
| 	 * \brief Destructor | ||||
| 	 */ | ||||
|     ~dll_pll_veml_tracking_fpga(); | ||||
|  | ||||
| 	/*! | ||||
|     /*! | ||||
| 	 * \brief Set the channel number and configure some multicorrelator parameters | ||||
| 	 */ | ||||
|     void set_channel(uint32_t channel); | ||||
| @@ -82,23 +82,23 @@ public: | ||||
|      */ | ||||
|     void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro); | ||||
|  | ||||
| 	/*! | ||||
|     /*! | ||||
| 	 * \brief This function starts the tracking process | ||||
| 	 */ | ||||
|     void start_tracking(); | ||||
|  | ||||
| 	/*! | ||||
|     /*! | ||||
| 	 * \brief This function sets a flag that makes general_work to stop in order to finish the tracking process. | ||||
| 	 */ | ||||
|     void stop_tracking(); | ||||
|  | ||||
| 	/*! | ||||
|     /*! | ||||
| 	 * \brief General Work | ||||
| 	 */ | ||||
|     int general_work(int noutput_items, gr_vector_int &ninput_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 | ||||
| 	 */ | ||||
|     void reset(void); | ||||
|   | ||||
| @@ -50,8 +50,7 @@ | ||||
| class Fpga_Multicorrelator_8sc | ||||
| { | ||||
| public: | ||||
|  | ||||
| 	/*! | ||||
|     /*! | ||||
| 	 * \brief Constructor | ||||
| 	 */ | ||||
|     Fpga_Multicorrelator_8sc(int32_t n_correlators, std::string device_name, | ||||
|   | ||||
| @@ -29,6 +29,7 @@ | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include "concurrent_queue.h" | ||||
| #include "gnss_block_factory.h" | ||||
| #include "gnss_block_interface.h" | ||||
| #include "gnss_sdr_valve.h" | ||||
| @@ -41,7 +42,6 @@ | ||||
| #include <gnuradio/blocks/file_source.h> | ||||
| #include <gnuradio/blocks/null_sink.h> | ||||
| #include <gnuradio/blocks/throttle.h> | ||||
| #include "concurrent_queue.h" | ||||
| #include <gnuradio/top_block.h> | ||||
| #include <gtest/gtest.h> | ||||
| #include <chrono> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Marc Majoral
					Marc Majoral