commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8874 - gnuradio/branches/developers/trondeau/dbs/gr-u


From: trondeau
Subject: [Commit-gnuradio] r8874 - gnuradio/branches/developers/trondeau/dbs/gr-usrp/src
Date: Sun, 13 Jul 2008 11:19:05 -0600 (MDT)

Author: trondeau
Date: 2008-07-13 11:18:56 -0600 (Sun, 13 Jul 2008)
New Revision: 8874

Added:
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.cc
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.h
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.i
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.cc
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.h
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.i
Log:
wip: adding c++ classes for basic (rx,tx,lfrx,lftx) and tv_rx boards

Added: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.cc           
                (rev 0)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.cc   
2008-07-13 17:18:56 UTC (rev 8874)
@@ -0,0 +1,273 @@
+//
+// Copyright 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 asversion 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 <db_basic.h>
+#include <usrp1_base.h>
+
+
+/**************************************************************************************************/
+
+
+db_basic_tx::db_basic_tx(usrp1_base *usrp, int which)
+  : db_base(usrp, which, true)
+{
+  // Handler for Basic Tx daughterboards.
+  // 
+  // @param usrp: instance of usrp.source_c
+  // @param which: which side: 0 or 1 corresponding to TX_A or TX_B 
respectively
+
+  if(0) {
+    // Doing this would give us a different default than the historical 
values...
+    std::vector<float> g = gain_range();                  // initialize gain
+    set_gain(float(g[0]+g[1]) / 2);
+  }
+}
+
+std::vector<float> 
+db_basic_tx::freq_range() 
+{
+  // Return range of frequencies in Hz that can be tuned by this d'board.
+  // 
+  // @returns (min_freq, max_freq, step_size)
+  // @rtype tuple
+  // 
+  // We say we can do pretty much anything...
+  
+  std::vector<float> f(3,0);
+  f[0] = -90e9;
+  f[1] = 90e9;
+  f[2] = 1e-6;
+  return f;
+}
+
+std::vector<float>
+db_basic_tx::set_freq(float target_freq)
+{
+  // Set the frequency.
+  // 
+  // @param freq:  target RF frequency in Hz
+  // @type freq:   float
+  // 
+  // @returns (ok, actual_baseband_freq) where:
+  //   ok is True or False and indicates success or failure,
+  //   actual_baseband_freq is the RF frequency that corresponds to DC in the 
IF.
+  
+  // FIXME: Should I return a struct{bool, float} instead?
+  std::vector<float> args(2);
+  args[0] = 1;   // 1: true
+  args[1] = 0.0; // baseband freq
+  return args;
+}
+
+std::vector<float>
+db_basic_tx::gain_range()
+{
+  // Return range of gain that can be set by this d'board.
+  // 
+  // @returns (min_gain, max_gain, step_size)
+  //    Where gains are expressed in decibels (your mileage may vary)
+  
+  std::vector<float> g(3,0);
+  g[0] = d_usrp->pga_min();
+  g[1] = d_usrp->pga_max();
+  g[2] = d_usrp->pga_db_per_step();
+  return g;
+}
+
+bool 
+db_basic_tx::set_gain(float gain)
+{
+  // Set the gain.
+  // 
+  // @param gain:  gain in decibels
+  // @returns True/False
+
+  bool ok = d_usrp->set_pga(d_which * 2 + 0, gain);
+  ok = ok && d_usrp->set_pga(d_which * 2 + 1, gain);
+  return ok;
+}
+
+bool 
+db_basic_tx::is_quadrature()
+{
+  // Return True if this board requires both I & Q analog channels.
+  
+  return true;
+}
+
+
+/******************************************************************************/
+
+
+db_basic_rx::db_basic_rx(usrp1_base *usrp, int which, int subdev)
+  : db_base(usrp, which, false)
+{
+  // Handler for Basic Rx daughterboards.
+  // 
+  // @param usrp: instance of usrp.source_c
+  // @param which: which side: 0 or 1 corresponding to TX_A or TX_B 
respectively
+  // @param subdev: which analog i/o channel: 0 or 1
+  // @type subdev: int
+  
+  d_subdev = subdev;
+    
+  bypass_adc_buffers(true);
+
+  if(0) {       // Doing this would give us a different default than the 
historical values...
+    std::vector<float> g = gain_range();                  // initialize gain
+    set_gain(float(g[0]+g[1]) / 2.0);
+  }
+}
+
+std::vector<float> 
+db_basic_rx::freq_range() 
+{
+  // Return range of frequencies in Hz that can be tuned by this d'board.
+  // 
+  // @returns (min_freq, max_freq, step_size)
+  // @rtype tuple
+  // 
+  // We say we can do pretty much anything...
+  
+  std::vector<float> f(3,0);
+  f[0] = -90e9;
+  f[1] = 90e9;
+  f[2] = 1e-6;
+  return f;
+}
+
+std::vector<float>
+db_basic_rx::set_freq(float target_freq)
+{
+  // Set the frequency.
+  // 
+  // @param freq:  target RF frequency in Hz
+  // @type freq:   float
+  // 
+  // @returns (ok, actual_baseband_freq) where:
+  //   ok is True or False and indicates success or failure,
+  //   actual_baseband_freq is the RF frequency that corresponds to DC in the 
IF.
+  
+  // FIXME: Should I return a struct{bool, float} instead?
+  std::vector<float> args(2);
+  args[0] = 1;   // 1: true
+  args[1] = 0.0; // baseband freq
+  return args;
+}
+
+std::vector<float>
+db_basic_rx::gain_range()
+{
+  // Return range of gain that can be set by this d'board.
+  // 
+  // @returns (min_gain, max_gain, step_size)
+  //    Where gains are expressed in decibels (your mileage may vary)
+  
+  std::vector<float> g(3,0);
+  g[0] = d_usrp->pga_min();
+  g[1] = d_usrp->pga_max();
+  g[2] = d_usrp->pga_db_per_step();
+  return g;
+}
+
+bool 
+db_basic_rx::set_gain(float gain)
+{
+  // Set the gain.
+  // 
+  // @param gain:  gain in decibels
+  // @returns True/False
+  
+  return d_usrp->set_pga(d_which * 2 + d_subdev, gain);
+}
+
+bool 
+db_basic_rx::is_quadrature()
+{
+  // Return True if this board requires both I & Q analog channels.
+
+  // This bit of info is useful when setting up the USRP Rx mux register.
+  
+  return false;
+}
+
+
+
+/******************************************************************************/
+
+
+db_lf_tx::db_lf_tx(usrp1_base *usrp, int which)
+  : db_basic_tx(usrp, which)
+{
+  // Handler for Low Freq Tx daughterboards.
+  //
+  // @param usrp: instance of usrp.source_c
+  // @param which: which side: 0 or 1 corresponding to RX_A or RX_B 
respectively
+}
+
+std::vector<float> 
+db_lf_tx::freq_range() 
+{
+  // Return range of frequencies in Hz that can be tuned by this d'board.
+  // 
+  // @returns (min_freq, max_freq, step_size)
+  // @rtype tuple
+  // 
+  // We cover the first nyquist zone only
+  
+  std::vector<float> f(3,0);
+  f[0] = -32e6;
+  f[1] = 32e6;
+  f[2] = 1e-6;
+  return f;
+}
+
+
+/******************************************************************************/
+
+
+db_lf_rx::db_lf_rx(usrp1_base *usrp, int which, int subdev)
+  : db_basic_rx(usrp, which, subdev)
+{
+  // Handler for Low Freq Rx daughterboards.
+  //
+  // @param usrp: instance of usrp.source_c
+  // @param which: which side: 0 or 1 corresponding to RX_A or RX_B 
respectively
+  // @param subdev: which analog i/o channel: 0 or 1
+  // @type subdev: int
+}
+
+std::vector<float>
+db_lf_rx::freq_range() 
+{
+  // Return range of frequencies in Hz that can be tuned by this d'board.
+  // 
+  // @returns (min_freq, max_freq, step_size)
+  // @rtype tuple
+  // 
+  // We cover the first nyquist zone only
+  
+  std::vector<float> f(3,0);
+  f[0] = 0.0;
+  f[1] = 32e6;
+  f[2] = 1e-6;
+  return f;
+}
+

