|
|
|
@ -105,18 +105,19 @@ private:
|
|
|
|
|
template <class T>
|
|
|
|
|
uhd_error parse_param(uhd::device_addr_t& args, const std::string& param, T& value, bool pop = true)
|
|
|
|
|
{
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this,
|
|
|
|
|
// Check if parameter exists
|
|
|
|
|
if (not args.has_key(param)) {
|
|
|
|
|
last_error = "RF-NOC requires " + param + " parameter";
|
|
|
|
|
return UHD_ERROR_KEY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse parameter
|
|
|
|
|
value = args.cast(param, value);
|
|
|
|
|
|
|
|
|
|
// Remove parameter from list
|
|
|
|
|
if (pop) args.pop(param);)
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this,
|
|
|
|
|
// Check if parameter exists
|
|
|
|
|
if (not args.has_key(param)) {
|
|
|
|
|
last_error = "RF-NOC requires " + param + " parameter";
|
|
|
|
|
return UHD_ERROR_KEY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse parameter
|
|
|
|
|
value = args.cast(param, value);
|
|
|
|
|
|
|
|
|
|
// Remove parameter from list
|
|
|
|
|
if (pop) args.pop(param);)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uhd_error parse_args(uhd::device_addr_t& args)
|
|
|
|
@ -227,7 +228,6 @@ private:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t j = 0; j < nof_channels; j++) {
|
|
|
|
|
|
|
|
|
|
uhd::device_addr_t args;
|
|
|
|
|
args.set("input_rate", std::to_string(master_clock_rate));
|
|
|
|
|
args.set("fullscale", "1.0");
|
|
|
|
@ -262,7 +262,6 @@ private:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t j = 0; j < nof_channels; j++) {
|
|
|
|
|
|
|
|
|
|
uhd::device_addr_t args;
|
|
|
|
|
args.set("output_rate", std::to_string(master_clock_rate));
|
|
|
|
|
args.set("fullscale", "1.0");
|
|
|
|
@ -462,15 +461,16 @@ public:
|
|
|
|
|
};
|
|
|
|
|
uhd_error get_mboard_sensor_names(std::vector<std::string>& sensors) override
|
|
|
|
|
{
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this, if (device3->get_tree()->exists(TREE_MBOARD_SENSORS)) {
|
|
|
|
|
sensors = device3->get_tree()->list(TREE_MBOARD_SENSORS);
|
|
|
|
|
})
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this, if (device3->get_tree()->exists(TREE_MBOARD_SENSORS)) {
|
|
|
|
|
sensors = device3->get_tree()->list(TREE_MBOARD_SENSORS);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
uhd_error get_rx_sensor_names(std::vector<std::string>& sensors) override
|
|
|
|
|
{
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this, if (device3->get_tree()->exists(TREE_RX_SENSORS)) {
|
|
|
|
|
sensors = device3->get_tree()->list(TREE_RX_SENSORS);
|
|
|
|
|
})
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this,
|
|
|
|
|
if (device3->get_tree()->exists(TREE_RX_SENSORS)) { sensors = device3->get_tree()->list(TREE_RX_SENSORS); })
|
|
|
|
|
}
|
|
|
|
|
uhd_error get_sensor(const std::string& sensor_name, double& sensor_value) override
|
|
|
|
|
{
|
|
|
|
@ -495,24 +495,29 @@ public:
|
|
|
|
|
uhd_error set_time_unknown_pps(const uhd::time_spec_t& timespec) override
|
|
|
|
|
{
|
|
|
|
|
Info("Setting time " << timespec.get_real_secs() << " at next PPS...");
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this, for (auto& r : radio_ctrl) { r->set_time_next_pps(timespec); });
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this,
|
|
|
|
|
for (auto& r
|
|
|
|
|
: radio_ctrl) { r->set_time_next_pps(timespec); });
|
|
|
|
|
}
|
|
|
|
|
uhd_error get_time_now(uhd::time_spec_t& timespec) override
|
|
|
|
|
{
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this, timespec = device3->get_tree()->access<uhd::time_spec_t>(TREE_TIME_NOW).get();
|
|
|
|
|
Info("-- " << timespec.get_real_secs());)
|
|
|
|
|
}
|
|
|
|
|
uhd_error set_sync_source(const std::string& source) override
|
|
|
|
|
uhd_error set_sync_source(const std::string& sync_source, const std::string& clock_source) override
|
|
|
|
|
{
|
|
|
|
|
if (loopback) {
|
|
|
|
|
return UHD_ERROR_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this, for (size_t radio_idx = 0; radio_idx < nof_radios; radio_idx++) {
|
|
|
|
|
UHD_LOG_DEBUG(radio_id[radio_idx], "Setting sync source to " << source);
|
|
|
|
|
radio_ctrl[radio_idx]->set_clock_source(source);
|
|
|
|
|
radio_ctrl[radio_idx]->set_time_source(source);
|
|
|
|
|
})
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this, for (size_t radio_idx = 0; radio_idx < nof_radios; radio_idx++) {
|
|
|
|
|
UHD_LOG_DEBUG(radio_id[radio_idx],
|
|
|
|
|
"Setting PPS source to '" << sync_source << "' and clock source to '" << clock_source << "'");
|
|
|
|
|
radio_ctrl[radio_idx]->set_clock_source(clock_source);
|
|
|
|
|
radio_ctrl[radio_idx]->set_time_source(sync_source);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
uhd_error get_gain_range(uhd::gain_range_t& tx_gain_range, uhd::gain_range_t& rx_gain_range) override
|
|
|
|
|
{
|
|
|
|
@ -524,21 +529,23 @@ public:
|
|
|
|
|
uhd_error set_master_clock_rate(double rate) override { return UHD_ERROR_NONE; }
|
|
|
|
|
uhd_error set_rx_rate(double rate) override
|
|
|
|
|
{
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this, for (size_t i = 0; i < nof_radios; i++) {
|
|
|
|
|
for (size_t j = 0; j < nof_channels; j++) {
|
|
|
|
|
UHD_LOG_DEBUG(ddc_id[i], "Setting channel " << j << " output rate to " << rate / 1e6 << " MHz");
|
|
|
|
|
ddc_ctrl[i]->set_arg("output_rate", std::to_string(rate), j);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this, for (size_t i = 0; i < nof_radios; i++) {
|
|
|
|
|
for (size_t j = 0; j < nof_channels; j++) {
|
|
|
|
|
UHD_LOG_DEBUG(ddc_id[i], "Setting channel " << j << " output rate to " << rate / 1e6 << " MHz");
|
|
|
|
|
ddc_ctrl[i]->set_arg("output_rate", std::to_string(rate), j);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
uhd_error set_tx_rate(double rate) override
|
|
|
|
|
{
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(this, for (size_t i = 0; i < nof_radios; i++) {
|
|
|
|
|
for (size_t j = 0; j < nof_channels; j++) {
|
|
|
|
|
UHD_LOG_DEBUG(duc_id[i], "Setting channel " << j << " input rate to " << rate / 1e6 << " MHz");
|
|
|
|
|
duc_ctrl[i]->set_arg("input_rate", std::to_string(rate), j);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
UHD_SAFE_C_SAVE_ERROR(
|
|
|
|
|
this, for (size_t i = 0; i < nof_radios; i++) {
|
|
|
|
|
for (size_t j = 0; j < nof_channels; j++) {
|
|
|
|
|
UHD_LOG_DEBUG(duc_id[i], "Setting channel " << j << " input rate to " << rate / 1e6 << " MHz");
|
|
|
|
|
duc_ctrl[i]->set_arg("input_rate", std::to_string(rate), j);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
uhd_error set_command_time(const uhd::time_spec_t& timespec) override { return UHD_ERROR_NONE; }
|
|
|
|
|
uhd_error get_rx_stream(size_t& max_num_samps) override
|
|
|
|
@ -656,7 +663,6 @@ public:
|
|
|
|
|
}
|
|
|
|
|
uhd_error get_rx_gain(double& gain) override
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (radio_ctrl.size() == 0) {
|
|
|
|
|
return UHD_ERROR_NONE;
|
|
|
|
|
}
|
|
|
|
|