[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 05/10: uhd: Expose GPIO functions through S
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 05/10: uhd: Expose GPIO functions through SWIG |
Date: |
Sun, 14 Jun 2015 16:34:15 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 1c9d7d93c0d87158e7cce85f39d2c1420c51c9ec
Author: Martin Braun <address@hidden>
Date: Thu Jun 11 13:17:05 2015 -0700
uhd: Expose GPIO functions through SWIG
---
gr-uhd/include/gnuradio/uhd/usrp_block.h | 56 ++++++++++++++++++++++++++++++++
gr-uhd/lib/usrp_block_impl.cc | 38 ++++++++++++++++++++++
gr-uhd/lib/usrp_block_impl.h | 13 ++++++++
3 files changed, 107 insertions(+)
diff --git a/gr-uhd/include/gnuradio/uhd/usrp_block.h
b/gr-uhd/include/gnuradio/uhd/usrp_block.h
index 5605ab8..d57e1d2 100644
--- a/gr-uhd/include/gnuradio/uhd/usrp_block.h
+++ b/gr-uhd/include/gnuradio/uhd/usrp_block.h
@@ -500,6 +500,62 @@ namespace gr {
*/
virtual void set_stream_args(const ::uhd::stream_args_t &stream_args) =
0;
+ /*******************************************************************
+ * GPIO methods
+ ******************************************************************/
+ /*!
+ * Enumerate GPIO banks on the current device.
+ * \param mboard the motherboard index 0 to M-1
+ * \return a list of string for each bank name
+ */
+ virtual std::vector<std::string> get_gpio_banks(const size_t mboard) = 0;
+
+ /*!
+ * Set a GPIO attribute on a particular GPIO bank.
+ * Possible attribute names:
+ * - CTRL - 1 for ATR mode 0 for GPIO mode
+ * - DDR - 1 for output 0 for input
+ * - OUT - GPIO output level (not ATR mode)
+ * - ATR_0X - ATR idle state
+ * - ATR_RX - ATR receive only state
+ * - ATR_TX - ATR transmit only state
+ * - ATR_XX - ATR full duplex state
+ * \param bank the name of a GPIO bank
+ * \param attr the name of a GPIO attribute
+ * \param value the new value for this GPIO bank
+ * \param mask the bit mask to effect which pins are changed
+ * \param mboard the motherboard index 0 to M-1
+ */
+ virtual void set_gpio_attr(
+ const std::string &bank,
+ const std::string &attr,
+ const boost::uint32_t value,
+ const boost::uint32_t mask = 0xffffffff,
+ const size_t mboard = 0
+ ) = 0;
+
+ /*!
+ * Get a GPIO attribute on a particular GPIO bank.
+ * Possible attribute names:
+ * - CTRL - 1 for ATR mode 0 for GPIO mode
+ * - DDR - 1 for output 0 for input
+ * - OUT - GPIO output level (not ATR mode)
+ * - ATR_0X - ATR idle state
+ * - ATR_RX - ATR receive only state
+ * - ATR_TX - ATR transmit only state
+ * - ATR_XX - ATR full duplex state
+ * - READBACK - readback input GPIOs
+ * \param bank the name of a GPIO bank
+ * \param attr the name of a GPIO attribute
+ * \param mboard the motherboard index 0 to M-1
+ * \return the value set for this attribute
+ */
+ virtual boost::uint32_t get_gpio_attr(
+ const std::string &bank,
+ const std::string &attr,
+ const size_t mboard = 0
+ ) = 0;
+
};
} /* namespace uhd */
diff --git a/gr-uhd/lib/usrp_block_impl.cc b/gr-uhd/lib/usrp_block_impl.cc
index c36898a..1977b89 100644
--- a/gr-uhd/lib/usrp_block_impl.cc
+++ b/gr-uhd/lib/usrp_block_impl.cc
@@ -327,6 +327,29 @@ usrp_block_impl::get_time_last_pps(size_t mboard)
return _dev->get_time_last_pps(mboard);
}
+std::vector<std::string>
+usrp_block_impl::get_gpio_banks(const size_t mboard)
+{
+#ifdef UHD_USRP_MULTI_USRP_GPIO_API
+ return _dev->get_gpio_banks(mboard);
+#else
+ throw std::runtime_error("not implemented in this version");
+#endif
+}
+
+boost::uint32_t
+usrp_block_impl::get_gpio_attr(
+ const std::string &bank,
+ const std::string &attr,
+ const size_t mboard
+) {
+#ifdef UHD_USRP_MULTI_USRP_GPIO_API
+ return _dev->get_gpio_attr(bank, attr, mboard);
+#else
+ throw std::runtime_error("not implemented in this version");
+#endif
+}
+
void
usrp_block_impl::set_time_now(const ::uhd::time_spec_t &time_spec,
size_t mboard)
@@ -379,6 +402,21 @@ usrp_block_impl::set_user_register(const uint8_t addr,
#endif
}
+void
+usrp_block_impl::set_gpio_attr(
+ const std::string &bank,
+ const std::string &attr,
+ const boost::uint32_t value,
+ const boost::uint32_t mask,
+ const size_t mboard
+) {
+#ifdef UHD_USRP_MULTI_USRP_GPIO_API
+ return _dev->set_gpio_attr(bank, attr, value, mask, mboard);
+#else
+ throw std::runtime_error("not implemented in this version");
+#endif
+}
+
::uhd::usrp::multi_usrp::sptr
usrp_block_impl::get_device(void)
{
diff --git a/gr-uhd/lib/usrp_block_impl.h b/gr-uhd/lib/usrp_block_impl.h
index 5b38b51..2158d54 100644
--- a/gr-uhd/lib/usrp_block_impl.h
+++ b/gr-uhd/lib/usrp_block_impl.h
@@ -62,6 +62,12 @@ namespace gr {
::uhd::time_spec_t get_time_now(size_t mboard = 0);
::uhd::time_spec_t get_time_last_pps(size_t mboard);
::uhd::usrp::multi_usrp::sptr get_device(void);
+ std::vector<std::string> get_gpio_banks(const size_t mboard);
+ boost::uint32_t get_gpio_attr(
+ const std::string &bank,
+ const std::string &attr,
+ const size_t mboard = 0
+ );
// Setters
void set_clock_config(const ::uhd::clock_config_t &clock_config, size_t
mboard);
@@ -74,6 +80,13 @@ namespace gr {
void set_command_time(const ::uhd::time_spec_t &time_spec, size_t
mboard);
void set_user_register(const uint8_t addr, const uint32_t data, size_t
mboard);
void clear_command_time(size_t mboard);
+ void set_gpio_attr(
+ const std::string &bank,
+ const std::string &attr,
+ const boost::uint32_t value,
+ const boost::uint32_t mask,
+ const size_t mboard
+ );
// RPC
void setup_rpc();
- [Commit-gnuradio] [gnuradio] branch master updated (1dc65e1 -> 7ee2f91), git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 06/10: Merge remote-tracking branch 'skoslowski/top_block_wait', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 09/10: Merge branch 'maint', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 01/10: runtime: add flag to wrapped top_block to control SIGINT handling in wait(), git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 08/10: Merge remote-tracking branch 'mbr0wn/uhd/gpios', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 07/10: Merge remote-tracking branch 'drmpeg/dtv-coverity-cleanup', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 05/10: uhd: Expose GPIO functions through SWIG,
git <=
- [Commit-gnuradio] [gnuradio] 10/10: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 03/10: grc: add <flags> to blocks dtd (<throttle> still supported), git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 04/10: grc: Added ability to bypass blocks (Suggested by Chris Headley)., git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 02/10: gr-dtv: Clean up minor Coverity Scan issues., git, 2015/06/14