GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
ad936x_iio_source.h
Go to the documentation of this file.
1 /*!
2  * \file ad936x_iio_source.h
3  * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the
4  * AD936x AD front-end family with special FPGA custom functionalities.
5  * \author Javier Arribas, jarribas(at)cttc.es
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-2022 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 
19 #ifndef GNSS_SDR_AD936X_IIO_SOURCE_H
20 #define GNSS_SDR_AD936X_IIO_SOURCE_H
21 
22 #include "ad936x_iio_custom.h"
23 #include "concurrent_queue.h"
24 #include "gnss_block_interface.h"
25 #include "ppstcprx.h"
26 #include <gnuradio/block.h>
27 #include <pmt/pmt.h>
28 #include <cstddef>
29 #include <cstdint>
30 #include <fstream>
31 #include <iostream>
32 #include <memory>
33 #include <string>
34 #include <thread>
35 #include <vector>
36 
37 /** \addtogroup Signal_Source
38  * \{ */
39 /** \addtogroup Signal_Source_gnuradio_blocks
40  * \{ */
41 
42 
43 class ad936x_iio_source;
44 
45 using ad936x_iio_source_sptr = gnss_shared_ptr<ad936x_iio_source>;
46 
47 ad936x_iio_source_sptr ad936x_iio_make_source_sptr(
48  const std::string &pluto_uri_,
49  const std::string &board_type_,
50  int64_t bandwidth_,
51  int64_t sample_rate_,
52  int64_t freq_,
53  const std::string &rf_port_select_,
54  const std::string &rf_filter,
55  const std::string &gain_mode_rx0_,
56  const std::string &gain_mode_rx1_,
57  double rf_gain_rx0_,
58  double rf_gain_rx1_,
59  bool enable_ch0,
60  bool enable_ch1,
61  int64_t freq_2ch,
62  bool ppsmode_,
63  bool customsamplesize_,
64  const std::string &fe_ip_,
65  int fe_ctlport_,
66  int ssize_,
67  int bshift_,
68  bool spattern_,
69  double lo_attenuation_db_,
70  bool high_side_lo_,
71  int tx_lo_channel_);
72 
73 /*!
74  * \brief This class implements conversion between Labsat 2, 3 and 3 Wideband
75  * formats to gr_complex
76  */
77 class ad936x_iio_source : public gr::block
78 {
79 public:
81 
82  //! start the sample transmission
83  bool start();
84  //! stop the sample transmission
85  bool stop();
86 
87  int general_work(int noutput_items,
88  gr_vector_int &ninput_items,
89  gr_vector_const_void_star &input_items,
90  gr_vector_void_star &output_items);
91 
92 private:
93  friend ad936x_iio_source_sptr ad936x_iio_make_source_sptr(
94  const std::string &pluto_uri_,
95  const std::string &board_type_,
96  int64_t bandwidth_,
97  int64_t sample_rate_,
98  int64_t freq_,
99  const std::string &rf_port_select_,
100  const std::string &rf_filter,
101  const std::string &gain_mode_rx0_,
102  const std::string &gain_mode_rx1_,
103  double rf_gain_rx0_,
104  double rf_gain_rx1_,
105  bool enable_ch0,
106  bool enable_ch1,
107  int64_t freq_2ch,
108  bool ppsmode_,
109  bool customsamplesize_,
110  const std::string &fe_ip_,
111  int fe_ctlport_,
112  int ssize_,
113  int bshift_,
114  bool spattern_,
115  double lo_attenuation_db_,
116  bool high_side_lo_,
117  int tx_lo_channel_);
118 
120  const std::string &pluto_uri_,
121  const std::string &board_type_,
122  int64_t bandwidth_,
123  int64_t sample_rate_,
124  int64_t freq_,
125  const std::string &rf_port_select_,
126  const std::string &rf_filter,
127  const std::string &gain_mode_rx0_,
128  const std::string &gain_mode_rx1_,
129  double rf_gain_rx0_,
130  double rf_gain_rx1_,
131  bool enable_ch0,
132  bool enable_ch1,
133  int64_t freq_2ch,
134  bool ppsmode_,
135  bool customsamplesize_,
136  const std::string &fe_ip_,
137  int fe_ctlport_,
138  int ssize_,
139  int bshift_,
140  bool spattern_,
141  double lo_attenuation_db_,
142  bool high_side_lo_,
143  int tx_lo_channel_);
144 
145  void ad9361_channel_demux_to_buffer(ad936x_iio_samples *samples_in, int nchannels, gr_vector_void_star &output_items);
146  void ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector<std::fstream> *files_out);
147 
148  std::thread pps_rx_thread;
149  std::unique_ptr<ad936x_iio_custom> ad936x_custom;
150  std::shared_ptr<pps_tcp_rx> pps_rx;
151  std::shared_ptr<Concurrent_Queue<PpsSamplestamp>> ppsqueue;
152 
153  std::vector<std::fstream> samplesfile;
154 };
155 
156 
157 /** \} */
158 /** \} */
159 #endif // GNSS_SDR_AD936X_IIO_SOURCE_H
Interface of a thread-safe std::queue.
This interface represents a GNSS block.
bool start()
start the sample transmission
TCP client class for front-end PPS samplestamp information reception.
This class implements conversion between Labsat 2, 3 and 3 Wideband formats to gr_complex.
A direct IIO custom front-end driver for the AD936x AD front-end family with special FPGA custom func...
bool stop()
stop the sample transmission