aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/usrp2_iface.cpp
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2014-02-04 11:04:07 -0800
committerBen Hilburn <ben.hilburn@ettus.com>2014-02-04 11:04:07 -0800
commit178ac3f1c9950d383c8f64b3df464c0f943c4a23 (patch)
tree318ed621a7b59b7d34d4ce6e4a92f73f0bcef509 /host/lib/usrp/usrp2/usrp2_iface.cpp
parent2718ac110fa931cc29daf7cb3dc5ab6230ee02ab (diff)
downloaduhd-178ac3f1c9950d383c8f64b3df464c0f943c4a23.tar.gz
uhd-178ac3f1c9950d383c8f64b3df464c0f943c4a23.tar.bz2
uhd-178ac3f1c9950d383c8f64b3df464c0f943c4a23.zip
Merging USRP X300 and X310 support!!
Diffstat (limited to 'host/lib/usrp/usrp2/usrp2_iface.cpp')
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp32
1 files changed, 3 insertions, 29 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index 5f97045e1..7297a30d1 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -36,6 +36,7 @@
#include <boost/filesystem.hpp>
#include <algorithm>
#include <iostream>
+#include <uhd/utils/platform.hpp>
using namespace uhd;
using namespace uhd::usrp;
@@ -62,33 +63,6 @@ static const boost::uint32_t MIN_PROTO_COMPAT_I2C = 7;
static const boost::uint32_t MIN_PROTO_COMPAT_REG = 10;
static const boost::uint32_t MIN_PROTO_COMPAT_UART = 7;
-//Define get_gpid() to get a globally unique identifier for this process.
-//The gpid is implemented as a hash of the pid and a unique machine identifier.
-#ifdef UHD_PLATFORM_WIN32
-#include <Windows.h>
-static inline size_t get_gpid(void){
- //extract volume serial number
- char szVolName[MAX_PATH+1], szFileSysName[MAX_PATH+1];
- DWORD dwSerialNumber, dwMaxComponentLen, dwFileSysFlags;
- GetVolumeInformation("C:\\", szVolName, MAX_PATH,
- &dwSerialNumber, &dwMaxComponentLen,
- &dwFileSysFlags, szFileSysName, sizeof(szFileSysName));
-
- size_t hash = 0;
- boost::hash_combine(hash, GetCurrentProcessId());
- boost::hash_combine(hash, dwSerialNumber);
- return hash;
-}
-#else
-#include <unistd.h>
-static inline size_t get_gpid(void){
- size_t hash = 0;
- boost::hash_combine(hash, getpid());
- boost::hash_combine(hash, gethostid());
- return hash;
-}
-#endif
-
class usrp2_iface_impl : public usrp2_iface{
public:
/***********************************************************************
@@ -122,7 +96,7 @@ public:
void lock_device(bool lock){
if (lock){
- this->pokefw(U2_FW_REG_LOCK_GPID, boost::uint32_t(get_gpid()));
+ this->pokefw(U2_FW_REG_LOCK_GPID, get_process_hash());
_lock_task = task::make(boost::bind(&usrp2_iface_impl::lock_task, this));
}
else{
@@ -147,7 +121,7 @@ public:
if (time_diff >= lock_timeout_time) return false;
//otherwise only lock if the device hash is different that ours
- return lock_gpid != boost::uint32_t(get_gpid());
+ return lock_gpid != get_process_hash();
}
void lock_task(void){