diff options
author | Josh Blum <josh@joshknows.com> | 2010-01-08 19:11:58 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-01-08 19:11:58 -0800 |
commit | 4e94574aeaa46c671bba0a6fc83cb967d228c880 (patch) | |
tree | dbc3ef97a3170875d07d9e0ab510d635c036edd6 | |
parent | a478ffe79757f82ce16b6694d860a53dac60849c (diff) | |
download | uhd-4e94574aeaa46c671bba0a6fc83cb967d228c880.tar.gz uhd-4e94574aeaa46c671bba0a6fc83cb967d228c880.tar.bz2 uhd-4e94574aeaa46c671bba0a6fc83cb967d228c880.zip |
Created subcomponent for usrp dboards.
Only populated the interface though.
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | Makefile.common | 12 | ||||
-rwxr-xr-x | bootstrap | 10 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | usrp_dboard/.gitignore | 2 | ||||
-rw-r--r-- | usrp_dboard/Makefile.am | 7 | ||||
-rw-r--r-- | usrp_dboard/include/.gitignore | 2 | ||||
-rw-r--r-- | usrp_dboard/include/Makefile.am | 10 | ||||
-rw-r--r-- | usrp_dboard/include/usrp_dboard/interface.hpp | 119 | ||||
-rw-r--r-- | usrp_dboard/lib/.gitignore | 2 | ||||
-rw-r--r-- | usrp_dboard/lib/Makefile.am | 23 | ||||
-rw-r--r-- | usrp_dboard/lib/interface.cpp | 13 | ||||
-rw-r--r-- | usrp_uhd/include/Makefile.am | 6 | ||||
-rw-r--r-- | usrp_uhd/lib/Makefile.am | 3 |
15 files changed, 213 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore index cce871cf4..6a9409823 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ /Makefile /Makefile.in /aclocal.m4 -/autom4te.cache/ -/bootstrap +/autom4te.cache /config.guess /config.log /config.status diff --git a/Makefile.am b/Makefile.am index 9658b5bd8..3fe105aa3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,4 +4,6 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = usrp_uhd +SUBDIRS = \ + usrp_dboard \ + usrp_uhd diff --git a/Makefile.common b/Makefile.common index 9b81eb842..b7e672baf 100644 --- a/Makefile.common +++ b/Makefile.common @@ -2,8 +2,20 @@ # Copyright 2010 Ettus Research LLC # +######################################################################## +## Makefile variables for the top level component: the uhd +######################################################################## USRP_UHD_INCLUDES = \ -I$(top_srcdir)/usrp_uhd/include USRP_UHD_LA = \ $(top_srcdir)/usrp_uhd/lib/libusrp_uhd.la + +######################################################################## +## Makefile variables for the usrp dboard component +######################################################################## +USRP_DBOARD_INCLUDES = \ + -I$(top_srcdir)/usrp_dboard/include + +USRP_DBOARD_LA = \ + $(top_srcdir)/usrp_dboard/lib/libusrp_dboard.la diff --git a/bootstrap b/bootstrap new file mode 100755 index 000000000..f94f12a33 --- /dev/null +++ b/bootstrap @@ -0,0 +1,10 @@ +# +# Copyright 2010 Ettus Research LLC +# + +rm -rf *.cache + +aclocal -I config +autoconf +libtoolize --automake +automake --add-missing --gnu --warnings=all diff --git a/configure.ac b/configure.ac index 3076fde5e..c9c59fbcf 100644 --- a/configure.ac +++ b/configure.ac @@ -32,5 +32,8 @@ AC_CONFIG_FILES([ \ usrp_uhd/Makefile \ usrp_uhd/include/Makefile \ usrp_uhd/lib/Makefile \ + usrp_dboard/Makefile \ + usrp_dboard/include/Makefile \ + usrp_dboard/lib/Makefile \ ]) AC_OUTPUT diff --git a/usrp_dboard/.gitignore b/usrp_dboard/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/usrp_dboard/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/usrp_dboard/Makefile.am b/usrp_dboard/Makefile.am new file mode 100644 index 000000000..a5a0ceb25 --- /dev/null +++ b/usrp_dboard/Makefile.am @@ -0,0 +1,7 @@ +# +# Copyright 2010 Ettus Research LLC +# + +include $(top_srcdir)/Makefile.common + +SUBDIRS = include lib diff --git a/usrp_dboard/include/.gitignore b/usrp_dboard/include/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/usrp_dboard/include/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/usrp_dboard/include/Makefile.am b/usrp_dboard/include/Makefile.am new file mode 100644 index 000000000..fc549bfe0 --- /dev/null +++ b/usrp_dboard/include/Makefile.am @@ -0,0 +1,10 @@ +# +# Copyright 2010 Ettus Research LLC +# + +include $(top_srcdir)/Makefile.common + +SUBDIRS = + +noinst_HEADERS = \ + usrp_dboard/interface.hpp diff --git a/usrp_dboard/include/usrp_dboard/interface.hpp b/usrp_dboard/include/usrp_dboard/interface.hpp new file mode 100644 index 000000000..c8e655736 --- /dev/null +++ b/usrp_dboard/include/usrp_dboard/interface.hpp @@ -0,0 +1,119 @@ +// +// Copyright 2010 Ettus Research LLC +// + +#ifndef INCLUDED_USRP_DBOARD_INTERFACE_HPP +#define INCLUDED_USRP_DBOARD_INTERFACE_HPP + +#include <boost/shared_ptr.hpp> +#include <stdint.h> + +namespace usrp_dboard{ + +/*! + * The daughter board interface to be subclassed. + * Each mboard should have a specially taylored dboard interface. + * This interface provides i2c, spi, gpio access for dboard instances. + */ +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); + + /*! + * 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 + * Writes are limited to a maximum of of 64 bytes. + */ + 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. + * Reads are limited to a maximum of 64 bytes. + */ + 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 + * + * Writes are limited to a maximum of 64 bytes. + */ + 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. Must be in [0,64]. + * \return the data read if sucessful, else a zero length string. + * + * Reads are limited to a maximum of 64 bytes. + */ + virtual std::string read_spi (spi_dev_t dev, spi_latch_t latch, size_t len) = 0; +}; + +} //namespace usrp_dboard + +#endif /* INCLUDED_USRP_DBOARD_INTERFACE_HPP */ diff --git a/usrp_dboard/lib/.gitignore b/usrp_dboard/lib/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/usrp_dboard/lib/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in diff --git a/usrp_dboard/lib/Makefile.am b/usrp_dboard/lib/Makefile.am new file mode 100644 index 000000000..69f2c8568 --- /dev/null +++ b/usrp_dboard/lib/Makefile.am @@ -0,0 +1,23 @@ +# +# Copyright 2010 Ettus Research LLC +# + +include $(top_srcdir)/Makefile.common + +SUBDIRS = + +AM_CPPFLAGS = \ + $(USRP_DBOARD_INCLUDES) \ + $(BOOST_CPPFLAGS) + +noinst_LTLIBRARIES = \ + libusrp_dboard.la + +libusrp_dboard_la_SOURCES = \ + interface.cpp + +libusrp_dboard_la_LIBADD = \ + $(BOOST_LDFLAGS) \ + $(BOOST_THREAD_LIB) + +noinst_HEADERS = diff --git a/usrp_dboard/lib/interface.cpp b/usrp_dboard/lib/interface.cpp new file mode 100644 index 000000000..5fedf9c46 --- /dev/null +++ b/usrp_dboard/lib/interface.cpp @@ -0,0 +1,13 @@ +// +// Copyright 2010 Ettus Research LLC +// + +#include <usrp_dboard/interface.hpp> + +usrp_dboard::interface::interface(void){ + /* NOP */ +} + +usrp_dboard::interface::~interface(void){ + /* NOP */ +} diff --git a/usrp_uhd/include/Makefile.am b/usrp_uhd/include/Makefile.am index b5d09b431..1ec431648 100644 --- a/usrp_uhd/include/Makefile.am +++ b/usrp_uhd/include/Makefile.am @@ -6,9 +6,11 @@ include $(top_srcdir)/Makefile.common SUBDIRS = -usrp_uhd_includedir = $(includedir) +this_includedir = $(includedir) +this_include_HEADERS = \ + usrp_uhd.hpp +usrp_uhd_includedir = $(includedir)/usrp_uhd usrp_uhd_include_HEADERS = \ - usrp_uhd.hpp \ usrp_uhd/usrp_addr.hpp \ usrp_uhd/wax.hpp diff --git a/usrp_uhd/lib/Makefile.am b/usrp_uhd/lib/Makefile.am index 09e15301b..2b744b4fc 100644 --- a/usrp_uhd/lib/Makefile.am +++ b/usrp_uhd/lib/Makefile.am @@ -20,6 +20,7 @@ libusrp_uhd_la_SOURCES = \ libusrp_uhd_la_LIBADD = \ $(BOOST_LDFLAGS) \ - $(BOOST_THREAD_LIB) + $(BOOST_THREAD_LIB) \ + $(USRP_DBOARD_LA) noinst_HEADERS = |