Added: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.h            
                (rev 0)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.h    
2008-07-13 17:18:56 UTC (rev 8874)
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+//
+// Copyright 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 asversion 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 DB_BASIC_H
+#define DB_BASIC_H
+
+#include <db_base.h>
+#include <gr_sync_block.h>
+
+class usrp1_base;
+
+
+/******************************************************************************/
+
+
+class db_basic_tx : public db_base
+{
+public:
+  db_basic_tx(usrp1_base *usrp, int which);
+
+  std::vector<float> freq_range();
+  std::vector<float> set_freq(float target_freq);
+  std::vector<float> gain_range();
+  bool               set_gain(float gain);
+  bool               is_quadrature();
+};
+
+
+/******************************************************************************/
+
+
+class db_basic_rx : public db_base
+{
+ public:
+  db_basic_rx(usrp1_base *usrp, int which, int subdev);
+  
+  std::vector<float> freq_range();
+  std::vector<float> set_freq(float target_freq);
+  std::vector<float> gain_range();
+  bool               set_gain(float gain);
+  bool               is_quadrature();
+
+private:
+  int d_subdev;
+};
+
+
+/******************************************************************************/
+
+
+class db_lf_rx : public db_basic_rx
+{
+ public:
+  db_lf_rx(usrp1_base *usrp, int which, int subdev);
+  
+  std::vector<float> freq_range();
+};
+
+
+/******************************************************************************/
+
+
+class db_lf_tx : public db_basic_tx
+{ 
+ public:
+  db_lf_tx(usrp1_base *usrp, int which);
+  
+  std::vector<float> freq_range();
+};
+
+
+#endif

