diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-01 17:32:43 +0000 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-01 17:32:43 +0000 |
commit | bcd80dae09776eddaf4fdf9c6fb925c0b2586a11 (patch) | |
tree | f6f3cc5b8ce4a59f0238c87c1e213b82f1d3c555 /host/lib/usrp/usrp_e/usrp_e_impl.cpp | |
parent | 8fd3ce07369a7962dc8eb5ace2007a80ad7dd907 (diff) | |
download | uhd-bcd80dae09776eddaf4fdf9c6fb925c0b2586a11.tar.gz uhd-bcd80dae09776eddaf4fdf9c6fb925c0b2586a11.tar.bz2 uhd-bcd80dae09776eddaf4fdf9c6fb925c0b2586a11.zip |
added peek and poke, using in dboard interface
Diffstat (limited to 'host/lib/usrp/usrp_e/usrp_e_impl.cpp')
-rw-r--r-- | host/lib/usrp/usrp_e/usrp_e_impl.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/host/lib/usrp/usrp_e/usrp_e_impl.cpp b/host/lib/usrp/usrp_e/usrp_e_impl.cpp index e821add8c..3fefd6787 100644 --- a/host/lib/usrp/usrp_e/usrp_e_impl.cpp +++ b/host/lib/usrp/usrp_e/usrp_e_impl.cpp @@ -16,12 +16,14 @@ // #include "usrp_e_impl.hpp" +#include <uhd/usrp/device_props.hpp> #include <uhd/utils/assert.hpp> #include <uhd/utils/static.hpp> #include <boost/format.hpp> #include <boost/filesystem.hpp> #include <fcntl.h> //open #include <sys/ioctl.h> //ioctl +#include <linux/usrp_e.h> using namespace uhd; using namespace uhd::usrp; @@ -113,6 +115,52 @@ void usrp_e_impl::ioctl(int request, void *mem){ } } +void usrp_e_impl::poke32(boost::uint32_t addr, boost::uint32_t value){ + //load the data struct + usrp_e_ctl32 data; + data.offset = addr; + data.count = 1; + data.buf[0] = value; + + //call the ioctl + this->ioctl(USRP_E_WRITE_CTL32, &data); +} + +void usrp_e_impl::poke16(boost::uint32_t addr, boost::uint16_t value){ + //load the data struct + usrp_e_ctl16 data; + data.offset = addr; + data.count = 1; + data.buf[0] = value; + + //call the ioctl + this->ioctl(USRP_E_WRITE_CTL16, &data); +} + +boost::uint32_t usrp_e_impl::peek32(boost::uint32_t addr){ + //load the data struct + usrp_e_ctl32 data; + data.offset = addr; + data.count = 1; + + //call the ioctl + this->ioctl(USRP_E_READ_CTL32, &data); + + return data.buf[0]; +} + +boost::uint16_t usrp_e_impl::peek16(boost::uint32_t addr){ + //load the data struct + usrp_e_ctl16 data; + data.offset = addr; + data.count = 1; + + //call the ioctl + this->ioctl(USRP_E_READ_CTL16, &data); + + return data.buf[0]; +} + /*********************************************************************** * Device Get **********************************************************************/ |