diff options
author | Ben Hilburn <ben.hilburn@ettus.com> | 2014-03-27 17:41:13 -0700 |
---|---|---|
committer | Ben Hilburn <ben.hilburn@ettus.com> | 2014-03-27 17:41:13 -0700 |
commit | f8753a3d7f3616a49f6c0a1ae661f286a4f20c66 (patch) | |
tree | c88bee6725422d1fd4ead1f52cf63c119a3c723c /host/lib/usrp/b200/b200_iface.cpp | |
parent | 89d36657a177ba3405ffb7a537a3e2f744a1e7ce (diff) | |
parent | da99b7edc2d1cfedd9c8acf36630d799782ee455 (diff) | |
download | uhd-f8753a3d7f3616a49f6c0a1ae661f286a4f20c66.tar.gz uhd-f8753a3d7f3616a49f6c0a1ae661f286a4f20c66.tar.bz2 uhd-f8753a3d7f3616a49f6c0a1ae661f286a4f20c66.zip |
Merge branch adding warning regarding MCR on the B2xx.
Diffstat (limited to 'host/lib/usrp/b200/b200_iface.cpp')
-rw-r--r-- | host/lib/usrp/b200/b200_iface.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index 6296b6d2d..efb9b3a35 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -19,6 +19,7 @@ #include <uhd/config.hpp> #include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/exception.hpp> #include <boost/functional/hash.hpp> #include <boost/thread/thread.hpp> @@ -304,10 +305,10 @@ public: } } - void ad9361_transact(const unsigned char in_buff[64], unsigned char out_buff[64]) { - const int bytes_to_write = 64; - const int bytes_to_read = 64; - const size_t read_retries = 30; + void ad9361_transact(const unsigned char in_buff[AD9361_DISPATCH_PACKET_SIZE], unsigned char out_buff[AD9361_DISPATCH_PACKET_SIZE]) { + const int bytes_to_write = AD9361_DISPATCH_PACKET_SIZE; + const int bytes_to_read = AD9361_DISPATCH_PACKET_SIZE; + const size_t read_retries = 5; int ret = fx3_control_write(B200_VREQ_AD9361_CTRL_WRITE, 0x00, 0x00, (unsigned char *)in_buff, bytes_to_write); if (ret < 0) @@ -317,9 +318,26 @@ public: for (size_t i = 0; i < read_retries; i++) { - ret = fx3_control_read(B200_VREQ_AD9361_CTRL_READ, 0x00, 0x00, out_buff, bytes_to_read, 1000); + ret = fx3_control_read(B200_VREQ_AD9361_CTRL_READ, 0x00, 0x00, out_buff, bytes_to_read, 3000); if (ret < 0) - throw uhd::io_error((boost::format("Failed to read AD9361 (%d: %s)") % ret % libusb_error_name(ret)).str()); + { + if (ret == LIBUSB_ERROR_TIMEOUT) + { + UHD_LOG << (boost::format("Failed to read AD9361 (%d: %s). Retrying (%d of %d)...") + % ret + % libusb_error_name(ret) + % (i+1) + % read_retries + ) << std::endl; + } + else + { + throw uhd::io_error((boost::format("Failed to read AD9361 (%d: %s)") + % ret + % libusb_error_name(ret) + ).str()); + } + } if (ret == bytes_to_read) return; |