summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-03-10 14:35:29 -0800
committerJosh Blum <josh@joshknows.com>2011-03-10 14:35:29 -0800
commit0336db128e38bd99d69e192189a63ba6d3d3e36b (patch)
treebb94bc29b9a25d96509360fe3b81e2a860248d64
parent552caa6980c3fce4baee9d6b899e07482e8ce556 (diff)
downloaduhd-0336db128e38bd99d69e192189a63ba6d3d3e36b.tar.gz
uhd-0336db128e38bd99d69e192189a63ba6d3d3e36b.tar.bz2
uhd-0336db128e38bd99d69e192189a63ba6d3d3e36b.zip
usrp1: also replaced control error prints w/ throws
-rw-r--r--host/lib/usrp/usrp1/usrp1_iface.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp
index e90d66c82..0c37610ce 100644
--- a/host/lib/usrp/usrp1/usrp1_iface.cpp
+++ b/host/lib/usrp/usrp1/usrp1_iface.cpp
@@ -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,8 +87,7 @@ 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);
}
@@ -193,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) |
@@ -214,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;
}
@@ -251,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: