From b5aa407ec2b1bdebc1c950a9428789fe50327776 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Mon, 17 Aug 2009 23:46:30 -0400 Subject: Applied libusb-1.0 patch set from Thomas Tsou : This patch set updates the usrp to support libusb-1.0. Asynchronous I/O through libusb is added with fusb_libusb1.*, which is heavily based on fusb_linux.*. In short, URB's and ioctl calls are replaced with libusb_transfer structs and native calls. Transfer reaping is handled by libusb and associated callbacks. I get 32Mb/s on all of my machines using test_usrp_standard_rx or tx. Due to the API rewrite in 1.0 from 0.12, there are alot of changes, many are simply name changes. Known Issues: Transmit and receive both work, but not at same time (e.g. usrp_benchmark_usb.py). libusb does not create any internal threads, so for a single session fusb_libusb1 works in the same manner as fusb_linux with the callback called at controlled times. With multiple libusb sessions the callback may occur at any time and threading issues come into play causing behavior to become undefined. The use of separate libusb_contexts _might_ solve this issue; I have not had the time to look into it. --- usrp/host/apps/usrper.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usrp/host/apps/usrper.cc') diff --git a/usrp/host/apps/usrper.cc b/usrp/host/apps/usrper.cc index fe8ff90d2..1c4beb713 100644 --- a/usrp/host/apps/usrper.cc +++ b/usrp/host/apps/usrper.cc @@ -23,7 +23,7 @@ #include #include #include -#include /* needed for usb functions */ +#include /* needed for usb functions */ #include #include #include @@ -194,7 +194,7 @@ main (int argc, char **argv) usrp_one_time_init (); - struct usb_device *udev = usrp_find_device (which_board, fx2_ok_p); + struct libusb_device *udev = usrp_find_device (which_board, fx2_ok_p); if (udev == 0){ fprintf (stderr, "%s: failed to find usrp[%d]\n", prog_name, which_board); exit (1); @@ -208,7 +208,7 @@ main (int argc, char **argv) fprintf (stderr, "%s: found unconfigured FX2; needs firmware.\n", prog_name); } - struct usb_dev_handle *udh = usrp_open_cmd_interface (udev); + struct libusb_device_handle *udh = usrp_open_cmd_interface (udev); if (udh == 0){ fprintf (stderr, "%s: failed to open_cmd_interface\n", prog_name); exit (1); -- cgit From bdec6a37a474b961389e0ac590d0582e490ffb2c Mon Sep 17 00:00:00 2001 From: ttsou Date: Wed, 26 Aug 2009 10:46:56 -0400 Subject: Modify apps and swig to reflect libusb_context use --- usrp/host/apps/usrper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usrp/host/apps/usrper.cc') diff --git a/usrp/host/apps/usrper.cc b/usrp/host/apps/usrper.cc index 1c4beb713..9c6403c9d 100644 --- a/usrp/host/apps/usrper.cc +++ b/usrp/host/apps/usrper.cc @@ -191,10 +191,10 @@ main (int argc, char **argv) const char *cmd = argv[optind++]; nopts--; - usrp_one_time_init (); + libusb_context *ctx = usrp_one_time_init (true); - struct libusb_device *udev = usrp_find_device (which_board, fx2_ok_p); + struct libusb_device *udev = usrp_find_device (which_board, fx2_ok_p, ctx); if (udev == 0){ fprintf (stderr, "%s: failed to find usrp[%d]\n", prog_name, which_board); exit (1); -- cgit From e6cb4a4c14d9aa92d024727965bd45e68c6620ce Mon Sep 17 00:00:00 2001 From: ttsou Date: Wed, 9 Sep 2009 14:46:57 -0400 Subject: Intermediate fix to simplify usrp_one_time_init api --- usrp/host/apps/usrper.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usrp/host/apps/usrper.cc') diff --git a/usrp/host/apps/usrper.cc b/usrp/host/apps/usrper.cc index 9c6403c9d..f8e98341f 100644 --- a/usrp/host/apps/usrper.cc +++ b/usrp/host/apps/usrper.cc @@ -19,6 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -34,7 +38,6 @@ char *prog_name; - static void set_progname (char *path) { @@ -191,10 +194,10 @@ main (int argc, char **argv) const char *cmd = argv[optind++]; nopts--; - libusb_context *ctx = usrp_one_time_init (true); + usrp_one_time_init (); - struct libusb_device *udev = usrp_find_device (which_board, fx2_ok_p, ctx); + struct libusb_device *udev = usrp_find_device (which_board, fx2_ok_p); if (udev == 0){ fprintf (stderr, "%s: failed to find usrp[%d]\n", prog_name, which_board); exit (1); -- cgit From fff854782eb2fbfc2a49e07ed9941b3beccc3e83 Mon Sep 17 00:00:00 2001 From: Thomas Tsou Date: Wed, 9 Sep 2009 18:52:34 -0400 Subject: Fixed swig and usrp apps to work with libusb-0.12 and libusb-1.0 plus minor cleanup --- usrp/host/apps/usrper.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'usrp/host/apps/usrper.cc') diff --git a/usrp/host/apps/usrper.cc b/usrp/host/apps/usrper.cc index f8e98341f..d1270589b 100644 --- a/usrp/host/apps/usrper.cc +++ b/usrp/host/apps/usrper.cc @@ -27,7 +27,6 @@ #include #include #include -#include /* needed for usb functions */ #include #include #include @@ -36,6 +35,12 @@ #include "usrp_spi_defs.h" #include +#ifdef HAVE_LIBUSB_1 +#include +#else +#include +#endif + char *prog_name; static void @@ -197,7 +202,7 @@ main (int argc, char **argv) usrp_one_time_init (); - struct libusb_device *udev = usrp_find_device (which_board, fx2_ok_p); + libusb_device *udev = usrp_find_device (which_board, fx2_ok_p); if (udev == 0){ fprintf (stderr, "%s: failed to find usrp[%d]\n", prog_name, which_board); exit (1); @@ -211,7 +216,7 @@ main (int argc, char **argv) fprintf (stderr, "%s: found unconfigured FX2; needs firmware.\n", prog_name); } - struct libusb_device_handle *udh = usrp_open_cmd_interface (udev); + libusb_device_handle *udh = usrp_open_cmd_interface (udev); if (udh == 0){ fprintf (stderr, "%s: failed to open_cmd_interface\n", prog_name); exit (1); -- cgit From df4edacd55663aecee58a9b3f95cbc08bceaab81 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Tue, 29 Sep 2009 18:29:44 -0700 Subject: Consolidate conditional headers into libusb_types.h, use automake --- usrp/host/apps/usrper.cc | 7 ------- 1 file changed, 7 deletions(-) (limited to 'usrp/host/apps/usrper.cc') diff --git a/usrp/host/apps/usrper.cc b/usrp/host/apps/usrper.cc index d1270589b..593cd7921 100644 --- a/usrp/host/apps/usrper.cc +++ b/usrp/host/apps/usrper.cc @@ -33,13 +33,6 @@ #include "usrp/usrp_prims.h" #include "usrp_spi_defs.h" -#include - -#ifdef HAVE_LIBUSB_1 -#include -#else -#include -#endif char *prog_name; -- cgit