Added: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.i
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.i            
                (rev 0)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_basic.i    
2008-07-13 17:18:56 UTC (rev 8874)
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+%{
+#include "db_basic.h"
+%}
+
+/******************************************************************************/
+
+
+class db_basic_tx : public db_base
+{
+public:
+  db_basic_tx(usrp1_base *usrp, int which);
+
+  std::vector<float> freq_range();
+  std::vector<float> set_freq(float target_freq);
+  std::vector<float> gain_range();
+  bool               set_gain(float gain);
+  bool               is_quadrature();
+};
+
+
+/******************************************************************************/
+
+
+class db_basic_rx : public db_base
+{
+public:
+  db_basic_rx(usrp1_base *usrp, int which, int subdev);
+
+  std::vector<float> freq_range();
+  std::vector<float> set_freq(float target_freq);
+  std::vector<float> gain_range();
+  bool               set_gain(float gain);
+  bool               is_quadrature();
+};
+
+
+/******************************************************************************/
+
+
+class db_lf_rx : public db_basic_rx
+{
+ public:
+  db_lf_rx(usrp1_base *usrp, int which, int subdev);
+  
+  std::vector<float> freq_range();
+};
+
+
+/******************************************************************************/
+
+
+class db_lf_tx : public db_basic_tx
+{ 
+ public:
+  db_lf_tx(usrp1_base *usrp, int which);
+  
+  std::vector<float> freq_range();
+};

Added: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.cc           
                (rev 0)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.cc   
