diff options
author | Josh Blum <josh@joshknows.com> | 2010-02-09 16:28:16 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-02-09 16:28:16 -0800 |
commit | c5480830c6e8e8e862523b3ebf3117fda8a100df (patch) | |
tree | 65aac999502e58efe5cdfad71bef7ddc3d201444 /include/usrp_uhd/usrp/dboard | |
parent | dfd7f99eecefc19effd97034048641de9d6b7e94 (diff) | |
download | uhd-c5480830c6e8e8e862523b3ebf3117fda8a100df.tar.gz uhd-c5480830c6e8e8e862523b3ebf3117fda8a100df.tar.bz2 uhd-c5480830c6e8e8e862523b3ebf3117fda8a100df.zip |
renamed usrp_uhd to uhd
Diffstat (limited to 'include/usrp_uhd/usrp/dboard')
-rw-r--r-- | include/usrp_uhd/usrp/dboard/.gitignore | 2 | ||||
-rw-r--r-- | include/usrp_uhd/usrp/dboard/Makefile.am | 27 | ||||
-rw-r--r-- | include/usrp_uhd/usrp/dboard/base.hpp | 111 | ||||
-rw-r--r-- | include/usrp_uhd/usrp/dboard/id.hpp | 34 | ||||
-rw-r--r-- | include/usrp_uhd/usrp/dboard/interface.hpp | 167 | ||||
-rw-r--r-- | include/usrp_uhd/usrp/dboard/manager.hpp | 82 |
6 files changed, 0 insertions, 423 deletions
diff --git a/include/usrp_uhd/usrp/dboard/.gitignore b/include/usrp_uhd/usrp/dboard/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/include/usrp_uhd/usrp/dboard/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/include/usrp_uhd/usrp/dboard/Makefile.am b/include/usrp_uhd/usrp/dboard/Makefile.am deleted file mode 100644 index a07ec3160..000000000 --- a/include/usrp_uhd/usrp/dboard/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2010 Ettus Research LLC -# -# 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 $(top_srcdir)/Makefile.common - -SUBDIRS = - -this_includedir = $(includedir)/usrp_uhd/usrp/dboard -this_include_HEADERS = \ - base.hpp \ - id.hpp \ - interface.hpp \ - manager.hpp diff --git a/include/usrp_uhd/usrp/dboard/base.hpp b/include/usrp_uhd/usrp/dboard/base.hpp deleted file mode 100644 index 50896b9a8..000000000 --- a/include/usrp_uhd/usrp/dboard/base.hpp +++ /dev/null @@ -1,111 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// 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/>. -// - -#ifndef INCLUDED_USRP_UHD_USRP_DBOARD_BASE_HPP -#define INCLUDED_USRP_UHD_USRP_DBOARD_BASE_HPP - -#include <usrp_uhd/wax.hpp> -#include <boost/utility.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/tuple/tuple.hpp> -#include <usrp_uhd/usrp/dboard/interface.hpp> - -namespace usrp_uhd{ namespace usrp{ namespace dboard{ - -/*! - * A daughter board base class for all dboards. - * Only other dboard base classes should inherit this. - */ -class base : boost::noncopyable{ -public: - typedef boost::shared_ptr<base> sptr; - //the constructor args consist of a subdev name and an interface - //derived classes should pass the args into the base class ctor - //but should not have to deal with the internals of the args - typedef boost::tuple<std::string, interface::sptr> ctor_args_t; - - //structors - base(ctor_args_t const&); - virtual ~base(void); - - //interface - virtual void rx_get(const wax::obj &key, wax::obj &val) = 0; - virtual void rx_set(const wax::obj &key, const wax::obj &val) = 0; - virtual void tx_get(const wax::obj &key, wax::obj &val) = 0; - virtual void tx_set(const wax::obj &key, const wax::obj &val) = 0; - -protected: - std::string get_subdev_name(void); - interface::sptr get_interface(void); - -private: - std::string _subdev_name; - interface::sptr _dboard_interface; -}; - -/*! - * A xcvr daughter board implements rx and tx methods - * Sub classes for xcvr boards should inherit this. - */ -class xcvr_base : public base{ -public: - /*! - * Create a new xcvr dboard object, override in subclasses. - */ - xcvr_base(ctor_args_t const&); - virtual ~xcvr_base(void); -}; - -/*! - * A rx daughter board only implements rx methods. - * Sub classes for rx-only boards should inherit this. - */ -class rx_base : public base{ -public: - /*! - * Create a new rx dboard object, override in subclasses. - */ - rx_base(ctor_args_t const&); - - virtual ~rx_base(void); - - //override here so the derived classes cannot - void tx_get(const wax::obj &key, wax::obj &val); - void tx_set(const wax::obj &key, const wax::obj &val); -}; - -/*! - * A tx daughter board only implements tx methods. - * Sub classes for rx-only boards should inherit this. - */ -class tx_base : public base{ -public: - /*! - * Create a new rx dboard object, override in subclasses. - */ - tx_base(ctor_args_t const&); - - virtual ~tx_base(void); - - //override here so the derived classes cannot - void rx_get(const wax::obj &key, wax::obj &val); - void rx_set(const wax::obj &key, const wax::obj &val); -}; - -}}} //namespace - -#endif /* INCLUDED_USRP_UHD_USRP_DBOARD_BASE_HPP */ diff --git a/include/usrp_uhd/usrp/dboard/id.hpp b/include/usrp_uhd/usrp/dboard/id.hpp deleted file mode 100644 index 8369841bf..000000000 --- a/include/usrp_uhd/usrp/dboard/id.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// 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 <iostream> - -#ifndef INCLUDED_USRP_UHD_USRP_DBOARD_ID_HPP -#define INCLUDED_USRP_UHD_USRP_DBOARD_ID_HPP - -namespace usrp_uhd{ namespace usrp{ namespace dboard{ - -enum dboard_id_t{ - ID_BASIC_TX = 0x0000, - ID_BASIC_RX = 0x0001 -}; - -}}} //namespace - -std::ostream& operator<<(std::ostream &, const usrp_uhd::usrp::dboard::dboard_id_t &); - -#endif /* INCLUDED_USRP_UHD_USRP_DBOARD_ID_HPP */ diff --git a/include/usrp_uhd/usrp/dboard/interface.hpp b/include/usrp_uhd/usrp/dboard/interface.hpp deleted file mode 100644 index 15621d0fc..000000000 --- a/include/usrp_uhd/usrp/dboard/interface.hpp +++ /dev/null @@ -1,167 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// 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/>. -// - -#ifndef INCLUDED_USRP_UHD_USRP_DBOARD_INTERFACE_HPP -#define INCLUDED_USRP_UHD_USRP_DBOARD_INTERFACE_HPP - -#include <boost/shared_ptr.hpp> -#include <stdint.h> - -namespace usrp_uhd{ namespace usrp{ namespace dboard{ - -/*! - * The daughter board interface to be subclassed. - * A dboard instance interfaces with the mboard though this api. - * This interface provides i2c, spi, gpio, atr, aux dac/adc access. - * Each mboard should have a specially tailored dboard interface. - */ -class interface{ -public: - typedef boost::shared_ptr<interface> sptr; - - //tells the host which device to use - enum spi_dev_t{ - SPI_TX_DEV, - SPI_RX_DEV - }; - - //args for writing spi data - enum spi_push_t{ - SPI_PUSH_RISE, - SPI_PUSH_FALL - }; - - //args for reading spi data - enum spi_latch_t{ - SPI_LATCH_RISE, - SPI_LATCH_FALL - }; - - //tell the host which gpio bank - enum gpio_bank_t{ - GPIO_TX_BANK, - GPIO_RX_BANK - }; - - //structors - interface(void); - virtual ~interface(void); - - /*! - * Write to an aux dac. - * \param which_dac the dac index 0, 1, 2, 3... - * \param value the value to write - */ - virtual void write_aux_dac(int which_dac, int value) = 0; - - /*! - * Read from an aux adc. - * \param which_adc the adc index 0, 1, 2, 3... - * \return the value that was read - */ - virtual int read_aux_adc(int which_adc) = 0; - - /*! - * Set daughterboard ATR register. - * The ATR register for a particular bank has 2 values: - * one value when transmitting, one when receiving. - * The mask controls which pins are controlled by ATR. - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \param tx_value 16-bits, 0=FPGA input, 1=FPGA output - * \param rx_value 16-bits, 0=FPGA input, 1=FPGA output - * \param mask 16-bits, 0=ignore, 1=atr - */ - virtual void set_atr_reg(gpio_bank_t bank, uint16_t tx_value, uint16_t rx_value, uint16_t mask) = 0; - - /*! - * Set daughterboard GPIO data direction register. - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \param value 16-bits, 0=FPGA input, 1=FPGA output - * \param mask 16-bits, 0=ignore, 1=set - */ - virtual void set_gpio_ddr(gpio_bank_t bank, uint16_t value, uint16_t mask) = 0; - - /*! - * Set daughterboard GPIO pin values. - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \param value 16 bits, 0=low, 1=high - * \param mask 16 bits, 0=ignore, 1=set - */ - virtual void write_gpio(gpio_bank_t bank, uint16_t value, uint16_t mask) = 0; - - /*! - * Read daughterboard GPIO pin values - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \return the value of the gpio bank - */ - virtual uint16_t read_gpio(gpio_bank_t bank) = 0; - - /*! - * \brief Write to I2C peripheral - * \param i2c_addr I2C bus address (7-bits) - * \param buf the data to write - */ - virtual void write_i2c(int i2c_addr, const std::string &buf) = 0; - - /*! - * \brief Read from I2C peripheral - * \param i2c_addr I2C bus address (7-bits) - * \param len number of bytes to read - * \return the data read if successful, else a zero length string. - */ - virtual std::string read_i2c(int i2c_addr, size_t len) = 0; - - /*! - * \brief Write data to SPI bus peripheral. - * - * \param dev which spi device - * \param push args for writing - * \param buf the data to write - */ - virtual void write_spi(spi_dev_t dev, spi_push_t push, const std::string &buf) = 0; - - /*! - * \brief Read data from SPI bus peripheral. - * - * \param dev which spi device - * \param push args for reading - * \param len number of bytes to read - * \return the data read if sucessful, else a zero length string. - */ - virtual std::string read_spi(spi_dev_t dev, spi_latch_t latch, size_t len) = 0; - - /*! - * \brief Get the rate of the rx dboard clock. - * \return the clock rate - */ - virtual double get_rx_clock_rate(void) = 0; - - /*! - * \brief Get the rate of the tx dboard clock. - * \return the clock rate - */ - virtual double get_tx_clock_rate(void) = 0; - -}; - -}}} //namespace - -#endif /* INCLUDED_USRP_UHD_USRP_DBOARD_INTERFACE_HPP */ diff --git a/include/usrp_uhd/usrp/dboard/manager.hpp b/include/usrp_uhd/usrp/dboard/manager.hpp deleted file mode 100644 index 8cc5658d9..000000000 --- a/include/usrp_uhd/usrp/dboard/manager.hpp +++ /dev/null @@ -1,82 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// 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/>. -// - -#ifndef INCLUDED_USRP_UHD_USRP_DBOARD_MANAGER_HPP -#define INCLUDED_USRP_UHD_USRP_DBOARD_MANAGER_HPP - -#include <map> -#include <usrp_uhd/wax.hpp> -#include <usrp_uhd/props.hpp> -#include <boost/utility.hpp> -#include <boost/shared_ptr.hpp> -#include <usrp_uhd/usrp/dboard/base.hpp> -#include <usrp_uhd/usrp/dboard/id.hpp> - -namespace usrp_uhd{ namespace usrp{ namespace dboard{ - -/*! - * A daughter board subdev manager class. - * Create subdev instances for each subdev on a dboard. - * Provide wax::obj access to the subdevs inside. - */ -class manager : boost::noncopyable{ - -public: - - //dboard constructor (each dboard should have a ::make with this signature) - typedef base::sptr(*dboard_ctor_t)(base::ctor_args_t const&); - - /*! - * Register subdevices for a given dboard id. - * - * \param dboard_id the dboard id (rx or tx) - * \param dboard_ctor the dboard constructor function pointer - * \param subdev_names the names of the subdevs on this dboard - */ - static void register_subdevs( - dboard_id_t dboard_id, - dboard_ctor_t dboard_ctor, - const prop_names_t &subdev_names - ); - -public: - typedef boost::shared_ptr<manager> sptr; - //structors - manager( - dboard_id_t rx_dboard_id, - dboard_id_t tx_dboard_id, - interface::sptr dboard_interface - ); - ~manager(void); - - //interface - prop_names_t get_rx_subdev_names(void); - prop_names_t get_tx_subdev_names(void); - wax::obj get_rx_subdev(const std::string &subdev_name); - wax::obj get_tx_subdev(const std::string &subdev_name); - -private: - //list of rx and tx dboards in this manager - //each dboard here is actually a subdevice proxy - //the subdevice proxy is internal to the cpp file - std::map<std::string, wax::obj> _rx_dboards; - std::map<std::string, wax::obj> _tx_dboards; -}; - -}}} //namespace - -#endif /* INCLUDED_USRP_UHD_USRP_DBOARD_MANAGER_HPP */ |