aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Tsou <tom@tsou.cc>2014-12-15 20:23:33 -0800
committerTom Tsou <tom@tsou.cc>2014-12-15 20:25:27 -0800
commit93b7f373097f3b1563ff327ffa163846b8da0987 (patch)
tree698dc80f777dcb42b38bff004f3fefa811786d50
parent4ad9ea69aba4a556d105e55cc5b67c5b3fc78fca (diff)
b210: Lock dual-channel tuning access
Frequency tuning is a multi-step process with RF and DDC/DUC protoimns that can be corrupted if both channels attempt to tune at the same time. Signed-off-by: Tom Tsou <tom@tsou.cc>
-rw-r--r--Transceiver52M/UHDDevice.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index d81fdc3..130a915 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -380,6 +380,7 @@ private:
Thread *async_event_thrd;
bool diversity;
+ Mutex tune_lock;
};
void *async_event_loop(uhd_device *dev)
@@ -1145,6 +1146,7 @@ bool uhd_device::setTxFreq(double wFreq, size_t chan)
LOG(ALERT) << "Requested non-existent channel " << chan;
return false;
}
+ ScopedLock lock(tune_lock);
return set_freq(wFreq, chan, true);
}
@@ -1155,6 +1157,7 @@ bool uhd_device::setRxFreq(double wFreq, size_t chan)
LOG(ALERT) << "Requested non-existent channel " << chan;
return false;
}
+ ScopedLock lock(tune_lock);
return set_freq(wFreq, chan, false);
}