commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11520 - in gnuradio/branches/developers/eb/vrt2: . co


From: eb
Subject: [Commit-gnuradio] r11520 - in gnuradio/branches/developers/eb/vrt2: . config gr-utils/src/python gr-vrt gr-vrt/src
Date: Thu, 30 Jul 2009 16:57:58 -0600 (MDT)

Author: eb
Date: 2009-07-30 16:57:57 -0600 (Thu, 30 Jul 2009)
New Revision: 11520

Added:
   gnuradio/branches/developers/eb/vrt2/config/grc_gr_vrt.m4
   gnuradio/branches/developers/eb/vrt2/config/grc_vrt.m4
   gnuradio/branches/developers/eb/vrt2/gr-utils/src/python/qr_fft.py
   gnuradio/branches/developers/eb/vrt2/gr-vrt/
   gnuradio/branches/developers/eb/vrt2/gr-vrt/Makefile.am
   gnuradio/branches/developers/eb/vrt2/gr-vrt/gnuradio-vrt.pc.in
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.am
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.swig.gen
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/qa_vrt.py
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/run_tests.in
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt.i
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.h
   gnuradio/branches/developers/eb/vrt2/vrt/
Removed:
   gnuradio/branches/developers/eb/vrt2/gr-vrt/Makefile.am
   gnuradio/branches/developers/eb/vrt2/gr-vrt/gnuradio-vrt.pc.in
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.am
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.swig.gen
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/qa_vrt.py
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/run_tests.in
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt.i
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.h
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.cc
   gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.h
Modified:
   gnuradio/branches/developers/eb/vrt2/config/Makefile.am
   gnuradio/branches/developers/eb/vrt2/configure.ac
   gnuradio/branches/developers/eb/vrt2/gr-utils/src/python/Makefile.am
Log:
merged eb/vrt r11054:11518 into new copy of trunk, vrt2

Modified: gnuradio/branches/developers/eb/vrt2/config/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/vrt2/config/Makefile.am     2009-07-30 
21:54:38 UTC (rev 11519)
+++ gnuradio/branches/developers/eb/vrt2/config/Makefile.am     2009-07-30 
22:57:57 UTC (rev 11520)
@@ -67,9 +67,11 @@
        grc_gr_trellis.m4 \
        grc_gr_usrp.m4 \
        grc_gr_video_sdl.m4 \
+       grc_gr_vrt.m4 \
        grc_gr_wxgui.m4 \
        grc_mblock.m4 \
        grc_gruel.m4 \
+       grc_vrt.m4 \
        gr_check_createfilemapping.m4 \
        gr_check_mc4020.m4 \
        gr_check_shm_open.m4 \

Copied: gnuradio/branches/developers/eb/vrt2/config/grc_gr_vrt.m4 (from rev 
11518, gnuradio/branches/developers/eb/vrt/config/grc_gr_vrt.m4)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/config/grc_gr_vrt.m4                   
        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/config/grc_gr_vrt.m4   2009-07-30 
22:57:57 UTC (rev 11520)
@@ -0,0 +1,38 @@
+dnl Copyright 2008,2009 Free Software Foundation, Inc.
+dnl 
+dnl This file is part of GNU Radio
+dnl 
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl 
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING.  If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+
+AC_DEFUN([GRC_GR_VRT],[
+    GRC_ENABLE(gr-vrt)
+
+    dnl Don't do gr-usrp if gnuradio-core or vrt skipped
+    GRC_CHECK_DEPENDENCY(gr-vrt, vrt)
+    GRC_CHECK_DEPENDENCY(gr-vrt, gnuradio-core)
+
+    AC_CONFIG_FILES([ \
+        gr-vrt/Makefile \
+       gr-vrt/gnuradio-vrt.pc \
+        gr-vrt/src/Makefile \
+        gr-vrt/src/run_tests \
+    ])
+
+    GRC_BUILD_CONDITIONAL(gr-vrt,[
+       dnl run_tests is created from run_tests.in.  Make it executable.
+       AC_CONFIG_COMMANDS([run_tests_vrt], [chmod +x gr-vrt/src/run_tests])
+    ])
+])

Copied: gnuradio/branches/developers/eb/vrt2/config/grc_vrt.m4 (from rev 11519, 
gnuradio/branches/developers/eb/vrt/config/grc_vrt.m4)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/config/grc_vrt.m4                      
        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/config/grc_vrt.m4      2009-07-30 
22:57:57 UTC (rev 11520)
@@ -0,0 +1,51 @@
+dnl Copyright 2008,2009 Free Software Foundation, Inc.
+dnl 
+dnl This file is part of GNU Radio
+dnl 
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl 
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING.  If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+
+AC_DEFUN([GRC_VRT],[
+    GRC_ENABLE(vrt)
+
+    dnl If execution gets to here, $passed will be:
+    dnl   with : if the --with code didn't error out
+    dnl   yes  : if the --enable code passed muster and all dependencies are 
met
+    dnl   no   : otherwise
+    if test $passed = yes; then
+       dnl Needed for vrt_socket_opener
+       AC_CHECK_HEADERS(arpa/inet.h byteswap.h linux/if_packet.h sys/socket.h 
sys/un.h)
+    fi
+    if test $passed != with; then
+       dnl how and where to find INCLUDES and LA
+       VRT_INCLUDES="-I\${abs_top_srcdir}/vrt/include"
+        VRT_LA="\${abs_top_builddir}/vrt/lib/libvrt.la"
+    fi
+
+    dnl Include the vrt INCLUDES and LA
+    AC_SUBST(VRT_INCLUDES)
+    AC_SUBST(VRT_LA)
+
+    AC_CONFIG_FILES([
+        vrt/Makefile
+        vrt/vrt.pc
+        vrt/include/Makefile
+        vrt/include/vrt/Makefile
+        vrt/lib/Makefile
+        vrt/apps/Makefile
+    ])
+
+    GRC_BUILD_CONDITIONAL(vrt)
+])

Modified: gnuradio/branches/developers/eb/vrt2/configure.ac
===================================================================
--- gnuradio/branches/developers/eb/vrt2/configure.ac   2009-07-30 21:54:38 UTC 
(rev 11519)
+++ gnuradio/branches/developers/eb/vrt2/configure.ac   2009-07-30 22:57:57 UTC 
(rev 11520)
@@ -338,8 +338,10 @@
 GRC_MBLOCK                     dnl this must come after GRC_GRUEL
 GRC_USRP
 GRC_USRP2
+GRC_VRT
 GRC_GR_USRP                    dnl this must come after GRC_USRP
 GRC_GR_USRP2
+GRC_GR_VRT
 GRC_GR_GCELL                   dnl this must come after GRC_GCELL and 
GRC_GNURADIO_CORE
 GRC_GR_MSDD6000        
 GRC_GR_AUDIO_ALSA

Modified: gnuradio/branches/developers/eb/vrt2/gr-utils/src/python/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-utils/src/python/Makefile.am        
2009-07-30 21:54:38 UTC (rev 11519)
+++ gnuradio/branches/developers/eb/vrt2/gr-utils/src/python/Makefile.am        
2009-07-30 22:57:57 UTC (rev 11520)
@@ -44,6 +44,7 @@
     gr_plot_iq.py \
     gr_plot_short.py \
     lsusrp \
+    qr_fft.py \
     usrp_fft.py \
     usrp_oscope.py \
     usrp_print_db.py \

