GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
adrv9361_z7035_signal_source_fpga.h
Go to the documentation of this file.
1 /*!
2  * \file adrv9361_z7035_signal_source_fpga.h
3  * \brief Signal source for the Analog Devices ADRV9361-Z7035 evaluation board
4  * directly connected to the FPGA accelerators.
5  * This source implements only the AD9361 control. It is NOT compatible with
6  * conventional SDR acquisition and tracking blocks.
7  * Please use the fmcomms2 source if conventional SDR acquisition and tracking
8  * is selected in the configuration file.
9  *
10  * -----------------------------------------------------------------------------
11  *
12  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
13  * This file is part of GNSS-SDR.
14  *
15  * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H
22 #define GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H
23 
24 #include "concurrent_queue.h"
25 #include "fpga_buffer_monitor.h"
27 #include "fpga_switch.h"
28 #include "gnss_block_interface.h"
29 #include "signal_source_base.h"
30 #include <pmt/pmt.h>
31 #include <cstdint>
32 #include <memory>
33 #include <mutex>
34 #include <string>
35 #include <thread>
36 
37 
38 /** \addtogroup Signal_Source
39  * \{ */
40 /** \addtogroup Signal_Source_adapters
41  * \{ */
42 
43 
45 
47 {
48 public:
50  const std::string &role, unsigned int in_stream,
51  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t> *queue);
52 
54 
55  inline size_t item_size() override
56  {
57  return item_size_;
58  }
59 
60  void connect(gr::top_block_sptr top_block) override;
61  void disconnect(gr::top_block_sptr top_block) override;
62  gr::basic_block_sptr get_left_block() override;
63  gr::basic_block_sptr get_right_block() override;
64 
65 private:
66  const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat");
67  const std::string default_rf_port_select = std::string("A_BALANCED");
68  const std::string default_gain_mode = std::string("slow_attack");
69  const double default_tx_attenuation_db = -10.0;
70  const double default_manual_gain_rx1 = 64.0;
71  const double default_manual_gain_rx2 = 64.0;
72  const uint64_t default_bandwidth = 12500000;
73 
74  // perform dynamic bit selection every 500 ms by default
75  const uint32_t Gain_control_period_ms = 500;
76  // check buffer overflow and perform buffer monitoring every 1s by default
77  const uint32_t buffer_monitor_period_ms = 1000;
78  // buffer overflow and buffer monitoring initial delay
79  const uint32_t buffer_monitoring_initial_delay_ms = 2000;
80  const int32_t switch_to_real_time_mode = 2;
81 
82  void run_dynamic_bit_selection_process();
83  void run_buffer_monitor_process();
84 
85  mutable std::mutex dynamic_bit_selection_mutex;
86  mutable std::mutex buffer_monitor_mutex;
87 
88  std::thread thread_dynamic_bit_selection;
89  std::thread thread_buffer_monitor;
90 
91  std::shared_ptr<Fpga_Switch> switch_fpga;
92  std::shared_ptr<Fpga_dynamic_bit_selection> dynamic_bit_selection_fpga;
93  std::shared_ptr<Fpga_buffer_monitor> buffer_monitor_fpga;
94 
95  std::string gain_mode_rx1_;
96  std::string gain_mode_rx2_;
97  std::string rf_port_select_;
98  std::string filter_file_;
99  std::string filter_source_;
100  std::string filter_filename_;
101 
102  double rf_gain_rx1_;
103  double rf_gain_rx2_;
104  double scale_dds_dbfs_;
105  double phase_dds_deg_;
106  double tx_attenuation_db_;
107 
108  uint64_t freq0_; // frequency of local oscillator for ADRV9361-A 0
109  uint64_t sample_rate_;
110  uint64_t bandwidth_;
111  uint64_t freq_dds_tx_hz_;
112  uint64_t freq_rf_tx_hz_;
113  uint64_t tx_bandwidth_;
114 
115  float Fpass_;
116  float Fstop_;
117  uint32_t in_stream_;
118  uint32_t out_stream_;
119 
120  size_t item_size_;
121 
122  bool enable_dds_lo_;
123  bool quadrature_;
124  bool rf_dc_;
125  bool bb_dc_;
126  bool rx1_enable_;
127  bool rx2_enable_;
128  bool enable_dynamic_bit_selection_;
129  bool enable_ovf_check_buffer_monitor_active_;
130  bool dump_;
131  bool rf_shutdown_;
132 };
133 
134 
135 /** \} */
136 /** \} */
137 #endif // GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H
Interface of a thread-safe std::queue.
Header file of the base class to signal_source GNSS blocks.
Check receiver buffer overflow and monitor the status of the receiver buffers.
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
Switch that connects the HW accelerator queues to the analog front end or the DMA.
Dynamic bit selection in the received signal.