aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorF5OEO <evaristec@gmail.com>2018-12-10 16:51:29 +0000
committerF5OEO <evaristec@gmail.com>2018-12-10 16:51:29 +0000
commit352ee913f5cefc47d5cd1cf73b5b6a70b5369bef (patch)
treefc0e965fbb300c85b2d8df4da8d8f1f070aabf49
parente32b0ea9c39330cd3c039aa158599d1011812cf1 (diff)
downloaddabmod-352ee913f5cefc47d5cd1cf73b5b6a70b5369bef.tar.gz
dabmod-352ee913f5cefc47d5cd1cf73b5b6a70b5369bef.tar.bz2
dabmod-352ee913f5cefc47d5cd1cf73b5b6a70b5369bef.zip
Set minimal init
-rw-r--r--src/ConfigParser.cpp30
-rw-r--r--src/output/Lime.cpp48
-rw-r--r--src/output/Lime.h8
3 files changed, 66 insertions, 20 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index 69655b4..8c80513 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -307,6 +307,36 @@ static void parse_configfile(
mod_settings.useSoapyOutput = true;
}
#endif
+#if defined(HAVE_LIMESDR)
+ else if (output_selected == "limesdr") {
+ auto& outputlime_conf = mod_settings.sdr_device_config;
+ outputlime_conf.device = pt.Get("soapyoutput.device", "");
+ outputlime_conf.masterClockRate = pt.GetInteger("soapyoutput.master_clock_rate", 0);
+
+ outputlime_conf.txgain = pt.GetReal("soapyoutput.txgain", 0.0);
+ outputlime_conf.tx_antenna = pt.Get("soapyoutput.tx_antenna", "");
+ outputlime_conf.lo_offset = pt.GetReal("soapyoutput.lo_offset", 0.0);
+ outputlime_conf.frequency = pt.GetReal("soapyoutput.frequency", 0);
+ std::string chan = pt.Get("soapyoutput.channel", "");
+ outputlime_conf.dabMode = mod_settings.dabMode;
+
+ if (outputlime_conf.frequency == 0 && chan == "") {
+ std::cerr << " soapy output enabled, but neither frequency nor channel defined.\n";
+ throw std::runtime_error("Configuration error");
+ }
+ else if (outputlime_conf.frequency == 0) {
+ outputlime_conf.frequency = parseChannel(chan);
+ }
+ else if (outputlime_conf.frequency != 0 && chan != "") {
+ std::cerr << " soapy output: cannot define both frequency and channel.\n";
+ throw std::runtime_error("Configuration error");
+ }
+
+ outputlime_conf.dpdFeedbackServerPort = pt.GetInteger("soapyoutput.dpd_port", 0);
+
+ mod_settings.useLimeOutput = true;
+ }
+#endif
#if defined(HAVE_ZEROMQ)
else if (output_selected == "zmq") {
mod_settings.outputName = pt.Get("zmqoutput.listen", "");
diff --git a/src/output/Lime.cpp b/src/output/Lime.cpp
index 82a42be..e67e90e 100644
--- a/src/output/Lime.cpp
+++ b/src/output/Lime.cpp
@@ -53,22 +53,40 @@ Lime::Lime(SDRDeviceConfig& config) :
etiLog.level(info) <<
"Lime:Creating the device with: " <<
m_conf.device;
- /*
- try {
- m_device = SoapySDR::Device::make(m_conf.device);
- stringstream ss;
- ss << "SoapySDR driver=" << m_device->getDriverKey();
- ss << " hardware=" << m_device->getHardwareKey();
- for (const auto &it : m_device->getHardwareInfo()) {
- ss << " " << it.first << "=" << it.second;
- }
- }
- catch (const std::exception &ex) {
- etiLog.level(error) << "Error making SoapySDR device: " <<
- ex.what();
- throw std::runtime_error("Cannot create SoapySDR output");
- }
+ int device_count = LMS_GetDeviceList(NULL);
+ if (device_count < 0)
+ {
+ etiLog.level(error) << "Error making LimeSDR device: " << LMS_GetLastErrorMessage();
+ throw std::runtime_error("Cannot find LimeSDR output device");
+
+ }
+ lms_info_str_t device_list[device_count];
+ if (LMS_GetDeviceList(device_list) < 0)
+ {
+ etiLog.level(error) << "Error making LimeSDR device: %s " << LMS_GetLastErrorMessage();
+ throw std::runtime_error("Cannot find LimeSDR output device");
+
+ }
+ unsigned int device_i=0; // If several cards, need to get device by configuration
+ if (LMS_Open(&m_device, device_list[device_i], NULL) < 0)
+ {
+ etiLog.level(error) << "Error making LimeSDR device: %s " << LMS_GetLastErrorMessage();
+ throw std::runtime_error("Cannot open LimeSDR output device");
+ }
+ if (LMS_Reset(m_device) < 0)
+ {
+ etiLog.level(error) << "Error making LimeSDR device: %s " << LMS_GetLastErrorMessage();
+ throw std::runtime_error("Cannot reset LimeSDR output device");
+ }
+
+ if (LMS_Init(m_device) < 0)
+ {
+ etiLog.level(error) << "Error making LimeSDR device: %s " << LMS_GetLastErrorMessage();
+ throw std::runtime_error("Cannot init LimeSDR output device");
+ }
+
+ /*
m_device->setMasterClockRate(m_conf.masterClockRate);
etiLog.level(info) << "SoapySDR master clock rate set to " <<
std::fixed << std::setprecision(4) <<
diff --git a/src/output/Lime.h b/src/output/Lime.h
index ad594c0..1770aaf 100644
--- a/src/output/Lime.h
+++ b/src/output/Lime.h
@@ -3,13 +3,11 @@
Queen in Right of Canada (Communications Research Center Canada)
Copyright (C) 2018
- Matthias P. Braendli, matthias.braendli@mpb.li
-
- http://opendigitalradio.org
+ Evariste F5OEO, evaristec@gmail.com
+
DESCRIPTION:
- It is an output driver using the SoapySDR library that can output to
- many devices.
+ It is an output driver using the LimeSDR library.
*/
/*