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>
This commit is contained in:
Tom Tsou 2014-12-15 20:23:33 -08:00
parent 4ad9ea69ab
commit 93b7f37309
1 changed files with 3 additions and 0 deletions

View File

@ -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);
}