summaryrefslogtreecommitdiffstats
path: root/host/lib
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/lib
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/lib')
-rw-r--r--host/lib/types.cpp9
-rw-r--r--host/lib/usrp/usrp2/clock_control.cpp1
-rw-r--r--host/lib/usrp/usrp2/dboard_iface.cpp6
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp1
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.hpp4
5 files changed, 16 insertions, 5 deletions
diff --git a/host/lib/types.cpp b/host/lib/types.cpp
index 0fd2522cf..2a687f34f 100644
--- a/host/lib/types.cpp
+++ b/host/lib/types.cpp
@@ -25,6 +25,7 @@
#include <uhd/types/mac_addr.hpp>
#include <uhd/types/otw_type.hpp>
#include <uhd/types/io_type.hpp>
+#include <uhd/types/serial.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/foreach.hpp>
@@ -243,3 +244,11 @@ io_type_t::io_type_t(size_t size)
: size(size), tid(CUSTOM_TYPE){
/* NOP */
}
+
+/***********************************************************************
+ * serial
+ **********************************************************************/
+spi_config_t::spi_config_t(edge_t edge){
+ mosi_edge = edge;
+ miso_edge = edge;
+}
diff --git a/host/lib/usrp/usrp2/clock_control.cpp b/host/lib/usrp/usrp2/clock_control.cpp
index dcd7ce9da..72f1f1c7a 100644
--- a/host/lib/usrp/usrp2/clock_control.cpp
+++ b/host/lib/usrp/usrp2/clock_control.cpp
@@ -21,6 +21,7 @@
#include "usrp2_regs.hpp" //spi slave constants
#include <boost/cstdint.hpp>
+using namespace uhd;
using namespace uhd::usrp;
/*!
diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp
index 2859a7981..5ccb6fa47 100644
--- a/host/lib/usrp/usrp2/dboard_iface.cpp
+++ b/host/lib/usrp/usrp2/dboard_iface.cpp
@@ -17,7 +17,8 @@
#include "usrp2_iface.hpp"
#include "clock_control.hpp"
-#include "usrp2_regs.hpp"
+#include "usrp2_regs.hpp" //wishbone address constants
+#include <uhd/usrp/dboard_iface.hpp>
#include <uhd/types/dict.hpp>
#include <uhd/utils/assert.hpp>
#include <boost/assign/list_of.hpp>
@@ -25,6 +26,7 @@
#include <boost/math/special_functions/round.hpp>
#include <algorithm>
+using namespace uhd;
using namespace uhd::usrp;
class usrp2_dboard_iface : public dboard_iface{
@@ -214,7 +216,7 @@ void usrp2_dboard_iface::write_i2c(int i2c_addr, const byte_vector_t &buf){
ASSERT_THROW(htonl(in_data.id) == USRP2_CTRL_ID_COOL_IM_DONE_I2C_WRITE_DUDE);
}
-dboard_iface::byte_vector_t usrp2_dboard_iface::read_i2c(int i2c_addr, size_t num_bytes){
+byte_vector_t usrp2_dboard_iface::read_i2c(int i2c_addr, size_t num_bytes){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_DO_AN_I2C_READ_FOR_ME_BRO);
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index 5c84fd8d3..742c53a14 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -24,7 +24,6 @@
#include <stdexcept>
using namespace uhd;
-using namespace uhd::usrp;
class usrp2_iface_impl : public usrp2_iface{
public:
diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp
index 1298d87f1..6667c8998 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.hpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.hpp
@@ -19,7 +19,7 @@
#define INCLUDED_USRP2_IFACE_HPP
#include <uhd/transport/udp_simple.hpp>
-#include <uhd/usrp/dboard_iface.hpp> //spi config
+#include <uhd/types/serial.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/cstdint.hpp>
@@ -87,7 +87,7 @@ public:
*/
virtual boost::uint32_t transact_spi(
int which_slave,
- const uhd::usrp::spi_config_t &config,
+ const uhd::spi_config_t &config,
boost::uint32_t data,
size_t num_bits,
bool readback