commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6287 - in gnuradio/trunk: gnuradio-examples/python/di


From: jcorgan
Subject: [Commit-gnuradio] r6287 - in gnuradio/trunk: gnuradio-examples/python/digital gnuradio-examples/python/usrp gnuradio-examples/python/usrp/limbo gr-utils/src/python
Date: Tue, 4 Sep 2007 07:21:25 -0600 (MDT)

Author: jcorgan
Date: 2007-09-04 07:21:24 -0600 (Tue, 04 Sep 2007)
New Revision: 6287

Added:
   gnuradio/trunk/gnuradio-examples/python/usrp/usrp_benchmark_usb.py
   gnuradio/trunk/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py
   gnuradio/trunk/gr-utils/src/python/usrp_test_loopback.py
Removed:
   gnuradio/trunk/gnuradio-examples/python/digital/limbo/
   gnuradio/trunk/gnuradio-examples/python/usrp/limbo/tvrx_am_rcv_gui.py
   gnuradio/trunk/gnuradio-examples/python/usrp/limbo/usrp_fft_old.py
   gnuradio/trunk/gnuradio-examples/python/usrp/wfm_rcv_file.py
   gnuradio/trunk/gr-utils/src/python/usrp_benchmark_usb.py
   gnuradio/trunk/gr-utils/src/python/usrp_test_loop.py
   gnuradio/trunk/gr-utils/src/python/usrp_test_loop_lfsr.py
Modified:
   gnuradio/trunk/gnuradio-examples/python/usrp/Makefile.am
   gnuradio/trunk/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
   gnuradio/trunk/gr-utils/src/python/Makefile.am
Log:
Cleanup on gnuradio-examples restructuring.

Modified: gnuradio/trunk/gnuradio-examples/python/usrp/Makefile.am
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/usrp/Makefile.am    2007-09-04 
05:01:26 UTC (rev 6286)
+++ gnuradio/trunk/gnuradio-examples/python/usrp/Makefile.am    2007-09-04 
13:21:24 UTC (rev 6287)
@@ -25,9 +25,11 @@
        fm_tx_2_daughterboards.py               \
        fm_tx4.py                               \
        max_power.py                            \
+       usrp_benchmark_usb.py                   \
        usrp_nbfm_ptt.py                        \
        usrp_nbfm_rcv.py                        \
        usrp_spectrum_sense.py                  \
+       usrp_test_loop_lfsr.py                  \
        usrp_tv_rcv_nogui.py                    \
        usrp_tv_rcv.py                          \
        usrp_wfm_rcv.py                         \

Deleted: gnuradio/trunk/gnuradio-examples/python/usrp/limbo/tvrx_am_rcv_gui.py

Deleted: gnuradio/trunk/gnuradio-examples/python/usrp/limbo/usrp_fft_old.py

Copied: gnuradio/trunk/gnuradio-examples/python/usrp/usrp_benchmark_usb.py 
(from rev 6284, gnuradio/trunk/gr-utils/src/python/usrp_benchmark_usb.py)
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/usrp/usrp_benchmark_usb.py          
                (rev 0)
+++ gnuradio/trunk/gnuradio-examples/python/usrp/usrp_benchmark_usb.py  
2007-09-04 13:21:24 UTC (rev 6287)
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005 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.
+# 
+
+"""
+Benchmark the USB/USRP throughput.  Finds the maximum full-duplex speed
+the USRP/USB combination can sustain without errors.
+
+This program does not currently give reliable results.  Sorry about that...
+"""
+
+from gnuradio import gr
+from gnuradio import usrp
+from gnuradio import eng_notation
+
+import sys
+
+def run_test (usb_throughput, verbose):
+    # usb_throughput is in bytes/sec.
+    #
+    # Returns True or False
+    
+    nsec = 1
+    stream_length = int (usb_throughput/2 * nsec)   # length of stream to 
examine
+
+    adc_freq =  64e6
+    dac_freq = 128e6
+    sizeof_sample = 2 * gr.sizeof_short
+
+    usb_throughput_in_samples = usb_throughput / sizeof_sample
+
+    # allocate usb throughput 50/50 between Tx and Rx
+
+    tx_interp = int (dac_freq) / int (usb_throughput_in_samples / 2)
+    rx_decim  = int (adc_freq) / int (usb_throughput_in_samples / 2)
+
+    # print "tx_interp =", tx_interp, "rx_decim =", rx_decim
+    assert (tx_interp == 2 * rx_decim)
+    
+    fg = gr.flow_graph ()
+
+    # Build the Tx pipeline
+    data_src = gr.lfsr_32k_source_s ()
+    src_head = gr.head (gr.sizeof_short, int (stream_length * 2))
+    usrp_tx = usrp.sink_s (0, tx_interp)
+    fg.connect (data_src, src_head, usrp_tx)
+
+    # and the Rx pipeline
+    usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210, 
usrp.FPGA_MODE_LOOPBACK)
+    head = gr.head (gr.sizeof_short, stream_length)
+    check = gr.check_lfsr_32k_s ()
+    fg.connect (usrp_rx, head, check)
+
+    fg.run ()
+
+    ntotal = check.ntotal ()
+    nright = check.nright ()
+    runlength = check.runlength ()
+
+    if verbose:
+        print "usb_throughput =", eng_notation.num_to_str (usb_throughput)
+        print "ntotal    =", ntotal
+        print "nright    =", nright
+        print "runlength =", runlength
+        print "delta     =", ntotal - runlength
+
+    return runlength >= stream_length - 80000
+    
+def main ():
+    verbose = True
+    best_rate = 0
+    usb_rate = [ 2e6, 4e6, 8e6, 16e6, 32e6 ]
+    #usb_rate = [ 32e6, 32e6, 32e6, 32e6, 32e6 ]
+    # usb_rate.reverse ()
+    for rate in usb_rate:
+        sys.stdout.write ("Testing %sB/sec... " % (eng_notation.num_to_str 
(rate)))
+        sys.stdout.flush ()
+        ok = run_test (rate, verbose)
+        if ok:
+            best_rate = max (best_rate, rate)
+            sys.stdout.write ("OK\n")
+        else:
+            sys.stdout.write ("FAILED\n")
+
+    print "Max USB/USRP throughput = %sB/sec" % (eng_notation.num_to_str 
(best_rate),)
+
+if __name__ == '__main__':
+    main ()

Copied: gnuradio/trunk/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py 
(from rev 6284, gnuradio/trunk/gr-utils/src/python/usrp_test_loop_lfsr.py)
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py         
                (rev 0)
+++ gnuradio/trunk/gnuradio-examples/python/usrp/usrp_test_loop_lfsr.py 
2007-09-04 13:21:24 UTC (rev 6287)
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# Copyright 2004 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.
+# 
+
+"""
+Digital loopback (Tx to Rx) for the USRP Rev1.
+"""
+
+from gnuradio import gr
+from gnuradio import usrp
+
+
+def build_graph ():
+    tx_interp =  32       # tx should be twice rx
+    rx_decim  =  16
+    
+    fg = gr.flow_graph ()
+
+    data_src = gr.lfsr_32k_source_s ()
+
+    # usrp_tx = usrp.sink_s (0, tx_interp, 1, 0x98)
+    usrp_tx = usrp.sink_s (0, tx_interp)
+
+    fg.connect (data_src, usrp_tx)
+
+    usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210, 
usrp.FPGA_MODE_LOOPBACK)
+
+    sink = gr.check_lfsr_32k_s ()
+    fg.connect (usrp_rx, sink)
+
+    # file_sink = gr.file_sink (gr.sizeof_short, "loopback.dat")
+    # fg.connect (usrp_rx, file_sink)
+    
+    return fg
+    
+def main ():
+    fg = build_graph ()
+    try:
+        fg.run()
+    except KeyboardInterrupt:
+        pass
+
+if __name__ == '__main__':
+    main ()


Property changes on: 
gnuradio/trunk/gnuradio-examples/python/usrp/usrp_wfm_rcv_sca.py
___________________________________________________________________
Name: svn:executable
   + *

Deleted: gnuradio/trunk/gnuradio-examples/python/usrp/wfm_rcv_file.py

Modified: gnuradio/trunk/gr-utils/src/python/Makefile.am
===================================================================
--- gnuradio/trunk/gr-utils/src/python/Makefile.am      2007-09-04 05:01:26 UTC 
(rev 6286)
+++ gnuradio/trunk/gr-utils/src/python/Makefile.am      2007-09-04 13:21:24 UTC 
(rev 6287)
@@ -23,7 +23,6 @@
     $(bin_SCRIPTS)
 
 bin_SCRIPTS = \
-    usrp_benchmark_usb.py \
     usrp_fft.py \
     usrp_oscope.py \
     usrp_print_db.py \
@@ -31,5 +30,4 @@
     usrp_rx_nogui.py \
     usrp_siggen.py \
     usrp_test_counting.py \
-    usrp_test_loop.py \
-    usrp_test_loop_lfsr.py
+    usrp_test_loopback.py

Deleted: gnuradio/trunk/gr-utils/src/python/usrp_benchmark_usb.py

Deleted: gnuradio/trunk/gr-utils/src/python/usrp_test_loop.py

Deleted: gnuradio/trunk/gr-utils/src/python/usrp_test_loop_lfsr.py

Copied: gnuradio/trunk/gr-utils/src/python/usrp_test_loopback.py (from rev 
6284, gnuradio/trunk/gr-utils/src/python/usrp_test_loop.py)
===================================================================
--- gnuradio/trunk/gr-utils/src/python/usrp_test_loopback.py                    
        (rev 0)
+++ gnuradio/trunk/gr-utils/src/python/usrp_test_loopback.py    2007-09-04 
13:21:24 UTC (rev 6287)
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# Copyright 2004 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.
+# 
+
+"""
+Digital loopback (Tx to Rx) for the USRP Rev1.
+"""
+
+
+from gnuradio import gr
+from gnuradio import usrp
+
+
+def ramp_source (fg):
+    period = 2**16
+    src = gr.vector_source_s (range (-period/2, period/2, 1), True)
+    return src
+
+def build_graph ():
+    tx_interp =  32       # tx should be twice rx
+    rx_decim  =  16
+    
+    fg = gr.flow_graph ()
+
+    data_src = ramp_source (fg)
+    # usrp_tx = usrp.sink_s (0, tx_interp, 1, 0x98)
+    usrp_tx = usrp.sink_s (0, tx_interp)
+    fg.connect (data_src, usrp_tx)
+
+    usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210, 
usrp.FPGA_MODE_LOOPBACK)
+    sink = gr.check_counting_s ()
+    fg.connect (usrp_rx, sink)
+
+    # file_sink = gr.file_sink (gr.sizeof_short, "loopback.dat")
+    # fg.connect (usrp_rx, file_sink)
+    
+    return fg
+    
+def main ():
+    fg = build_graph ()
+    try:
+        fg.run()
+    except KeyboardInterrupt:
+        pass
+
+if __name__ == '__main__':
+    main ()





reply via email to

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