commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10344 - in gnuradio/trunk/grc: data/platforms/python/


From: jblum
Subject: [Commit-gnuradio] r10344 - in gnuradio/trunk/grc: data/platforms/python/blocks src/grc_gnuradio/usrp
Date: Fri, 30 Jan 2009 12:30:07 -0700 (MST)

Author: jblum
Date: 2009-01-30 12:30:03 -0700 (Fri, 30 Jan 2009)
New Revision: 10344

Modified:
   gnuradio/trunk/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml
   gnuradio/trunk/grc/data/platforms/python/blocks/usrp_dual_source_x.xml
   gnuradio/trunk/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml
   gnuradio/trunk/grc/data/platforms/python/blocks/usrp_simple_source_x.xml
   gnuradio/trunk/grc/src/grc_gnuradio/usrp/common.py
   gnuradio/trunk/grc/src/grc_gnuradio/usrp/dual_usrp.py
   gnuradio/trunk/grc/src/grc_gnuradio/usrp/simple_usrp.py
Log:
grc usrp supports 8 bits

Modified: gnuradio/trunk/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml        
2009-01-30 14:06:18 UTC (rev 10343)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml        
2009-01-30 19:30:03 UTC (rev 10344)
@@ -9,6 +9,9 @@
        <key>usrp_dual_sink_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
        <make>grc_usrp.dual_sink_$(type.fcn)(number=$number)
+#if $format.eval
+self.$(id).set_format(width=$format.width, shift=$format.shift)
+#end if
 self.$(id).set_interp_rate($interpolation)
 self.$(id).set_frequency_a($frequency_a, verbose=True)
 self.$(id).set_frequency_b($frequency_b, verbose=True)
@@ -45,14 +48,35 @@
                        <name>Complex</name>
                        <key>complex</key>
                        <opt>fcn:c</opt>
+                       <opt>bits8:</opt>
                </option>
                <option>
                        <name>Short</name>
                        <key>short</key>
                        <opt>fcn:s</opt>
+                       <opt>bits8:</opt>
                </option>
        </param>
        <param>
+               <name>Format</name>
+               <key>format</key>
+               <value></value>
+               <type>enum</type>
+               <hide>#if $format.eval then '' else 'part'#</hide>
+               <option>
+                       <name>16 Bits (Default)</name>
+                       <key></key>
+                       <opt>width:16</opt>
+                       <opt>shift:0</opt>
+               </option>
+               <option>
+                       <name>8 Bits, Shift 8</name>
+                       <key>w8_s8</key>
+                       <opt>width:8</opt>
+                       <opt>shift:8</opt>
+               </option>
+       </param>
+       <param>
                <name>Unit Number</name>
                <key>number</key>
                <value>0</value>

Modified: gnuradio/trunk/grc/data/platforms/python/blocks/usrp_dual_source_x.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/usrp_dual_source_x.xml      
2009-01-30 14:06:18 UTC (rev 10343)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/usrp_dual_source_x.xml      
2009-01-30 19:30:03 UTC (rev 10344)
@@ -9,6 +9,9 @@
        <key>usrp_dual_source_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
        <make>grc_usrp.dual_source_$(type.fcn)(number=$number, 
side_a='$rx_ant_a.side', rx_ant_a='$rx_ant_a.rx_ant', side_b='$rx_ant_b.side', 
rx_ant_b='$rx_ant_b.rx_ant')
+#if $format.eval
+self.$(id).set_format(width=$format.width, shift=$format.shift)
+#end if
 self.$(id).set_decim_rate($decimation)
 self.$(id).set_frequency_a($frequency_a, verbose=True)
 self.$(id).set_frequency_b($frequency_b, verbose=True)
@@ -47,6 +50,25 @@
                </option>
        </param>
        <param>
+               <name>Format</name>
+               <key>format</key>
+               <value></value>
+               <type>enum</type>
+               <hide>#if $format.eval then '' else 'part'#</hide>
+               <option>
+                       <name>16 Bits (Default)</name>
+                       <key></key>
+                       <opt>width:16</opt>
+                       <opt>shift:0</opt>
+               </option>
+               <option>
+                       <name>8 Bits, Shift 8</name>
+                       <key>w8_s8</key>
+                       <opt>width:8</opt>
+                       <opt>shift:8</opt>
+               </option>
+       </param>
+       <param>
                <name>Unit Number</name>
                <key>number</key>
                <value>0</value>

