mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-30 23:03:05 +00:00 
			
		
		
		
	Merge branch 'fpga_extended_coherent_integration' of https://github.com/mmajoral/gnss-sdr into mmajoral-fpga_extended_coherent_integration
This commit is contained in:
		| @@ -44,14 +44,6 @@ | ||||
| #include <cmath>      // for abs, pow, floor | ||||
| #include <complex>    // for complex | ||||
|  | ||||
| // 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. | ||||
| #define QUANT_BITS_LOCAL_CODE 16 | ||||
| #define SELECT_LSBits 0x0000FFFF         // Select the 10 LSbits out of a 20-bit word | ||||
| #define SELECT_MSBbits 0xFFFF0000        // Select the 10 MSbits out of a 20-bit word | ||||
| #define SELECT_ALL_CODE_BITS 0xFFFFFFFF  // Select a 20 bit word | ||||
| #define SHL_CODE_BITS 65536              // shift left by 10 bits | ||||
|  | ||||
| GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( | ||||
|     ConfigurationInterface* configuration, | ||||
|     const std::string& role, | ||||
| @@ -166,10 +158,10 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( | ||||
|             // and package codes in a format that is ready to be written to the FPGA | ||||
|             for (uint32_t i = 0; i < nsamples_total; i++) | ||||
|                 { | ||||
|                     tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); | ||||
|                     tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); | ||||
|                     local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits);  // put together the real part and the imaginary part | ||||
|                     fft_data = local_code & SELECT_ALL_CODE_BITS; | ||||
|                     tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); | ||||
|                     tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); | ||||
|                     local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits);  // put together the real part and the imaginary part | ||||
|                     fft_data = local_code & select_all_code_bits; | ||||
|                     d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; | ||||
|                 } | ||||
|         } | ||||
| @@ -221,6 +213,12 @@ void GalileoE1PcpsAmbiguousAcquisitionFpga::set_doppler_step(unsigned int dopple | ||||
|     acquisition_fpga_->set_doppler_step(doppler_step_); | ||||
| } | ||||
|  | ||||
| void GalileoE1PcpsAmbiguousAcquisitionFpga::set_doppler_center(int doppler_center) | ||||
| { | ||||
|     doppler_center_ = doppler_center; | ||||
|  | ||||
|     acquisition_fpga_->set_doppler_center(doppler_center_); | ||||
| } | ||||
|  | ||||
| void GalileoE1PcpsAmbiguousAcquisitionFpga::set_gnss_synchro(Gnss_Synchro* gnss_synchro) | ||||
| { | ||||
|   | ||||
| @@ -24,7 +24,7 @@ | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
| @@ -32,16 +32,15 @@ | ||||
| #ifndef GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_ | ||||
| #define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_ | ||||
|  | ||||
| #include "acq_conf.h" | ||||
| #include "channel_fsm.h" | ||||
| #include "gnss_synchro.h" | ||||
| #include "pcps_acquisition_fpga.h" | ||||
| #include <gnuradio/runtime_types.h>  // for basic_block_sptr, top_block_sptr | ||||
| #include <volk/volk_complex.h>       // for lv_16sc_t | ||||
| #include <cstddef>                   // for size_t | ||||
| #include <memory> | ||||
| #include <string> | ||||
| #include <vector> | ||||
|  | ||||
| class Gnss_Synchro; | ||||
|  | ||||
| class ConfigurationInterface; | ||||
|  | ||||
| /*! | ||||
| @@ -51,13 +50,22 @@ class ConfigurationInterface; | ||||
| class GalileoE1PcpsAmbiguousAcquisitionFpga : public AcquisitionInterface | ||||
| { | ||||
| public: | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
|     GalileoE1PcpsAmbiguousAcquisitionFpga(ConfigurationInterface* configuration, | ||||
|         const std::string& role, | ||||
|         unsigned int in_streams, | ||||
|         unsigned int out_streams); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Destructor | ||||
|      */ | ||||
|     ~GalileoE1PcpsAmbiguousAcquisitionFpga() = default; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Role | ||||
|      */ | ||||
|     inline std::string role() override | ||||
|     { | ||||
|         return role_; | ||||
| @@ -71,21 +79,38 @@ public: | ||||
|         return "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga"; | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Returns size of lv_16sc_t | ||||
|      */ | ||||
|     size_t item_size() override | ||||
|     { | ||||
|         size_t item_size = sizeof(lv_16sc_t); | ||||
|         return item_size; | ||||
|         return sizeof(int16_t); | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Connect | ||||
|      */ | ||||
|     void connect(gr::top_block_sptr top_block) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Disconnect | ||||
|      */ | ||||
|     void disconnect(gr::top_block_sptr top_block) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Get left block | ||||
|      */ | ||||
|     gr::basic_block_sptr get_left_block() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Get right block | ||||
|      */ | ||||
|     gr::basic_block_sptr get_right_block() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set acquisition/tracking common Gnss_Synchro object pointer | ||||
|      * to efficiently exchange synchronization data between acquisition and | ||||
|      * tracking blocks | ||||
|      *  tracking blocks | ||||
|      */ | ||||
|     void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override; | ||||
|  | ||||
| @@ -122,6 +147,11 @@ public: | ||||
|      */ | ||||
|     void set_doppler_step(unsigned int doppler_step) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set Doppler center for the grid search | ||||
|      */ | ||||
|     void set_doppler_center(int doppler_center) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Initializes acquisition algorithm. | ||||
|      */ | ||||
| @@ -152,9 +182,20 @@ public: | ||||
|      */ | ||||
|     void stop_acquisition() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set resampler latency | ||||
|      */ | ||||
|     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 | ||||
|  | ||||
|     ConfigurationInterface* configuration_; | ||||
|     pcps_acquisition_fpga_sptr acquisition_fpga_; | ||||
|     bool acquire_pilot_; | ||||
| @@ -162,6 +203,7 @@ private: | ||||
|     std::weak_ptr<ChannelFsm> channel_fsm_; | ||||
|     uint32_t doppler_max_; | ||||
|     uint32_t doppler_step_; | ||||
|     int32_t doppler_center_; | ||||
|     std::string dump_filename_; | ||||
|     Gnss_Synchro* gnss_synchro_; | ||||
|     std::string role_; | ||||
|   | ||||
| @@ -44,14 +44,6 @@ | ||||
| #include <cmath>      // for abs, pow, floor | ||||
| #include <complex>    // for complex | ||||
|  | ||||
| // 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. | ||||
| #define QUANT_BITS_LOCAL_CODE 16 | ||||
| #define SELECT_LSBits 0x0000FFFF         // Select the 10 LSbits out of a 20-bit word | ||||
| #define SELECT_MSBbits 0xFFFF0000        // Select the 10 MSbits out of a 20-bit word | ||||
| #define SELECT_ALL_CODE_BITS 0xFFFFFFFF  // Select a 20 bit word | ||||
| #define SHL_CODE_BITS 65536              // shift left by 10 bits | ||||
|  | ||||
| GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterface* configuration, | ||||
|     const std::string& role, | ||||
|     unsigned int in_streams, | ||||
| @@ -169,10 +161,10 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf | ||||
|             // and package codes in a format that is ready to be written to the FPGA | ||||
|             for (uint32_t i = 0; i < nsamples_total; i++) | ||||
|                 { | ||||
|                     tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); | ||||
|                     tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); | ||||
|                     local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits);  // put together the real part and the imaginary part | ||||
|                     fft_data = local_code & SELECT_ALL_CODE_BITS; | ||||
|                     tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); | ||||
|                     tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); | ||||
|                     local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits);  // put together the real part and the imaginary part | ||||
|                     fft_data = local_code & select_all_code_bits; | ||||
|                     d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; | ||||
|                 } | ||||
|         } | ||||
| @@ -224,6 +216,12 @@ void GalileoE5aPcpsAcquisitionFpga::set_doppler_step(unsigned int doppler_step) | ||||
|     acquisition_fpga_->set_doppler_step(doppler_step_); | ||||
| } | ||||
|  | ||||
| void GalileoE5aPcpsAcquisitionFpga::set_doppler_center(int doppler_center) | ||||
| { | ||||
|     doppler_center_ = doppler_center; | ||||
|  | ||||
|     acquisition_fpga_->set_doppler_center(doppler_center_); | ||||
| } | ||||
|  | ||||
| void GalileoE5aPcpsAcquisitionFpga::set_gnss_synchro(Gnss_Synchro* gnss_synchro) | ||||
| { | ||||
|   | ||||
| @@ -24,7 +24,7 @@ | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
| @@ -34,16 +34,12 @@ | ||||
|  | ||||
|  | ||||
| #include "channel_fsm.h" | ||||
| #include "gnss_synchro.h" | ||||
| #include "pcps_acquisition_fpga.h" | ||||
| #include <gnuradio/runtime_types.h>  // for basic_block_sptr, top_block_sptr | ||||
| #include <volk/volk_complex.h>       // for lv_16sc_t | ||||
| #include <cstddef>                   // for size_t | ||||
| #include <cstdint> | ||||
| #include <memory> | ||||
| #include <string> | ||||
| #include <vector> | ||||
|  | ||||
| class Gnss_Synchro; | ||||
| class ConfigurationInterface; | ||||
|  | ||||
|  | ||||
| @@ -54,13 +50,22 @@ class ConfigurationInterface; | ||||
| class GalileoE5aPcpsAcquisitionFpga : public AcquisitionInterface | ||||
| { | ||||
| public: | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
|     GalileoE5aPcpsAcquisitionFpga(ConfigurationInterface* configuration, | ||||
|         const std::string& role, | ||||
|         unsigned int in_streams, | ||||
|         unsigned int out_streams); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Destructor | ||||
|      */ | ||||
|     ~GalileoE5aPcpsAcquisitionFpga() = default; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Role | ||||
|      */ | ||||
|     inline std::string role() override | ||||
|     { | ||||
|         return role_; | ||||
| @@ -74,20 +79,38 @@ public: | ||||
|         return "Galileo_E5a_Pcps_Acquisition_Fpga"; | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Returns size of lv_16sc_t | ||||
|      */ | ||||
|     inline size_t item_size() override | ||||
|     { | ||||
|         return sizeof(lv_16sc_t); | ||||
|         return sizeof(int16_t); | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Connect | ||||
|      */ | ||||
|     void connect(gr::top_block_sptr top_block) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Disconnect | ||||
|      */ | ||||
|     void disconnect(gr::top_block_sptr top_block) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Get left block | ||||
|      */ | ||||
|     gr::basic_block_sptr get_left_block() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Get right block | ||||
|      */ | ||||
|     gr::basic_block_sptr get_right_block() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set acquisition/tracking common Gnss_Synchro object pointer | ||||
|      * to efficiently exchange synchronization data between acquisition and | ||||
|      * tracking blocks | ||||
|      *  tracking blocks | ||||
|      */ | ||||
|     void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override; | ||||
|  | ||||
| @@ -124,6 +147,11 @@ public: | ||||
|      */ | ||||
|     void set_doppler_step(unsigned int doppler_step) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set Doppler center for the grid search | ||||
|      */ | ||||
|     void set_doppler_center(int doppler_center) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Initializes acquisition algorithm. | ||||
|      */ | ||||
| @@ -162,11 +190,19 @@ public: | ||||
|     void stop_acquisition() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Sets the resampler latency to account it in the acquisition code delay estimation | ||||
|      * \brief Set resampler latency | ||||
|      */ | ||||
|     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 | ||||
|  | ||||
|     ConfigurationInterface* configuration_; | ||||
|     pcps_acquisition_fpga_sptr acquisition_fpga_; | ||||
|     std::string item_type_; | ||||
| @@ -178,6 +214,7 @@ private: | ||||
|     std::weak_ptr<ChannelFsm> channel_fsm_; | ||||
|     uint32_t doppler_max_; | ||||
|     uint32_t doppler_step_; | ||||
|     int32_t doppler_center_; | ||||
|     unsigned int in_streams_; | ||||
|     unsigned int out_streams_; | ||||
|     Gnss_Synchro* gnss_synchro_; | ||||
|   | ||||
| @@ -47,16 +47,6 @@ | ||||
| #include <cmath>      // for abs, pow, floor | ||||
| #include <complex>    // for complex | ||||
|  | ||||
| #define NUM_PRNs 32 | ||||
|  | ||||
| // 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. | ||||
| #define QUANT_BITS_LOCAL_CODE 16 | ||||
| #define SELECT_LSBits 0x0000FFFF         // Select the 10 LSbits out of a 20-bit word | ||||
| #define SELECT_MSBbits 0xFFFF0000        // Select the 10 MSbits out of a 20-bit word | ||||
| #define SELECT_ALL_CODE_BITS 0xFFFFFFFF  // Select a 20 bit word | ||||
| #define SHL_CODE_BITS 65536              // shift left by 10 bits | ||||
|  | ||||
| GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( | ||||
|     ConfigurationInterface* configuration, | ||||
|     const std::string& role, | ||||
| @@ -146,10 +136,10 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( | ||||
|             // and package codes in a format that is ready to be written to the FPGA | ||||
|             for (uint32_t i = 0; i < nsamples_total; i++) | ||||
|                 { | ||||
|                     tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); | ||||
|                     tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); | ||||
|                     local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits);  // put together the real part and the imaginary part | ||||
|                     fft_data = local_code & SELECT_ALL_CODE_BITS; | ||||
|                     tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); | ||||
|                     tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); | ||||
|                     local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits);  // put together the real part and the imaginary part | ||||
|                     fft_data = local_code & select_all_code_bits; | ||||
|                     d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; | ||||
|                 } | ||||
|         } | ||||
| @@ -202,6 +192,12 @@ void GpsL1CaPcpsAcquisitionFpga::set_doppler_step(unsigned int doppler_step) | ||||
|     acquisition_fpga_->set_doppler_step(doppler_step_); | ||||
| } | ||||
|  | ||||
| void GpsL1CaPcpsAcquisitionFpga::set_doppler_center(int doppler_center) | ||||
| { | ||||
|     doppler_center_ = doppler_center; | ||||
|  | ||||
|     acquisition_fpga_->set_doppler_center(doppler_center_); | ||||
| } | ||||
|  | ||||
| void GpsL1CaPcpsAcquisitionFpga::set_gnss_synchro(Gnss_Synchro* gnss_synchro) | ||||
| { | ||||
|   | ||||
| @@ -38,14 +38,11 @@ | ||||
|  | ||||
| #include "channel_fsm.h" | ||||
| #include "pcps_acquisition_fpga.h" | ||||
| #include <gnuradio/runtime_types.h>  // for basic_block_sptr, top_block_sptr | ||||
| #include <volk/volk_complex.h>       // for lv_16sc_t | ||||
| #include <cstddef>                   // for size_t | ||||
| #include <memory> | ||||
| #include <string> | ||||
| #include <vector> | ||||
|  | ||||
| class Gnss_Synchro; | ||||
|  | ||||
| class ConfigurationInterface; | ||||
|  | ||||
| /*! | ||||
| @@ -55,13 +52,22 @@ class ConfigurationInterface; | ||||
| class GpsL1CaPcpsAcquisitionFpga : public AcquisitionInterface | ||||
| { | ||||
| public: | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
|     GpsL1CaPcpsAcquisitionFpga(ConfigurationInterface* configuration, | ||||
|         const std::string& role, | ||||
|         unsigned int in_streams, | ||||
|         unsigned int out_streams); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Destructor | ||||
|      */ | ||||
|     ~GpsL1CaPcpsAcquisitionFpga() = default; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Role | ||||
|      */ | ||||
|     inline std::string role() override | ||||
|     { | ||||
|         return role_; | ||||
| @@ -75,15 +81,32 @@ public: | ||||
|         return "GPS_L1_CA_PCPS_Acquisition_Fpga"; | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Returns size of lv_16sc_t | ||||
|      */ | ||||
|     inline size_t item_size() override | ||||
|     { | ||||
|         size_t item_size = sizeof(lv_16sc_t); | ||||
|         return item_size; | ||||
|         return sizeof(int16_t); | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Connect | ||||
|      */ | ||||
|     void connect(gr::top_block_sptr top_block) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Disconnect | ||||
|      */ | ||||
|     void disconnect(gr::top_block_sptr top_block) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Get left block | ||||
|      */ | ||||
|     gr::basic_block_sptr get_left_block() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Get right block | ||||
|      */ | ||||
|     gr::basic_block_sptr get_right_block() override; | ||||
|  | ||||
|     /*! | ||||
| @@ -126,6 +149,11 @@ public: | ||||
|      */ | ||||
|     void set_doppler_step(unsigned int doppler_step) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set Doppler center for the grid search | ||||
|      */ | ||||
|     void set_doppler_center(int doppler_center) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Initializes acquisition algorithm. | ||||
|      */ | ||||
| @@ -156,15 +184,30 @@ public: | ||||
|      */ | ||||
|     void stop_acquisition() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set Resampler Latency | ||||
|      */ | ||||
|     void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; | ||||
|  | ||||
| private: | ||||
|     static const uint32_t NUM_PRNs = 32; | ||||
|  | ||||
|     // 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 | ||||
|  | ||||
|  | ||||
|     ConfigurationInterface* configuration_; | ||||
|     pcps_acquisition_fpga_sptr acquisition_fpga_; | ||||
|     uint32_t channel_; | ||||
|     std::weak_ptr<ChannelFsm> channel_fsm_; | ||||
|     uint32_t doppler_max_; | ||||
|     uint32_t doppler_step_; | ||||
|     int32_t doppler_center_; | ||||
|     Gnss_Synchro* gnss_synchro_; | ||||
|     std::string role_; | ||||
|     unsigned int in_streams_; | ||||
|   | ||||
| @@ -46,13 +46,6 @@ | ||||
| #include <cmath>      // for abs, pow, floor | ||||
| #include <complex>    // for complex | ||||
|  | ||||
| #define NUM_PRNs 32 | ||||
| #define QUANT_BITS_LOCAL_CODE 16 | ||||
| #define SELECT_LSBits 0x0000FFFF         // Select the 10 LSbits out of a 20-bit word | ||||
| #define SELECT_MSBbits 0xFFFF0000        // Select the 10 MSbits out of a 20-bit word | ||||
| #define SELECT_ALL_CODE_BITS 0xFFFFFFFF  // Select a 20 bit word | ||||
| #define SHL_CODE_BITS 65536              // shift left by 10 bits | ||||
|  | ||||
| GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( | ||||
|     ConfigurationInterface* configuration, | ||||
|     const std::string& role, | ||||
| @@ -87,7 +80,6 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( | ||||
|     // The FPGA can only use FFT lengths that are a power of two. | ||||
|     float nbits = ceilf(log2f((float)code_length)); | ||||
|     unsigned int nsamples_total = pow(2, nbits); | ||||
|     unsigned int vector_length = nsamples_total; | ||||
|     unsigned int select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 0); | ||||
|     acq_parameters.select_queue_Fpga = select_queue_Fpga; | ||||
|     std::string default_device_name = "/dev/uio0"; | ||||
|   | ||||
| @@ -156,6 +156,13 @@ public: | ||||
|     void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; | ||||
|  | ||||
| private: | ||||
|     static const uint32_t NUM_PRNs = 32; | ||||
|     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_MSBbits = 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_; | ||||
|     std::string item_type_; | ||||
|   | ||||
| @@ -47,17 +47,6 @@ | ||||
| #include <cmath>      // for abs, pow, floor | ||||
| #include <complex>    // for complex | ||||
|  | ||||
| #define NUM_PRNs 32 | ||||
|  | ||||
| // 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. | ||||
| #define QUANT_BITS_LOCAL_CODE 16 | ||||
| #define SELECT_LSBits 0x0000FFFF         // Select the 10 LSbits out of a 20-bit word | ||||
| #define SELECT_MSBbits 0xFFFF0000        // Select the 10 MSbits out of a 20-bit word | ||||
| #define SELECT_ALL_CODE_BITS 0xFFFFFFFF  // Select a 20 bit word | ||||
| #define SHL_CODE_BITS 65536              // shift left by 10 bits | ||||
|  | ||||
|  | ||||
| GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( | ||||
|     ConfigurationInterface* configuration, | ||||
|     const std::string& role, | ||||
| @@ -150,10 +139,10 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( | ||||
|             // and package codes in a format that is ready to be written to the FPGA | ||||
|             for (uint32_t i = 0; i < nsamples_total; i++) | ||||
|                 { | ||||
|                     tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); | ||||
|                     tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); | ||||
|                     local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits);  // put together the real part and the imaginary part | ||||
|                     fft_data = local_code & SELECT_ALL_CODE_BITS; | ||||
|                     tmp = static_cast<int32_t>(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); | ||||
|                     tmp2 = static_cast<int32_t>(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); | ||||
|                     local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits);  // put together the real part and the imaginary part | ||||
|                     fft_data = local_code & select_all_code_bits; | ||||
|                     d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; | ||||
|                 } | ||||
|         } | ||||
| @@ -207,6 +196,12 @@ void GpsL5iPcpsAcquisitionFpga::set_doppler_step(unsigned int doppler_step) | ||||
|     acquisition_fpga_->set_doppler_step(doppler_step_); | ||||
| } | ||||
|  | ||||
| void GpsL5iPcpsAcquisitionFpga::set_doppler_center(int doppler_center) | ||||
| { | ||||
|     doppler_center_ = doppler_center; | ||||
|  | ||||
|     acquisition_fpga_->set_doppler_center(doppler_center_); | ||||
| } | ||||
|  | ||||
| void GpsL5iPcpsAcquisitionFpga::set_gnss_synchro(Gnss_Synchro* gnss_synchro) | ||||
| { | ||||
|   | ||||
| @@ -27,7 +27,7 @@ | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>. | ||||
|  * along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
| @@ -37,14 +37,10 @@ | ||||
|  | ||||
| #include "channel_fsm.h" | ||||
| #include "pcps_acquisition_fpga.h" | ||||
| #include <gnuradio/runtime_types.h>  // for basic_block_sptr, top_block_sptr | ||||
| #include <volk/volk_complex.h>       // for lv_16sc_t | ||||
| #include <cstddef>                   // for size_t | ||||
| #include <memory> | ||||
| #include <string> | ||||
| #include <vector> | ||||
|  | ||||
| class Gnss_Synchro; | ||||
| class ConfigurationInterface; | ||||
|  | ||||
| /*! | ||||
| @@ -54,13 +50,22 @@ class ConfigurationInterface; | ||||
| class GpsL5iPcpsAcquisitionFpga : public AcquisitionInterface | ||||
| { | ||||
| public: | ||||
|     /*! | ||||
|      * \brief Constructor | ||||
|      */ | ||||
|     GpsL5iPcpsAcquisitionFpga(ConfigurationInterface* configuration, | ||||
|         const std::string& role, | ||||
|         unsigned int in_streams, | ||||
|         unsigned int out_streams); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Destructor | ||||
|      */ | ||||
|     ~GpsL5iPcpsAcquisitionFpga() = default; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Role | ||||
|      */ | ||||
|     inline std::string role() override | ||||
|     { | ||||
|         return role_; | ||||
| @@ -74,14 +79,32 @@ public: | ||||
|         return "GPS_L5i_PCPS_Acquisition_Fpga"; | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Returns size of lv_16sc_t | ||||
|      */ | ||||
|     inline size_t item_size() override | ||||
|     { | ||||
|         return sizeof(lv_16sc_t); | ||||
|         return sizeof(int16_t); | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Connect | ||||
|      */ | ||||
|     void connect(gr::top_block_sptr top_block) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Disconnect | ||||
|      */ | ||||
|     void disconnect(gr::top_block_sptr top_block) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Get left block | ||||
|      */ | ||||
|     gr::basic_block_sptr get_left_block() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Get right block | ||||
|      */ | ||||
|     gr::basic_block_sptr get_right_block() override; | ||||
|  | ||||
|     /*! | ||||
| @@ -124,6 +147,11 @@ public: | ||||
|      */ | ||||
|     void set_doppler_step(unsigned int doppler_step) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set Doppler center for the grid search | ||||
|      */ | ||||
|     void set_doppler_center(int doppler_center) override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Initializes acquisition algorithm. | ||||
|      */ | ||||
| @@ -154,9 +182,22 @@ public: | ||||
|      */ | ||||
|     void stop_acquisition() override; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set resampler latency | ||||
|      */ | ||||
|     void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; | ||||
|  | ||||
| private: | ||||
|     static const uint32_t NUM_PRNs = 32; | ||||
|  | ||||
|     // 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 | ||||
|  | ||||
|     ConfigurationInterface* configuration_; | ||||
|     pcps_acquisition_fpga_sptr acquisition_fpga_; | ||||
|     std::string item_type_; | ||||
| @@ -164,6 +205,7 @@ private: | ||||
|     std::weak_ptr<ChannelFsm> channel_fsm_; | ||||
|     uint32_t doppler_max_; | ||||
|     uint32_t doppler_step_; | ||||
|     int32_t doppler_center_; | ||||
|     std::string dump_filename_; | ||||
|     Gnss_Synchro* gnss_synchro_; | ||||
|     std::string role_; | ||||
|   | ||||
| @@ -40,8 +40,6 @@ | ||||
| #include <utility>   // for move | ||||
|  | ||||
|  | ||||
| #define AQ_DOWNSAMPLING_DELAY 40  // delay due to the downsampling filter in the acquisition | ||||
|  | ||||
| pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_) | ||||
| { | ||||
|     return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(std::move(conf_))); | ||||
| @@ -60,6 +58,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) | ||||
|     d_num_doppler_bins = 0U; | ||||
|     d_threshold = 0.0; | ||||
|     d_doppler_step = 0U; | ||||
|     d_doppler_center = 0U; | ||||
|     d_doppler_index = 0U; | ||||
|     d_test_statistics = 0.0; | ||||
|     d_channel = 0U; | ||||
| @@ -141,7 +140,9 @@ void pcps_acquisition_fpga::send_positive_acquisition() | ||||
|                << ", code phase " << d_gnss_synchro->Acq_delay_samples | ||||
|                << ", doppler " << d_gnss_synchro->Acq_doppler_hz | ||||
|                << ", magnitude " << d_mag | ||||
|                << ", input signal power " << d_input_power; | ||||
|                << ", input signal power " << d_input_power | ||||
|                << ", Assist doppler_center " << d_doppler_center; | ||||
|  | ||||
|  | ||||
|     //the channel FSM is set, so, notify it directly the positive acquisition to minimize delays | ||||
|     d_channel_fsm.lock()->Event_valid_acquisition(); | ||||
| @@ -211,13 +212,6 @@ void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t | ||||
|                 } | ||||
|         } | ||||
|  | ||||
|     // debug | ||||
|     //    if (d_test_statistics > d_threshold) | ||||
|     //        { | ||||
|     //            printf("firstpeak = %f, secondpeak = %f, test_statistics = %f reported block exp = %d PRN = %d inext = %d, initial_sample = %ld doppler = %d\n", firstpeak, secondpeak, d_test_statistics, (int)total_block_exp, (int)d_gnss_synchro->PRN, (int)indext, (long int)initial_sample, (int)doppler); | ||||
|     //            printf("doppler_min = %d doppler_step = %d num_doppler_bins = %d\n", (int)doppler_min, (int)doppler_step, (int)num_doppler_bins); | ||||
|     //        } | ||||
|  | ||||
|     d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler); | ||||
|     d_sample_counter = initial_sample; | ||||
|  | ||||
| @@ -263,7 +257,7 @@ void pcps_acquisition_fpga::set_active(bool active) | ||||
|     acquisition_fpga->write_local_code(); | ||||
|     acquisition_fpga->set_block_exp(d_total_block_exp); | ||||
|  | ||||
|     acquisition_core(d_num_doppler_bins, d_doppler_step, -d_doppler_max); | ||||
|     acquisition_core(d_num_doppler_bins, d_doppler_step, -d_doppler_max + d_doppler_center); | ||||
|     if (!d_make_2_steps) | ||||
|         { | ||||
|             acquisition_fpga->close_device(); | ||||
| @@ -290,7 +284,7 @@ void pcps_acquisition_fpga::set_active(bool active) | ||||
|  | ||||
|                     while (num_second_acq < d_max_num_acqs) | ||||
|                         { | ||||
|                             acquisition_core(d_num_doppler_bins_step2, d_doppler_step2, d_doppler_center_step_two - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0)) * d_doppler_step2); | ||||
|                             acquisition_core(d_num_doppler_bins_step2, d_doppler_step2, d_doppler_center_step_two - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0)) * d_doppler_step2 + d_doppler_center); | ||||
|                             if (d_test_statistics > d_threshold) | ||||
|                                 { | ||||
|                                     d_active = false; | ||||
|   | ||||
| @@ -44,10 +44,10 @@ | ||||
| #include "channel_fsm.h" | ||||
| #include "fpga_acquisition.h" | ||||
| #include <boost/shared_ptr.hpp> | ||||
| #include <volk/volk_complex.h>  // for lv_16sc_t | ||||
| #include <cstdint>              // for uint32_t | ||||
| #include <memory>               // for shared_ptr | ||||
| #include <string>               // for string | ||||
| #include <glog/logging.h> | ||||
|  | ||||
| class Gnss_Synchro; | ||||
|  | ||||
| @@ -89,6 +89,9 @@ pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); | ||||
| class pcps_acquisition_fpga | ||||
| { | ||||
| public: | ||||
|     /*! | ||||
|      * \brief Destructor | ||||
|      */ | ||||
|     ~pcps_acquisition_fpga() = default; | ||||
|  | ||||
|     /*! | ||||
| @@ -116,7 +119,6 @@ public: | ||||
|  | ||||
|     /*! | ||||
|      * \brief Sets local code for PCPS acquisition algorithm. | ||||
|      * \param code - Pointer to the PRN code. | ||||
|      */ | ||||
|     void set_local_code(); | ||||
|  | ||||
| @@ -181,6 +183,19 @@ public: | ||||
|         acquisition_fpga->set_doppler_step(doppler_step); | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set Doppler center frequency for the grid search. It will refresh the Doppler grid. | ||||
|      * \param doppler_center - Frequency center of the search grid [Hz]. | ||||
|      */ | ||||
|     inline void set_doppler_center(int32_t doppler_center) | ||||
|     { | ||||
|         if (doppler_center != d_doppler_center) | ||||
|             { | ||||
|                 DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; | ||||
|                 d_doppler_center = doppler_center; | ||||
|             } | ||||
|     } | ||||
|  | ||||
|     /*! | ||||
|      * \brief This function triggers a HW reset of the FPGA PL. | ||||
|      */ | ||||
| @@ -194,6 +209,7 @@ private: | ||||
|     uint32_t d_doppler_index; | ||||
|     uint32_t d_channel; | ||||
|     uint32_t d_doppler_step; | ||||
|     int32_t d_doppler_center; | ||||
|     uint32_t d_doppler_max; | ||||
|     uint32_t d_fft_size; | ||||
|     uint32_t d_num_doppler_bins; | ||||
|   | ||||
| @@ -44,22 +44,6 @@ | ||||
| #include <utility>         // for move | ||||
|  | ||||
|  | ||||
| // FPGA register parameters | ||||
| #define PAGE_SIZE 0x10000                    // default page size for the multicorrelator memory map | ||||
| #define RESET_ACQUISITION 2                  // command to reset the multicorrelator | ||||
| #define LAUNCH_ACQUISITION 1                 // command to launch the multicorrelator | ||||
| #define TEST_REG_SANITY_CHECK 0x55AA         // value to check the presence of the test register (to detect the hw) | ||||
| #define LOCAL_CODE_CLEAR_MEM 0x10000000      // command to clear the internal memory of the multicorrelator | ||||
| #define MEM_LOCAL_CODE_WR_ENABLE 0x0C000000  // command to enable the ENA and WR pins of the internal memory of the multicorrelator | ||||
| #define POW_2_2 4                            // 2^2 (used for the conversion of floating point numbers to integers) | ||||
| #define POW_2_31 2147483648                  // 2^31 (used for the conversion of floating point numbers to integers) | ||||
|  | ||||
| #define SELECT_LSBits 0x0000FFFF         // Select the 10 LSbits out of a 20-bit word | ||||
| #define SELECT_MSBbits 0xFFFF0000        // Select the 10 MSbits out of a 20-bit word | ||||
| #define SELECT_ALL_CODE_BITS 0xFFFFFFFF  // Select a 20 bit word | ||||
| #define SHL_CODE_BITS 65536              // shift left by 10 bits | ||||
|  | ||||
|  | ||||
| #ifndef TEMP_FAILURE_RETRY | ||||
| #define TEMP_FAILURE_RETRY(exp)              \ | ||||
|     ({                                       \ | ||||
| @@ -191,12 +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; | ||||
|         } | ||||
|  | ||||
|     //    nbytes = TEMP_FAILURE_RETRY(write(d_fd, reinterpret_cast<void *>(&disable_int), sizeof(int32_t))); | ||||
|     //    if (nbytes != sizeof(int32_t)) | ||||
|     //        { | ||||
|     //            std::cerr << "Error disabling interruptions in the FPGA." << std::endl; | ||||
|     //        } | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -229,7 +207,7 @@ void Fpga_Acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_s | ||||
|  | ||||
| void Fpga_Acquisition::configure_acquisition() | ||||
| { | ||||
|     //Fpga_Acquisition::open_device(); | ||||
|     //Fpga_Acquisition::(); | ||||
|     d_map_base[0] = d_select_queue; | ||||
|     d_map_base[1] = d_vector_length; | ||||
|     d_map_base[2] = d_nsamples; | ||||
| @@ -274,18 +252,6 @@ void Fpga_Acquisition::read_acquisition_results(uint32_t *max_index, | ||||
| } | ||||
|  | ||||
|  | ||||
| void Fpga_Acquisition::block_samples() | ||||
| { | ||||
|     d_map_base[14] = 1;  // block the samples | ||||
| } | ||||
|  | ||||
|  | ||||
| void Fpga_Acquisition::unblock_samples() | ||||
| { | ||||
|     d_map_base[14] = 0;  // unblock the samples | ||||
| } | ||||
|  | ||||
|  | ||||
| void Fpga_Acquisition::close_device() | ||||
| { | ||||
|     auto *aux = const_cast<uint32_t *>(d_map_base); | ||||
| @@ -299,6 +265,7 @@ void Fpga_Acquisition::close_device() | ||||
|  | ||||
| void Fpga_Acquisition::reset_acquisition(void) | ||||
| { | ||||
|     //printf("============ resetting the hw now from the acquisition ==============="); | ||||
|     d_map_base[8] = RESET_ACQUISITION;  // writing a 2 to d_map_base[8] resets the acquisition. This causes a reset of all | ||||
|                                         // the FPGA HW modules including the multicorrelators | ||||
| } | ||||
|   | ||||
| @@ -45,6 +45,9 @@ | ||||
| class Fpga_Acquisition | ||||
| { | ||||
| public: | ||||
|     /*! | ||||
| 	 * \brief Constructor | ||||
| 	 */ | ||||
|     Fpga_Acquisition( | ||||
|         std::string device_name, | ||||
|         uint32_t nsamples, | ||||
| @@ -56,14 +59,29 @@ public: | ||||
|         uint32_t *all_fft_codes, | ||||
|         uint32_t excludelimit); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Destructor | ||||
|      */ | ||||
|     ~Fpga_Acquisition() = default; | ||||
|  | ||||
|     /*! | ||||
|      * \brief Select the code with the chosen PRN | ||||
|      */ | ||||
|     bool set_local_code(uint32_t PRN); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Configure the doppler sweep parameters in the FPGA | ||||
|      */ | ||||
|     void set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_step, int32_t doppler_min); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Run the acquisition process in the FPGA | ||||
|      */ | ||||
|     void run_acquisition(void); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Read the results of the acquisition process | ||||
|      */ | ||||
|     void read_acquisition_results( | ||||
|         uint32_t *max_index, | ||||
|         float *firstpeak, | ||||
| @@ -73,10 +91,6 @@ public: | ||||
|         uint32_t *doppler_index, | ||||
|         uint32_t *total_blk_exp); | ||||
|  | ||||
|     void block_samples(); | ||||
|  | ||||
|     void unblock_samples(); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set maximum Doppler grid search | ||||
|      * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. | ||||
| @@ -101,21 +115,51 @@ public: | ||||
|     void reset_acquisition(void); | ||||
|  | ||||
|     /*! | ||||
|      * \brief read the scaling factor that has been used by the FFT-IFFT | ||||
|      * \brief Read the scaling factor that has been used by the FFT-IFFT | ||||
|      */ | ||||
|     void read_fpga_total_scale_factor(uint32_t *total_scale_factor, uint32_t *fw_scale_factor); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Set the block exponent of the FFT in the FPGA. | ||||
|      */ | ||||
|     void set_block_exp(uint32_t total_block_exp); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Write the PRN code in the FPGA | ||||
|      */ | ||||
|     void write_local_code(void); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Write the acquisition parameters into the FPGA | ||||
|      */ | ||||
|     void configure_acquisition(void); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Open the device driver | ||||
|      */ | ||||
|     void open_device(); | ||||
|  | ||||
|     /*! | ||||
|      * \brief Close the device driver | ||||
|      */ | ||||
|     void close_device(); | ||||
|  | ||||
| private: | ||||
|     // FPGA register parameters | ||||
|     static const uint32_t PAGE_SIZE = 0x10000;                    // default page size for the multicorrelator memory map | ||||
|     static const uint32_t RESET_ACQUISITION = 2;                  // command to reset the multicorrelator | ||||
|     static const uint32_t LAUNCH_ACQUISITION = 1;                 // command to launch the multicorrelator | ||||
|     static const uint32_t TEST_REG_SANITY_CHECK = 0x55AA;         // value to check the presence of the test register (to detect the hw) | ||||
|     static const uint32_t LOCAL_CODE_CLEAR_MEM = 0x10000000;      // command to clear the internal memory of the multicorrelator | ||||
|     static const uint32_t MEM_LOCAL_CODE_WR_ENABLE = 0x0C000000;  // command to enable the ENA and WR pins of the internal memory of the multicorrelator | ||||
|     static const uint32_t POW_2_2 = 4;                            // 2^2 (used for the conversion of floating point numbers to integers) | ||||
|     static const uint32_t POW_2_31 = 2147483648;                  // 2^31 (used for the conversion of floating point numbers to integers) | ||||
|  | ||||
|     static const uint32_t SELECT_LSBits = 0x0000FFFF;         // Select the 10 LSbits out of a 20-bit word | ||||
|     static const uint32_t SELECT_MSBbits = 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 | ||||
|  | ||||
|     int64_t d_fs_in; | ||||
|     // data related to the hardware module and the driver | ||||
|     int32_t d_fd;                   // driver descriptor | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez