[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9953 - in gnuradio/branches/developers/eb/cppdb-wip:
From: |
eb |
Subject: |
[Commit-gnuradio] r9953 - in gnuradio/branches/developers/eb/cppdb-wip: gr-usrp/src usrp/host/lib/legacy |
Date: |
Fri, 7 Nov 2008 12:48:04 -0700 (MST) |
Author: eb
Date: 2008-11-07 12:48:03 -0700 (Fri, 07 Nov 2008)
New Revision: 9953
Added:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_subdev_spec.h
Modified:
gnuradio/branches/developers/eb/cppdb-wip/gr-usrp/src/usrp_base.cc
gnuradio/branches/developers/eb/cppdb-wip/gr-usrp/src/usrp_base.h
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
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:
work-in-progress
Modified: gnuradio/branches/developers/eb/cppdb-wip/gr-usrp/src/usrp_base.cc
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/gr-usrp/src/usrp_base.cc
2008-11-07 11:05:43 UTC (rev 9952)
+++ gnuradio/branches/developers/eb/cppdb-wip/gr-usrp/src/usrp_base.cc
2008-11-07 19:48:03 UTC (rev 9953)
@@ -60,28 +60,11 @@
}
db_base_sptr
-usrp_base::selected_subdev(const std::vector<int> &subdev_spec)
+usrp_base::selected_subdev(usrp_subdev_spec ss)
{
- size_t sss = subdev_spec.size();
- if (!(1 <= sss && sss <= 2))
- throw std::invalid_argument("invalid subdev_spec");
-
- unsigned int side = subdev_spec[0];
- unsigned int subdev = 0;
- if (sss == 2)
- subdev = subdev_spec[1];
-
- std::vector<db_base_sptr> v = db(side);
-
- assert(v.size() >= 1);
-
- if (!(subdev <= 0 && subdev < v.size()))
- throw std::invalid_argument("invalid subdev_spec");
-
- return v[subdev];
+ return d_usrp_basic->selected_subdev(ss);
}
-
long
usrp_base::fpga_master_clock_freq() const
{
Modified: gnuradio/branches/developers/eb/cppdb-wip/gr-usrp/src/usrp_base.h
===================================================================
--- gnuradio/branches/developers/eb/cppdb-wip/gr-usrp/src/usrp_base.h
2008-11-07 11:05:43 UTC (rev 9952)
+++ gnuradio/branches/developers/eb/cppdb-wip/gr-usrp/src/usrp_base.h
2008-11-07 19:48:03 UTC (rev 9953)
@@ -25,6 +25,7 @@
#include <stdexcept>
#include <boost/shared_ptr.hpp>
#include <db_base.h>
+#include <usrp_subdev_spec.h>
class usrp_basic;
@@ -48,7 +49,7 @@
virtual ~usrp_base();
/*!
- * Return a vector of size 1 or 2 that contains weak pointers
+ * Return a vector of size 1 or 2 that contains shared pointers
* to the daughterboard instance(s) associated with the specified side.
*
* \param which_side [0,1] which daughterboard
@@ -62,14 +63,12 @@
std::vector<db_base_sptr> db(int which_side);
/*!
- * \brief returns a weak_ptr to an instance derived from db_base.
+ * \brief given a usrp_subdev_spec, return the corresponding daughterboard
object.
+ * \throws std::invalid_argument if ss is invalid.
*
- * \param subdev_spec is an array of length 1 or 2. The first integer
- * specifies the side (0 -> A, 1 -> B). The optional second integer (0 or 1)
- * selects the subdevice for those devices such as the Basic Rx and LF Rx
- * that have multiple subdevices.
+ * \param ss specifies the side and subdevice
*/
- db_base_sptr selected_subdev(const std::vector<int> &subdev_spec);
+ db_base_sptr selected_subdev(usrp_subdev_spec ss);
/*!
* \brief return frequency of master oscillator on USRP
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-11-07 11:05:43 UTC (rev 9952)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/Makefile.am
2008-11-07 19:48:03 UTC (rev 9953)
@@ -141,6 +141,7 @@
endif
include_HEADERS = \
+ db_base.h \
usrp_basic.h \
usrp_bytesex.h \
usrp_config.h \
@@ -148,28 +149,28 @@
usrp_prims.h \
usrp_slots.h \
usrp_standard.h \
- db_boards.h \
- db_base.h \
- db_basic.h \
- db_tv_rx.h \
- db_flexrf.h \
- db_flexrf_mimo.h \
- db_dbs_rx.h \
- db_xcvr2450.h \
- db_wbx.h \
- db_dtt754.h \
- db_dtt768.h
+ usrp_subdev_spec.h
noinst_HEADERS = \
ad9862.h \
db_base_impl.h \
+ db_basic.h \
+ db_boards.h \
+ db_dbs_rx.h \
+ db_dtt754.h \
+ db_dtt768.h \
+ db_flexrf.h \
+ db_flexrf_mimo.h \
+ db_tv_rx.h \
db_util.h \
+ db_wbx.h \
+ db_xcvr2450.h \
fusb.h \
fusb_darwin.h \
- fusb_win32.h \
fusb_generic.h \
fusb_linux.h \
fusb_ra_wb.h \
+ fusb_win32.h \
md5.h \
rate_to_regval.h \
usrp_local_sighandler.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-11-07 11:05:43 UTC (rev 9952)
+++
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.cc
2008-11-07 19:48:03 UTC (rev 9953)
@@ -181,6 +181,23 @@
return d_db[which_side];
}
+db_base_sptr
+usrp_basic::selected_subdev(usrp_subdev_spec ss)
+{
+
+ if (!(0 <= ss.side && ss.side <= 1))
+ throw std::invalid_argument("invalid subdev_spec side");
+
+ std::vector<db_base_sptr> v = db(ss.side);
+
+ assert(v.size() >= 1);
+
+ if (!(0 <= ss.subdev && (size_t) ss.subdev < v.size()))
+ throw std::invalid_argument("invalid subdev_spec subdev");
+
+ return v[ss.subdev];
+}
+
bool
usrp_basic::start ()
{
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-11-07 11:05:43 UTC (rev 9952)
+++ gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_basic.h
2008-11-07 19:48:03 UTC (rev 9953)
@@ -44,8 +44,8 @@
#include <string>
#include <vector>
#include <boost/utility.hpp>
+#include <usrp_subdev_spec.h>
-
struct usb_dev_handle;
class fusb_devhandle;
class fusb_ephandle;
@@ -73,10 +73,11 @@
/*!
* 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.
+ *
+ * The outer vector is of length 2 (0 = side A, 1 = side B). The
+ * inner vectors are of length 1, 2 or 3 depending on the number of
+ * subdevices implemented by the daugherboard. At this time, only
+ * the Basic Rx and LF Rx implement more than 1 subdevice.
*/
std::vector< std::vector<db_base_sptr> > d_db;
@@ -136,20 +137,25 @@
virtual ~usrp_basic ();
/*!
- * Return a vector of size 1 or 2 that contains weak pointers
+ * Return a vector of size >= 1 that contains shared 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.
+ * It is an error to use the returned objects after the usrp_basic
+ * object has been destroyed.
*/
std::vector<db_base_sptr> db(int which_side);
/*!
+ * \brief given a subdev_spec, return the corresponding daughterboard object.
+ * \throws std::invalid_ argument if ss is invalid.
+ *
+ * \param ss specifies the side and subdevice
+ */
+ db_base_sptr selected_subdev(usrp_subdev_spec ss);
+
+ /*!
* \brief return frequency of master oscillator on USRP
*/
long fpga_master_clock_freq () const { return 64000000; }
Added:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_subdev_spec.h
===================================================================
---
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_subdev_spec.h
(rev 0)
+++
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_subdev_spec.h
2008-11-07 19:48:03 UTC (rev 9953)
@@ -0,0 +1,50 @@
+/* -*- 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_USRP_SUBDEV_SPEC_H
+#define INCLUDED_USRP_SUBDEV_SPEC_H
+
+/*!
+ * \brief specify a daughterboard and subdevice on a daughterboard.
+ *
+ * In the USRP1, there are two sides, A and B.
+ *
+ * A daughterboard generally implements a single subdevice, but may in
+ * general implement any number of subdevices. At this time, all
daughterboards
+ * with the exception of the Basic Rx and LF Rx implement a single subdevice.
+ *
+ * The Basic Rx and LF Rx implement 2 subdevices (soon 3). Subdevice
+ * 0 routes input RX-A to the DDC I input and routes a constant zero
+ * to the DDC Q input. Similarly, subdevice 1 routes input RX-B to
+ * the DDC I input and routes a constant zero to the DDC Q
+ * input. Subdevice 2 (when implemented) will route RX-A to the DDC I
+ * input and RX-B to the DDC Q input.
+ */
+
+struct usrp_subdev_spec {
+ unsigned int side; // 0 -> A; 1 -> B
+ unsigned int subdev; // which subdevice (usually zero)
+
+ usrp_subdev_spec(unsigned int _side = 0, unsigned int _subdev = 0)
+ : side(_side), subdev(_subdev) {}
+};
+
+#endif /* INCLUDED_USRP_SUBDEV_SPEC_H */
Property changes on:
gnuradio/branches/developers/eb/cppdb-wip/usrp/host/lib/legacy/usrp_subdev_spec.h
___________________________________________________________________
Name: svn:eol-style
+ native
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9953 - in gnuradio/branches/developers/eb/cppdb-wip: gr-usrp/src usrp/host/lib/legacy,
eb <=