aboutsummaryrefslogtreecommitdiffstats
path: root/lib/usrp/usrp.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-12 18:07:55 -0800
committerJosh Blum <josh@joshknows.com>2010-02-12 18:07:55 -0800
commit9fff25f4e5da179ea29ff44278e0415a337870cb (patch)
treecfbee4cf2921fd4bd415e3af1c1d466f79bab3d7 /lib/usrp/usrp.cpp
parent350f5c5decca20a54132867283448fd32226bbc2 (diff)
downloaduhd-9fff25f4e5da179ea29ff44278e0415a337870cb.tar.gz
uhd-9fff25f4e5da179ea29ff44278e0415a337870cb.tar.bz2
uhd-9fff25f4e5da179ea29ff44278e0415a337870cb.zip
Added a templated dictionary class because its more useful than map.
Made the device addrs into a string:string dict. If its all strings we dont have to change the top level caller for new product. Created shared_iovec class to manage memory for device recvs. Work on the bro/dude control protocol for usrp2.
Diffstat (limited to 'lib/usrp/usrp.cpp')
-rw-r--r--lib/usrp/usrp.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/usrp/usrp.cpp b/lib/usrp/usrp.cpp
index c49a63d49..68b423538 100644
--- a/lib/usrp/usrp.cpp
+++ b/lib/usrp/usrp.cpp
@@ -16,6 +16,7 @@
//
#include <uhd/usrp/usrp.hpp>
+#include <uhd/usrp/mboard/usrp2.hpp>
#include <uhd/usrp/mboard/test.hpp>
#include <uhd/utils.hpp>
#include <boost/format.hpp>
@@ -32,22 +33,28 @@ static void send_raw_default(const std::vector<boost::asio::const_buffer> &){
throw std::runtime_error("No callback registered for send raw");
}
-static boost::asio::const_buffer recv_raw_default(void){
+static uhd::shared_iovec recv_raw_default(void){
throw std::runtime_error("No callback registered for recv raw");
}
/***********************************************************************
* the usrp device wrapper
**********************************************************************/
-usrp::usrp(const device_addr_t & device_addr){
+usrp::usrp(const device_addr_t &device_addr){
//set the default callbacks, the code below should replace them
_send_raw_cb = boost::bind(&send_raw_default, _1);
_recv_raw_cb = boost::bind(&recv_raw_default);
//create mboard based on the device addr
- if (device_addr.type == DEVICE_ADDR_TYPE_VIRTUAL){
+ if (not device_addr.has_key("type")){
+ //TODO nothing
+ }
+ else if (device_addr["type"] == "test"){
_mboards[""] = mboard::base::sptr(new mboard::test(device_addr));
}
+ else if (device_addr["type"] == "udp"){
+ _mboards[""] = mboard::base::sptr(new mboard::usrp2(device_addr));
+ }
}
usrp::~usrp(void){
@@ -87,6 +94,6 @@ void usrp::send_raw(const std::vector<boost::asio::const_buffer> &buffs){
return _send_raw_cb(buffs);
}
-boost::asio::const_buffer usrp::recv_raw(void){
+uhd::shared_iovec usrp::recv_raw(void){
return _recv_raw_cb();
}