Modified: gnuradio/trunk/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml      
2009-01-30 14:06:18 UTC (rev 10343)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml      
2009-01-30 19:30:03 UTC (rev 10344)
@@ -9,6 +9,9 @@
        <key>usrp_simple_sink_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
        <make>grc_usrp.simple_sink_$(type.fcn)(number=$number, side='$side')
+#if $format.eval
+self.$(id).set_format(width=$format.width, shift=$format.shift)
+#end if
 self.$(id).set_interp_rate($interpolation)
 self.$(id).set_frequency($frequency, verbose=True)
 self.$(id).set_gain($gain)
@@ -37,6 +40,25 @@
                </option>
        </param>
        <param>
+               <name>Format</name>
+               <key>format</key>
+               <value></value>
+               <type>enum</type>
+               <hide>#if $format.eval then '' else 'part'#</hide>
+               <option>
+                       <name>16 Bits (Default)</name>
+                       <key></key>
+                       <opt>width:16</opt>
+                       <opt>shift:0</opt>
+               </option>
+               <option>
+                       <name>8 Bits, Shift 8</name>
+                       <key>w8_s8</key>
+                       <opt>width:8</opt>
+                       <opt>shift:8</opt>
+               </option>
+       </param>
+       <param>
                <name>Unit Number</name>
                <key>number</key>
                <value>0</value>

Modified: 
gnuradio/trunk/grc/data/platforms/python/blocks/usrp_simple_source_x.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/usrp_simple_source_x.xml    
2009-01-30 14:06:18 UTC (rev 10343)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/usrp_simple_source_x.xml    
2009-01-30 19:30:03 UTC (rev 10344)
@@ -9,6 +9,9 @@
        <key>usrp_simple_source_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
        <make>grc_usrp.simple_source_$(type.fcn)(number=$number, side='$side', 
rx_ant='$rx_ant')
+#if $format.eval
+self.$(id).set_format(width=$format.width, shift=$format.shift)
+#end if
 self.$(id).set_decim_rate($decimation)
 self.$(id).set_frequency($frequency, verbose=True)
 self.$(id).set_gain($gain)
@@ -34,6 +37,25 @@
                </option>
        </param>
        <param>
+               <name>Format</name>
+               <key>format</key>
+               <value></value>
+               <type>enum</type>
+               <hide>#if $format.eval then '' else 'part'#</hide>
+               <option>
+                       <name>16 Bits (Default)</name>
+                       <key></key>
+                       <opt>width:16</opt>
+                       <opt>shift:0</opt>
+               </option>
+               <option>
+                       <name>8 Bits, Shift 8</name>
+                       <key>w8_s8</key>
+                       <opt>width:8</opt>
+                       <opt>shift:8</opt>
+               </option>
+       </param>
+       <param>
                <name>Unit Number</name>
                <key>number</key>
                <value>0</value>

Modified: gnuradio/trunk/grc/src/grc_gnuradio/usrp/common.py
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/usrp/common.py  2009-01-30 14:06:18 UTC 
(rev 10343)
+++ gnuradio/trunk/grc/src/grc_gnuradio/usrp/common.py  2009-01-30 19:30:03 UTC 
(rev 10344)
@@ -22,39 +22,40 @@
 from gnuradio import usrp, gr
 
 ##################################################
-# Set frequency function w/ verbose option
+# USRP base class with common methods
 ##################################################
-def set_frequency(u, which, subdev, frequency, verbose=False):
-       """
-       Set the carrier frequency for the given subdevice.
-       @param u the usrp source/sink
-       @param which specifies the DDC/DUC number
-       @param frequency the carrier frequency in Hz
-       @param verbose if true, print usrp tuning information
-       """
-       r = u.tune(which, subdev, frequency)
-       if not verbose: return
-       print subdev.side_and_name()
-       if r:
-               print "\tr.baseband_frequency =", r.baseband_freq
-               print "\tr.dxc_frequency =", r.dxc_freq
-               print "\tr.residual_frequency =", r.residual_freq
-               print "\tr.inverted =", r.inverted, "\n"
-       else: print >> sys.stderr, 'Error calling tune on subdevice.'
+class usrp_helper(object):
+       def _make_usrp(self, *args, **kwargs): self._u = 
self._usrp_args[0](*args, **kwargs)
+       def _get_u(self): return self._u
+       def _get_io_size(self): return self._usrp_args[1]
+       def _set_frequency(self, which, subdev, frequency, verbose=False):
+               """
+               Set the carrier frequency for the given subdevice.
+               @param which specifies the DDC/DUC number
+               @param frequency the carrier frequency in Hz
+               @param verbose if true, print usrp tuning information
+               """
+               r = self._get_u().tune(which, subdev, frequency)
+               if not verbose: return
+               print subdev.side_and_name()
+               if r:
+                       print "\tr.baseband_frequency =", r.baseband_freq
+                       print "\tr.dxc_frequency =", r.dxc_freq
+                       print "\tr.residual_frequency =", r.residual_freq
+                       print "\tr.inverted =", r.inverted, "\n"
+               else: print >> sys.stderr, 'Error calling tune on subdevice.'
+       def set_format(self, width, shift): 
self._get_u().set_format(self._get_u().make_format(width, shift))
 
 ##################################################
 # Classes to associate usrp constructor w/ io size
 ##################################################
