[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3657 - in gnuradio/branches/developers/eb/digital-wip
From: |
eb |
Subject: |
[Commit-gnuradio] r3657 - in gnuradio/branches/developers/eb/digital-wip: config ezdop/src/firmware gnuradio-core/src/lib/io gr-error-correcting-codes/src/python gr-radio-astronomy/src/python gr-wxgui/src/python usrp/host/lib |
Date: |
Tue, 26 Sep 2006 21:41:30 -0600 (MDT) |
Author: eb
Date: 2006-09-26 21:41:30 -0600 (Tue, 26 Sep 2006)
New Revision: 3657
Added:
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_ra_wb.cc
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_ra_wb.h
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_ra_wb.cc
Modified:
gnuradio/branches/developers/eb/digital-wip/config/usrp_fusb_tech.m4
gnuradio/branches/developers/eb/digital-wip/ezdop/src/firmware/dopctrl.c
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/lib/io/gr_oscope_guts.cc
gnuradio/branches/developers/eb/digital-wip/gr-error-correcting-codes/src/python/Makefile.am
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/local_calibrator.py
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/usrp_psr_receiver.py
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/usrp_ra_receiver.py
gnuradio/branches/developers/eb/digital-wip/gr-wxgui/src/python/scopesink.py
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/Makefile.am
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb.h
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_darwin.cc
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_generic.cc
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_linux.cc
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_win32.cc
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/usrp_basic.cc
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/usrp_prims.cc
Log:
Merged trunk -r 3553:3656 into eb/digital-wip
Modified: gnuradio/branches/developers/eb/digital-wip/config/usrp_fusb_tech.m4
===================================================================
--- gnuradio/branches/developers/eb/digital-wip/config/usrp_fusb_tech.m4
2006-09-27 02:54:32 UTC (rev 3656)
+++ gnuradio/branches/developers/eb/digital-wip/config/usrp_fusb_tech.m4
2006-09-27 03:41:30 UTC (rev 3657)
@@ -41,6 +41,13 @@
darwin*) FUSB_TECH=darwin ;;
cygwin*|win*|mingw*) FUSB_TECH=win32 ;;
+ *bsd*)
+ AC_MSG_CHECKING([for RA/WB])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <dev/usb/usb.h>]],
+ [[struct usb_bulk_ra_wb_opt
o;
+ ioctl(0, USB_SET_BULK_RA,
&o);]])],
+ [FUSB_TECH=ra_wb],
+ [FUSB_TECH=generic]) ;;
*) FUSB_TECH=generic ;;
esac
@@ -51,5 +58,6 @@
AM_CONDITIONAL(FUSB_TECH_win32, test $FUSB_TECH = win32)
AM_CONDITIONAL(FUSB_TECH_generic, test $FUSB_TECH = generic)
AM_CONDITIONAL(FUSB_TECH_linux, test $FUSB_TECH = linux)
+ AM_CONDITIONAL(FUSB_TECH_ra_wb, test $FUSB_TECH = ra_wb)
])
Modified:
gnuradio/branches/developers/eb/digital-wip/ezdop/src/firmware/dopctrl.c
===================================================================
--- gnuradio/branches/developers/eb/digital-wip/ezdop/src/firmware/dopctrl.c
2006-09-27 02:54:32 UTC (rev 3656)
+++ gnuradio/branches/developers/eb/digital-wip/ezdop/src/firmware/dopctrl.c
2006-09-27 03:41:30 UTC (rev 3657)
@@ -33,7 +33,7 @@
#include <avr/io.h>
#include <avr/interrupt.h>
-#include <avr/signal.h>
+#include <compat/deprecated.h> // for timer_enable_int
#include "dopctrl.h"
#define LED 0
Modified:
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/lib/io/gr_oscope_guts.cc
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/lib/io/gr_oscope_guts.cc
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/gnuradio-core/src/lib/io/gr_oscope_guts.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -54,7 +54,7 @@
gr_oscope_guts::gr_oscope_guts (int nchannels, double sample_rate,
gr_msg_queue_sptr msgq)
: d_nchannels (nchannels),
d_msgq (msgq),
- d_trigger_mode (gr_TRIG_POS_SLOPE),
+ d_trigger_mode (gr_TRIG_AUTO),
d_trigger_channel (0),
d_sample_rate (sample_rate),
d_update_rate (20),
Modified:
gnuradio/branches/developers/eb/digital-wip/gr-error-correcting-codes/src/python/Makefile.am
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gr-error-correcting-codes/src/python/Makefile.am
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/gr-error-correcting-codes/src/python/Makefile.am
2006-09-27 03:41:30 UTC (rev 3657)
@@ -27,6 +27,6 @@
noinst_PYTHON = qa_ecc.py
-grpython_PYTHON =
+#grpython_PYTHON =
MOSTLYCLEANFILES = *.pyc *~ run_tests
Modified:
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/local_calibrator.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/local_calibrator.py
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/local_calibrator.py
2006-09-27 03:41:30 UTC (rev 3657)
@@ -63,14 +63,34 @@
filenamestr = "%s/%04d%02d%02d%02d" % (pfx, foo.tm_year,
foo.tm_mon, foo.tm_mday, foo.tm_hour)
- rainbow_file = open (filenamestr+".tpdat","a")
+ numogate_file = open (filenamestr+".tpdat","a")
- r = (data / 4096.0)
+ r = (data / 409.6)
flt = "%6.3f" % r
#r = calib_default_total_power(data)
inter = globals()["calib_decln"]
- rainbow_file.write(str(ephem.hours(sidtime))+" "+flt+" "+str(inter)+"\n")
- rainbow_file.close()
+ integ = globals()["calib_integ_setting"]
+ fc = globals()["calib_freq_setting"]
+ fc = fc / 1000000
+ bw = globals()["calib_bw_setting"]
+ bw = bw / 1000000
+ ga = globals()["calib_gain_setting"]
+
+ now = time.time()
+
+ if not "calib_then_tpdat" in globals():
+ globals()["calib_then_tpdat"] = now
+
+ if (now - globals()["calib_then_tpdat"]) >= 20:
+ globals()["calib_then_tpdat"] = now
+
+ numogate_file.write(str(ephem.hours(sidtime))+" "+flt+"
Dn="+str(inter)+",")
+ numogate_file.write("Ti="+str(integ)+",Fc="+str(fc)+",Bw="+str(bw))
+ numogate_file.write(",Ga="+str(ga)+"\n")
+ else:
+ numogate_file.write(str(ephem.hours(sidtime))+" "+flt+"\n")
+
+ numogate_file.close()
return(r)
def calib_numogate_ridge_observatory_fft(data,l):
@@ -107,12 +127,18 @@
if (now - globals()["calib_then"]) >= delta:
globals()["calib_then"] = now
- rainbow_file = open (filenamestr+".sdat","a")
+ numogate_file = open (filenamestr+".sdat","a")
r = calib_default_fft(data,l)
inter = globals()["calib_decln"]
- rainbow_file.write("data:"+str(ephem.hours(sidtime))+" "+str(inter)+"
"+str(r)+"\n")
- rainbow_file.close()
+ fc = globals()["calib_freq_setting"]
+ fc = fc / 1000000
+ bw = globals()["calib_bw_setting"]
+ bw = bw / 1000000
+ av = globals()["calib_avg_alpha"]
+ numogate_file.write("data:"+str(ephem.hours(sidtime))+"
Dn="+str(inter)+",Fc="+str(fc)+",Bw="+str(bw)+",Av="+str(av))
+ numogate_file.write(" "+str(r)+"\n")
+ numogate_file.close()
return(r)
return(data)
@@ -127,15 +153,19 @@
#
def calib_set_gain(gain):
globals()["calib_gain_setting"] = gain
+ globals()["calib_then_tpdat"] = time.time() - 50
def calib_set_integ(integ):
globals()["calib_integ_setting"] = integ
+ globals()["calib_then_tpdat"] = time.time() - 50
def calib_set_bw(bw):
globals()["calib_bw_setting"] = bw
+ globals()["calib_then_tpdat"] = time.time() - 50
def calib_set_freq(freq):
globals()["calib_freq_setting"] = freq
+ globals()["calib_then_tpdat"] = time.time() - 50
def calib_set_avg_alpha(alpha):
globals()["calib_avg_alpha"] = alpha
@@ -145,6 +175,7 @@
def calib_set_decln(dec):
globals()["calib_decln"] = dec
+ globals()["calib_then_tpdat"] = time.time() - 50
def calib_set_prefix(pfx):
globals()["calib_prefix"] = pfx
Modified:
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/usrp_psr_receiver.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/usrp_psr_receiver.py
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/usrp_psr_receiver.py
2006-09-27 03:41:30 UTC (rev 3657)
@@ -84,6 +84,7 @@
parser.add_option("-O", "--doppler", type="eng_float", default=1.0,
help="Doppler ratio")
parser.add_option("-B", "--divbase", type="eng_float", default=20,
help="Y/Div menu base")
parser.add_option("-I", "--division", type="eng_float", default=100,
help="Y/Div")
+ parser.add_option("-A", "--audio_source", default="plughw:0,0",
help="Audio input device spec")
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
@@ -94,6 +95,7 @@
self.reflevel = options.reflevel
self.divbase = options.divbase
self.division = options.division
+ self.audiodev = options.audio_dev
# Low-pass cutoff for post-detector filter
# Set to 100Hz usually, since lots of pulsars fit in this
@@ -219,7 +221,7 @@
self.decim = int(decim)
# So that we can view 4 pulses in the pulse viewer window
- FOLD_MULT=4
+ FOLD_MULT=1
# determine the daughterboard subdevice we're using
self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
@@ -235,7 +237,10 @@
# Set baseband filter bandwidth if DBS_RX:
#
if self.cardtype == usrp_dbid.DBS_RX:
- self.subdev.set_bw((self.u.adc_freq() / self.u.decim_rate())/2)
+ lbw = input_rate / 2
+ if lbw < 1.0e6:
+ lbw = 1.0e6
+ self.subdev.set_bw(lbw)
#
# We use this as a crude volume control for the audio output
@@ -337,7 +342,7 @@
#
# Audio sink
#
- self.audio = audio.sink(second_input_rate, "plughw:0,0")
+ self.audio = audio.sink(second_input_rate, self.audiodev)
#
# The three post-detector filters
Modified:
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/usrp_ra_receiver.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/usrp_ra_receiver.py
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/gr-radio-astronomy/src/python/usrp_ra_receiver.py
2006-09-27 03:41:30 UTC (rev 3657)
@@ -290,7 +290,10 @@
# Set analog baseband filtering, if DBS_RX
if self.cardtype == usrp_dbid.DBS_RX:
- self.subdev.set_bw((self.u.adc_freq() / self.u.decim_rate())/2)
+ lbw = (self.u.adc_freq() / self.u.decim_rate()) / 2
+ if lbw < 1.0e6:
+ lbw = 1.0e6
+ self.subdev.set_bw(lbw)
# Tell calibrator our declination as well
calib_set_decln(self.decln)
Modified:
gnuradio/branches/developers/eb/digital-wip/gr-wxgui/src/python/scopesink.py
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/gr-wxgui/src/python/scopesink.py
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/gr-wxgui/src/python/scopesink.py
2006-09-27 03:41:30 UTC (rev 3657)
@@ -310,7 +310,7 @@
ctrlbox.Add (self.trig_chan_choice, 0, wx.ALIGN_CENTER)
self.trig_mode_choice = wx.Choice (self, 1005,
- choices = ['Pos', 'Neg', 'Auto'])
+ choices = ['Auto', 'Pos', 'Neg'])
self.trig_mode_choice.SetToolTipString ("Select trigger slope or Auto
(untriggered roll)")
wx.EVT_CHOICE (self, 1005, self.trig_mode_choice_event)
ctrlbox.Add (self.trig_mode_choice, 0, wx.ALIGN_CENTER)
Modified: gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/Makefile.am
2006-09-27 02:54:32 UTC (rev 3656)
+++ gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/Makefile.am
2006-09-27 03:41:30 UTC (rev 3657)
@@ -64,7 +64,11 @@
fusb_linux.cc \
fusb_sysconfig_linux.cc
+ra_wb_CODE = \
+ fusb_ra_wb.cc \
+ fusb_sysconfig_ra_wb.cc
+
#
# include each <foo>_CODE entry here...
#
@@ -72,7 +76,8 @@
$(generic_CODE) \
$(darwin_CODE) \
$(win32_CODE) \
- $(linux_CODE)
+ $(linux_CODE) \
+ $(ra_wb_CODE)
# work around automake deficiency
@@ -103,7 +108,11 @@
libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(linux_CODE)
endif
+if FUSB_TECH_ra_wb
+libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(ra_wb_CODE)
+endif
+
libusrp_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
libusrp_la_LIBADD = $(USB_LIBS) ../misc/libmisc.la
Modified: gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb.h
===================================================================
--- gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb.h
2006-09-27 02:54:32 UTC (rev 3656)
+++ gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb.h
2006-09-27 03:41:30 UTC (rev 3657)
@@ -123,6 +123,11 @@
*/
static int max_block_size ();
+ /*!
+ * \brief returns the default buffer size
+ */
+ static int default_buffer_size ();
+
};
#endif /* _FUSB_H_ */
Copied: gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_ra_wb.cc
(from rev 3656, gnuradio/trunk/usrp/host/lib/fusb_ra_wb.cc)
===================================================================
--- gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_ra_wb.cc
(rev 0)
+++ gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_ra_wb.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -0,0 +1,258 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2006 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 2, 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <fusb_ra_wb.h>
+#include <usb.h>
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include <sys/event.h>
+#include <dev/usb/usb.h>
+
+static const int USB_TIMEOUT = 1000; // in milliseconds
+
+// the following comment and function is from fusb_linux.cc
+#if 0
+// Totally evil and fragile extraction of file descriptor from
+// guts of libusb. They don't install usbi.h, which is what we'd need
+// to do this nicely.
+//
+// FIXME if everything breaks someday in the future, look here...
+
+static int
+fd_from_usb_dev_handle (usb_dev_handle *udh)
+{
+ return *((int *) udh);
+}
+#endif
+
+// the control endpoint doesn't actually do us any good so here is a
+// new "fragile extraction"
+static int
+ep_fd_from_usb_dev_handle (usb_dev_handle *udh, int endpoint)
+{
+ struct usb_dev_handle_kludge2 { // see also usrp_prims.cc
+ int fd;
+ struct usb_bus *bus;
+ struct usb_device *device;
+ int config;
+ int interface;
+ int altsetting;
+ void *impl_info;
+ };
+ struct bsd_usb_dev_handle_info_kludge {
+ int ep_fd[USB_MAX_ENDPOINTS];
+ };
+ struct bsd_usb_dev_handle_info_kludge *info
+ = (struct bsd_usb_dev_handle_info_kludge *)
+ ((struct usb_dev_handle_kludge2 *)udh)->impl_info;
+ return info->ep_fd[UE_GET_ADDR(endpoint)];
+}
+
+
+fusb_devhandle_ra_wb::fusb_devhandle_ra_wb (usb_dev_handle *udh)
+ : fusb_devhandle (udh)
+{
+ // that's it
+}
+
+fusb_devhandle_ra_wb::~fusb_devhandle_ra_wb ()
+{
+ // nop
+}
+
+fusb_ephandle *
+fusb_devhandle_ra_wb::make_ephandle (int endpoint, bool input_p,
+ int block_size, int nblocks)
+{
+ return new fusb_ephandle_ra_wb (this, endpoint, input_p,
+ block_size, nblocks);
+}
+
+// ----------------------------------------------------------------
+
+fusb_ephandle_ra_wb::fusb_ephandle_ra_wb (fusb_devhandle_ra_wb *dh,
+ int endpoint, bool input_p,
+ int block_size, int nblocks)
+ : fusb_ephandle (endpoint, input_p, block_size, nblocks),
+ d_devhandle (dh), d_ra_wb_on (false)
+{
+ // that's it
+}
+
+fusb_ephandle_ra_wb::~fusb_ephandle_ra_wb ()
+{
+ // nop
+}
+
+bool
+fusb_ephandle_ra_wb::start ()
+{
+ d_started = true;
+
+ char buf = '\0';
+ int fd;
+
+ // this is to cause libusb to open the endpoint
+ if (!d_input_p) {
+ write(&buf, 0);
+ fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(),
+ d_endpoint);
+ }
+ else {
+ read(&buf, 0);
+ fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(),
+ d_endpoint|USB_ENDPOINT_IN);
+ }
+
+ // enable read ahead/write behind
+ int ret;
+ struct usb_bulk_ra_wb_opt opts;
+ int enable = 1;
+
+ opts.ra_wb_buffer_size = d_block_size*d_nblocks;
+ opts.ra_wb_request_size = d_block_size;
+// fprintf (stderr, "setting buffer size to %d, request size to %d\n",
+// opts.ra_wb_buffer_size, opts.ra_wb_request_size);
+ if (!d_input_p) {
+ ret = ioctl (fd, USB_SET_BULK_WB_OPT, &opts);
+ if (ret < 0)
+ fprintf (stderr, "USB_SET_BULK_WB_OPT: %s\n", strerror(errno));
+ else {
+ ret = ioctl (fd, USB_SET_BULK_WB, &enable);
+ if (ret < 0)
+ fprintf (stderr, "USB_SET_BULK_WB: %s\n", strerror(errno));
+ else
+ d_ra_wb_on = true;
+ }
+ }
+ else {
+ ret = ioctl (fd, USB_SET_BULK_RA_OPT, &opts);
+ if (ret < 0)
+ fprintf (stderr, "USB_SET_BULK_RA_OPT: %s\n", strerror(errno));
+ else {
+ ret = ioctl (fd, USB_SET_BULK_RA, &enable);
+ if (ret < 0)
+ fprintf (stderr, "USB_SET_BULK_RA: %s\n", strerror(errno));
+ else
+ d_ra_wb_on = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+fusb_ephandle_ra_wb::stop ()
+{
+ int fd;
+ int ret;
+ int enable = 0;
+ if (d_ra_wb_on) {
+ if (!d_input_p) {
+ fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(),
+ d_endpoint);
+ ret = ioctl (fd, USB_SET_BULK_WB, &enable);
+ if (ret < 0)
+ fprintf (stderr, "USB_SET_BULK_WB: %s\n", strerror(errno));
+ else
+ d_ra_wb_on = false;
+ }
+ else {
+ fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(),
+ d_endpoint|USB_ENDPOINT_IN);
+ ret = ioctl (fd, USB_SET_BULK_RA, &enable);
+ if (ret < 0)
+ fprintf (stderr, "USB_SET_BULK_RA: %s\n", strerror(errno));
+ else
+ d_ra_wb_on = false;
+ }
+ }
+
+ d_started = false;
+ return true;
+}
+
+int
+fusb_ephandle_ra_wb::write (const void *buffer, int nbytes)
+{
+ if (!d_started)
+ return -1;
+
+ if (d_input_p)
+ return -1;
+
+ return usb_bulk_write (d_devhandle->get_usb_dev_handle (),
+ d_endpoint, (char *) buffer, nbytes, USB_TIMEOUT);
+}
+
+int
+fusb_ephandle_ra_wb::read (void *buffer, int nbytes)
+{
+ if (!d_started)
+ return -1;
+
+ if (!d_input_p)
+ return -1;
+
+ return usb_bulk_read (d_devhandle->get_usb_dev_handle (),
+ d_endpoint|USB_ENDPOINT_IN, (char *) buffer, nbytes,
+ USB_TIMEOUT);
+}
+
+void
+fusb_ephandle_ra_wb::wait_for_completion ()
+{
+ // as the driver is implemented this only makes sense for write
+ if (d_ra_wb_on && !d_input_p) {
+ int fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(),
+ d_endpoint);
+ int kq = kqueue();
+ if (kq < 0)
+ return;
+ struct kevent evt;
+ int nevents;
+ EV_SET (&evt, fd, EVFILT_WRITE, EV_ADD | EV_ENABLE, 0, 0, 0/*NULL*/);
+ nevents = kevent (kq, &evt, 1, &evt, 1, NULL);
+ if (nevents < 1) {
+ close(kq);
+ return;
+ }
+ while (!(evt.flags & EV_ERROR) && evt.data < (d_block_size*d_nblocks)) {
+ // it's a busy loop, but that's all I can do at the moment
+ nevents = kevent (kq, NULL, 0, &evt, 1, NULL);
+ // let's see if this improves the test_usrp_standard_tx throughput &
+ // "CPU usage" by looping less frequently
+ struct timeval timeout;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 1000; // 1 ms
+ select (0, NULL, NULL, NULL, &timeout);
+ }
+ close (kq);
+ }
+}
Copied: gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_ra_wb.h
(from rev 3656, gnuradio/trunk/usrp/host/lib/fusb_ra_wb.h)
===================================================================
--- gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_ra_wb.h
(rev 0)
+++ gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_ra_wb.h
2006-09-27 03:41:30 UTC (rev 3657)
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2006 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 2, 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.
+ */
+
+#ifndef _FUSB_RA_WB_H_
+#define _FUSB_RA_WB_H_
+
+#include <fusb.h>
+
+/*!
+ * \brief generic implementation of fusb_devhandle using only libusb
+ */
+class fusb_devhandle_ra_wb : public fusb_devhandle
+{
+public:
+ // CREATORS
+ fusb_devhandle_ra_wb (usb_dev_handle *udh);
+ virtual ~fusb_devhandle_ra_wb ();
+
+ // MANIPULATORS
+ virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p,
+ int block_size = 0, int nblocks = 0);
+};
+
+
+/*!
+ * \brief generic implementation of fusb_ephandle using only libusb
+ */
+class fusb_ephandle_ra_wb : public fusb_ephandle
+{
+private:
+ fusb_devhandle_ra_wb *d_devhandle;
+ bool d_ra_wb_on;
+
+public:
+ // CREATORS
+ fusb_ephandle_ra_wb (fusb_devhandle_ra_wb *dh, int endpoint, bool input_p,
+ int block_size = 0, int nblocks = 0);
+ virtual ~fusb_ephandle_ra_wb ();
+
+ // MANIPULATORS
+
+ virtual bool start (); //!< begin streaming i/o
+ virtual bool stop (); //!< stop streaming i/o
+
+ /*!
+ * \returns \p nbytes if write was successfully enqueued, else -1.
+ * Will block if no free buffers available.
+ */
+ virtual int write (const void *buffer, int nbytes);
+
+ /*!
+ * \returns number of bytes read or -1 if error.
+ * number of bytes read will be <= nbytes.
+ * Will block if no input available.
+ */
+ virtual int read (void *buffer, int nbytes);
+
+ /*
+ * block until all outstanding writes have completed
+ */
+ virtual void wait_for_completion ();
+};
+
+#endif /* _FUSB_RA_WB_H_ */
+
Modified:
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_darwin.cc
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_darwin.cc
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_darwin.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -24,6 +24,7 @@
#include <fusb_darwin.h>
static const int MAX_BLOCK_SIZE = 32 * 1024; // hard limit
+static const int FUSB_BUFFER_SIZE = 2 * (1L << 20); // 2 MB (was 8 MB)
fusb_devhandle *
fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
@@ -35,3 +36,9 @@
{
return MAX_BLOCK_SIZE;
}
+
+int fusb_sysconfig::default_buffer_size ()
+{
+ return FUSB_BUFFER_SIZE;
+}
+
Modified:
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_generic.cc
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_generic.cc
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_generic.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -24,6 +24,7 @@
#include <fusb_generic.h>
static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit
+static const int FUSB_BUFFER_SIZE = 2 * (1L << 20); // 2 MB (was 8 MB)
fusb_devhandle *
fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
@@ -35,3 +36,8 @@
{
return MAX_BLOCK_SIZE;
}
+
+int fusb_sysconfig::default_buffer_size ()
+{
+ return FUSB_BUFFER_SIZE;
+}
Modified:
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_linux.cc
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_linux.cc
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_linux.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -24,6 +24,7 @@
#include <fusb_linux.h>
static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit
+static const int FUSB_BUFFER_SIZE = 2 * (1L << 20); // 2 MB (was 8 MB)
fusb_devhandle *
fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
@@ -35,3 +36,8 @@
{
return MAX_BLOCK_SIZE;
}
+
+int fusb_sysconfig::default_buffer_size ()
+{
+ return FUSB_BUFFER_SIZE;
+}
Copied:
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_ra_wb.cc
(from rev 3656, gnuradio/trunk/usrp/host/lib/fusb_sysconfig_ra_wb.cc)
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_ra_wb.cc
(rev 0)
+++
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_ra_wb.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003,2006 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 2, 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_ra_wb.h>
+
+//static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit
+// there's no hard limit, even before making any changes to the driver
+// 64k is empirically a pretty good number
+static const int MAX_BLOCK_SIZE = 64 * 1024;
+// there is a limit of 1 MB in the driver for the buffer size
+static const int FUSB_BUFFER_SIZE = 256 * (1L << 10); // 256 kB
+
+fusb_devhandle *
+fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
+{
+ return new fusb_devhandle_ra_wb (udh);
+}
+
+int fusb_sysconfig::max_block_size ()
+{
+ return MAX_BLOCK_SIZE;
+}
+
+int fusb_sysconfig::default_buffer_size ()
+{
+ return FUSB_BUFFER_SIZE;
+}
Modified:
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_win32.cc
===================================================================
---
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_win32.cc
2006-09-27 02:54:32 UTC (rev 3656)
+++
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/fusb_sysconfig_win32.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -24,6 +24,7 @@
#include <fusb_win32.h>
static const int MAX_BLOCK_SIZE = 64 * 1024; // Windows kernel hard
limit
+static const int FUSB_BUFFER_SIZE = 2 * (1L << 20); // 2 MB (was 8 MB)
fusb_devhandle *
fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
@@ -35,3 +36,8 @@
{
return MAX_BLOCK_SIZE;
}
+
+int fusb_sysconfig::default_buffer_size ()
+{
+ return FUSB_BUFFER_SIZE;
+}
Modified:
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/usrp_basic.cc
===================================================================
--- gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/usrp_basic.cc
2006-09-27 02:54:32 UTC (rev 3656)
+++ gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/usrp_basic.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -42,8 +42,7 @@
// These set the buffer size used for each end point using the fast
// usb interface. The kernel ends up locking down this much memory.
-static const int FUSB_BUFFER_SIZE = 2 * (1L << 20); // 2 MB (was 8 MB)
-//static const int FUSB_BUFFER_SIZE = 256 * (1L << 10); // 256 kB
+static const int FUSB_BUFFER_SIZE = fusb_sysconfig::default_buffer_size();
static const int FUSB_BLOCK_SIZE = fusb_sysconfig::max_block_size();
static const int FUSB_NBLOCKS = FUSB_BUFFER_SIZE / FUSB_BLOCK_SIZE;
Modified:
gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/usrp_prims.cc
===================================================================
--- gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/usrp_prims.cc
2006-09-27 02:54:32 UTC (rev 3656)
+++ gnuradio/branches/developers/eb/digital-wip/usrp/host/lib/usrp_prims.cc
2006-09-27 03:41:30 UTC (rev 3657)
@@ -244,12 +244,13 @@
abort ();
}
-#if defined(WIN32)
+#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
// There's no get get_configuration function, and with some of the newer
kernels
// setting the configuration, even if to the same value, hoses any other
processes
// that have it open. Hence we opt to not set it at all (We've only
// got a single configuration anyway). This may hose the win32 stuff...
+ // Appears to be required for libusb-win32 and Cygwin -- dew 09/20/06
if (usb_set_configuration (udh, 1) < 0){
/*
* Ignore this error.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3657 - in gnuradio/branches/developers/eb/digital-wip: config ezdop/src/firmware gnuradio-core/src/lib/io gr-error-correcting-codes/src/python gr-radio-astronomy/src/python gr-wxgui/src/python usrp/host/lib,
eb <=