1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 01:20:56 -05:00

LimeSDR support (2)

This commit is contained in:
f4exb 2017-04-11 18:13:40 +02:00
parent fb161a09c6
commit e96a7294dd
4 changed files with 145 additions and 8 deletions

View File

@ -12,8 +12,12 @@ if(LIBUSB_FOUND AND LIBHACKRF_FOUND)
add_subdirectory(hackrf) add_subdirectory(hackrf)
endif(LIBUSB_FOUND AND LIBHACKRF_FOUND) endif(LIBUSB_FOUND AND LIBHACKRF_FOUND)
find_package(LimeSuite)
if(LIMESUITE_FOUND AND LIBHACKRF_FOUND)
add_subdirectory(limesdr)
endif(LIMESUITE_FOUND AND LIBHACKRF_FOUND)
if (BUILD_DEBIAN) if (BUILD_DEBIAN)
add_subdirectory(bladerf) add_subdirectory(bladerf)
add_subdirectory(hackrf) add_subdirectory(hackrf)
endif (BUILD_DEBIAN) endif (BUILD_DEBIAN)

View File

@ -1,6 +1,7 @@
project(limesdrdevice) project(limesdrdevice)
set(limesdrdevice_SOURCES set(limesdrdevice_SOURCES
devicelimesdrparam.cpp
) )
set(limesdrdevice_HEADERS set(limesdrdevice_HEADERS

View File

@ -0,0 +1,98 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QDebug>
#include "devicelimesdrparam.h"
bool DeviceLimeSDRParams::open(lms_info_str_t deviceStr)
{
if (LMS_Open(&m_dev, deviceStr, 0))
{
QDebug() << "DeviceLimeSDRParams::open: cannot open device " << deviceStr;
return false;
}
if (LMS_Init(m_dev) != 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot init device " << deviceStr;
return false;
}
int n;
if ((n = LMS_GetNumChannels(m_dev, LMS_CH_RX)) < 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot get the number of Rx channels for device " << deviceStr;
return false;
}
else
{
m_nbRxChannels = n;
QDebug() << "DeviceLimeSDRParams::open: " << n << " Rx channels for device " << deviceStr;
}
if ((n = LMS_GetNumChannels(m_dev, LMS_CH_TX)) < 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot get the number of Tx channels for device " << deviceStr;
return false;
}
else
{
m_nbTxChannels = n;
QDebug() << "DeviceLimeSDRParams::open: " << n << " Tx channels for device " << deviceStr;
}
if (LMS_GetLPFBWRange(m_dev, LMS_CH_RX, &m_lpfRangeRx) != 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot get the Rx LPF range for device " << deviceStr;
return false;
}
if (LMS_GetLPFBWRange(m_dev, LMS_CH_TX, &m_lpfRangeTx) != 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot get the Tx LPF range for device " << deviceStr;
return false;
}
if (LMS_GetLOFrequencyRange(m_dev, LMS_CH_RX, &m_lpfRangeRx) != 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot get the Rx LO range for device " << deviceStr;
return false;
}
if (LMS_GetLOFrequencyRange(m_dev, LMS_CH_TX, &m_lpfRangeTx) != 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot get the Tx LO range for device " << deviceStr;
return false;
}
if (LMS_GetSampleRateRange(m_dev, LMS_CH_RX, &m_srRangeRx) != 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot get the Rx sample rate range for device " << deviceStr;
return false;
}
if (LMS_GetSampleRateRange(m_dev, LMS_CH_TX, &m_srRangeTx) != 0)
{
QDebug() << "DeviceLimeSDRParams::open: cannot get the Tx sample rate range for device " << deviceStr;
return false;
}
return true;
}

View File

@ -20,23 +20,57 @@
#include "lime/LimeSuite.h" #include "lime/LimeSuite.h"
/** /**
* This structure is owned by each of the parties sharing the same physical device * This structure refers to one physical device shared among parties (logical devices represented by
* It allows exchange of information on the common resources * the DeviceSinkAPI or DeviceSourceAPI).
* It allows storing information on the common resources in one place and is shared among participants.
* There is only one copy that is constructed by the first participant and destroyed by the last.
* A participant knows it is the first or last by checking the lists of buddies (Rx + Tx).
*/ */
struct DeviceLimeSDRParams struct DeviceLimeSDRParams
{ {
lms_device_t *m_dev; //!< device handle if the party has ownership else 0 lms_device_t *m_dev; //!< device handle if the party has ownership else 0
int m_nbRxChannels; //!< number of Rx channels (normally 2, we'll see if we really use it...)
int m_nbTxChannels; //!< number of Tx channels (normally 2, we'll see if we really use it...)
lms_range_t m_lpfRangeRx; //!< Low pass filter range information (Rx side) lms_range_t m_lpfRangeRx; //!< Low pass filter range information (Rx side)
lms_range_t m_lpfRangeTx; //!< Low pass filter range information (Tx side) lms_range_t m_lpfRangeTx; //!< Low pass filter range information (Tx side)
lms_range_t m_loRangeRx[2]; //!< LO range for Rx lms_range_t m_loRangeRx; //!< LO range for Rx
lms_range_t m_loRangeTx[2]; //!< LO range for Tx lms_range_t m_loRangeTx; //!< LO range for Tx
lms_range_t m_srRangeRx[2]; //!< ADC sample rate range lms_range_t m_srRangeRx; //!< ADC sample rate range
lms_range_t m_srRangeTx[2]; //!< DAC sample rate range lms_range_t m_srRangeTx; //!< DAC sample rate range
float m_sampleRate; //!< ADC/DAC sample rate
int m_log2OvSRRx; //!< log2 of Rx oversampling (0..5)
int m_log2OvSRTx; //!< log2 of Tx oversampling (0..5)
float m_rxFrequency; //!< Rx frequency
float m_txFrequency; //!< Tx frequency
DeviceLimeSDRParams() : DeviceLimeSDRParams() :
m_dev(0) m_dev(0),
m_nbRxChannels(0),
m_nbTxChannels(0),
m_sampleRate(1e6),
m_log2OvSRRx(0),
m_log2OvSRTx(0),
m_rxFrequency(1e6),
m_txFrequency(1e6)
{ {
} }
/**
* Opens and initialize the device and obtain information (# channels, ranges, ...)
*/
bool open(lms_info_str_t deviceStr);
~DeviceLimeSDRParams()
{
if (m_dev)
{
LMS_Close(m_dev);
m_dev = 0;
}
}
private:
void close();
}; };
#endif /* DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ */ #endif /* DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ */