GNU Radio Manual and C++ API Reference  3.10.0.0
The Free & Open Software Radio Ecosystem
fmcomms5_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Analog Devices Inc.
4  * Author: Paul Cercueil <paul.cercueil@analog.com>
5  *
6  * SPDX-License-Identifier: GPL-3.0-or-later
7  *
8  */
9 
10 
11 #ifndef INCLUDED_IIO_FMCOMMS5_SINK_H
12 #define INCLUDED_IIO_FMCOMMS5_SINK_H
13 
14 #include <gnuradio/hier_block2.h>
15 #include <gnuradio/iio/api.h>
16 #include <gnuradio/sync_block.h>
17 
18 #include "device_sink.h"
19 
20 namespace gr {
21 namespace iio {
22 
23 /*!
24  * \brief Device specific sink for FMComms5 evaluation card
25  * \ingroup iio
26  *
27  * \details
28  * This block is a sink specifically designed for FMComms5 evaluation
29  * card. The FMComms5 is a dual AD9361 FMC card which enables 4x4
30  * applications.
31  */
32 class IIO_API fmcomms5_sink : virtual public gr::sync_block
33 {
34 public:
35  typedef std::shared_ptr<fmcomms5_sink> sptr;
36 
37  /*!
38  * \brief Return a shared_ptr to a new instance of iio::fmcomms5_sink.
39  *
40  * \param uri String of the context uri
41  * \param frequency1 Long long of LO frequency in Hz of chip A
42  * \param frequency2 Long long of LO frequency in Hz of chip B
43  * \param samplerate Long of sample rate in samples per second
44  * \param bandwidth Long of bandwidth of front-end analog filter in
45  * in Hz
46  * \param ch1_en Boolean enable channel 1
47  * \param ch2_en Boolean enable channel 2
48  * \param ch3_en Boolean enable channel 3
49  * \param ch4_en Boolean enable channel 4
50  * \param ch5_en Boolean enable channel 5
51  * \param ch6_en Boolean enable channel 6
52  * \param ch7_en Boolean enable channel 7
53  * \param ch8_en Boolean enable channel 8
54  * \param buffer_size Long of number of samples in buffer to send to device
55  * \param cyclic Boolean when True sends first buffer_size number of samples
56  * to hardware which is repeated in the hardware itself. Future
57  * samples are ignored.
58  * \param rf_port_select String of name of port to use for TX output mux
59  * with options: 'A', 'B'
60  * \param attenuation1 Double of TX channel 1 attenuation in dB [0, 90]
61  * \param attenuation2 Double of TX channel 2 attenuation in dB [0, 90]
62  * \param attenuation3 Double of TX channel 3 attenuation in dB [0, 90]
63  * \param attenuation4 Double of TX channel 4 attenuation in dB [0, 90]
64  * \param filter_source String which selects filter configuration with
65  * options:
66  * - 'Off': Disable filter
67  * - 'Auto': Use auto-generated filters
68  * - 'File': Use provide filter filter in filter_filename input
69  * - 'Design': Create filter from Fpass, Fstop, samplerate, and
70  * bandwidth parameters
71  * \param filter_filename String of path to filter file
72  * \param Fpass Float of edge of passband frequency in Hz for designed FIR
73  * \param Fstop Float of edge of stopband frequency in Hz for designed FIR
74  */
75  static sptr make(const std::string& uri,
76  unsigned long long frequency1,
77  unsigned long long frequency2,
78  unsigned long samplerate,
79  unsigned long bandwidth,
80  bool ch1_en,
81  bool ch2_en,
82  bool ch3_en,
83  bool ch4_en,
84  bool ch5_en,
85  bool ch6_en,
86  bool ch7_en,
87  bool ch8_en,
88  unsigned long buffer_size,
89  bool cyclic,
90  const char* rf_port_select,
91  double attenuation1,
92  double attenuation2,
93  double attenuation3,
94  double attenuation4,
95  const char* filter_source = "",
96  const char* filter_filename = "",
97  float Fpass = 0.0,
98  float Fstop = 0.0);
99 
100  static sptr make_from(iio_context* ctx,
101  unsigned long long frequency1,
102  unsigned long long frequency2,
103  unsigned long samplerate,
104  unsigned long bandwidth,
105  bool ch1_en,
106  bool ch2_en,
107  bool ch3_en,
108  bool ch4_en,
109  bool ch5_en,
110  bool ch6_en,
111  bool ch7_en,
112  bool ch8_en,
113  unsigned long buffer_size,
114  bool cyclic,
115  const char* rf_port_select,
116  double attenuation1,
117  double attenuation2,
118  double attenuation3,
119  double attenuation4,
120  const char* filter_source = "",
121  const char* filter_filename = "",
122  float Fpass = 0.0,
123  float Fstop = 0.0);
124 
125  virtual void set_params(unsigned long long frequency1,
126  unsigned long long frequency2,
127  unsigned long samplerate,
128  unsigned long bandwidth,
129  const char* rf_port_select,
130  double attenuation1,
131  double attenuation2,
132  double attenuation3,
133  double attenuation4,
134  const char* filter_source,
135  const char* filter_filename,
136  float Fpass,
137  float Fstop) = 0;
138 };
139 
140 /*!
141  * \brief Device specific sink for FMComms5 evaluation card
142  * \ingroup iio
143  *
144  * \details
145  * This block is a sink specifically designed for FMComms5 evaluation
146  * card. The FMComms5 is a dual AD9361 FMC card which enables 4x4
147  * applications.
148  */
150 {
151 public:
152  typedef std::shared_ptr<fmcomms5_sink_f32c> sptr;
153 
154  /*!
155  * \brief Return a shared_ptr to a new instance of iio::fmcomms5_sink.
156  *
157  * \param uri String of the context uri
158  * \param frequency1 Long long of LO frequency in Hz of chip A
159  * \param frequency2 Long long of LO frequency in Hz of chip B
160  * \param samplerate Long of sample rate in samples per second
161  * \param bandwidth Long of bandwidth of front-end analog filter in
162  * in Hz
163  * \param tx1_en Boolean enable channel 1
164  * \param tx2_en Boolean enable channel 2
165  * \param tx3_en Boolean enable channel 3
166  * \param tx4_en Boolean enable channel 4
167  * \param buffer_size Long of number of samples in buffer to send to device
168  * \param cyclic Boolean when True sends first buffer_size number of samples
169  * to hardware which is repeated in the hardware itself. Future
170  * samples are ignored.
171  * \param rf_port_select String of name of port to use for TX output mux
172  * with options: 'A', 'B'
173  * \param attenuation1 Double of TX channel 1 attenuation in dB [0, 90]
174  * \param attenuation2 Double of TX channel 2 attenuation in dB [0, 90]
175  * \param attenuation3 Double of TX channel 3 attenuation in dB [0, 90]
176  * \param attenuation4 Double of TX channel 4 attenuation in dB [0, 90]
177  * \param filter_source String which selects filter configuration with
178  * options:
179  * - 'Off': Disable filter
180  * - 'Auto': Use auto-generated filters
181  * - 'File': Use provide filter filter in filter_filename input
182  * - 'Design': Create filter from Fpass, Fstop, samplerate, and
183  * bandwidth parameters
184  * \param filter_filename String of path to filter file
185  * \param Fpass Float of edge of passband frequency in Hz for designed FIR
186  * \param Fstop Float of edge of stopband frequency in Hz for designed FIR
187  */
188  static sptr make(const std::string& uri,
189  unsigned long long frequency1,
190  unsigned long long frequency2,
191  unsigned long samplerate,
192  unsigned long bandwidth,
193  bool tx1_en,
194  bool tx2_en,
195  bool tx3_en,
196  bool tx4_en,
197  unsigned long buffer_size,
198  bool cyclic,
199  const char* rf_port_select,
200  double attenuation1,
201  double attenuation2,
202  double attenuation3,
203  double attenuation4,
204  const char* filter_source = "",
205  const char* filter_filename = "",
206  float Fpass = 0.0,
207  float Fstop = 0.0)
208  {
210  frequency1,
211  frequency2,
212  samplerate,
213  bandwidth,
214  tx1_en,
215  tx1_en,
216  tx2_en,
217  tx2_en,
218  tx3_en,
219  tx3_en,
220  tx4_en,
221  tx4_en,
222  buffer_size,
223  cyclic,
224  rf_port_select,
225  attenuation1,
226  attenuation2,
227  attenuation3,
228  attenuation4,
229  filter_source,
230  filter_filename,
231  Fpass,
232  Fstop);
233 
234  return gnuradio::get_initial_sptr(
235  new fmcomms5_sink_f32c(tx1_en, tx2_en, tx3_en, tx4_en, block));
236  }
237 
238  void set_params(unsigned long long frequency1,
239  unsigned long long frequency2,
240  unsigned long samplerate,
241  unsigned long bandwidth,
242  const char* rf_port_select,
243  double attenuation1,
244  double attenuation2,
245  double attenuation3,
246  double attenuation4,
247  const char* filter_source,
248  const char* filter_filename,
249  float Fpass,
250  float Fstop)
251  {
252  fmcomms5_block->set_params(frequency1,
253  frequency2,
254  samplerate,
255  bandwidth,
256  rf_port_select,
257  attenuation1,
258  attenuation2,
259  attenuation3,
260  attenuation4,
261  filter_source,
262  filter_filename,
263  Fpass,
264  Fstop);
265  }
266 
267 private:
268  fmcomms5_sink::sptr fmcomms5_block;
269 
270 protected:
272  bool tx1_en, bool tx2_en, bool tx3_en, bool tx4_en, fmcomms5_sink::sptr block);
273 };
274 
275 } // namespace iio
276 } // namespace gr
277 
278 #endif /* INCLUDED_IIO_FMCOMMS5_SINK_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Hierarchical container class for gr::block's and gr::hier_block2's.
Definition: hier_block2.h:34
Device specific sink for FMComms5 evaluation card.
Definition: fmcomms5_sink.h:150
static sptr make(const std::string &uri, unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, bool tx1_en, bool tx2_en, bool tx3_en, bool tx4_en, unsigned long buffer_size, bool cyclic, const char *rf_port_select, double attenuation1, double attenuation2, double attenuation3, double attenuation4, const char *filter_source="", const char *filter_filename="", float Fpass=0.0, float Fstop=0.0)
Return a shared_ptr to a new instance of iio::fmcomms5_sink.
Definition: fmcomms5_sink.h:188
std::shared_ptr< fmcomms5_sink_f32c > sptr
Definition: fmcomms5_sink.h:152
fmcomms5_sink_f32c(bool tx1_en, bool tx2_en, bool tx3_en, bool tx4_en, fmcomms5_sink::sptr block)
void set_params(unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, const char *rf_port_select, double attenuation1, double attenuation2, double attenuation3, double attenuation4, const char *filter_source, const char *filter_filename, float Fpass, float Fstop)
Definition: fmcomms5_sink.h:238
Device specific sink for FMComms5 evaluation card.
Definition: fmcomms5_sink.h:33
static sptr make(const std::string &uri, unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en, bool ch5_en, bool ch6_en, bool ch7_en, bool ch8_en, unsigned long buffer_size, bool cyclic, const char *rf_port_select, double attenuation1, double attenuation2, double attenuation3, double attenuation4, const char *filter_source="", const char *filter_filename="", float Fpass=0.0, float Fstop=0.0)
Return a shared_ptr to a new instance of iio::fmcomms5_sink.
static sptr make_from(iio_context *ctx, unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, bool ch1_en, bool ch2_en, bool ch3_en, bool ch4_en, bool ch5_en, bool ch6_en, bool ch7_en, bool ch8_en, unsigned long buffer_size, bool cyclic, const char *rf_port_select, double attenuation1, double attenuation2, double attenuation3, double attenuation4, const char *filter_source="", const char *filter_filename="", float Fpass=0.0, float Fstop=0.0)
std::shared_ptr< fmcomms5_sink > sptr
Definition: fmcomms5_sink.h:35
virtual void set_params(unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, const char *rf_port_select, double attenuation1, double attenuation2, double attenuation3, double attenuation4, const char *filter_source, const char *filter_filename, float Fpass, float Fstop)=0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define IIO_API
Definition: gr-iio/include/gnuradio/iio/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29