[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7165 - gnuradio/branches/developers/jcorgan/t127/usrp
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r7165 - gnuradio/branches/developers/jcorgan/t127/usrpdb/src |
Date: |
Thu, 13 Dec 2007 20:37:32 -0700 (MST) |
Author: jcorgan
Date: 2007-12-13 20:37:32 -0700 (Thu, 13 Dec 2007)
New Revision: 7165
Added:
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/qa_basic_rx.py
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.cc
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.h
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.i
Modified:
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/Makefile.am
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb.i
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa.h
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa.i
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.cc
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.h
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.i
Log:
Added basic_rx class.
Modified: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/Makefile.am
2007-12-14 02:41:48 UTC (rev 7164)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/Makefile.am
2007-12-14 03:37:32 UTC (rev 7165)
@@ -34,6 +34,7 @@
LOCAL_IFILES = \
usrpdb.i \
usrpdb_base.i \
+ usrpdb_basic_rx.i \
usrpdb_basic_tx.i \
usrpdb_hwa.i \
usrpdb_hwa_qa.i
@@ -58,6 +59,7 @@
libusrpdb_la_SOURCES = \
usrpdb_base.cc \
+ usrpdb_basic_rx.cc \
usrpdb_basic_tx.cc \
usrpdb_hwa.cc \
usrpdb_hwa_qa.cc
@@ -78,6 +80,7 @@
grinclude_HEADERS = \
usrpdb_base.h \
+ usrpdb_basic_rx.h \
usrpdb_basic_tx.h \
usrpdb_hwa.h \
usrpdb_hwa_qa.h
@@ -93,7 +96,10 @@
@for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done
@for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done
-noinst_PYTHON = qa_usrpdb.py
+noinst_PYTHON = \
+ qa_basic_rx.py \
+ qa_basic_tx.py \
+ qa_usrpdb.py
MOSTLYCLEANFILES = \
$(BUILT_SOURCES) *~ *.pyc
Added: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/qa_basic_rx.py
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/qa_basic_rx.py
(rev 0)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/qa_basic_rx.py
2007-12-14 03:37:32 UTC (rev 7165)
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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.
+#
+
+from gnuradio import gr, gr_unittest
+import usrpdb
+
+class qa_basic_rx(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.hwa = usrpdb.hwa_qa()
+ self.db = usrpdb.basic_rx(self.hwa)
+
+ def tearDown(self):
+ self.db = None
+ self.hwa = None
+
+ def test_000_freq_range(self):
+ expected_range = (0, 89999998976, 1e-6)
+ freq_range = self.db.freq_range()
+ self.assertFloatTuplesAlmostEqual(freq_range, expected_range, 5)
+
+ def test_001_set_freq(self):
+ actual_baseband_freq = self.db.set_freq(1e6)
+ self.assertEqual(actual_baseband_freq, 0.0)
+
+ def test_002_gain_range(self):
+ expected_range = (-20.0, 0, 0.2)
+ gain_range = self.db.gain_range()
+ self.assertFloatTuplesAlmostEqual(gain_range, expected_range, 5)
+
+ def test_003_set_gain(self):
+ self.db.set_gain(-10.0)
+ self.assertEqual(self.hwa.adc_pga_gain(), -10.0)
+
+ def test_004_set_gain_bad(self):
+ self.assertRaises(ValueError,
+ lambda: self.db.set_gain(10.0))
+
+ def test_005_is_quadrature(self):
+ self.assertFalse(self.db.is_quadrature())
+
+if __name__ == '__main__':
+ gr_unittest.main ()
Property changes on:
gnuradio/branches/developers/jcorgan/t127/usrpdb/src/qa_basic_rx.py
___________________________________________________________________
Name: svn:executable
+ *
Modified: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb.i
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb.i
2007-12-14 02:41:48 UTC (rev 7164)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb.i
2007-12-14 03:37:32 UTC (rev 7165)
@@ -24,4 +24,5 @@
%include <shared_ptr.i>
%include "usrpdb_hwa_qa.i"
+%include "usrpdb_basic_rx.i"
%include "usrpdb_basic_tx.i"
Added: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.cc
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.cc
(rev 0)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.cc
2007-12-14 03:37:32 UTC (rev 7165)
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <usrpdb_basic_rx.h>
+#include <stdexcept>
+
+usrpdb_basic_rx_sptr
+usrpdb_make_basic_rx(usrpdb_hwa_sptr hwa)
+{
+ return usrpdb_basic_rx_sptr(new usrpdb_basic_rx(hwa));
+}
+
+usrpdb_basic_rx::usrpdb_basic_rx(usrpdb_hwa_sptr hwa)
+ : usrpdb_base(hwa)
+{
+ d_hwa->bypass_adc_buffers(true);
+}
+
+std::vector<float>
+usrpdb_basic_rx::freq_range()
+{
+ // BasicRx boards report they can do essentially anything
+ std::vector<float> result(3);
+ result[0] = 0;
+ result[1] = 90e9;
+ result[2] = 1e-6;
+ return result;
+}
+
+float
+usrpdb_basic_rx::set_freq(float target_freq)
+{
+ // BasicRx boards don't have an LO, so they always return 0.0 as result
+ return 0.0;
+}
+
+std::vector<float>
+usrpdb_basic_rx::gain_range()
+{
+ // BasicRx boards have no gain, but report the DAC PGA settings
+ std::vector<float> result(3);
+ result[0] = d_hwa->adc_pga_min();
+ result[1] = d_hwa->adc_pga_max();
+ result[2] = d_hwa->adc_pga_db_per_step();
+ return result;
+}
+
+void
+usrpdb_basic_rx::set_gain(float gain)
+{
+ // BasicRx boards have no gain, but adjust the DAC PGA setting
+ if (gain < d_hwa->adc_pga_min() || gain > d_hwa->adc_pga_max()) {
+ throw std::invalid_argument("gain value is out of range");
+ }
+
+ d_hwa->set_adc_pga(gain);
+}
+
+bool
+usrpdb_basic_rx::is_quadrature()
+{
+ // Basic boards do not quadrature downsample
+ return false;
+}
+
+usrpdb_basic_rx::~usrpdb_basic_rx()
+{
+}
Added: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.h
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.h
(rev 0)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.h
2007-12-14 03:37:32 UTC (rev 7165)
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+#ifndef INCLUDED_USRPDB_BASIC_RX_H
+#define INCLUDED_USRPDB_BASIC_RX_H
+
+#include <usrpdb_base.h>
+
+class usrpdb_basic_rx;
+typedef boost::shared_ptr<usrpdb_basic_rx> usrpdb_basic_rx_sptr;
+
+usrpdb_basic_rx_sptr usrpdb_make_basic_rx(usrpdb_hwa_sptr hwa);
+
+class usrpdb_basic_rx : protected usrpdb_base
+{
+private:
+ usrpdb_basic_rx(usrpdb_hwa_sptr hwa);
+
+ friend usrpdb_basic_rx_sptr usrpdb_make_basic_rx(usrpdb_hwa_sptr hwa);
+
+public:
+ virtual ~usrpdb_basic_rx();
+
+ virtual std::vector<float> freq_range();
+ virtual float set_freq(float target_freq);
+ virtual std::vector<float> gain_range();
+ virtual void set_gain(float gain);
+ virtual bool is_quadrature();
+};
+
+#endif /* INCLUDED_USRPDB_BASIC_RX_H */
Added: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.i
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.i
(rev 0)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_basic_rx.i
2007-12-14 03:37:32 UTC (rev 7165)
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 <usrpdb_basic_rx.h>
+%}
+
+%include "usrpdb_base.i"
+
+class usrpdb_basic_rx;
+typedef boost::shared_ptr<usrpdb_basic_rx> usrpdb_basic_rx_sptr;
+%template(usrpdb_basic_rx_sptr) boost::shared_ptr<usrpdb_basic_rx>;
+%rename(basic_rx) usrpdb_make_basic_rx;
+%ignore basic_rx;
+
+usrpdb_basic_rx_sptr usrpdb_make_basic_rx(usrpdb_hwa_sptr hwa);
+
+class usrpdb_basic_rx : protected usrpdb_base
+{
+private:
+ usrpdb_basic_rx(usrpdb_hwa_sptr hwa);
+
+public:
+ ~usrpdb_basic_rx();
+
+ std::vector<float> freq_range();
+ float set_freq(float target_freq);
+ std::vector<float> gain_range();
+ void set_gain(float gain) throw (std::invalid_argument);
+ bool is_quadrature();
+};
Modified: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa.h
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa.h
2007-12-14 02:41:48 UTC (rev 7164)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa.h
2007-12-14 03:37:32 UTC (rev 7165)
@@ -29,13 +29,20 @@
{
public:
usrpdb_hwa();
+ virtual ~usrpdb_hwa() = 0;
virtual float dac_pga_gain() = 0;
virtual float dac_pga_min() = 0;
virtual float dac_pga_max() = 0;
virtual float dac_pga_db_per_step() = 0;
virtual void set_dac_pga(float gain) = 0;
- virtual ~usrpdb_hwa() = 0;
+ virtual float adc_pga_gain() = 0;
+ virtual float adc_pga_min() = 0;
+ virtual float adc_pga_max() = 0;
+ virtual float adc_pga_db_per_step() = 0;
+ virtual void set_adc_pga(float gain) = 0;
+
+ virtual void bypass_adc_buffers(bool bypass) = 0;
};
typedef boost::shared_ptr<usrpdb_hwa> usrpdb_hwa_sptr;
Modified: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa.i
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa.i
2007-12-14 02:41:48 UTC (rev 7164)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa.i
2007-12-14 03:37:32 UTC (rev 7165)
@@ -32,11 +32,18 @@
{
public:
usrpdb_hwa();
+ virtual ~usrpdb_hwa() = 0;
virtual float dac_pga_gain() = 0;
virtual float dac_pga_min() = 0;
virtual float dac_pga_max() = 0;
virtual float dac_pga_db_per_step() = 0;
virtual void set_dac_pga(float gain) = 0;
- virtual ~usrpdb_hwa() = 0;
+ virtual float adc_pga_gain() = 0;
+ virtual float adc_pga_min() = 0;
+ virtual float adc_pga_max() = 0;
+ virtual float adc_pga_db_per_step() = 0;
+ virtual void set_adc_pga(float gain) = 0;
+
+ virtual void bypass_adc_buffers(bool bypass);
};
Modified: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.cc
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.cc
2007-12-14 02:41:48 UTC (rev 7164)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.cc
2007-12-14 03:37:32 UTC (rev 7165)
@@ -36,7 +36,8 @@
}
usrpdb_hwa_qa::usrpdb_hwa_qa()
- : d_dac_pga_gain(0.0)
+ : d_adc_pga_gain(0.0),
+ d_dac_pga_gain(0.0)
{
}
@@ -75,6 +76,48 @@
d_dac_pga_gain = gain;
}
+float
+usrpdb_hwa_qa::adc_pga_gain()
+{
+ return d_adc_pga_gain;
+}
+
+float
+usrpdb_hwa_qa::adc_pga_min()
+{
+ // mimic USRP1
+ return -20.0;
+}
+
+float
+usrpdb_hwa_qa::adc_pga_max()
+{
+ // mimic USRP1
+ return 0.0;
+}
+
+float
+usrpdb_hwa_qa::adc_pga_db_per_step()
+{
+ // mimic USRP1
+ return (adc_pga_max()-adc_pga_min())/100.0;
+}
+
+void
+usrpdb_hwa_qa::set_adc_pga(float gain)
+{
+ if (USRPDB_HWA_QA_DEBUG)
+ std::cout << "usrpdb_hwa_qa: setting ADC PGA gain to " << gain <<
std::endl;
+ d_adc_pga_gain = gain;
+}
+
+void
+usrpdb_hwa_qa::bypass_adc_buffers(bool bypass)
+{
+ if (USRPDB_HWA_QA_DEBUG)
+ std::cout << "usrpdb_hwa_qa: bypassing ADC buffers: " << bypass <<
std::endl;
+}
+
usrpdb_hwa_qa::~usrpdb_hwa_qa()
{
}
Modified: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.h
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.h
2007-12-14 02:41:48 UTC (rev 7164)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.h
2007-12-14 03:37:32 UTC (rev 7165)
@@ -35,8 +35,9 @@
friend usrpdb_hwa_sptr usrpdb_make_qa_hwa();
// Mimic dummy hardware
+ float d_adc_pga_gain;
float d_dac_pga_gain;
-
+
public:
~usrpdb_hwa_qa();
@@ -46,6 +47,13 @@
float dac_pga_max();
float dac_pga_db_per_step();
void set_dac_pga(float gain);
+ float adc_pga_gain();
+ float adc_pga_min();
+ float adc_pga_max();
+ float adc_pga_db_per_step();
+ void set_adc_pga(float gain);
+
+ void bypass_adc_buffers(bool bypass);
};
#endif /* INCLUDED_USRPDB_HWA_QA_H */
Modified: gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.i
===================================================================
--- gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.i
2007-12-14 02:41:48 UTC (rev 7164)
+++ gnuradio/branches/developers/jcorgan/t127/usrpdb/src/usrpdb_hwa_qa.i
2007-12-14 03:37:32 UTC (rev 7165)
@@ -43,4 +43,11 @@
float dac_pga_max();
float dac_pga_db_per_step();
void set_dac_pga(float gain);
+ float adc_pga_gain();
+ float adc_pga_min();
+ float adc_pga_max();
+ float adc_pga_db_per_step();
+ void set_adc_pga(float gain);
+
+ void bypass_adc_buffers(bool bypass);
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7165 - gnuradio/branches/developers/jcorgan/t127/usrpdb/src,
jcorgan <=