-class usrp_helper(object):
-       def _get_usrp_constructor(self): return self._usrp_args[0]
-       def _get_io_size(self): return self._usrp_args[1]
 class usrp_source_c(usrp_helper): _usrp_args = (usrp.source_c, 
gr.sizeof_gr_complex)
 class usrp_source_s(usrp_helper): _usrp_args = (usrp.source_s, gr.sizeof_short)
 class usrp_sink_c(usrp_helper): _usrp_args = (usrp.sink_c, 
gr.sizeof_gr_complex)
 class usrp_sink_s(usrp_helper): _usrp_args = (usrp.sink_s, gr.sizeof_short)
 
 ##################################################
-# RX antenna definitions and helpers
+# Side spec and antenna spec functions
 ##################################################
 def is_flex(rx_ant): return rx_ant.upper() in ('TX/RX', 'RX2')
 def to_spec(side, rx_ant='RXA'):

Modified: gnuradio/trunk/grc/src/grc_gnuradio/usrp/dual_usrp.py
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/usrp/dual_usrp.py       2009-01-30 
14:06:18 UTC (rev 10343)
+++ gnuradio/trunk/grc/src/grc_gnuradio/usrp/dual_usrp.py       2009-01-30 
19:30:03 UTC (rev 10344)
@@ -43,34 +43,32 @@
                        gr.io_signature(2, 2, self._get_io_size()),
                )
                #create usrp object
-               self._u = self._get_usrp_constructor()(number, nchan=2)
+               self._make_usrp(number, nchan=2)
                #get the mux for output A
                subdev_spec_a = common.to_spec(side_a, rx_ant_a)
-               self._subdev_a = usrp.selected_subdev(self._u, subdev_spec_a)
-               mux_a = usrp.determine_rx_mux_value(self._u, subdev_spec_a)
+               self._subdev_a = usrp.selected_subdev(self._get_u(), 
subdev_spec_a)
+               mux_a = usrp.determine_rx_mux_value(self._get_u(), 
subdev_spec_a)
                #get the mux for output B
                subdev_spec_b = common.to_spec(side_b, rx_ant_b)
-               self._subdev_b = usrp.selected_subdev(self._u, subdev_spec_b)
-               mux_b = usrp.determine_rx_mux_value(self._u, subdev_spec_b)
+               self._subdev_b = usrp.selected_subdev(self._get_u(), 
subdev_spec_b)
+               mux_b = usrp.determine_rx_mux_value(self._get_u(), 
subdev_spec_b)
                #move the lower byte of the mux b into the second byte of the 
mux a
-               self._u.set_mux(((mux_b & 0xff) << 8) | (mux_a - (mux_a & 
0xff00)))
+               self._get_u().set_mux(((mux_b & 0xff) << 8) | (mux_a - (mux_a & 
0xff00)))
                #connect
                deinter = gr.deinterleave(self._get_io_size())
-               self.connect(self._u, deinter)
+               self.connect(self._get_u(), deinter)
                for i in range(2): self.connect((deinter, i), (self, i))
 
-       def set_decim_rate(self, decim): self._u.set_decim_rate(int(decim))
+       def set_decim_rate(self, decim): 
self._get_u().set_decim_rate(int(decim))
        def set_frequency_a(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=0, #ddc0
                        subdev=self._subdev_a,
                        frequency=frequency,
                        verbose=verbose,
                )
        def set_frequency_b(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=1, #ddc1
                        subdev=self._subdev_b,
                        frequency=frequency,
@@ -102,34 +100,32 @@
                        gr.io_signature(0, 0, 0),
                )
                #create usrp object
