1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
//
// Copyright 2020 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include "x400_dboard_iface.hpp"
#include <uhd/exception.hpp>
#include <uhdlib/rfnoc/rf_control/dboard_iface.hpp>
#include <string>
namespace uhd { namespace rfnoc {
/*! \brief Implementation of dboard_iface for unpopulated or unsupported daughterboards
*/
class null_dboard_impl : public uhd::usrp::x400::x400_dboard_iface
{
public:
using sptr = std::shared_ptr<null_dboard_impl>;
rf_control::gain_profile_iface::sptr get_tx_gain_profile_api() override
{
return rf_control::gain_profile_iface::sptr();
}
rf_control::gain_profile_iface::sptr get_rx_gain_profile_api() override
{
return rf_control::gain_profile_iface::sptr();
}
bool is_adc_self_cal_supported() override
{
return false;
}
uhd::usrp::x400::adc_self_cal_params_t get_adc_self_cal_params(double) override
{
return {
0.0,
0.0,
0.0,
0.0,
};
}
size_t get_chan_from_dboard_fe(const std::string& fe, direction_t) const override
{
if (fe == "0") {
return 0;
}
if (fe == "1") {
return 1;
}
throw uhd::key_error(std::string("[X400] Invalid frontend: ") + fe);
}
std::string get_dboard_fe_from_chan(size_t chan, direction_t) const override
{
if (chan == 0) {
return "0";
}
if (chan == 1) {
return "1";
}
throw uhd::lookup_error(
std::string("[X400] Invalid channel: ") + std::to_string(chan));
}
std::vector<usrp::pwr_cal_mgr::sptr>& get_pwr_mgr(direction_t) override
{
static std::vector<usrp::pwr_cal_mgr::sptr> empty_vtr;
return empty_vtr;
}
eeprom_map_t get_db_eeprom() override
{
return {};
}
std::string get_tx_antenna(const size_t) const override
{
return "";
}
std::vector<std::string> get_tx_antennas(const size_t) const override
{
return {};
}
void set_tx_antenna(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
std::string get_rx_antenna(const size_t) const override
{
return "";
}
std::vector<std::string> get_rx_antennas(const size_t) const override
{
return {};
}
void set_rx_antenna(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
double get_tx_frequency(const size_t) override
{
return 0;
}
double set_tx_frequency(const double, size_t) override
{
throw _no_dboard_exception();
}
void set_tx_tune_args(const device_addr_t&, const size_t) override
{
throw _no_dboard_exception();
}
freq_range_t get_tx_frequency_range(const size_t) const override
{
return meta_range_t(0.0, 0.0);
}
double get_rx_frequency(const size_t) override
{
return 0;
}
double set_rx_frequency(const double, const size_t) override
{
throw _no_dboard_exception();
}
void set_rx_tune_args(const device_addr_t&, const size_t) override
{
throw _no_dboard_exception();
}
freq_range_t get_rx_frequency_range(const size_t) const override
{
return meta_range_t(0.0, 0.0);
}
std::vector<std::string> get_tx_gain_names(const size_t) const override
{
return {};
}
gain_range_t get_tx_gain_range(const size_t) const override
{
return meta_range_t(0.0, 0.0);
}
gain_range_t get_tx_gain_range(const std::string&, const size_t) const override
{
return meta_range_t(0.0, 0.0);
}
double get_tx_gain(const size_t) override
{
return 0;
}
double get_tx_gain(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
double set_tx_gain(const double, const size_t) override
{
throw _no_dboard_exception();
}
double set_tx_gain(const double, const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
std::vector<std::string> get_rx_gain_names(const size_t) const override
{
return {};
}
gain_range_t get_rx_gain_range(const size_t) const override
{
throw _no_dboard_exception();
}
gain_range_t get_rx_gain_range(const std::string&, const size_t) const override
{
throw _no_dboard_exception();
}
double get_rx_gain(const size_t) override
{
return 0;
}
double get_rx_gain(const std::string&, const size_t) override
{
return 0;
}
double set_rx_gain(const double, const size_t) override
{
throw _no_dboard_exception();
}
double set_rx_gain(const double, const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
void set_rx_agc(const bool, const size_t) override
{
throw _no_dboard_exception();
}
meta_range_t get_tx_bandwidth_range(size_t) const override
{
return meta_range_t(0.0, 0.0);
}
double get_tx_bandwidth(const size_t) override
{
return 0;
}
double set_tx_bandwidth(const double, const size_t) override
{
throw _no_dboard_exception();
}
meta_range_t get_rx_bandwidth_range(size_t) const override
{
return meta_range_t(0.0, 0.0);
}
double get_rx_bandwidth(const size_t) override
{
return 0;
}
double set_rx_bandwidth(const double, const size_t) override
{
throw _no_dboard_exception();
}
std::vector<std::string> get_rx_lo_names(const size_t) const override
{
return {};
}
std::vector<std::string> get_rx_lo_sources(
const std::string&, const size_t) const override
{
throw _no_dboard_exception();
}
freq_range_t get_rx_lo_freq_range(const std::string&, const size_t) const override
{
throw _no_dboard_exception();
}
void set_rx_lo_source(const std::string&, const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
const std::string get_rx_lo_source(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
void set_rx_lo_export_enabled(bool, const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
bool get_rx_lo_export_enabled(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
double set_rx_lo_freq(double, const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
double get_rx_lo_freq(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
std::vector<std::string> get_tx_lo_names(const size_t) const override
{
return {};
}
std::vector<std::string> get_tx_lo_sources(const std::string&, const size_t) const override
{
throw _no_dboard_exception();
}
freq_range_t get_tx_lo_freq_range(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
void set_tx_lo_source(const std::string&, const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
const std::string get_tx_lo_source(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
void set_tx_lo_export_enabled(const bool, const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
bool get_tx_lo_export_enabled(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
double set_tx_lo_freq(const double, const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
double get_tx_lo_freq(const std::string&, const size_t) override
{
throw _no_dboard_exception();
}
void set_command_time(uhd::time_spec_t, const size_t) override
{
// nop
}
private:
uhd::runtime_error _no_dboard_exception() const
{
const std::string msg("No daughterboard or daughterboard with unrecognized PID.");
return uhd::runtime_error(msg);
}
};
}} // namespace uhd::rfnoc
|