From 876d4150aa3da531ddd687b48afada6e43f79146 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 2 Mar 2020 15:25:13 -0800 Subject: 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. --- host/utils/uhd_usrp_probe.cpp | 122 +++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'host/utils/uhd_usrp_probe.cpp') 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 #include +#include +#include #include #include #include #include #include -#include #include -#include -#include +#include #include #include //for split #include -#include #include +#include #include #include #include @@ -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(str); - } - return boost::lexical_cast(str); +uint32_t str2uint32(const std::string& str) +{ + if (str.find("0x") == 0) { + return cast::hexstr_cast(str); } + return boost::lexical_cast(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 << ">>> " <> 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"); -- cgit v1.2.3