[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10030 - gnuradio/branches/features/cppdb/gr-usrp/src
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r10030 - gnuradio/branches/features/cppdb/gr-usrp/src |
Date: |
Fri, 21 Nov 2008 18:31:36 -0700 (MST) |
Author: jcorgan
Date: 2008-11-21 18:31:35 -0700 (Fri, 21 Nov 2008)
New Revision: 10030
Added:
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_shim.py
Modified:
gnuradio/branches/features/cppdb/gr-usrp/src/Makefile.am
gnuradio/branches/features/cppdb/gr-usrp/src/__init__.py
gnuradio/branches/features/cppdb/gr-usrp/src/usrp.i
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.cc
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.h
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.i
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_c.i
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_s.i
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.cc
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.h
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.i
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_c.i
gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_s.i
Log:
wip, recreating Python API from new C++ API
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/Makefile.am
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/Makefile.am 2008-11-21
22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/Makefile.am 2008-11-22
01:31:35 UTC (rev 10030)
@@ -40,7 +40,7 @@
usrp_sink_s.cc \
usrp_source_base.cc \
usrp_source_c.cc \
- usrp_source_s.cc
+ usrp_source_s.cc
libgnuradio_usrp_la_LIBADD = \
$(GNURADIO_CORE_LA) \
@@ -55,7 +55,7 @@
usrp_sink_s.h \
usrp_source_base.h \
usrp_source_c.h \
- usrp_source_s.h
+ usrp_source_s.h
# ----------------------------------------------------------------
# The SWIG library and Python modules
@@ -94,6 +94,7 @@
ourlib_PYTHON = \
__init__.py \
+ usrp_shim.py \
usrp_swig.py
_usrp_swig_la_SOURCES = \
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/__init__.py
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/__init__.py 2008-11-21
22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/__init__.py 2008-11-22
01:31:35 UTC (rev 10030)
@@ -25,3 +25,4 @@
from usrp_swig import *
# Add other content from pure-Python modules here
+from usrp_shim import *
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp.i
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp.i 2008-11-21 22:45:00 UTC
(rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp.i 2008-11-22 01:31:35 UTC
(rev 10030)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -30,6 +30,7 @@
#include <stdexcept>
%}
+%include <usrp_subdev_spec.h>
%include "usrp_standard.i"
%include "usrp_base.i"
%include "usrp_source_base.i"
Added: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_shim.py
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_shim.py
(rev 0)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_shim.py 2008-11-22
01:31:35 UTC (rev 10030)
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+import usrp_swig
+
+"""
+Shim usrp.determine_tx_value to allow use sink version of function
+"""
+def determine_tx_mux_value(u, subdev_spec):
+ """
+ Determine appropriate Tx mux value as a function of the subdevice choosen.
+
+ @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
+ @returns: the Tx mux value
+ """
+ return u.determine_tx_mux_value(subdev_spec)
+
+"""
+Shim usrp.determine_rx_value to allow use source version of function
+"""
+def determine_rx_mux_value(u, subdev_spec):
+ """
+ Determine appropriate Rx mux value as a function of the subdevice choosen.
+
+ @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
+ @returns: the Rx mux value
+ """
+ return u.determine_rx_mux_value(subdev_spec)
+
+"""
+Shim usrp.selected_subdev to allow use source/sink version of function
+"""
+def selected_subdev(u, subdev_spec):
+ """
+ Return the user specified daughterboard subdevice.
+
+ @param u: an instance of usrp.source_* or usrp.sink_*
+ @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 u.selected_subdev(subdev_spec)
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.cc
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.cc
2008-11-21 22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.cc
2008-11-22 01:31:35 UTC (rev 10030)
@@ -146,7 +146,7 @@
}
int
-usrp_sink_base::determine_tx_mux_value(const usrp_subdev_spec &ss)
+usrp_sink_base::determine_tx_mux_value(usrp_subdev_spec ss)
{
return d_usrp->determine_tx_mux_value(ss);
}
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.h
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.h
2008-11-21 22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.h
2008-11-22 01:31:35 UTC (rev 10030)
@@ -28,7 +28,6 @@
class usrp_standard_tx;
-
/*!
* \brief abstract interface to Universal Software Radio Peripheral Tx path
(Rev 1)
*/
@@ -85,7 +84,7 @@
bool set_interp_rate (unsigned int rate);
bool set_nchannels (int nchan);
bool set_mux (int mux);
- int determine_tx_mux_value(const usrp_subdev_spec &ss);
+ int determine_tx_mux_value(usrp_subdev_spec ss);
/*!
* \brief set the frequency of the digital up converter.
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.i
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.i
2008-11-21 22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_base.i
2008-11-22 01:31:35 UTC (rev 10030)
@@ -33,7 +33,8 @@
bool set_interp_rate (unsigned int rate);
bool set_nchannels (int nchan);
bool set_mux (int mux);
- int determine_tx_mux_value(const usrp_subdev_spec &ss);
+ %rename(_real_determine_tx_mux_value) determine_tx_mux_value;
+ int determine_tx_mux_value(usrp_subdev_spec ss);
bool set_tx_freq (int channel, double freq);
long dac_rate() const { return converter_rate(); }
long dac_freq() const { return converter_rate(); }
@@ -48,3 +49,11 @@
int nducs();
bool tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result
*result);
};
+
+//--- Allow Python subdev_spec to be tuple
+
+%pythoncode %{
+def __determine_tx_mux_value(self, subdev_spec):
+ ss = usrp_subdev_spec(subdev_spec[0], subdev_spec[1])
+ return self._real_determine_tx_mux_value(ss)
+%}
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_c.i
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_c.i 2008-11-21
22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_c.i 2008-11-22
01:31:35 UTC (rev 10030)
@@ -46,3 +46,9 @@
usrp_sink_c() throw (std::runtime_error);
};
+//--- Allow Python subdev_spec to be tuple
+%pythoncode %{
+
+usrp_sink_c_sptr.determine_tx_mux_value = __determine_tx_mux_value
+
+%}
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_s.i
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_s.i 2008-11-21
22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_sink_s.i 2008-11-22
01:31:35 UTC (rev 10030)
@@ -46,3 +46,9 @@
usrp_sink_s() throw (std::runtime_error);
};
+//--- Allow Python subdev_spec to be tuple
+%pythoncode %{
+
+usrp_sink_s_sptr.determine_tx_mux_value = __determine_tx_mux_value
+
+%}
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.cc
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.cc
2008-11-21 22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.cc
2008-11-22 01:31:35 UTC (rev 10030)
@@ -143,7 +143,7 @@
}
int
-usrp_source_base::determine_rx_mux_value(const usrp_subdev_spec &ss)
+usrp_source_base::determine_rx_mux_value(usrp_subdev_spec ss)
{
return d_usrp->determine_rx_mux_value(ss);
}
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.h
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.h
2008-11-21 22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.h
2008-11-22 01:31:35 UTC (rev 10030)
@@ -98,7 +98,7 @@
bool set_decim_rate (unsigned int rate);
bool set_nchannels (int nchan);
bool set_mux (int mux);
- int determine_rx_mux_value(const usrp_subdev_spec &ss);
+ int determine_rx_mux_value(usrp_subdev_spec ss);
/*!
* \brief set the center frequency of the digital down converter.
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.i
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.i
2008-11-21 22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_base.i
2008-11-22 01:31:35 UTC (rev 10030)
@@ -33,7 +33,8 @@
bool set_decim_rate (unsigned int rate);
bool set_nchannels (int nchan);
bool set_mux (int mux);
- int determine_rx_mux_value(const usrp_subdev_spec &ss);
+ %rename(_real_determine_rx_mux_value) determine_rx_mux_value;
+ int determine_rx_mux_value(usrp_subdev_spec ss);
bool set_rx_freq (int channel, double freq);
bool set_fpga_mode (int mode);
bool set_ddc_phase(int channel, int phase);
@@ -57,3 +58,11 @@
static bool format_bypass_halfband(unsigned int format);
bool tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result
*result);
};
+
+//--- Allow Python subdev_spec to be tuple
+
+%pythoncode %{
+def __determine_rx_mux_value(self, subdev_spec):
+ ss = usrp_subdev_spec(subdev_spec[0], subdev_spec[1])
+ return self._real_determine_rx_mux_value(ss)
+%}
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_c.i
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_c.i
2008-11-21 22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_c.i
2008-11-22 01:31:35 UTC (rev 10030)
@@ -46,3 +46,10 @@
private:
usrp_source_c() throw (std::runtime_error);
};
+
+//--- Allow Python subdev_spec to be tuple
+%pythoncode %{
+
+usrp_source_c_sptr.determine_rx_mux_value = __determine_rx_mux_value
+
+%}
Modified: gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_s.i
===================================================================
--- gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_s.i
2008-11-21 22:45:00 UTC (rev 10029)
+++ gnuradio/branches/features/cppdb/gr-usrp/src/usrp_source_s.i
2008-11-22 01:31:35 UTC (rev 10030)
@@ -46,3 +46,10 @@
private:
usrp_source_s() throw (std::runtime_error);
};
+
+//--- Allow Python subdev_spec to be tuple
+%pythoncode %{
+
+usrp_source_s_sptr.determine_rx_mux_value = __determine_rx_mux_value
+
+%}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10030 - gnuradio/branches/features/cppdb/gr-usrp/src,
jcorgan <=