GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
ad9361_fpga_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file ad9361_fpga_signal_source.h
3  * \brief signal source for Analog Devices front-end AD9361 connected directly to FPGA accelerators.
4  * This source implements only the AD9361 control. It is NOT compatible with conventional SDR acquisition and tracking blocks.
5  * Please use the fmcomms2 source if conventional SDR acquisition and tracking is selected in the configuration file.
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
10  *
11  * GNSS-SDR is a software defined Global Navigation
12  * Satellite Systems receiver
13  *
14  * This file is part of GNSS-SDR.
15  *
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H
22 #define GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H
23 
24 #include "concurrent_queue.h"
26 #include "fpga_switch.h"
27 #include "gnss_block_interface.h"
28 #include <pmt/pmt.h>
29 #include <cstdint>
30 #include <memory>
31 #include <mutex>
32 #include <string>
33 #include <thread>
34 
36 
38 {
39 public:
41  const std::string &role, unsigned int in_stream,
42  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t> *queue);
43 
45 
46  inline std::string role() override
47  {
48  return role_;
49  }
50 
51  /*!
52  * \brief Returns "Ad9361_Fpga_Signal_Source"
53  */
54  inline std::string implementation() override
55  {
56  return "Ad9361_Fpga_Signal_Source";
57  }
58 
59  inline size_t item_size() override
60  {
61  return item_size_;
62  }
63 
64  void connect(gr::top_block_sptr top_block) override;
65  void disconnect(gr::top_block_sptr top_block) override;
66  gr::basic_block_sptr get_left_block() override;
67  gr::basic_block_sptr get_right_block() override;
68 
69 private:
70  // perform dynamic bit selection every 500 ms by default
71  static const uint32_t Gain_control_period_ms = 500;
72 
73  void run_DMA_process(const std::string &FreqBand,
74  const std::string &Filename1,
75  const std::string &Filename2);
76 
77  void run_dynamic_bit_selection_process(void);
78 
79  std::thread thread_file_to_dma;
80  std::thread thread_dynamic_bit_selection;
81 
82  std::shared_ptr<Fpga_Switch> switch_fpga;
83  std::shared_ptr<Fpga_dynamic_bit_selection> dynamic_bit_selection_fpga;
84 
85  std::string role_;
86 
87  // Front-end settings
88  std::string gain_mode_rx1_;
89  std::string gain_mode_rx2_;
90  std::string rf_port_select_;
91  std::string filter_file_;
92  std::string filter_source_;
93  std::string filter_filename_;
94  std::string filename_rx1;
95  std::string filename_rx2;
96  std::string freq_band;
97 
98  double rf_gain_rx1_;
99  double rf_gain_rx2_;
100  uint64_t freq_; // frequency of local oscillator
101  uint64_t sample_rate_;
102  uint64_t bandwidth_;
103  float Fpass_;
104  float Fstop_;
105 
106  // DDS configuration for LO generation for external mixer
107  double scale_dds_dbfs_;
108  double phase_dds_deg_;
109  double tx_attenuation_db_;
110  uint64_t freq_rf_tx_hz_;
111  uint64_t freq_dds_tx_hz_;
112  uint64_t tx_bandwidth_;
113  size_t item_size_;
114  uint32_t in_stream_;
115  uint32_t out_stream_;
116  int32_t switch_position;
117  bool enable_dds_lo_;
118 
119  bool filter_auto_;
120  bool quadrature_;
121  bool rf_dc_;
122  bool bb_dc_;
123  bool rx1_enable_;
124  bool rx2_enable_;
125  bool enable_DMA_;
126  bool enable_dynamic_bit_selection_;
127  bool rf_shutdown_;
128 
129  std::mutex dma_mutex;
130  std::mutex dynamic_bit_selection_mutex;
131 };
132 
133 #endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
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.
This abstract class represents an interface to GNSS blocks.
Dynamic bit selection in the received signal.
std::string implementation() override
Returns "Ad9361_Fpga_Signal_Source".