UHD: added device args for log level, spp and return if timeout

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 88a1ab12c5
commit 774c0926a6

@ -593,6 +593,35 @@ int rf_uhd_open_multi(char* args, void** h, uint32_t nof_channels)
clock_src = device_addr.pop("clock"); clock_src = device_addr.pop("clock");
} }
// Samples-Per-Packet option, 0 means automatic
std::string spp = "0";
if (device_addr.has_key("spp")) {
spp = device_addr.pop("spp");
}
// Logging level
uhd::log::severity_level severity_level = uhd::log::severity_level::info;
if (device_addr.has_key("log_level")) {
std::string log_level = device_addr.pop("log_level");
for (auto& e : log_level) {
e = std::toupper(e);
}
if (log_level == "WARNING") {
severity_level = uhd::log::severity_level::warning;
} else if (log_level == "INFO") {
severity_level = uhd::log::severity_level::info;
} else if (log_level == "DEBUG") {
severity_level = uhd::log::severity_level::debug;
} else if (log_level == "TRACE") {
severity_level = uhd::log::severity_level::trace;
} else {
severity_level = uhd::log::severity_level::error;
}
}
uhd::log::set_console_level(severity_level);
#if HAVE_ASYNC_THREAD #if HAVE_ASYNC_THREAD
bool start_async_thread = true; bool start_async_thread = true;
if (device_addr.has_key("silent")) { if (device_addr.has_key("silent")) {
@ -780,6 +809,7 @@ int rf_uhd_open_multi(char* args, void** h, uint32_t nof_channels)
// Initialize TX/RX stream args // Initialize TX/RX stream args
handler->stream_args.cpu_format = "fc32"; handler->stream_args.cpu_format = "fc32";
handler->stream_args.otw_format = otw_format; handler->stream_args.otw_format = otw_format;
handler->stream_args.args.set("spp", spp);
handler->stream_args.channels.resize(nof_channels); handler->stream_args.channels.resize(nof_channels);
for (size_t i = 0; i < (size_t)nof_channels; i++) { for (size_t i = 0; i < (size_t)nof_channels; i++) {
handler->stream_args.channels[i] = i; handler->stream_args.channels[i] = i;
@ -1223,10 +1253,7 @@ int rf_uhd_recv_with_time_multi(void* h,
} else if (error_code == uhd::rx_metadata_t::ERROR_CODE_LATE_COMMAND) { } else if (error_code == uhd::rx_metadata_t::ERROR_CODE_LATE_COMMAND) {
log_late(handler, true); log_late(handler, true);
} else if (error_code != uhd::rx_metadata_t::ERROR_CODE_NONE) { } else if (error_code != uhd::rx_metadata_t::ERROR_CODE_NONE) {
ERROR("Error in metadata '%s'. Recovering (%d/%d).\n", ERROR("Error in metadata '%s'.\n", md.to_pp_string(true).c_str());
md.to_pp_string(true).c_str(),
trials,
RF_UHD_IMP_MAX_RX_TRIALS);
if (handler->tx_state == RF_UHD_IMP_TX_STATE_BURST) { if (handler->tx_state == RF_UHD_IMP_TX_STATE_BURST) {
handler->tx_state = RF_UHD_IMP_TX_STATE_END_OF_BURST; handler->tx_state = RF_UHD_IMP_TX_STATE_END_OF_BURST;
@ -1236,6 +1263,8 @@ int rf_uhd_recv_with_time_multi(void* h,
// Stop Rx stream // Stop Rx stream
rf_uhd_stop_rx_stream_unsafe(handler); rf_uhd_stop_rx_stream_unsafe(handler);
} }
return SRSLTE_ERROR;
} }
} }

@ -318,9 +318,6 @@ public:
// Copy device address // Copy device address
uhd::device_addr_t device_addr = _device_addr; uhd::device_addr_t device_addr = _device_addr;
// Set log level to debug
uhd::log::set_console_level(uhd::log::severity_level::trace);
// Parse arguments, removes // Parse arguments, removes
uhd_error err = parse_args(device_addr); uhd_error err = parse_args(device_addr);
if (err != UHD_ERROR_NONE) { if (err != UHD_ERROR_NONE) {

@ -265,6 +265,13 @@ bool radio::rx_now(rf_buffer_interface& buffer, rf_timestamp_interface& rxd_time
srslte_rf_start_rx_stream(&rf_device, false); srslte_rf_start_rx_stream(&rf_device, false);
} }
radio_is_streaming = true; radio_is_streaming = true;
// Flush buffers to compensate settling time
if (rf_devices.size() > 1) {
for (srslte_rf_t& rf_device : rf_devices) {
srslte_rf_flush_buffer(&rf_device);
}
}
} }
for (uint32_t device_idx = 0; device_idx < (uint32_t)rf_devices.size(); device_idx++) { for (uint32_t device_idx = 0; device_idx < (uint32_t)rf_devices.size(); device_idx++) {

Loading…
Cancel
Save