Copied: gnuradio/branches/developers/eb/vrt2/gr-utils/src/python/qr_fft.py 
(from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-utils/src/python/qr_fft.py)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-utils/src/python/qr_fft.py          
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-utils/src/python/qr_fft.py  
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,490 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,2007,2008,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.
+# 
+
+from grc_gnuradio.wxgui import forms
+from gnuradio import gr, gru
+from gnuradio import vrt
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2, 
form, slider
+from gnuradio.gr import pubsub
+from optparse import OptionParser
+import wx
+import sys
+import numpy
+import time
+
+class app_top_block(stdgui2.std_top_block, pubsub.pubsub):
+    def __init__(self, frame, panel, vbox, argv):
+        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
+        pubsub.pubsub.__init__(self)
+        self.frame = frame
+        self.panel = panel
+        
+        parser = OptionParser(option_class=eng_option)
+        #parser.add_option("-e", "--interface", type="string", default="eth0",
+        #                  help="select Ethernet interface, default is eth0")
+        #parser.add_option("-m", "--mac-addr", type="string", default="",
+        #                  help="select USRP by MAC address, default is 
auto-select")
+        #parser.add_option("-A", "--antenna", default=None,
+        #                  help="select Rx Antenna (only on RFX-series 
boards)")
+        #parser.add_option("-d", "--decim", type="int", default=16,
+        #                  help="set fgpa decimation rate to DECIM 
[default=%default]")
+        #parser.add_option("-f", "--freq", type="eng_float", default=None,
+        #                  help="set frequency to FREQ", metavar="FREQ")
+        #parser.add_option("-g", "--gain", type="eng_float", default=None,
+        #                  help="set gain in dB (default is midpoint)")
+        parser.add_option("-W", "--waterfall", action="store_true", 
default=False,
+                          help="Enable waterfall display")
+        parser.add_option("-S", "--oscilloscope", action="store_true", 
default=False,
+                          help="Enable oscilloscope display")
+       parser.add_option("", "--avg-alpha", type="eng_float", default=1e-1,
+                         help="Set fftsink averaging factor, 
default=[%default]")
+       parser.add_option("", "--ref-scale", type="eng_float", default=1.0,
+                         help="Set dBFS=0dB input value, default=[%default]")
+        parser.add_option("--fft-size", type="int", default=1024,
+                          help="Set number of FFT bins [default=%default]")
+        parser.add_option("--samples-per-pkt", type="int", default=0,
+                          help="Set number of SAMPLES-PER-PKT 
[default=%default]")
+        (options, args) = parser.parse_args()
+        if len(args) != 0:
+            parser.print_help()
+            sys.exit(1)
+       self.options = options
+        self.show_debug_info = True
+        
+        self.u = vrt.quadradio_source_32fc("192.168.123.123",
+                                           int(62.5e6), 
options.samples_per_pkt)
+        #self.u.set_decim(options.decim)
+        
+        #input_rate = self.u.adc_rate() / self.u.decim()
+        input_rate = int(120e6/4)
+        
+        if options.waterfall:
+            self.scope = \
+              waterfallsink2.waterfall_sink_c (panel, fft_size=1024, 
sample_rate=input_rate)
+        elif options.oscilloscope:
+            self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate)
+        else:
+            self.scope = fftsink2.fft_sink_c (panel,
+                                              fft_size=options.fft_size,
+                                              sample_rate=input_rate, 
+                                             ref_scale=options.ref_scale,
+                                              ref_level=20.0,
+                                              y_divs = 12,
+                                             avg_alpha=options.avg_alpha)
+
+        self.connect(self.u, self.scope)
+
+        self._build_gui(vbox)
+       self._setup_events()
+       
+        # set initial values
+
+        #if options.gain is None:
+        #    # if no gain was specified, use the mid-point in dB
+        #    g = self.u.gain_range()
+        #    options.gain = float(g[0]+g[1])/2
+
+        #if options.freq is None:
+        #    # if no freq was specified, use the mid-point
+        #    r = self.u.freq_range()
+        #    options.freq = float(r[0]+r[1])/2
+            
+        #self.set_gain(options.gain)
+
+       #if options.antenna is not None:
+        #    print "Selecting antenna %s" % (options.antenna,)
+        #    self.subdev.select_rx_antenna(options.antenna)
+
+        if self.show_debug_info:
+        #    self.myform['decim'].set_value(self.u.decim())
+            self.myform['address@hidden'].set_value(input_rate)
+        #    self.myform['dbname'].set_value("0x%04X" % 
(self.u.daughterboard_id(),)) # FIXME: add text name
+            self.myform['baseband'].set_value(0)
+            self.myform['ddc'].set_value(0)
+
+        #if not(self.set_freq(options.freq)):
+        #    self._set_status_msg("Failed to set initial frequency")
+
+    def _set_status_msg(self, msg):
+        self.frame.GetStatusBar().SetStatusText(msg, 0)
+
+    def _build_gui(self, vbox):
+
+        def _form_set_freq(kv):
+            return self.set_freq(kv['freq'])
+            
+        vbox.Add(self.scope.win, 10, wx.EXPAND)
+        
+        # add control area at the bottom
+        self.myform = myform = form.form()
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        hbox.Add((5,0), 0, 0)
+        myform['freq'] = form.float_field(
+            parent=self.panel, sizer=hbox, label="Center freq", weight=1,
+            callback=myform.check_input_and_call(_form_set_freq, 
self._set_status_msg))
+
+        hbox.Add((5,0), 0, 0)
+        #g = self.u.gain_range()
+
+       # some configurations don't have gain control
+       if 0 and g[1] > g[0]:
+           myform['gain'] = form.slider_field(parent=self.panel, sizer=hbox, 
label="Gain",
+                                           weight=3,
+                                           min=int(g[0]), max=int(g[1]),
+                                           callback=self.set_gain)
+
+        hbox.Add((5,0), 0, 0)
+        vbox.Add(hbox, 0, wx.EXPAND)
+
+        self._build_subpanel(vbox)
+
+    def _build_subpanel(self, vbox_arg):
+        # build a secondary information panel (sometimes hidden)
+
+        # FIXME figure out how to have this be a subpanel that is always
+        # created, but has its visibility controlled by foo.Show(True/False)
+        
+        def _form_set_decim(kv):
+            return self.set_decim(kv['decim'])
+
+        if not(self.show_debug_info):
+            return
+
+        panel = self.panel
+        vbox = vbox_arg
+        myform = self.myform
+
+        #panel = wx.Panel(self.panel, -1)
+        #vbox = wx.BoxSizer(wx.VERTICAL)
+
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        hbox.Add((5,0), 0)
+
+        myform['decim'] = form.int_field(
+            parent=panel, sizer=hbox, label="Decim",
+            callback=myform.check_input_and_call(_form_set_decim, 
self._set_status_msg))
+
+        hbox.Add((5,0), 1)
+        myform['address@hidden'] = form.static_float_field(
+            parent=panel, sizer=hbox, label="address@hidden")
+
+        hbox.Add((5,0), 1)
+        myform['dbname'] = form.static_text_field(
+            parent=panel, sizer=hbox)
+
+        hbox.Add((5,0), 1)
+        myform['baseband'] = form.static_float_field(
+            parent=panel, sizer=hbox, label="Analog BB")
+
+        hbox.Add((5,0), 1)
+        myform['ddc'] = form.static_float_field(
+            parent=panel, sizer=hbox, label="DDC")
+
+        hbox.Add((5,0), 0)
+        vbox.Add(hbox, 0, wx.EXPAND)
+        ##### db control stuff #####
+        self.subscribe('cal_div_lo_freq', lambda x: self.u.set_lo_freq(x) and 
time.sleep(0.01))
+        self.subscribe('cal_div_lo_freq', self.u.set_center_freq) #TODO should 
be combined with set lo freq
+        self.subscribe('cal_div_cal_freq', lambda x: self.u.set_cal_freq(x) 
and time.sleep(0.01))
+        self.subscribe('db_ctrl_atten0', self.u.set_attenuation0)
+        self.subscribe('db_ctrl_atten1', self.u.set_attenuation1)
+        #self.subscribe('db_ctrl_10db', self.u.set_10dB_atten)
+        self.subscribe('db_ctrl_adcgain', self.u.set_adc_gain)
+        self.subscribe('db_ctrl_diggain', self.u.set_digital_gain)
+        self.subscribe('db_ctrl_dcoffset', self.u.set_dc_offset_comp)
+        self.subscribe('db_ctrl_bandsel', self.u.set_band_select)
+        self.subscribe('db_ctrl_type', self.u.select_rx_antenna)
+        self.subscribe('db_test_signal', self.u.set_test_signal)
+        self['db_ctrl_bandsel'] = 'A'
+        self['cal_div_lo_freq'] = 2.1e9
+        self['cal_div_cal_freq'] = 2.102e9
+        self['db_ctrl_atten0'] = 0
+        self['db_ctrl_atten1'] = 0
+        #self['db_ctrl_10db'] = False
+        self['db_ctrl_adcgain'] = False
+        self['db_ctrl_dcoffset'] = False
+        self['db_ctrl_diggain'] = 0.0
+        self['db_ctrl_type'] = 'rf'
+        self['db_test_signal'] = vrt.VRT_TEST_SIG_NORMAL
+        #slider and box for freqs
+        for key, name in (('cal_div_lo_freq', 'LO Freq'), ('cal_div_cal_freq', 
'Cal Freq')):
+            hbox = wx.BoxSizer(wx.HORIZONTAL)
+            hbox.AddSpacer(10)
+            forms.text_box(
+                label=name,
+                ps=self,
+                key=key,
+                sizer=hbox,
+                parent=panel,
+                proportion=0,
+                converter=forms.float_converter()
+            )
+            hbox.AddSpacer(20)
+            forms.slider(
+                ps=self,
+                key=key,
+                minimum=0,   #TODO get bounds from cal_div, from vrt...
+                maximum=int(3.5e9),
+                step_size=int(5e6),
+                cast=float,
+                sizer=hbox,
+                parent=panel,
+                proportion=2,
+            )
+            hbox.AddSpacer(10)
+            vbox.Add(hbox, 0, wx.EXPAND)
+        ############################################
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        hbox.AddSpacer(10)
+        #create slider for atten
+        atten0_txt_box = forms.static_text(
+            label='Attenuation (0)',
+            ps=self,
+            key='db_ctrl_atten0',
+            sizer=hbox,
+            parent=panel,
+            proportion=0,
+            converter=forms.int_converter()
+        )
+        hbox.AddSpacer(20)
+        atten0_slider = forms.slider(
+            ps=self,
+            key='db_ctrl_atten0',
+            minimum=0,
+            maximum=31,
+            step_size=1,
+            cast=int,
+            sizer=hbox,
+            parent=panel,
+            proportion=2,
+        )
+        hbox.AddSpacer(10)
+        #create slider for atten
+        forms.static_text(
+            label='Attenuation (1)',
+            ps=self,
+            key='db_ctrl_atten1',
+            sizer=hbox,
+            parent=panel,
+            proportion=0,
+            converter=forms.int_converter()
+        )
+        hbox.AddSpacer(20)
+        forms.slider(
+            ps=self,
+            key='db_ctrl_atten1',
+            minimum=0,
+            maximum=31,
+            step_size=1,
+            cast=int,
+            sizer=hbox,
+            parent=panel,
+            proportion=2,
+        )
+        hbox.AddSpacer(10)
+        def update_atten0(*args):
+            for form_obj in (atten0_txt_box, atten0_slider): 
form_obj.Enable(self['db_ctrl_bandsel'] > 'B')
+        update_atten0()
+        self.subscribe('db_ctrl_bandsel', update_atten0)
+        #create checkbox for 10dB att
+        #forms.check_box(
+        #    label='10dB Attenuation',
+        #    ps=self,
+        #    key='db_ctrl_10db',
+        #    sizer=hbox,
+        #    parent=panel,
+        #    proportion=1,
+        #)
+        #hbox.AddSpacer(10)
+        vbox.Add(hbox, 0, wx.EXPAND)
+        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
+        hbox2.AddSpacer(10)
+        forms.static_text(
+            label='ADC Controls',
+            ps=self,
+            key='db_ctrl_diggain',
+            sizer=hbox2,
+            parent=panel,
+            proportion=0,
+            converter=forms.float_converter()
+        )
+        hbox2.AddSpacer(20)
+        #create checkbox for ADC digital gain
+        forms.slider(
+            #label='ADC Digital Gain',
+            ps=self,
+            minimum=0,
+            maximum=6,
+            step_size=0.5,
+            key='db_ctrl_diggain',
+            sizer=hbox2,
+            parent=panel,
+            proportion=2,
+        )
+        hbox2.AddSpacer(10)
+        #create checkbox for 3.5dB ADC gain
+        forms.check_box(
+            label='3.5dB ADC Gain',
+            ps=self,
+            key='db_ctrl_adcgain',
+            sizer=hbox2,
+            parent=panel,
+            proportion=1,
+        )
+        hbox2.AddSpacer(10)
+        #create checkbox for DC Offset Correction in ADC
+        forms.check_box(
+            label='DC Offset Correction',
+            ps=self,
+            key='db_ctrl_dcoffset',
+            sizer=hbox2,
+            parent=panel,
+            proportion=2,
+        )
+        hbox2.AddSpacer(10)
+        vbox.Add(hbox2, 0, wx.EXPAND)
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        hbox.AddSpacer(10)
+        #create radio buttons for band sel
+        forms.radio_buttons(
+            label='Band Select',
+            ps=self,
+            key='db_ctrl_bandsel',
+            choices=['A', 'B', 'C', 'D'],
+            labels=['A', 'B', 'C', 'D'],
+            sizer=hbox,
+            parent=panel,
+            proportion=2,
+        )
+        hbox.AddSpacer(10)
+        #create radio buttons for band sel
+        types = sorted(
+            filter(lambda x: x.startswith('VRT_TEST_SIG_'), dir(vrt)),
+            lambda x, y: cmp(getattr(vrt, x), getattr(vrt, y)),
+        )
+        forms.drop_down(
+            label='Test Signal',
+            ps=self,
+            key='db_test_signal',
+            choices=map(lambda a: getattr(vrt, a), types),
+            labels=types,
+            sizer=hbox,
+            parent=panel,
+            proportion=2,
+        )
+        hbox.AddSpacer(10)
+        #create radio buttons for type
+        forms.radio_buttons(
+            label='RF Input',
+            ps=self,
+            key='db_ctrl_type',
+            choices=['rf', 'cal'],
+            labels=['Main RF', 'Calibrator'],
+            sizer=hbox,
+            parent=panel,
+            proportion=1,
+        )
+        hbox.AddSpacer(10)
+        vbox.Add(hbox, 0, wx.EXPAND)
+            
+    def set_freq(self, target_freq):
+        """
+        Set the center frequency we're interested in.
+
+        @param target_freq: frequency in Hz
+        @rypte: bool
+
+        Tuning is a two step process.  First we ask the front-end to
+        tune as close to the desired frequency as it can.  Then we use
+        the result of that operation and our target_frequency to
+        determine the value for the digital down converter.
+        """
+        return True
+    
+        r = self.u.set_center_freq(target_freq)
+        
+        if r:
+            self.myform['freq'].set_value(target_freq)     # update displayed 
value
+            if self.show_debug_info:
+                self.myform['baseband'].set_value(r.baseband_freq)
+                self.myform['ddc'].set_value(r.dxc_freq)
+           if not self.options.oscilloscope:
+               self.scope.win.set_baseband_freq(target_freq)
+           return True
+
+        return False
+
+    def set_gain(self, gain):
+        return True
+    
+       if self.myform.has_key('gain'):
+           self.myform['gain'].set_value(gain)     # update displayed value
+        self.u.set_gain(gain)
+
+    def set_decim(self, decim):
+        return True
+    
+        ok = self.u.set_decim(decim)
+        if not ok:
+            print "set_decim failed"
+        #input_rate = self.u.adc_rate() / self.u.decim()
+        input_rate = 120e6/4
+        self.scope.set_sample_rate(input_rate)
+        if self.show_debug_info:  # update displayed values
+            self.myform['decim'].set_value(self.u.decim())
+            self.myform['address@hidden'].set_value(input_rate)
+        return ok
+
+    def _setup_events(self):
+       if not self.options.waterfall and not self.options.oscilloscope:
+           self.scope.win.Bind(wx.EVT_LEFT_DCLICK, self.evt_left_dclick)
+           
+    def evt_left_dclick(self, event):
+       (ux, uy) = self.scope.win.GetXY(event)
+       if event.CmdDown():
+           # Re-center on maximum power
+           points = self.scope.win._points
+           if self.scope.win.peak_hold:
+               if self.scope.win.peak_vals is not None:
+                   ind = numpy.argmax(self.scope.win.peak_vals)
+               else:
+                   ind = int(points.shape()[0]/2)
+           else:
+               ind = numpy.argmax(points[:,1])
+            (freq, pwr) = points[ind]
+           target_freq = freq/self.scope.win._scale_factor
+           print ind, freq, pwr
+            self.set_freq(target_freq)            
+       else:
+           # Re-center on clicked frequency
+           target_freq = ux/self.scope.win._scale_factor
+           self.set_freq(target_freq)
+           
+       
+def main ():
+    app = stdgui2.stdapp(app_top_block, "QuadRadio FFT", nstatus=1)
+    app.MainLoop()
+
+if __name__ == '__main__':
+    main ()


Property changes on: gnuradio/branches/developers/eb/vrt2/gr-vrt
___________________________________________________________________
Added: svn:ignore
   + Makefile
Makefile.in
gnuradio-vrt.pc



Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/Makefile.am (from rev 
11518, gnuradio/branches/developers/eb/vrt/gr-vrt/Makefile.am)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/Makefile.am                     
        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/Makefile.am     2009-07-30 
22:57:57 UTC (rev 11520)
@@ -0,0 +1,27 @@
+#
+# Copyright 2001,2006,2008,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 $(top_srcdir)/Makefile.common
+
+SUBDIRS = src
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gnuradio-vrt.pc

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/gnuradio-vrt.pc.in (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/gnuradio-vrt.pc.in)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/gnuradio-vrt.pc.in              
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/gnuradio-vrt.pc.in      
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,11 @@
address@hidden@
address@hidden@
address@hidden@
address@hidden@/gnuradio
+
+Name: gnuradio-vrt
+Description: GNU Software Radio support for Virtual Radio Transport (VRT aka 
VITA-49)
+Requires: gnuradio-core vrt
+Version: @VERSION@
+Libs: -L${libdir} -lgnuradio-vrt
+Cflags: -I${includedir}


Property changes on: gnuradio/branches/developers/eb/vrt2/gr-vrt/src
___________________________________________________________________
Added: svn:ignore
   + Makefile
Makefile.in
.libs
.deps
vrt.py
vrt.cc
run_tests
test_gr_usrp2
*.pyc


Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.am (from rev 
11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/Makefile.am)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.am                 
        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.am 2009-07-30 
