summaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2013-07-19 13:29:50 -0700
committerJosh Blum <josh@joshknows.com>2013-07-19 13:29:50 -0700
commit7c9a4a5a41bb981dd4db66e7b479e4e66d488fa5 (patch)
tree405402c1c44a9ba2cfac14031815ccf18c3ab34a /host/lib
parente7642d44d5fb0a168c1da620e3463c68e4df68f9 (diff)
downloaduhd-7c9a4a5a41bb981dd4db66e7b479e4e66d488fa5.tar.gz
uhd-7c9a4a5a41bb981dd4db66e7b479e4e66d488fa5.tar.bz2
uhd-7c9a4a5a41bb981dd4db66e7b479e4e66d488fa5.zip
b100: moved usb wrapper class into b100 impl
* since its only used internally in b100
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/transport/CMakeLists.txt3
-rw-r--r--host/lib/usrp/b100/CMakeLists.txt3
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp4
-rw-r--r--host/lib/usrp/b100/b100_impl.hpp20
-rw-r--r--host/lib/usrp/b100/usb_zero_copy_wrapper.cpp (renamed from host/lib/transport/usb_zero_copy_wrapper.cpp)14
5 files changed, 31 insertions, 13 deletions
diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt
index 4eb7c8c92..963edcf85 100644
--- a/host/lib/transport/CMakeLists.txt
+++ b/host/lib/transport/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2010-2011 Ettus Research LLC
+# Copyright 2010-2013 Ettus Research LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -122,5 +122,4 @@ LIBUHD_APPEND_SOURCES(
${CMAKE_CURRENT_SOURCE_DIR}/buffer_pool.cpp
${CMAKE_CURRENT_SOURCE_DIR}/if_addrs.cpp
${CMAKE_CURRENT_SOURCE_DIR}/udp_simple.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/usb_zero_copy_wrapper.cpp
)
diff --git a/host/lib/usrp/b100/CMakeLists.txt b/host/lib/usrp/b100/CMakeLists.txt
index d2c33b512..bcc5ac74d 100644
--- a/host/lib/usrp/b100/CMakeLists.txt
+++ b/host/lib/usrp/b100/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright 2011-2012 Ettus Research LLC
+# Copyright 2011-2013 Ettus Research LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,5 +31,6 @@ IF(ENABLE_B100)
${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dboard_iface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io_impl.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/usb_zero_copy_wrapper.cpp
)
ENDIF(ENABLE_B100)
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 1673f5f3c..20933a2fe 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2012 Ettus Research LLC
+// Copyright 2012-2013 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -245,7 +245,7 @@ b100_impl::b100_impl(const device_addr_t &device_addr){
const size_t rx_lut_size = size_t(data_xport_args.cast<double>("recv_frame_size", 0.0));
_fifo_ctrl->poke32(TOREG(SR_PADDER+0), rx_lut_size/sizeof(boost::uint32_t));
- _data_transport = usb_zero_copy::make_wrapper(
+ _data_transport = usb_zero_copy_make_wrapper(
usb_zero_copy::make(
handle, // identifier
2, 6, // IN interface, endpoint
diff --git a/host/lib/usrp/b100/b100_impl.hpp b/host/lib/usrp/b100/b100_impl.hpp
index 5f4899eb3..f81aa3568 100644
--- a/host/lib/usrp/b100/b100_impl.hpp
+++ b/host/lib/usrp/b100/b100_impl.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2011-2012 Ettus Research LLC
+// Copyright 2011-2013 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -74,6 +74,24 @@ uhd::usrp::dboard_iface::sptr make_b100_dboard_iface(
b100_codec_ctrl::sptr codec
);
+/*!
+ * Make a wrapper around a zero copy implementation.
+ * The wrapper performs the following functions:
+ * - Pad commits to the frame boundary
+ * - Extract multiple packets on recv
+ *
+ * When enable multiple receive packets is set to true,
+ * the implementation inspects the vita length on transfers,
+ * and may split a single transfer into multiple managed buffers.
+ *
+ * \param usb_zc a usb zero copy interface object
+ * \param usb_frame_boundary bytes per frame
+ * \return a new zero copy wrapper object
+ */
+uhd::transport::zero_copy_if::sptr usb_zero_copy_make_wrapper(
+ uhd::transport::zero_copy_if::sptr usb_zc, size_t usb_frame_boundary = 512
+);
+
//! Implementation guts
class b100_impl : public uhd::device {
public:
diff --git a/host/lib/transport/usb_zero_copy_wrapper.cpp b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp
index ec5667020..2096e4ef4 100644
--- a/host/lib/transport/usb_zero_copy_wrapper.cpp
+++ b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp
@@ -81,7 +81,7 @@ private:
**********************************************************************/
class usb_zero_copy_wrapper_msb : public managed_send_buffer{
public:
- usb_zero_copy_wrapper_msb(const usb_zero_copy::sptr internal, const size_t fragmentation_size):
+ usb_zero_copy_wrapper_msb(const zero_copy_if::sptr internal, const size_t fragmentation_size):
_internal(internal), _fragmentation_size(fragmentation_size)
{
_ok_to_auto_flush = false;
@@ -131,7 +131,7 @@ public:
}
private:
- usb_zero_copy::sptr _internal;
+ zero_copy_if::sptr _internal;
const size_t _fragmentation_size;
managed_send_buffer::sptr _last_send_buff;
size_t _bytes_in_buffer;
@@ -164,7 +164,7 @@ private:
**********************************************************************/
class usb_zero_copy_wrapper : public usb_zero_copy{
public:
- usb_zero_copy_wrapper(sptr usb_zc, const size_t frame_boundary):
+ usb_zero_copy_wrapper(zero_copy_if::sptr usb_zc, const size_t frame_boundary):
_internal_zc(usb_zc),
_frame_boundary(frame_boundary),
_next_recv_buff_index(0)
@@ -218,7 +218,7 @@ public:
}
private:
- sptr _internal_zc;
+ zero_copy_if::sptr _internal_zc;
size_t _frame_boundary;
std::vector<boost::shared_ptr<usb_zero_copy_wrapper_mrb> > _mrb_pool;
boost::shared_ptr<usb_zero_copy_wrapper_msb> _the_only_msb;
@@ -232,8 +232,8 @@ private:
/***********************************************************************
* USB zero copy wrapper factory function
**********************************************************************/
-usb_zero_copy::sptr usb_zero_copy::make_wrapper(
- sptr usb_zc, size_t usb_frame_boundary
+zero_copy_if::sptr usb_zero_copy_make_wrapper(
+ zero_copy_if::sptr usb_zc, size_t usb_frame_boundary
){
- return sptr(new usb_zero_copy_wrapper(usb_zc, usb_frame_boundary));
+ return zero_copy_if::sptr(new usb_zero_copy_wrapper(usb_zc, usb_frame_boundary));
}