Updates to C++ and Python APIs:
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Tue, 19 May 2009 03:10:32 +0000 (03:10 +0000)
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Tue, 19 May 2009 03:10:32 +0000 (03:10 +0000)
* C++: Adds usrp2::MC_* constants for config_mimo() call in libusrp2

* Python: Adds usrp2.config_mimo(), and usrp2.MC_* constants

* Python: Adds usrp2.sync_every_pps()

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11050 221aa14e-8319-0410-a670-987f0aec2ac5

gr-usrp2/src/usrp2.i
gr-usrp2/src/usrp2_base.cc
gr-usrp2/src/usrp2_base.h
usrp2/host/include/usrp2/Makefile.am
usrp2/host/include/usrp2/mimo_config.h [new file with mode: 0644]
usrp2/host/include/usrp2/usrp2.h

index 3d6da06067421543ec8ccdea914c1d40bf53c848..319740283f86de341b0ea99628f0a4c85bb18fe7 100644 (file)
@@ -31,6 +31,7 @@
 %}
 
 %include <usrp2/tune_result.h>
+%include <usrp2/mimo_config.h>
 
 %template(uint32_t_vector) std::vector<uint32_t>;
 
@@ -48,7 +49,9 @@ public:
   std::string interface_name() const;
   %rename(_real_fpga_master_clock_freq) fpga_master_clock_freq;
   bool fpga_master_clock_freq(long *freq);
+  bool config_mimo(int flags);
   bool sync_to_pps();
+  bool sync_every_pps(bool enable);
   std::vector<uint32_t> peek32(uint32_t addr, uint32_t words);
   bool poke32(uint32_t addr, const std::vector<uint32_t> &data);
 };
index 34492dc478cada2aed19b6eec8a02a2d21d201f3..bb99597254a1d51def14b6a743a47e643a79708b 100644 (file)
@@ -67,12 +67,24 @@ usrp2_base::fpga_master_clock_freq(long *freq) const
   return d_u2->fpga_master_clock_freq(freq);
 }
 
+bool
+usrp2_base::config_mimo(int flags)
+{
+  return d_u2->config_mimo(flags);
+}
+
 bool
 usrp2_base::sync_to_pps()
 {
   return d_u2->sync_to_pps();
 }
 
+bool
+usrp2_base::sync_every_pps(bool enable)
+{
+  return d_u2->sync_every_pps(enable);
+}
+
 std::vector<uint32_t>
 usrp2_base::peek32(uint32_t addr, uint32_t words)
 {
index bfd1dce0949e9bb57ee109666b02ca57da3dc13e..67a62ba10643fb30ed68056e4d53608f0ffdc9c3 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -63,11 +63,21 @@ public:
    */
   bool fpga_master_clock_freq(long *freq) const;
 
+  /*!
+   * \brief MIMO configuration
+   */
+  bool config_mimo(int flags);
+  
   /*!
    * \brief Set master time to 0 at next PPS rising edge
    */
   bool sync_to_pps();
 
+  /*!
+   * Reset master time to 0 at every PPS edge
+   */
+  bool sync_every_pps(bool enable);
+
   /*!
    * \brief Read memory from Wishbone bus as words
    */
index 4c6dac8999b0844520878fa187a3723de3f58bb9..08fdcde33eac6d06bfe69f40510a1bfed2de626d 100644 (file)
@@ -26,6 +26,7 @@ usrp2include_HEADERS = \
        copy_handler.h \
         data_handler.h \
        metadata.h \
+       mimo_config.h \
        rx_nop_handler.h \
        rx_sample_handler.h \
        strtod_si.h \
diff --git a/usrp2/host/include/usrp2/mimo_config.h b/usrp2/host/include/usrp2/mimo_config.h
new file mode 100644 (file)
index 0000000..a1e038f
--- /dev/null
@@ -0,0 +1,50 @@
+/* -*- c -*- */
+/*
+ * Copyright 2008,2009 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_USRP2_MIMO_CONFIG_H
+#define INCLUDED_USRP2_MIMO_CONFIG_H
+
+// FIXME: This duplicates the firmware usrp2_mimo_config.h file
+
+namespace usrp2 {
+
+  static const int _MC_WE_LOCK         = 0x0001;
+  static const int _MC_MIMO_CLK_INPUT  = 0x0002;               // else SMA input
+  
+  /*
+   * Derived masks (use these):
+   *
+   * We get our input from 1 of three places:
+   *  Our free running oscilator, our SMA connector, or from the MIMO connector
+   */
+  static const int MC_WE_DONT_LOCK     = 0x0000;
+  static const int MC_WE_LOCK_TO_SMA   = (_MC_WE_LOCK | 0);
+  static const int MC_WE_LOCK_TO_MIMO  = (_MC_WE_LOCK | _MC_MIMO_CLK_INPUT);
+  
+  /*
+   * Independent of the source of the clock, we may or may not drive our
+   * clock onto the mimo connector.  Note that there are dedicated clock
+   * signals in each direction, so disaster doesn't occurs if we're
+   * unnecessarily providing clock.
+   */
+  static const int MC_PROVIDE_CLK_TO_MIMO = 0x0004;
+}
+
+#endif /* INCLUDED_USRP2_MIMO_CONFIG_H */
index f4086440ec2413979386a9748b2390cd7a2377f0..1c99a54cb4b10c1d864c1cc664f88fd42a811c58 100644 (file)
@@ -25,7 +25,7 @@
 #include <complex>
 #include <usrp2/rx_sample_handler.h>
 #include <usrp2/tune_result.h>
-
+#include <usrp2/mimo_config.h>
 
 /*
  * N.B., The interfaces described here are still in flux.
@@ -67,7 +67,7 @@ namespace usrp2 {
   // FIXME: get from firmware include
   static const int GPIO_TX_BANK = 0;
   static const int GPIO_RX_BANK = 1;
-  
+
   class usrp2 : boost::noncopyable
   {
   public: