summaryrefslogtreecommitdiff
path: root/usrp/host/lib/fusb_sysconfig_libusb1.cc
diff options
context:
space:
mode:
authorJohnathan Corgan2009-10-01 14:24:08 -0700
committerJohnathan Corgan2009-10-01 14:24:08 -0700
commit0cd478fdc090123e09b7ee21c88e5657abab8ae0 (patch)
tree901fcd8cda2ae27e28c20fc2659759fa71984b0d /usrp/host/lib/fusb_sysconfig_libusb1.cc
parentbf76534044a1bbcc665f0400a53d1070cae8caf0 (diff)
parentf4a86ccaa23e7e513dbbfa45456ea5783c106ec0 (diff)
downloadgnuradio-0cd478fdc090123e09b7ee21c88e5657abab8ae0.tar.gz
gnuradio-0cd478fdc090123e09b7ee21c88e5657abab8ae0.tar.bz2
gnuradio-0cd478fdc090123e09b7ee21c88e5657abab8ae0.zip
Merge branch 'wip/libusb-1.0' of http://gnuradio.org/git/jcorgan into master
This merge adds support for libusb1.0 in the usrp component. To enable, you must add --with-fusb-tech=libusb1 to your configure command line. Existing support for libusb0.1 is retained, no changes are needed. Most of the work was done here by Thomas Tsou. * 'wip/libusb-1.0' of http://gnuradio.org/git/jcorgan: (32 commits) Cleanup in preparation for merge Add required include directory for new header organization Added config.h headers to fix win32 build Consolidate conditional headers into libusb_types.h, use automake Change write_internal_ram in usrp_prims to print signed error code Allow fusb_sysconfig to build on non-linux libusb-0.12 impls Comments for usrp_prims Removed internal functions from external header file Moved to single generated fusb.h, headers now generated out of lib directory Added copyright header Removed preprocessor declrs out of fusb.h and created separate fusb_libusb1_base.h Fixed libusb1 configure bug, libusb1 updates for previous usrp_prims integration Commonized more usrp_prims code and renamed libusb-0.12 files to libusb0 Fixed bug usb_control_transfer bug Combined additiona usrp_prims code Fix glitch from previous commit changes to build on windows / cygwin Re-added non pkgconfig support for libusb Autoconf support for checking the required version of libusb based on fusb-tech Use default arguments instead of overloaded virtual constructors for cleaner interface ...
Diffstat (limited to 'usrp/host/lib/fusb_sysconfig_libusb1.cc')
-rw-r--r--usrp/host/lib/fusb_sysconfig_libusb1.cc51
1 files changed, 51 insertions, 0 deletions
diff --git a/usrp/host/lib/fusb_sysconfig_libusb1.cc b/usrp/host/lib/fusb_sysconfig_libusb1.cc
new file mode 100644
index 000000000..46daf561a
--- /dev/null
+++ b/usrp/host/lib/fusb_sysconfig_libusb1.cc
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <fusb.h>
+#include <fusb_libusb1.h>
+
+static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit
+static const int DEFAULT_BLOCK_SIZE = 4 * 1024;
+static const int FUSB_BUFFER_SIZE = 1 * (1L << 20); // 1 MB
+
+struct libusb_context;
+
+fusb_devhandle *
+fusb_sysconfig::make_devhandle (libusb_device_handle *udh, libusb_context *ctx)
+{
+ return new fusb_devhandle_libusb1 (udh, ctx);
+}
+
+int fusb_sysconfig::max_block_size ()
+{
+ return MAX_BLOCK_SIZE;
+}
+
+int fusb_sysconfig::default_block_size ()
+{
+ return DEFAULT_BLOCK_SIZE;
+}
+
+int fusb_sysconfig::default_buffer_size ()
+{
+ return FUSB_BUFFER_SIZE;
+}