GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
pcps_acquisition_fpga.h
Go to the documentation of this file.
1 /*!
2  * \file pcps_acquisition_fpga.h
3  * \brief This class implements a Parallel Code Phase Search Acquisition for the FPGA
4  *
5  *
6  * Kay Borre book: K.Borre, D.M.Akos, N.Bertelsen, P.Rinder, and S.H.Jensen,
7  * "A Software-Defined GPS and Galileo Receiver. A Single-Frequency
8  * Approach", Birkhauser, 2007. pp 81-84
9  *
10  * \authors <ul>
11  * <li> Marc Majoral, 2019. mmajoral(at)cttc.es
12  * <li> Javier Arribas, 2019. jarribas(at)cttc.es
13  * </ul>
14  *
15  * -----------------------------------------------------------------------------
16  *
17  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
18  * This file is part of GNSS-SDR.
19  *
20  * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
21  * SPDX-License-Identifier: GPL-3.0-or-later
22  *
23  * -----------------------------------------------------------------------------
24  */
25 
26 #ifndef GNSS_SDR_PCPS_ACQUISITION_FPGA_H
27 #define GNSS_SDR_PCPS_ACQUISITION_FPGA_H
28 
29 #include "acq_conf_fpga.h"
30 #include "channel_fsm.h"
31 #include "fpga_acquisition.h"
32 #include <cstdint> // for uint32_t
33 #include <memory> // for shared_ptr
34 #include <string> // for string
35 #include <utility> // for for std::move, std::pair
36 #include <vector> // for std::vector
37 
38 /** \addtogroup Acquisition
39  * \{ */
40 /** \addtogroup Acq_gnuradio_blocks
41  * \{ */
42 
43 
44 class Gnss_Synchro;
45 
47 
48 using pcps_acquisition_fpga_sptr = std::shared_ptr<pcps_acquisition_fpga>;
49 
50 pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga* conf_, uint32_t acq_buff_num, std::vector<std::pair<uint32_t, uint32_t>>& downsampling_filter_specs, uint32_t& max_FFT_size);
51 
52 /*!
53  * \brief This class implements a Parallel Code Phase Search Acquisition that uses the FPGA.
54  *
55  * Check \ref Navitec2012 "An Open Source Galileo E1 Software Receiver",
56  * Algorithm 1, for a pseudocode description of this implementation.
57  */
59 {
60 public:
61  /*!
62  * \brief Destructor
63  */
64  ~pcps_acquisition_fpga() = default;
65 
66  /*!
67  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
68  * to exchange synchronization data between acquisition and tracking blocks.
69  * \param p_gnss_synchro Satellite information shared by the processing blocks.
70  */
71  inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
72  {
73  d_gnss_synchro = p_gnss_synchro;
74  }
75 
76  /*!
77  * \brief Returns the maximum peak of grid search.
78  */
79  inline uint32_t mag() const
80  {
81  return d_mag;
82  }
83 
84  /*!
85  * \brief Initializes acquisition algorithm.
86  */
87  void init();
88 
89  /*!
90  * \brief Sets local code for PCPS acquisition algorithm.
91  */
92  void set_local_code();
93 
94  /*!
95  * \brief Starts acquisition algorithm, turning from standby mode to
96  * active mode
97  * \param active - bool that activates/deactivates the block.
98  */
99  void set_active(bool active);
100 
101  /*!
102  * \brief Set acquisition channel unique ID
103  * \param channel - receiver channel.
104  */
105  inline void set_channel(uint32_t channel)
106  {
107  d_channel = channel;
108  }
109 
110  /*!
111  * \brief Set channel fsm associated to this acquisition instance
112  */
113  inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm)
114  {
115  d_channel_fsm = std::move(channel_fsm);
116  }
117 
118  /*!
119  * \brief Set Doppler center frequency for the grid search. It will refresh the Doppler grid.
120  * \param doppler_center - Frequency center of the search grid [Hz].
121  */
122  void set_doppler_center(int32_t doppler_center);
123 
124  /*!
125  * \brief This function triggers a HW reset of the FPGA PL.
126  */
127  void reset_acquisition();
128 
129  /*!
130  * \brief stop the acquisition and the other FPGA modules.
131  */
132  void stop_acquisition();
133 
134 private:
135  friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga* conf, uint32_t acq_buff_num, std::vector<std::pair<uint32_t, uint32_t>>& downsampling_filter_specs, uint32_t& max_FFT_size);
136  explicit pcps_acquisition_fpga(Acq_Conf_Fpga* conf, uint32_t acq_buff_num, std::vector<std::pair<uint32_t, uint32_t>>& downsampling_filter_specs, uint32_t& max_FFT_size);
137 
138  void send_negative_acquisition();
139  void send_positive_acquisition();
140  void acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_min);
141  float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
142 
143  std::shared_ptr<Fpga_Acquisition> d_acquisition_fpga;
144  std::weak_ptr<ChannelFsm> d_channel_fsm;
145 
146  Acq_Conf_Fpga* d_acq_parameters;
147 
148  Gnss_Synchro* d_gnss_synchro;
149 
150  uint64_t d_sample_counter;
151 
152  const float d_threshold;
153  float d_mag;
154  float d_input_power;
155  float d_test_statistics;
156  float d_doppler_step2;
157  float d_doppler_center_step_two;
158 
159  int32_t d_doppler_center;
160  int32_t d_state;
161 
162  uint32_t d_doppler_index;
163  uint32_t d_channel;
164  const uint32_t d_doppler_step;
165  const uint32_t d_doppler_max;
166  const uint32_t d_num_doppler_bins;
167  uint32_t d_total_block_exp;
168  uint32_t d_num_doppler_bins_step2;
169  uint32_t d_max_num_acqs;
170 
171  bool d_active;
172  bool d_make_2_steps;
173 };
174 
175 
176 /** \} */
177 /** \} */
178 #endif // GNSS_SDR_PCPS_ACQUISITION_FPGA_H
Class that contains all the configuration parameters for generic acquisition block based on the PCPS ...
void reset_acquisition()
This function triggers a HW reset of the FPGA PL.
void set_doppler_center(int32_t doppler_center)
Set Doppler center frequency for the grid search. It will refresh the Doppler grid.
Highly optimized FPGA vector correlator class.
void set_local_code()
Sets local code for PCPS acquisition algorithm.
void stop_acquisition()
stop the acquisition and the other FPGA modules.
void set_channel(uint32_t channel)
Set acquisition channel unique ID.
Interface of the State Machine for channel.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
Set acquisition/tracking common Gnss_Synchro object pointer to exchange synchronization data between ...
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
This class implements a Parallel Code Phase Search Acquisition that uses the FPGA.
void set_active(bool active)
Starts acquisition algorithm, turning from standby mode to active mode.
~pcps_acquisition_fpga()=default
Destructor.
void init()
Initializes acquisition algorithm.
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm)
Set channel fsm associated to this acquisition instance.
uint32_t mag() const
Returns the maximum peak of grid search.