diff options
Diffstat (limited to 'gnuradio-core/src')
39 files changed, 0 insertions, 2953 deletions
diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt index 7aeea798cd..ee8e9befa5 100644 --- a/gnuradio-core/src/lib/io/CMakeLists.txt +++ b/gnuradio-core/src/lib/io/CMakeLists.txt @@ -29,14 +29,6 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_guts.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_f.cc ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_x.cc - ${CMAKE_CURRENT_SOURCE_DIR}/i2c.cc - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bitbang.cc - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio.cc - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio_pp.cc - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4702.cc - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4937.cc - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_xxxx.cc - ${CMAKE_CURRENT_SOURCE_DIR}/ppio_ppdev.cc ) ######################################################################## @@ -48,15 +40,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_f.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_oscope_sink_x.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_trigger_mode.h - ${CMAKE_CURRENT_SOURCE_DIR}/i2c.h - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bitbang.h - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio.h - ${CMAKE_CURRENT_SOURCE_DIR}/i2c_bbio_pp.h - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4702.h - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_4937.h - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_eval_board_defs.h - ${CMAKE_CURRENT_SOURCE_DIR}/microtune_xxxx.h - ${CMAKE_CURRENT_SOURCE_DIR}/ppio_ppdev.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel" ) @@ -73,22 +56,3 @@ install(FILES COMPONENT "core_swig" ) endif(ENABLE_PYTHON) - -######################################################################## -# Handle triple-threat files that have cc, h, and i -######################################################################## -set(gr_core_io_triple_threats - microtune_xxxx_eval_board - microtune_4702_eval_board - microtune_4937_eval_board - ppio - sdr_1000 -) - -foreach(file_tt ${gr_core_io_triple_threats}) - list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.cc) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel") - if(ENABLE_PYTHON) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file_tt}.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig") - endif(ENABLE_PYTHON) -endforeach(file_tt ${gr_core_io_triple_threats}) diff --git a/gnuradio-core/src/lib/io/i2c.cc b/gnuradio-core/src/lib/io/i2c.cc deleted file mode 100644 index 02dd47b53e..0000000000 --- a/gnuradio-core/src/lib/io/i2c.cc +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#include "i2c.h" - -i2c::~i2c () -{ - // NOP -} diff --git a/gnuradio-core/src/lib/io/i2c.h b/gnuradio-core/src/lib/io/i2c.h deleted file mode 100644 index 6b7f25a293..0000000000 --- a/gnuradio-core/src/lib/io/i2c.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifndef INCLUDED_I2C_H -#define INCLUDED_I2C_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class i2c; -typedef boost::shared_ptr<i2c> i2c_sptr; - -/*! - * \brief abstract class for controlling i2c bus - */ -class GR_CORE_API i2c { - public: - - i2c () {} - virtual ~i2c (); - - //! \returns true iff successful - virtual bool write (int addr, const unsigned char *buf, int nbytes) = 0; - - //! \returns number of bytes read or -1 if error - virtual int read (int addr, unsigned char *buf, int max_bytes) = 0; -}; - -#endif /* INCLUDED_I2C_H */ - diff --git a/gnuradio-core/src/lib/io/i2c_bbio.cc b/gnuradio-core/src/lib/io/i2c_bbio.cc deleted file mode 100644 index ddd00290d0..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bbio.cc +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#include "i2c_bbio.h" - -i2c_bbio::~i2c_bbio () -{ - // NOP -} - diff --git a/gnuradio-core/src/lib/io/i2c_bbio.h b/gnuradio-core/src/lib/io/i2c_bbio.h deleted file mode 100644 index 6bf47b9cd0..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bbio.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifndef INCLUDED_I2C_BBIO_H -#define INCLUDED_I2C_BBIO_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class i2c_bbio; -typedef boost::shared_ptr<i2c_bbio> i2c_bbio_sptr; - - -/*! - * \brief abstract class that implements bit banging i/o for i2c bus. - * \ingroup base - */ -class GR_CORE_API i2c_bbio { - public: - - i2c_bbio () {} - virtual ~i2c_bbio (); - - virtual void set_scl (bool state) = 0; - virtual void set_sda (bool state) = 0; - virtual bool get_sda () = 0; - - virtual void lock () = 0; - virtual void unlock () = 0; -}; - -#endif /* INCLUDED_I2C_BBIO_H */ diff --git a/gnuradio-core/src/lib/io/i2c_bbio_pp.cc b/gnuradio-core/src/lib/io/i2c_bbio_pp.cc deleted file mode 100644 index 382bb6b378..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bbio_pp.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#include "i2c_bbio_pp.h" -#include "microtune_eval_board_defs.h" - -i2c_bbio_pp::i2c_bbio_pp (ppio_sptr pp) -{ - d_pp = pp; - d_pp->lock (); - d_pp->write_control (d_pp->read_control () & ~UT_CP_MUST_BE_ZERO); // output, no interrupts - d_pp->unlock (); -} - -i2c_bbio_sptr -make_i2c_bbio_pp (ppio_sptr pp) -{ - return i2c_bbio_sptr (new i2c_bbio_pp (pp)); -} - -void -i2c_bbio_pp::set_scl (bool state) -{ - int r = d_pp->read_control(); - - if (!state){ // active low - d_pp->write_control (r | UT_CP_TUNER_SCL); - } - else { - d_pp->write_control (r & ~UT_CP_TUNER_SCL); - } - d_pp->read_control (); // use for 1us delay - d_pp->read_control (); // use for 1us delay -} - -void -i2c_bbio_pp::set_sda (bool state) -{ - int r = d_pp->read_data (); - - if (!state){ // active low - d_pp->write_data (r | UT_DP_TUNER_SDA_OUT); - } - else { - d_pp->write_data (r & ~UT_DP_TUNER_SDA_OUT); - } - d_pp->read_data (); // use for 1us delay - d_pp->read_data (); // use for 1us delay -} - -bool -i2c_bbio_pp::get_sda () -{ - int r = d_pp->read_status (); - return (r & UT_SP_TUNER_SDA_IN) == 0; // eval board has an inverter on it -} - -void -i2c_bbio_pp::lock () -{ - d_pp->lock (); -} - -void -i2c_bbio_pp::unlock () -{ - d_pp->unlock (); -} diff --git a/gnuradio-core/src/lib/io/i2c_bbio_pp.h b/gnuradio-core/src/lib/io/i2c_bbio_pp.h deleted file mode 100644 index 2391bc1fc0..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bbio_pp.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifndef INCLUDED_I2C_BBIO_PP_H -#define INCLUDED_I2C_BBIO_PP_H - -#include <gr_core_api.h> -#include "i2c_bbio.h" -#include "ppio.h" - -/*! - * \brief concrete class that bit bangs eval board i2c bus using parallel port - * - * \ingroup base - * This class talks to the i2c bus on the microtune eval board using - * the parallel port. This works for both the 4937 and 4702 boards. - */ -class GR_CORE_API i2c_bbio_pp : public i2c_bbio { - friend GR_CORE_API i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp); - i2c_bbio_pp (ppio_sptr pp); - - public: - - virtual void set_scl (bool state); - virtual void set_sda (bool state); - virtual bool get_sda (); - - virtual void lock (); - virtual void unlock (); - - private: - ppio_sptr d_pp; -}; - -GR_CORE_API i2c_bbio_sptr make_i2c_bbio_pp (ppio_sptr pp); - - -#endif /* INCLUDED_I2C_BBIO_PP_H */ diff --git a/gnuradio-core/src/lib/io/i2c_bitbang.cc b/gnuradio-core/src/lib/io/i2c_bitbang.cc deleted file mode 100644 index eb801c68f5..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bitbang.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#include "i2c_bitbang.h" - -i2c_bitbang::i2c_bitbang (i2c_bbio_sptr io) -{ - d_io = io; - d_io->lock (); - - stop (); // get bus in known state - - d_io->unlock (); -} - -i2c_sptr -make_i2c_bitbang (i2c_bbio_sptr io) -{ - return i2c_sptr (new i2c_bitbang (io)); -} - - -// start: -// entry: SCL = 1, SDA = 1 -// exit: SCL = 0, SDA = 0 - -void -i2c_bitbang::start () -{ - set_sda (1); - set_scl (1); - set_sda (0); // SDA high -> low while SCL high - set_scl (0); -} - - -// stop: -// entry: SCL = X, SDA = X -// exit: SCL = 1, SDA = 1 - -void -i2c_bitbang::stop () -{ - set_scl (0); - set_sda (0); - set_scl (1); - set_sda (1); // SDA low -> high while SCL high -} - - -// write_bit: -// entry: SCL = 0, SDA = X -// exit: SCL = 0, SDA = X - -void -i2c_bitbang::write_bit (bool bit) -{ - set_sda (bit); - set_scl (1); - set_scl (0); -} - - -// write_byte: -// entry: SCL = 0, SDA = X -// exit: SCL = 0, SDA = 1 - -bool -i2c_bitbang::write_byte (char t) -{ - int i; - bool ack_bit; - - for (i = 0; i < 8; i++){ - write_bit (t & 0x80); - t <<= 1; - } - - // clock #9. This is the ACK bit. - - set_sda (1); // tristate SDA - set_scl (1); - ack_bit = get_sda (); // slave should pull SDA line low - set_scl (0); - - return ack_bit == 0; -} - - -// write: the high level entry point... -// entry: SCL = 1, SDA = 1 -// exit: SCL = 1, SDA = 1 - -bool -i2c_bitbang::write (int addr, const unsigned char *buf, int nbytes) -{ - bool ok = true; - - d_io->lock (); - start (); - ok = write_byte ((addr << 1) | 0); // addr plus "read opcode" - - for (int i = 0; i < nbytes; i++) - ok &= write_byte (buf[i]); - - stop (); - d_io->unlock (); - return ok; -} - - -// read: the high level entry point... -// entry: SCL = 1, SDA = 1 -// exit: SCL = 1, SDA = 1 - -int -i2c_bitbang::read (int addr, unsigned char *buf, int max_bytes) -{ - d_io->lock (); - - // FIXME - - d_io->unlock (); - return -1; -} diff --git a/gnuradio-core/src/lib/io/i2c_bitbang.h b/gnuradio-core/src/lib/io/i2c_bitbang.h deleted file mode 100644 index 1d6fe5044e..0000000000 --- a/gnuradio-core/src/lib/io/i2c_bitbang.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifndef INCLUDED_I2C_BITBANG_H -#define INCLUDED_I2C_BITBANG_H - -#include <gr_core_api.h> -#include <i2c.h> -#include <i2c_bbio.h> - -/*! - * \brief class for controlling i2c bus - * \ingroup base - */ -class GR_CORE_API i2c_bitbang : public i2c { - friend GR_CORE_API i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io); - i2c_bitbang (i2c_bbio_sptr io); - - public: - ~i2c_bitbang () {} - - //! \returns true iff successful - bool write (int addr, const unsigned char *buf, int nbytes); - - //! \returns number of bytes read or -1 if error - int read (int addr, unsigned char *buf, int max_bytes); - - -private: - void start (); - void stop (); - void write_bit (bool bit); - bool write_byte (char byte); - - void set_sda (bool bit) { d_io->set_sda (bit); } - void set_scl (bool bit) { d_io->set_scl (bit); } - bool get_sda () { return d_io->get_sda (); } - - i2c_bbio_sptr d_io; -}; - -GR_CORE_API i2c_sptr make_i2c_bitbang (i2c_bbio_sptr io); - -#endif /* INCLUDED_I2C_BITBANG_H */ - - diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i index 6cd3e06f47..2c8def973c 100644 --- a/gnuradio-core/src/lib/io/io.i +++ b/gnuradio-core/src/lib/io/io.i @@ -27,20 +27,11 @@ #endif #include <gr_histo_sink_f.h> -#include <microtune_4702_eval_board.h> -#include <microtune_4937_eval_board.h> -#include <sdr_1000.h> #include <gr_oscope_sink_x.h> #include <gr_oscope_sink_f.h> -#include <ppio.h> %} %include "gr_histo_sink.i" -%include "microtune_xxxx_eval_board.i" -%include "microtune_4702_eval_board.i" -%include "microtune_4937_eval_board.i" -%include "sdr_1000.i" %include "gr_oscope_sink.i" -%include "ppio.i" diff --git a/gnuradio-core/src/lib/io/microtune_4702.cc b/gnuradio-core/src/lib/io/microtune_4702.cc deleted file mode 100644 index 3ec072d51b..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702.cc +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- c++-*- */ -/* - * Copyright 2001,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. - */ - -#include "microtune_4702.h" -#include <stdlib.h> -#include <stdio.h> -#include "i2c.h" - -static const double FIRST_IF = 36.00e6; - -// The tuner internally has 3 bands: VHF Low, VHF High & UHF. -// These are the recommened boundaries -static const double VHF_High_takeover = 174e6; -static const double UHF_takeover = 470e6; - -static int PLL_I2C_ADDR = 0x60; - -static unsigned char -control_byte_1 (bool prescaler, int reference_divisor) -{ - int c = 0x80; - //Note: Last two divider bits (bits 2 and 3 of this byte) determined later - if (prescaler) - c |= 0x10; - - switch (reference_divisor){ - case 2: - c |= 0x00; break; - case 4: - c |= 0x01; break; - case 8: - c |= 0x02; break; - case 16: - c |= 0x03; break; - case 32: - c |= 0x04; break; - case 64: - c |= 0x05; break; - case 128: - c |= 0x06; break; - case 256: - c |= 0x07; break; - case 24: - c |= 0x08; break; - case 5: - c |= 0x09; break; - case 10: - c |= 0x0A; break; - case 20: - c |= 0x0B; break; - case 40: - c |= 0x0C; break; - case 80: - c |= 0x0D; break; - case 160: - c |= 0x0E; break; - case 320: - c |= 0x0F; break; - default: - abort (); - } - return c; -} - -static unsigned char -control_byte_2 (double target_freq) -{ - int c; - - if (target_freq < VHF_High_takeover) // VHF low - c = 0x8E; - - else if (target_freq < UHF_takeover){ // VHF high - c = 0x05; - if (target_freq < 390e6) - c |= 0x40; - else - c |= 0x80; - } - else { // UHF - c = 0x03; - if (target_freq < 750e6) - c |= 0x80; - else - c |= 0xC0; - } - - return c; -} - - -microtune_4702::microtune_4702 (i2c_sptr i2c, int i2c_addr) -{ - d_i2c = i2c; - d_i2c_addr = i2c_addr; - d_reference_divider = 320; - d_prescaler = false; -} - -microtune_4702::~microtune_4702 () -{ - // nop -} - -/*! - * \brief select RF frequency to be tuned to output frequency. - * \p target_freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ -bool -microtune_4702::set_RF_freq (double target_freq, double *p_actual_freq) -{ - unsigned char buf[4]; - - double target_f_osc = target_freq + FIRST_IF; - - double f_ref = 4e6 / d_reference_divider; - - //int divisor = (int) ((target_f_osc + (f_ref * 4)) / (f_ref * 8)); - - long int divisor = (long int) (target_f_osc / f_ref); - double actual_freq = (f_ref * divisor) - FIRST_IF; - if (p_actual_freq != 0) - *p_actual_freq = actual_freq; - - if ((divisor & ~0x1ffff) != 0) // >17 bit divisor - return false; - - buf[0] = ((divisor & 0x07f00) >> 8) & 0xff; // DB1 - buf[1] = divisor & 0xff; // DB2 - buf[2] = control_byte_1 (d_prescaler, d_reference_divider); - buf[2] = buf[2] | (((divisor & 0x18000) >> 10) & 0xff); - buf[3] = control_byte_2 (target_freq); - - printf ("%x\n", PLL_I2C_ADDR); -//#if 0 - printf ("set_RF_freq: target: %g MHz actual: %g MHz %02x %02x %02x %02x\n", - target_freq/1e6, actual_freq/1e6, buf[0], buf[1], buf[2], buf[3]); -//#endif - - return d_i2c->write (d_i2c_addr, buf, sizeof (buf)); -} - -/*! - * \returns true iff PLL is locked - */ -bool -microtune_4702::pll_locked_p () -{ - // FIXME - return true; -} - -/*! - * \returns the output frequency of the tuner in Hz. - */ -double -microtune_4702::get_output_freq () -{ - return FIRST_IF; -} diff --git a/gnuradio-core/src/lib/io/microtune_4702.h b/gnuradio-core/src/lib/io/microtune_4702.h deleted file mode 100644 index ccc66db71e..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003 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. - */ - -#ifndef INCLUDED_MICROTUNE_4702_H -#define INCLUDED_MICROTUNE_4702_H - -#include <gr_core_api.h> -#include <microtune_xxxx.h> - -/*! - * \brief class for controlling microtune 4702 tuner module - * \ingroup hardware - */ - -class GR_CORE_API microtune_4702 : public microtune_xxxx { -public: - microtune_4702 (i2c_sptr i2c, int i2c_addr); - - virtual ~microtune_4702 (); - - /*! - * \brief select RF frequency to be tuned to output frequency. - * \p freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ - bool set_RF_freq (double freq, double *actual_freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency of the tuner in Hz. - */ - double get_output_freq (); - - private: - - i2c_sptr d_i2c; - int d_i2c_addr; - int d_reference_divider; - bool d_prescaler; /* if set, higher charge pump current: - faster tuning, worse phase noise - for distance < 10kHz to the carrier */ -}; - -#endif /* INCLUDED_MICROTUNE_4702_H */ - diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc b/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc deleted file mode 100644 index f6c68726b5..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702_eval_board.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#include "microtune_4702_eval_board.h" -#include "microtune_eval_board_defs.h" -#include "ppio.h" -#include "microtune_4702.h" - -static const int TUNER_I2C_ADDR = 0x60; - -microtune_4702_eval_board::microtune_4702_eval_board (int which_pp) - : microtune_xxxx_eval_board (which_pp) -{ - d_tuner = new microtune_4702 (d_i2c, TUNER_I2C_ADDR); -} - -microtune_4702_eval_board::~microtune_4702_eval_board () -{ - // default is OK -} - -static const float RF_MIN_V = 1.0; // RF AGC control voltages -static const float RF_MAX_V = 4.0; -static const float IF_MIN_V = 2.0; // IF AGC control voltages -static const float IF_MAX_V = 4.0; - -static const float MIN_AGC = 0; // bottom of synthetic range -static const float MAX_AGC = 1000; // top of synthetic range - -static const float CUTOVER_POINT = 667; - - -// linear is in the range MIN_AGC to MAX_AGC - -static float -linear_to_RF_AGC_voltage (float linear) -{ - if (linear >= CUTOVER_POINT) - return RF_MAX_V; - - float slope = (RF_MAX_V - RF_MIN_V) / CUTOVER_POINT; - return RF_MIN_V + linear * slope; -} - -static float -linear_to_IF_AGC_voltage (float linear) -{ - if (linear < CUTOVER_POINT) - return IF_MIN_V; - - float slope = (IF_MAX_V - IF_MIN_V) / (MAX_AGC - CUTOVER_POINT); - return IF_MIN_V + (linear - CUTOVER_POINT) * slope; -} - -void -microtune_4702_eval_board::set_AGC (float v) -{ - if (v < MIN_AGC) - v = MIN_AGC; - - if (v > MAX_AGC) - v = MAX_AGC; - - float rf_agc_voltage = linear_to_RF_AGC_voltage (v); - float if_agc_voltage = linear_to_IF_AGC_voltage (v); - - set_RF_AGC_voltage (rf_agc_voltage); - set_IF_AGC_voltage (if_agc_voltage); -} diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.h b/gnuradio-core/src/lib/io/microtune_4702_eval_board.h deleted file mode 100644 index d866a4b943..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702_eval_board.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifndef INCLUDED_MICROTUNE_4702_EVAL_BOARD_H -#define INCLUDED_MICROTUNE_4702_EVAL_BOARD_H - -#include <gr_core_api.h> -#include "microtune_xxxx_eval_board.h" - -/*! - * \brief control microtune 4702 eval board - * \ingroup hardware - */ - -class GR_CORE_API microtune_4702_eval_board : public microtune_xxxx_eval_board { -public: - microtune_4702_eval_board (int which_pp = 0); - ~microtune_4702_eval_board (); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000); -}; - -#endif /* INCLUDED_MICROTUNE_4702_EVAL_BOARD_H */ diff --git a/gnuradio-core/src/lib/io/microtune_4702_eval_board.i b/gnuradio-core/src/lib/io/microtune_4702_eval_board.i deleted file mode 100644 index fc085a9756..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4702_eval_board.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,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. - */ - -class microtune_4702_eval_board : public microtune_xxxx_eval_board { -public: - microtune_4702_eval_board (int which_pp = 0); - ~microtune_4702_eval_board (); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000); -}; diff --git a/gnuradio-core/src/lib/io/microtune_4937.cc b/gnuradio-core/src/lib/io/microtune_4937.cc deleted file mode 100644 index 72ddd4bb62..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937.cc +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- c++-*- */ -/* - * Copyright 2001,2003 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. - */ - -#include "microtune_4937.h" -#include <stdlib.h> -#include <stdio.h> -#include <i2c.h> - -static const double first_IF = 43.75e6; - -// The tuner internally has 3 bands: VHF Low, VHF High & UHF. -// These are the recommened boundaries -static const double VHF_High_takeover = 158e6; -static const double UHF_takeover = 464e6; - - -static unsigned char -control_byte_1 (bool fast_tuning_p, int reference_divisor) -{ - int c = 0x88; - - if (fast_tuning_p) - c |= 0x40; - - switch (reference_divisor){ - case 512: - c |= 0x3 << 1; break; - case 640: - c |= 0x0 << 1; break; - case 1024: - c |= 0x1 << 1; break; - default: - abort (); - } - return c; -} - -static unsigned char -control_byte_2 (double target_freq, bool shutdown_tx_PGA) -{ - int c; - - if (target_freq < VHF_High_takeover) // VHF low - c = 0xa0; - else if (target_freq < UHF_takeover) // VHF high - c = 0x90; - else // UHF - c = 0x30; - - if (shutdown_tx_PGA) - c |= 0x08; - - return c; -} - -microtune_4937::microtune_4937 (i2c_sptr i2c, int i2c_addr) -{ - d_i2c = i2c; - d_i2c_addr = i2c_addr; - d_reference_divider = 640; - d_fast_tuning_p = false; -} - -microtune_4937::~microtune_4937 () -{ - // nop -} - -/*! - * \brief select RF frequency to be tuned to output frequency. - * \p target_freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ -bool -microtune_4937::set_RF_freq (double target_freq, double *p_actual_freq) -{ - unsigned char buf[4]; - - double target_f_osc = target_freq + first_IF; - - double f_ref = 4e6 / d_reference_divider; - - // f_osc = f_ref * 8 * divisor - // divisor = f_osc / (f_ref * 8) - - int divisor = (int) ((target_f_osc + (f_ref * 4)) / (f_ref * 8)); - double actual_freq = (f_ref * 8 * divisor) - first_IF; - if (p_actual_freq != 0) - *p_actual_freq = actual_freq; - - if ((divisor & ~0x7fff) != 0) // 15 bit divisor - return false; - - buf[0] = (divisor >> 8) & 0xff; // DB1 - buf[1] = divisor & 0xff; // DB2 - buf[2] = control_byte_1 (d_fast_tuning_p, d_reference_divider); - buf[3] = control_byte_2 (target_freq, true); - -#if 0 - printf ("set_RF_freq: target: %g MHz actual: %g MHz %02x %02x %02x %02x\n", - target_freq/1e6, actual_freq/1e6, buf[0], buf[1], buf[2], buf[3]); -#endif - - return d_i2c->write (d_i2c_addr, buf, 4); -} - -/*! - * \returns true iff PLL is locked - */ -bool -microtune_4937::pll_locked_p () -{ - // FIXME - return true; -} - -/*! - * \returns the output frequency of the tuner in Hz. - */ -double -microtune_4937::get_output_freq () -{ - return 5.75e6; // 3x7702 -} diff --git a/gnuradio-core/src/lib/io/microtune_4937.h b/gnuradio-core/src/lib/io/microtune_4937.h deleted file mode 100644 index be8657c950..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003 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. - */ - -#ifndef INCLUDED_MICROTUNE_4937_H -#define INCLUDED_MICROTUNE_4937_H - -#include <gr_core_api.h> -#include <microtune_xxxx.h> - -/*! - * \brief class for controlling microtune 4937 tuner module - * \ingroup hardware - */ -class GR_CORE_API microtune_4937 : public microtune_xxxx { -public: - microtune_4937 (i2c_sptr i2c, int i2c_addr = 0x61); - virtual ~microtune_4937 (); - - /*! - * \brief select RF frequency to be tuned to output frequency. - * \p freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ - bool set_RF_freq (double freq, double *actual_freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - double get_output_freq (); - - private: - - i2c_sptr d_i2c; - int d_i2c_addr; - int d_reference_divider; - bool d_fast_tuning_p; /* if set, higher charge pump current: - faster tuning, worse phase noise - for distance < 10kHz to the carrier */ -}; - -#endif /* INCLUDED_MICROTUNE_4937_H */ diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc b/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc deleted file mode 100644 index a25b8addfb..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937_eval_board.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#include "microtune_4937_eval_board.h" -#include "microtune_eval_board_defs.h" -#include "ppio.h" -#include "microtune_4937.h" - -static const int TUNER_I2C_ADDR = 0x61; - -microtune_4937_eval_board::microtune_4937_eval_board (int which_pp) - : microtune_xxxx_eval_board (which_pp) -{ - d_tuner = new microtune_4937 (d_i2c, TUNER_I2C_ADDR); - - // disable upstream amplifier - d_ppio->lock (); - int t = d_ppio->read_data (); - t &= ~(UT_DP_TX_ENABLE | UT_DP_TX_SDA | UT_DP_TX_SCL); - t |= UT_DP_TX_AS; - d_ppio->write_data (t); - d_ppio->unlock (); -} - -microtune_4937_eval_board::~microtune_4937_eval_board () -{ - // Default action is OK -} - - -static const float RF_MIN_V = 1.5; // RF AGC control voltages -static const float RF_MAX_V = 4.0; -static const float IF_MIN_V = 2.0; // IF AGC control voltages -static const float IF_MAX_V = 4.0; - -static const float MIN_AGC = 0; // bottom of synthetic range -static const float MAX_AGC = 1000; // top of synthetic range - -static const float CUTOVER_POINT = 667; - - -// linear is in the range MIN_AGC to MAX_AGC - -static float -linear_to_RF_AGC_voltage (float linear) -{ - if (linear >= CUTOVER_POINT) - return RF_MAX_V; - - float slope = (RF_MAX_V - RF_MIN_V) / CUTOVER_POINT; - return RF_MIN_V + linear * slope; -} - -static float -linear_to_IF_AGC_voltage (float linear) -{ - if (linear < CUTOVER_POINT) - return IF_MIN_V; - - float slope = (IF_MAX_V - IF_MIN_V) / (MAX_AGC - CUTOVER_POINT); - return IF_MIN_V + (linear - CUTOVER_POINT) * slope; -} - -void -microtune_4937_eval_board::set_AGC (float v) -{ - if (v < MIN_AGC) - v = MIN_AGC; - - if (v > MAX_AGC) - v = MAX_AGC; - - float rf_agc_voltage = linear_to_RF_AGC_voltage (v); - float if_agc_voltage = linear_to_IF_AGC_voltage (v); - - set_RF_AGC_voltage (rf_agc_voltage); - set_IF_AGC_voltage (if_agc_voltage); -} diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.h b/gnuradio-core/src/lib/io/microtune_4937_eval_board.h deleted file mode 100644 index 3abd9084ef..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937_eval_board.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifndef INCLUDED_MICROTUNE_4937_EVAL_BOARD_H -#define INCLUDED_MICROTUNE_4937_EVAL_BOARD_H - -#include <gr_core_api.h> -#include "microtune_xxxx_eval_board.h" - -/*! - * \brief control microtune 4937 eval board - * \ingroup hardware - */ - -class GR_CORE_API microtune_4937_eval_board : public microtune_xxxx_eval_board { -public: - microtune_4937_eval_board (int which_pp = 0); - ~microtune_4937_eval_board (); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000); -}; - - -#endif /* INCLUDED_MICROTUNE_4937_EVAL_BOARD_H */ diff --git a/gnuradio-core/src/lib/io/microtune_4937_eval_board.i b/gnuradio-core/src/lib/io/microtune_4937_eval_board.i deleted file mode 100644 index e261416f78..0000000000 --- a/gnuradio-core/src/lib/io/microtune_4937_eval_board.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,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. - */ - -class microtune_4937_eval_board : public microtune_xxxx_eval_board { -public: - microtune_4937_eval_board (int which_pp = 0); - ~microtune_4937_eval_board (); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000); -}; diff --git a/gnuradio-core/src/lib/io/microtune_eval_board.i b/gnuradio-core/src/lib/io/microtune_eval_board.i deleted file mode 100644 index f77ef47b4b..0000000000 --- a/gnuradio-core/src/lib/io/microtune_eval_board.i +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -/* - * SWIG interface defs for Microtune 4937 and eval board with Eric's daughterboard - */ - -/*! - * \brief abstract class for controlling microtune 4937 tuner module - */ -class microtune_4937 { -public: - microtune_4937 (); - - virtual ~microtune_4937 (); - - // returns actual freq or 0 if error (easier interface for SWIG) - double set_RF_freq (double freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - double get_output_freq (); - - - private: - //! \returns true iff successful - virtual bool i2c_write (int addr, const unsigned char *buf, int nbytes) = 0; - - //! \returns number of bytes read or -1 if error - virtual int i2c_read (int addr, unsigned char *buf, int max_bytes) = 0; - - int d_reference_divider; - bool d_fast_tuning_p; /* if set, higher charge pump current: - faster tuning, worse phase noise - for distance < 10kHz to the carrier */ -}; - -/*! - * \brief concrete class for controlling microtune 4937 eval board attached to parallel port - */ -class microtune_eval_board : public microtune_4937 { -public: - microtune_eval_board (int which_pp = 0); - ~microtune_eval_board (); - - //! is the eval board present? - bool board_present_p (); - - /*! - * \brief set RF and IF AGC control voltages ([0, 5] volts) - */ - void set_RF_AGC_voltage (float volts); - void set_IF_AGC_voltage (float volts); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - void set_AGC (float value_0_1000); - -private: - //! \returns true iff successful - virtual bool i2c_write (int addr, const unsigned char *buf, int nbytes); - - //! \returns number of bytes read or -1 if error - virtual int i2c_read (int addr, unsigned char *buf, int max_bytes); -}; diff --git a/gnuradio-core/src/lib/io/microtune_eval_board_defs.h b/gnuradio-core/src/lib/io/microtune_eval_board_defs.h deleted file mode 100644 index 61c52364f3..0000000000 --- a/gnuradio-core/src/lib/io/microtune_eval_board_defs.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*-C-*- -******************************************************************************* -* -* File: microtune_eval_board_defs.h -* Description: defines for parallel port control of eval board -* -******************************************************************************* -*/ - -/* - * Copyright 2001 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. - */ - -#ifndef _MICROTUNE_EVAL_BOARD_DEFS_H_ -#define _MICROTUNE_EVAL_BOARD_DEFS_H_ - -/* - * The Microtune 4937DI5 cable modem tuner eval board is controlled - * by bit banging the PC parallel port. This file defines the relevant - * bits. - * - * The parallel port has an 8 bit data port (output), - * an 8 bit control port (output) and - * an 8 bit status port (input). - * - * Not all bits of the control and status ports may be arbitrarily used. - */ - - -// parallel port data port constants (output) - -static const int UT_DP_TX_SDA = 0x01; // upstream control bus -static const int UT_DP_TX_SCL = 0x02; // upstream control bus -static const int UT_DP_TX_AS = 0x04; // upstream control bus -static const int UT_DP_TX_ENABLE = 0x08; // upstream h/w enable -// bits 4,5,6 not used -static const int UT_DP_TUNER_SDA_OUT = 0x80; // tuner i2c bus data - -// parallel port control port constants (output) - -static const int UT_CP_TUNER_SCL = 0x08; // tuner i2c bus clock -static const int UT_CP_MUST_BE_ZERO = 0xf0; // must be zero - -// parallel port status port constants (input) - -// bits 0,1,2 not used -static const int UT_SP_TUNER_SCL_LOOP_BACK= 0x08; // inverted SCL loop back -static const int UT_SP_SHOULD_BE_ZERO = 0x10; // reads as zero -static const int UT_SP_SHOULD_BE_ONE = 0x20; // reads as one -// bit 6 not used -static const int UT_SP_TUNER_SDA_IN = 0x80; - - -#endif /* _MICROTUNE_EVAL_BOARD_DEFS_H_ */ diff --git a/gnuradio-core/src/lib/io/microtune_xxxx.cc b/gnuradio-core/src/lib/io/microtune_xxxx.cc deleted file mode 100644 index 3d55f534a0..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++-*- */ -/* - * Copyright 2001,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. - */ - -#include "microtune_xxxx.h" - -microtune_xxxx::~microtune_xxxx () -{ - // nop -} - -double -microtune_xxxx::set_RF_freq (double target_freq) -{ - double actual_freq = 0.0; - - if (set_RF_freq (target_freq, &actual_freq)) - return actual_freq; - - return 0.0; -} - - diff --git a/gnuradio-core/src/lib/io/microtune_xxxx.h b/gnuradio-core/src/lib/io/microtune_xxxx.h deleted file mode 100644 index b2646d39f9..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifndef INCLUDED_MICROTUNE_XXXX_H -#define INCLUDED_MICROTUNE_XXXX_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class i2c; -typedef boost::shared_ptr<i2c> i2c_sptr; - -/*! - * \brief abstract class for controlling microtune {4937,4702} tuner modules - * \ingroup base - */ -class GR_CORE_API microtune_xxxx { -public: - microtune_xxxx () {} - virtual ~microtune_xxxx (); - - /*! - * \brief select RF frequency to be tuned to output frequency. - * \p freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ - virtual bool set_RF_freq (double freq, double *actual_freq) = 0; - - // returns actual freq or 0 if error (easier interface for SWIG) - double set_RF_freq (double freq); - - /*! - * \returns true iff PLL is locked - */ - virtual bool pll_locked_p () = 0; - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - virtual double get_output_freq () = 0; - -}; - -#endif /* INCLUDED_MICROTUNE_XXXX_H */ diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc deleted file mode 100644 index 35600ff066..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "microtune_xxxx_eval_board.h" -#include "microtune_eval_board_defs.h" -#include "microtune_xxxx.h" -#include "ppio.h" -#include "i2c_bitbang.h" -#include "i2c_bbio_pp.h" -#include <cmath> - -static int AGC_DAC_I2C_ADDR = 0x2C; - -microtune_xxxx_eval_board::microtune_xxxx_eval_board (int which_pp) -{ - d_ppio = make_ppio (which_pp); - d_i2c = make_i2c_bitbang (make_i2c_bbio_pp (d_ppio)); - d_tuner = 0; -} - -microtune_xxxx_eval_board::~microtune_xxxx_eval_board () -{ - delete d_tuner; - d_tuner = 0; -} - - -//! is the eval board present? -bool -microtune_xxxx_eval_board::board_present_p () -{ - bool result = true; - d_ppio->lock (); - - int t = d_ppio->read_status (); - if ((t & UT_SP_SHOULD_BE_ZERO) != 0 - || (t & UT_SP_SHOULD_BE_ONE) != UT_SP_SHOULD_BE_ONE) - result = false; - - // could also see if SCL is looped back or not, but that seems like overkill - - d_ppio->unlock (); - return result; -} - -/* - * ---------------------------------------------------------------- - * AGC stuff - * - * We're using a MAX518 8-bit 5V dual dac for setting the AGC's - * ---------------------------------------------------------------- - */ -void -microtune_xxxx_eval_board::write_dac (int which, int value) -{ - unsigned char cmd[2]; - cmd[0] = which & 1; - cmd[1] = value; - d_i2c->write (AGC_DAC_I2C_ADDR, cmd, sizeof (cmd)); -} - -void -microtune_xxxx_eval_board::write_both_dacs (int value0, int value1) -{ - unsigned char cmd[4]; - cmd[0] = 0; - cmd[1] = value0; - cmd[2] = 1; - cmd[3] = value1; - d_i2c->write (AGC_DAC_I2C_ADDR, cmd, sizeof (cmd)); -} - -static int scale_volts (float volts) -{ - int n; - n = (int) rint (volts * (256 / 5.0)); - if (n < 0) - n = 0; - if (n > 255) - n = 255; - - return n; -} - -void -microtune_xxxx_eval_board::set_RF_AGC_voltage (float volts) -{ - write_dac (0, scale_volts (volts)); -} - -void -microtune_xxxx_eval_board::set_IF_AGC_voltage (float volts) -{ - write_dac (1, scale_volts (volts)); -} - -// delegate to tuner - -bool -microtune_xxxx_eval_board::set_RF_freq (double freq, double *actual_freq) -{ - return d_tuner->set_RF_freq (freq, actual_freq); -} - -double -microtune_xxxx_eval_board::set_RF_freq (double freq) -{ - return d_tuner->set_RF_freq (freq); -} - -bool -microtune_xxxx_eval_board::pll_locked_p () -{ - return d_tuner->pll_locked_p (); -} - -double -microtune_xxxx_eval_board::get_output_freq () -{ - return d_tuner->get_output_freq (); -} diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h deleted file mode 100644 index 7fd784ade3..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2001,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. - */ - -#ifndef INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H -#define INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class microtune_xxxx; - -class ppio; -typedef boost::shared_ptr<ppio> ppio_sptr; - -class i2c; -typedef boost::shared_ptr<i2c> i2c_sptr; - -/*! - * \brief abstract class for controlling microtune xxxx eval board - * \ingroup hardware - */ -class GR_CORE_API microtune_xxxx_eval_board { -public: - microtune_xxxx_eval_board (int which_pp = 0); - virtual ~microtune_xxxx_eval_board (); - - //! is the eval board present? - bool board_present_p (); - - /*! - * \brief set RF and IF AGC control voltages ([0, 5] volts) - */ - void set_RF_AGC_voltage (float volts); - void set_IF_AGC_voltage (float volts); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000) = 0; - - /*! - * \brief select RF frequency to be tuned to output frequency. - * \p freq is the requested frequency in Hz, \p actual_freq - * is set to the actual frequency tuned. It takes about 100 ms - * for the PLL to settle. - * - * \returns true iff sucessful. - */ - bool set_RF_freq (double freq, double *actual_freq); - - // returns actual freq or 0 if error (easier interface for SWIG) - double set_RF_freq (double freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - double get_output_freq (); - - -private: - void write_dac (int which, int value); - void write_both_dacs (int val0, int val1); - -protected: - ppio_sptr d_ppio; - i2c_sptr d_i2c; - microtune_xxxx *d_tuner; -}; - -#endif /* INCLUDED_MICROTUNE_XXXX_EVAL_BOARD_H */ diff --git a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i b/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i deleted file mode 100644 index 8a8a597427..0000000000 --- a/gnuradio-core/src/lib/io/microtune_xxxx_eval_board.i +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -class microtune_xxxx_eval_board { -public: - microtune_xxxx_eval_board (int which_pp = 0); - virtual ~microtune_xxxx_eval_board (); - - //! is the eval board present? - bool board_present_p (); - - /*! - * \brief set RF and IF AGC control voltages ([0, 5] volts) - */ - void set_RF_AGC_voltage (float volts); - void set_IF_AGC_voltage (float volts); - - /*! - * \brief set RF and IF AGC levels together (scale [0, 1000]) - * - * This provides a simple linear interface for adjusting both - * the RF and IF gain in consort. This is the easy to use interface. - * 0 corresponds to minimum gain. 1000 corresponds to maximum gain. - */ - virtual void set_AGC (float value_0_1000) = 0; - - // returns actual freq or 0 if error (easier interface for SWIG) - double set_RF_freq (double freq); - - /*! - * \returns true iff PLL is locked - */ - bool pll_locked_p (); - - /*! - * \returns the output frequency (IF center freq) of the tuner in Hz. - */ - double get_output_freq (); -}; diff --git a/gnuradio-core/src/lib/io/ppio.cc b/gnuradio-core/src/lib/io/ppio.cc deleted file mode 100644 index a5edc539ca..0000000000 --- a/gnuradio-core/src/lib/io/ppio.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#include <ppio.h> -#include <ppio_ppdev.h> - -ppio::~ppio () -{ -} - -// Factory method. -// -// Right now, we've only got one subclass we like. If there were more, -// we'd instantiate the "right one" here. - -ppio_sptr -make_ppio (int which_pp) -{ - return make_ppio_ppdev (which_pp); -} diff --git a/gnuradio-core/src/lib/io/ppio.h b/gnuradio-core/src/lib/io/ppio.h deleted file mode 100644 index d99f7bf79a..0000000000 --- a/gnuradio-core/src/lib/io/ppio.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003 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. - */ - -#ifndef INCLUDED_PPIO_H -#define INCLUDED_PPIO_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class ppio; -typedef boost::shared_ptr<ppio> ppio_sptr; - - -/*! - * \brief abstract class that provides low level access to parallel port bits - * \ingroup hardware - */ - -class GR_CORE_API ppio { - public: - ppio () {} - virtual ~ppio (); - - virtual void write_data (unsigned char v) = 0; - virtual unsigned char read_data () = 0; - virtual void write_control (unsigned char v) = 0; - virtual unsigned char read_control () = 0; - virtual unsigned char read_status () = 0; - - virtual void lock () = 0; - virtual void unlock () = 0; -}; - -/*! - * \brief Factory method. - * - * Split out from class to make life easier for SWIG - */ - -GR_CORE_API ppio_sptr make_ppio (int which_pp); - - -#endif /* INCLUDED_PPIO_H */ - diff --git a/gnuradio-core/src/lib/io/ppio.i b/gnuradio-core/src/lib/io/ppio.i deleted file mode 100644 index 6b95dcf888..0000000000 --- a/gnuradio-core/src/lib/io/ppio.i +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -class ppio; -typedef boost::shared_ptr<ppio> ppio_sptr; - -%template(ppio_sptr) boost::shared_ptr<ppio>; - -/*! - * \brief abstract class that provides low level access to parallel port bits - */ - -class ppio { - public: - ppio () {} - virtual ~ppio (); - - virtual void write_data (unsigned char v) = 0; - virtual unsigned char read_data () = 0; - virtual void write_control (unsigned char v) = 0; - virtual unsigned char read_control () = 0; - virtual unsigned char read_status () = 0; - - virtual void lock () = 0; - virtual void unlock () = 0; -}; - - -ppio_sptr make_ppio (int which_pp); diff --git a/gnuradio-core/src/lib/io/ppio_ppdev.cc b/gnuradio-core/src/lib/io/ppio_ppdev.cc deleted file mode 100644 index f528459585..0000000000 --- a/gnuradio-core/src/lib/io/ppio_ppdev.cc +++ /dev/null @@ -1,321 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003,2004,2008 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <ppio_ppdev.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdlib.h> -#include <iostream> -#include <errno.h> -#include <stdio.h> -#include <stdexcept> -#if defined(HAVE_LINUX_PPDEV_H) -#include <sys/ioctl.h> -#include <linux/ppdev.h> -#include <linux/parport.h> -#include <sstream> -#elif defined(HAVE_DEV_PPBUS_PPI_H) -#include <sys/ioctl.h> -#include <dev/ppbus/ppi.h> -#include <dev/ppbus/ppbconf.h> -#include <sstream> -#else -// #warn "ppio_ppdev is not functional on this platform" -#endif - -// These control port bits are active low. -// We toggle them so that this weirdness doesn't get get propagated -// through our interface. - -static int CP_ACTIVE_LOW_BITS = 0x0B; - -// These status port bits are active low. -// We toggle them so that this weirdness doesn't get get propagated -// through our interface. - -static int SP_ACTIVE_LOW_BITS = 0x80; - -#if defined(HAVE_LINUX_PPDEV_H) - -// The real Linux code... - -ppio_ppdev::ppio_ppdev (int which) -{ - std::ostringstream filename; - filename << "/dev/parport" << which; - const char *c_filename = filename.str().c_str(); - - if ((d_fd = open (c_filename, O_RDWR)) < 0){ - int my_errno = errno; - perror (c_filename); - if (my_errno == ENOENT){ - std::cerr << "Does the device file " << c_filename << " exist?\n"; - std::cerr << "If not, as root execute: \n"; - std::cerr << " # mknod " << c_filename << " c 99 0\n"; - std::cerr << " # chmod 666 " << c_filename << std::endl; - } - throw std::runtime_error ("open"); - } - - int mode = IEEE1284_MODE_COMPAT; - if (ioctl (d_fd, PPSETMODE, &mode) != 0){ - perror ("ppio_ppdev: PPSETMODE"); - close (d_fd); - throw std::runtime_error ("PPSETMODE"); - } -} - -ppio_ppdev::~ppio_ppdev () -{ - close (d_fd); -} - - -void -ppio_ppdev::write_data (unsigned char v) -{ - if (ioctl (d_fd, PPWDATA, &v) != 0){ - perror ("ppio_ppdev: PPWDATA"); - throw std::runtime_error ("PPWDATA"); - } -} - -unsigned char -ppio_ppdev::read_data () -{ - unsigned char v; - - if (ioctl (d_fd, PPRDATA, &v) != 0){ - perror ("ppio_ppdev: PPRDATA"); - throw std::runtime_error ("PPRDATA"); - } - return v; -} - -void -ppio_ppdev::write_control (unsigned char v) -{ - unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS; - if (ioctl (d_fd, PPWCONTROL, &ctrl) != 0){ - perror ("ppio_ppdev: PPWCONTROL"); - throw std::runtime_error ("PPWCONTROL"); - } -} - -unsigned char -ppio_ppdev::read_control () -{ - unsigned char ctrl; - if (ioctl (d_fd, PPRCONTROL, &ctrl) != 0){ - perror ("ppio_ppdev: PPRCONTROL"); - throw std::runtime_error ("PPRCONTROL"); - } - - return ctrl ^ CP_ACTIVE_LOW_BITS; -} - -unsigned char -ppio_ppdev::read_status () -{ - unsigned char status; - if (ioctl (d_fd, PPRSTATUS, &status) != 0){ - perror ("ppio_ppdev: PPRSTATUS"); - throw std::runtime_error ("PPRSTATUS"); - } - - return status ^ SP_ACTIVE_LOW_BITS; -} - -void -ppio_ppdev::lock () -{ - if (ioctl (d_fd, PPCLAIM) != 0){ - perror ("ppio_ppdev: PPCLAIM"); - throw std::runtime_error ("PPCLAIM"); - } -} - -void -ppio_ppdev::unlock () -{ - if (ioctl (d_fd, PPRELEASE) != 0){ - perror ("ppio_ppdev: PPRELEASE"); - throw std::runtime_error ("PPRELEASE"); - } -} - -#elif defined(HAVE_DEV_PPBUS_PPI_H) - -// The real FreeBSD code... (Could work on other BSDs as well) - -ppio_ppdev::ppio_ppdev (int which) -{ - std::ostringstream filename; - filename << "/dev/ppi" << which; - const char *c_filename = filename.str().c_str(); - if ((d_fd = open (c_filename, O_RDWR)) < 0){ - int my_errno = errno; - perror (c_filename); - throw std::runtime_error ("open"); - } - -#if 0 - int mode = IEEE1284_MODE_COMPAT; - if (ioctl (d_fd, PPSETMODE, &mode) != 0){ - perror ("ppio_ppdev: PPSETMODE"); - close (d_fd); - throw std::runtime_error ("PPSETMODE"); - } -#endif -} - -ppio_ppdev::~ppio_ppdev () -{ - close (d_fd); -} - - -void -ppio_ppdev::write_data (unsigned char v) -{ - if (ioctl (d_fd, PPISDATA, &v) != 0){ - perror ("ppio_ppdev: PPISDATA"); - throw std::runtime_error ("PPISDATA"); - } -} - -unsigned char -ppio_ppdev::read_data () -{ - unsigned char v; - - if (ioctl (d_fd, PPIGDATA, &v) != 0){ - perror ("ppio_ppdev: PPIGDATA"); - throw std::runtime_error ("PPIGDATA"); - } - return v; -} - -void -ppio_ppdev::write_control (unsigned char v) -{ - unsigned char ctrl = v ^ CP_ACTIVE_LOW_BITS; - if (ioctl (d_fd, PPISCTRL, &ctrl) != 0){ - perror ("ppio_ppdev: PPISCTRL"); - throw std::runtime_error ("PPISCTRL"); - } -} - -unsigned char -ppio_ppdev::read_control () -{ - unsigned char ctrl; - if (ioctl (d_fd, PPIGCTRL, &ctrl) != 0){ - perror ("ppio_ppdev: PPIGCTRL"); - throw std::runtime_error ("PPIGCTRL"); - } - - return ctrl ^ CP_ACTIVE_LOW_BITS; -} - -unsigned char -ppio_ppdev::read_status () -{ - unsigned char status; - if (ioctl (d_fd, PPIGSTATUS, &status) != 0){ - perror ("ppio_ppdev: PPIGSTATUS"); - throw std::runtime_error ("PPIGSTATUS"); - } - return status ^ SP_ACTIVE_LOW_BITS; -} - -void -ppio_ppdev::lock () -{ -} - -void -ppio_ppdev::unlock () -{ -} -#else -/* Apparently, non real code */ - -ppio_ppdev::ppio_ppdev (int which) -{ - std::cerr << "ppio_ppdev: Not implemented on this platform\n"; - throw std::runtime_error ("not implmeneted"); -} - -ppio_ppdev::~ppio_ppdev () -{ -} - -void -ppio_ppdev::write_data (unsigned char v) -{ -} - -unsigned char -ppio_ppdev::read_data () -{ - return 0; -} - -void -ppio_ppdev::write_control (unsigned char v) -{ -} - -unsigned char -ppio_ppdev::read_control () -{ - return 0; -} - -unsigned char -ppio_ppdev::read_status () -{ - return 0; -} - -void -ppio_ppdev::lock () -{ -} - -void -ppio_ppdev::unlock () -{ -} - -#endif - -ppio_ppdev_sptr -make_ppio_ppdev (int which) -{ - return ppio_ppdev_sptr (new ppio_ppdev (which)); -} diff --git a/gnuradio-core/src/lib/io/ppio_ppdev.h b/gnuradio-core/src/lib/io/ppio_ppdev.h deleted file mode 100644 index 1f86d7e047..0000000000 --- a/gnuradio-core/src/lib/io/ppio_ppdev.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2001,2003 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. - */ - -#ifndef INCLUDED_PPIO_PPDEV_H -#define INCLUDED_PPIO_PPDEV_H - -#include <gr_core_api.h> -#include <ppio.h> - -class ppio_ppdev; -typedef boost::shared_ptr<ppio_ppdev> ppio_ppdev_sptr; - -/*! - * \brief access to parallel port bits using the linux ppdev interface - * \ingroup hardware - */ - -class GR_CORE_API ppio_ppdev : public ppio { - friend GR_CORE_API ppio_ppdev_sptr make_ppio_ppdev (int which = 0); - ppio_ppdev (int which = 0); - - public: - virtual ~ppio_ppdev (); - - virtual void write_data (unsigned char v); - virtual unsigned char read_data (); - virtual void write_control (unsigned char v); - virtual unsigned char read_control (); - virtual unsigned char read_status (); - - virtual void lock (); - virtual void unlock (); - - private: - int d_fd; -}; - -ppio_ppdev_sptr -make_ppio_ppdev (int which); - - -#endif /* INCLUDED_PPIO_PPDEV_H */ - diff --git a/gnuradio-core/src/lib/io/sdr_1000.cc b/gnuradio-core/src/lib/io/sdr_1000.cc deleted file mode 100644 index a8c2555e0e..0000000000 --- a/gnuradio-core/src/lib/io/sdr_1000.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -#include <sdr_1000.h> -#include <ppio.h> - -sdr_1000_base::sdr_1000_base (int which_pp) -{ - d_ppio = make_ppio (which_pp); - d_shadow[0] = 0; - d_shadow[1] = 0; - d_shadow[2] = 0; - d_shadow[3] = 0; - reset (); -} - -sdr_1000_base::~sdr_1000_base () -{ -} - -void -sdr_1000_base::reset () -{ - d_ppio->lock (); - d_ppio->write_control (0x0F); - d_ppio->unlock (); - write_latch (L_EXT, 0x00, 0xff); - write_latch (L_BAND, 0x00, 0xff); - write_latch (L_DDS0, 0x80, 0xff); // hold DDS in reset - write_latch (L_DDS1, 0x00, 0xff); -} - - -void -sdr_1000_base::write_latch (int which, int value, int mask) -{ - if (!(0 <= which && which <= 3)) - return; - - d_ppio->lock (); - d_shadow[which] = (d_shadow[which] & ~mask) | (value & mask); - d_ppio->write_data (d_shadow[which]); - d_ppio->write_control (0x0F ^ (1 << which)); - d_ppio->write_control (0x0F); - d_ppio->unlock (); -} diff --git a/gnuradio-core/src/lib/io/sdr_1000.h b/gnuradio-core/src/lib/io/sdr_1000.h deleted file mode 100644 index c00608a3a9..0000000000 --- a/gnuradio-core/src/lib/io/sdr_1000.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_SDR_1000_H -#define INCLUDED_SDR_1000_H - -#include <gr_core_api.h> -#include <boost/shared_ptr.hpp> - -class ppio; -typedef boost::shared_ptr<ppio> ppio_sptr; - - -enum { L_EXT = 0, L_BAND = 1, L_DDS0 = 2, L_DDS1 = 3 }; - -/*! - * \brief Very low level interface to SDR 1000 xcvr hardware - * \sa sdr_1000.py for a higher level interface. - * \ingroup hardware - */ -class GR_CORE_API sdr_1000_base { - ppio_sptr d_ppio; - int d_shadow[4]; // shadow latches - -public: - - sdr_1000_base (int which_pp); - ~sdr_1000_base (); - - void reset (); - void write_latch (int which, int value, int mask); -}; - -#endif /* INCLUDED_SDR_1000_H */ diff --git a/gnuradio-core/src/lib/io/sdr_1000.i b/gnuradio-core/src/lib/io/sdr_1000.i deleted file mode 100644 index c9b1ef5609..0000000000 --- a/gnuradio-core/src/lib/io/sdr_1000.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -const int L_EXT = 0; -const int L_BAND = 1; -const int L_DDS0 = 2; -const int L_DDS1 = 3; - -class sdr_1000_base { -public: - - sdr_1000_base (int which_pp); - ~sdr_1000_base (); - - void reset (); - void write_latch (int which, int value, int mask); -}; 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) |