22:57:57 UTC (rev 11520)
@@ -0,0 +1,122 @@
+#
+# Copyright 2004,2005,2006,2008,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 $(top_srcdir)/Makefile.common
+
+# ----------------------------------------------------------------------
+# Local Python files, not installed
+#
+# qa_vrt.py
+# ----------------------------------------------------------------------
+
+noinst_PYTHON = qa_vrt.py
+
+# ----------------------------------------------------------------------
+# Miscellaneous build operations
+# ----------------------------------------------------------------------
+
+EXTRA_DIST = run_tests.in
+TESTS = run_tests
+DISTCLEANFILES = run_tests
+
+# ----------------------------------------------------------------------
+# C++ block API interface librar(ies)
+#
+# libgnuradio_vrt.so
+# ----------------------------------------------------------------------
+AM_CPPFLAGS = \
+       $(STD_DEFINES_AND_INCLUDES)  \
+       $(GRUEL_INCLUDES) \
+       $(PYTHON_CPPFLAGS) \
+       $(VRT_INCLUDES) \
+       $(WITH_INCLUDES)
+
+lib_LTLIBRARIES = libgnuradio-vrt.la
+
+libgnuradio_vrt_la_SOURCES = \
+       missing_pkt_checker.cc \
+       vrt_source_base.cc \
+       vrt_source_32fc.cc \
+       vrt_quadradio_source_32fc.cc
+
+
+#libgnuradio_vrt_la_SOURCES = \
+#      rx_16sc_handler.cc \
+#      rx_32fc_handler.cc \
+#      vrt_base.cc \
+#      vrt_source_base.cc \
+#      vrt_source_16sc.cc \
+#      vrt_source_32fc.cc
+
+#      vrt_sink_base.cc \
+#      vrt_sink_16sc.cc \
+#      vrt_sink_32fc.cc
+
+libgnuradio_vrt_la_LIBADD = \
+       $(VRT_LA) \
+       $(GNURADIO_CORE_LA) 
+
+grinclude_HEADERS = \
+       vrt_source_base.h \
+       vrt_source_32fc.h \
+       vrt_quadradio_source_32fc.h
+
+#      vrt_source_16sc.h \
+#      vrt_sink_base.h \
+#      vrt_sink_16sc.h \
+#      vrt_sink_32fc.h
+
+noinst_HEADERS = \
+       missing_pkt_checker.h
+
+
+# ----------------------------------------------------------------------
+# Python SWIG wrapper around C++ library
+#
+# vrt.py
+# _vrt.so
+# ----------------------------------------------------------------------
+
+TOP_SWIG_IFILES =              \
+       vrt.i
+
+# Install so that they end up available as:
+#   import gnuradio.vrt
+# This ends up at:
+#   ${prefix}/lib/python${python_version}/site-packages/gnuradio
+vrt_pythondir_category =       \
+       gnuradio
+
+# additional arguments to the SWIG command
+vrt_swig_args =                \
+       $(VRT_INCLUDES)
+
+# additional libraries for linking with the SWIG-generated library
+vrt_la_swig_libadd =           \
+       libgnuradio-vrt.la
+
+include $(top_srcdir)/Makefile.swig
+
+# add some of the variables generated inside the Makefile.swig.gen
+BUILT_SOURCES = $(swig_built_sources)
+
+# Do not distribute the output of SWIG
+no_dist_files = $(swig_built_sources)

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.swig.gen (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/Makefile.swig.gen)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.swig.gen           
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/Makefile.swig.gen   
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,259 @@
+# -*- Makefile -*-
+#
+# Copyright 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.
+# 
+
+# Makefile.swig.gen for vrt.i
+
+## Default install locations for these files:
+##
+## Default location for the Python directory is:
+##  ${prefix}/lib/python${python_version}/site-packages/[category]/vrt
+## Default location for the Python exec directory is:
+##  ${exec_prefix}/lib/python${python_version}/site-packages/[category]/vrt
+##
+## The following can be overloaded to change the install location, but
+## this has to be done in the including Makefile.am -before-
+## Makefile.swig is included.
+
+vrt_pythondir_category ?= gnuradio/vrt
+vrt_pylibdir_category ?= $(vrt_pythondir_category)
+vrt_pythondir = $(pythondir)/$(vrt_pythondir_category)
+vrt_pylibdir = $(pyexecdir)/$(vrt_pylibdir_category)
+
+## SWIG headers are always installed into the same directory.
+
+vrt_swigincludedir = $(swigincludedir)
+
+## This is a template file for a "generated" Makefile addition (in
+## this case, "Makefile.swig.gen").  By including the top-level
+## Makefile.swig, this file will be used to generate the SWIG
+## dependencies.  Assign the variable TOP_SWIG_FILES to be the list of
+## SWIG .i files to generated wrappings for; there can be more than 1
+## so long as the names are unique (no sorting is done on the
+## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i
+## file will generate .cc, .py, and possibly .h files -- meaning that
+## all of these files will have the same base name (that provided for
+## the SWIG .i file).
+##
+## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
+## right thing.  For more info, see <
+## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
+
+## Stamps used to ensure parallel make does the right thing.  These
+## are removed by "make clean", but otherwise unused except during the
+## parallel built.  These will not be included in a tarball, because
+## the SWIG-generated files will be removed from the distribution.
+
+STAMPS += $(DEPDIR)/vrt-generate-*
+
+## Other cleaned files: dependency files generated by SWIG or this Makefile
+
+MOSTLYCLEANFILES += $(DEPDIR)/*.S*
+
+## Add the .py and .cc files to the list of SWIG built sources.  The
+## .h file is sometimes built, but not always ... so that one has to
+## be added manually by the including Makefile.am .
+
+swig_built_sources += vrt.py vrt.cc
+
+## Various SWIG variables.  These can be overloaded in the including
+## Makefile.am by setting the variable value there, then including
+## Makefile.swig .
+
+vrt_swiginclude_HEADERS =              \
+       vrt.i                   \
+       $(vrt_swiginclude_headers)
+
+vrt_pylib_LTLIBRARIES =                \
+       _vrt.la
+
+_vrt_la_SOURCES =                      \
+       vrt.cc                  \
+       $(vrt_la_swig_sources)
+
+_vrt_la_LIBADD =                       \
+       $(STD_SWIG_LA_LIB_ADD)          \
+       $(vrt_la_swig_libadd)
+
+_vrt_la_LDFLAGS =                      \
+       $(STD_SWIG_LA_LD_FLAGS)         \
+       $(vrt_la_swig_ldflags)
+
+_vrt_la_CXXFLAGS =                     \
+       $(STD_SWIG_CXX_FLAGS)           \
+       $(vrt_la_swig_cxxflags)
+
+vrt_python_PYTHON =                    \
+       vrt.py                  \
+       $(vrt_python)
+
+## Entry rule for running SWIG
+
+vrt.h vrt.py vrt.cc: vrt.i
+## This rule will get called only when MAKE decides that one of the
+## targets needs to be created or re-created, because:
+##
+## * The .i file is newer than any or all of the generated files;
+##
+## * Any or all of the .cc, .h, or .py files does not exist and is
+##   needed (in the case this file is not needed, the rule for it is
+##   ignored); or
+##
+## * Some SWIG-based dependecy of the .cc file isn't met and hence the
+##   .cc file needs be be regenerated.  Explanation: Because MAKE
+##   knows how to handle dependencies for .cc files (regardless of
+##   their name or extension), then the .cc file is used as a target
+##   instead of the .i file -- but with the dependencies of the .i
+##   file.  It is this last reason why the line:
+##
+##             if test -f $@; then :; else
+##
+##   cannot be used in this case: If a .i file dependecy is not met,
+##   then the .cc file needs to be rebuilt.  But if the stamp is newer
+##   than the .cc file, and the .cc file exists, then in the original
+##   version (with the 'test' above) the internal MAKE call will not
+##   be issued and hence the .cc file will not be rebuilt.
+##
+## Once execution gets to here, it should always proceed no matter the
+## state of a stamp (as discussed in link above).  The
+## $(DEPDIR)/vrt-generate stuff is used to allow for parallel
+## builds to "do the right thing".  The stamp has no relationship with
+## either the target files or dependency file; it is used solely for
+## the protection of multiple builds during a given call to MAKE.
+##
+## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
+## (15).  At a caught signal, the quoted command will be issued before
+## exiting.  In this case, remove any stamp, whether temporary of not.
+## The trap is valid until the process exits; the process includes all
+## commands appended via "\"s.
+##
+       trap 'rm -rf $(DEPDIR)/vrt-generate-*' 1 2 13 15; \
+##
+## Create a temporary directory, which acts as a lock.  The first
+## process to create the directory will succeed and issue the MAKE
+## command to do the actual work, while all subsequent processes will
+## fail -- leading them to wait for the first process to finish.
+##
+       if mkdir $(DEPDIR)/vrt-generate-lock 2>/dev/null; then \
+##
+## This code is being executed by the first process to succeed in
+## creating the directory lock.
+##
+## Remove the stamp associated with this filename.
+##
+               rm -f $(DEPDIR)/vrt-generate-stamp; \
+##
+## Tell MAKE to run the rule for creating this stamp.
+##
+               $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/vrt-generate-stamp WHAT=$<; \
+##
+## Now that the .cc, .h, and .py files have been (re)created from the
+## .i file, future checking of this rule during the same MAKE
+## execution will come back that the rule doesn't need to be executed
+## because none of the conditions mentioned at the start of this rule
+## will be positive.  Remove the the directory lock, which frees up
+## any waiting process(es) to continue.
+##
+               rmdir $(DEPDIR)/vrt-generate-lock; \
+       else \
+##
+## This code is being executed by any follower processes while the
+## directory lock is in place.
+##
+## Wait until the first process is done, testing once per second.
+##
+               while test -d $(DEPDIR)/vrt-generate-lock; do \
+                       sleep 1; \
+               done; \
+##
+## Succeed if and only if the first process succeeded; exit this
+## process returning the status of the generated stamp.
+##
+               test -f $(DEPDIR)/vrt-generate-stamp; \
+               exit $$?; \
+       fi;
+
+$(DEPDIR)/vrt-generate-stamp:
+## This rule will be called only by the first process issuing the
+## above rule to succeed in creating the lock directory, after
+## removing the actual stamp file in order to guarantee that MAKE will
+## execute this rule.
+##
+## Call SWIG to generate the various output files; special
+## post-processing on 'mingw32' host OS for the dependency file.
+##
+       if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(vrt_swig_args) \
+               -MD -MF $(DEPDIR)/vrt.Std \
+               -module vrt -o vrt.cc $(WHAT); then \
+           if test $(host_os) = mingw32; then \
+               $(RM) $(DEPDIR)/vrt.Sd; \
+               $(SED) 's,\\\\,/,g' < $(DEPDIR)/vrt.Std \
+                       > $(DEPDIR)/vrt.Sd; \
+               $(RM) $(DEPDIR)/vrt.Std; \
+               $(MV) $(DEPDIR)/vrt.Sd $(DEPDIR)/vrt.Std; \
+           fi; \
+       else \
+           $(RM) $(DEPDIR)/vrt.S*; exit 1; \
+       fi;
+##
+## Mess with the SWIG output .Std dependency file, to create a
+## dependecy file valid for the input .i file: Basically, simulate the
+## dependency file created for libraries by GNU's libtool for C++,
+## where all of the dependencies for the target are first listed, then
+## each individual dependency is listed as a target with no further
+## dependencies.
+##
+## (1) remove the current dependency file
+##
+       $(RM) $(DEPDIR)/vrt.d
+##
+## (2) Copy the whole SWIG file:
+##
+       cp $(DEPDIR)/vrt.Std $(DEPDIR)/vrt.d
+##
+## (3) all a carriage return to the end of the dependency file.
+##
+       echo "" >> $(DEPDIR)/vrt.d
+##
+## (4) from the SWIG file, remove the first line (the target); remove
+##     trailing " \" and " " from each line.  Append ":" to each line,
+##     followed by 2 carriage returns, then append this to the end of
+##     the dependency file.
+##
+       $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/vrt.Std | \
+               awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/vrt.d
+##
+## (5) remove the SWIG-generated file
+##
+       $(RM) $(DEPDIR)/vrt.Std
+##
+## Create the stamp for this filename generation, to signal success in
+## executing this rule; allows other threads waiting on this process
+## to continue.
+##
+       touch $(DEPDIR)/vrt-generate-stamp
+
+# KLUDGE: Force runtime include of a SWIG dependency file.  This is
+# not guaranteed to be portable, but will probably work.  If it works,
+# we have accurate dependencies for our swig stuff, which is good.
+
address@hidden@ @address@hidden/$(DEPDIR)/address@hidden@
+

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.cc 
(from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/missing_pkt_checker.cc)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.cc      
                        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.cc      
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <missing_pkt_checker.h>
+
+int
+missing_pkt_checker::check(const vrt::expanded_header *hdr)
+{
+  // FIXME assumes we're inspecting only a single stream
+
+  int nmissing = 0;
+  int actual = hdr->pkt_cnt();
+  int expected = (d_last_pkt_cnt + 1) & 0xf;
+  if (actual != expected && !d_resync){
+    d_nwrong_pkt_cnt++;
+    if (actual > expected)
+      nmissing = actual - expected;
+    else
+      nmissing = actual + 16 - expected;
+    d_nmissing_pkt_est += nmissing;
+  }
+  d_last_pkt_cnt = actual;
+  d_npackets++;
+  d_resync = false;
+  return nmissing;
+}

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.h 
(from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/missing_pkt_checker.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.h       
                        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/missing_pkt_checker.h       
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_MISSING_PKT_CHECKER_H
+#define INCLUDED_MISSING_PKT_CHECKER_H
+
+#include <vrt/expanded_header.h>
+#include <stdint.h>
+
+/*!
+ * \brief Check for missing packets
+ */
+class missing_pkt_checker
+{
+  // FIXME assumes we're inspecting only a single stream
+
+  bool         d_resync;
+  uint64_t     d_npackets;             //< total number of packets
+  int          d_last_pkt_cnt;         //< the last pkt_cnt we saw
+  uint64_t     d_nwrong_pkt_cnt;       //< number of incorrect pkt_cnt
+  uint64_t     d_nmissing_pkt_est;     //< estimate of total number of missing 
pkts
+  
+public:
+  missing_pkt_checker()
+    : d_resync(true), d_npackets(0), d_last_pkt_cnt(0xf), d_nwrong_pkt_cnt(0),
+      d_nmissing_pkt_est(0) {}
+    
+  /*!
+   * \brief check header pkt_cnt and return 0 if OK, else estimate of number 
of missing packets.
+   */
+  int check(const vrt::expanded_header *hdr);
+
+  void resync() { d_resync = true; }
+  uint64_t npackets() const { return d_npackets; }
+  uint64_t nwrong_pkt_cnt() const { return d_nwrong_pkt_cnt; }
+  uint64_t nmissing_pkt_est() const { return d_nmissing_pkt_est; }
+};
+
+
+#endif /* INCLUDED_MISSING_PKT_CHECKER_H */

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/qa_vrt.py (from rev 
11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/qa_vrt.py)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/qa_vrt.py                   
        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/qa_vrt.py   2009-07-30 
