aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2018-07-13 20:09:49 -0700
committerMartin Braun <martin.braun@ettus.com>2018-07-13 20:58:01 -0700
commit72e5fda9323a2f485da5d5e66d0e42002190a11b (patch)
tree5a182e7b07172f857174d603c5f5c72d7d106f5c /host/lib
parent04987da5150d4043d8a424dd897eeae0b7110ee5 (diff)
downloaduhd-72e5fda9323a2f485da5d5e66d0e42002190a11b.tar.gz
uhd-72e5fda9323a2f485da5d5e66d0e42002190a11b.tar.bz2
uhd-72e5fda9323a2f485da5d5e66d0e42002190a11b.zip
fixup! B200: Check if recv_frame_size is larger than minimum value
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp31
-rw-r--r--host/lib/usrp/b200/b200_impl.hpp1
2 files changed, 20 insertions, 12 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 6642ae0a7..a034ef632 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -518,28 +518,35 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s
// before being cleared.
////////////////////////////////////////////////////////////////////
device_addr_t data_xport_args;
+ const int max_transfer = usb_speed == 3 ? 1024 : 512;
int recv_frame_size = device_addr.cast<int>(
"recv_frame_size",
B200_USB_DATA_DEFAULT_FRAME_SIZE
);
- // If the recv_frame_size is divisible by 512, set it to the next lowest
- // number that is divisible by 24. This is done to avoid bugs in the fx3
- // when a packet of length divisible by 512 is sent.
- if (recv_frame_size % 512 == 0) {
- recv_frame_size = (recv_frame_size - 16) / 24;
- recv_frame_size *= 24;
- UHD_LOGGER_WARNING("B200")
- << "Multiples of 512 not supported for recv_frame_size. "
- << "Requested recv_frame_size of " << device_addr["recv_frame_size"]
- << " reduced to " << recv_frame_size << ".";
- }
- // Check that recv_frame_size was set to a reasonable value.
+ // Check that recv_frame_size limits.
if (recv_frame_size < B200_USB_DATA_MIN_RECV_FRAME_SIZE) {
UHD_LOGGER_WARNING("B200")
<< "Requested recv_frame_size of " << recv_frame_size
<< " is too small. It will be set to "
<< B200_USB_DATA_MIN_RECV_FRAME_SIZE << ".";
recv_frame_size = B200_USB_DATA_MIN_RECV_FRAME_SIZE;
+ } else if (recv_frame_size > B200_USB_DATA_MAX_RECV_FRAME_SIZE) {
+ UHD_LOGGER_WARNING("B200")
+ << "Requested recv_frame_size of " << recv_frame_size
+ << " is too large. It will be set to "
+ << B200_USB_DATA_MAX_RECV_FRAME_SIZE << ".";
+ recv_frame_size = B200_USB_DATA_MAX_RECV_FRAME_SIZE;
+ } else if (recv_frame_size % max_transfer == 0) {
+ // The Cypress FX3 does not properly handle recv_frame_sizes that are
+ // aligned to the maximum transfer size. The code below coerces the
+ // recv_frame_size down to a value that is not a multiple of of the
+ // maximum transfer size and aligns to full 8 byte words for sc8, sc12,
+ // and sc16 data types for best performance on the FPGA.
+ recv_frame_size = (((recv_frame_size - 16) / 24) * 24) + 16;
+ UHD_LOGGER_WARNING("B200")
+ << "Multiples of 512 not supported for recv_frame_size. "
+ << "Requested recv_frame_size of " << device_addr["recv_frame_size"]
+ << " reduced to " << recv_frame_size << ".";
}
data_xport_args["recv_frame_size"] = std::to_string(recv_frame_size);
data_xport_args["num_recv_frames"] = device_addr.get("num_recv_frames", "16");
diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp
index c1dbb88f6..3e1a62249 100644
--- a/host/lib/usrp/b200/b200_impl.hpp
+++ b/host/lib/usrp/b200/b200_impl.hpp
@@ -84,6 +84,7 @@ static const unsigned char B200_USB_DATA_SEND_ENDPOINT = 2;
static const int B200_USB_DATA_DEFAULT_FRAME_SIZE = 8176;
// recv_frame_size values below this will be upped to this value
static const int B200_USB_DATA_MIN_RECV_FRAME_SIZE = 40;
+static const int B200_USB_DATA_MAX_RECV_FRAME_SIZE = 16360;
/*
* VID/PID pairs for all B2xx products