aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputUHD.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli (think) <matthias@mpb.li>2012-08-16 18:56:43 +0200
committerMatthias P. Braendli (think) <matthias@mpb.li>2012-08-16 18:56:43 +0200
commit63f6e31cad0276352dd508394742b3161dde77bf (patch)
treeca071abf8a14479b507e10b717dbd9d5727a39ee /src/OutputUHD.cpp
parent06fe89bd86fc709908c5882a2c48d03fc0977a25 (diff)
downloaddabmod-63f6e31cad0276352dd508394742b3161dde77bf.tar.gz
dabmod-63f6e31cad0276352dd508394742b3161dde77bf.tar.bz2
dabmod-63f6e31cad0276352dd508394742b3161dde77bf.zip
crc-dabmod: UHD remote control supports mutingr3
Diffstat (limited to 'src/OutputUHD.cpp')
-rw-r--r--src/OutputUHD.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index 808d0e1..a852c10 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -55,7 +55,9 @@ OutputUHD::OutputUHD(const char* device, unsigned sampleRate,
device, this);
/* register the parameters that can be remote controlled */
- RC_ADD_PARAMETER(txgain, "UHD analog daughterboard TX gain")
+ RC_ADD_PARAMETER(txgain, "UHD analog daughterboard TX gain");
+ RC_ADD_PARAMETER(freq, "UHD transmission frequency");
+ RC_ADD_PARAMETER(muting, "mute the output by stopping the transmitter");
myDevice = device;
@@ -96,7 +98,8 @@ OutputUHD::OutputUHD(const char* device, unsigned sampleRate,
//set the centre frequency
MDEBUG("OutputUHD:Setting freq to %f...\n", myFrequency);
myUsrp->set_tx_freq(myFrequency);
- MDEBUG("OutputUHD:Actual frequency: %f\n", myUsrp->get_tx_freq());
+ myFrequency = myUsrp->get_tx_freq();
+ MDEBUG("OutputUHD:Actual frequency: %f\n", myFrequency);
myUsrp->set_tx_gain(myTxGain);
MDEBUG("OutputUHD:Actual TX Gain: %f ...\n", myUsrp->get_tx_gain());
@@ -177,6 +180,8 @@ int OutputUHD::process(Buffer* dataIn, Buffer* dataOut)
{
struct frame_timestamp ts;
+ uwd.muting = myMuting;
+
// On the first call, we must do some allocation and we must fill
// the first buffer
// We will only wait on the barrier on the subsequent calls to
@@ -370,7 +375,7 @@ void UHDWorker::process(struct UHDWorkerData *uwd)
}
else { // !uwd->sourceContainsTimestamp
- if (uwd->muteNoTimestamps) {
+ if (uwd->muting || uwd->muteNoTimestamps) {
/* There was some error decoding the timestamp
*/
fprintf(stderr, "UHDOut: Muting sample %d : no timestamp\n",
@@ -390,7 +395,7 @@ void UHDWorker::process(struct UHDWorkerData *uwd)
MDEBUG("UHDWorker::process:num_tx_samps: %zu.\n", num_tx_samps);
*/
- while (running && (num_acc_samps < sizeIn)) {
+ while (running && !uwd->muting && (num_acc_samps < sizeIn)) {
size_t samps_to_send = std::min(sizeIn - num_acc_samps, bufsize);
//ensure the the last packet has EOB set if the timestamps has been refreshed
@@ -517,6 +522,16 @@ void OutputUHD::set_parameter(string parameter, string value)
myUsrp->set_tx_gain(myTxGain);
#endif
}
+ else if (parameter == "freq") {
+ ss >> myFrequency;
+#if ENABLE_UHD
+ myUsrp->set_tx_freq(myFrequency);
+ myFrequency = myUsrp->get_tx_freq();
+#endif
+ }
+ else if (parameter == "muting") {
+ ss >> myMuting;
+ }
else {
stringstream ss;
ss << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name();
@@ -530,6 +545,12 @@ string OutputUHD::get_parameter(string parameter)
if (parameter == "txgain") {
ss << myTxGain;
}
+ else if (parameter == "freq") {
+ ss << myFrequency;
+ }
+ else if (parameter == "muting") {
+ ss << myMuting;
+ }
else {
ss << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name();
throw ParameterError(ss.str());