aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/uhd_usrp_probe.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2020-03-02 15:25:13 -0800
committeratrnati <54334261+atrnati@users.noreply.github.com>2020-03-03 08:51:32 -0600
commit876d4150aa3da531ddd687b48afada6e43f79146 (patch)
treefd72a71419f4cd800d4e500cfcaded4dfc8dc367 /host/utils/uhd_usrp_probe.cpp
parent1393553d623bdf4ba40d5435c9719b6ce990d9ac (diff)
downloaduhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.gz
uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.bz2
uhd-876d4150aa3da531ddd687b48afada6e43f79146.zip
uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of files that clang-format gets applied against.
Diffstat (limited to 'host/utils/uhd_usrp_probe.cpp')
-rw-r--r--host/utils/uhd_usrp_probe.cpp122
1 files changed, 61 insertions, 61 deletions
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");