aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-06-17 17:58:18 -0700
committerJosh Blum <josh@joshknows.com>2012-06-18 15:53:18 -0700
commit3dd244bb9f17c7641f4a60b4e10f5978382432df (patch)
treee755f507ad3b1c0d03744fdaf7c0a1db8a98f9ff /host/lib/usrp
parentd9157133fbd23c2e550ed46840da3ebbafa52d5c (diff)
downloaduhd-3dd244bb9f17c7641f4a60b4e10f5978382432df.tar.gz
uhd-3dd244bb9f17c7641f4a60b4e10f5978382432df.tar.bz2
uhd-3dd244bb9f17c7641f4a60b4e10f5978382432df.zip
usrp2: created fw peek/poke functions
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp20
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.hpp8
2 files changed, 22 insertions, 6 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index 7c26e2e71..316e38da8 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -122,12 +122,12 @@ public:
void lock_device(bool lock){
if (lock){
- this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_GPID, boost::uint32_t(get_gpid()));
+ this->pokefw(U2_FW_REG_LOCK_GPID, boost::uint32_t(get_gpid()));
_lock_task = task::make(boost::bind(&usrp2_iface_impl::lock_task, this));
}
else{
_lock_task.reset(); //shutdown the task
- this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_TIME, 0); //unlock
+ this->pokefw(U2_FW_REG_LOCK_TIME, 0); //unlock
}
}
@@ -135,8 +135,8 @@ public:
//never assume lock with fpga image mismatch
if ((this->peek32(U2_REG_COMPAT_NUM_RB) >> 16) != USRP2_FPGA_COMPAT_NUM) return false;
- boost::uint32_t lock_time = this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_PEEK32>(U2_FW_REG_LOCK_TIME);
- boost::uint32_t lock_gpid = this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_PEEK32>(U2_FW_REG_LOCK_GPID);
+ boost::uint32_t lock_time = this->peekfw(U2_FW_REG_LOCK_TIME);
+ boost::uint32_t lock_gpid = this->peekfw(U2_FW_REG_LOCK_GPID);
//may not be the right tick rate, but this is ok for locking purposes
const boost::uint32_t lock_timeout_time = boost::uint32_t(3*100e6);
@@ -152,7 +152,7 @@ public:
void lock_task(void){
//re-lock in task
- this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_TIME, this->get_curr_time());
+ this->pokefw(U2_FW_REG_LOCK_TIME, this->get_curr_time());
//sleep for a bit
boost::this_thread::sleep(boost::posix_time::milliseconds(1500));
}
@@ -180,6 +180,16 @@ public:
return this->get_reg<boost::uint16_t, USRP2_REG_ACTION_FPGA_PEEK16>(addr);
}
+ void pokefw(wb_addr_type addr, boost::uint32_t data)
+ {
+ this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(addr, data);
+ }
+
+ boost::uint32_t peekfw(wb_addr_type addr)
+ {
+ return this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_PEEK32>(addr);
+ }
+
template <class T, usrp2_reg_action_t action>
T get_reg(wb_addr_type addr, T data = 0){
//setup the out data
diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp
index 95d899b7f..ed4de02d5 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.hpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011 Ettus Research LLC
+// Copyright 2010-2012 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -43,6 +43,12 @@ public:
*/
static sptr make(uhd::transport::udp_simple::sptr ctrl_transport);
+ //! poke a register in the virtual fw table
+ virtual void pokefw(wb_addr_type addr, boost::uint32_t data) = 0;
+
+ //! peek a register in the virtual fw table
+ virtual boost::uint32_t peekfw(wb_addr_type addr) = 0;
+
//! The list of possible revision types
enum rev_type {
USRP2_REV3 = 3,