aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/include/uhd/utils/pimpl.hpp3
-rw-r--r--host/lib/usrp/usrp_e/dboard_iface.cpp2
-rw-r--r--host/lib/usrp/usrp_e/dboard_impl.cpp37
-rw-r--r--host/lib/usrp/usrp_e/io_impl.cpp18
-rw-r--r--host/lib/usrp/usrp_e/usrp_e_iface.cpp22
-rw-r--r--host/lib/usrp/usrp_e/usrp_e_impl.hpp5
6 files changed, 33 insertions, 54 deletions
diff --git a/host/include/uhd/utils/pimpl.hpp b/host/include/uhd/utils/pimpl.hpp
index 18454f0c4..09bf0c0a2 100644
--- a/host/include/uhd/utils/pimpl.hpp
+++ b/host/include/uhd/utils/pimpl.hpp
@@ -20,7 +20,6 @@
#include <uhd/config.hpp>
#include <boost/shared_ptr.hpp>
-#include <boost/make_shared.hpp>
/*! \file pimpl.hpp
* "Pimpl idiom" (pointer to implementation idiom).
@@ -51,6 +50,6 @@
* \param _args the constructor args for the pimpl
*/
#define UHD_PIMPL_MAKE(_name, _args) \
- boost::make_shared<_name> _args
+ boost::shared_ptr<_name>(new _name _args)
#endif /* INCLUDED_UHD_UTILS_PIMPL_HPP */
diff --git a/host/lib/usrp/usrp_e/dboard_iface.cpp b/host/lib/usrp/usrp_e/dboard_iface.cpp
index ce00cd40d..d5ec10d84 100644
--- a/host/lib/usrp/usrp_e/dboard_iface.cpp
+++ b/host/lib/usrp/usrp_e/dboard_iface.cpp
@@ -50,6 +50,8 @@ public:
/* NOP */
}
+ std::string get_mboard_name(void){return "usrp-e";}
+
void write_aux_dac(unit_t, aux_dac_t, float);
float read_aux_adc(unit_t, aux_adc_t);
diff --git a/host/lib/usrp/usrp_e/dboard_impl.cpp b/host/lib/usrp/usrp_e/dboard_impl.cpp
index a384c71a0..4d3f70dfe 100644
--- a/host/lib/usrp/usrp_e/dboard_impl.cpp
+++ b/host/lib/usrp/usrp_e/dboard_impl.cpp
@@ -51,10 +51,6 @@ void usrp_e_impl::dboard_init(void){
boost::bind(&usrp_e_impl::tx_dboard_get, this, _1, _2),
boost::bind(&usrp_e_impl::tx_dboard_set, this, _1, _2)
);
-
- //init the subdevs in use (use the first subdevice)
- rx_dboard_set(DBOARD_PROP_USED_SUBDEVS, prop_names_t(1, _dboard_manager->get_rx_subdev_names().at(0)));
- tx_dboard_set(DBOARD_PROP_USED_SUBDEVS, prop_names_t(1, _dboard_manager->get_tx_subdev_names().at(0)));
}
/***********************************************************************
@@ -78,10 +74,6 @@ void usrp_e_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
val = _dboard_manager->get_rx_subdev_names();
return;
- case DBOARD_PROP_USED_SUBDEVS:
- val = _rx_subdevs_in_use;
- return;
-
case DBOARD_PROP_DBOARD_ID:
val = _rx_db_eeprom.id;
return;
@@ -99,18 +91,6 @@ void usrp_e_impl::rx_dboard_get(const wax::obj &key_, wax::obj &val){
**********************************************************************/
void usrp_e_impl::rx_dboard_set(const wax::obj &key, const wax::obj &val){
switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_USED_SUBDEVS:{
- _rx_subdevs_in_use = val.as<prop_names_t>();
- UHD_ASSERT_THROW(_rx_subdevs_in_use.size() == 1);
- wax::obj rx_subdev = _dboard_manager->get_rx_subdev(_rx_subdevs_in_use.at(0));
- std::cout << "Using: " << rx_subdev[SUBDEV_PROP_NAME].as<std::string>() << std::endl;
- _iface->poke32(UE_REG_DSP_RX_MUX, dsp_type1::calc_rx_mux_word(
- rx_subdev[SUBDEV_PROP_QUADRATURE].as<bool>(),
- rx_subdev[SUBDEV_PROP_IQ_SWAPPED].as<bool>()
- ));
- }
- return;
-
case DBOARD_PROP_DBOARD_ID:
_rx_db_eeprom.id = val.as<dboard_id_t>();
_iface->write_eeprom(I2C_ADDR_RX_DB, 0, _rx_db_eeprom.get_eeprom_bytes());
@@ -141,10 +121,6 @@ void usrp_e_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
val = _dboard_manager->get_tx_subdev_names();
return;
- case DBOARD_PROP_USED_SUBDEVS:
- val = _tx_subdevs_in_use;
- return;
-
case DBOARD_PROP_DBOARD_ID:
val = _tx_db_eeprom.id;
return;
@@ -161,18 +137,7 @@ void usrp_e_impl::tx_dboard_get(const wax::obj &key_, wax::obj &val){
* TX Dboard Set
**********************************************************************/
void usrp_e_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val){
- switch(key.as<dboard_prop_t>()){
- case DBOARD_PROP_USED_SUBDEVS:{
- _tx_subdevs_in_use = val.as<prop_names_t>();
- UHD_ASSERT_THROW(_tx_subdevs_in_use.size() == 1);
- wax::obj tx_subdev = _dboard_manager->get_tx_subdev(_tx_subdevs_in_use.at(0));
- std::cout << "Using: " << tx_subdev[SUBDEV_PROP_NAME].as<std::string>() << std::endl;
- _iface->poke32(UE_REG_DSP_TX_MUX, dsp_type1::calc_tx_mux_word(
- tx_subdev[SUBDEV_PROP_IQ_SWAPPED].as<bool>()
- ));
- }
- return;
-
+ switch(key.as<dboard_prop_t>()){
case DBOARD_PROP_DBOARD_ID:
_tx_db_eeprom.id = val.as<dboard_id_t>();
_iface->write_eeprom(I2C_ADDR_TX_DB, 0, _tx_db_eeprom.get_eeprom_bytes());
diff --git a/host/lib/usrp/usrp_e/io_impl.cpp b/host/lib/usrp/usrp_e/io_impl.cpp
index ecde9ca27..0742c4514 100644
--- a/host/lib/usrp/usrp_e/io_impl.cpp
+++ b/host/lib/usrp/usrp_e/io_impl.cpp
@@ -24,6 +24,7 @@
#include <linux/usrp_e.h> //transfer frame struct
#include <poll.h>
#include <boost/format.hpp>
+#include <boost/thread.hpp>
#include <iostream>
using namespace uhd;
@@ -35,7 +36,6 @@ using namespace uhd::usrp;
static const size_t MAX_BUFF_SIZE = 2048;
static const size_t vrt_header_offset_words32 = sizeof(usrp_transfer_frame)/sizeof(boost::uint32_t);
static const bool usrp_e_io_impl_verbose = true;
-static const size_t recv_timeout_ms = 100;
/***********************************************************************
* Data Transport (phony zero-copy with read/write)
@@ -61,6 +61,8 @@ public:
return 10; //FIXME no idea!
}
+ size_t recv_timeout_ms;
+
private:
int _fd;
ssize_t send(const boost::asio::const_buffer &buff){
@@ -220,13 +222,17 @@ size_t usrp_e_impl::recv(
size_t num_samps,
rx_metadata_t &metadata,
const io_type_t &io_type,
- recv_mode_t recv_mode
+ recv_mode_t recv_mode,
+ size_t timeout_ms
){
otw_type_t recv_otw_type;
recv_otw_type.width = 16;
recv_otw_type.shift = 0;
recv_otw_type.byteorder = otw_type_t::BO_LITTLE_ENDIAN;
+ //hand-off the timeout to the transport
+ _io_impl->transport.recv_timeout_ms = timeout_ms;
+
return vrt_packet_handler::recv(
_io_impl->packet_handler_recv_state, //last state of the recv handler
buffs, num_samps, //buffer to fill
@@ -239,3 +245,11 @@ size_t usrp_e_impl::recv(
vrt_header_offset_words32
);
}
+
+/***********************************************************************
+ * Dummy Async Recv
+ **********************************************************************/
+bool usrp_e_impl::recv_async_msg(async_metadata_t &, size_t timeout_ms){
+ boost::this_thread::sleep(boost::posix_time::milliseconds(timeout_ms));
+ return false;
+}
diff --git a/host/lib/usrp/usrp_e/usrp_e_iface.cpp b/host/lib/usrp/usrp_e/usrp_e_iface.cpp
index 21e91452f..f00e92946 100644
--- a/host/lib/usrp/usrp_e/usrp_e_iface.cpp
+++ b/host/lib/usrp/usrp_e/usrp_e_iface.cpp
@@ -123,13 +123,13 @@ public:
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 = addr;
- data.len = bytes.size();
- std::copy(bytes.begin(), bytes.end(), data.data);
+ usrp_e_i2c *data = reinterpret_cast<usrp_e_i2c*>(mem);
+ data->addr = addr;
+ data->len = bytes.size();
+ std::copy(bytes.begin(), bytes.end(), data->data);
//call the spi ioctl
- this->ioctl(USRP_E_I2C_WRITE, &data);
+ this->ioctl(USRP_E_I2C_WRITE, data);
}
byte_vector_t read_i2c(boost::uint8_t addr, size_t num_bytes){
@@ -138,17 +138,17 @@ public:
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 = addr;
- data.len = num_bytes;
+ usrp_e_i2c *data = reinterpret_cast<usrp_e_i2c*>(mem);
+ data->addr = addr;
+ data->len = num_bytes;
//call the spi ioctl
- this->ioctl(USRP_E_I2C_READ, &data);
+ this->ioctl(USRP_E_I2C_READ, data);
//unload the data
- byte_vector_t bytes(data.len);
+ byte_vector_t bytes(data->len);
UHD_ASSERT_THROW(bytes.size() == num_bytes);
- std::copy(data.data, data.data+bytes.size(), bytes.begin());
+ std::copy(data->data, data->data+bytes.size(), bytes.begin());
return bytes;
}
diff --git a/host/lib/usrp/usrp_e/usrp_e_impl.hpp b/host/lib/usrp/usrp_e/usrp_e_impl.hpp
index efbf9f68f..4bbe100c1 100644
--- a/host/lib/usrp/usrp_e/usrp_e_impl.hpp
+++ b/host/lib/usrp/usrp_e/usrp_e_impl.hpp
@@ -82,7 +82,8 @@ public:
//the io interface
size_t send(const std::vector<const void *> &, size_t, const uhd::tx_metadata_t &, const uhd::io_type_t &, send_mode_t);
- size_t recv(const std::vector<void *> &, size_t, uhd::rx_metadata_t &, const uhd::io_type_t &, recv_mode_t);
+ size_t recv(const std::vector<void *> &, size_t, uhd::rx_metadata_t &, const uhd::io_type_t &, recv_mode_t, size_t);
+ bool recv_async_msg(uhd::async_metadata_t &, size_t);
size_t get_max_send_samps_per_packet(void) const{return 503;}
size_t get_max_recv_samps_per_packet(void) const{return 503;}
@@ -128,14 +129,12 @@ private:
uhd::usrp::dboard_eeprom_t _rx_db_eeprom;
void rx_dboard_get(const wax::obj &, wax::obj &);
void rx_dboard_set(const wax::obj &, const wax::obj &);
- uhd::prop_names_t _rx_subdevs_in_use;
wax_obj_proxy::sptr _rx_dboard_proxy;
//tx dboard functions and settings
uhd::usrp::dboard_eeprom_t _tx_db_eeprom;
void tx_dboard_get(const wax::obj &, wax::obj &);
void tx_dboard_set(const wax::obj &, const wax::obj &);
- uhd::prop_names_t _tx_subdevs_in_use;
wax_obj_proxy::sptr _tx_dboard_proxy;
//rx ddc functions and settings