[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6408 - in gnuradio/branches/developers/jcorgan/t162:
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r6408 - in gnuradio/branches/developers/jcorgan/t162: gnuradio-core/src/lib/runtime gnuradio-core/src/python/gnuradio/blks2impl gr-utils/src/python |
Date: |
Tue, 11 Sep 2007 13:51:40 -0600 (MDT) |
Author: jcorgan
Date: 2007-09-11 13:51:39 -0600 (Tue, 11 Sep 2007)
New Revision: 6408
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.h
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.i
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.cc
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.h
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.i
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_fft.py
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_oscope.py
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_rx_cfile.py
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_rx_nogui.py
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_siggen.py
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_test_counting.py
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_test_loopback.py
Log:
Converted gr-utils to new top block code, more blks2 blocks.
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
2007-09-11 19:51:39 UTC (rev 6408)
@@ -78,6 +78,12 @@
}
void
+gr_hier_block2::disconnect_all()
+{
+ d_detail->disconnect_all();
+}
+
+void
gr_hier_block2::lock()
{
d_detail->lock();
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.h
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.h
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.h
2007-09-11 19:51:39 UTC (rev 6408)
@@ -68,6 +68,7 @@
void disconnect(gr_basic_block_sptr src, int src_port,
gr_basic_block_sptr dst, int dst_port);
+ void disconnect_all();
virtual void lock();
virtual void unlock();
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.i
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.i
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2.i
2007-09-11 19:51:39 UTC (rev 6408)
@@ -53,6 +53,7 @@
void disconnect(gr_basic_block_sptr src, int src_port,
gr_basic_block_sptr dst, int dst_port)
throw (std::invalid_argument);
+ void disconnect_all();
void lock();
void unlock();
};
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.cc
2007-09-11 19:51:39 UTC (rev 6408)
@@ -288,6 +288,15 @@
return result;
}
+void
+gr_hier_block2_detail::disconnect_all()
+{
+ d_fg->clear();
+ d_blocks.clear();
+ d_inputs.clear();
+ d_outputs.clear();
+}
+
gr_endpoint
gr_hier_block2_detail::resolve_endpoint(const gr_endpoint &endp, bool
is_input) const
{
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_hier_block2_detail.h
2007-09-11 19:51:39 UTC (rev 6408)
@@ -37,6 +37,7 @@
void disconnect(gr_basic_block_sptr block);
void disconnect(gr_basic_block_sptr, int src_port,
gr_basic_block_sptr, int dst_port);
+ void disconnect_all();
void lock();
void unlock();
void flatten_aux(gr_flat_flowgraph_sptr sfg) const;
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.cc
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.cc
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.cc
2007-09-11 19:51:39 UTC (rev 6408)
@@ -88,3 +88,9 @@
{
d_impl->unlock();
}
+
+bool
+gr_top_block::is_running()
+{
+ return d_impl->is_running();
+}
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.h
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.h
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.h
2007-09-11 19:51:39 UTC (rev 6408)
@@ -97,6 +97,11 @@
* reconfiguration happens.
*/
virtual void unlock();
+
+ /*!
+ * Returns true if flowgraph is running
+ */
+ bool is_running();
};
#endif /* INCLUDED_GR_TOP_BLOCK_H */
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.i
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.i
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.i
2007-09-11 19:51:39 UTC (rev 6408)
@@ -46,6 +46,7 @@
void run();
void lock();
void unlock();
+ bool is_running();
};
%{
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
2007-09-11 19:51:39 UTC (rev 6408)
@@ -53,6 +53,9 @@
// Unlock the top block at end of reconfiguration
void unlock();
+ // Return true if flowgraph is running
+ bool is_running() const { return d_running; }
+
private:
bool d_running;
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -1,5 +1,5 @@
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,7 +21,7 @@
from gnuradio import gr, optfir
-class am_demod_cf(gr.hier_block):
+class am_demod_cf(gr.hier_block2):
"""
Generalized AM demodulation block with audio filtering.
@@ -30,7 +30,6 @@
filtering to the audio output. It produces a float stream in the
range [-1.0, +1.0].
- @param fg: flowgraph
@param channel_rate: incoming sample rate of the AM baseband
@type sample_rate: integer
@param audio_decim: input to output decimation rate
@@ -40,7 +39,11 @@
@param audio_stop: audio low pass filter stop frequency
@type audio_stop: float
"""
- def __init__(self, fg, channel_rate, audio_decim, audio_pass, audio_stop):
+ def __init__(self, channel_rate, audio_decim, audio_pass, audio_stop):
+ gr.hier_block2.__init__(self, "am_demod_cf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) #
Input signature
+
MAG = gr.complex_to_mag()
DCR = gr.add_const_ff(-1.0)
@@ -52,8 +55,7 @@
60) # Stopband attenuation
LPF = gr.fir_filter_fff(audio_decim, audio_taps)
- fg.connect(MAG, DCR, LPF)
- gr.hier_block.__init__(self, fg, MAG, LPF)
+ self.connect(self, MAG, DCR, LPF, self)
class demod_10k0a3e_cf(am_demod_cf):
"""
@@ -68,8 +70,8 @@
@param audio_decim: input to output decimation rate
@type audio_decim: integer
"""
- def __init__(self, fg, channel_rate, audio_decim):
- am_demod_cf.__init__(self, fg, channel_rate, audio_decim,
+ def __init__(self, channel_rate, audio_decim):
+ am_demod_cf.__init__(self, channel_rate, audio_decim,
5000, # Audio passband
5500) # Audio stopband
\ No newline at end of file
Modified:
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -1,5 +1,5 @@
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -20,10 +20,10 @@
#
from gnuradio import gr, optfir
-from gnuradio.blksimpl.fm_emph import fm_deemph
+from gnuradio.blks2impl.fm_emph import fm_deemph
from math import pi
-class fm_demod_cf(gr.hier_block):
+class fm_demod_cf(gr.hier_block2):
"""
Generalized FM demodulation block with deemphasis and audio
filtering.
@@ -33,7 +33,6 @@
deemphasis. Low pass filtering is done on the resultant signal. It
produces an output float strem in the range of [-1.0, +1.0].
- @param fg: flowgraph
@param channel_rate: incoming sample rate of the FM baseband
@type sample_rate: integer
@param deviation: maximum FM deviation (default = 5000)
@@ -49,18 +48,12 @@
@param tau: deemphasis time constant (default = 75e-6), specify 'None'
to prevent deemphasis
"""
- def __init__(self, fg, channel_rate, audio_decim, deviation,
+ def __init__(self, channel_rate, audio_decim, deviation,
audio_pass, audio_stop, gain=1.0, tau=75e-6):
-
- """
- # Equalizer for ~100 us delay
- delay = 100e-6
- num_taps = int(channel_rate*delay)
-
- mu = 1e-4/num_taps
- print "CMA: delay =", delay, "n =", num_taps, "mu =", mu
- CMA = gr.cma_equalizer_cc(num_taps, 1.0, mu)
- """
+ gr.hier_block2.__init__(self, "fm_demod_cf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) #
Output signature
+
k = channel_rate/(2*pi*deviation)
QUAD = gr.quadrature_demod_cf(k)
@@ -73,13 +66,11 @@
LPF = gr.fir_filter_fff(audio_decim, audio_taps)
if tau is not None:
- DEEMPH = fm_deemph(fg, channel_rate, tau)
- fg.connect(QUAD, DEEMPH, LPF)
+ DEEMPH = fm_deemph(channel_rate, tau)
+ self.connect(self, QUAD, DEEMPH, LPF, self)
else:
- fg.connect(QUAD, LPF)
+ self.connect(self, QUAD, LPF, self)
- gr.hier_block.__init__(self, fg, QUAD, LPF)
-
class demod_20k0f3e_cf(fm_demod_cf):
"""
NBFM demodulation block, 20 KHz channels
@@ -88,14 +79,13 @@
channel conforming to 20K0F3E emission standards, outputting
floats in the range [-1.0, +1.0].
- @param fg: flowgraph
@param sample_rate: incoming sample rate of the FM baseband
@type sample_rate: integer
@param audio_decim: input to output decimation rate
@type audio_decim: integer
"""
- def __init__(self, fg, channel_rate, audio_decim):
- fm_demod_cf.__init__(self, fg, channel_rate, audio_decim,
+ def __init__(self, channel_rate, audio_decim):
+ fm_demod_cf.__init__(self, channel_rate, audio_decim,
5000, # Deviation
3000, # Audio passband frequency
4000) # Audio stopband frequency
@@ -108,14 +98,13 @@
channel conforming to 200KF3E emission standards, outputting
floats in the range [-1.0, +1.0].
- @param fg: flowgraph
@param sample_rate: incoming sample rate of the FM baseband
@type sample_rate: integer
@param audio_decim: input to output decimation rate
@type audio_decim: integer
"""
def __init__(self, fg, channel_rate, audio_decim):
- fm_demod_cf.__init__(self, fg, channel_rate, audio_decim,
+ fm_demod_cf.__init__(self, channel_rate, audio_decim,
75000, # Deviation
15000, # Audio passband
16000, # Audio stopband
Modified:
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_fft.py
===================================================================
--- gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_fft.py
2007-09-11 19:21:06 UTC (rev 6407)
+++ gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_fft.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005 Free Software Foundation, Inc.
+# Copyright 2004,2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,7 +24,7 @@
from gnuradio import usrp
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
-from gnuradio.wxgui import stdgui, fftsink, waterfallsink, scopesink, form,
slider
+from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2,
form, slider
from optparse import OptionParser
import wx
import sys
@@ -44,9 +44,9 @@
return (0, 0)
-class app_flow_graph(stdgui.gui_flow_graph):
+class app_top_block(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui.gui_flow_graph.__init__(self)
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
self.frame = frame
self.panel = panel
@@ -98,11 +98,11 @@
if options.waterfall:
self.scope = \
- waterfallsink.waterfall_sink_c (self, panel, fft_size=1024,
sample_rate=input_rate)
+ waterfallsink2.waterfall_sink_c (panel, fft_size=1024,
sample_rate=input_rate)
elif options.oscilloscope:
- self.scope = scopesink.scope_sink_c(self, panel,
sample_rate=input_rate)
+ self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate)
else:
- self.scope = fftsink.fft_sink_c (self, panel, fft_size=1024,
sample_rate=input_rate)
+ self.scope = fftsink2.fft_sink_c (panel, fft_size=1024,
sample_rate=input_rate)
self.connect(self.u, self.scope)
@@ -247,7 +247,7 @@
return ok
def main ():
- app = stdgui.stdapp(app_flow_graph, "USRP FFT", nstatus=1)
+ app = stdgui2.stdapp(app_top_block, "USRP FFT", nstatus=1)
app.MainLoop()
if __name__ == '__main__':
Modified:
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_oscope.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_oscope.py
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_oscope.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2005,2006 Free Software Foundation, Inc.
+# Copyright 2004,2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -26,7 +26,7 @@
from gnuradio import usrp
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
-from gnuradio.wxgui import stdgui, fftsink, waterfallsink, scopesink, form,
slider
+from gnuradio.wxgui import stdgui2, scopesink2, form, slider
from optparse import OptionParser
import wx
import sys
@@ -46,9 +46,9 @@
return (0, 0)
-class app_flow_graph(stdgui.gui_flow_graph):
+class app_top_block(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
- stdgui.gui_flow_graph.__init__(self)
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
self.frame = frame
self.panel = panel
@@ -97,7 +97,7 @@
input_rate = self.u.adc_freq() / self.u.decim_rate()
- self.scope = scopesink.scope_sink_c(self, panel,
sample_rate=input_rate,
+ self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate,
frame_decim=options.frame_decim,
v_scale=options.v_scale,
t_scale=options.t_scale)
@@ -245,7 +245,7 @@
return ok
def main ():
- app = stdgui.stdapp(app_flow_graph, "USRP O'scope", nstatus=1)
+ app = stdgui2.stdapp(app_top_block, "USRP O'scope", nstatus=1)
app.MainLoop()
if __name__ == '__main__':
Modified:
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_rx_cfile.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_rx_cfile.py
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_rx_cfile.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -11,11 +11,12 @@
from gnuradio import usrp
from gnuradio.eng_option import eng_option
from optparse import OptionParser
+import sys
-class my_graph(gr.flow_graph):
+class my_top_block(gr.top_block):
def __init__(self):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
usage="%prog: [options] output_filename"
parser = OptionParser(option_class=eng_option, usage=usage)
@@ -99,9 +100,12 @@
sys.stderr.write('Failed to set frequency\n')
raise SystemExit, 1
+ def __del__(self):
+ # Avoid weak reference error
+ del self.subdev
if __name__ == '__main__':
try:
- my_graph().run()
+ my_top_block().run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_rx_nogui.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_rx_nogui.py
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_rx_nogui.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -1,8 +1,29 @@
#!/usr/bin/env python
+#
+# Copyright 2006,2007 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, gru, usrp, optfir, audio, eng_notation, blks
+from gnuradio import gr, gru, usrp, optfir, audio, eng_notation, blks2
from gnuradio.eng_option import eng_option
from optparse import OptionParser
+import sys
"""
This example application demonstrates receiving and demodulating
@@ -47,12 +68,12 @@
# (usrp_decim, channel_decim, audio_decim, channel_pass, channel_stop, demod)
demod_params = {
- 'AM' : (250, 16, 1, 5000, 8000, blks.demod_10k0a3e_cf),
- 'FM' : (250, 8, 4, 8000, 9000, blks.demod_20k0f3e_cf),
- 'WFM' : (250, 1, 8, 90000, 100000, blks.demod_200kf3e_cf)
+ 'AM' : (250, 16, 1, 5000, 8000, blks2.demod_10k0a3e_cf),
+ 'FM' : (250, 8, 4, 8000, 9000, blks2.demod_20k0f3e_cf),
+ 'WFM' : (250, 1, 8, 90000, 100000, blks2.demod_200kf3e_cf)
}
-class usrp_source_c(gr.hier_block):
+class usrp_src(gr.hier_block2):
"""
Create a USRP source object supplying complex floats.
@@ -61,7 +82,11 @@
Calibration value is the offset from the tuned frequency to
the actual frequency.
"""
- def __init__(self, fg, subdev_spec, decim, gain=None, calibration=0.0):
+ def __init__(self, subdev_spec, decim, gain=None, calibration=0.0):
+ gr.hier_block2.__init__(self, "usrp_src",
+ gr.io_signature(0, 0, 0), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
+
self._decim = decim
self._src = usrp.source_c()
if subdev_spec is None:
@@ -77,7 +102,7 @@
self._subdev.set_gain(gain)
self._cal = calibration
- gr.hier_block.__init__(self, fg, self._src, self._src)
+ self.connect(self._src, self)
def tune(self, freq):
result = usrp.tune(self._src, 0, self._subdev, freq+self._cal)
@@ -86,20 +111,18 @@
def rate(self):
return self._src.adc_rate()/self._decim
-class app_flow_graph(gr.flow_graph):
- def __init__(self, options, args):
- gr.flow_graph.__init__(self)
+class app_top_block(gr.top_block):
+ def __init__(self, options):
+ gr.top_block.__init__(self)
self.options = options
- self.args = args
(usrp_decim, channel_decim, audio_decim,
channel_pass, channel_stop, demod) = demod_params[options.modulation]
- USRP = usrp_source_c(self, # Flow graph
- options.rx_subdev_spec, # Daugherboard spec
- usrp_decim, # IF decimation ratio
- options.gain, # Receiver gain
- options.calibration) # Frequency offset
+ USRP = usrp_src(options.rx_subdev_spec, # Daugherboard spec
+ usrp_decim, # IF decimation ratio
+ options.gain, # Receiver gain
+ options.calibration) # Frequency offset
USRP.tune(options.frequency)
if_rate = USRP.rate()
@@ -128,7 +151,7 @@
1.0, # Initial gain
1.0) # Maximum gain
- DEMOD = demod(self, channel_rate, audio_decim)
+ DEMOD = demod(channel_rate, audio_decim)
# From RF to audio
self.connect(USRP, CHAN, RFSQL, AGC, DEMOD)
@@ -145,7 +168,7 @@
out_lcm = gru.lcm(audio_rate, options.output_rate)
out_interp = int(out_lcm // audio_rate)
out_decim = int(out_lcm // options.output_rate)
- RSAMP = blks.rational_resampler_fff(self, out_interp, out_decim)
+ RSAMP = blks2.rational_resampler_fff(out_interp, out_decim)
self.connect(tail, RSAMP)
tail = RSAMP
@@ -155,7 +178,7 @@
def main():
parser = OptionParser(option_class=eng_option)
- parser.add_option("-f", "--frequency", type="eng_float",
+ parser.add_option("-f", "--frequency", type="eng_float", default=None,
help="set receive frequency to Hz", metavar="Hz")
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
help="select USRP Rx side A or B", metavar="SUBDEV")
@@ -173,12 +196,16 @@
help="set CTCSS squelch to FREQ", metavar="FREQ")
(options, args) = parser.parse_args()
+ if options.frequency is None:
+ print "Must supply receive frequency with -f"
+ sys.exit(1)
+
if options.frequency < 1e6:
options.frequency *= 1e6
- fg = app_flow_graph(options, args)
+ tb = app_top_block(options)
try:
- fg.run()
+ tb.run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_siggen.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_siggen.py
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_siggen.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -8,9 +8,9 @@
import sys
-class my_graph(gr.flow_graph):
+class my_top_block(gr.top_block):
def __init__ (self):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
# controllable values
self.interp = 64
@@ -146,33 +146,33 @@
parser.print_help()
raise SystemExit
- fg = my_graph()
- fg.set_interpolator (options.interp)
- fg.set_waveform_type (options.type)
- fg.set_waveform_freq (options.waveform_freq)
- fg.set_waveform_ampl (options.amplitude)
- fg.set_waveform_offset (options.offset)
+ tb = my_top_block()
+ tb.set_interpolator (options.interp)
+ tb.set_waveform_type (options.type)
+ tb.set_waveform_freq (options.waveform_freq)
+ tb.set_waveform_ampl (options.amplitude)
+ tb.set_waveform_offset (options.offset)
# determine the daughterboard subdevice we're using
if options.tx_subdev_spec is None:
- options.tx_subdev_spec = usrp.pick_tx_subdevice(fg.u)
+ options.tx_subdev_spec = usrp.pick_tx_subdevice(tb.u)
- m = usrp.determine_tx_mux_value(fg.u, options.tx_subdev_spec)
+ m = usrp.determine_tx_mux_value(tb.u, options.tx_subdev_spec)
#print "mux = %#04x" % (m,)
- fg.u.set_mux(m)
- fg.subdev = usrp.selected_subdev(fg.u, options.tx_subdev_spec)
- print "Using TX d'board %s" % (fg.subdev.side_and_name(),)
+ tb.u.set_mux(m)
+ tb.subdev = usrp.selected_subdev(tb.u, options.tx_subdev_spec)
+ print "Using TX d'board %s" % (tb.subdev.side_and_name(),)
- fg.subdev.set_gain(fg.subdev.gain_range()[1]) # set max Tx gain
+ tb.subdev.set_gain(tb.subdev.gain_range()[1]) # set max Tx gain
- if not fg.set_freq(options.rf_freq):
+ if not tb.set_freq(options.rf_freq):
sys.stderr.write('Failed to set RF frequency\n')
raise SystemExit
- fg.subdev.set_enable(True) # enable transmitter
+ tb.subdev.set_enable(True) # enable transmitter
try:
- fg.run()
+ tb.run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_test_counting.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_test_counting.py
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_test_counting.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,20 +32,20 @@
def build_graph ():
rx_decim = 32
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210,
usrp.FPGA_MODE_COUNTING)
sink = gr.check_counting_s ()
- fg.connect (usrp_rx, sink)
+ tb.connect (usrp_rx, sink)
# file_sink = gr.file_sink (gr.sizeof_short, 'counting.dat')
- # fg.connect (usrp_rx, file_sink)
+ # tb.connect (usrp_rx, file_sink)
- return fg
+ return tb
def main ():
- fg = build_graph ()
+ tb = build_graph ()
try:
- fg.run()
+ tb.run()
except KeyboardInterrupt:
pass
Modified:
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_test_loopback.py
===================================================================
---
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_test_loopback.py
2007-09-11 19:21:06 UTC (rev 6407)
+++
gnuradio/branches/developers/jcorgan/t162/gr-utils/src/python/usrp_test_loopback.py
2007-09-11 19:51:39 UTC (rev 6408)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -29,7 +29,7 @@
from gnuradio import usrp
-def ramp_source (fg):
+def ramp_source (tb):
period = 2**16
src = gr.vector_source_s (range (-period/2, period/2, 1), True)
return src
@@ -38,26 +38,26 @@
tx_interp = 32 # tx should be twice rx
rx_decim = 16
- fg = gr.flow_graph ()
+ tb = gr.top_block ()
- data_src = ramp_source (fg)
+ data_src = ramp_source (tb)
# usrp_tx = usrp.sink_s (0, tx_interp, 1, 0x98)
usrp_tx = usrp.sink_s (0, tx_interp)
- fg.connect (data_src, usrp_tx)
+ tb.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)
+ tb.connect (usrp_rx, sink)
# file_sink = gr.file_sink (gr.sizeof_short, "loopback.dat")
- # fg.connect (usrp_rx, file_sink)
+ # tb.connect (usrp_rx, file_sink)
- return fg
+ return tb
def main ():
- fg = build_graph ()
+ tb = build_graph ()
try:
- fg.run()
+ tb.run()
except KeyboardInterrupt:
pass
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6408 - in gnuradio/branches/developers/jcorgan/t162: gnuradio-core/src/lib/runtime gnuradio-core/src/python/gnuradio/blks2impl gr-utils/src/python,
jcorgan <=