diff options
Diffstat (limited to 'host/lib/usrp/usrp1/usrp1_iface.cpp')
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_iface.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 63fcd5777..0c37610ce 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -17,7 +17,7 @@ #include "usrp1_iface.hpp" #include "usrp_commands.h" -#include <uhd/utils/assert.hpp> +#include <uhd/exception.hpp> #include <uhd/utils/byteswap.hpp> #include <boost/format.hpp> #include <stdexcept> @@ -70,8 +70,7 @@ public: (unsigned char*) &swapped, sizeof(boost::uint32_t)); - if (ret < 0) - std::cerr << "USRP: failed memory write: " << ret << std::endl; + if (ret < 0) throw uhd::io_error("USRP1: failed control write"); } boost::uint32_t peek32(boost::uint32_t addr) @@ -88,11 +87,27 @@ public: (unsigned char*) &value_out, sizeof(boost::uint32_t)); - if (ret < 0) - std::cerr << "USRP: failed memory read: " << ret << std::endl; + if (ret < 0) throw uhd::io_error("USRP1: failed control read"); return uhd::ntohx(value_out); } + + void poke16(boost::uint32_t, boost::uint16_t) { + throw uhd::not_implemented_error("Unhandled command poke16()"); + } + + boost::uint16_t peek16(boost::uint32_t) { + throw uhd::not_implemented_error("Unhandled command peek16()"); + return 0; + } + + void write_uart(boost::uint8_t, const std::string &) { + throw uhd::not_implemented_error("Unhandled command write_uart()"); + } + + std::string read_uart(boost::uint8_t) { + throw uhd::not_implemented_error("Unhandled command read_uart()"); + } /******************************************************************* * I2C @@ -176,10 +191,7 @@ public: buff, (w_len_h << 8) | (w_len_l << 0)); - if (ret < 0) { - std::cout << "USRP: failed SPI readback transaction: " - << std::dec << ret << std::endl; - } + if (ret < 0) throw uhd::io_error("USRP1: failed SPI readback transaction"); boost::uint32_t val = (((boost::uint32_t)buff[0]) << 0) | (((boost::uint32_t)buff[1]) << 8) | @@ -197,10 +209,7 @@ public: (w_index_h << 8) | (w_index_l << 0), buff, num_bytes); - if (ret < 0) { - std::cout << "USRP: failed SPI transaction: " - << std::dec << ret << std::endl; - } + if (ret < 0) throw uhd::io_error("USRP1: failed SPI transaction"); return 0; } @@ -234,8 +243,7 @@ public: length); } - if (ret < 0) - std::cerr << "USRP: failed firmware command: " << ret << std::endl; + if (ret < 0) throw uhd::io_error("USRP1: failed firmware command"); } private: |