diff options
author | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2009-01-27 18:00:05 +0000 |
---|---|---|
committer | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2009-01-27 18:00:05 +0000 |
commit | 85b76dd55f422cf70238c58f2e39c2c28555f6ce (patch) | |
tree | 4c49a90a90efc0b8fbc1c6c5229363b8c14611a9 /gnuradio-examples/python | |
parent | f0d8ab4f2f2cf681994e1ab9a2f5c7dbcd9419cd (diff) |
General housekeeping--removing ancient cruft mostly.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10315 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-examples/python')
-rw-r--r-- | gnuradio-examples/python/limbo/networking/Makefile.am | 23 | ||||
-rwxr-xr-x | gnuradio-examples/python/limbo/networking/measurement_slave.py | 241 | ||||
-rw-r--r-- | gnuradio-examples/python/limbo/sounder/Makefile.am | 30 | ||||
-rw-r--r-- | gnuradio-examples/python/limbo/sounder/sounder_rx.py | 53 | ||||
-rw-r--r-- | gnuradio-examples/python/limbo/sounder/sounder_tx.py | 45 | ||||
-rw-r--r-- | gnuradio-examples/python/limbo/sounder/usrp_sink.py | 117 | ||||
-rwxr-xr-x | gnuradio-examples/python/limbo/sounder/usrp_sounder_rx.py | 95 | ||||
-rwxr-xr-x | gnuradio-examples/python/limbo/sounder/usrp_sounder_tx.py | 110 | ||||
-rw-r--r-- | gnuradio-examples/python/limbo/sounder/usrp_source.py | 126 | ||||
-rwxr-xr-x | gnuradio-examples/python/usrp/limbo/am_rcv.py | 115 | ||||
-rw-r--r-- | gnuradio-examples/python/usrp/limbo/ayfabtu.dat | bin | 544640 -> 0 bytes | |||
-rwxr-xr-x | gnuradio-examples/python/usrp/limbo/ayfabtu.py | 169 | ||||
-rwxr-xr-x | gnuradio-examples/python/usrp/limbo/flexrf_debug.py | 169 | ||||
-rwxr-xr-x | gnuradio-examples/python/usrp/limbo/flexrf_siggen.py | 148 |
14 files changed, 0 insertions, 1441 deletions
diff --git a/gnuradio-examples/python/limbo/networking/Makefile.am b/gnuradio-examples/python/limbo/networking/Makefile.am deleted file mode 100644 index d302945378..0000000000 --- a/gnuradio-examples/python/limbo/networking/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 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. -# - -EXTRA_DIST = \ - measurement_slave.py
\ No newline at end of file diff --git a/gnuradio-examples/python/limbo/networking/measurement_slave.py b/gnuradio-examples/python/limbo/networking/measurement_slave.py deleted file mode 100755 index a2b04151fe..0000000000 --- a/gnuradio-examples/python/limbo/networking/measurement_slave.py +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 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. -# - -import struct -import socket -import asyncore -import sys -import optparse -import random -from gnuradio.eng_option import eng_option -import gnuradio.gr.gr_threading as _threading - -LOOP_TIMEOUT = 0.001 -BROADCAST_ADDR = '255.255.255.255' - -BROADCAST_PORT = 27010 # UDP -CONTROL_PORT = 27011 # TCP - -PKT_HEADER_SIZE = 4 # 32-bit int - -logfile = None - -def unpack_header(s): - (len,) = struct.unpack('!i', s) - return (len,) - -def pack_header(len): - return struct.pack('!i', len) - - -class control_port_listener(asyncore.dispatcher): - def __init__(self, port=CONTROL_PORT, udp_socket=None, verbose=False): - """ - @param port: TCP port to listen on. - @type port: int - """ - asyncore.dispatcher.__init__(self) - - self._verbose = verbose - self._udp_socket = udp_socket - - host = '' # symbolic name for localhost - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.set_reuse_addr() - - try: - self.bind((host, port)) - except socket.error, err: - sys.stderr.write('Failed to bind to %s: %s\n' % - ((host, port), os.strerror (err.args[0]),)) - sys.exit(1) - - self.listen(3) - - def handle_accept(self): - socket, addr = self.accept() - sys.stderr.write("handle_accept: %r\n" % (addr,)) - if not(socket is None): - # instantiate a server - s = control_server(socket, addr, self._udp_socket, self._verbose) - - -class gr_dispatcher(asyncore.dispatcher): - def __init__(self, sock=None, map=None): - asyncore.dispatcher.__init__(self, sock=sock, map=map) - - def read_packet(self): - """ - Returns None or packet - """ - s = self.recvall(PKT_HEADER_SIZE) - if s == '': - return None - - (payload_len,) = unpack_header(s) - - payload_len = int(payload_len) - - if payload_len == 0: - payload = '' - else: - payload = self.recvall(payload_len) - if len(payload) != payload_len: - sys.stderr.write ('short recv, expected %d bytes, got %d\n' % ( - payload_len, len(payload))) - raise RuntimeError, "short recv" - - return payload - - def recvall(self, buffer_size): - result = '' - while len(result) < buffer_size: - data = self.recv(buffer_size - len(result)) - if not data: - return '' - result += data - return result - - -class pkt_receiver_thread(_threading.Thread): - def __init__(self, socket): - _threading.Thread.__init__(self) - self.setDaemon(1) - self.socket = socket - self.keep_running = True - self.start() - - def run(self): - while self.keep_running: - pkt, sender = self.socket.recvfrom(10000) - if pkt: - if len(pkt) > 2: - t = struct.unpack('!H', pkt[0:2]) - seqno = t[0] - else: - seqno = -1 - - logfile.write('RCVD seqno %4d len %4d from %s\n' % (seqno, len(pkt), sender)) - logfile.flush() - - -class control_server(gr_dispatcher): - def __init__(self, socket, addr, udp_socket, verbose=False): - gr_dispatcher.__init__(self, sock=socket) - - self._udp_socket = udp_socket - self.verbose = verbose - self.setblocking(1) - - def writable(self): - return False - - def handle_read(self): - pkt = self.read_packet() - if pkt: - annotate = 'ANNOTATE' - if pkt.startswith(annotate): - logfile.write(pkt[len(annotate)+1:]) - logfile.write('\n') - logfile.flush() - elif pkt.startswith('SEND'): - tokens = pkt.split() - if len(tokens) < 4: - invalid_packet(pkt) - else: - npkts = int(tokens[1]) - size = int(tokens[2]) - power = float(tokens[3]) - send_test_packets(self._udp_socket, npkts, size, power) - else: - invalid_packet(pkt) - - def handle_close(self): - self.close() - - -def invalid_packet(pkt): - sys.stderr.write('received unrecognized packet: %s\n' % (pkt,)) - - -def make_random_payload(size): - p = [0] * size - if 1: - for i in range(size): - p[i] = chr(random.randint(0, 255)) - else: - for i in range(size): - p[i] = chr(i % 256) - return ''.join(p) - - -def send_test_packets(udp_socket, npkts, size, power): - # we ignore power for now... - size = max(2, size) - payload = make_random_payload(size - 2) - for n in range(npkts): - pkt = struct.pack('!H', n) + payload - udp_socket.sendto(pkt, (BROADCAST_ADDR, BROADCAST_PORT)) - #udp_socket.sendall(pkt) - - -def open_udp_broadcast_socket(gr0_host_ip, port): - s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -# s.bind((gr0_host_ip, port)) - s.bind(('', port)) - s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) -# s.connect((BROADCAST_ADDR, port)) - return s - - -def main(): - global logfile - - usage = 'usage: %prog [options] gr0-ip-addr' - parser = optparse.OptionParser (option_class=eng_option, usage=usage) - parser.add_option('-l', '--logfile', type='string', default=None, - help="specify log file name [default=<stdout>]") - parser.add_option('-v', '--verbose', action="store_true", default=False, - help="enable verbose diagnostics") - - (options, args) = parser.parse_args () - if len(args) != 1: - parser.print_help() - sys.exit(1) - - gr0_ip_addr = args[0] - if options.logfile is None: - logfile = sys.stdout - else: - logfile = file(options.logfile, 'w') - - udp_socket = open_udp_broadcast_socket(gr0_ip_addr, BROADCAST_PORT) - R = pkt_receiver_thread(udp_socket) - L = control_port_listener(CONTROL_PORT, udp_socket=udp_socket, verbose=options.verbose) - asyncore.loop(LOOP_TIMEOUT) - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gnuradio-examples/python/limbo/sounder/Makefile.am b/gnuradio-examples/python/limbo/sounder/Makefile.am deleted file mode 100644 index 9814d80ef8..0000000000 --- a/gnuradio-examples/python/limbo/sounder/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 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. -# - -EXTRA_DIST = \ - usrp_sounder_rx.py \ - usrp_sounder_tx.py \ - usrp_source.py \ - usrp_sink.py \ - sounder_rx.py \ - sounder_tx.py - -MOSTLYCLEANFILES = *.pyc *~ *.dat diff --git a/gnuradio-examples/python/limbo/sounder/sounder_rx.py b/gnuradio-examples/python/limbo/sounder/sounder_rx.py deleted file mode 100644 index d24eb8efa9..0000000000 --- a/gnuradio-examples/python/limbo/sounder/sounder_rx.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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, usrp, eng_notation -from usrp_source import usrp_source_c -import math - -n2s = eng_notation.num_to_str - -class sounder_rx(gr.hier_block2): - """ - Creates a channel sounder receiver block with the given parameters. - """ - - def __init__(self, chip_rate, degree, verbose): - - # Call hierarchical block constructor - # Top-level blocks have no inputs or outputs - gr.hier_block2.__init__(self, - "sounder_rx", # Block typename - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - - self._degree = degree - self._chip_rate = chip_rate - self._verbose = verbose - self._length = 2**self._degree-1 - self._rep_rate = self._chip_rate/float(self._length) - - if self._verbose: - print "Using PN sequence of degree", self._degree, "length", self._length - print "Sequence repetition rate is", n2s(self._rep_rate), "per sec" - - self.connect(self, gr.pn_correlator_cc(self._degree), self) diff --git a/gnuradio-examples/python/limbo/sounder/sounder_tx.py b/gnuradio-examples/python/limbo/sounder/sounder_tx.py deleted file mode 100644 index dcdd9fc5ce..0000000000 --- a/gnuradio-examples/python/limbo/sounder/sounder_tx.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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, usrp, eng_notation -import math - -n2s = eng_notation.num_to_str - -class sounder_tx(gr.hier_block2): - """ - Creates a channel sounder generator with the given parameters. - """ - - def __init__(self, degree, chip_rate, verbose): - gr.hier_block2.__init__(self, - "sounder_tx", # Block typename - gr.io_signature(0,0,0), # Input signature - gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - - self._degree = degree - self._chip_rate = chip_rate - self._verbose = verbose - self._length = 2**degree-1 - - # Connect PN source to block output - self.connect(gr.glfsr_source_f(degree), self) diff --git a/gnuradio-examples/python/limbo/sounder/usrp_sink.py b/gnuradio-examples/python/limbo/sounder/usrp_sink.py deleted file mode 100644 index 34b6107048..0000000000 --- a/gnuradio-examples/python/limbo/sounder/usrp_sink.py +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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, usrp, eng_notation -n2s = eng_notation.num_to_str - -# Hierarchical block implementing a USRP sink for complex floats, -# with convenience functions for tuning, interpolation, etc. -# -class usrp_sink_c(gr.hier_block2): - """ - Create a USRP sink object accepting complex floats. - """ - def __init__(self, which=0, subdev_spec=None, if_rate=None, - freq=0.0, calibration=0.0, verbose=False): - # Call hierarchical block constructor - gr.hier_block2.__init__(self, - "usrp_sink_c", # Block typename - gr.io_signature(1,1,gr.sizeof_gr_complex), # Input signature - gr.io_signature(0,0,0)) # Output signature - - self._verbose = verbose - self._u = usrp.sink_c(which) - if self._verbose: - print 'DAC sample rate is', n2s(self._u.dac_rate()), "sps" - self.set_subdev(subdev_spec) - self.set_if_rate(if_rate) - self.set_calibration(calibration) - self.tune(freq) - self.connect(self, self._u) - - def set_subdev(self, subdev_spec): - if subdev_spec is None: - subdev_spec = self.pick_subdevice() - self._subdev = usrp.selected_subdev(self._u, subdev_spec) - self._u.set_mux(usrp.determine_tx_mux_value(self._u, subdev_spec)) - if self._verbose: - print 'TX using', self._subdev.name(), 'daughterboard' - - def pick_subdevice(self): - """ - The user didn't specify a subdevice. - If there's a daughterboard on A, select A. - If there's a daughterboard on B, select B. - Otherwise, select A. - """ - if self._u.db[0][0].dbid() >= 0: # dbid is < 0 if there's no d'board or a problem - return (0, 0) - if self._u.db[1][0].dbid() >= 0: - return (1, 0) - return (0, 0) - - def set_if_rate(self, if_rate): - # If no IF rate specified, set to maximum interpolation - if if_rate is None: - self._interp = 512 - else: - self._interp = 4*int(self._u.dac_rate()/(4.0*if_rate)+0.5) - - - self._if_rate = self._u.dac_rate()/self._interp - self._u.set_interp_rate(self._interp) - - if self._verbose: - print "USRP interpolation rate is", self._interp - print "USRP IF rate is", n2s(self._if_rate), "sps" - - def set_calibration(self, calibration): - self._cal = calibration - if self._verbose: - print "Using frequency calibration offset of", n2s(calibration), "Hz" - - def tune(self, freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @type: 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. - """ - self._tune_result = self._u.tune(self._subdev._which, self._subdev, freq+self._cal) - if self._tune_result: - if self._verbose: - print "Baseband frequency is", n2s(self._tune_result.baseband_freq), "Hz" - print "DXC frequency is", n2s(self._tune_result.dxc_freq), "Hz" - print "Center frequency is", n2s(freq), "Hz" - print "Residual frequency is", n2s(self._tune_result.residual_freq), "Hz" - return True - - return False - -if __name__ == '__main__': - sink = usrp_sink_c(verbose=True) - diff --git a/gnuradio-examples/python/limbo/sounder/usrp_sounder_rx.py b/gnuradio-examples/python/limbo/sounder/usrp_sounder_rx.py deleted file mode 100755 index 6b85281ad7..0000000000 --- a/gnuradio-examples/python/limbo/sounder/usrp_sounder_rx.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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, eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -from usrp_source import usrp_source_c -from sounder_rx import sounder_rx - -n2s = eng_notation.num_to_str - -class usrp_sounder_rx(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self, "usrp_sounder_rx") - self._options = options - self._u = usrp_source_c(0, - self._options.rx_subdev_spec, - self._options.gain, - self._options.chip_rate, - self._options.freq, - self._options.cal, - self._options.verbose) - self._options.chip_rate = self._u._if_rate - self._length = 2**self._options.degree-1 - self._receiver = sounder_rx(self._options.chip_rate, - self._options.degree, - self._options.verbose) - - samples = 100 * self._length**2 - - head = gr.head(gr.sizeof_gr_complex, samples) - c2m = gr.complex_to_mag() - s2v = gr.stream_to_vector(gr.sizeof_float, self._length) - lpf = gr.single_pole_iir_filter_ff(self._options.alpha, self._length) - v2s = gr.vector_to_stream(gr.sizeof_float, self._length) - sink = gr.file_sink(gr.sizeof_float, "impulse.dat") - - self.connect(self._u, head, self._receiver, c2m, s2v, lpf, v2s, sink) - - if self._options.verbose: - print "Chip rate is", n2s(self._options.chip_rate), "chips/sec" - print "Resolution is", n2s(1.0/self._options.chip_rate), "sec" - print "Using PN code of degree", self._options.degree - -def main(): - parser = OptionParser(option_class=eng_option) - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None, - help="select USRP Rx side A or B (default=first found)") - parser.add_option("-f", "--freq", type="eng_float", default=0.0, - help="set center frequency (default=%default)") - parser.add_option("-c", "--cal", type="eng_float", default=0.0, - help="set frequency calibration offset (default=%default)") - parser.add_option("-v", "--verbose", action="store_true", default=False, - help="print extra debugging info") - parser.add_option("-d", "--degree", type="int", default=10, - help="set PN code degree (length=2**degree-1, default=%default)") - parser.add_option("-r", "--chip-rate", type="eng_float", default=8e6, - help="set sounder chip rate (default=%default)") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set receiver gain (default=%default)") - parser.add_option("", "--alpha", type="eng_float", default=1.0, - help="set smoothing constant (default=%default)") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - top_block = usrp_sounder_rx(options) - - try: - top_block.run() - except KeyboardInterrupt: - pass - -if __name__ == '__main__': - main () diff --git a/gnuradio-examples/python/limbo/sounder/usrp_sounder_tx.py b/gnuradio-examples/python/limbo/sounder/usrp_sounder_tx.py deleted file mode 100755 index ae531d5100..0000000000 --- a/gnuradio-examples/python/limbo/sounder/usrp_sounder_tx.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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, eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -from usrp_sink import usrp_sink_c -from sounder_tx import sounder_tx - -n2s = eng_notation.num_to_str - -class usrp_sounder_tx(gr.top_block): - def __init__(self, subdev_spec, freq, cal, verbose, degree, chip_rate, amplitude): - - # Call hierarchical block constructor - # Top-level blocks have no inputs or outputs - gr.top_block.__init__(self, "usrp_sounder_tx") - self._freq = freq - self._cal = cal - self._verbose = verbose - self._degree = degree - self._length = 2**degree-1 - self._amplitude = amplitude - - self._u = usrp_sink_c(0, subdev_spec, chip_rate, self._freq, self._cal, self._verbose) - self._chip_rate = self._u._if_rate - self._max_time = float(self._length)/self._chip_rate - self._pn = sounder_tx(self._degree, self._chip_rate, self._verbose) - self._gain = gr.multiply_const_ff(amplitude) - self._f2c = gr.float_to_complex() - self.connect(self._pn, self._gain, self._f2c, self._u) - - if self._verbose: - print "Chip rate is", n2s(self._chip_rate), "chips/sec" - print "Resolution is", n2s(1.0/self._chip_rate), "sec" - print "Using PN code of degree", self._degree, "length", 2**self._degree-1 - print "Maximum measurable impulse response is", n2s(self._max_time), "sec" - print "Output amplitude is", amplitude - - -def main(): - parser = OptionParser(option_class=eng_option) - - # Transmit path options - parser.add_option("-T", "--tx-subdev-spec", type="subdev", default=None, - help="select USRP Rx side A or B (default=first found)") - parser.add_option("-f", "--freq", type="eng_float", default=0.0, - help="set center frequency (default=%default)") - parser.add_option("-c", "--cal", type="eng_float", default=0.0, - help="set frequency calibration offset (default=%default)") - parser.add_option("-v", "--verbose", action="store_true", default=False, - help="print extra debugging info") - parser.add_option("-d", "--degree", type="int", default=10, - help="set PN code degree (length=2**degree-1, default=%default)") - parser.add_option("-r", "--chip-rate", type="eng_float", default=8e6, - help="set sounder chip rate (default=%default)") - parser.add_option("-g", "--amplitude", type="eng_float", default=8000.0, - help="set output amplitude (default=%default)") - parser.add_option("", "--real-time", action="store_true", default=False, - help="Attempt to enable real-time scheduling") - (options, args) = parser.parse_args() - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if not options.real_time: - realtime = False - else: - # Attempt to enable realtime scheduling - r = gr.enable_realtime_scheduling() - if r == gr.RT_OK: - realtime = True - else: - realtime = False - print "Note: failed to enable realtime scheduling" - - # Create an instance of a hierarchical block - top_block = usrp_sounder_tx(options.tx_subdev_spec, options.freq, options.cal, - options.verbose, options.degree, options.chip_rate, - options.amplitude) - - try: - # Run forever - top_block.run() - except KeyboardInterrupt: - # Ctrl-C exits - pass - -if __name__ == '__main__': - main () diff --git a/gnuradio-examples/python/limbo/sounder/usrp_source.py b/gnuradio-examples/python/limbo/sounder/usrp_source.py deleted file mode 100644 index 63eb3ce2bf..0000000000 --- a/gnuradio-examples/python/limbo/sounder/usrp_source.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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, usrp, eng_notation -n2s = eng_notation.num_to_str - -# Hierarchical block implementing a USRP source for complex floats, -# with convenience functions for gain, tune, decimation, etc. -# -class usrp_source_c(gr.hier_block2): - """ - Create a USRP source object supplying complex floats. - """ - def __init__(self, which=0, subdev_spec=None, gain=None, if_rate=None, - freq=0.0, calibration=0.0, verbose=False): - # Call hierarchical block constructor - gr.hier_block2.__init__(self, - "usrp_source_c", # Block typename - gr.io_signature(0,0,0), # Input signature - gr.io_signature(1,1,gr.sizeof_gr_complex)) # Output signature - - self._verbose = verbose - self._u = usrp.source_c(which) - if self._verbose: - print 'ADC sample rate is', n2s(self._u.adc_rate()), "sps" - self.set_subdev(subdev_spec) - self.set_if_rate(if_rate) - self.set_gain(gain) - self.set_calibration(calibration) - self.tune(freq) - self.connect(self._u, self) - - def set_subdev(self, subdev_spec): - if subdev_spec is None: - subdev_spec = self.pick_subdevice() - self._subdev = usrp.selected_subdev(self._u, subdev_spec) - self._u.set_mux(usrp.determine_rx_mux_value(self._u, subdev_spec)) - if self._verbose: - print 'RX using', self._subdev.name(), 'daughterboard' - - def pick_subdevice(self): - """ - The user didn't specify a subdevice. - If there's a daughterboard on A, select A. - If there's a daughterboard on B, select B. - Otherwise, select A. - """ - if self._u.db[0][0].dbid() >= 0: # dbid is < 0 if there's no d'board or a problem - return (0, 0) - if self._u.db[1][0].dbid() >= 0: - return (1, 0) - return (0, 0) - - def set_if_rate(self, if_rate): - # If no IF rate specified, set to maximum decimation - if if_rate is None: - self._decim = 256 - else: - self._decim = int(self._u.adc_rate()/if_rate) - - self._u.set_decim_rate(self._decim) - self._if_rate = self._u.adc_rate()/self._decim - - if self._verbose: - print "USRP decimation rate is", self._decim - print "USRP IF rate is", n2s(self._if_rate), "sps" - - def set_gain(self, gain): - # If no gain specified, set to midrange - if gain is None: - g = self._subdev.gain_range() - gain = (g[0]+g[1])/2.0 - self._gain = gain - self._subdev.set_gain(self._gain) - if self._verbose: - print "USRP gain set to", self._gain - - def set_calibration(self, calibration): - self._cal = calibration - if self._verbose: - print "Using frequency calibration offset of", n2s(calibration), "Hz" - - def tune(self, freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @type: 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. - """ - self._tune_result = usrp.tune(self._u, 0, self._subdev, freq+self._cal) - if self._tune_result: - if self._verbose: - print "Baseband frequency is", n2s(self._tune_result.baseband_freq), "Hz" - print "DXC frequency is", n2s(self._tune_result.dxc_freq), "Hz" - print "Center frequency is", n2s(freq), "Hz" - print "Residual frequency is", n2s(self._tune_result.residual_freq), "Hz" - return True - - return False - -if __name__ == '__main__': - src = usrp_source_c(verbose=True) diff --git a/gnuradio-examples/python/usrp/limbo/am_rcv.py b/gnuradio-examples/python/usrp/limbo/am_rcv.py deleted file mode 100755 index 2908dcbf54..0000000000 --- a/gnuradio-examples/python/usrp/limbo/am_rcv.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, eng_notation -from gnuradio import audio -from gnuradio import usrp -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys -import math - -from gnuradio.wxgui import stdgui, fftsink -import wx - -class am_rx_graph (stdgui.gui_flow_graph): - def __init__(self,frame,panel,vbox,argv): - stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv) - - station = parseargs(argv[1:]) - offset_freq = 30e3 - IF_freq = offset_freq - station - - adc_rate = 64e6 - usrp_decim = 250 - if_rate = adc_rate / usrp_decim # 256 kHz - if_decim = 4 - demod_rate = if_rate / if_decim # 64 kHz - audio_decimation = 2 - audio_rate = demod_rate / audio_decimation # 16 kHz - - # usrp is data source - src = usrp.source_c (0, usrp_decim) - src.set_rx_freq (0, IF_freq) - actual_IF_freq =src.rx_freq(0) - actual_offset = actual_IF_freq + station - - #print actual_IF_freq - #print actual_offset - - src.set_pga(0,20) - # sound card as final sink - audio_sink = audio.sink (int (audio_rate)) - - channel_coeffs = \ - gr.firdes.low_pass (1.0, # gain - if_rate, # sampling rate - 9e3, # low pass cutoff freq - 10e3, # width of trans. band - gr.firdes.WIN_HANN) - - ddc = gr.freq_xlating_fir_filter_ccf (if_decim,channel_coeffs,-actual_offset,if_rate) - - magblock = gr.complex_to_mag() - volumecontrol = gr.multiply_const_ff(.003) - - # Deemphasis. Is this necessary on AM? - TAU = 75e-6 # 75us in US, 50us in EUR - fftaps = [ 1 - math.exp(-1/TAU/if_rate), 0] - fbtaps= [ 0 , math.exp(-1/TAU/if_rate) ] - - deemph = gr.iir_filter_ffd(fftaps,fbtaps) - - # compute FIR filter taps for audio filter - width_of_transition_band = audio_rate / 8 - audio_coeffs = gr.firdes.low_pass (1.0, # gain - if_rate, # sampling rate - 9e3, #audio_rate/2 - width_of_transition_band, - 4e3, # width_of_transition_band, - gr.firdes.WIN_HANN) - - # input: float; output: float - audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) - - - - - print len(channel_coeffs) - print len(audio_coeffs) - - # now wire it all together - self.connect (src, ddc) - self.connect (ddc, magblock) - self.connect (magblock, volumecontrol) - self.connect (volumecontrol,deemph) - self.connect (deemph,audio_filter) - self.connect (audio_filter, (audio_sink, 0)) - - if 1: - pre_demod = fftsink.fft_sink_c (self, panel, title="Pre-Demodulation", fft_size=128, sample_rate=if_rate) - self.connect (src, pre_demod) - vbox.Add (pre_demod.win, 1, wx.EXPAND) - - if 0: - post_demod = fftsink.fft_sink_c (self, panel, title="Post Demodulation", fft_size=256, sample_rate=demod_rate) - self.connect (ddc, post_demod) - vbox.Add (post_demod.win, 1, wx.EXPAND) - - if 0: - post_filt = fftsink.fft_sink_f (self, panel, title="Post Filter", fft_size=512, sample_rate=audio_rate) - self.connect (magblock,post_filt) - vbox.Add (post_filt.win, 1, wx.EXPAND) - -def parseargs (args): - nargs = len (args) - if nargs == 1: - freq1 = float (args[0]) * 1e3 - else: - sys.stderr.write ('usage: am_rcv freq1\n') - sys.exit (1) - - return freq1 - -if __name__ == '__main__': - app = stdgui.stdapp (am_rx_graph, "AM RX") - app.MainLoop () - diff --git a/gnuradio-examples/python/usrp/limbo/ayfabtu.dat b/gnuradio-examples/python/usrp/limbo/ayfabtu.dat Binary files differdeleted file mode 100644 index 5c65cf4833..0000000000 --- a/gnuradio-examples/python/usrp/limbo/ayfabtu.dat +++ /dev/null diff --git a/gnuradio-examples/python/usrp/limbo/ayfabtu.py b/gnuradio-examples/python/usrp/limbo/ayfabtu.py deleted file mode 100755 index de6c26f58a..0000000000 --- a/gnuradio-examples/python/usrp/limbo/ayfabtu.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 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. -# - -# -# All Your Frequencies are Belong to Us! -# -# Transmit NBFM message on 25 channels simultaneously! -# - -from gnuradio import gr, gru, eng_notation -from gnuradio import usrp -from gnuradio import audio -from gnuradio import blks -from gnuradio import optfir -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import math -import sys -import random - -from gnuradio.wxgui import stdgui, fftsink -import wx - - -def make_random_complex_tuple(L): - result = [] - for x in range(L): - result.append(complex(random.gauss(0, 1),random.gauss(0, 1))) - - return tuple(result) - -def random_noise_c(): - src = gr.vector_source_c(make_random_complex_tuple(32*1024), True) - return src - - -def plot_taps(taps, sample_rate=2): - return gru.gnuplot_freqz (gru.freqz (taps, 1), sample_rate) - - -class ayfabtu_graph (stdgui.gui_flow_graph): - def __init__(self, frame, panel, vbox, argv): - stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv) - - parser = OptionParser (option_class=eng_option) - parser.add_option ("-c", "--duc-freq", type="eng_float", default=29.325e6, - help="set Tx ddc frequency to FREQ", metavar="FREQ") - (options, args) = parser.parse_args () - - nchan = 25 - IF_GAIN = 80000 - AUDIO_GAIN = 100 - - self.dac_rate = 128e6 - self.usrp_interp = 256 - self.usrp_rate = self.dac_rate / self.usrp_interp # 500 kS/s - self.audio_rate = 32000 # 32 kS/s - - self.audio_src = gr.file_source(gr.sizeof_float, "ayfabtu.dat", True) - - ahp_taps = gr.firdes.high_pass(1, # gain - 32e3, # Fs - 300, # cutoff - 600, # trans width - gr.firdes.WIN_HANN) - self.audio_hp = gr.fir_filter_fff(1, ahp_taps) - - self.audio_gain = gr.multiply_const_ff(AUDIO_GAIN) - - null_src = gr.null_source(gr.sizeof_gr_complex) - #noise_src = gr.noise_source_c(gr.GR_UNIFORM, 1, 0) - noise_src = random_noise_c() - - if 0: - artaps = optfir.low_pass(1, # gain - 2, # Fs - .75/32, # freq1 - 1.0/32, # freq2 - 1, # pb ripple in dB - 50, # stopband atten in dB - 2) # + extra taps - else: - artaps = gr.firdes.low_pass(1, # gain - 32e3*15,# Fs - 2.7e3, # cutoff - .3e3, # trans width - gr.firdes.WIN_HANN) - print "len(artaps) =", len(artaps) - self.audio_resampler = blks.rational_resampler_fff(self, 15, 32, artaps) - - self.fm_mod = blks.nbfm_tx(self, 15000, 15000, max_dev=4.5e3) - - - fbtaps = gr.firdes.low_pass(1, # gain - 25*15e3, # rate - 13e3, # cutoff - 2e3, # trans width - gr.firdes.WIN_HANN) - print "len(fbtabs) =", len(fbtaps) - #self.plot = plot_taps(fbtaps, 25*15e3) - self.filter_bank = blks.synthesis_filterbank(self, nchan, fbtaps) - - self.if_gain = gr.multiply_const_cc(IF_GAIN) - - if 0: - ifrtaps = optfir.low_pass(1, - 2, # Fs - .75/3, # freq1 - 1.0/3, # freq2 - 1, # pb ripple in dB - 50, # stopband atten in dB - 2) # + extra taps - else: - ifrtaps = gr.firdes.low_pass(1, - 2, # Fs - .75/3, # freq1 - .25/3, # trans width - gr.firdes.WIN_HANN) - - - print "len(ifrtaps) =", len(ifrtaps) - self.if_resampler = blks.rational_resampler_ccf(self, 4, 3, ifrtaps) - - - self.u = usrp.sink_c(0, 256) - self.u.set_tx_freq(0, options.duc_freq) - self.u.set_pga(0, self.u.pga_max()) - - # wire it all together - - self.connect(self.audio_src, self.audio_hp, self.audio_gain, - self.audio_resampler, self.fm_mod) - - null_sink = gr.null_sink(gr.sizeof_gr_complex) - - for i in range(nchan): - if True or i == 0: - self.connect(self.fm_mod, (self.filter_bank, i)) - else: - self.connect(null_src, (self.filter_bank, i)) - - self.connect(self.filter_bank, self.if_gain, self.if_resampler, self.u) - - -def main (): - app = stdgui.stdapp (ayfabtu_graph, "All Your Frequency Are Belong to Us") - app.MainLoop () - -if __name__ == '__main__': - main () diff --git a/gnuradio-examples/python/usrp/limbo/flexrf_debug.py b/gnuradio-examples/python/usrp/limbo/flexrf_debug.py deleted file mode 100755 index 13d1db110d..0000000000 --- a/gnuradio-examples/python/usrp/limbo/flexrf_debug.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/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. -# - -from gnuradio import gr, gru -from gnuradio import usrp -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import stdgui, fftsink, scopesink, slider -from optparse import OptionParser -import wx - -class app_flow_graph (stdgui.gui_flow_graph): - def __init__(self, frame, panel, vbox, argv): - stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv) - - self.frame = frame - self.panel = panel - - parser = OptionParser (option_class=eng_option) - parser.add_option ("-d", "--decim", type="int", default=8, - help="set fgpa decimation rate to DECIM") - parser.add_option ("-c", "--ddc-freq", type="eng_float", default=0, - help="set Digital downconverter frequency to FREQ", metavar="FREQ") - parser.add_option ("-f", "--freq", type="eng_float", default=950e6, - help="set RF downconverter frequency to FREQ", metavar="FREQ") - parser.add_option ("-m", "--mux", type="intx", default=0x32103210, - help="set fpga FR_RX_MUX register to MUX") - parser.add_option ("-g", "--gain", type="eng_float", default=0, - help="set Rx PGA gain in dB (default 0 dB)") - (options, args) = parser.parse_args () - - self.u = usrp.source_c (0, options.decim, 1, gru.hexint(options.mux), 0) - - self.u.set_verbose (0) - - input_rate = self.u.adc_freq () / self.u.decim_rate () - - block = fftsink.fft_sink_c (self, panel, fft_size=1024, sample_rate=input_rate) - self.connect (self.u, block) - vbox.Add (block.win, 10, wx.EXPAND) - - if 0: - c2f_1 = gr.complex_to_float () - scope = scopesink.scope_sink_f (self, panel, "Rx Data", input_rate) - vbox.Add (scope.win, 6, wx.EXPAND) - - self.connect (self.u,c2f_1) - self.connect ((c2f_1, 0), (scope, 0)) - self.connect ((c2f_1, 1), (scope, 1)) - - if 0: - rms_complex = gr.rms_cf(.0001) - rms_i = gr.rms_ff(.0001) - rms_q = gr.rms_ff(.0001) - - self.connect(self.u,rms_complex) - self.connect((c2f_1,0),rms_i) - self.connect((c2f_1,1),rms_q) - - ns1 = gr.null_sink(4) - ns2 = gr.null_sink(4) - ns3 = gr.null_sink(4) - - self.connect(rms_complex,ns1) - self.connect(rms_i,ns2) - self.connect(rms_q,ns3) - - # sliders - - #vbox.Add(slider.slider(panel, 0, 104, self.set_gain), 1, wx.ALIGN_CENTER) - - #vbox.Add(slider.slider(panel, 0, 4095, self.set_gain_gc1), 1, wx.ALIGN_CENTER) - #vbox.Add(slider.slider(panel, 0, 31, self.set_gain_gc2), 1, wx.ALIGN_CENTER) - #vbox.Add(slider.slider(panel, 0, 1, self.set_gain_dl), 1, wx.ALIGN_CENTER) - #vbox.Add(slider.slider(panel, 0, 200, self.set_gain_i), 1, wx.ALIGN_CENTER) - #vbox.Add(slider.slider(panel, 0, 200, self.set_gain_q), 1, wx.ALIGN_CENTER) - - self.offset = 0 - #vbox.Add(slider.slider(panel, -200, 200, self.set_offset_i), 1, wx.ALIGN_CENTER) - #vbox.Add(slider.slider(panel, -200, 200, self.set_offset_q), 1, wx.ALIGN_CENTER) - - vbox.Add(slider.slider(panel, 380, 480, self.set_rf_freq), 1, wx.EXPAND|wx.ALIGN_CENTER) - vbox.Add(slider.slider(panel, -32000, +32000, self.set_if_freq), 1, wx.EXPAND|wx.ALIGN_CENTER) - vbox.Add(slider.slider(panel, 0, 4095, self.set_gain), 1, wx.EXPAND|wx.ALIGN_CENTER) - - # build small control area at bottom - hbox = wx.BoxSizer (wx.HORIZONTAL) - hbox.Add ((1, 1), 1, wx.EXPAND) - hbox.Add (wx.StaticText (panel, -1, "Set ddc freq: "), 0, wx.ALIGN_CENTER) - self.tc_freq = wx.TextCtrl (panel, -1, "", style=wx.TE_PROCESS_ENTER) - hbox.Add (self.tc_freq, 0, wx.ALIGN_CENTER) - wx.EVT_TEXT_ENTER (self.tc_freq, self.tc_freq.GetId(), self.handle_text_enter) - hbox.Add ((1, 1), 1, wx.EXPAND) - # add it to the main vbox - vbox.Add (hbox, 0, wx.EXPAND) - - self.update_status_bar () - - def set_rf_freq (self,freq): - (success,actual_freq) = self.set_freq(1e6*freq) - if not success: - print "Failed on ",freq - def set_if_freq (self,freq): - self.u.set_rx_freq(0,freq*1e3) - - def set_gain (self,gain): - self.rfrx.set_gain(gain) - - def set_gain_i (self,gain): - self.u.set_pga(0,gain/10.0) - def set_gain_q (self,gain): - self.u.set_pga(1,gain/10.0) - - def set_offset_i(self,offset): - self.offset = (self.offset & 0x0000ffff) | ((offset&0xffff)<<16) - self.u._write_fpga_reg (3,self.offset) - - def set_offset_q(self,offset): - self.offset = (self.offset & 0xffff0000) | (offset&0xffff) - self.u._write_fpga_reg (3,self.offset) - - def handle_text_enter (self, event): - str = event.GetString () - self.tc_freq.Clear () - self.u.set_rx_freq (0, eng_notation.str_to_num (str)) - self.update_status_bar () - - def update_status_bar (self): - ddc_freq = self.u.rx_freq (0) - decim_rate = self.u.decim_rate () - sample_rate = self.u.adc_freq () / decim_rate - msg = "decim: %d %sS/s DDC: %s" % ( - decim_rate, - eng_notation.num_to_str (sample_rate), - eng_notation.num_to_str (ddc_freq)) - - self.frame.GetStatusBar().SetStatusText (msg, 1) - - def set_gain(self,gain): - assert gain>=0 and gain<4096 - self.u.write_aux_dac(0,0,int(gain)) - -def main (): - app = stdgui.stdapp (app_flow_graph, "USRP FFT") - app.MainLoop () - -if __name__ == '__main__': - main () - - diff --git a/gnuradio-examples/python/usrp/limbo/flexrf_siggen.py b/gnuradio-examples/python/usrp/limbo/flexrf_siggen.py deleted file mode 100755 index 6a59148b88..0000000000 --- a/gnuradio-examples/python/usrp/limbo/flexrf_siggen.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, gru -from gnuradio import usrp -from gnuradio.eng_option import eng_option -from optparse import OptionParser -from gnuradio.wxgui import stdgui, slider -import wx - -class flex_siggen (stdgui.gui_flow_graph): - __slots__ = ['interp', 'waveform_type', 'waveform_ampl', - 'waveform_freq', 'waveform_offset', 'fg', 'usrp', - 'siggen', 'noisegen', 'src', 'file_sink' ] - - def __init__ (self,frame,panel,vbox,argv): - stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv) - - self.frame = frame - self.panel = panel - - parser = OptionParser (option_class=eng_option) - parser.add_option ("-a", "--amplitude", type="int", default=32000, - help="amplitude") - parser.add_option ("-i", "--interp", type="int", default=64, - help="set fpga interpolation rate to INTERP") - parser.add_option ("-n", "--nchannels", type="int", default=1, - help="set number of output channels to NCHANNELS") - (options, args) = parser.parse_args () - - self.waveform_type = gr.GR_CONST_WAVE - self.waveform_ampl = options.amplitude - self.waveform_freq = 100.12345e3 - self.waveform_offset = 0 - - self.interp = options.interp - self._instantiate_blocks () - self.usrp.set_nchannels (options.nchannels) - - self.dboard=self.usrp.db[0][0] - - self.set_waveform_type (self.waveform_type) - vbox.Add(slider.slider(panel, 390, 510, self.set_rf_freq), 1, wx.EXPAND|wx.ALIGN_CENTER) - vbox.Add(slider.slider(panel, -45000, +45000, self.set_if_freq), 1, wx.EXPAND|wx.ALIGN_CENTER) - #vbox.Add(slider.slider(panel, 0, 4095, self.set_gain), 1, wx.EXPAND|wx.ALIGN_CENTER) - - def usb_freq (self): - return self.usrp.dac_freq() / self.interp - - def usb_throughput (self): - return self.usb_freq () * 4 - - def set_waveform_type (self, type): - ''' - valid waveform types are: gr.GR_SIN_WAVE, gr.GR_CONST_WAVE, - gr.GR_UNIFORM and gr.GR_GAUSSIAN - ''' - self._configure_graph (type) - self.waveform_type = type - - def set_waveform_ampl (self, ampl): - self.waveform_ampl = ampl - self.siggen.set_amplitude (ampl) - self.noisegen.set_amplitude (ampl) - - def set_waveform_freq (self, freq): - self.waveform_freq = freq - self.siggen.set_frequency (freq) - - def set_if_freq (self, freq): - self.if_freq = freq - self.usrp.set_tx_freq (0,freq*1e3) - - def set_rf_freq (self, freq): - self.rf_freq = freq - (success,actual_freq) = self.dboard.set_freq (freq*1e6) - if not success: - print "Failed on ", freq - - def set_waveform_offset (self, offset): - self.waveform_offset = offset - self.siggen.set_offset (offset) - - def set_interpolator (self, interp): - self.interp = interp - self.siggen.set_sampling_freq (self.usb_freq ()) - self.usrp.set_interp_rate (interp) - - def set_duc_freq (self, freq): - self.usrp.set_tx_freq (0, freq) - - def _instantiate_blocks (self): - self.src = None - self.usrp = usrp.sink_c (0, self.interp) - - self.siggen = gr.sig_source_c (self.usb_freq (), - gr.GR_SIN_WAVE, - self.waveform_freq, - self.waveform_ampl, - self.waveform_offset) - - self.noisegen = gr.noise_source_c (gr.GR_UNIFORM, - self.waveform_ampl) - print "done" - - def _configure_graph (self, type): - was_running = self.is_running () - if was_running: - self.stop () - self.disconnect_all () - if type == gr.GR_SIN_WAVE or type == gr.GR_CONST_WAVE: - self.connect (self.siggen, self.usrp) - self.siggen.set_waveform (type) - self.src = self.siggen - elif type == gr.GR_UNIFORM or type == gr.GR_GAUSSIAN: - self.connect (self.noisegen, self.usrp) - self.noisegen.set_type (type) - self.src = self.noisegen - else: - raise ValueError, type - if was_running: - self.start () - - -if __name__ == '__main__': - parser = OptionParser (option_class=eng_option) - parser.add_option ("--sine", dest="type", action="store_const", const=gr.GR_SIN_WAVE, - help="generate a complex sinusoid [default]", default=gr.GR_SIN_WAVE) - parser.add_option ("--const", dest="type", action="store_const", const=gr.GR_CONST_WAVE, - help="generate a constant output") - parser.add_option ("--gaussian", dest="type", action="store_const", const=gr.GR_GAUSSIAN, - help="generate Gaussian random output") - parser.add_option ("--uniform", dest="type", action="store_const", const=gr.GR_UNIFORM, - help="generate Uniform random output") - parser.add_option ("-f", "--freq", type="eng_float", default=100e3, - help="set waveform frequency to FREQ") - parser.add_option ("-r", "--rf-freq", type="eng_float", default=910e6, - help="set waveform frequency to FREQ") - parser.add_option ("-a", "--amplitude", type="eng_float", default=16e3, - help="set waveform amplitude to AMPLITUDE", metavar="AMPL") - parser.add_option ("-o", "--offset", type="eng_float", default=0, - help="set waveform offset to OFFSET") - parser.add_option ("-c", "--duc-freq", type="eng_float", default=0, - help="set Tx DUC frequency to FREQ", metavar="FREQ") - parser.add_option ("-m", "--mux", type="intx", default=0x98, - help="set output mux register") - - app = stdgui.stdapp (flex_siggen, "USRP FlexRF Siggen") - app.MainLoop () |