[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9237 - gnuradio/branches/developers/trondeau/dbs/gr-u
From: |
trondeau |
Subject: |
[Commit-gnuradio] r9237 - gnuradio/branches/developers/trondeau/dbs/gr-usrp/src |
Date: |
Sun, 10 Aug 2008 22:50:08 -0600 (MDT) |
Author: trondeau
Date: 2008-08-10 22:50:08 -0600 (Sun, 10 Aug 2008)
New Revision: 9237
Removed:
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db1_base.cc
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db1_base.h
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db1_base.i
Modified:
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/Makefile.am
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1.i
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.h
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.i
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_c.cc
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source.i
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_base.cc
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_base.h
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_c.cc
Log:
wip: removing local db1_base wrapper class; will take straight from usrp code.
Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/Makefile.am
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/Makefile.am
2008-08-11 04:50:08 UTC (rev 9237)
@@ -39,8 +39,8 @@
LOCAL_IFILES = \
usrp1.i \
usrp1_source.i \
- usrp1_sink.i \
- db1_base.i
+ usrp1_sink.i
+# db1_base.i
NON_LOCAL_IFILES = $(GNURADIO_I)
@@ -73,8 +73,8 @@
usrp1_sink_base.h \
usrp1_sink_c.h \
usrp1_source_base.h \
- usrp1_source_c.h \
- db1_base.h
+ usrp1_source_c.h
+# db1_base.h
swiginclude_HEADERS = \
$(LOCAL_IFILES)
@@ -89,8 +89,8 @@
usrp1_sink_base.cc \
usrp1_sink_c.cc \
usrp1_source_base.cc \
- usrp1_source_c.cc \
- db1_base.cc
+ usrp1_source_c.cc
+# db1_base.cc
_usrp_la_LIBADD = \
Deleted: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db1_base.cc
Deleted: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db1_base.h
Deleted: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db1_base.i
Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1.i
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1.i
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1.i
2008-08-11 04:50:08 UTC (rev 9237)
@@ -41,7 +41,7 @@
%include <usrp1_base.i>
%include <usrp1_source.i>
%include <usrp1_sink.i>
-%include <db1_base.i>
+//%include <db1_base.i>
%constant int FPGA_MODE_NORMAL = usrp_standard_rx::FPGA_MODE_NORMAL;
%constant int FPGA_MODE_LOOPBACK = usrp_standard_rx::FPGA_MODE_LOOPBACK;
Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.cc
2008-08-11 04:50:08 UTC (rev 9237)
@@ -74,7 +74,7 @@
struct usb_device *d = usrp_find_device(which);
if(!d) {
- throw "Unable to find USRP";
+ throw std::runtime_error("Unable to find USRP");
//raise RuntimeError, "Unable to find USRP #%d" % (which,);
}
@@ -86,7 +86,7 @@
{
int v = _look_for_usrp(which);
if(!((v == 2) || (v = 4))) {
- throw "Sorry, unsupported USRP revision";
+ throw std::runtime_error("Sorry, unsupported USRP revision");
// raise RuntimeError, "Sorry, unsupported USRP revision (rev=%d)" % (v,)
}
}
@@ -107,7 +107,7 @@
return mask;
}
-
+#if 0
int
usrp1_base::determine_rx_mux_value(const std::vector<int> &subdev_spec)
{
@@ -144,15 +144,16 @@
//raise ValueError, "Invalid subdev_spec: %r:" % (subdev_spec,)
}
- db1_base *db = d_db[side]; // This is a tuple of length 1 or 2 containing
the subdevice
- // classes for the selected side.
+ // This is a tuple of length 1 or 2 containing the subdevice
+ // classes for the selected side.
+ std::vector<db_base_sptr> db = (usrp_standard_rx*)d_usrp->db(side);
unsigned int subdev0_uses, subdev1_uses, uses;
// compute bitmasks of used A/D's
- printf("db[0].is_quadrature(): %d\n", db[0].is_quadrature());
- if(db[0].is_quadrature()) {
+ printf("db[0].is_quadrature(): %d\n", db[0]->is_quadrature());
+ if(db[0]->is_quadrature()) {
subdev0_uses = 0x3; // uses A/D 0 and 1
}
else {
@@ -173,16 +174,16 @@
uses = subdev1_uses;
}
else {
- throw "Invalid subdev_spec";
+ throw std::runtime_error("Invalid subdev_spec");
//raise ValueError, "Invalid subdev_spec: %r: " % (subdev_spec,);
}
if(uses == 0) {
- throw "Daughterboard doesn't have a subdevice 1";
+ throw std::runtime_error("Daughterboard doesn't have a subdevice 1");
//raise RuntimeError, "Daughterboard doesn't have a subdevice 1: %r: " %
(subdev_spec,);
}
- bool swap_iq = db[0].i_and_q_swapped();
+ bool swap_iq = db[0]->i_and_q_swapped();
truth_table_element_t truth_table[8] = {
// (side, uses, swap_iq) : mux_val
@@ -228,9 +229,9 @@
//raise ValueError, "Invalid subdev_spec: %r:" % (subdev_spec,)
}
- db1_base *db = d_db[side];
+ std::vector<db_base_sptr> db = (usrp_standard_tx*)d_usrp->db(side);
- if(db[0].i_and_q_swapped()) {
+ if(db[0]->i_and_q_swapped()) {
unsigned int mask[2] = {0x0089, 0x8900};
return hexint(mask[side]);
}
@@ -241,7 +242,7 @@
}
-db1_base *
+db_base_sptr
usrp1_base::selected_subdev(const std::vector<int> &subdev_spec)
{
/*
@@ -253,11 +254,11 @@
*/
// FIXME: make sure we don't leave this in memory
- return &d_db[subdev_spec[0]][subdev_spec[1]];
+ return &d_usrp->db(subdev_spec[0])[subdev_spec[1]];
//return d_db;
}
+#endif
-
float
calc_dxc_freq(float target_freq, float baseband_freq, long fs, bool &inverted)
{
@@ -366,8 +367,8 @@
struct subdev_spec ss;
- int db0 = u.db(0)->dbid();
- int db1 = u.db(1)->dbid();
+ int db0 = u.db(0)[0]->dbid();
+ int db1 = u.db(1)[0]->dbid();
for(int i=0; i < ncandidates; i++) {
if(candidates[i] == db0) {
ss.side = 0;
Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.h
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.h
2008-08-11 04:50:08 UTC (rev 9237)
@@ -33,7 +33,7 @@
#include <fpga_regs_standard.h>
#include <fpga_regs_common.h>
#include <iostream>
-#include <db1_base.h>
+#include <db_base.h>
//#define FPGA_MODE_NORMAL usrp_standard_rx::FPGA_MODE_NORMAL
//#define FPGA_MODE_LOOPBACK usrp_standard_rx::FPGA_MODE_LOOPBACK
@@ -56,6 +56,7 @@
unsigned int d_mux_val;
};
+int hexint(unsigned int mask);
/*!
* \brief abstract interface to Universal Software Radio Peripheral (Rev 1)
@@ -68,7 +69,7 @@
protected:
usrp_standard_common *d_usrp;
int d_fpga_caps;
- db1_base *d_db[2];
+ //db1_base *d_db[2];
usrp1_base (const std::string &name, gr_io_signature_sptr insig,
gr_io_signature_sptr outsig);
@@ -78,11 +79,14 @@
virtual ~usrp1_base ();
- db1_base * db(int side) { return d_db[side]; }
+ std::vector<db_base_sptr> db(int which) { throw std::runtime_error("db()
called from base class."); }
- int determine_tx_mux_value(const std::vector<int> &subdev_spec);
- int determine_rx_mux_value(const std::vector<int> &subdev_spec);
- db1_base * selected_subdev(const std::vector<int> &subdev_spec);
+ virtual int determine_tx_mux_value(const std::vector<int> &subdev_spec)
+ { throw std::runtime_error("determing_tx_value called from base class\n"); }
+ virtual int determine_rx_mux_value(const std::vector<int> &subdev_spec)
+ { throw std::runtime_error("determing_rx_value called from base class\n"); }
+ virtual db_base_sptr selected_subdev(const std::vector<int> &subdev_spec)
+ { throw std::runtime_error("selected_subdev called from base class\n"); }
virtual bool start() {return false;}
virtual bool stop() {return false;}
@@ -93,10 +97,10 @@
virtual void set_verbose (bool verbose) {}
// FIXME: throw exceptions properly
- virtual bool set_tx_freq (int channel, double freq) { throw 0; }
- virtual bool set_rx_freq (int channel, double freq) { throw 0; }
- virtual double tx_freq (int channel) const { throw 0; }
- virtual double rx_freq (int channel) const { throw 0; }
+ virtual bool set_tx_freq (int channel, double freq) { throw
std::runtime_error("set_tx_freq called from base class\n"); }
+ virtual bool set_rx_freq (int channel, double freq) { throw
std::runtime_error("set_rx_freq called from base class\n"); }
+ virtual double tx_freq (int channel) const { throw
std::runtime_error("tx_freq called from base class\n"); }
+ virtual double rx_freq (int channel) const { throw
std::runtime_error("rx_freq called from base class\n"); }
/*!
* \brief Set Programmable Gain Amplifier (PGA)
Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.i
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.i
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_base.i
2008-08-11 04:50:08 UTC (rev 9237)
@@ -34,7 +34,6 @@
private:
usrp_standard_common *d_usrp;
int d_fpga_caps;
- db1_base *d_db;
protected:
usrp1_base () {}
@@ -45,12 +44,9 @@
virtual ~usrp1_base ();
- db1_base * db(int side);
-
-
int determine_tx_mux_value(const std::vector<int> &subdev_spec);
int determine_rx_mux_value(const std::vector<int> &subdev_spec);
- db1_base * selected_subdev(const std::vector<int> &subdev_spec);
+ db_base_sptr selected_subdev(const std::vector<int> &subdev_spec);
virtual bool start() {return false;}
virtual bool stop() {return false;}
Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_c.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_c.cc
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_sink_c.cc
2008-08-11 04:50:08 UTC (rev 9237)
@@ -70,10 +70,10 @@
{
_ensure_rev2(which_board);
- int dbid = daughterboard_id(which_board);
+ //int dbid = daughterboard_id(which_board);
- d_db[0] = (db1_base*)instantiate_dbs(dbid, this->d_usrp, which_board);
- d_db[1] = (db1_base*)instantiate_dbs(dbid, this->d_usrp, which_board);
+ //d_db[0] = (db1_base*)instantiate_dbs(dbid, this->d_usrp, which_board);
+ //d_db[1] = (db1_base*)instantiate_dbs(dbid, this->d_usrp, which_board);
}
usrp1_sink_c::~usrp1_sink_c ()
Modified: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source.i
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source.i
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source.i
2008-08-11 04:50:08 UTC (rev 9237)
@@ -60,6 +60,10 @@
public:
~usrp1_source_base ();
+ int determine_tx_mux_value(const std::vector<int> &subdev_spec);
+ int determine_rx_mux_value(const std::vector<int> &subdev_spec);
+ db_base_sptr selected_subdev(const std::vector<int> &subdev_spec);
+
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
Modified:
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_base.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_base.cc
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_base.cc
2008-08-11 04:50:08 UTC (rev 9237)
@@ -64,9 +64,130 @@
usrp1_source_base::~usrp1_source_base ()
{
+
delete d_usrp;
}
+std::vector<db_base_sptr>
+usrp1_source_base::db(int which)
+{
+ return d_usrp->db(which);
+}
+
+
+int
+usrp1_source_base::determine_rx_mux_value(const std::vector<int> &subdev_spec)
+{
+ /*
+ Determine appropriate Rx mux value as a function of the subdevice choosen
and the
+ characteristics of the respective daughterboard.
+
+ @param u: instance of USRP source
+ @param subdev_spec: return value from subdev option parser.
+ @type subdev_spec: (side, subdev), where side is 0 or 1 and subdev is 0
or 1
+ @returns: the Rx mux value
+
+ Figure out which A/D's to connect to the DDC.
+
+ Each daughterboard consists of 1 or 2 subdevices. (At this time,
+ all but the Basic Rx have a single subdevice. The Basic Rx
+ has two independent channels, treated as separate subdevices).
+ subdevice 0 of a daughterboard may use 1 or 2 A/D's. We determine this
+ by checking the is_quadrature() method. If subdevice 0 uses only a single
+ A/D, it's possible that the daughterboard has a second subdevice,
subdevice 1,
+ and it uses the second A/D.
+
+ If the card uses only a single A/D, we wire a zero into the DDC Q input.
+
+ (side, 0) says connect only the A/D's used by subdevice 0 to the DDC.
+ (side, 1) says connect only the A/D's used by subdevice 1 to the DDC.
+ */
+
+ int side = subdev_spec[0]; // side A = 0, side B = 1
+ int spec = subdev_spec[1];
+
+ if(!((side == 0 || side == 1))) {
+ throw "Invalid subdev_spec";
+ //raise ValueError, "Invalid subdev_spec: %r:" % (subdev_spec,)
+ }
+
+ // This is a tuple of length 1 or 2 containing the subdevice
+ // classes for the selected side.
+ std::vector<db_base_sptr> db = d_usrp->db(side);
+
+ unsigned int subdev0_uses, subdev1_uses, uses;
+
+ // compute bitmasks of used A/D's
+
+ printf("db[0].is_quadrature(): %d\n", db[0]->is_quadrature());
+ if(db[0]->is_quadrature()) {
+ subdev0_uses = 0x3; // uses A/D 0 and 1
+ }
+ else {
+ subdev0_uses = 0x1; // uses A/D 0 only
+ }
+
+ if(&db[1] != NULL) { // test if we have 2 daughterboards
+ subdev1_uses = 0x2; // uses A/D 1 only
+ }
+ else {
+ subdev1_uses = 0x0; // uses no A/D (doesn't exist)
+ }
+
+ if(spec == 0) {
+ uses = subdev0_uses;
+ }
+ else if(spec == 1) {
+ uses = subdev1_uses;
+ }
+ else {
+ throw std::runtime_error("Invalid subdev_spec");
+ //raise ValueError, "Invalid subdev_spec: %r: " % (subdev_spec,);
+ }
+
+ if(uses == 0) {
+ throw std::runtime_error("Daughterboard doesn't have a subdevice 1");
+ //raise RuntimeError, "Daughterboard doesn't have a subdevice 1: %r: " %
(subdev_spec,);
+ }
+
+ bool swap_iq = db[0]->i_and_q_swapped();
+
+ truth_table_element_t truth_table[8] = {
+ // (side, uses, swap_iq) : mux_val
+ truth_table_element_t(0, 0x1, false, 0xf0f0f0f0),
+ truth_table_element_t(0, 0x2, false, 0xf0f0f0f1),
+ truth_table_element_t(0, 0x3, false, 0x00000010),
+ truth_table_element_t(0, 0x3, true, 0x00000001),
+ truth_table_element_t(1, 0x1, false, 0xf0f0f0f2),
+ truth_table_element_t(1, 0x2, false, 0xf0f0f0f3),
+ truth_table_element_t(1, 0x3, false, 0x00000032),
+ truth_table_element_t(1, 0x3, true, 0x00000023)
+ };
+
+ truth_table_element_t match(side, uses, swap_iq, 0);
+
+ int i=0;
+ while((i < 8) && (truth_table[i] != match))
+ i++;
+
+ return hexint(truth_table[i].mux_val());
+}
+
+db_base_sptr
+usrp1_source_base::selected_subdev(const std::vector<int> &subdev_spec)
+{
+ /*
+ Return the user specified daughterboard subdevice.
+
+ @param subdev_spec: return value from subdev option parser.
+ @type subdev_spec: (side, subdev), where side is 0 or 1 and subdev is 0
or 1
+ @returns: an weakref to an instance derived from db_base
+ */
+
+ return d_usrp->db(subdev_spec[0])[subdev_spec[1]];
+}
+
+
unsigned int
usrp1_source_base::sizeof_basic_sample() const
{
Modified:
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_base.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_base.h
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_base.h
2008-08-11 04:50:08 UTC (rev 9237)
@@ -89,6 +89,10 @@
~usrp1_source_base ();
+ std::vector<db_base_sptr> db(int which);
+ int determine_rx_mux_value(const std::vector<int> &subdev_spec);
+ db_base_sptr selected_subdev(const std::vector<int> &subdev_spec);
+
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
Modified:
gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_c.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_c.cc
2008-08-11 04:48:38 UTC (rev 9236)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/usrp1_source_c.cc
2008-08-11 04:50:08 UTC (rev 9237)
@@ -74,10 +74,10 @@
{
_ensure_rev2(which_board);
- int dbid = daughterboard_id(which_board);
+ //int dbid = daughterboard_id(which_board);
- d_db[0] = (db1_base*)instantiate_dbs(dbid, this->d_usrp, which_board);
- d_db[1] = (db1_base*)instantiate_dbs(dbid, this->d_usrp, which_board);
+ //d_db[0] = (db1_base*)instantiate_dbs(dbid, this->d_usrp, which_board);
+ //d_db[1] = (db1_base*)instantiate_dbs(dbid, this->d_usrp, which_board);
}
usrp1_source_c::~usrp1_source_c ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9237 - gnuradio/branches/developers/trondeau/dbs/gr-usrp/src,
trondeau <=