aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp_e
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-28 11:25:26 -0700
committerJosh Blum <josh@joshknows.com>2010-04-28 11:25:26 -0700
commit1b924876d7d7216504e604137ed0ade36460169f (patch)
tree0667a56d9fb77f5c1427bd44ed097997ea825c8a /host/lib/usrp/usrp_e
parentcbd9e1da0866893d86320787a99cf4257478c539 (diff)
downloaduhd-1b924876d7d7216504e604137ed0ade36460169f.tar.gz
uhd-1b924876d7d7216504e604137ed0ade36460169f.tar.bz2
uhd-1b924876d7d7216504e604137ed0ade36460169f.zip
usrp-e branch compiling with recent master pulled in
Diffstat (limited to 'host/lib/usrp/usrp_e')
-rw-r--r--host/lib/usrp/usrp_e/dboard_iface.cpp19
-rw-r--r--host/lib/usrp/usrp_e/dboard_impl.cpp8
-rw-r--r--host/lib/usrp/usrp_e/dsp_impl.cpp8
-rw-r--r--host/lib/usrp/usrp_e/mboard_impl.cpp15
-rw-r--r--host/lib/usrp/usrp_e/usrp_e_iface.cpp6
-rw-r--r--host/lib/usrp/usrp_e/usrp_e_iface.hpp4
-rw-r--r--host/lib/usrp/usrp_e/usrp_e_impl.cpp5
7 files changed, 32 insertions, 33 deletions
diff --git a/host/lib/usrp/usrp_e/dboard_iface.cpp b/host/lib/usrp/usrp_e/dboard_iface.cpp
index 12e8fe206..c4784d29c 100644
--- a/host/lib/usrp/usrp_e/dboard_iface.cpp
+++ b/host/lib/usrp/usrp_e/dboard_iface.cpp
@@ -23,6 +23,7 @@
#include <boost/assign/list_of.hpp>
#include <linux/usrp_e.h> //i2c and spi constants
+using namespace uhd;
using namespace uhd::usrp;
class usrp_e_dboard_iface : public dboard_iface{
@@ -37,8 +38,8 @@ public:
void set_gpio_ddr(unit_t, boost::uint16_t);
boost::uint16_t read_gpio(unit_t);
- void write_i2c(int, const byte_vector_t &);
- byte_vector_t read_i2c(int, size_t);
+ void write_i2c(boost::uint8_t, const byte_vector_t &);
+ byte_vector_t read_i2c(boost::uint8_t, size_t);
void write_spi(
unit_t unit,
@@ -171,14 +172,14 @@ boost::uint32_t usrp_e_dboard_iface::read_write_spi(
**********************************************************************/
static const size_t max_i2c_data_bytes = 10;
-void usrp_e_dboard_iface::write_i2c(int i2c_addr, const byte_vector_t &buf){
+void usrp_e_dboard_iface::write_i2c(boost::uint8_t addr, const byte_vector_t &buf){
//allocate some memory for this transaction
- ASSERT_THROW(buf.size() <= max_i2c_data_bytes);
+ UHD_ASSERT_THROW(buf.size() <= max_i2c_data_bytes);
boost::uint8_t mem[sizeof(usrp_e_i2c) + max_i2c_data_bytes];
//load the data struct
usrp_e_i2c &data = reinterpret_cast<usrp_e_i2c&>(mem);
- data.addr = i2c_addr;
+ data.addr = addr;
data.len = buf.size();
std::copy(buf.begin(), buf.end(), data.data);
@@ -186,14 +187,14 @@ void usrp_e_dboard_iface::write_i2c(int i2c_addr, const byte_vector_t &buf){
_iface->ioctl(USRP_E_I2C_WRITE, &data);
}
-dboard_iface::byte_vector_t usrp_e_dboard_iface::read_i2c(int i2c_addr, size_t num_bytes){
+byte_vector_t usrp_e_dboard_iface::read_i2c(boost::uint8_t addr, size_t num_bytes){
//allocate some memory for this transaction
- ASSERT_THROW(num_bytes <= max_i2c_data_bytes);
+ UHD_ASSERT_THROW(num_bytes <= max_i2c_data_bytes);
boost::uint8_t mem[sizeof(usrp_e_i2c) + max_i2c_data_bytes];
//load the data struct
usrp_e_i2c &data = reinterpret_cast<usrp_e_i2c&>(mem);
- data.addr = i2c_addr;
+ data.addr = addr;
data.len = num_bytes;
//call the spi ioctl
@@ -201,7 +202,7 @@ dboard_iface::byte_vector_t usrp_e_dboard_iface::read_i2c(int i2c_addr, size_t n
//unload the data
byte_vector_t ret(data.len);
- ASSERT_THROW(ret.size() == num_bytes);
+ UHD_ASSERT_THROW(ret.size() == num_bytes);
std::copy(data.data, data.data+ret.size(), ret.begin());
return ret;
}
diff --git a/host/lib/usrp/usrp_e/dboard_impl.cpp b/host/lib/usrp/usrp_e/dboard_impl.cpp
index df0f1d9a9..e87a2c0a5 100644
--- a/host/lib/usrp/usrp_e/dboard_impl.cpp
+++ b/host/lib/usrp/usrp_e/dboard_impl.cpp
@@ -50,26 +50,26 @@ void usrp_e_impl::dboard_init(void){
* RX Dboard Get
**********************************************************************/
void usrp_e_impl::rx_dboard_get(const wax::obj &, wax::obj &){
-
+ UHD_THROW_PROP_GET_ERROR();
}
/***********************************************************************
* RX Dboard Set
**********************************************************************/
void usrp_e_impl::rx_dboard_set(const wax::obj &, const wax::obj &){
-
+ UHD_THROW_PROP_SET_ERROR();
}
/***********************************************************************
* TX Dboard Get
**********************************************************************/
void usrp_e_impl::tx_dboard_get(const wax::obj &, wax::obj &){
-
+ UHD_THROW_PROP_GET_ERROR();
}
/***********************************************************************
* TX Dboard Set
**********************************************************************/
void usrp_e_impl::tx_dboard_set(const wax::obj &, const wax::obj &){
-
+ UHD_THROW_PROP_SET_ERROR();
}
diff --git a/host/lib/usrp/usrp_e/dsp_impl.cpp b/host/lib/usrp/usrp_e/dsp_impl.cpp
index e32c76a3d..272ac71b3 100644
--- a/host/lib/usrp/usrp_e/dsp_impl.cpp
+++ b/host/lib/usrp/usrp_e/dsp_impl.cpp
@@ -34,14 +34,14 @@ void usrp_e_impl::rx_ddc_init(void){
* RX DDC Get
**********************************************************************/
void usrp_e_impl::rx_ddc_get(const wax::obj &, wax::obj &){
-
+ UHD_THROW_PROP_GET_ERROR();
}
/***********************************************************************
* RX DDC Set
**********************************************************************/
void usrp_e_impl::rx_ddc_set(const wax::obj &, const wax::obj &){
-
+ UHD_THROW_PROP_SET_ERROR();
}
/***********************************************************************
@@ -58,12 +58,12 @@ void usrp_e_impl::tx_duc_init(void){
* TX DUC Get
**********************************************************************/
void usrp_e_impl::tx_duc_get(const wax::obj &, wax::obj &){
-
+ UHD_THROW_PROP_GET_ERROR();
}
/***********************************************************************
* TX DUC Set
**********************************************************************/
void usrp_e_impl::tx_duc_set(const wax::obj &, const wax::obj &){
-
+ UHD_THROW_PROP_SET_ERROR();
}
diff --git a/host/lib/usrp/usrp_e/mboard_impl.cpp b/host/lib/usrp/usrp_e/mboard_impl.cpp
index 2d225c6ea..00ce4b782 100644
--- a/host/lib/usrp/usrp_e/mboard_impl.cpp
+++ b/host/lib/usrp/usrp_e/mboard_impl.cpp
@@ -58,7 +58,7 @@ void usrp_e_impl::mboard_get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_RX_DBOARD:
- ASSERT_THROW(name == "");
+ UHD_ASSERT_THROW(name == "");
val = _rx_dboard_proxy->get_link();
return;
@@ -67,7 +67,7 @@ void usrp_e_impl::mboard_get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_TX_DBOARD:
- ASSERT_THROW(name == "");
+ UHD_ASSERT_THROW(name == "");
val = _tx_dboard_proxy->get_link();
return;
@@ -80,7 +80,7 @@ void usrp_e_impl::mboard_get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_RX_DSP:
- ASSERT_THROW(name == "ddc0");
+ UHD_ASSERT_THROW(name == "ddc0");
val = _rx_ddc_proxy->get_link();
return;
@@ -89,7 +89,7 @@ void usrp_e_impl::mboard_get(const wax::obj &key_, wax::obj &val){
return;
case MBOARD_PROP_TX_DSP:
- ASSERT_THROW(name == "duc0");
+ UHD_ASSERT_THROW(name == "duc0");
val = _tx_duc_proxy->get_link();
return;
@@ -101,10 +101,7 @@ void usrp_e_impl::mboard_get(const wax::obj &key_, wax::obj &val){
val = _clock_config;
return;
- case MBOARD_PROP_TIME_NOW:
- case MBOARD_PROP_TIME_NEXT_PPS:
- throw std::runtime_error("Error: trying to get write-only property on usrp-e mboard");
-
+ default: UHD_THROW_PROP_GET_ERROR();
}
}
@@ -112,5 +109,5 @@ void usrp_e_impl::mboard_get(const wax::obj &key_, wax::obj &val){
* Mboard Set
**********************************************************************/
void usrp_e_impl::mboard_set(const wax::obj &, const wax::obj &){
-
+ UHD_THROW_PROP_SET_ERROR();
}
diff --git a/host/lib/usrp/usrp_e/usrp_e_iface.cpp b/host/lib/usrp/usrp_e/usrp_e_iface.cpp
index d4c988211..f12eee177 100644
--- a/host/lib/usrp/usrp_e/usrp_e_iface.cpp
+++ b/host/lib/usrp/usrp_e/usrp_e_iface.cpp
@@ -100,7 +100,7 @@ public:
******************************************************************/
boost::uint32_t transact_spi(
int which_slave,
- const uhd::usrp::spi_config_t &config,
+ const uhd::spi_config_t &config,
boost::uint32_t bits,
size_t num_bits,
bool readback
@@ -114,8 +114,8 @@ public:
//load the flags
data.flags = 0;
- data.flags |= (config.miso_edge == uhd::usrp::spi_config_t::EDGE_RISE)? UE_SPI_LATCH_RISE : UE_SPI_LATCH_FALL;
- data.flags |= (config.mosi_edge == uhd::usrp::spi_config_t::EDGE_RISE)? UE_SPI_PUSH_FALL : UE_SPI_PUSH_RISE;
+ data.flags |= (config.miso_edge == uhd::spi_config_t::EDGE_RISE)? UE_SPI_LATCH_RISE : UE_SPI_LATCH_FALL;
+ data.flags |= (config.mosi_edge == uhd::spi_config_t::EDGE_RISE)? UE_SPI_PUSH_FALL : UE_SPI_PUSH_RISE;
//call the spi ioctl
this->ioctl(USRP_E_SPI, &data);
diff --git a/host/lib/usrp/usrp_e/usrp_e_iface.hpp b/host/lib/usrp/usrp_e/usrp_e_iface.hpp
index 4fc3bb33d..850e15ac4 100644
--- a/host/lib/usrp/usrp_e/usrp_e_iface.hpp
+++ b/host/lib/usrp/usrp_e/usrp_e_iface.hpp
@@ -19,7 +19,7 @@
#define INCLUDED_USRP_E_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
diff --git a/host/lib/usrp/usrp_e/usrp_e_impl.cpp b/host/lib/usrp/usrp_e/usrp_e_impl.cpp
index 4d08210e2..211b939ee 100644
--- a/host/lib/usrp/usrp_e/usrp_e_impl.cpp
+++ b/host/lib/usrp/usrp_e/usrp_e_impl.cpp
@@ -112,7 +112,7 @@ void usrp_e_impl::get(const wax::obj &key_, wax::obj &val){
return;
case DEVICE_PROP_MBOARD:
- ASSERT_THROW(name == "");
+ UHD_ASSERT_THROW(name == "");
val = _mboard_proxy->get_link();
return;
@@ -128,6 +128,7 @@ void usrp_e_impl::get(const wax::obj &key_, wax::obj &val){
val = size_t(_max_num_samples);
return;
+ default: UHD_THROW_PROP_GET_ERROR();
}
}
@@ -135,7 +136,7 @@ void usrp_e_impl::get(const wax::obj &key_, wax::obj &val){
* Device Set
**********************************************************************/
void usrp_e_impl::set(const wax::obj &, const wax::obj &){
- throw std::runtime_error("Cannot set in usrp-e device");
+ UHD_THROW_PROP_SET_ERROR();
}
/***********************************************************************