aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/usrp2_impl.cpp
diff options
context:
space:
mode:
authorPhilip Balister <philip@opensdr.com>2010-04-13 16:38:42 +0000
committerPhilip Balister <philip@opensdr.com>2010-04-13 16:38:42 +0000
commitf1838b9284a124fcfb5996eaf1647a69b4473278 (patch)
tree15e69f3641f8919fae201ec002a2edfc61f6cb42 /host/lib/usrp/usrp2/usrp2_impl.cpp
parentb59c54e334dfc1c6ab7da81c62038444f93efe61 (diff)
parent41a515f3f97ae77b7c1b4371fdef7c085dce8c1c (diff)
downloaduhd-f1838b9284a124fcfb5996eaf1647a69b4473278.tar.gz
uhd-f1838b9284a124fcfb5996eaf1647a69b4473278.tar.bz2
uhd-f1838b9284a124fcfb5996eaf1647a69b4473278.zip
Merge branch 'usrp_e' of git@ettus.sourcerepo.com:ettus/uhd into usrp_e
Diffstat (limited to 'host/lib/usrp/usrp2/usrp2_impl.cpp')
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index b3a22e175..a7be2da8c 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -174,28 +174,47 @@ double usrp2_impl::get_master_clock_freq(void){
return 100e6;
}
-void usrp2_impl::poke(boost::uint32_t addr, boost::uint32_t data){
+template <class T> void impl_poke(usrp2_impl *impl, boost::uint32_t addr, T data){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_POKE_THIS_REGISTER_FOR_ME_BRO);
out_data.data.poke_args.addr = htonl(addr);
- out_data.data.poke_args.data = htonl(data);
+ out_data.data.poke_args.data = htonl(boost::uint32_t(data));
+ out_data.data.poke_args.num_bytes = sizeof(T);
//send and recv
- usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data);
+ usrp2_ctrl_data_t in_data = impl->ctrl_send_and_recv(out_data);
ASSERT_THROW(htonl(in_data.id) == USRP2_CTRL_ID_OMG_POKED_REGISTER_SO_BAD_DUDE);
}
-boost::uint32_t usrp2_impl::peek(boost::uint32_t addr){
+template <class T> T impl_peek(usrp2_impl *impl, boost::uint32_t addr){
//setup the out data
usrp2_ctrl_data_t out_data;
out_data.id = htonl(USRP2_CTRL_ID_PEEK_AT_THIS_REGISTER_FOR_ME_BRO);
out_data.data.poke_args.addr = htonl(addr);
+ out_data.data.poke_args.num_bytes = sizeof(T);
//send and recv
- usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data);
+ usrp2_ctrl_data_t in_data = impl->ctrl_send_and_recv(out_data);
ASSERT_THROW(htonl(in_data.id) == USRP2_CTRL_ID_WOAH_I_DEFINITELY_PEEKED_IT_DUDE);
- return ntohl(out_data.data.poke_args.data);
+ return T(ntohl(out_data.data.poke_args.data));
+}
+
+
+void usrp2_impl::poke32(boost::uint32_t addr, boost::uint32_t data){
+ return impl_poke<boost::uint32_t>(this, addr, data);
+}
+
+boost::uint32_t usrp2_impl::peek32(boost::uint32_t addr){
+ return impl_peek<boost::uint32_t>(this, addr);
+}
+
+void usrp2_impl::poke16(boost::uint32_t addr, boost::uint16_t data){
+ return impl_poke<boost::uint16_t>(this, addr, data);
+}
+
+boost::uint16_t usrp2_impl::peek16(boost::uint32_t addr){
+ return impl_peek<boost::uint16_t>(this, addr);
}
/***********************************************************************
@@ -236,12 +255,12 @@ void usrp2_impl::get(const wax::obj &key_, wax::obj &val){
return;
case DEVICE_PROP_MBOARD:
- ASSERT_THROW(_mboards.has_key(name));
- val = _mboards[name]->get_link();
+ ASSERT_THROW(name == "");
+ val = _mboard_proxy->get_link();
return;
case DEVICE_PROP_MBOARD_NAMES:
- val = prop_names_t(_mboards.get_keys());
+ val = prop_names_t(1, "");
return;
case DEVICE_PROP_MAX_RX_SAMPLES: