GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
base_dll_pll_tracking_fpga.h
Go to the documentation of this file.
1 /*!
2  * \file base_dll_pll_tracking_fpga.h
3  * \brief Base class providing shared logic for DLL+PLL VEML tracking adapters
4  * for FPGA-based devices
5  * \authors Carles Fernandez, 2025. carles.fernandez(at)cttc.cat
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-2025 (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_BASE_DLL_PLL_TRACKING_FPGA_H
19 #define GNSS_SDR_BASE_DLL_PLL_TRACKING_FPGA_H
20 
21 #include "dll_pll_conf_fpga.h"
23 #include "tracking_interface.h"
24 #include <cstddef>
25 #include <cstdint>
26 #include <map>
27 #include <mutex>
28 #include <string>
29 
30 // /** \addtogroup Tracking
31 // * \{ */
32 // /** \addtogroup Tracking_adapters
33 // * \{ */
34 
36 
38 {
39 public:
40  /*!
41  * \brief Base constructor of FPGA-based Tracking block adapters
42  */
44  const std::string& role,
45  unsigned int in_streams,
46  unsigned int out_streams);
47  /*!
48  * \brief Base destructor of FPGA-based Tracking block adapters
49  */
50  virtual ~BaseDllPllTrackingFpga() = default;
51 
52  // Common TrackingInterface overrides
53 
54  /*!
55  * \brief Get role from the Tracking block adapter
56  */
57  std::string role() override { return role_; }
58 
59  /*!
60  * \brief Get item_size from the Tracking block adapter
61  */
62  size_t item_size() override { return sizeof(int16_t); }
63 
64  /*!
65  * \brief Connect the Tracking block adapter
66  */
67  void connect(gr::top_block_sptr top_block) override;
68 
69  /*!
70  * \brief Disconnect the Tracking block adapter
71  */
72  void disconnect(gr::top_block_sptr top_block) override;
73 
74  /*!
75  * \brief Get left block from the Tracking block adapter
76  */
77  gr::basic_block_sptr get_left_block() override;
78 
79  /*!
80  * \brief Get right block from the Tracking block adapter
81  */
82  gr::basic_block_sptr get_right_block() override;
83 
84  /*!
85  * \brief Start the tracking process in the FPGA
86  */
87  void start_tracking() override;
88 
89  /*!
90  * \brief Stop the tracking process in the FPGA
91  */
92  void stop_tracking() override;
93 
94  /*!
95  * \brief configure FPGA tracking channel mapping
96  */
97  void configure_fpga_tracking_channel_mapping(std::string signal);
98 
99  /*!
100  * \brief Set tracking channel unique ID
101  */
102  void set_channel(unsigned int channel) override;
103 
104  /*!
105  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
106  * to efficiently exchange synchronization data between acquisition and tracking blocks
107  */
108  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
109 
110 protected:
111  // Can be used by each derived class
112  static const int32_t LOCAL_CODE_FPGA_ENABLE_WRITE_MEMORY = 0x0C000000; // flag that enables WE (Write Enable) of the local code FPGA
113  static const int32_t LOCAL_CODE_FPGA_CORRELATOR_SELECT_COUNT = 0x20000000; // flag that selects the writing of the pilot code in the FPGA (as opposed to the data code)
114 
115  inline Dll_Pll_Conf_Fpga& config_params_fpga() { return trk_params_; }
116  inline const Dll_Pll_Conf_Fpga& config_params_fpga() const { return trk_params_; }
117 
118  // Must be set by each derived class
119  dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc_sptr_;
120 
121 private:
122  // Mapping of GNSS signals to FPGA hardware multicorrelator names
123  inline static const std::map<std::string, std::string> signal_to_device_ = {
124  {"1C", "multicorrelator_resampler_S00_AXI"},
125  {"2S", "multicorrelator_resampler_S00_AXI"},
126  {"L5", "multicorrelator_resampler_3_1_AXI"},
127  {"1B", "multicorrelator_resampler_5_1_AXI"},
128  {"5X", "multicorrelator_resampler_3_1_AXI"},
129  };
130  // Mapping of GNSS signals to alternative FPGA multicorrelator tracking names
131  inline static const std::map<std::string, std::string> signal_to_alternative_device_ = {
132  {"1C", "multicorrelator_resampler_5_1_AXI"}};
133 
134  // Number of channels per signal supported by the FPGA
135  inline static std::map<std::string, int> channel_counts_;
136 
137  void set_signal_channel_base_index_locked_(); // Compute the base channel index for signal_ based on the channel initialization order in the receiver and the number of channels assigned to each signal. Requires: channel_counts_mtx_ is held by the caller.
138  uint32_t get_num_alternative_devices_locked_() const; // Return the number of FPGA tracking multicorrelator devices mapped to signal_ that are also assigned as alternative for other signals. Requires: channel_counts_mtx_ is held by the caller.
139 
140  Dll_Pll_Conf_Fpga trk_params_;
141  const std::string role_;
142  std::string signal_; // GNSS signal type (1C, 2S, L5, 1B, 5X ...)
143  std::string device_name_; // FPGA multicorrelator name
144 
145  inline static std::mutex channel_counts_mtx_; // Protects access to channel_counts_
146 
147  uint32_t channel_;
148  uint32_t signal_base_channel_index_; // Channel index within the signal type (GPS L1 C/A, GPS L2, GPS L5, Galileo E1, Galileo E5a ...)
149 };
150 
151 /** \} */
152 /** \} */
153 #endif // GNSS_SDR_BASE_DLL_PLL_TRACKING_FPGA_H
void configure_fpga_tracking_channel_mapping(std::string signal)
configure FPGA tracking channel mapping
gr::basic_block_sptr get_right_block() override
Get right block from the Tracking block adapter.
Implementation of a code DLL + carrier PLL tracking block using an FPGA.
void start_tracking() override
Start the tracking process in the FPGA.
Class that contains all the configuration parameters for generic tracking block based on a DLL and a ...
gr::basic_block_sptr get_left_block() override
Get left block from the Tracking block adapter.
BaseDllPllTrackingFpga(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_streams, unsigned int out_streams)
Base constructor of FPGA-based Tracking block adapters.
virtual ~BaseDllPllTrackingFpga()=default
Base destructor of FPGA-based Tracking block adapters.
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.
size_t item_size() override
Get item_size from the Tracking block adapter.
void set_channel(unsigned int channel) override
Set tracking channel unique ID.
This abstract class represents an interface to a tracking block.
void connect(gr::top_block_sptr top_block) override
Connect the Tracking block adapter.
std::string role() override
Get role from the Tracking block adapter.
void disconnect(gr::top_block_sptr top_block) override
Disconnect the Tracking block adapter.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) override
Set acquisition/tracking common Gnss_Synchro object pointer to efficiently exchange synchronization d...
void stop_tracking() override
Stop the tracking process in the FPGA.
This class represents an interface to a tracking block.