diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2017-03-27 18:03:52 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:45 -0800 |
commit | 6a12add1560545438e1bebc05efbafd05aace4f9 (patch) | |
tree | c94dbbbd4da0c7ef41fc8849f174875a13f0b511 /mpm/include | |
parent | ba4fad345d7489b40a7dab83842ac21d13c4f460 (diff) | |
download | uhd-6a12add1560545438e1bebc05efbafd05aace4f9.tar.gz uhd-6a12add1560545438e1bebc05efbafd05aace4f9.tar.bz2 uhd-6a12add1560545438e1bebc05efbafd05aace4f9.zip |
mpm: mpm reorganization
Diffstat (limited to 'mpm/include')
-rw-r--r-- | mpm/include/mpm/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mpm/include/mpm/ad937x/CMakeLists.txt | 1 | ||||
-rw-r--r-- | mpm/include/mpm/lmk04828/lmk04828_spi_iface.hpp | 2 | ||||
-rw-r--r-- | mpm/include/mpm/net_helper.hpp | 69 | ||||
-rw-r--r-- | mpm/include/mpm/udev_helper.hpp | 62 |
5 files changed, 3 insertions, 133 deletions
diff --git a/mpm/include/mpm/CMakeLists.txt b/mpm/include/mpm/CMakeLists.txt index 8d073b622..a4ce92931 100644 --- a/mpm/include/mpm/CMakeLists.txt +++ b/mpm/include/mpm/CMakeLists.txt @@ -15,8 +15,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # INSTALL(FILES - net_helper.hpp - udev_helper.hpp xbar_iface.hpp DESTINATION ${INCLUDE_DIR}/mpm ) diff --git a/mpm/include/mpm/ad937x/CMakeLists.txt b/mpm/include/mpm/ad937x/CMakeLists.txt index 3fe8d1419..834d6759a 100644 --- a/mpm/include/mpm/ad937x/CMakeLists.txt +++ b/mpm/include/mpm/ad937x/CMakeLists.txt @@ -15,6 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # INSTALL(FILES + adi_ctrl.hpp ad937x_ctrl.hpp DESTINATION ${INCLUDE_DIR}/mpm/mykonos ) diff --git a/mpm/include/mpm/lmk04828/lmk04828_spi_iface.hpp b/mpm/include/mpm/lmk04828/lmk04828_spi_iface.hpp index fa11029a8..2743977dc 100644 --- a/mpm/include/mpm/lmk04828/lmk04828_spi_iface.hpp +++ b/mpm/include/mpm/lmk04828/lmk04828_spi_iface.hpp @@ -1,3 +1,5 @@ +#pragma once + #include "lmk04828.hpp" #include "uhd/types/serial.hpp" #include <boost/shared_ptr.hpp> diff --git a/mpm/include/mpm/net_helper.hpp b/mpm/include/mpm/net_helper.hpp deleted file mode 100644 index b07e43ccc..000000000 --- a/mpm/include/mpm/net_helper.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright 2017 Ettus Research (National Instruments) -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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, see <http://www.gnu.org/licenses/>. -// - -#include <map> -#include <vector> -#include <string> - -namespace mpm { -namespace network { - -/*! - * A struct describing a single network interface - */ -using net_iface = struct net_iface { - /*! MAC address of the interface in the form AABBCCDDEEFF */ - std::string mac_addr; - /*! vector of associated IP addresses, contains both IPv4 and IPv6 */ - std::vector<std::string> ip_addr; -}; - -/*! - * net_ifaces contains a <interfaces name, net_iface> pair - * describing mac address and associated ip addresses for - * each interface - */ -using net_ifaces = std::map<std::string, net_iface>; - -/*! - * Convenience function to get all ip addresses of one MAC address - * \param MAC address in the form AABBCCDDEEFF - * \return vector of strings containing all IP addresses with this MAC address - */ -std::vector<std::string> get_if_addrs(const std::string& mac_addr); - -/*! - * Get information about all interfaces on this system - * \return a map with interface names as keys and the interfaces information as value - */ -net_ifaces get_net_map(); - -/*! - * Pretty print net_ifaces in the style of `ip addr` - * \param interface map net_ifaces to print - */ -void print_net_ifaces(net_ifaces my_ifaces); -} -} - -#ifdef LIBMPM_PYTHON -void export_net_iface(){ - LIBMPM_BOOST_PREAMBLE("network") - bp::def("get_if_addrs", &mpm::network::get_if_addrs); -} -#endif - diff --git a/mpm/include/mpm/udev_helper.hpp b/mpm/include/mpm/udev_helper.hpp deleted file mode 100644 index 055a93cee..000000000 --- a/mpm/include/mpm/udev_helper.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright 2017 Ettus Research (National Instruments) -// -// This program 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 of the License, or -// (at your option) any later version. -// -// This program 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, see <http://www.gnu.org/licenses/>. -// - -#include <libudev.h> -#include <string> -#include <vector> - -namespace mpm { - /*! - * The udev_helper class: - * - * talks to libudev and holds a udev context. Device enumeration is done - * once during initialization. - * On destruction the udev context is unreferenced again. - */ - class udev_helper{ - public: - udev_helper(); - ~udev_helper(); - /*! - * Return the nvmem device associated with the parent address - * \param address of the parent platform driver - * \return a string containing the name of file of the device in /sys - */ - std::string get_eeprom(const std::string &address); - /*! - * Find spidevices associated with the spi_master - * \param address of the parent platform driver - * \return a vector of string containing the device paths is /dev - */ - std::vector<std::string> get_spidev_nodes(const std::string &spi_master); - - private: - udev *_udev; - udev_enumerate *_enumerate; - }; -} - -#ifdef LIBMPM_PYTHON -void export_udev_helper(){ - LIBMPM_BOOST_PREAMBLE("udev") - bp::class_<mpm::udev_helper>("udev_helper", bp::init<>()) - .def("get_eeprom", &mpm::udev_helper::get_eeprom) - .def("get_spidev_nodes", &mpm::udev_helper::get_spidev_nodes) - ; -} -#endif - |