diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-17 17:45:38 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-17 17:45:38 -0400 |
commit | cab7429540a5790d4fe0997c3fa056386ebaca5f (patch) | |
tree | b59758de225fe8ae83127cbeb42f377907073852 /gnuradio-core/src/python | |
parent | 1521e18e41d888dc938f88f92d051875a90e6cde (diff) |
core: removed i2c, sdr1000, microtune code.
Diffstat (limited to 'gnuradio-core/src/python')
-rwxr-xr-x | gnuradio-core/src/python/bin/microtune.py | 42 | ||||
-rw-r--r-- | gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py | 186 | ||||
-rw-r--r-- | gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py | 84 |
4 files changed, 0 insertions, 314 deletions
diff --git a/gnuradio-core/src/python/bin/microtune.py b/gnuradio-core/src/python/bin/microtune.py deleted file mode 100755 index fbe743f396..0000000000 --- a/gnuradio-core/src/python/bin/microtune.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- - -from gnuradio import gr -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import stdgui, fftsink -from optparse import OptionParser -from gnuradio import eng_notation - - -def main (): - parser = OptionParser (option_class=eng_option) - parser.add_option ("-g", "--gain", type="eng_float", default=-1, - help="set front end gain to GAIN [0,1000]") - parser.add_option ("-f", "--freq", type="eng_float", default=-1, - help="set front end center frequency to FREQ") - parser.add_option ("-t", "--type", type="string", default="4937", - help="select eval board type {4937 or 4702}") - parser.add_option ("-p", "--port", type="int", default=0, - help="parallel port eval board is attached to") - (options, args) = parser.parse_args () - - if options.type == "4937": - front_end = gr.microtune_4937_eval_board (options.port) - elif options.type == "4702": - front_end = gr.microtune_4702_eval_board (options.port) - else: - raise RuntimeError, "Invalid board type. Must be either -t 4937 or -t 4702" - - if options.gain != -1: - front_end.set_AGC (options.gain) - - if options.freq != -1: - if options.freq < 1e6: - options.freq = options.freq * 1e6 - - actual = front_end.set_RF_freq (options.freq) - print "microtune: actual freq = %s" % (eng_notation.num_to_str (actual),) - - -if __name__ == '__main__': - main () diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt index 7d48f35121..d77da24073 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt +++ b/gnuradio-core/src/python/gnuradio/gruimpl/CMakeLists.txt @@ -26,10 +26,8 @@ GR_PYTHON_INSTALL(FILES hexint.py listmisc.py mathmisc.py - lmx2306.py msgq_runner.py os_read_exactly.py - sdr_1000.py seq_with_cursor.py socket_stuff.py daemon.py diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py b/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py deleted file mode 100755 index aa4efc3e9c..0000000000 --- a/gnuradio-core/src/python/gnuradio/gruimpl/lmx2306.py +++ /dev/null @@ -1,186 +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. -# - -'''Control National LMX2306 based frequency synthesizer''' - -from gnuradio import gr -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# bottom two bits of 21 bit word select which register to program - -R_REG = 0x0 -AB_REG = 0x1 -F_REG = 0x2 - -F_counter_reset = (1 << 2) -F_phase_detector_polarity = (1 << 7) - -F_LD_tri_state = (0 << 4) -F_LD_R_divider_output = (4 << 4) -F_LD_N_divider_output = (2 << 4) -F_LD_serial_data_output = (6 << 4) -F_LD_digital_lock_detect = (1 << 4) -F_LD_open_drain = (5 << 4) -F_LD_high = (3 << 4) -F_LD_low = (7 << 4) - -# F_default = F_LD_digital_lock_detect | F_phase_detector_polarity -F_default = F_LD_open_drain | F_phase_detector_polarity - -# -# 4 control pins: -# CE always high -# LE load enable. When LE goes high, data stored in the shift register -# is loaded into one of the three registers -# CLK data is clocked in on the rising edge -# DATA single data bit. Entered MSB first - -DB_CLK = (1 << 0) -DB_DATA = (1 << 1) -DB_LE = (1 << 2) -DB_CE = (1 << 3) - -class lmx2306 (object): - '''Control the National LMX2306 PLL''' - __slots__ = ['pp', 'shadow', 'fosc', 'r', 'step_size', 'verbose'] - def __init__ (self, fosc, step_size, which_pp = 0): - '''FOSC is the frequency of the reference oscillator, - STEP_SIZE is the step between valid frequencies, - WHICH_PP specifies which parallel port to use - ''' - self.pp = gr.make_ppio (which_pp) - self.shadow = DB_CE - self.pp.lock () - self.pp.write_data (self.shadow) - self.pp.unlock () - self.verbose = False - self._set_fosc (fosc) - self._set_step (step_size) - - - def program (self, r, a, b): - if self.verbose: - print "lmx2306: r = %d a = %d b = %d" % (r, a, b) - self.pp.lock () - self._write_word (F_REG | F_default | F_counter_reset) - self._write_word (R_REG | ((r & 0x3fff) << 2)) - self._write_word (AB_REG | ((a & 0x1f) << 2) | ((b & 0x1fff) << 7)) - self._write_word (F_REG | F_default) - self.pp.unlock () - - def set_freq (self, freq): - '''Set the PLL frequency to FREQ - - Return the actual freq value set. It will be rounded down to a - multiple of step_size - ''' - divisor = int (freq / self.step_size) - actual = divisor * self.step_size - (a, b) = self._compute_ab (divisor) - self.program (self.r, a, b) - return actual - - # ---------------------------------------------------------------- - - def _set_fosc (self, ref_oscillator_freq): - self.fosc = ref_oscillator_freq - - def _set_step (self, step_size): - r = int (self.fosc / step_size) - if r * step_size != self.fosc: - raise ValueError, "step_size is not a factor of self.fosc" - if r < 3 or r > 16383: - raise ValueError, "r is out of range" - self.r = r - self.step_size = step_size - - def _compute_ab (self, divisor): - b = divisor / 8 - a = divisor - (b * 8) - if b < 3 or b > 8191 or a > b: - raise ValueError, "Invalid divisor" - return (a, b) - - def _write_word (self, w): - for i in range(21): - if w & (1 << 20): - self._set_DATA_1 () - else: - self._set_DATA_0 () - w = (w << 1) & 0x0ffffff - self._set_CLK_1 () - self._set_CLK_0 () - self._set_LE_1 () - self._set_LE_0 () - - def _set_LE_0 (self): - self.shadow = self.shadow & ~DB_LE - self.pp.write_data (self.shadow) - - def _set_LE_1 (self): - self.shadow = self.shadow | DB_LE - self.pp.write_data (self.shadow) - - def _set_CLK_0 (self): - self.shadow = self.shadow & ~DB_CLK - self.pp.write_data (self.shadow) - - def _set_CLK_1 (self): - self.shadow = self.shadow | DB_CLK - self.pp.write_data (self.shadow) - - def _set_DATA_0 (self): - self.shadow = self.shadow & ~DB_DATA - self.pp.write_data (self.shadow) - - def _set_DATA_1 (self): - self.shadow = self.shadow | DB_DATA - self.pp.write_data (self.shadow) - -if __name__ == '__main__': - parser = OptionParser (option_class=eng_option) - parser.add_option ("-o", "--fosc", type="eng_float", default=32e6, - help="set reference oscillator freq to FREQ", metavar="FREQ") - parser.add_option ("-s", "--step-size", type="eng_float", default=10e3, - help="set the frequency step size to STEP_SIZE") - parser.add_option ("-f", "--freq", type="eng_float", default=430e6, - help="set VCO frequency to FREQ") - parser.add_option ("-v", "--verbose", action="store_true", default=False) - (options, args) = parser.parse_args () - - if options.verbose: - print "fosc = %s step = %s fvco = %s" % ( - eng_notation.num_to_str (options.fosc), - eng_notation.num_to_str (options.step_size), - eng_notation.num_to_str (options.freq)) - - lmx = lmx2306 (options.fosc, options.step_size) - lmx.verbose = options.verbose - - actual = lmx.set_freq (options.freq) - - if options.verbose: - print "fvco_actual = %s delta = %s" % ( - eng_notation.num_to_str (actual), - eng_notation.num_to_str (options.freq - actual)) diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py b/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py deleted file mode 100644 index 5192a71554..0000000000 --- a/gnuradio-core/src/python/gnuradio/gruimpl/sdr_1000.py +++ /dev/null @@ -1,84 +0,0 @@ -# -# Copyright 2003,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 - -class sdr_1000 (gr.sdr_1000_base): - "Control the DDS on the SDR-1000" - def __init__(self, pport = 0): - gr.sdr_1000_base.__init__(self, pport) - self.write_latch (3, 0x00, 0xC0) # Reset low, WRS/ low - self.write_reg (0x20, 0x40) - - def write_reg(self, addr, data): - self.write_latch (3, addr & 0x3f, 0x3f) - self.write_latch (2, data, 0xff) - self.write_latch (3, 0x40, 0x40) - self.write_latch (3, 0x00, 0x40) - - def set_freq(self, freq): - self.set_band (freq) - ftw = freq / 200e6; - for i in xrange(6): - word = int(ftw * 256) - ftw = ftw*256 - word - # print (('%d [%02x]') % (i, word)) - self.write_reg (4+i, word) - - def set_band (self, freq): - if freq <= 2.25e6: - band = 0 - elif freq <= 5.5e6: - band = 1 - elif freq <= 11e6: - band = 3 # due to wiring mistake on board - elif freq <= 22e6: - band = 2 # due to wiring mistake on board - elif freq <= 37.5e6: - band = 4 - else: - band = 5 - - self.write_latch (1, 1 << band, 0x3f) - - def set_bit (self, reg, bit, state): - val = 0x00 - if state: val = 1<<bit - self.write_latch (reg, val, 1<<bit) - - def set_tx (self, on = 1): - self.set_bit(1, 6, on) - - def set_rx (self): - self.set_bit(1, 6, 0) - - def set_gain (self, high): - self.set_bit(0, 7, high) - - def set_mute (self, mute = 1): - self.set_bit(1, 7, mute) - - def set_unmute (self): - self.set_bit(1, 7, 0) - - def set_external_pin (self, pin, on = 1): - assert (pin < 8 and pin > 0), "Out of range 1..7" - self.set_bit(0, pin-1, on) |