summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorBalint Seeber <balint@ettus.com>2013-11-19 13:17:25 -0800
committerBalint Seeber <balint@ettus.com>2013-11-19 13:17:25 -0800
commit01cfe2118f0bd72719809d2539c61df46a164fec (patch)
treea93b693341d0e7b9c37844fabcd996ed626ba543 /host
parentdb6541583a9c42df79600b47ab2184ee59c46e6a (diff)
downloaduhd-01cfe2118f0bd72719809d2539c61df46a164fec.tar.gz
uhd-01cfe2118f0bd72719809d2539c61df46a164fec.tar.bz2
uhd-01cfe2118f0bd72719809d2539c61df46a164fec.zip
b200: increase FPGA VREQ transfer size to 512 if operating over USB3
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/b200/b200_iface.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp
index 1d05e159c..a74e058d0 100644
--- a/host/lib/usrp/b200/b200_iface.cpp
+++ b/host/lib/usrp/b200/b200_iface.cpp
@@ -69,6 +69,11 @@ const static boost::uint8_t FX3_STATE_RUNNING = 0x04;
const static boost::uint8_t FX3_STATE_UNCONFIGURED = 0x05;
const static boost::uint8_t FX3_STATE_ERROR = 0x06;
+const static int VREQ_MAX_SIZE_USB2 = 64;
+const static int VREQ_MAX_SIZE_USB3 = 512;
+const static int VREQ_DEFAULT_SIZE = VREQ_MAX_SIZE_USB2;
+const static int VREQ_MAX_SIZE = VREQ_MAX_SIZE_USB3;
+
typedef boost::uint32_t hash_type;
@@ -484,8 +489,17 @@ public:
hash_type hash = generate_hash(filename);
hash_type loaded_hash; usrp_get_fpga_hash(loaded_hash);
if (hash == loaded_hash) return 0;
-
- unsigned char out_buff[64];
+
+ int transfer_size = VREQ_DEFAULT_SIZE;
+ int current_usb_speed = get_usb_speed();
+ if (current_usb_speed == 3)
+ transfer_size = VREQ_MAX_SIZE_USB3;
+ else if (current_usb_speed != 2)
+ throw uhd::io_error("load_fpga: get_usb_speed returned invalid USB speed (not 2 or 3)");
+
+ UHD_ASSERT_THROW(transfer_size <= VREQ_MAX_SIZE);
+
+ unsigned char out_buff[VREQ_MAX_SIZE];
memset(out_buff, 0x00, sizeof(out_buff));
fx3_control_write(B200_VREQ_FPGA_CONFIG, 0, 0, out_buff, 1, 1000);
@@ -535,7 +549,7 @@ public:
size_t bytes_sent = 0;
while(!file.eof()) {
- file.read((char *) out_buff, sizeof(out_buff));
+ file.read((char *) out_buff, transfer_size);
const std::streamsize n = file.gcount();
if(n == 0) continue;