GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
galileo_e1_pcps_ambiguous_acquisition_fpga.h
Go to the documentation of this file.
1 /*!
2  * \file galileo_e1_pcps_ambiguous_acquisition_fpga.h
3  * \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
4  * Galileo E1 Signals for the FPGA
5  * \author Marc Majoral, 2019. mmajoral(at)cttc.es
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H
19 #define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H
20 
21 #include "acq_conf_fpga.h"
22 #include "channel_fsm.h"
23 #include "gnss_synchro.h"
24 #include "pcps_acquisition_fpga.h"
25 #include <volk_gnsssdr/volk_gnsssdr_alloc.h>
26 #include <memory>
27 #include <string>
28 #include <utility>
29 #include <vector>
30 
31 /** \addtogroup Acquisition
32  * \{ */
33 /** \addtogroup Acq_adapters
34  * \{ */
35 
36 
38 
39 /*!
40  * \brief This class adapts a PCPS acquisition block off-loaded on an FPGA
41  * to an AcquisitionInterface for Galileo E1 Signals
42  */
44 {
45 public:
46  /*!
47  * \brief Constructor
48  */
50  const ConfigurationInterface* configuration,
51  const std::string& role,
52  unsigned int in_streams,
53  unsigned int out_streams);
54 
55  /*!
56  * \brief Destructor
57  */
59 
60  /*!
61  * \brief Role
62  */
63  inline std::string role() override
64  {
65  return role_;
66  }
67 
68  /*!
69  * \brief Returns "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga"
70  */
71  inline std::string implementation() override
72  {
73  return "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga";
74  }
75 
76  /*!
77  * \brief Returns size of lv_16sc_t
78  */
79  size_t item_size() override
80  {
81  return sizeof(int16_t);
82  }
83 
84  /*!
85  * \brief Connect
86  */
87  void connect(gr::top_block_sptr top_block) override;
88 
89  /*!
90  * \brief Disconnect
91  */
92  void disconnect(gr::top_block_sptr top_block) override;
93 
94  /*!
95  * \brief Get left block
96  */
97  gr::basic_block_sptr get_left_block() override;
98 
99  /*!
100  * \brief Get right block
101  */
102  gr::basic_block_sptr get_right_block() override;
103 
104  /*!
105  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
106  * to efficiently exchange synchronization data between acquisition and
107  * tracking blocks
108  */
109  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
110 
111  /*!
112  * \brief Set acquisition channel unique ID
113  */
114  inline void set_channel(unsigned int channel) override
115  {
116  channel_ = channel;
117  acquisition_fpga_->set_channel(channel_);
118  }
119 
120  /*!
121  * \brief Set channel fsm associated to this acquisition instance
122  */
123  inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
124  {
125  channel_fsm_ = std::move(channel_fsm);
126  acquisition_fpga_->set_channel_fsm(channel_fsm_);
127  }
128 
129  /*!
130  * \brief Set statistics threshold of PCPS algorithm
131  */
132  void set_threshold(float threshold) override;
133 
134  /*!
135  * \brief Set maximum Doppler off grid search
136  */
137  void set_doppler_max(unsigned int doppler_max) override;
138 
139  /*!
140  * \brief Set Doppler steps for the grid search
141  */
142  void set_doppler_step(unsigned int doppler_step) override;
143 
144  /*!
145  * \brief Set Doppler center for the grid search
146  */
147  void set_doppler_center(int doppler_center) override;
148 
149  /*!
150  * \brief Initializes acquisition algorithm.
151  */
152  void init() override;
153 
154  /*!
155  * \brief Sets local code for Galileo E1 PCPS acquisition algorithm.
156  */
157  void set_local_code() override;
158 
159  /*!
160  * \brief Returns the maximum peak of grid search
161  */
162  signed int mag() override;
163 
164  /*!
165  * \brief Restart acquisition algorithm
166  */
167  void reset() override;
168 
169  /*!
170  * \brief If state = 1, it forces the block to start acquiring from the first sample
171  */
172  void set_state(int state) override;
173 
174  /*!
175  * \brief Stop running acquisition
176  */
177  void stop_acquisition() override;
178 
179  /*!
180  * \brief Set resampler latency
181  */
182  void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
183 
184 private:
185  static const uint32_t downsampling_factor_default = 4;
186  static const uint32_t fpga_buff_num = 0; // L1/E1 band
187  static const uint32_t fpga_blk_exp = 13; // default block exponent
188 
189  // 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
190  // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
191  static const uint32_t quant_bits_local_code = 16;
192  static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word
193  static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word
194  static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word
195  static const uint32_t shl_code_bits = 65536; // shift left by 10 bits
196 
197  pcps_acquisition_fpga_sptr acquisition_fpga_;
198  volk_gnsssdr::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
199  std::weak_ptr<ChannelFsm> channel_fsm_;
200  Gnss_Synchro* gnss_synchro_;
201  Acq_Conf_Fpga acq_parameters_;
202  std::string role_;
203  int64_t fs_in_;
204  int32_t doppler_center_;
205  uint32_t channel_;
206  uint32_t doppler_max_;
207  uint32_t doppler_step_;
208  unsigned int in_streams_;
209  unsigned int out_streams_;
210  bool acquire_pilot_;
211 };
212 
213 
214 /** \} */
215 /** \} */
216 #endif // GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H
size_t item_size() override
Returns size of lv_16sc_t.
Class that contains all the configuration parameters for generic acquisition block based on the PCPS ...
void set_channel(unsigned int channel) override
Set acquisition channel unique ID.
void set_state(int state) override
If state = 1, it forces the block to start acquiring from the first sample.
signed int mag() override
Returns the maximum peak of grid search.
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm) override
Set channel fsm associated to this acquisition instance.
void connect(gr::top_block_sptr top_block) override
Connect.
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override
Set resampler latency.
void reset() override
Restart acquisition algorithm.
Interface of the State Machine for channel.
void set_threshold(float threshold) override
Set statistics threshold of PCPS algorithm.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) override
Set acquisition/tracking common Gnss_Synchro object pointer to efficiently exchange synchronization d...
This abstract class represents an interface to an acquisition GNSS block.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
This abstract class represents an interface to configuration parameters.
This class implements a Parallel Code Phase Search Acquisition for the FPGA.
void disconnect(gr::top_block_sptr top_block) override
Disconnect.
This class adapts a PCPS acquisition block off-loaded on an FPGA to an AcquisitionInterface for Galil...
void set_doppler_center(int doppler_center) override
Set Doppler center for the grid search.
GalileoE1PcpsAmbiguousAcquisitionFpga(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams)
Constructor.
void stop_acquisition() override
Stop running acquisition.
~GalileoE1PcpsAmbiguousAcquisitionFpga()=default
Destructor.
void set_doppler_max(unsigned int doppler_max) override
Set maximum Doppler off grid search.
gr::basic_block_sptr get_right_block() override
Get right block.
std::string implementation() override
Returns "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga".
gr::basic_block_sptr get_left_block() override
Get left block.
void init() override
Initializes acquisition algorithm.
void set_doppler_step(unsigned int doppler_step) override
Set Doppler steps for the grid search.
void set_local_code() override
Sets local code for Galileo E1 PCPS acquisition algorithm.
Interface of the Gnss_Synchro class.