aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/usrp2_impl.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-03-31 17:43:20 -0700
committerJosh Blum <josh@joshknows.com>2010-03-31 17:43:20 -0700
commit38248b816c75bcf60eca69244d363cae2397ce47 (patch)
tree5d8f7880a89fe8c25e4f1af224ea048293de1bfb /host/lib/usrp/usrp2/usrp2_impl.cpp
parentf7867f4a510eb2b83b1a11bc3f08e3d74e6877ba (diff)
downloaduhd-38248b816c75bcf60eca69244d363cae2397ce47.tar.gz
uhd-38248b816c75bcf60eca69244d363cae2397ce47.tar.bz2
uhd-38248b816c75bcf60eca69244d363cae2397ce47.zip
Refactor ATR part of dboard interface (and some constants).
Added peek and poke to the dude/bro protocol. Started moving more control code through peek and poke. Added usrp_regs.hpp to be like memory map for slave perifs.
Diffstat (limited to 'host/lib/usrp/usrp2/usrp2_impl.cpp')
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index b0ee395fb..e89fe8a63 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -173,6 +173,30 @@ double usrp2_impl::get_master_clock_freq(void){
return 100e6;
}
+void usrp2_impl::poke(boost::uint32_t addr, boost::uint32_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);
+
+ //send and recv
+ usrp2_ctrl_data_t in_data = this->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){
+ //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);
+
+ //send and recv
+ usrp2_ctrl_data_t in_data = this->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);
+}
+
/***********************************************************************
* Control Send/Recv
**********************************************************************/