[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9236 - gnuradio/branches/developers/trondeau/dbs/usrp
From: |
trondeau |
Subject: |
[Commit-gnuradio] r9236 - gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy |
Date: |
Sun, 10 Aug 2008 22:48:38 -0600 (MDT) |
Author: trondeau
Date: 2008-08-10 22:48:38 -0600 (Sun, 10 Aug 2008)
New Revision: 9236
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.h
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.h
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.cc
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.h
Log:
wip: moving vector of daughterboards into usrp_basic
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
2008-08-11 03:20:39 UTC (rev 9235)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.cc
2008-08-11 04:48:38 UTC (rev 9236)
@@ -20,6 +20,7 @@
//
#include <db_base.h>
+#include <stdexcept>
tune_result::tune_result(float baseband, float dxc, float residual, bool inv)
: ok(false), baseband_freq(baseband), dxc_freq(dxc),
@@ -70,7 +71,7 @@
db_base::bypass_adc_buffers(bool bypass)
{
if(d_tx) {
- throw "TX Board has no adc buffers";
+ throw std::runtime_error("TX Board has no adc buffers\n");
}
if(d_which==0) {
@@ -123,13 +124,13 @@
float
db_base::freq_min()
{
- throw 0;
+ throw std::runtime_error("freq_min() called from base class\n");
}
float
db_base::freq_max()
{
- throw 0;
+ throw std::runtime_error("freq_max() called from base class\n");
}
struct freq_result_t
@@ -143,26 +144,26 @@
// @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.
- throw 0;
+ throw std::runtime_error("set_freq() called from base class\n");
}
float
db_base::gain_min()
{
- throw 0;
+ throw std::runtime_error("gain_min() called from base class\n");
}
float
db_base::gain_max()
{
- throw 0;
+ throw std::runtime_error("gain_max() called from base class\n");
}
float
db_base::gain_db_per_step()
{
- throw 0;
+ throw std::runtime_error("gain_db_per_step() called from base class\n");
}
bool
@@ -172,8 +173,7 @@
//
// @param gain: gain in decibels
// @returns True/False
- printf("db_base::set_gain\n");
- throw 0;
+ throw std::runtime_error("set_gain() called from base class\n");
}
bool
@@ -183,7 +183,7 @@
// That is, 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.
- throw 0;
+ throw std::runtime_error("is_quadrature() called from base class\n");
}
bool
@@ -278,7 +278,7 @@
db_base::_refclk_divisor()
{
// Return value to stick in REFCLK_DIVISOR register
- throw 0;
+ throw std::runtime_error("_reflck_divisor() called from base class\n");;
}
tune_result
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
2008-08-11 03:20:39 UTC (rev 9235)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_base.h
2008-08-11 04:48:38 UTC (rev 9236)
@@ -26,13 +26,10 @@
#include <fpga_regs_standard.h>
#include <fpga_regs_common.h>
#include <vector>
-#include <usrp_basic.h>
-#include <usrp_standard.h>
#include <usrp_prims.h>
#include <usrp_spi_defs.h>
+#include <usrp_standard.h>
-class usrp_base;
-
#define NUM_DAUGHTERBOARDS 1
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.cc
2008-08-11 03:20:39 UTC (rev 9235)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.cc
2008-08-11 04:48:38 UTC (rev 9236)
@@ -21,76 +21,81 @@
//
#include <db_boards.h>
+#include <usrp_dbid.h>
+#include <db_basic.h>
+#include <db_tv_rx.h>
+#include <db_flexrf.h>
+#include <db_flexrf_mimo.h>
-db_base * instantiate_dbs(int dbid, usrp_basic * usrp, int which)
+std::vector<db_base_sptr>
+instantiate_dbs(int dbid, usrp_basic * usrp, int which)
{
- db_base *db;
+ std::vector<db_base_sptr> db;
- printf("dbid: %d\n", dbid);
-
switch(dbid) {
- /*
case(USRP_DBID_BASIC_TX):
- db = new db_basic_tx(usrp, which);
+ db.push_back(db_base_sptr(new db_basic_tx(usrp, which)));
+ db.push_back(db_base_sptr(new db_basic_tx(usrp, which)));
break;
- */
case(USRP_DBID_TV_RX):
- db = new db_tv_rx(usrp, which, 43.75e6, 5.75e6);
+ db.push_back(db_base_sptr(new db_tv_rx(usrp, which, 43.75e6, 5.75e6)));
break;
case(USRP_DBID_TV_RX_REV_2):
- db = new db_tv_rx(usrp, which, 44e6, 20e6);
+ db.push_back(db_base_sptr(new db_tv_rx(usrp, which, 44e6, 20e6)));
break;
case(USRP_DBID_TV_RX_REV_3):
- db = new db_tv_rx(usrp, which, 44e6, 20e6);
+ db.push_back(db_base_sptr(new db_tv_rx(usrp, which, 44e6, 20e6)));
break;
case(USRP_DBID_FLEX_2400_TX):
- db = new db_flexrf_2400_tx(usrp, which);
+ db.push_back(db_base_sptr(new db_flexrf_2400_tx(usrp, which)));
break;
- case(USRP_DBID_FLEX_2400_RX): db = new db_flexrf_2400_rx(usrp, which); break;
- //case(USRP_DBID_FLEX_1200_TX): db = new db_flexrf_1200_tx(usrp, which);
break;
- //case(USRP_DBID_FLEX_1200_RX): db = new db_flexrf_1200_rx(usrp, which);
break;
- //case(USRP_DBID_FLEX_1800_TX): db = new db_flexrf_1800_tx(usrp, which);
break;
- //case(USRP_DBID_FLEX_1800_RX): db = new db_flexrf_1800_rx(usrp, which);
break;
- //case(USRP_DBID_FLEX_900_TX): db = new db_flexrf_900_tx(usrp, which);
break;
- //case(USRP_DBID_FLEX_900_RX): db = new db_flexrf_900_rx(usrp, which);
break;
- //case(USRP_DBID_FLEX_400_TX): db = new db_flexrf_400_tx(usrp, which);
break;
- //case(USRP_DBID_FLEX_400_RX): db = new db_flexrf_400_rx(usrp, which);
break;
+ case(USRP_DBID_FLEX_2400_RX): db.push_back(db_base_sptr(new
db_flexrf_2400_rx(usrp, which))); break;
+ //case(USRP_DBID_FLEX_1200_TX): db.push_back(new db_flexrf_1200_tx(usrp,
which)); break;
+ //case(USRP_DBID_FLEX_1200_RX): db .push_back(new db_flexrf_1200_rx(usrp,
which)); break;
+ //case(USRP_DBID_FLEX_1800_TX): db.push_back(new db_flexrf_1800_tx(usrp,
which)); break;
+ //case(USRP_DBID_FLEX_1800_RX): db.push_back(new db_flexrf_1800_rx(usrp,
which)); break;
+ //case(USRP_DBID_FLEX_900_TX): db.push_back(new db_flexrf_900_tx(usrp,
which)); break;
+ //case(USRP_DBID_FLEX_900_RX): db.push_back(new db_flexrf_900_rx(usrp,
which)); break;
+ //case(USRP_DBID_FLEX_400_TX): db.push_back(new db_flexrf_400_tx(usrp,
which)); break;
+ //case(USRP_DBID_FLEX_400_RX): db.push_back(new db_flexrf_400_rx(usrp,
which)); break;
- case(USRP_DBID_FLEX_2400_TX_MIMO_A): db = new db_flexrf_2400_tx_mimo_a(usrp,
which); break;
- case(USRP_DBID_FLEX_2400_RX_MIMO_A): db = new db_flexrf_2400_rx_mimo_a(usrp,
which); break;
- //case(USRP_DBID_FLEX_1800_TX_MIMO_A): db = new
db_flexrf_1800_tx_mimo_a(usrp, which); break;
- //case(USRP_DBID_FLEX_1800_RX_MIMO_A): db = new
db_flexrf_1800_rx_mimo_a(usrp, which); break;
- //case(USRP_DBID_FLEX_1200_TX_MIMO_A): db = new
db_flexrf_1200_tx_mimo_a(usrp, which); break;
- //case(USRP_DBID_FLEX_1200_RX_MIMO_A): db = new
db_flexrf_1200_rx_mimo_a(usrp, which); break;
- //case(USRP_DBID_FLEX_900_TX_MIMO_A): db = new
db_flexrf_900_tx_mimo_a(usrp, which); break;
- //case(USRP_DBID_FLEX_900_RX_MIMO_A): db = new
db_flexrf_900_rx_mimo_a(usrp, which); break;
- //case(USRP_DBID_FLEX_400_TX_MIMO_A): db = new
db_flexrf_400_tx_mimo_a(usrp, which); break;
- //case(USRP_DBID_FLEX_400_RX_MIMO_A): db = new
db_flexrf_400_rx_mimo_a(usrp, which); break;
- //case(USRP_DBID_FLEX_2400_TX_MIMO_B): db = new
db_flexrf_2400_tx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_2400_RX_MIMO_B): db = new
db_flexrf_2400_rx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_1800_TX_MIMO_B): db = new
db_flexrf_1800_tx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_1800_RX_MIMO_B): db = new
db_flexrf_1800_rx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_1200_TX_MIMO_B): db = new
db_flexrf_1200_tx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_1200_RX_MIMO_B): db = new
db_flexrf_1200_rx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_900_TX_MIMO_B): db = new
db_flexrf_900_tx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_900_RX_MIMO_B): db = new
db_flexrf_900_rx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_400_TX_MIMO_B): db = new
db_flexrf_400_tx_mimo_b(usrp, which); break;
- //case(USRP_DBID_FLEX_400_RX_MIMO_B): db = new
db_flexrf_400_rx_mimo_b(usrp, which); break;
+ case(USRP_DBID_FLEX_2400_TX_MIMO_A): db.push_back(db_base_sptr(new
db_flexrf_2400_tx_mimo_a(usrp, which))); break;
+ case(USRP_DBID_FLEX_2400_RX_MIMO_A): db.push_back(db_base_sptr(new
db_flexrf_2400_rx_mimo_a(usrp, which))); break;
+ //case(USRP_DBID_FLEX_1800_TX_MIMO_A): db.push_back(new
db_flexrf_1800_tx_mimo_a(usrp, which)); break;
+ //case(USRP_DBID_FLEX_1800_RX_MIMO_A): db.push_back(new
db_flexrf_1800_rx_mimo_a(usrp, which)); break;
+ //case(USRP_DBID_FLEX_1200_TX_MIMO_A): db.push_back(new
db_flexrf_1200_tx_mimo_a(usrp, which)); break;
+ //case(USRP_DBID_FLEX_1200_RX_MIMO_A): db.push_back(new
db_flexrf_1200_rx_mimo_a(usrp, which)); break;
+ //case(USRP_DBID_FLEX_900_TX_MIMO_A): db.push_back(new
db_flexrf_900_tx_mimo_a(usrp, which)); break;
+ //case(USRP_DBID_FLEX_900_RX_MIMO_A): db.push_back(new
db_flexrf_900_rx_mimo_a(usrp, which)); break;
+ //case(USRP_DBID_FLEX_400_TX_MIMO_A): db.push_back(new
db_flexrf_400_tx_mimo_a(usrp, which)); break;
+ //case(USRP_DBID_FLEX_400_RX_MIMO_A): db.push_back(new
db_flexrf_400_rx_mimo_a(usrp, which)); break;
+ //case(USRP_DBID_FLEX_2400_TX_MIMO_B): db.push_back(new
db_flexrf_2400_tx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_2400_RX_MIMO_B): db.push_back(new
db_flexrf_2400_rx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_1800_TX_MIMO_B): db.push_back(new
db_flexrf_1800_tx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_1800_RX_MIMO_B): db.push_back(new
db_flexrf_1800_rx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_1200_TX_MIMO_B): db.push_back(new
db_flexrf_1200_tx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_1200_RX_MIMO_B): db.push_back(new
db_flexrf_1200_rx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_900_TX_MIMO_B): db.push_back(new
db_flexrf_900_tx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_900_RX_MIMO_B): db.push_back(new
db_flexrf_900_rx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_400_TX_MIMO_B): db.push_back(new
db_flexrf_400_tx_mimo_b(usrp, which)); break;
+ //case(USRP_DBID_FLEX_400_RX_MIMO_B): db.push_back(new
db_flexrf_400_rx_mimo_b(usrp, which)); break;
case(-1):
try {
+ // FIXME
//usrp->tx_freq(0);
- //db = new db_basic_tx(usrp, which);
- db = NULL;
+ db.push_back(db_base_sptr(new db_basic_tx(usrp, which)));
}
catch (int e) {
- db = NULL; //new db_basic_rx(usrp, which);
+ // FIXME: should return rx when it gets defined
+ //db.push_back(db_base_sptr(new db_basic_rx(usrp, which)));
+ db.push_back(db_base_sptr(new db_basic_tx(usrp, which)));
}
break;
@@ -101,14 +106,14 @@
usrp->tx_freq(0);
fprintf(stderr, "\n\aWarning: Treating daughterboard with invalid EEPROM
contents as if it were a \"Basic Tx.\"\n");
fprintf(stderr, "Warning: This is almost certainly wrong... Use
appropriate burn-*-eeprom utility.\n\n");
- db = new db_basic_tx(usrp, which);
+ db.push_back(db_base_sptr(new db_basic_tx(usrp, which)));
*/
- db = NULL;
+ db.push_back(db_base_sptr(new db_basic_tx(usrp, which)));
}
catch (int e) {
fprintf(stderr, "\n\aWarning: Treating daughterboard with invalid EEPROM
contents as if it were a \"Basic Rx.\"\n");
fprintf(stderr, "Warning: This is almost certainly wrong... Use
appropriate burn-*-eeprom utility.\n\n");
- db = NULL; //new db_basic_rx(usrp, which);
+ db.push_back(db_base_sptr(new db_basic_tx(usrp, which)));
}
break;
}
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.h
2008-08-11 03:20:39 UTC (rev 9235)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_boards.h
2008-08-11 04:48:38 UTC (rev 9236)
@@ -23,16 +23,16 @@
#ifndef DB_BOARDS_H
#define DB_BOARDS_H
+#include <db_base.h>
#include <usrp_basic.h>
-#include <usrp_dbid.h>
-#include <db_base.h>
-//#include <db_basic.h>
-#include <db_tv_rx.h>
-#include <db_flexrf.h>
-#include <db_flexrf_mimo.h>
+#include <vector>
+#include <boost/shared_ptr.hpp>
-db_base * instantiate_dbs(int dbid, usrp_basic *usrp, int which);
+class db_base;
+typedef boost::shared_ptr<db_base> db_base_sptr;
+std::vector<db_base_sptr> instantiate_dbs(int dbid, usrp_basic *usrp, int
which);
+
#endif
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
2008-08-11 03:20:39 UTC (rev 9235)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.cc
2008-08-11 04:48:38 UTC (rev 9236)
@@ -21,6 +21,7 @@
#include <db_flexrf.h>
#include <sstream>
#include <assert.h>
+#include <stdexcept>
flexrf_base::flexrf_base(usrp_basic *usrp, int which)
@@ -162,21 +163,19 @@
*/
//raise NotImplementedError;
- throw 0;
+ throw std::runtime_error("_compute_regs called from flexrf_base\n");
}
int
flexrf_base::_compute_control_reg()
{
- throw 0;
+ throw std::runtime_error("_compute_control_regs called from flexrf_base\n");
}
float
-flexrf_base::_refclk_freq(flexrf_base *child)
+flexrf_base::_refclk_freq()
{
- // return float(d_u.fpga_master_clock_freq())/d_refclk_divisor()
- printf("frexrf_base::_refclk_freq()\n");
- return 64e6/child->_refclk_divisor();
+ return 64e6/_refclk_divisor();
}
//std::vector<float>
@@ -452,9 +451,7 @@
d_usrp->write_io(d_which, RX2_RX1N, RX2_RX1N);
}
else {
- //raise ValueError, "which_antenna must be either 'TX/RX' or 'RX2'";
- printf("which_antenna must be either 'TX/RX' or 'RX2'\n");
- throw 0;
+ throw std::invalid_argument("which_antenna must be either 'TX/RX' or
'RX2'\n");
}
}
@@ -837,7 +834,7 @@
bool
db_flexrf_2400_tx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
@@ -848,6 +845,7 @@
d_common = new _2400_common(false);
d_power_on = 0;
d_power_off = 0; // Powering it off kills the serial bus
+ printf("db_flexrf_2400_rx\n");
}
db_flexrf_2400_rx::~db_flexrf_2400_rx()
@@ -895,7 +893,7 @@
bool
db_flexrf_2400_rx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
int
@@ -942,7 +940,7 @@
bool
db_flexrf_1200_tx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
@@ -1000,7 +998,7 @@
bool
db_flexrf_1200_rx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
int
@@ -1047,7 +1045,7 @@
bool
db_flexrf_1800_tx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
@@ -1105,7 +1103,7 @@
bool
db_flexrf_1800_rx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
int
@@ -1152,7 +1150,7 @@
bool
db_flexrf_900_tx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
@@ -1208,7 +1206,7 @@
bool
db_flexrf_900_rx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
int
@@ -1255,7 +1253,7 @@
bool
db_flexrf_400_tx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
@@ -1313,7 +1311,7 @@
bool
db_flexrf_400_rx::_compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq)
{
- return d_common->_compute_regs(_refclk_freq(this), freq, retR, retcontrol,
retN, retfreq);
+ return d_common->_compute_regs(_refclk_freq(), freq, retR, retcontrol, retN,
retfreq);
}
int
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
2008-08-11 03:20:39 UTC (rev 9235)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/db_flexrf.h
2008-08-11 04:48:38 UTC (rev 9236)
@@ -66,7 +66,7 @@
virtual bool _compute_regs(float freq, int &retR, int &retcontrol, int
&retN, float &retfreq);
virtual int _compute_control_reg();
- float _refclk_freq(flexrf_base *child);
+ float _refclk_freq();
bool _set_pga(float pga_gain);
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
2008-08-11 03:20:39 UTC (rev 9235)
+++
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.cc
2008-08-11 04:48:38 UTC (rev 9236)
@@ -35,6 +35,7 @@
#include <math.h>
#include <ad9862.h>
#include <string.h>
+#include <db_boards.h>
using namespace ad9862;
@@ -196,6 +197,8 @@
*/
memset (d_fpga_shadows, 0, sizeof (d_fpga_shadows));
+ d_db.resize(4);
+
usrp_one_time_init ();
if (!usrp_load_standard_bits (which_board, false, fpga_filename,
firmware_filename))
@@ -232,8 +235,6 @@
usb_close (d_udh);
}
-
-
int
usrp_basic::dboard_to_slot (int dboard)
{
@@ -243,6 +244,16 @@
// tx=(0,2) rx=(1,3)
}
+std::vector<db_base_sptr>
+usrp_basic::db(int which)
+{
+ if(which > 3) {
+ throw std::invalid_argument("usrp_standard_commond::db which must be
0, 1, 2, or 3");
+ }
+ return d_db[which];
+}
+
+
/********************************************
PGA functions
********************************************/
@@ -726,7 +737,10 @@
set_dc_offset_cl_enable(0xf, 0xf); // enable DC offset removal control
loops
+ printf("probing rx slots\n");
probe_rx_slots (false);
+ d_db[SLOT_RX_A] = instantiate_dbs(d_dbid[SLOT_RX_A], this, which_board);
+ d_db[SLOT_RX_B] = instantiate_dbs(d_dbid[SLOT_RX_B], this, which_board);
// check fusb buffering parameters
@@ -774,7 +788,19 @@
}
}
+std::vector<db_base_sptr>
+usrp_basic_rx::db(int which)
+{
+ // When called from here, only return if the RX side
+ if(which == 0) {
+ return d_db[SLOT_RX_A];
+ }
+ else {
+ return d_db[SLOT_RX_B];
+ }
+}
+
bool
usrp_basic_rx::start ()
{
@@ -945,7 +971,7 @@
switch (s){
case UDBE_OK:
- d_dbid[i] = eeprom.id;
+ d_dbid[slot_id] = eeprom.id;
msg = usrp_dbid_to_string (eeprom.id).c_str ();
set_adc_offset (2*i+0, eeprom.offset[0]);
set_adc_offset (2*i+1, eeprom.offset[1]);
@@ -954,14 +980,14 @@
break;
case UDBE_NO_EEPROM:
- d_dbid[i] = -1;
+ d_dbid[slot_id] = -1;
msg = "<none>";
_write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000);
_write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000);
break;
case UDBE_INVALID_EEPROM:
- d_dbid[i] = -2;
+ d_dbid[slot_id] = -2;
msg = "Invalid EEPROM contents";
_write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000);
_write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000);
@@ -1075,7 +1101,10 @@
set_fpga_tx_sample_rate_divisor (4); // we're using interp x4
+ printf("probing tx slots\n");
probe_tx_slots (false);
+ d_db[SLOT_TX_A] = instantiate_dbs(d_dbid[SLOT_TX_A], this, which_board);
+ d_db[SLOT_TX_B] = instantiate_dbs(d_dbid[SLOT_TX_B], this, which_board);
// check fusb buffering parameters
@@ -1295,7 +1324,7 @@
switch (s){
case UDBE_OK:
- d_dbid[i] = eeprom.id;
+ d_dbid[slot_id] = eeprom.id;
msg = usrp_dbid_to_string (eeprom.id).c_str ();
// FIXME, figure out interpretation of dc offset for TX d'boards
// offset = (eeprom.offset[1] << 16) | (eeprom.offset[0] & 0xffff);
@@ -1304,14 +1333,14 @@
break;
case UDBE_NO_EEPROM:
- d_dbid[i] = -1;
+ d_dbid[slot_id] = -1;
msg = "<none>";
_write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000);
_write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000);
break;
case UDBE_INVALID_EEPROM:
- d_dbid[i] = -2;
+ d_dbid[slot_id] = -2;
msg = "Invalid EEPROM contents";
_write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000);
_write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000);
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.h
2008-08-11 03:20:39 UTC (rev 9235)
+++ gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_basic.h
2008-08-11 04:48:38 UTC (rev 9236)
@@ -41,7 +41,13 @@
#include <usrp_slots.h>
#include <string>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+class db_base;
+typedef boost::shared_ptr<db_base> db_base_sptr;
+
struct dxc_freq_t
{
float ddc_freq;
@@ -73,6 +79,9 @@
bool d_tx; // is this for RX or TX?
int d_dbid[4]; // daughterboard ID's; 0,1 for
Rx, 2,3 for Tx
+
+ std::vector< std::vector<db_base_sptr> > d_db;
+
static const int MAX_REGS = 128;
unsigned int d_fpga_shadows[MAX_REGS];
@@ -100,6 +109,8 @@
public:
virtual ~usrp_basic ();
+ std::vector<db_base_sptr> db(int which);
+
/*!
* \brief Return daughterboard ID for given daughterboard slot [0,1].
*
@@ -462,6 +473,8 @@
public:
~usrp_basic_rx ();
+ std::vector<db_base_sptr> db(int which);
+
/*!
* \brief invokes constructor, returns instance or 0 if trouble
*
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.cc
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.cc
2008-08-11 03:20:39 UTC (rev 9235)
+++
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.cc
2008-08-11 04:48:38 UTC (rev 9236)
@@ -25,6 +25,7 @@
#include "usrp_prims.h"
#include "fpga_regs_common.h"
#include "fpga_regs_standard.h"
+#include <db_boards.h>
#include <stdexcept>
#include <assert.h>
#include <math.h>
@@ -102,6 +103,7 @@
if (d_fpga_caps == OLD_CAPS_VAL)
d_fpga_caps = DEFAULT_CAPS_VAL;
+
if (0){
fprintf(stdout, "has_rx_halfband = %d\n", has_rx_halfband());
fprintf(stdout, "nddcs = %d\n", nddcs());
@@ -396,6 +398,17 @@
return d_rx_freq[channel];
}
+/*
+db_base_sptr
+usrp_standard_rx::db(int which) const
+{
+ if(which > 1) {
+ throw std::invalid_argument("usrp_standard_tx::db which is not 0 or
1");
+ }
+ return d_db[which];
+}
+*/
+
bool
usrp_standard_rx::set_fpga_mode (int mode)
{
@@ -553,6 +566,10 @@
d_coarse_mod[i] = CM_OFF;
set_tx_freq (i, 0);
}
+
+ // int usrp_basic::d_dbid[4] --> daughterboard ID's; 2,3 for Tx
+ d_db[0] = instantiate_dbs(d_dbid[2], this, which_board);
+ d_db[1] = instantiate_dbs(d_dbid[3], this, which_board);
}
usrp_standard_tx::~usrp_standard_tx ()
@@ -821,6 +838,17 @@
return d_tx_freq[channel];
}
+/*
+db_base_sptr
+usrp_standard_tx::db(int which) const
+{
+ if(which > 1) {
+ throw std::invalid_argument("usrp_standard_tx::db which is not 0 or 1");
+ }
+ return d_db[which];
+}
+*/
+
usrp_standard_tx::coarse_mod_t
usrp_standard_tx::coarse_modulator (int channel) const
{
Modified:
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.h
===================================================================
---
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.h
2008-08-11 03:20:39 UTC (rev 9235)
+++
gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy/usrp_standard.h
2008-08-11 04:48:38 UTC (rev 9236)
@@ -53,13 +53,13 @@
/*!
* \brief number of digital upconverters implemented in the FPGA
+
* This will be 0, 1, or 2.
*/
int nducs() const;
virtual bool set_rx_freq (int channel, double freq) { throw 0; }
virtual bool set_tx_freq (int channel, double freq) { throw 0; }
-
};
/*!
@@ -76,6 +76,7 @@
int d_sw_mux;
int d_hw_mux;
double d_rx_freq[MAX_CHAN];
+ //db_base_sptr d_db[2];
protected:
usrp_standard_rx (int which_board,
@@ -224,6 +225,7 @@
int nchannels () const;
int mux () const;
unsigned int format () const;
+ //db_base_sptr db(int which) const;
// called in base class to derived class order
bool start ();
@@ -257,6 +259,7 @@
double d_tx_freq[MAX_CHAN];
coarse_mod_t d_coarse_mod[MAX_CHAN];
unsigned char d_tx_modulator_shadow[MAX_CHAN];
+ //db_base_sptr d_db[2];
virtual bool set_coarse_modulator (int channel, coarse_mod_t cm);
usrp_standard_tx::coarse_mod_t coarse_modulator (int channel) const;
@@ -361,6 +364,7 @@
double tx_freq (int channel) const;
int nchannels () const;
int mux () const;
+ //db_base_sptr db(int which) const;
// called in base class to derived class order
bool start ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9236 - gnuradio/branches/developers/trondeau/dbs/usrp/host/lib/legacy,
trondeau <=