GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
fmcomms2_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file fmcomms2_signal_source.h
3  * \brief Interface to use SDR hardware based in FMCOMMS2 driver from analog
4  * devices, for example FMCOMMS4 and ADALM-PLUTO (PlutoSdr)
5  * \author Rodrigo Muñoz, 2017. rmunozl(at)inacap.cl, rodrigo.munoz(at)proteinlab.cl
6  *
7  *
8  * This class represent a fmcomms2 signal source. It use the gr_iio block
9  * -----------------------------------------------------------------------------
10  *
11  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12  * This file is part of GNSS-SDR.
13  *
14  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 #ifndef GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H
21 #define GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H
22 
23 #include "signal_source_base.h"
24 #include <gnuradio/blocks/file_sink.h>
25 #if GRIIO_INCLUDE_HAS_GNURADIO
26 #include <gnuradio/iio/fmcomms2_source.h>
27 #else
28 #include <iio/fmcomms2_source.h>
29 #endif
30 #include "concurrent_queue.h"
31 #include <pmt/pmt.h>
32 #include <cstdint>
33 #include <string>
34 
35 
36 /** \addtogroup Signal_Source
37  * \{ */
38 /** \addtogroup Signal_Source_adapters
39  * \{ */
40 
41 
43 
45 {
46 public:
47  Fmcomms2SignalSource(const ConfigurationInterface* configuration,
48  const std::string& role, unsigned int in_stream,
49  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
50 
52 
53  inline size_t item_size() override
54  {
55  return item_size_;
56  }
57 
58  void connect(gr::top_block_sptr top_block) override;
59  void disconnect(gr::top_block_sptr top_block) override;
60  gr::basic_block_sptr get_left_block() override;
61  gr::basic_block_sptr get_right_block() override;
62 
63 private:
64  const std::string default_gain_mode = std::string("slow_attack");
65  const double default_tx_attenuation_db = -10.0;
66 
67 #if GNURADIO_API_IIO
68 #if GR_IIO_TEMPLATIZED_API
69  gr::iio::fmcomms2_source<gr_complex>::sptr fmcomms2_source_f32c_;
70 #else
71  gr::iio::fmcomms2_source::sptr fmcomms2_source_f32c_;
72 #endif
73 #else
74  gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_;
75 #endif
76  gnss_shared_ptr<gr::block> valve_;
77  gr::blocks::file_sink::sptr file_sink_;
78 
79  std::string item_type_;
80  std::string dump_filename_;
81 
82  // Front-end settings
83  std::string uri_; // device direction
84  std::string gain_mode_rx1_;
85  std::string gain_mode_rx2_;
86  std::string rf_port_select_;
87  std::string filter_file_;
88  std::string filter_source_;
89  std::string filter_filename_;
90 
91  int64_t samples_;
92  size_t item_size_;
93 
94  double rf_gain_rx1_;
95  double rf_gain_rx2_;
96  uint64_t freq_; // frequency of local oscilator
97  uint64_t sample_rate_;
98  uint64_t bandwidth_;
99  uint64_t buffer_size_; // reception buffer
100  float Fpass_;
101  float Fstop_;
102  unsigned int in_stream_;
103  unsigned int out_stream_;
104  int RF_channels_;
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_dds_tx_hz_;
111  uint64_t freq_rf_tx_hz_;
112  uint64_t tx_bandwidth_;
113  bool enable_dds_lo_;
114 
115  bool rx1_en_;
116  bool rx2_en_;
117  bool quadrature_;
118  bool rf_dc_;
119  bool bb_dc_;
120  bool filter_auto_;
121  bool rf_shutdown_;
122  bool dump_;
123 };
124 
125 
126 /** \} */
127 /** \} */
128 #endif // GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
Header file of the base class to signal_source GNSS blocks.
This abstract class represents an interface to configuration parameters.