[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9764 - gnuradio/branches/developers/eb/cppdb-wip/usrp
From: |
eb |
Subject: |
[Commit-gnuradio] r9764 - gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy |
Date: |
Thu, 9 Oct 2008 01:03:41 -0600 (MDT) |
Author: eb
Date: 2008-10-09 01:03:39 -0600 (Thu, 09 Oct 2008)
New Revision: 9764
Added:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base_impl.h
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.h
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.h
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt754.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt768.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf_mimo.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.h
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_xcvr2450.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
Log:
Added db(int which_side) method back into usrp_basic. Refactored a
bunch of includes related to db_*. Not yet tested, but just about
ready to test.
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
2008-10-09 07:03:39 UTC (rev 9764)
@@ -114,7 +114,8 @@
db_dbs_rx.cc \
db_xcvr2450.cc \
db_dtt754.cc \
- db_dtt768.cc
+ db_dtt768.cc \
+ db_util.cc
# db_wbx.cc
@@ -161,6 +162,8 @@
noinst_HEADERS = \
ad9862.h \
+ db_base_impl.h \
+ db_util.h \
fusb.h \
fusb_darwin.h \
fusb_win32.h \
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -20,7 +20,7 @@
//
#include <db_base.h>
-#include <stdexcept>
+#include <db_base_impl.h>
tune_result::tune_result(double baseband, double dxc, double residual, bool
inv)
: ok(false), baseband_freq(baseband), dxc_freq(dxc),
@@ -47,19 +47,19 @@
}
int
-db_base::dbid()
+db_base::dbid() const
{
return d_usrp->daughterboard_id(d_which);
}
std::string
-db_base::name()
+db_base::name() const
{
return usrp_dbid_to_string(dbid());
}
std::string
-db_base::side_and_name()
+db_base::side_and_name() const
{
if(d_which == 0)
return "A: " + name();
@@ -218,6 +218,16 @@
throw std::runtime_error("_reflck_divisor() called from base class\n");;
}
+
+std::ostream &operator<<(std::ostream &os, const db_base &x)
+{
+ os << x.side_and_name();
+ return os;
+}
+
+
+
+
#if 0 // FIXME tune shouldn't be a method of db_base
tune_result
db_base::tune(int chan, double target_freq)
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base.h
2008-10-09 07:03:39 UTC (rev 9764)
@@ -20,17 +20,15 @@
// Boston, MA 02110-1301, USA.
//
-#ifndef DB_BASE_H
-#define DB_BASE_H
+#ifndef INCLUDED_DB_BASE_H
+#define INCLUDED_DB_BASE_H
-#include <fpga_regs_standard.h>
-#include <fpga_regs_common.h>
-#include <vector>
-#include <usrp_prims.h>
-#include <usrp_spi_defs.h>
-#include <usrp_standard.h>
+#include <string>
+#include <iosfwd>
+class usrp_basic;
+
class tune_result
{
public:
@@ -59,9 +57,9 @@
db_base(usrp_basic *usrp, int which);
virtual ~db_base();
- int dbid();
- std::string name();
- std::string side_and_name();
+ int dbid() const;
+ std::string name() const;
+ std::string side_and_name() const;
bool bypass_adc_buffers(bool bypass);
bool set_atr_mask(int v);
@@ -104,6 +102,7 @@
double d_lo_offset;
};
-#endif
+std::ostream & operator<<(std::ostream &os, const db_base &x);
+#endif /* INCLUDED_DB_BASE_H */
Added:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base_impl.h
===================================================================
---
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base_impl.h
(rev 0)
+++
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base_impl.h
2008-10-09 07:03:39 UTC (rev 9764)
@@ -0,0 +1,33 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_DB_BASE_IMPL_H
+#define INCLUDED_DB_BASE_IMPL_H
+
+#include <db_base.h>
+#include <db_util.h>
+#include <usrp_basic.h>
+#include <fpga_regs_standard.h>
+#include <fpga_regs_common.h>
+#include <usrp_prims.h>
+#include <usrp_spi_defs.h>
+#include <stdexcept>
+
+#endif /* INCLUDED_DB_BASE_IMPL_H */
Property changes on:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_base_impl.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_basic.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -19,6 +19,7 @@
// Boston, MA 02110-1301, USA.
#include <db_basic.h>
+#include <db_base_impl.h>
/******************************************************************************/
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.h
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_boards.h
2008-10-09 07:03:39 UTC (rev 9764)
@@ -25,12 +25,7 @@
#include <db_base.h>
#include <usrp_basic.h>
-#include <vector>
-#include <boost/shared_ptr.hpp>
-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_side);
#endif
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -19,10 +19,7 @@
// Boston, MA 02110-1301, USA.
#include <db_dbs_rx.h>
-#include <db_tv_rx.h>
-#include <sstream>
-#include <assert.h>
-#include <stdexcept>
+#include <db_base_impl.h>
#include <cmath>
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dbs_rx.h
2008-10-09 07:03:39 UTC (rev 9764)
@@ -23,6 +23,7 @@
#define DB_DBS_RX_H
#include <db_base.h>
+#include <vector>
struct bw_t {
int m;
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt754.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt754.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt754.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -20,7 +20,7 @@
// Boston, MA 02110-1301, USA.
#include <db_dtt754.h>
-#include <db_tv_rx.h>
+#include <db_base_impl.h>
int
control_byte_1()
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt768.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt768.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_dtt768.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -20,7 +20,7 @@
// Boston, MA 02110-1301, USA.
#include <db_dtt768.h>
-#include <db_tv_rx.h>
+#include <db_base_impl.h>
int
control_byte_4()
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -19,9 +19,7 @@
// Boston, MA 02110-1301, USA.
#include <db_flexrf.h>
-#include <sstream>
-#include <assert.h>
-#include <stdexcept>
+#include <db_base_impl.h>
// d'board i/o pin defs
// Tx and Rx have shared defs, but different i/o regs
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf_mimo.cc
===================================================================
---
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf_mimo.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_flexrf_mimo.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -20,8 +20,12 @@
*/
#include <db_flexrf_mimo.h>
-#include <assert.h>
+#include <fpga_regs_standard.h>
+#include <fpga_regs_common.h>
+#include <usrp_prims.h>
+#include <usrp_spi_defs.h>
+
db_flexrf_2400_tx_mimo_a::db_flexrf_2400_tx_mimo_a(usrp_basic *usrp, int which)
: db_flexrf_2400_tx(usrp, which)
{
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -19,38 +19,10 @@
// Boston, MA 02110-1301, USA.
#include <db_tv_rx.h>
-#include <sstream>
-#include <assert.h>
+#include <db_base_impl.h>
/*****************************************************************************/
-std::string
-int_seq_to_str(std::vector<int> &seq)
-{
- //convert a sequence of integers into a string
-
- 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;
- std::vector<int>::iterator sitr;
- std::string::iterator i;
- for(i=str.begin(); i != str.end(); i++) {
- int a = (int)(*i);
- seq.push_back(a);
- }
- return seq;
-}
-
int
control_byte_1(bool fast_tuning_p, int reference_divisor)
{
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.h
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_tv_rx.h
2008-10-09 07:03:39 UTC (rev 9764)
@@ -31,7 +31,6 @@
void _set_ifagc(float gain);
void _set_pga(float pga_gain);
- usrp_basic_rx *d_usrp;
int d_i2c_addr;
double d_first_IF, d_second_IF;
int d_reference_divisor;
@@ -54,9 +53,4 @@
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(double target_freq, bool shutdown_tx_PGA);
-
#endif
Added: gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.cc
(rev 0)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -0,0 +1,54 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <db_util.h>
+#include <sstream>
+
+std::string
+int_seq_to_str(std::vector<int> &seq)
+{
+ //convert a sequence of integers into a string
+
+ 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;
+ std::vector<int>::iterator sitr;
+ std::string::iterator i;
+ for(i=str.begin(); i != str.end(); i++) {
+ int a = (int)(*i);
+ seq.push_back(a);
+ }
+ return seq;
+}
+
Property changes on:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added: gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.h
(rev 0)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.h
2008-10-09 07:03:39 UTC (rev 9764)
@@ -0,0 +1,31 @@
+/* -*- 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_DB_UTIL_H
+#define INCLUDED_DB_UTIL_H
+
+#include <string>
+#include <vector>
+
+std::string int_seq_to_str(std::vector<int> &seq);
+std::vector<int> str_to_int_seq(std::string str);
+
+#endif /* INCLUDED_DB_UTIL_H */
Property changes on:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_util.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_wbx.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -20,6 +20,10 @@
// Boston, MA 02110-1301, USA.
#include <db_wbx.h>
+#include <fpga_regs_standard.h>
+#include <fpga_regs_common.h>
+#include <usrp_prims.h>
+#include <usrp_spi_defs.h>
#include <stdexcept>
#include <cmath>
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_xcvr2450.cc
===================================================================
---
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_xcvr2450.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/db_xcvr2450.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -19,9 +19,8 @@
// Boston, MA 02110-1301, USA.
#include <db_xcvr2450.h>
+#include <db_base_impl.h>
#include <cmath>
-#include <sstream>
-#include <assert.h>
/* ------------------------------------------------------------------------
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
===================================================================
---
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
2008-10-09 05:24:16 UTC (rev 9763)
+++
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
2008-10-09 07:03:39 UTC (rev 9764)
@@ -30,6 +30,7 @@
#include "fpga_regs_common.h"
#include "fpga_regs_standard.h"
#include "fusb.h"
+#include "db_boards.h"
#include <usb.h>
#include <stdexcept>
#include <assert.h>
@@ -111,7 +112,7 @@
: d_udh (0),
d_usb_data_rate (16000000), // SWAG, see below
d_bytes_per_poll ((int) (POLLING_INTERVAL * d_usb_data_rate)),
- d_verbose (false)
+ d_verbose (false), d_db(2)
{
/*
* SWAG: Scientific Wild Ass Guess.
@@ -157,10 +158,31 @@
usrp_basic::~usrp_basic ()
{
+ d_db.resize(0); // nuke d'boards before we close down USB
+
if (d_udh)
usb_close (d_udh);
}
+/*
+ * We return a vector of weak pointers. d_db should be the only place
+ * in the system that's holding them as shared pointers.
+ */
+std::vector<db_base_wptr>
+usrp_basic::db(int which_side)
+{
+ which_side &= 0x1; // clamp it to avoid any reporting any errors
+ std::vector<db_base_wptr> r;
+
+ assert(d_db.size() == 2);
+
+ for (unsigned i = 0; i < d_db[which_side].size(); i++)
+ r.push_back(db_base_wptr(d_db[which_side][i]));
+
+ return r;
+}
+
+
bool
usrp_basic::start ()
{
@@ -741,6 +763,8 @@
set_dc_offset_cl_enable(0xf, 0xf); // enable DC offset removal control
loops
probe_rx_slots (false);
+ d_db[0] = instantiate_dbs(d_dbid[0], this, 0);
+ d_db[1] = instantiate_dbs(d_dbid[1], this, 1);
// check fusb buffering parameters
@@ -1145,6 +1169,8 @@
set_fpga_tx_sample_rate_divisor (4); // we're using interp x4
probe_tx_slots (false);
+ d_db[0] = instantiate_dbs(d_dbid[0], this, 0);
+ d_db[1] = instantiate_dbs(d_dbid[1], this, 1);
// check fusb buffering parameters
Modified:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
2008-10-09 05:24:16 UTC (rev 9763)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
2008-10-09 07:03:39 UTC (rev 9764)
@@ -41,14 +41,12 @@
#include <usrp_slots.h>
#include <string>
+#include <vector>
#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
#include <boost/utility.hpp>
-class db_base;
-typedef boost::shared_ptr<db_base> db_base_sptr;
-
-
struct usb_dev_handle;
class fusb_devhandle;
class fusb_ephandle;
@@ -58,7 +56,11 @@
C_TX = 1
};
+class db_base;
+typedef boost::shared_ptr<db_base> db_base_sptr;
+typedef boost::weak_ptr<db_base> db_base_wptr;
+
/*!
* \brief base class for usrp operations
*/
@@ -73,6 +75,17 @@
static const int MAX_REGS = 128;
unsigned int d_fpga_shadows[MAX_REGS];
+ int d_dbid[2]; // daughterboard ID's (side A,
side B)
+
+ /*!
+ * Shared pointers to subclasses of db_base.
+ * The outer vector is of length 2 (0 = side A, 1 = side B). The inner
vectors
+ * are of length 1 or 2 depending on whether the given daugherboard
implements
+ * 1 or 2 subdevices. At this time, only the Basic Rx and LF Rx implement
+ * 2 subdevices.
+ */
+ std::vector< std::vector<db_base_sptr> > d_db;
+
usrp_basic (int which_board,
struct usb_dev_handle *open_interface (struct usb_device *dev),
const std::string fpga_filename = "",
@@ -125,6 +138,20 @@
virtual ~usrp_basic ();
/*!
+ * Return a vector of size 1 or 2 that contains weak pointers
+ * to the daughterboard instance(s) associated with the specified side.
+ *
+ * \param which_side [0,1] which daughterboard
+ *
+ * N.B. To ensure proper lifetime management, the caller should
+ * continue to hold these as weak pointers, not shared pointers.
+ * As long as the caller does not attempt to directly use the weak
+ * pointers after this usrp object has been destroyed, everything
+ * will work out fine.
+ */
+ std::vector<db_base_wptr> db(int which_side);
+
+ /*!
* \brief return frequency of master oscillator on USRP
*/
long fpga_master_clock_freq () const { return 64000000; }
@@ -193,7 +220,7 @@
/*!
* \brief Control ADC input buffer
- * \param which which ADC[0,3]
+ * \param which_adc which ADC[0,3]
* \param bypass if non-zero, bypass input buffer and connect input
* directly to switched cap SHA input of RxPGA.
*/
@@ -716,8 +743,6 @@
bool d_rx_enable;
protected:
- int d_dbid[2]; // Rx daughterboard ID's
-
/*!
* \param which_board Which USRP board on usb (not particularly
useful; use 0)
* \param fusb_block_size fast usb xfer block size. Must be a multiple of
512.
@@ -825,8 +850,6 @@
bool d_tx_enable;
protected:
- int d_dbid[2]; // Tx daughterboard ID's
-
/*!
* \param which_board Which USRP board on usb (not particularly
useful; use 0)
* \param fusb_block_size fast usb xfer block size. Must be a multiple of
512.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9764 - gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy,
eb <=