2008-07-13 17:18:56 UTC (rev 8874)
@@ -0,0 +1,302 @@
+//
+// Copyright 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 asversion 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 <db_tv_rx.h>
+#include <usrp1_base.h>
+#include <sstream>
+
+/**************************************************************************************************/
+
+std::string
+int_seq_to_str(std::vector<int> &seq)
+{
+  //convert a sequence of integers into a string
+  //return ''.join (map (chr, seq));
+  
+  std::stringstream str; 
+  std::vector<int>::iterator i;
+  for(i = seq.begin(); i != seq.end(); i++) {
+    str << char((unsigned int)*i);
+  }
+  return str.str();
+}
+
+std::vector<int> 
+str_to_int_seq(std::string str)
+{
+  //convert a string to a list of integers
+  std::vector<int> seq(str.size());
+  std::vector<int>::iterator sitr;
+  std::string::iterator i;
+  for(i=str.begin(); i != str.end(); i++) {
+    int a = atoi(&(*i));
+    seq.push_back(a);
+  }
+  return seq;
+}
+
+int
+control_byte_1(bool fast_tuning_p, int reference_divisor)
+{
+  int c = 0x88;
+  if(fast_tuning_p) {
+    c |= 0x40;
+  }
+
+  if(reference_divisor == 512) {
+    c |= 0x3 << 1;
+  }
+  else if(reference_divisor == 640) {
+    c |= 0x0 << 1;
+  }
+  else if(reference_divisor == 1024) {
+    c |= 0x1 << 1;
+  }
+  else {
+    assert(0);
+  }
+
+  return c;
+}
+
+int
+control_byte_2(float target_freq, bool shutdown_tx_PGA)
+{
+  int c;
+  if(target_freq < 158e6) {        // VHF low
+    c = 0xa0;
+  }
+  else if(target_freq < 464e6) {   // VHF high
+    c = 0x90;
+  }
+  else {                           // UHF
+    c = 0x30;
+  }
+
+  if(shutdown_tx_PGA) {
+    c |= 0x08;
+  }
+
+  return c;
+}
+
+
+/**************************************************************************************************/
+
+
+db_tv_rx::db_tv_rx(usrp1_base *usrp, int which, float first_IF, float 
second_IF)
+  : db_base(usrp, which, true)
+{
+  // Handler for Tv Rx daughterboards.
+  // 
+  // @param usrp: instance of usrp.source_c
+  // @param which: which side: 0 or 1 corresponding to RX_A or RX_B 
respectively
+
+  d_tx = false;
+
+  if(which == 0) {
+    d_i2c_addr = 0x60;
+  }
+  else {
+    d_i2c_addr = 0x61;
+  }
+
+  d_first_IF = first_IF;
+  d_second_IF = second_IF;
+  d_reference_divisor = 640;
+  d_fast_tuning = false;
+  d_inverted = false;                     // FIXME get rid of this
+        
+  std::vector<float> g = gain_range();                  // initialize gain
+  set_gain(float(g[0]+g[1]) / 2);
+
+  bypass_adc_buffers(false);
+}
+
+// Gain setting
+void
+db_tv_rx::_set_rfagc(float gain)
+{
+  float voltage;
+
+  assert(gain <= 60 && gain >= 0);
+  // FIXME this has a 0.5V step between gain = 60 and gain = 59.
+  // Why are there two cases instead of a single linear case?
+  if(gain == 60) {
+    voltage = 4;
+  }
+  else {
+    voltage = gain/60.0 * 2.25 + 1.25;
+  }
+  int dacword = int(4096*voltage/1.22/3.3);    // 1.22 = opamp gain
+
+  assert(dacword>=0 && dacword<4096);
+  d_usrp->write_aux_dac(d_which, 1, dacword);
+}
+
+void
+db_tv_rx::_set_ifagc(float gain)
+{
+  float voltage;
+
+  assert(gain <= 35 && gain >= 0);
+  voltage = gain/35.0 * 2.1 + 1.4;
+  int dacword = int(4096*voltage/1.22/3.3);    // 1.22 = opamp gain
+  
+  assert(dacword>=0 && dacword<4096);
+  d_usrp->write_aux_dac(d_which, 0, dacword);
+}
+
+void
+db_tv_rx::_set_pga(float pga_gain)
+{
+  assert(pga_gain >=0 && pga_gain <=20);
+  if(d_which == 0) {
+    d_usrp->set_pga(0, pga_gain);
+  }
+  else {
+    d_usrp->set_pga (2, pga_gain);
+  }
+}           
+
+std::vector<float> 
+db_tv_rx::freq_range() 
+{
+  // Return range of frequencies in Hz that can be tuned by this d'board.
+  // 
+  // @returns (min_freq, max_freq, step_size)
+  // @rtype tuple
+  
+  std::vector<float> f(3,0);
+  f[0] = 50e6;
+  f[1] = 860e6;
+  f[2] = 10e3;
+  return f;
+}
+
+std::vector<float>
+db_tv_rx::set_freq(float target_freq)
+{
+  // Set the frequency.
+  // 
+  // @param freq:  target RF frequency in Hz
+  // @type freq:   float
+  // 
+  // @returns (ok, actual_baseband_freq) where:
+  //   ok is True or False and indicates success or failure,
+  //   actual_baseband_freq is the RF frequency that corresponds to DC in the 
IF.
+  
+  std::vector<float> args(2, 0);
+
+  std::vector<float> r = freq_range();
+  if((target_freq < r[0]) || (target_freq > r[1])) {
+    return args;
+  }
+  
+  float target_lo_freq = target_freq + d_first_IF;  // High side mixing
+  float f_ref = 4e6 / d_reference_divisor;           // frequency steps
+
+  int divisor = int((target_lo_freq + (f_ref * 4)) / (f_ref * 8));  
+  float actual_lo_freq = (f_ref * 8 * divisor);
+  float actual_freq = actual_lo_freq - d_first_IF;
+
+  if((divisor & ~0x7fff) != 0) {               // must be 15-bits or less
+    return args;
+  }
+        
+  // build i2c command string
+  std::vector<int> buf(4);
+  buf[0] = (divisor >> 8) & 0xff;         // DB1
+  buf[1] = divisor & 0xff;                // DB2
+  buf[2] = control_byte_1(d_fast_tuning, d_reference_divisor);
+  buf[3] = control_byte_2(actual_freq, true);
+
+  bool ok = d_usrp->write_i2c(d_i2c_addr, int_seq_to_str (buf));
+
+  args[0] = 1;
+  args[1] = actual_freq - d_second_IF;
+  return args;
+}
+
+std::vector<float>
+db_tv_rx::gain_range()
+{
+  // Return range of gain that can be set by this d'board.
+  // 
+  // @returns (min_gain, max_gain, step_size)
+  //    Where gains are expressed in decibels (your mileage may vary)
+  
+  std::vector<float> g(3,0);
+  g[0] = 0;
+  g[1] = 115;
+  g[2] = 1;
+  return g;
+}
+
+bool 
+db_tv_rx::set_gain(float gain)
+{
+  // Set the gain.
+  // 
+  // @param gain:  gain in decibels
+  // @returns True/False
+
+  float rfgain, ifgain, pgagain;
+
+  assert(gain>=0 && gain<=115);
+  if(gain>60) {
+    rfgain = 60;
+    gain = gain - 60;
+  }
+  else {
+    rfgain = gain;
+    gain = 0;
+  }
+   
+  if(gain > 35) {
+    ifgain = 35;
+    gain = gain - 35;
+  }
+  else {
+    ifgain = gain;
+    gain = 0;
+  }
+
+  pgagain = gain;
+  _set_rfagc(rfgain);
+  _set_ifagc(ifgain);
+  _set_pga(pgagain);
+
+  return true;
+}
+
+bool 
+db_tv_rx::is_quadrature()
+{
+  // Return True if this board requires both I & Q analog channels.  
+  return false;
+}
+
+bool
+db_tv_rx::spectrum_inverted() 
+{
+  // The 43.75 MHz version is inverted
+  return d_inverted;
+}

