aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/radioInterface.cpp
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-04-24 17:48:52 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-04-24 18:46:48 +0200
commit0fc20d14b31c116b758dbfb9a1988b619270a034 (patch)
treeff698cfcc48ef527c50ad323e565ecdbcabfbe7f /Transceiver52M/radioInterface.cpp
parenta4316ee4c5d2f097823616f1ca3fa82b2f25204c (diff)
Move device specific code out of radioInterface
This way code of radioInterface is independent of the device and doesn't need to be rebuild for each device. Change-Id: Id104e1edef02f863b6465ced5b4241050dc188f9
Diffstat (limited to 'Transceiver52M/radioInterface.cpp')
-rw-r--r--Transceiver52M/radioInterface.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp
index c3063ff..a377436 100644
--- a/Transceiver52M/radioInterface.cpp
+++ b/Transceiver52M/radioInterface.cpp
@@ -145,16 +145,31 @@ bool RadioInterface::tuneRx(double freq, size_t chan)
return mRadio->setRxFreq(freq, chan);
}
+/** synchronization thread loop */
+void *AlignRadioServiceLoopAdapter(RadioInterface *radioInterface)
+{
+ while (1) {
+ sleep(60);
+ radioInterface->alignRadio();
+ pthread_testcancel();
+ }
+ return NULL;
+}
+
+void RadioInterface::alignRadio() {
+ mRadio->updateAlignment(writeTimestamp+ (TIMESTAMP) 10000);
+}
+
bool RadioInterface::start()
{
if (mOn)
return true;
LOG(INFO) << "Starting radio device";
-#ifdef DEVICE_USRP1
- mAlignRadioServiceLoopThread.start((void * (*)(void*))AlignRadioServiceLoopAdapter,
- (void*)this);
-#endif
+ if (mRadio->requiresRadioAlign())
+ mAlignRadioServiceLoopThread.start(
+ (void * (*)(void*))AlignRadioServiceLoopAdapter,
+ (void*)this);
if (!mRadio->start())
return false;
@@ -191,22 +206,6 @@ bool RadioInterface::stop()
return true;
}
-#ifdef DEVICE_USRP1
-void *AlignRadioServiceLoopAdapter(RadioInterface *radioInterface)
-{
- while (1) {
- radioInterface->alignRadio();
- pthread_testcancel();
- }
- return NULL;
-}
-
-void RadioInterface::alignRadio() {
- sleep(60);
- mRadio->updateAlignment(writeTimestamp+ (TIMESTAMP) 10000);
-}
-#endif
-
void RadioInterface::driveTransmitRadio(std::vector<signalVector *> &bursts,
std::vector<bool> &zeros)
{