22:57:57 UTC (rev 11520)
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+#
+# Copyright 2005,2008,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.
+# 
+
+from gnuradio import gr, gr_unittest
+import vrt
+
+class qa_vrt(gr_unittest.TestCase):
+
+    def setUp(self):
+        self.tb = gr.top_block()
+
+    def tearDown(self):
+        self.tb = None
+
+    def test_000_nop (self):
+        """Just see if we can import the module...
+        They may not have a VRT connected, etc.  Don't try to run anything"""
+        pass
+    
+if __name__ == '__main__':
+    gr_unittest.main ()

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/run_tests.in (from rev 
11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/run_tests.in)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/run_tests.in                
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/run_tests.in        
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# 1st parameter is absolute path to component source directory
+# 2nd parameter is absolute path to component build directory
+# 3rd parameter is path to Python QA directory
+
+# For OS/X
address@hidden@/vrt/host/lib/legacy:@abs_top_builddir@/vrt/host/lib/legacy/.libs:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH
+
+# For Win32
address@hidden@/vrt/host/lib/legacy:@abs_top_builddir@/vrt/host/lib/legacy/.libs:$PATH
+
address@hidden@/run_tests.sh \
+    @abs_top_srcdir@/gr-vrt \
+    @abs_top_builddir@/gr-vrt \
+    @srcdir@

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt.i (from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt.i)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt.i                       
        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt.i       2009-07-30 
22:57:57 UTC (rev 11520)
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,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 "gnuradio.i"  // the common stuff
+%import <stdint.i>
+
+%{
+#include "vrt_quadradio_source_32fc.h"
+#include <vrt/quadradio.h>
+//#include "vrt_quadradio_source_16sc.h"
+//#include "vrt_sink_32fc.h"
+//#include "vrt_sink_16sc.h"
+%}
+
+%template(uint32_t_vector) std::vector<uint32_t>;
+
+// ----------------------------------------------------------------
+
+class vrt_source_base : public gr_sync_block
+{
+protected:
+  vrt_source_base() throw (std::runtime_error);
+
+public:
+  ~vrt_source_base();
+
+};
+
+class vrt_source_32fc : public vrt_source_base
+{
+protected:
+  vrt_source_32fc() throw (std::runtime_error);
+
+public:
+  ~vrt_source_32fc();
+};
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(vrt,quadradio_source_32fc)
+
+%include "vrt_quadradio_source_32fc.h"
+
+%include <vrt/quadradio.h>

Copied: 
gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.cc 
(from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.cc)
===================================================================
--- 
gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.cc    
                            (rev 0)
+++ 
gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.cc    
    2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,200 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vrt_quadradio_source_32fc.h>
