summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-16 22:10:35 -0700
committerJosh Blum <josh@joshknows.com>2010-04-16 22:10:35 -0700
commit8375ae721cd819b54fae4cc22e76285552033945 (patch)
tree5f2140a4e358d9f5259c617d17316d1a6ee17fdf /host/include
parent632ca4afbbc2e383b956a7abe8e35ee1020c7306 (diff)
downloaduhd-8375ae721cd819b54fae4cc22e76285552033945.tar.gz
uhd-8375ae721cd819b54fae4cc22e76285552033945.tar.bz2
uhd-8375ae721cd819b54fae4cc22e76285552033945.zip
moved spi and i2c api into serial.hpp, its used for more than the dboard interfacing
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/types/CMakeLists.txt1
-rw-r--r--host/include/uhd/types/io_type.hpp1
-rw-r--r--host/include/uhd/types/serial.hpp61
-rw-r--r--host/include/uhd/usrp/dboard_iface.hpp30
4 files changed, 64 insertions, 29 deletions
diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt
index e4cdf2cef..dbce21c98 100644
--- a/host/include/uhd/types/CMakeLists.txt
+++ b/host/include/uhd/types/CMakeLists.txt
@@ -25,6 +25,7 @@ INSTALL(FILES
metadata.hpp
otw_type.hpp
ranges.hpp
+ serial.hpp
stream_cmd.hpp
time_spec.hpp
tune_result.hpp
diff --git a/host/include/uhd/types/io_type.hpp b/host/include/uhd/types/io_type.hpp
index 930394d1b..5176374d6 100644
--- a/host/include/uhd/types/io_type.hpp
+++ b/host/include/uhd/types/io_type.hpp
@@ -23,6 +23,7 @@
namespace uhd{
/*!
+ * The Input/Output configuration struct:
* Used to specify the IO type with device send/recv.
*/
class UHD_API io_type_t{
diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp
new file mode 100644
index 000000000..b0fe5d7bd
--- /dev/null
+++ b/host/include/uhd/types/serial.hpp
@@ -0,0 +1,61 @@
+//
+// 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_UHD_TYPES_SERIAL_HPP
+#define INCLUDED_UHD_TYPES_SERIAL_HPP
+
+#include <uhd/config.hpp>
+#include <boost/cstdint.hpp>
+#include <vector>
+
+namespace uhd{
+
+ /*!
+ * Byte vector typedef for passing data in and out of I2C interfaces.
+ */
+ typedef std::vector<boost::uint8_t> byte_vector_t;
+
+ /*!
+ * The SPI configuration struct:
+ * Used to configure a SPI transaction interface.
+ */
+ struct UHD_API spi_config_t{
+ /*!
+ * The edge type specifies when data is valid
+ * relative to the edge of the serial clock.
+ */
+ enum edge_t{
+ EDGE_RISE = 'r',
+ EDGE_FALL = 'f'
+ };
+
+ //! on what edge is the mosi data valid?
+ edge_t mosi_edge;
+
+ //! on what edge is the miso data valid?
+ edge_t miso_edge;
+
+ /*!
+ * Create a new spi config.
+ * \param edge the default edge for mosi and miso
+ */
+ spi_config_t(edge_t edge = EDGE_RISE);
+ };
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_TYPES_SERIAL_HPP */
diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp
index 71c7be200..79b8ee664 100644
--- a/host/include/uhd/usrp/dboard_iface.hpp
+++ b/host/include/uhd/usrp/dboard_iface.hpp
@@ -19,39 +19,12 @@
#define INCLUDED_UHD_USRP_DBOARD_IFACE_HPP
#include <uhd/config.hpp>
+#include <uhd/types/serial.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/cstdint.hpp>
-#include <vector>
namespace uhd{ namespace usrp{
-//spi configuration struct
-struct UHD_API spi_config_t{
- /*!
- * The edge type specifies when data is valid
- * relative to the edge of the serial clock.
- */
- enum edge_t{
- EDGE_RISE = 'r',
- EDGE_FALL = 'f'
- };
-
- //! on what edge is the mosi data valid?
- edge_t mosi_edge;
-
- //! on what edge is the miso data valid?
- edge_t miso_edge;
-
- /*!
- * Create a new spi config.
- * \param edge the default edge for mosi and miso
- */
- spi_config_t(edge_t edge = EDGE_RISE){
- mosi_edge = edge;
- miso_edge = edge;
- }
-};
-
/*!
* The daughter board dboard interface to be subclassed.
* A dboard instance interfaces with the mboard though this api.
@@ -61,7 +34,6 @@ struct UHD_API spi_config_t{
class UHD_API dboard_iface{
public:
typedef boost::shared_ptr<dboard_iface> sptr;
- typedef std::vector<boost::uint8_t> byte_vector_t;
//tells the host which unit to use
enum unit_t{