GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
ad936x_custom_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file ad936x_custom_signal_source.h
3  * \brief A direct IIO custom front-end gnss-sdr signal source for the AD936x AD front-end family with special FPGA custom functionalities.
4  * \author Javier Arribas, jarribas(at)cttc.es
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 #ifndef GNSS_SDR_Ad936xCustom_SIGNAL_SOURCE_H
18 #define GNSS_SDR_Ad936xCustom_SIGNAL_SOURCE_H
19 
20 #include "ad936x_iio_source.h"
21 #include "concurrent_queue.h"
22 #include "conjugate_cc.h"
23 #include "signal_source_base.h"
26 #include "unpack_short_byte_samples.h"
27 #include <gnuradio/blocks/char_to_short.h>
28 #include <gnuradio/blocks/file_sink.h>
29 // #include <gnuradio/blocks/interleaved_char_to_complex.h>
30 #include <gnuradio/blocks/delay.h>
31 #include <gnuradio/blocks/interleaved_short_to_complex.h>
32 #include <pmt/pmt.h>
33 #include <cstdint>
34 #include <memory>
35 #include <stdexcept>
36 #include <string>
37 #include <vector>
38 
39 /** \addtogroup Signal_Source
40  * \{ */
41 /** \addtogroup Signal_Source_adapters
42  * \{ */
43 
44 
46 
47 /*!
48  * \brief This class instantiates the Ad936xCustom gnuradio signal source.
49  * It has support also for a customized Ad936xCustom firmware and signal source to support PPS samplestamp reading.
50  */
52 {
53 public:
55  const std::string& role, unsigned int in_stream,
56  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
57 
58  ~Ad936xCustomSignalSource() = default;
59 
60  inline size_t item_size() override
61  {
62  return item_size_;
63  }
64 
65  void connect(gr::top_block_sptr top_block) override;
66  void disconnect(gr::top_block_sptr top_block) override;
67  gr::basic_block_sptr get_left_block() override;
68  gr::basic_block_sptr get_right_block() override;
69  gr::basic_block_sptr get_right_block(int RF_channel) override;
70 
71 private:
72  unsigned int in_stream_;
73  unsigned int out_stream_;
74  gr::block_sptr ad936x_iio_source;
75  std::vector<gr::blocks::file_sink::sptr> sink_;
76  std::vector<std::string> filename_vec_;
77 
78  gr::blocks::delay::sptr gr_delay;
79  std::vector<gr::blocks::char_to_short::sptr> gr_char_to_short_;
80  std::vector<gr::blocks::interleaved_short_to_complex::sptr> gr_interleaved_short_to_complex_;
81  // std::vector<gr::blocks::interleaved_char_to_complex::sptr> gr_interleaved_char_to_complex_;
82  std::vector<unpack_short_byte_samples_sptr> unpack_short_byte;
83  std::vector<unpack_byte_4bit_samples_sptr> unpack_byte_fourbits;
84  std::vector<unpack_byte_2bit_cpx_samples_sptr> unpack_byte_twobits;
85 
86  std::string item_type_;
87  size_t item_size_;
88  int64_t samples_;
89  bool dump_;
90  std::string dump_filename_;
91 
92  // Front-end settings
93  std::string pluto_uri_;
94  std::string board_type_;
95  long long sample_rate_;
96  long long bandwidth_;
97  long long freq_;
98  long long freq_2ch;
99  std::string rf_port_select_;
100  std::string rf_filter;
101  std::string gain_mode_rx0_;
102  std::string gain_mode_rx1_;
103  double rf_gain_rx0_;
104  double rf_gain_rx1_;
105  bool enable_ch0;
106  bool enable_ch1;
107  bool PPS_mode_;
108  std::string fe_ip_;
109  int fe_ctlport_;
110  int ssize_;
111  int bshift_;
112  bool spattern_;
113  bool inverted_spectrum_ch0_;
114  bool inverted_spectrum_ch1_;
115  double lo_attenuation_db_;
116  bool high_side_lo_;
117  int tx_lo_channel_;
118  double rx0_to_rx1_delay_ns_;
119  bool delay_enabled;
120  bool apply_delay_on_rx0;
121 
122  std::vector<bool> inverted_spectrum_vec;
123  int n_channels;
124 };
125 
126 
127 /** \} */
128 /** \} */
129 #endif // GNSS_SDR_Ad936xCustom_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
Unpacks byte samples to 2 bits complex samples. Packing Order Most Significant Nibble - Sample n Leas...
This class instantiates the Ad936xCustom gnuradio signal source. It has support also for a customized...
Header file of the base class to signal_source GNSS blocks.
This abstract class represents an interface to configuration parameters.
Conjugate a stream of gr_complex.
A direct IIO custom front-end gnss-sdr signal gnuradio block for the AD936x AD front-end family with ...
Unpacks byte samples to 4 bits samples. Packing Order Packing order in Nibble I0 I1 I2 I3 I0 I1 I2 I3...
This class implements conversion between Labsat 2, 3 and 3 Wideband formats to gr_complex.