aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
Diffstat (limited to 'host/utils')
-rw-r--r--host/utils/b2xx_fx3_utils.cpp7
-rw-r--r--host/utils/converter_benchmark.cpp8
-rw-r--r--host/utils/uhd_cal_tx_dc_offset.cpp2
-rw-r--r--host/utils/uhd_cal_tx_iq_balance.cpp2
-rw-r--r--host/utils/uhd_usrp_probe.cpp122
5 files changed, 72 insertions, 69 deletions
diff --git a/host/utils/b2xx_fx3_utils.cpp b/host/utils/b2xx_fx3_utils.cpp
index e495262be..efeecd984 100644
--- a/host/utils/b2xx_fx3_utils.cpp
+++ b/host/utils/b2xx_fx3_utils.cpp
@@ -79,7 +79,8 @@ const uhd::byte_vector_t EEPROM_DATA_HEADER = {
} // namespace
//! used with lexical cast to parse a hex string
-template <class T> struct to_hex
+template <class T>
+struct to_hex
{
T value;
operator T() const
@@ -628,9 +629,9 @@ int32_t main(int32_t argc, char* argv[])
<< std::endl;
// Read values that will be clobbered by the bootloader
- auto pidvid = b200->read_eeprom(0x00, 0x04, 4);
+ auto pidvid = b200->read_eeprom(0x00, 0x04, 4);
uhd::byte_vector_t vidpid = {pidvid[2], pidvid[3], pidvid[0], pidvid[1]};
- auto eeprom_data = b200->read_eeprom(0x04, 0xDC, 36);
+ auto eeprom_data = b200->read_eeprom(0x04, 0xDC, 36);
// Write in default header
b200->write_eeprom(
diff --git a/host/utils/converter_benchmark.cpp b/host/utils/converter_benchmark.cpp
index d00255d0c..f981455ac 100644
--- a/host/utils/converter_benchmark.cpp
+++ b/host/utils/converter_benchmark.cpp
@@ -47,7 +47,7 @@ void configure_conv(
if (in_type == "sc16") {
if (out_type == "fc32") {
std::cout << "Setting scalar to 1./32767." << std::endl;
- conv->set_scalar(1./32767.);
+ conv->set_scalar(1. / 32767.);
return;
}
}
@@ -116,7 +116,8 @@ void init_random_vector_real_int(std::vector<char>& buf_ptr, size_t n_items)
}
// Fill a buffer with increasing numbers
-template <typename T> void init_inc_vector(std::vector<char>& buf_ptr, size_t n_items)
+template <typename T>
+void init_inc_vector(std::vector<char>& buf_ptr, size_t n_items)
{
T* const buf = reinterpret_cast<T* const>(&buf_ptr[0]);
for (size_t i = 0; i < n_items; i++) {
@@ -206,7 +207,8 @@ double run_benchmark(converter::sptr conv,
return benchmark_timer.elapsed();
}
-template <typename T> std::string void_ptr_to_hexstring(const void* v_ptr, size_t index)
+template <typename T>
+std::string void_ptr_to_hexstring(const void* v_ptr, size_t index)
{
const T* ptr = reinterpret_cast<const T*>(v_ptr);
return str(boost::format("%X") % ptr[index]);
diff --git a/host/utils/uhd_cal_tx_dc_offset.cpp b/host/utils/uhd_cal_tx_dc_offset.cpp
index 5a1e23d50..9a0a3bb77 100644
--- a/host/utils/uhd_cal_tx_dc_offset.cpp
+++ b/host/utils/uhd_cal_tx_dc_offset.cpp
@@ -18,9 +18,9 @@
#include <chrono>
#include <complex>
#include <ctime>
+#include <functional>
#include <iostream>
#include <thread>
-#include <functional>
namespace po = boost::program_options;
diff --git a/host/utils/uhd_cal_tx_iq_balance.cpp b/host/utils/uhd_cal_tx_iq_balance.cpp
index b0a09b49c..5f2695784 100644
--- a/host/utils/uhd_cal_tx_iq_balance.cpp
+++ b/host/utils/uhd_cal_tx_iq_balance.cpp
@@ -15,9 +15,9 @@
#include <complex>
#include <cstdlib>
#include <ctime>
+#include <functional>
#include <iostream>
#include <thread>
-#include <functional>
namespace po = boost::program_options;
diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp
index 7fd42941e..6b98b212a 100644
--- a/host/utils/uhd_usrp_probe.cpp
+++ b/host/utils/uhd_usrp_probe.cpp
@@ -7,20 +7,20 @@
#include <uhd/device.hpp>
#include <uhd/property_tree.hpp>
+#include <uhd/rfnoc/block_id.hpp>
+#include <uhd/rfnoc_graph.hpp>
#include <uhd/types/ranges.hpp>
#include <uhd/types/sensors.hpp>
#include <uhd/usrp/dboard_eeprom.hpp>
#include <uhd/usrp/dboard_id.hpp>
#include <uhd/usrp/mboard_eeprom.hpp>
-#include <uhd/utils/safe_main.hpp>
#include <uhd/utils/cast.hpp>
-#include <uhd/rfnoc_graph.hpp>
-#include <uhd/rfnoc/block_id.hpp>
+#include <uhd/utils/safe_main.hpp>
#include <uhd/version.hpp>
#include <boost/algorithm/string.hpp> //for split
#include <boost/format.hpp>
-#include <boost/program_options.hpp>
#include <boost/lexical_cast.hpp>
+#include <boost/program_options.hpp>
#include <cstdlib>
#include <iostream>
#include <sstream>
@@ -319,73 +319,73 @@ void print_tree(const uhd::fs_path& path, uhd::property_tree::sptr tree)
namespace {
- uint32_t str2uint32(const std::string& str)
- {
- if (str.find("0x") == 0) {
- return cast::hexstr_cast<uint32_t>(str);
- }
- return boost::lexical_cast<uint32_t>(str);
+uint32_t str2uint32(const std::string& str)
+{
+ if (str.find("0x") == 0) {
+ return cast::hexstr_cast<uint32_t>(str);
}
+ return boost::lexical_cast<uint32_t>(str);
+}
- void shell_print_help()
- {
- std::cout << "Commands:\n\n"
- << "poke32 $addr $data : Write $data to $addr\n"
- << "peek32 $addr : Read from $addr and print\n"
- << "help : Show this\n"
- << "quit : Terminate shell\n"
- << std::endl;
- }
+void shell_print_help()
+{
+ std::cout << "Commands:\n\n"
+ << "poke32 $addr $data : Write $data to $addr\n"
+ << "peek32 $addr : Read from $addr and print\n"
+ << "help : Show this\n"
+ << "quit : Terminate shell\n"
+ << std::endl;
+}
- void run_interactive_regs_shell(rfnoc::noc_block_base::sptr blk_ctrl)
- {
- std::cout << "<<< Interactive Block Peeker/Poker >>>" << std::endl;
- std::cout << "Type 'help' to get a list of commands." << std::endl;
- while (true) {
- std::string input;
- std::cout << ">>> " <<std::flush;
- std::getline(std::cin, input);
- std::stringstream ss(input);
- std::string command;
- ss >> command;
- if (command == "poke32") {
- std::string addr_s, data_s;
- uint32_t addr, data;
- try {
- ss >> addr_s >> data_s;
- addr = str2uint32(addr_s);
- data = str2uint32(data_s);
- } catch (std::exception&) {
- std::cout << "Usage: poke32 $addr $data" << std::endl;
- continue;
- }
- blk_ctrl->regs().poke32(addr, data);
+void run_interactive_regs_shell(rfnoc::noc_block_base::sptr blk_ctrl)
+{
+ std::cout << "<<< Interactive Block Peeker/Poker >>>" << std::endl;
+ std::cout << "Type 'help' to get a list of commands." << std::endl;
+ while (true) {
+ std::string input;
+ std::cout << ">>> " << std::flush;
+ std::getline(std::cin, input);
+ std::stringstream ss(input);
+ std::string command;
+ ss >> command;
+ if (command == "poke32") {
+ std::string addr_s, data_s;
+ uint32_t addr, data;
+ try {
+ ss >> addr_s >> data_s;
+ addr = str2uint32(addr_s);
+ data = str2uint32(data_s);
+ } catch (std::exception&) {
+ std::cout << "Usage: poke32 $addr $data" << std::endl;
+ continue;
}
- if (command == "peek32") {
- std::string addr_s;
- uint32_t addr;
- try {
- ss >> addr_s;
- addr = str2uint32(addr_s);
- } catch (std::exception&) {
- std::cout << "Usage: peek32 $addr" << std::endl;
- continue;
- }
- std::cout << "==> " << std::hex << blk_ctrl->regs().peek32(addr)
- << std::dec << std::endl;
+ blk_ctrl->regs().poke32(addr, data);
+ }
+ if (command == "peek32") {
+ std::string addr_s;
+ uint32_t addr;
+ try {
+ ss >> addr_s;
+ addr = str2uint32(addr_s);
+ } catch (std::exception&) {
+ std::cout << "Usage: peek32 $addr" << std::endl;
+ continue;
}
+ std::cout << "==> " << std::hex << blk_ctrl->regs().peek32(addr) << std::dec
+ << std::endl;
+ }
- if (input == "help") {
- shell_print_help();
- }
- if (input == "quit") {
- return;
- }
+ if (input == "help") {
+ shell_print_help();
+ }
+ if (input == "quit") {
+ return;
}
}
-
}
+} // namespace
+
int UHD_SAFE_MAIN(int argc, char* argv[])
{
po::options_description desc("Allowed options");