GNSS-SDR  0.0.14
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  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2020 (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_AD9361_FPGA_SIGNAL_SOURCE_H
19 #define GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H
20 
21 #include "concurrent_queue.h"
23 #include "fpga_switch.h"
24 #include "gnss_block_interface.h"
25 #include <pmt/pmt.h>
26 #include <cstdint>
27 #include <memory>
28 #include <mutex>
29 #include <string>
30 #include <thread>
31 
32 
33 /** \addtogroup Signal_Source
34  * \{ */
35 /** \addtogroup Signal_Source_adapters
36  * \{ */
37 
38 
40 
42 {
43 public:
45  const std::string &role, unsigned int in_stream,
46  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t> *queue);
47 
49 
50  void start() override;
51 
52  inline std::string role() override
53  {
54  return role_;
55  }
56 
57  /*!
58  * \brief Returns "Ad9361_Fpga_Signal_Source"
59  */
60  inline std::string implementation() override
61  {
62  return "Ad9361_Fpga_Signal_Source";
63  }
64 
65  inline size_t item_size() override
66  {
67  return item_size_;
68  }
69 
70  void connect(gr::top_block_sptr top_block) override;
71  void disconnect(gr::top_block_sptr top_block) override;
72  gr::basic_block_sptr get_left_block() override;
73  gr::basic_block_sptr get_right_block() override;
74 
75 private:
76  const std::string switch_device_name = "AXIS_Switch_v1_0_0"; // Switch UIO device name
77  const std::string dyn_bit_sel_device_name = "dynamic_bits_selector"; // Switch UIO device name
78 
79  // perform dynamic bit selection every 500 ms by default
80  static const uint32_t Gain_control_period_ms = 500;
81 
82  void run_DMA_process(const std::string &FreqBand,
83  const std::string &Filename1,
84  const std::string &Filename2);
85 
86  void run_dynamic_bit_selection_process();
87 
88  std::thread thread_file_to_dma;
89  std::thread thread_dynamic_bit_selection;
90 
91  std::shared_ptr<Fpga_Switch> switch_fpga;
92  std::shared_ptr<Fpga_dynamic_bit_selection> dynamic_bit_selection_fpga;
93 
94  std::string role_;
95 
96  // Front-end settings
97  std::string gain_mode_rx1_;
98  std::string gain_mode_rx2_;
99  std::string rf_port_select_;
100  std::string filter_file_;
101  std::string filter_source_;
102  std::string filter_filename_;
103  std::string filename_rx1;
104  std::string filename_rx2;
105  std::string freq_band;
106 
107  std::mutex dma_mutex;
108  std::mutex dynamic_bit_selection_mutex;
109 
110  double rf_gain_rx1_;
111  double rf_gain_rx2_;
112  uint64_t freq_; // frequency of local oscillator
113  uint64_t sample_rate_;
114  uint64_t bandwidth_;
115  float Fpass_;
116  float Fstop_;
117 
118  // DDS configuration for LO generation for external mixer
119  double scale_dds_dbfs_;
120  double phase_dds_deg_;
121  double tx_attenuation_db_;
122  uint64_t freq_rf_tx_hz_;
123  uint64_t freq_dds_tx_hz_;
124  uint64_t tx_bandwidth_;
125  size_t item_size_;
126  uint32_t in_stream_;
127  uint32_t out_stream_;
128  int32_t switch_position;
129  bool enable_dds_lo_;
130 
131  bool filter_auto_;
132  bool quadrature_;
133  bool rf_dc_;
134  bool bb_dc_;
135  bool rx1_enable_;
136  bool rx2_enable_;
137  bool enable_DMA_;
138  bool enable_dynamic_bit_selection_;
139  bool rf_shutdown_;
140 };
141 
142 
143 /** \} */
144 /** \} */
145 #endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
void start() override
Start the flow of samples if needed.
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".