GNSS-SDR  0.0.19
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 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 
18 #ifndef GNSS_SDR_AD936X_IIO_SOURCE_H
19 #define GNSS_SDR_AD936X_IIO_SOURCE_H
20 
21 #include "ad936x_iio_custom.h"
22 #include "concurrent_queue.h"
23 #include "gnss_block_interface.h"
24 #include "ppstcprx.h"
25 #include <gnuradio/block.h>
26 #include <pmt/pmt.h>
27 #include <cstddef>
28 #include <cstdint>
29 #include <fstream>
30 #include <iostream>
31 #include <memory>
32 #include <string>
33 #include <thread>
34 #include <vector>
35 
36 /** \addtogroup Signal_Source
37  * \{ */
38 /** \addtogroup Signal_Source_gnuradio_blocks
39  * \{ */
40 
41 
42 class ad936x_iio_source;
43 
44 using ad936x_iio_source_sptr = gnss_shared_ptr<ad936x_iio_source>;
45 
46 ad936x_iio_source_sptr ad936x_iio_make_source_sptr(
47  std::string pluto_uri_,
48  std::string board_type_,
49  long long bandwidth_,
50  long long sample_rate_,
51  long long freq_,
52  std::string rf_port_select_,
53  std::string rf_filter,
54  std::string gain_mode_rx0_,
55  std::string gain_mode_rx1_,
56  double rf_gain_rx0_,
57  double rf_gain_rx1_,
58  bool enable_ch0,
59  bool enable_ch1,
60  long long freq_2ch,
61  bool ppsmode_,
62  bool customsamplesize_,
63  std::string fe_ip_,
64  int fe_ctlport_,
65  int ssize_,
66  int bshift_,
67  bool spattern_,
68  double lo_attenuation_db_,
69  bool high_side_lo_,
70  int tx_lo_channel_);
71 
72 /*!
73  * \brief This class implements conversion between Labsat 2, 3 and 3 Wideband
74  * formats to gr_complex
75  */
76 class ad936x_iio_source : public gr::block
77 {
78 public:
80 
81  //! start the sample transmission
82  bool start();
83  //! stop the sample transmission
84  bool stop();
85 
86  int general_work(int noutput_items,
87  gr_vector_int &ninput_items,
88  gr_vector_const_void_star &input_items,
89  gr_vector_void_star &output_items);
90 
91 private:
92  friend ad936x_iio_source_sptr ad936x_iio_make_source_sptr(
93  std::string pluto_uri_,
94  std::string board_type_,
95  long long bandwidth_,
96  long long sample_rate_,
97  long long freq_,
98  std::string rf_port_select_,
99  std::string rf_filter,
100  std::string gain_mode_rx0_,
101  std::string gain_mode_rx1_,
102  double rf_gain_rx0_,
103  double rf_gain_rx1_,
104  bool enable_ch0,
105  bool enable_ch1,
106  long long freq_2ch,
107  bool ppsmode_,
108  bool customsamplesize_,
109  std::string fe_ip_,
110  int fe_ctlport_,
111  int ssize_,
112  int bshift_,
113  bool spattern_,
114  double lo_attenuation_db_,
115  bool high_side_lo_,
116  int tx_lo_channel_);
117 
119  std::string pluto_uri_,
120  std::string board_type_,
121  long long bandwidth_,
122  long long sample_rate_,
123  long long freq_,
124  std::string rf_port_select_,
125  std::string rf_filter,
126  std::string gain_mode_rx0_,
127  std::string gain_mode_rx1_,
128  double rf_gain_rx0_,
129  double rf_gain_rx1_,
130  bool enable_ch0,
131  bool enable_ch1,
132  long long freq_2ch,
133  bool ppsmode_,
134  bool customsamplesize_,
135  std::string fe_ip_,
136  int fe_ctlport_,
137  int ssize_,
138  int bshift_,
139  bool spattern_,
140  double lo_attenuation_db_,
141  bool high_side_lo_,
142  int tx_lo_channel_);
143 
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