GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
fmcomms5_source.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2014 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_SOURCE_H
12#define INCLUDED_IIO_FMCOMMS5_SOURCE_H
13
15#include <gnuradio/iio/api.h>
16#include <gnuradio/sync_block.h>
17
18#include "device_source.h"
19
20namespace gr {
21namespace iio {
22
23/*!
24 * \brief Device specific source for the FMComms5 evaluation card
25 * \ingroup iio
26 *
27 * \details
28 * This block is a source specifically designed for FMComms5 evaluation
29 * card. The FMComms5 is a dual AD9361 FMC card which enables 4x4
30 * applications.
31 */
33{
34public:
35 typedef std::shared_ptr<fmcomms5_source> sptr;
36
37 /*!
38 * \brief Return a shared_ptr to a new instance of iio::device.
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 A
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 quadrature Boolean enable RX quadrature tracking
55 * \param rfdc Boolean enable RX RF DC tracking
56 * \param bbdc Boolean enable RX Baseband DC tracking
57 * \param buffer_size Long of number of samples in buffer to send to device
58 * \param rf_port_select String of name of port to use for TX output mux
59 * with options:
60 * - 'A_BALANCED'
61 * - 'B_BALANCED'
62 * - 'C_BALANCED'
63 * - 'A_N'
64 * - 'A_P'
65 * - 'B_N'
66 * - 'B_P'
67 * - 'C_N'
68 * - 'C_P'
69 * - 'TX_MONITOR1'
70 * - 'TX_MONITOR2'
71 * - 'TX_MONITOR1_2'
72 * \param gain1 String of gain mode for channel 1 with options:
73 * - 'manual'
74 * - 'slow_attack'
75 * - 'fast_attack'
76 * - 'hybrid'
77 * \param gain1_value Double of RX channel 1 gain in dB [0, 76]
78 * \param gain2 String of gain mode for channel 2 with options:
79 * - 'manual'
80 * - 'slow_attack'
81 * - 'fast_attack'
82 * - 'hybrid'
83 * \param gain2_value Double of RX channel 2 gain in dB [0, 76]
84 * \param gain3 String of gain mode for channel 3 with options:
85 * - 'manual'
86 * - 'slow_attack'
87 * - 'fast_attack'
88 * - 'hybrid'
89 * \param gain3_value Double of RX channel 3 gain in dB [0, 76]
90 * \param gain4 String of gain mode for channel 4 with options:
91 * - 'manual'
92 * - 'slow_attack'
93 * - 'fast_attack'
94 * - 'hybrid'
95 * \param gain4_value Double of RX channel 4 gain in dB [0, 76]
96 * \param filter_source String which selects filter configuration with
97 * options:
98 * - 'Off': Disable filter
99 * - 'Auto': Use auto-generated filters
100 * - 'File': Use provide filter filter in filter_filename input
101 * - 'Design': Create filter from Fpass, Fstop, samplerate, and
102 * bandwidth parameters
103 * \param filter_filename String of path to filter file
104 * \param Fpass Float of edge of passband frequency in Hz for designed FIR
105 * \param Fstop Float of edge of stopband frequency in Hz for designed FIR
106 */
107 static sptr make(const std::string& uri,
108 unsigned long long frequency1,
109 unsigned long long frequency2,
110 unsigned long samplerate,
111 unsigned long bandwidth,
112 bool ch1_en,
113 bool ch2_en,
114 bool ch3_en,
115 bool ch4_en,
116 bool ch5_en,
117 bool ch6_en,
118 bool ch7_en,
119 bool ch8_en,
120 unsigned long buffer_size,
121 bool quadrature,
122 bool rfdc,
123 bool bbdc,
124 const char* gain1,
125 double gain1_value,
126 const char* gain2,
127 double gain2_value,
128 const char* gain3,
129 double gain3_value,
130 const char* gain4,
131 double gain4_value,
132 const char* rf_port_select,
133 const char* filter_source = "",
134 const char* filter_filename = "",
135 float Fpass = 0.0,
136 float Fstop = 0.0);
137
138 static sptr make_from(iio_context* ctx,
139 unsigned long long frequency1,
140 unsigned long long frequency2,
141 unsigned long samplerate,
142 unsigned long bandwidth,
143 bool ch1_en,
144 bool ch2_en,
145 bool ch3_en,
146 bool ch4_en,
147 bool ch5_en,
148 bool ch6_en,
149 bool ch7_en,
150 bool ch8_en,
151 unsigned long buffer_size,
152 bool quadrature,
153 bool rfdc,
154 bool bbdc,
155 const char* gain1,
156 double gain1_value,
157 const char* gain2,
158 double gain2_value,
159 const char* gain3,
160 double gain3_value,
161 const char* gain4,
162 double gain4_value,
163 const char* rf_port_select,
164 const char* filter_source = "",
165 const char* filter_filename = "",
166 float Fpass = 0.0,
167 float Fstop = 0.0);
168
169 virtual void set_params(unsigned long long frequency1,
170 unsigned long long frequency2,
171 unsigned long samplerate,
172 unsigned long bandwidth,
173 bool quadrature,
174 bool rfdc,
175 bool bbdc,
176 const char* gain1,
177 double gain1_value,
178 const char* gain2,
179 double gain2_value,
180 const char* gain3,
181 double gain3_value,
182 const char* gain4,
183 double gain4_value,
184 const char* rf_port_select,
185 const char* filter_source,
186 const char* filter_filename,
187 float Fpass,
188 float Fstop) = 0;
189};
190
191/*!
192 * \brief Device specific source for the FMComms5 evaluation card
193 * \ingroup iio
194 *
195 * \details
196 * This block is a source specifically designed for FMComms5 evaluation
197 * card. The FMComms5 is a dual AD9361 FMC card which enables 4x4
198 * applications.
199 */
201{
202public:
203 typedef std::shared_ptr<fmcomms5_source_f32c> sptr;
204
205 /*!
206 * \brief Return a shared_ptr to a new instance of iio::device.
207 *
208 * \param uri String of the context uri
209 * \param frequency1 Long long of LO frequency in Hz of chip A
210 * \param frequency2 Long long of LO frequency in Hz of chip A
211 * \param samplerate Long of sample rate in samples per second
212 * \param bandwidth Long of bandwidth of front-end analog filter in
213 * in Hz
214 * \param rx1_en Boolean enable channel 1
215 * \param rx2_en Boolean enable channel 2
216 * \param rx3_en Boolean enable channel 3
217 * \param rx4_en Boolean enable channel 4
218 * \param quadrature Boolean enable RX quadrature tracking
219 * \param rfdc Boolean enable RX RF DC tracking
220 * \param bbdc Boolean enable RX Baseband DC tracking
221 * \param buffer_size Long of number of samples in buffer to send to device
222 * \param rf_port_select String of name of port to use for TX output mux
223 * with options:
224 * - 'A_BALANCED'
225 * - 'B_BALANCED'
226 * - 'C_BALANCED'
227 * - 'A_N'
228 * - 'A_P'
229 * - 'B_N'
230 * - 'B_P'
231 * - 'C_N'
232 * - 'C_P'
233 * - 'TX_MONITOR1'
234 * - 'TX_MONITOR2'
235 * - 'TX_MONITOR1_2'
236 * \param gain1 String of gain mode for channel 1 with options:
237 * - 'manual'
238 * - 'slow_attack'
239 * - 'fast_attack'
240 * - 'hybrid'
241 * \param gain1_value Double of RX channel 1 gain in dB [0, 76]
242 * \param gain2 String of gain mode for channel 2 with options:
243 * - 'manual'
244 * - 'slow_attack'
245 * - 'fast_attack'
246 * - 'hybrid'
247 * \param gain2_value Double of RX channel 2 gain in dB [0, 76]
248 * \param gain3 String of gain mode for channel 3 with options:
249 * - 'manual'
250 * - 'slow_attack'
251 * - 'fast_attack'
252 * - 'hybrid'
253 * \param gain3_value Double of RX channel 3 gain in dB [0, 76]
254 * \param gain4 String of gain mode for channel 4 with options:
255 * - 'manual'
256 * - 'slow_attack'
257 * - 'fast_attack'
258 * - 'hybrid'
259 * \param gain4_value Double of RX channel 4 gain in dB [0, 76]
260 * \param filter_source String which selects filter configuration with
261 * options:
262 * - 'Off': Disable filter
263 * - 'Auto': Use auto-generated filters
264 * - 'File': Use provide filter filter in filter_filename input
265 * - 'Design': Create filter from Fpass, Fstop, samplerate, and
266 * bandwidth parameters
267 * \param filter_filename String of path to filter file
268 * \param Fpass Float of edge of passband frequency in Hz for designed FIR
269 * \param Fstop Float of edge of stopband frequency in Hz for designed FIR
270 */
271 static sptr make(const std::string& uri,
272 unsigned long long frequency1,
273 unsigned long long frequency2,
274 unsigned long samplerate,
275 unsigned long bandwidth,
276 bool rx1_en,
277 bool rx2_en,
278 bool rx3_en,
279 bool rx4_en,
280 unsigned long buffer_size,
281 bool quadrature,
282 bool rfdc,
283 bool bbdc,
284 const char* gain1,
285 double gain1_value,
286 const char* gain2,
287 double gain2_value,
288 const char* gain3,
289 double gain3_value,
290 const char* gain4,
291 double gain4_value,
292 const char* rf_port_select,
293 const char* filter_source = "",
294 const char* filter_filename = "",
295 float Fpass = 0.0,
296 float Fstop = 0.0)
297 {
299 frequency1,
300 frequency2,
301 samplerate,
302 bandwidth,
303 rx1_en,
304 rx1_en,
305 rx2_en,
306 rx2_en,
307 rx3_en,
308 rx3_en,
309 rx4_en,
310 rx4_en,
311 buffer_size,
312 quadrature,
313 rfdc,
314 bbdc,
315 gain1,
316 gain1_value,
317 gain2,
318 gain2_value,
319 gain3,
320 gain3_value,
321 gain4,
322 gain4_value,
323 rf_port_select,
324 filter_source,
325 filter_filename,
326 Fpass,
327 Fstop);
328
329 return gnuradio::make_block_sptr<fmcomms5_source_f32c>(
330 rx1_en, rx2_en, rx3_en, rx4_en, block);
331 }
332
333 void set_params(unsigned long long frequency1,
334 unsigned long long frequency2,
335 unsigned long samplerate,
336 unsigned long bandwidth,
337 bool quadrature,
338 bool rfdc,
339 bool bbdc,
340 const char* gain1,
341 double gain1_value,
342 const char* gain2,
343 double gain2_value,
344 const char* gain3,
345 double gain3_value,
346 const char* gain4,
347 double gain4_value,
348 const char* rf_port_select,
349 const char* filter_source,
350 const char* filter_filename,
351 float Fpass,
352 float Fstop)
353 {
354 fmcomms5_block->set_params(frequency1,
355 frequency2,
356 samplerate,
357 bandwidth,
358 quadrature,
359 rfdc,
360 bbdc,
361 gain1,
362 gain1_value,
363 gain2,
364 gain2_value,
365 gain3,
366 gain3_value,
367 gain4,
368 gain4_value,
369 rf_port_select,
370 filter_source,
371 filter_filename,
372 Fpass,
373 Fstop);
374 }
375
376private:
377 fmcomms5_source::sptr fmcomms5_block;
378
379protected:
381 bool rx1_en, bool rx2_en, bool rx3_en, bool rx4_en, fmcomms5_source::sptr block);
382};
383
384} // namespace iio
385} // namespace gr
386
387#endif /* INCLUDED_IIO_FMCOMMS5_SOURCE_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 source for the FMComms5 evaluation card.
Definition: fmcomms5_source.h:201
fmcomms5_source_f32c(bool rx1_en, bool rx2_en, bool rx3_en, bool rx4_en, fmcomms5_source::sptr block)
std::shared_ptr< fmcomms5_source_f32c > sptr
Definition: fmcomms5_source.h:203
static sptr make(const std::string &uri, unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, bool rx1_en, bool rx2_en, bool rx3_en, bool rx4_en, unsigned long buffer_size, bool quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *gain3, double gain3_value, const char *gain4, double gain4_value, const char *rf_port_select, 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::device.
Definition: fmcomms5_source.h:271
void set_params(unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, bool quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *gain3, double gain3_value, const char *gain4, double gain4_value, const char *rf_port_select, const char *filter_source, const char *filter_filename, float Fpass, float Fstop)
Definition: fmcomms5_source.h:333
Device specific source for the FMComms5 evaluation card.
Definition: fmcomms5_source.h:33
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 quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *gain3, double gain3_value, const char *gain4, double gain4_value, const char *rf_port_select, const char *filter_source="", const char *filter_filename="", float Fpass=0.0, float Fstop=0.0)
virtual void set_params(unsigned long long frequency1, unsigned long long frequency2, unsigned long samplerate, unsigned long bandwidth, bool quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *gain3, double gain3_value, const char *gain4, double gain4_value, const char *rf_port_select, const char *filter_source, const char *filter_filename, float Fpass, float Fstop)=0
std::shared_ptr< fmcomms5_source > sptr
Definition: fmcomms5_source.h:35
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 quadrature, bool rfdc, bool bbdc, const char *gain1, double gain1_value, const char *gain2, double gain2_value, const char *gain3, double gain3_value, const char *gain4, double gain4_value, const char *rf_port_select, 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::device.
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