+#include <vrt/quadradio.h>
+#include <vrt/rx_packet_handler.h>
+
+vrt_quadradio_source_32fc_sptr
+vrt_make_quadradio_source_32fc(const std::string &ip, 
+                              size_t rx_bufsize,
+                              size_t samples_per_pkt)
+{
+  return gnuradio::get_initial_sptr(new vrt_quadradio_source_32fc(ip,
+                                                                 rx_bufsize,
+                                                                 
samples_per_pkt));
+}
+
+vrt_quadradio_source_32fc::vrt_quadradio_source_32fc(const std::string &ip,
+                                                    size_t rx_bufsize,
+                                                    size_t samples_per_pkt)
+  : vrt_source_32fc("quadradio_source_32fc"),
+    d_samples_per_pkt(samples_per_pkt == 0 ? 800 : samples_per_pkt),
+    d_qr(vrt::quadradio::sptr(new vrt::quadradio(ip, rx_bufsize)))
+{
+}
+
+vrt_quadradio_source_32fc::~vrt_quadradio_source_32fc()
+{
+  d_qr->stop_streaming();
+}
+
+vrt::rx::sptr 
+vrt_quadradio_source_32fc::vrt_rx() const
+{
+  return d_qr->vrt_rx();
+}
+
+bool 
+vrt_quadradio_source_32fc::start()
+{
+  // throw away any stale packets before starting
+  vrt::rx_packet_handler nop;
+  vrt_rx()->rx_packets(&nop, true);
+  d_checker.resync();
+
+  return d_qr->start_streaming(d_samples_per_pkt);
+}  
+
+bool
+vrt_quadradio_source_32fc::stop()
+{
+  return d_qr->stop_streaming();
+}
+
+bool 
+vrt_quadradio_source_32fc::write_dboard_pins(int v)
+{
+  return d_qr->write_dboard_pins(v);
+}
+
+bool 
+vrt_quadradio_source_32fc::set_center_freq(double target_freq)
+{
+  return d_qr->set_center_freq(target_freq);
+}
+
+bool 
+vrt_quadradio_source_32fc::set_band_select(const std::string &band)
+{
+  return d_qr->set_band_select(band);
+}
+
+//void 
+//vrt_quadradio_source_32fc::set_10dB_atten(bool on)
+//{
+//  return d_qr->set_10dB_atten(on);
+//}
+
+bool 
+vrt_quadradio_source_32fc::select_rx_antenna(const std::string &ant)
+{
+  return d_qr->select_rx_antenna(ant);
+}
+
+bool 
+vrt_quadradio_source_32fc::set_attenuation0(int attenuation)
+{
+  return d_qr->set_attenuation0(attenuation);
+}
+
+bool 
+vrt_quadradio_source_32fc::set_attenuation1(int attenuation)
+{
+  return d_qr->set_attenuation1(attenuation);
+}
+
+void
+vrt_quadradio_source_32fc::set_adc_gain(bool on){
+  d_qr->set_adc_gain(on);
+}
+
+void
+vrt_quadradio_source_32fc::set_dc_offset_comp(bool on){
+  d_qr->set_dc_offset_comp(on);
+}
+
+void
+vrt_quadradio_source_32fc::set_digital_gain(float gain){
+  d_qr->set_digital_gain(gain);
+}
+
+void
+vrt_quadradio_source_32fc::set_test_signal(int type){
+  d_qr->set_test_signal(static_cast<vrt_test_sig_t>(type));
+}
+
+bool
+vrt_quadradio_source_32fc::set_setting_reg(int regno, int value)
+{
+  return d_qr->set_setting_reg(regno, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_hsadc_conf(int which_dboard, int regno, int 
value)
+{
+  return d_qr->set_hsadc_conf(which_dboard, regno, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_lsdac(int which_dboard, int which_dac, int 
value)
+{
+  return d_qr->set_lsdac(which_dboard, which_dac, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_mem32(int addr, int value)
+{
+  return d_qr->set_mem32(addr, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_lo_freq(double freq)
+{
+  return d_qr->set_lo_freq(freq);
+}
+
+bool
+vrt_quadradio_source_32fc::set_cal_freq(double freq)
+{
+  return d_qr->set_cal_freq(freq);
+}
+
+/*--------------------------------------------------------------------*/
+#define IQ_IMBAL_NUM_TAPS 30
+#define IQ_IMBAL_REG_NO 162
+
+//helper function to set the iq imbalance register with a tap
+static int get_iq_imbal_reg(bool real, bool init, float tap){
+  int val = int(round(tap));
+  val &= 0x1ffffff; //lower 25 bits for tap
+  val |= (real?0:1) << 30; //30th bit for filter type
+  val |= (init?1:0) << 31; //31st bit for initialization
+  printf("Reg %d Val %x\n", IQ_IMBAL_REG_NO, val);
+  return val;
+}
+
+void
+vrt_quadradio_source_32fc::set_iq_imbal_taps(const std::vector<gr_complex> 
taps){
+  int i = 0;
+  /* set the real part of the taps */
+  get_iq_imbal_reg(true, true, 0);
+  for (i = 0; i < IQ_IMBAL_NUM_TAPS; i++){
+      set_setting_reg(IQ_IMBAL_REG_NO, get_iq_imbal_reg(true, false, 
taps[IQ_IMBAL_NUM_TAPS-i-1].real()));
+  }
+  get_iq_imbal_reg(false, true, 0);
+  /* set the imaginary part of the taps */
+  for (i = 0; i < IQ_IMBAL_NUM_TAPS; i++){
+      set_setting_reg(IQ_IMBAL_REG_NO, get_iq_imbal_reg(false, false, 
taps[IQ_IMBAL_NUM_TAPS-i-1].imag()));
+  }
+}

Copied: 
gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.h 
(from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_quadradio_source_32fc.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.h 
                        (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_quadradio_source_32fc.h 
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,115 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H
+#define INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H
+
+#include <vrt_source_32fc.h>
+
+namespace vrt {
+  class quadradio;
+};
+
+class vrt_quadradio_source_32fc;
+typedef boost::shared_ptr<vrt_quadradio_source_32fc> 
vrt_quadradio_source_32fc_sptr;
+
+vrt_quadradio_source_32fc_sptr
+vrt_make_quadradio_source_32fc(const std::string &ip,
+                              size_t rx_bufsize = 0,
+                              size_t samples_per_pkt = 0);
+
+class vrt_quadradio_source_32fc : public vrt_source_32fc
+{
+  size_t                               d_samples_per_pkt;
+  boost::shared_ptr<vrt::quadradio>    d_qr;
+
+  vrt_quadradio_source_32fc(const std::string &ip, size_t rx_bufsize,
+                           size_t samples_per_pkt);
+
+  friend vrt_quadradio_source_32fc_sptr
+  vrt_make_quadradio_source_32fc(const std::string &ip, size_t rx_bufsize,
+                                size_t samples_per_pkt);
+
+public:
+  virtual ~vrt_quadradio_source_32fc();
+  virtual vrt::rx::sptr vrt_rx() const;
+
+  /*!
+   * \brief Called by scheduler when starting flowgraph
+   */
+  virtual bool start();
+  
+  /*!
+   * \brief Called by scheduler when stopping flowgraph
+   */
+  virtual bool stop();
+
+  /*!
+   * \brief write \p v to daugherboard control setting register
+   */
+  bool write_dboard_pins(int v);
+
+  /*!
+   * \brief Set the LO frequency (actually just sets the band select for now).
+   */
+  bool set_center_freq(double target_freq);
+
+  /*!
+   * \brief Set the band select dboard bits.
+   * \param band "A", "B", "C", "D"
+   */
+  bool set_band_select(const std::string &band);
+
+  /*!
+   * \brief Turn the 10 dB attenuation on/off.
+   */
+  //void set_10dB_atten(bool on);
+
+  /*!
+   * \brief Set the antenna type to the main rf or calibrator.
+   * \param ant "rf" or "cal"
+   */
+  bool select_rx_antenna(const std::string &ant);
+
+  /*!
+   * \brief Set the attenuation.
+   * \param attenuation 0 to 31 in dB
+   */
+  bool set_attenuation0(int attenuation);
+  bool set_attenuation1(int attenuation);
+
+  void set_iq_imbal_taps(const std::vector<gr_complex> taps);
+
+  void set_adc_gain(bool on);
+  void set_dc_offset_comp(bool on);
+  void set_digital_gain(float gain);
+  void set_test_signal(int type);
+
+  bool set_setting_reg(int regno, int value);
+  bool set_hsadc_conf(int which_dboard, int regno, int value);
+  bool set_lsdac(int which_dboard, int which_dac, int value);
+  bool set_mem32(int addr, int value);
+  bool set_lo_freq(double freq);
+  bool set_cal_freq(double freq);
+};
+
+
+
+#endif /* INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H */

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.cc (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_sink_16sc.cc)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.cc            
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.cc    
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_sink_16sc.h>
+#include <vrt/metadata.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_sink_16sc_sptr
+vrt_make_sink_16sc(const std::string &ifc, const std::string &mac_addr) 
+  throw (std::runtime_error)
+{
+  return gnuradio::get_initial_sptr(new vrt_sink_16sc(ifc, mac_addr));
+}
+
+vrt_sink_16sc::vrt_sink_16sc(const std::string &ifc, const std::string 
&mac_addr) 
+  throw (std::runtime_error)
+  : vrt_sink_base("vrt_sink_16sc",
+                   gr_make_io_signature(1, 1, sizeof(std::complex<int16_t>)),
+                   ifc, mac_addr)
+{
+  // NOP
+}
+
+vrt_sink_16sc::~vrt_sink_16sc()
+{
+  // NOP
+}
+
+int
+vrt_sink_16sc::work(int noutput_items,
+                     gr_vector_const_void_star &input_items,
+                     gr_vector_void_star &output_items)
+{
+  std::complex<int16_t> *in = (std::complex<int16_t> *)input_items[0];
+
+  vrt::tx_metadata metadata;
+  metadata.timestamp = -1;
+  metadata.send_now = 1;
+  metadata.start_of_burst = 1;
+
+  bool ok = d_u2->tx_16sc(0,  // FIXME: someday, streams will have channel 
numbers
+                         in, noutput_items, &metadata);
+  if (!ok){
+    std::cerr << "vrt_sink_16sc: tx_16sc failed" << std::endl;
+    return -1; // say we're done
+  }
+
+  return noutput_items;
+}

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.h (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_sink_16sc.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.h             
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_16sc.h     
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef INCLUDED_USRP2_SINK_16SC_H
+#define INCLUDED_USRP2_SINK_16SC_H
+
+#include <vrt_sink_base.h>
+
+class vrt_sink_16sc;
+typedef boost::shared_ptr<vrt_sink_16sc> vrt_sink_16sc_sptr;
+
+vrt_sink_16sc_sptr
+vrt_make_sink_16sc(const std::string &ifc="eth0",
+                    const std::string &mac="")
+  throw (std::runtime_error);
+
+class vrt_sink_16sc : public vrt_sink_base 
+{
+private:
+  friend vrt_sink_16sc_sptr
+  vrt_make_sink_16sc(const std::string &ifc,
+                      const std::string &mac) 
+    throw (std::runtime_error);
+  
+protected:
+  vrt_sink_16sc(const std::string &ifc, const std::string &mac) 
+    throw (std::runtime_error);
+
+public:
+  ~vrt_sink_16sc();
+
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_USRP2_SINK_16SC_H */

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.cc (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_sink_32fc.cc)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.cc            
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.cc    
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,73 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_sink_32fc.h>
+#include <vrt/metadata.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_sink_32fc_sptr
+vrt_make_sink_32fc(const std::string &ifc, const std::string &mac_addr) 
+  throw (std::runtime_error)
+{
+  return gnuradio::get_initial_sptr(new vrt_sink_32fc(ifc, mac_addr));
+}
+
+vrt_sink_32fc::vrt_sink_32fc(const std::string &ifc, const std::string 
&mac_addr) 
+  throw (std::runtime_error)
+  : vrt_sink_base("vrt_sink_32fc",
+                   gr_make_io_signature(1, 1, sizeof(gr_complex)),
+                   ifc, mac_addr)
+{
+  // NOP
+}
+
+vrt_sink_32fc::~vrt_sink_32fc()
+{
+  // NOP
+}
+
+int
+vrt_sink_32fc::work(int noutput_items,
+                     gr_vector_const_void_star &input_items,
+                     gr_vector_void_star &output_items)
+{
+  gr_complex *in = (gr_complex *)input_items[0];
+
+  vrt::tx_metadata metadata;
+  metadata.timestamp = -1;
+  metadata.send_now = 1;
+  metadata.start_of_burst = 1;
+
+  bool ok = d_u2->tx_32fc(0, // FIXME: someday, streams will have channel 
numbers
+                         in, noutput_items, &metadata);
+  if (!ok){
+    std::cerr << "vrt_sink_32fc: tx_32fc failed" << std::endl;
+    return -1; // say we're done
+  }
+
+  return noutput_items;
+}

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.h (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_sink_32fc.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.h             
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_32fc.h     
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef INCLUDED_USRP2_SINK_32FC_H
+#define INCLUDED_USRP2_SINK_32FC_H
+
+#include <vrt_sink_base.h>
+
+class vrt_sink_32fc;
+typedef boost::shared_ptr<vrt_sink_32fc> vrt_sink_32fc_sptr;
+
+vrt_sink_32fc_sptr
+vrt_make_sink_32fc(const std::string &ifc="eth0",
+                    const std::string &mac="")
+  throw (std::runtime_error);
+
+class vrt_sink_32fc : public vrt_sink_base 
+{
+private:
+  friend vrt_sink_32fc_sptr
+  vrt_make_sink_32fc(const std::string &ifc,
+                      const std::string &mac) 
+    throw (std::runtime_error);
+  
+protected:
+  vrt_sink_32fc(const std::string &ifc, const std::string &mac) 
+    throw (std::runtime_error);
+
+public:
+  ~vrt_sink_32fc();
+
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_USRP2_SINK_32FC_H */

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.cc (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_sink_base.cc)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.cc            
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.cc    
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,151 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_sink_base.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_sink_base::vrt_sink_base(const char *name,
+                                gr_io_signature_sptr input_signature,
+                                const std::string &ifc,
+                                const std::string &mac) 
+  throw (std::runtime_error)
+  : vrt_base(name,
+               input_signature,
+              gr_make_io_signature(0, 0, 0),
+              ifc, mac)
+{
+  // NOP
+}
+
+vrt_sink_base::~vrt_sink_base ()
+{
+  // NOP
+}
+
+bool
+vrt_sink_base::set_gain(double gain)
+{
+  return d_u2->set_tx_gain(gain);
+}
+
+bool
+vrt_sink_base::set_lo_offset(double frequency)
+{
+  return d_u2->set_tx_lo_offset(frequency);
+}
+
+bool
+vrt_sink_base::set_center_freq(double frequency, vrt::tune_result *tr)
+{
+  return d_u2->set_tx_center_freq(frequency, tr);
+}
+
+bool
+vrt_sink_base::set_interp(int interp_factor)
+{
+  return d_u2->set_tx_interp(interp_factor);
+}
+
+void
+vrt_sink_base::default_scale_iq(int interp_factor, int *scale_i, int *scale_q)
+{
+  return d_u2->default_tx_scale_iq(interp_factor, scale_i, scale_q);
+}
+
+bool 
+vrt_sink_base::set_scale_iq(int scale_i, int scale_q)
+{
+  return d_u2->set_tx_scale_iq(scale_i, scale_q);
+}
+
+int
+vrt_sink_base::interp()
+{
+  return d_u2->tx_interp();
+}
+
+bool
+vrt_sink_base::dac_rate(long *rate)
+{
+  return d_u2->dac_rate(rate);
+}
+
+double
+vrt_sink_base::gain_min()
+{
+  return d_u2->tx_gain_min();
+}
+
+double
+vrt_sink_base::gain_max()
+{
+  return d_u2->tx_gain_max();
+}
+
+double
+vrt_sink_base::gain_db_per_step()
+{
+  return d_u2->tx_gain_db_per_step();
+}
+  
+double
+vrt_sink_base::freq_min()
+{
+  return d_u2->tx_freq_min();
+}
+
+double
+vrt_sink_base::freq_max()
+{
+  return d_u2->tx_freq_max();
+}
+
+bool
+vrt_sink_base::daughterboard_id(int *dbid)
+{
+  return d_u2->tx_daughterboard_id(dbid);
+}
+
+bool vrt_sink_base::set_gpio_ddr(uint16_t value, uint16_t mask)
+{
+  return d_u2->set_gpio_ddr(vrt::GPIO_TX_BANK, value, mask);
+}
+
+bool vrt_sink_base::set_gpio_sels(std::string sels)
+{
+  return d_u2->set_gpio_sels(vrt::GPIO_TX_BANK, sels);
+}
+
+bool vrt_sink_base::write_gpio(uint16_t value, uint16_t mask)
+{
+  return d_u2->write_gpio(vrt::GPIO_TX_BANK, value, mask);
+}
+
+bool vrt_sink_base::read_gpio(uint16_t *value)
+{
+  return d_u2->read_gpio(vrt::GPIO_TX_BANK, value);
+}

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.h (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_sink_base.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.h             
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_sink_base.h     
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef INCLUDED_USRP2_SINK_BASE_H
+#define INCLUDED_USRP2_SINK_BASE_H
+
+#include <vrt_base.h>
+
+/*!
+ * Base class for all USRP2 transmit blocks
+ */
+class vrt_sink_base : public vrt_base 
+{
+protected:
+  vrt_sink_base(const char *name,
+                 gr_io_signature_sptr input_signature,
+                 const std::string &ifc,
+                 const std::string &mac)
+    throw (std::runtime_error);
+
+public:
+  ~vrt_sink_base();
+
+  /*!
+   * \brief Set transmitter gain
+   */
+  bool set_gain(double gain);
+
+  /*!
+   * \brief Set transmitter LO offset frequency
+   */
+  bool set_lo_offset(double frequency);
+
+  /*!
+   * \brief Set transmitter center frequency
+   */
+  bool set_center_freq(double frequency, vrt::tune_result *tr);
+   
+  /*!
+   * \brief Set transmit interpolation rate
+   */
+  bool set_interp(int interp_factor);
+
+  /*!
+   * \brief Calculate default scale_iq for given interpolation factor
+   */
+  void default_scale_iq(int interpolation_factor, int *scale_i, int *scale_q);
+
+  /*!
+   * \brief Set transmit IQ scale factors
+   */
+  bool set_scale_iq(int scale_i, int scale_q);
+
+  /*!
+   * \brief Get transmit interpolation rate
+   */
+  int interp();
+
+  /*!
+   * \brief Get DAC sample rate in Hz 
+   */
+  bool dac_rate(long *rate);
+
+  /*!
+   * \brief Returns minimum Tx gain 
+   */
+  double gain_min();
+
+  /*!
+   * \brief Returns maximum Tx gain 
+   */
+  double gain_max();
+  
+  /*!
+   * \brief Returns Tx gain db_per_step
+   */
+  double gain_db_per_step();
+
+  /*!
+   * \brief Returns minimum Tx center frequency
+   */
+  double freq_min();
+
+  /*!
+   * \brief Returns maximum Tx center frequency
+   */
+  double freq_max();
+
+  /*!
+   * \brief Get Tx daughterboard ID
+   *
+   * \param[out] dbid returns the daughterboard id.
+   *
+   * daughterboard id >= 0 if successful, -1 if no daugherboard installed,
+   * -2 if invalid EEPROM on daughterboard.
+   */
+  bool daughterboard_id(int *dbid);
+
+  /*!
+   * \brief Set daughterboard GPIO data direction register.
+   */
+  bool set_gpio_ddr(uint16_t value, uint16_t mask);
+
+  /*!
+   * \brief Set daughterboard GPIO output selection register.
+   */
+  bool set_gpio_sels(std::string sels);
+
+  /*!
+   * \brief Set daughterboard GPIO pin values.
+   */
+  bool write_gpio(uint16_t value, uint16_t mask);
+
+  /*!
+   * \brief Read daughterboard GPIO pin values
+   */
+  bool read_gpio(uint16_t *value);
+};
+
+#endif /* INCLUDED_USRP2_SINK_BASE_H */

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.cc 
(from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_16sc.cc)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.cc          
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.cc  
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_source_16sc.h>
+#include <rx_16sc_handler.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_source_16sc_sptr
+vrt_make_source_16sc(const std::string &ifc, const std::string &mac_addr) 
+  throw (std::runtime_error)
+{
+  return gnuradio::get_initial_sptr(new vrt_source_16sc(ifc, mac_addr));
+}
+
+vrt_source_16sc::vrt_source_16sc(const std::string &ifc, const std::string 
&mac_addr) 
+  throw (std::runtime_error)
+  : vrt_source_base("vrt_source_16sc",
+                     gr_make_io_signature(1, 1, sizeof(std::complex<int16_t>)),
+                     ifc, mac_addr)
+{
+  set_output_multiple(USRP2_MIN_RX_SAMPLES);
+}
+
+vrt_source_16sc::~vrt_source_16sc()
+{
+  // NOP
+}
+
+int
+vrt_source_16sc::work(int noutput_items,
+                       gr_vector_const_void_star &input_items,
+                       gr_vector_void_star &output_items)
+{
+  std::complex<int16_t> *out = (std::complex<int16_t> *)output_items[0];
+
+  rx_16sc_handler::sptr handler = rx_16sc_handler::make(noutput_items, 
USRP2_MIN_RX_SAMPLES, out);
+
+  bool ok = d_u2->rx_samples(0, handler.get()); // FIXME: channel number 
instead of 0
+  if (!ok){
+    std::cerr << "vrt::rx_samples() failed" << std::endl;
+    return -1; // say we're done
+  }
+
+  return handler->nsamples();
+}

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.h (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_16sc.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.h           
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_16sc.h   
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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.
+ */
+
+#ifndef INCLUDED_USRP2_SOURCE_16SC_H
+#define INCLUDED_USRP2_SOURCE_16SC_H
+
+#include <vrt_source_base.h>
+
+class vrt_source_16sc;
+typedef boost::shared_ptr<vrt_source_16sc> vrt_source_16sc_sptr;
+
+vrt_source_16sc_sptr
+vrt_make_source_16sc(const std::string &ifc="eth0",
+                      const std::string &mac="")
+  throw (std::runtime_error);
+
+class vrt_source_16sc : public vrt_source_base
+{
+private:
+  friend vrt_source_16sc_sptr
+  vrt_make_source_16sc(const std::string &ifc,
+                        const std::string &mac) throw (std::runtime_error);
+  
+protected:
+  vrt_source_16sc(const std::string &ifc, const std::string &mac) throw 
(std::runtime_error);
+
+public:
+  ~vrt_source_16sc();
+
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_USRP2_SOURCE_16SC_H */

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.cc 
(from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_32fc.cc)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.cc          
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.cc  
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,144 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <vrt_source_32fc.h>
+#include <vrt/expanded_header.h>
+#include <vrt/copiers.h>
+#include <gr_io_signature.h>
+#include <missing_pkt_checker.h>
+#include <iostream>
+
+#define VERBOSE 1              // define to 0 or 1
+
+
+class rx_32fc_handler : public vrt::rx_packet_handler
+{
+  int                                d_noutput_items;
+  std::complex<float>               *d_out;
+  int                               *d_oo;             // output index
+  std::vector< std::complex<float> > &d_remainder;
+  missing_pkt_checker               &d_checker;
+  
+
+public:
+
+  rx_32fc_handler(int noutput_items, std::complex<float> *out,
+                 int *oo, std::vector< std::complex<float> > &remainder,
+                 missing_pkt_checker &checker)
+    : d_noutput_items(noutput_items), d_out(out),
+      d_oo(oo), d_remainder(remainder), d_checker(checker) {}
+
+  ~rx_32fc_handler();
+
+  bool operator()(const uint32_t *payload,
+                 size_t n32_bit_words,
+                 const vrt::expanded_header *hdr);
+};
+
+rx_32fc_handler::~rx_32fc_handler()
+{
+}
+
+bool
+rx_32fc_handler::operator()(const uint32_t *payload,
+                           size_t n32_bit_words,
+                           const vrt::expanded_header *hdr)
+{
+  int nmissing = d_checker.check(hdr);
+  if (VERBOSE && nmissing != 0){
+    std::cerr << "S" << nmissing;
+  }
+
+  // copy as many as will fit into the output buffer.
+
+  size_t n = std::min(n32_bit_words, (size_t)(d_noutput_items - *d_oo));
+  vrt::copy_net_16sc_to_host_32fc(n, payload, &d_out[*d_oo]);
+  *d_oo += n;
+
+  // if there are any left over, copy them into remainder and tell
+  // our caller we're had enough for now.
+
+  size_t r = n32_bit_words - n;
+  if (r > 0){
+    assert(d_remainder.size() == 0);
+    d_remainder.resize(r);
+    vrt::copy_net_16sc_to_host_32fc(r, &payload[n], &d_remainder[0]);
+    return false;              // Stop calling us.
+  }
+
+  return true;                 // Keep calling us, we've got more room
+}
+
+
+// ------------------------------------------------------------------------
+
+vrt_source_32fc::vrt_source_32fc(const char *name)
+
+  : vrt_source_base(name,
+                   gr_make_io_signature(1, 1, sizeof(gr_complex)))
+{
+}
+
+vrt_source_32fc::~vrt_source_32fc()
+{
+  if (VERBOSE){
+    std::cerr << "\nvrt_source_32fc: npackets = " << d_checker.npackets()
+             << " nwrong_pkt_cnt = " << d_checker.nwrong_pkt_cnt()
+             << " nmissing_pkt_est = " << d_checker.nmissing_pkt_est()
+             << std::endl;
+  }
+}
+
+int
+vrt_source_32fc::work(int noutput_items,
+                     gr_vector_const_void_star &input_items,
+                     gr_vector_void_star &output_items)
+{
+  gr_complex *out = (gr_complex *)output_items[0];
+  int  oo = 0;
+
+  // Handle any samples left over from the last call.
+  int t = std::min(noutput_items, (int)d_remainder.size());
+  if (t != 0){
+    for (int i = 0; i < t; i++)
+      out[i] = d_remainder[i];
+    d_remainder.erase(d_remainder.begin(), d_remainder.begin()+t);
+    oo = t;
+  }
+  if (noutput_items - oo == 0)
+    return oo;
+  
+  // While we've got room, and there are packets, handle them
+  rx_32fc_handler h(noutput_items, out, &oo, d_remainder, d_checker);
+  bool ok = vrt_rx()->rx_packets(&h);
+
+  if (!ok){
+    std::cerr << "vrt_source_32fc: vrt::rx_packets() failed" << std::endl;
+    return -1; // say we're done
+  }
+
+  return oo;
+}

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.h (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_32fc.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.h           
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_32fc.h   
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,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.
+ */
+
+#ifndef INCLUDED_VRT_SOURCE_32FC_H
+#define INCLUDED_VRT_SOURCE_32FC_H
+
+#include <vrt_source_base.h>
+#include <missing_pkt_checker.h>
+
+class vrt_source_32fc : public vrt_source_base
+{
+protected:
+  vrt_source_32fc(const char *name);
+
+  std::vector< std::complex<float> >   d_remainder;
+  missing_pkt_checker                  d_checker;
+
+public:
+  ~vrt_source_32fc();
+
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_VRT_SOURCE_32FC_H */

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.cc 
(from rev 11518, 
gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.cc)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.cc          
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.cc  
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_source_base.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_source_base::vrt_source_base(const char *name,
+                                gr_io_signature_sptr output_signature)
+  : gr_sync_block(name,
+                 gr_make_io_signature(0, 0, 0),
+                 output_signature)
+{
+}
+
+vrt_source_base::~vrt_source_base()
+{
+}

Copied: gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.h (from 
rev 11518, gnuradio/branches/developers/eb/vrt/gr-vrt/src/vrt_source_base.h)
===================================================================
--- gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.h           
                (rev 0)
+++ gnuradio/branches/developers/eb/vrt2/gr-vrt/src/vrt_source_base.h   
2009-07-30 22:57:57 UTC (rev 11520)
@@ -0,0 +1,45 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,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.
+ */
+
+#ifndef INCLUDED_VRT_SOURCE_BASE_H
+#define INCLUDED_VRT_SOURCE_BASE_H
+
+#include <gr_sync_block.h>
+#include <vrt/rx.h>
+#include <gr_io_signature.h>
+
+/*!
+ * Base class for all VRT source blocks
+ */
+class vrt_source_base : public gr_sync_block
+{
+protected:
+  vrt_source_base(const char *name,
+                 gr_io_signature_sptr output_signature);
+
+public:
+  ~vrt_source_base();
+
+  virtual vrt::rx::sptr vrt_rx() const = 0;
+};
+
+#endif /* INCLUDED_VRT_SOURCE_BASE_H */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]