-               self._u = self._get_usrp_constructor()(number, nchan=2)
+               self._make_usrp(number, nchan=2)
                #get the mux for side A
                subdev_spec_a = common.to_spec('A')
-               self._subdev_a = usrp.selected_subdev(self._u, subdev_spec_a)
-               mux_a = usrp.determine_tx_mux_value(self._u, subdev_spec_a)
+               self._subdev_a = usrp.selected_subdev(self._get_u(), 
subdev_spec_a)
+               mux_a = usrp.determine_tx_mux_value(self._get_u(), 
subdev_spec_a)
                #get the mux for side B
                subdev_spec_b = common.to_spec('B')
-               self._subdev_b = usrp.selected_subdev(self._u, subdev_spec_b)
-               mux_b = usrp.determine_tx_mux_value(self._u, subdev_spec_b)
+               self._subdev_b = usrp.selected_subdev(self._get_u(), 
subdev_spec_b)
+               mux_b = usrp.determine_tx_mux_value(self._get_u(), 
subdev_spec_b)
                #set the mux
-               self._u.set_mux(mux_a | mux_b)
+               self._get_u().set_mux(mux_a | mux_b)
                #connect
                inter = gr.interleave(self._get_io_size())
-               self.connect(inter, self._u)
+               self.connect(inter, self._get_u())
                for i in range(2): self.connect((self, i), (inter, i))
 
-       def set_interp_rate(self, interp): self._u.set_interp_rate(int(interp))
+       def set_interp_rate(self, interp): 
self._get_u().set_interp_rate(int(interp))
        def set_frequency_a(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=self._subdev_a.which(),
                        subdev=self._subdev_a,
                        frequency=frequency,
                        verbose=verbose,
                )
        def set_frequency_b(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=self._subdev_b.which(),
                        subdev=self._subdev_b,
                        frequency=frequency,

Modified: gnuradio/trunk/grc/src/grc_gnuradio/usrp/simple_usrp.py
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/usrp/simple_usrp.py     2009-01-30 
14:06:18 UTC (rev 10343)
+++ gnuradio/trunk/grc/src/grc_gnuradio/usrp/simple_usrp.py     2009-01-30 
19:30:03 UTC (rev 10344)
@@ -41,18 +41,17 @@
                        gr.io_signature(1, 1, self._get_io_size()),
                )
                #create usrp object
-               self._u = self._get_usrp_constructor()(number, nchan=1)
+               self._make_usrp(number, nchan=1)
                subdev_spec = common.to_spec(side, rx_ant)
-               self._u.set_mux(usrp.determine_rx_mux_value(self._u, 
subdev_spec))
-               self._subdev = usrp.selected_subdev(self._u, subdev_spec)
+               
self._get_u().set_mux(usrp.determine_rx_mux_value(self._get_u(), subdev_spec))
+               self._subdev = usrp.selected_subdev(self._get_u(), subdev_spec)
                if common.is_flex(rx_ant): 
self._subdev.select_rx_antenna(rx_ant)
                #connect
-               self.connect(self._u, self)
+               self.connect(self._get_u(), self)
 
-       def set_decim_rate(self, decim): self._u.set_decim_rate(int(decim))
+       def set_decim_rate(self, decim): 
self._get_u().set_decim_rate(int(decim))
        def set_frequency(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=0, #ddc0
                        subdev=self._subdev,
                        frequency=frequency,
@@ -83,17 +82,16 @@
                        gr.io_signature(0, 0, 0),
                )
                #create usrp object
-               self._u = self._get_usrp_constructor()(number, nchan=1)
+               self._make_usrp(number, nchan=1)
                subdev_spec = common.to_spec(side)
-               self._u.set_mux(usrp.determine_tx_mux_value(self._u, 
subdev_spec))
-               self._subdev = usrp.selected_subdev(self._u, subdev_spec)
+               
self._get_u().set_mux(usrp.determine_tx_mux_value(self._get_u(), subdev_spec))
+               self._subdev = usrp.selected_subdev(self._get_u(), subdev_spec)
                #connect
-               self.connect(self, self._u)
+               self.connect(self, self._get_u())
 
-       def set_interp_rate(self, interp): self._u.set_interp_rate(int(interp))
+       def set_interp_rate(self, interp): 
self._get_u().set_interp_rate(int(interp))
        def set_frequency(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=self._subdev.which(),
                        subdev=self._subdev,
                        frequency=frequency,





reply via email to

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