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/common | |
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/common')
-rw-r--r-- | host/lib/usrp/common/ad9361_ctrl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/common/ad9361_ctrl.hpp | 23 | ||||
-rw-r--r-- | host/lib/usrp/common/ad9361_transaction.h | 5 |
3 files changed, 19 insertions, 11 deletions
diff --git a/host/lib/usrp/common/ad9361_ctrl.cpp b/host/lib/usrp/common/ad9361_ctrl.cpp index 1afa2fbb7..10496f2a9 100644 --- a/host/lib/usrp/common/ad9361_ctrl.cpp +++ b/host/lib/usrp/common/ad9361_ctrl.cpp @@ -151,7 +151,7 @@ struct ad9361_ctrl_impl : public ad9361_ctrl //handle errors const size_t len = my_strnlen(out->error_msg, AD9361_TRANSACTION_MAX_ERROR_MSG); const std::string error_msg(out->error_msg, len); - if (not error_msg.empty()) throw uhd::runtime_error("ad9361 do transaction: " + error_msg); + if (not error_msg.empty()) throw uhd::runtime_error("[ad9361_ctrl::do_transaction] firmware reported: \"" + error_msg + "\""); //return result done! return *out; diff --git a/host/lib/usrp/common/ad9361_ctrl.hpp b/host/lib/usrp/common/ad9361_ctrl.hpp index fd8012764..098b5dae8 100644 --- a/host/lib/usrp/common/ad9361_ctrl.hpp +++ b/host/lib/usrp/common/ad9361_ctrl.hpp @@ -27,10 +27,17 @@ #include <vector> #include <string> +#include "ad9361_transaction.h" + + +static const double AD9361_CLOCK_RATE_MAX = 61.44e6; +static const double AD9361_1_CHAN_CLOCK_RATE_MAX = AD9361_CLOCK_RATE_MAX; +static const double AD9361_2_CHAN_CLOCK_RATE_MAX = (AD9361_1_CHAN_CLOCK_RATE_MAX / 2); + struct ad9361_ctrl_iface_type { - virtual void ad9361_transact(const unsigned char in_buff[64], unsigned char out_buff[64]) = 0; + virtual void ad9361_transact(const unsigned char in_buff[AD9361_DISPATCH_PACKET_SIZE], unsigned char out_buff[AD9361_DISPATCH_PACKET_SIZE]) = 0; }; typedef boost::shared_ptr<ad9361_ctrl_iface_type> ad9361_ctrl_iface_sptr; @@ -42,18 +49,18 @@ struct ad9361_ctrl_over_zc : ad9361_ctrl_iface_type _xport = xport; } - void ad9361_transact(const unsigned char in_buff[64], unsigned char out_buff[64]) + void ad9361_transact(const unsigned char in_buff[AD9361_DISPATCH_PACKET_SIZE], unsigned char out_buff[AD9361_DISPATCH_PACKET_SIZE]) { { uhd::transport::managed_send_buffer::sptr buff = _xport->get_send_buff(10.0); - if (not buff or buff->size() < 64) throw std::runtime_error("ad9361_ctrl_over_zc send timeout"); - std::memcpy(buff->cast<void *>(), in_buff, 64); - buff->commit(64); + if (not buff or buff->size() < AD9361_DISPATCH_PACKET_SIZE) throw std::runtime_error("ad9361_ctrl_over_zc send timeout"); + std::memcpy(buff->cast<void *>(), in_buff, AD9361_DISPATCH_PACKET_SIZE); + buff->commit(AD9361_DISPATCH_PACKET_SIZE); } { uhd::transport::managed_recv_buffer::sptr buff = _xport->get_recv_buff(10.0); - if (not buff or buff->size() < 64) throw std::runtime_error("ad9361_ctrl_over_zc recv timeout"); - std::memcpy(out_buff, buff->cast<const void *>(), 64); + if (not buff or buff->size() < AD9361_DISPATCH_PACKET_SIZE) throw std::runtime_error("ad9361_ctrl_over_zc recv timeout"); + std::memcpy(out_buff, buff->cast<const void *>(), AD9361_DISPATCH_PACKET_SIZE); } } @@ -100,7 +107,7 @@ public: static uhd::meta_range_t get_clock_rate_range(void) { //return uhd::meta_range_t(220e3, 61.44e6); - return uhd::meta_range_t(5e6, 61.44e6); //5 MHz DCM low end + return uhd::meta_range_t(5e6, AD9361_CLOCK_RATE_MAX); //5 MHz DCM low end } //! set the filter bandwidth for the frontend diff --git a/host/lib/usrp/common/ad9361_transaction.h b/host/lib/usrp/common/ad9361_transaction.h index 7cbad5908..693f32e41 100644 --- a/host/lib/usrp/common/ad9361_transaction.h +++ b/host/lib/usrp/common/ad9361_transaction.h @@ -25,8 +25,8 @@ extern "C" { #endif //various constants -#define AD9361_TRANSACTION_VERSION 0x4 -#define AD9361_TRANSACTION_MAX_ERROR_MSG 40 +#define AD9361_TRANSACTION_VERSION 0x4 +#define AD9361_DISPATCH_PACKET_SIZE 64 //action types #define AD9361_ACTION_ECHO 0 @@ -100,6 +100,7 @@ typedef struct } ad9361_transaction_t; +#define AD9361_TRANSACTION_MAX_ERROR_MSG (AD9361_DISPATCH_PACKET_SIZE - (sizeof(ad9361_transaction_t)-4)-1) // -4 for 'error_msg' alignment padding, -1 for terminating \0 #ifdef __cplusplus } |