Added: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.h            
                (rev 0)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.h    
2008-07-13 17:18:56 UTC (rev 8874)
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+//
+// Copyright 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 asversion 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 DB_TV_RX_H
+#define DB_TV_RX_H
+
+#include <db_base.h>
+#include <gr_sync_block.h>
+
+class usrp1_base;
+
+class db_tv_rx : public db_base
+{
+private:
+  void _set_rfagc(float gain);
+  void _set_ifagc(float gain);
+  void _set_pga(float pga_gain);
+
+  int d_i2c_addr;
+  float d_first_IF, d_second_IF;
+  int d_reference_divisor;
+  bool d_fast_tuning;
+  bool d_inverted;
+
+public:
+  db_tv_rx(usrp1_base *usrp, int which, 
+                float first_IF, float second_IF);
+
+  std::vector<float> freq_range();
+  std::vector<float> set_freq(float target_freq);
+  std::vector<float> gain_range();
+  bool               set_gain(float gain);
+  bool               is_quadrature();
+  bool               spectrum_inverted();
+};
+
+std::string int_seq_to_str(std::vector<int> &seq);
+std::vector<int> str_to_int_seq(std::string str);
+int control_byte_1(bool fast_tuning_p, int reference_divisor);
+int control_byte_2(float target_freq, bool shutdown_tx_PGA);
+
+#endif

Added: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.i
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.i            
                (rev 0)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_tv_rx.i    
2008-07-13 17:18:56 UTC (rev 8874)
@@ -0,0 +1,40 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 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.
+ */
+
+%{
+#include "db_tv_rx.h"
+%}
+
+class db_tv_rx : public db_base
+{
+public:
+  db_tv_rx(usrp1_base *usrp, int which, 
+          float first_IF, float second_IF);
+
+  std::vector<float> freq_range();
+  std::vector<float> set_freq(float target_freq);
+  std::vector<float> gain_range();
+  bool               set_gain(float gain);
+  bool               is_quadrature();
+  bool               spectrum_inverted();
+};
+





reply via email to

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